0.1.160: Mail: reine Textbriefe ohne Anhang/Gold moeglich; Items-Hinweis umbrechen

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
Claude
2026-10-28 23:36:22 +01:00
parent 396e446875
commit 2eb5eb2727
4 changed files with 17 additions and 7 deletions
+9 -2
View File
@@ -759,7 +759,8 @@ function Mail:BuildCompose(form)
if IsSelf(to) then return nil, "self" end
local picks = form.picks or {}
local money = math.floor(tonumber(form.money) or 0)
if #picks == 0 and money <= 0 then return nil, "nothing" end
-- Ein reiner Textbrief (ohne Anhang und Gold) ist erlaubt; leer ist nur, wer weder Betreff noch Text noch Anhang hat
if #picks == 0 and money <= 0 and Trim(form.subject) == "" and Trim(form.body) == "" then return nil, "nothing" end
if form.cod and #picks == 0 then return nil, "codItem" end
if form.cod and money <= 0 then return nil, "codMoney" end
local base = Trim(form.subject)
@@ -770,7 +771,13 @@ function Mail:BuildCompose(form)
local subject = base
if subject == "" then
local info = pick and Util.GetItem and Util.GetItem(pick.id)
subject = (info and info.name) or FW.L.MAIL_SUBJECT_DEFAULT
subject = (info and info.name) or ""
if subject == "" then
-- Textbrief ohne Betreff: erste Zeile des Textes
local first = Trim(tostring(form.body or ""):match("^[^\r\n]*") or "")
if #first > 40 then first = first:sub(1, 40) end
subject = first ~= "" and first or FW.L.MAIL_SUBJECT_DEFAULT
end
end
if n > 1 then subject = string.format(FW.L.MAIL_SUBJECT_ITEM_N, subject, i, n) end
local job = { to = to, subject = subject, body = form.body or "", item = pick }