mirror of
https://github.com/Lacustat/Freewood-OctoWoW-Mail.git
synced 2026-11-02 13:17:03 +00:00
0.1.161: Brett-Briefe mit Kennung, gruene Darstellung, Mail-Pflicht fuer Brief-Auftraege, doppelte Abfrage, Knopf-Reihen ohne Ueberlappung
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
## Notes: Own mailbox window: open all or selected mails safely, recent recipients, mailing lists with automatic sending, multi-item mails, gold surplus and cash on delivery.
|
||||
## Notes-deDE: Eigenes Briefkasten-Fenster: alles oder Ausgewähltes sicher öffnen, letzte Empfänger, Mailinglisten mit Automatik, mehrere Items, Gold-Überschuss und Nachnahme.
|
||||
## Author: Lacustat
|
||||
## Version: 0.1.160
|
||||
## Version: 0.1.161
|
||||
## Dependencies: Freewood-OctoWoW-Core
|
||||
## OptionalDeps: Freewood-OctoWoW-Creator, Freewood-OctoWoW-Brett
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ FW:AddLocale("enUS", {
|
||||
MAIL_BOARD_BUSY = "A board mission is preparing a mail. Finish it in the mission window first; this window waits.",
|
||||
MAIL_BUSY = "Another action is running. Please wait.",
|
||||
MAIL_BOARD_TITLE = "Board mission letter",
|
||||
MAIL_BOARD_TAG = "Board mission",
|
||||
MAIL_BOARD_FILLING = "The letter is being prepared ...",
|
||||
MAIL_BOARD_READY_AUTO = "Everything is correct. The letter is sent automatically.",
|
||||
MAIL_BOARD_READY_MANUAL = "Everything is correct. Click \"Send now\".",
|
||||
@@ -207,6 +208,7 @@ FW:AddLocale("deDE", {
|
||||
MAIL_BOARD_BUSY = "Ein Brett-Auftrag bereitet gerade einen Brief vor. Erst im Auftragsfenster abschließen; dieses Fenster wartet.",
|
||||
MAIL_BUSY = "Es läuft gerade eine andere Aktion. Bitte warten.",
|
||||
MAIL_BOARD_TITLE = "Brief für einen Brett-Auftrag",
|
||||
MAIL_BOARD_TAG = "Brett-Auftrag",
|
||||
MAIL_BOARD_FILLING = "Der Brief wird vorbereitet ...",
|
||||
MAIL_BOARD_READY_AUTO = "Alles stimmt. Der Brief wird automatisch gesendet.",
|
||||
MAIL_BOARD_READY_MANUAL = "Alles stimmt. Klicke auf \"Jetzt senden\".",
|
||||
|
||||
@@ -364,6 +364,35 @@ function Mail:RemoveMail(m)
|
||||
return true, own and "own" or "archived"
|
||||
end
|
||||
|
||||
-- Kennung der Brett-Briefe (vom Freewood-Briefkasten geschrieben): gruen darstellen
|
||||
local GREEN = "|cff6cc070"
|
||||
function Mail.IsBoardSubject(s)
|
||||
local tag = "[Brett] "
|
||||
return type(s) == "string" and s:sub(1, #tag) == tag
|
||||
end
|
||||
function Mail.ColorSubject(s)
|
||||
s = tostring(s or "")
|
||||
if Mail.IsBoardSubject(s) then return GREEN .. "[Brett]|r " .. s:sub(9) end
|
||||
return s
|
||||
end
|
||||
function Mail.ColorBody(text)
|
||||
text = tostring(text or "")
|
||||
if text:sub(1, 16) ~= "[Freewood Brett]" then return text end
|
||||
local out, data, first = {}, false, true
|
||||
for line in (text .. "\n"):gmatch("(.-)\n") do
|
||||
if first then
|
||||
first = false
|
||||
out[#out + 1] = GREEN .. FW.L.MAIL_BOARD_TAG .. "|r"
|
||||
elseif not data and not line:find("FW%d+:") then
|
||||
out[#out + 1] = GREEN .. line .. "|r"
|
||||
else
|
||||
data = true
|
||||
out[#out + 1] = line
|
||||
end
|
||||
end
|
||||
return table.concat(out, "\n")
|
||||
end
|
||||
|
||||
-- Brett-Brief: Ein Brett-Auftrag bereitet einen Brief vor (Creator befuellt das verdeckte Briefformular).
|
||||
-- Mit ersetztem Briefkasten zeigt unser Fenster den Stand und sendet selbst, sobald alles stimmt.
|
||||
function Mail.BoardLetter()
|
||||
|
||||
+16
-7
@@ -340,17 +340,17 @@ local function BuildInbox(parent)
|
||||
d.attach:SetWordWrap(false)
|
||||
d.bodyScroll = UI.CreateScrollFrame(d)
|
||||
d.bodyScroll:SetPoint("TOPLEFT", d, "TOPLEFT", 12, -76)
|
||||
d.bodyScroll:SetPoint("BOTTOMRIGHT", d, "BOTTOMRIGHT", -12, 100)
|
||||
d.bodyScroll:SetPoint("BOTTOMRIGHT", d, "BOTTOMRIGHT", -12, 132)
|
||||
d.body = UI.CreateLabel(d.bodyScroll.child, "", { size = 12, justifyV = "TOP" })
|
||||
d.body:SetPoint("TOPLEFT", d.bodyScroll.child, "TOPLEFT", 2, -2)
|
||||
d.msg = UI.CreateLabel(d, "", { size = 11, color = "danger" })
|
||||
d.msg:SetPoint("BOTTOMLEFT", d, "BOTTOMLEFT", 12, 76)
|
||||
d.msg:SetPoint("BOTTOMLEFT", d, "BOTTOMLEFT", 12, 108)
|
||||
d.msg:SetPoint("RIGHT", d, "RIGHT", -12, 0)
|
||||
d.msg:SetWordWrap(false)
|
||||
d.take = UI.CreateButton(d, T("MAIL_TAKE_ITEM"), 120, 26, nil, "primary")
|
||||
d.take:SetPoint("BOTTOMLEFT", d, "BOTTOMLEFT", 12, 12)
|
||||
d.take:SetPoint("BOTTOMLEFT", d, "BOTTOMLEFT", 12, 76) -- drei feste Reihen: Nehmen / Zurueck / Antworten + Loeschen
|
||||
d.reply = UI.CreateButton(d, T("MAIL_REPLY"), 80, 26, nil, "default")
|
||||
d.reply:SetPoint("LEFT", d.take, "RIGHT", 6, 0)
|
||||
d.reply:SetPoint("BOTTOMLEFT", d, "BOTTOMLEFT", 12, 12)
|
||||
d.ret = UI.CreateButton(d, T("MAIL_RETURN"), 170, 26, nil, "default")
|
||||
d.ret:SetPoint("BOTTOMLEFT", d, "BOTTOMLEFT", 12, 44)
|
||||
UI.AttachTooltip(d.ret, function() return T("MAIL_RETURN") end, function() return T("MAIL_RETURN_TIP") end)
|
||||
@@ -486,10 +486,19 @@ local function BuildInbox(parent)
|
||||
view.key = cur.key
|
||||
if f.shownKey ~= cur.key then
|
||||
f.shownKey = cur.key
|
||||
f.bodyTries = 0
|
||||
f.bodyText = Mail.ReadText(cur.i)
|
||||
if FW.Brett and FW.Brett.CheckMailData then pcall(FW.Brett.CheckMailData, cur.i) end
|
||||
elseif (f.bodyText or "") == "" and (f.bodyTries or 0) < 5 then
|
||||
-- der Server liefert den Brieftext manchmal erst einen Moment spaeter: noch einmal lesen
|
||||
f.bodyTries = (f.bodyTries or 0) + 1
|
||||
f.bodyText = Mail.ReadText(cur.i)
|
||||
if (f.bodyText or "") == "" and C_Timer and C_Timer.After then
|
||||
local key = cur.key
|
||||
C_Timer.After(0.7, function() if f.shownKey == key and f:IsShown() then f.Refresh() end end)
|
||||
end
|
||||
end
|
||||
d.subj:SetText(cur.subject ~= "" and cur.subject or T("MAIL_ARCH_NOSUBJECT"))
|
||||
d.subj:SetText(cur.subject ~= "" and Mail.ColorSubject(cur.subject) or T("MAIL_ARCH_NOSUBJECT"))
|
||||
d.meta:SetText(string.format(T("MAIL_DETAIL_FROM"), cur.sender) .. (cur.days and (" " .. string.format(T("MAIL_ROW_DAYS"), math.floor(cur.days))) or ""))
|
||||
local parts = {}
|
||||
if cur.hasItem then parts[#parts + 1] = string.format(T("MAIL_ATTACH_ITEM"), (cur.itemName or "?") .. ((cur.itemCount or 1) > 1 and (" x" .. cur.itemCount) or "")) end
|
||||
@@ -498,7 +507,7 @@ local function BuildInbox(parent)
|
||||
if cur.cod > 0 then attach = attach .. " |cffff7060" .. string.format(T("MAIL_ATTACH_COD"), Mail.Money(cur.cod)) .. "|r" end
|
||||
d.attach:SetText(attach)
|
||||
local text = f.bodyText or ""
|
||||
d.body:SetText(text ~= "" and text or "|cff8a8f9a" .. T("MAIL_DETAIL_NOTEXT") .. "|r")
|
||||
d.body:SetText(text ~= "" and Mail.ColorBody(text) or "|cff8a8f9a" .. T("MAIL_DETAIL_NOTEXT") .. "|r")
|
||||
local bw = math.max(200, (d.bodyScroll:GetWidth() or 0) - 22)
|
||||
local h = UI.FitLabel(d.body, bw, 20)
|
||||
d.bodyScroll:SetContentHeight(h + 8)
|
||||
@@ -538,7 +547,7 @@ local function BuildInbox(parent)
|
||||
else
|
||||
row.icon:SetTexture("Interface\\Icons\\INV_Misc_Note_01")
|
||||
end
|
||||
row.l1:SetText(m.subject ~= "" and m.subject or m.sender)
|
||||
row.l1:SetText(m.subject ~= "" and Mail.ColorSubject(m.subject) or m.sender)
|
||||
local parts = {}
|
||||
if m.hasItem then parts[#parts + 1] = (m.itemName or "?") .. ((m.itemCount or 1) > 1 and (" x" .. m.itemCount) or "") end
|
||||
if m.money > 0 then parts[#parts + 1] = Mail.Money(m.money) end
|
||||
|
||||
Reference in New Issue
Block a user