From d0a5b5ca2aa8dd50f1bfe55655f345e930549156 Mon Sep 17 00:00:00 2001 From: Freewood <948+freewood@noreply.octowow.st> Date: Thu, 29 Oct 2026 00:35:58 +0000 Subject: [PATCH] Dateien nach "/" hochladen --- Codex.lua | 75 ++++++++++++++++++++++++++++++++++++++++++++++------- Locales.lua | 12 +++++---- 2 files changed, 72 insertions(+), 15 deletions(-) diff --git a/Codex.lua b/Codex.lua index e20c3b9..a8d4c5b 100644 --- a/Codex.lua +++ b/Codex.lua @@ -3283,15 +3283,43 @@ function Codex.ItemLoadStart(ids, resume) Step() end -function Codex:CaptureStats(ids) - local n = 0 - for _, id in ipairs(ids or {}) do - if self.db.istats == nil or self.db.istats[id] == nil then - if self:GetStats(id) then n = n + 1 end +-- Werte aller Items lesen: in kleinen Zeitscheiben (hoechstens CAP_MS je Bild), Rest per Timer. +-- Vorher las ein einziger Aufruf tausende Items in einem Bild (Tooltip-Lesen je Item) und fror den Client Sekunden bis Minuten ein. +local CAP_MS = 6 +local capList, capPos, capTimer = nil, 1, false +local function CapNow() + return _G.debugprofilestop and _G.debugprofilestop() or ((_G.GetTime and _G.GetTime() or 0) * 1000) +end +local function CapRun() + local ids = capList + if not ids then return 0 end + local n, t0 = 0, CapNow() + local store = Codex.db.istats + while capPos <= #ids do + local id = ids[capPos] + capPos = capPos + 1 + if store == nil or store[id] == nil then + if Codex:GetStats(id) then n = n + 1 end + store = Codex.db.istats + if CapNow() - t0 >= CAP_MS then break end end end + if capPos <= #ids then + if not capTimer and _G.C_Timer and C_Timer.After then + capTimer = true + C_Timer.After(0.05, function() capTimer = false CapRun() end) + end + else + capList = nil + if n > 0 then FW:Fire("CODEX_ITEMS_LOADED") end + end return n end +function Codex:CaptureStats(ids) + if not ids then return 0 end + if capList ~= ids then capList, capPos = ids, 1 end + return CapRun() +end -- Anzeigename eines Wertes ("ITEM_MOD_AGILITY_SHORT" -> "Beweglichkeit") function Codex.StatName(key) @@ -3371,7 +3399,15 @@ function Codex:ItemName(itemID) if seed then return seed end - return Codex.ExtraItemName and Codex.ExtraItemName(itemID) or nil + local extra = Codex.ExtraItemName and Codex.ExtraItemName(itemID) + if extra then return extra end + -- mitgelieferter Katalog (Startdaten): Name ohne Serverabfrage + local Cat = Codex.Catalog + if Cat and Cat.GetItem then + local nm = Cat.GetItem(itemID) + if nm then return nm end + end + return nil end ------------------------------------------------------------------------ @@ -4252,9 +4288,14 @@ end -- Itemdaten (Qualitaet, Typ, Preis) nachladen; feuert CODEX_ITEMS_LOADED, wenn etwas angekommen ist. -- Rueckgabe: Zahl neu angeforderter Items -function Codex:LoadItemInfo(ids) - local started = 0 - for _, id in ipairs(ids) do +local loadList, loadPos, loadTimer = nil, 1, false +local function LoadRun() + local ids = loadList + if not ids then return 0 end + local started, t0 = 0, CapNow() + while loadPos <= #ids do + local id = ids[loadPos] + loadPos = loadPos + 1 if not state.requested[id] and not Util.GetItem(id) then state.requested[id] = true state.pendingInfo = state.pendingInfo + 1 @@ -4263,16 +4304,30 @@ function Codex:LoadItemInfo(ids) state.pendingInfo = math.max(0, state.pendingInfo - 1) if not state.infoTimer then state.infoTimer = true - C_Timer.After(0.5, function() + C_Timer.After(1.5, function() state.infoTimer = nil FW:Fire("CODEX_ITEMS_LOADED") end) end end) end + if CapNow() - t0 >= CAP_MS then break end + end + if loadPos <= #ids then + if not loadTimer and _G.C_Timer and C_Timer.After then + loadTimer = true + C_Timer.After(0.05, function() loadTimer = false LoadRun() end) + end + else + loadList = nil end return started end +function Codex:LoadItemInfo(ids) + if not ids then return 0 end + if loadList ~= ids then loadList, loadPos = ids, 1 end + return LoadRun() +end -- Durchschnittlicher Wert einer gelooteten Leiche in Kupfer: tatsaechliches Gold plus Haendlerwert -- der Items nach Drop-Chance und Durchschnittsmenge. Rueckgabe: gesamt, gold, items, Items ohne Preisdaten diff --git a/Locales.lua b/Locales.lua index 9d31679..27a2800 100644 --- a/Locales.lua +++ b/Locales.lua @@ -182,8 +182,9 @@ FW:AddLocale("enUS", { CODEX_SORTBY_ahkill = "Value per kill (auction)", CODEX_SORTBY_gpmah = "Gold per minute (auction)", CODEX_FILTER_AH = "Auction (g)", - CODEX_BAD_MARK = "Mark as faulty", + CODEX_BAD_MARK = "Mark faulty", CODEX_BAD_UNMARK = "Unmark faulty", + CODEX_BAD_TIP = "Hides this entry for all players (permitted characters only). Click again to remove the mark.", CODEX_SORTBY_flip = "Vendor profit (auction)", CODEX_AH_AGE = "Last scan", CODEX_AH_TODAY = "today", @@ -530,7 +531,7 @@ FW:AddLocale("enUS", { CODEX_TEST_SHARE = "Sharing: %s, %d own records, %d players with %d records stored", CODEX_ON = "on", CODEX_OFF = "off", - CODEX_NAME_EDIT = "Edit name", + CODEX_NAME_EDIT = "Change name", CODEX_NAME_IMPORT = "Paste names", CODEX_NAME_DE = "German", CODEX_NAME_EN = "English", @@ -725,8 +726,9 @@ FW:AddLocale("deDE", { CODEX_SORTBY_ahkill = "Wert pro Kill (Auktion)", CODEX_SORTBY_gpmah = "Gold pro Minute (Auktion)", CODEX_FILTER_AH = "Auktion (g)", - CODEX_BAD_MARK = "Fehlerhaft markieren", - CODEX_BAD_UNMARK = "Markierung aufheben", + CODEX_BAD_MARK = "Fehlerhaft", + CODEX_BAD_UNMARK = "Fehlerhaft aufheben", + CODEX_BAD_TIP = "Blendet diesen Eintrag bei allen Spielern aus (nur berechtigte Charaktere). Erneut klicken hebt die Markierung auf.", CODEX_SORTBY_flip = "Händlergewinn (Auktion)", CODEX_AH_AGE = "Letzter Scan", CODEX_AH_TODAY = "heute", @@ -1073,7 +1075,7 @@ FW:AddLocale("deDE", { CODEX_TEST_SHARE = "Teilen: %s, %d eigene Datensätze, %d Spieler mit %d gespeicherten Datensätzen", CODEX_ON = "an", CODEX_OFF = "aus", - CODEX_NAME_EDIT = "Name bearbeiten", + CODEX_NAME_EDIT = "Name ändern", CODEX_NAME_IMPORT = "Namen einfügen", CODEX_NAME_DE = "Deutsch", CODEX_NAME_EN = "Englisch",