mirror of
https://github.com/Lacustat/Freewood-OctoWoW-Mail.git
synced 2026-10-31 00:56:59 +00:00
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:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user