0.1.162: Brett: Nachnahme-Pruefung gegen eigenen Auftrag, Annahme auch bei offline Geber, Annahme-Fenster; Mail: Loeschen bei Nachnahme = zuruecksenden

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
Lacustat
2026-10-29 00:30:42 +01:00
co-authored by Claude Sonnet 5.5
parent 94d580ccd6
commit c861012b2e
4 changed files with 59 additions and 7 deletions
+31 -4
View File
@@ -366,15 +366,39 @@ end
-- Kennung der Brett-Briefe (vom Freewood-Briefkasten geschrieben): gruen darstellen
local GREEN = "|cff6cc070"
-- Kennung steht vorn, bei Nachnahme steht "(COD) " davor
local function BoardTagPos(s)
if type(s) ~= "string" then return nil end
local a, b = s:find("[Brett] ", 1, true)
if a and a <= 12 then return a, b end
return nil
end
function Mail.IsBoardSubject(s)
local tag = "[Brett] "
return type(s) == "string" and s:sub(1, #tag) == tag
return BoardTagPos(s) ~= nil
end
function Mail.ColorSubject(s)
s = tostring(s or "")
if Mail.IsBoardSubject(s) then return GREEN .. "[Brett]|r " .. s:sub(9) end
local a, b = BoardTagPos(s)
if a then return s:sub(1, a - 1) .. GREEN .. "[Brett]|r " .. s:sub(b + 1) end
return s
end
-- Nachnahme-Briefe werden NIE geloescht: auch ueber das Blizzard-Fenster wird "Loeschen" zu "An Absender zurueck"
if not Mail.deleteWrapped and _G.DeleteInboxItem and _G.ReturnInboxItem and _G.GetInboxHeaderInfo then
Mail.deleteWrapped = true
local origDelete = _G.DeleteInboxItem
_G.DeleteInboxItem = function(i, ...)
if not Mail.allowDelete then
local ok, _, _, sender, _, _, cod, _, hasItem = pcall(_G.GetInboxHeaderInfo, i)
if ok and tonumber(cod) and cod > 0 then
pcall(_G.ReturnInboxItem, i)
if FW.Print and FW.L.MAIL_COD_RETURNED then FW:Print(FW.L.MAIL_COD_RETURNED) end
return
end
end
return origDelete(i, ...)
end
end
function Mail.ColorBody(text)
text = tostring(text or "")
if text:sub(1, 16) ~= "[Freewood Brett]" then return text end
@@ -470,7 +494,9 @@ function Mail:TakeOne(m)
local B = FW.Brett
if B and B.InspectMail then
local ok, st = pcall(B.InspectMail, m.i)
if ok and (st == "high" or st == "nodeal") then return false, "codbad" end
if ok and st == "high" then return false, "codbad" end
if ok and st == "nodeal" then return false, "codnodeal" end
if ok and st == "taken" then return false, "codtaken" end
end
if ((GetMoney and GetMoney()) or 0) < m.cod then return false, "codmoney" end
end
@@ -481,6 +507,7 @@ function Mail:TakeOne(m)
elseif m.hasItem then
if Mail.FreeSlots() <= KEEP_FREE then return false, "full" end
NoteTaken(m, "item")
if m.cod > 0 and FW.Brett and FW.Brett.NoteDelivered then pcall(FW.Brett.NoteDelivered, m.sender, m.subject) end
pcall(TakeInboxItem, m.i)
return true
end