0.1.156: Brief an Absender zurueck; Codex-Datenbank ohne langes Einfrieren (Item-Werte in Zeitscheiben)

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 22:48:19 +01:00
parent 756d3cad35
commit 16c7ab655d
3 changed files with 58 additions and 11 deletions
+56 -9
View File
@@ -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)
@@ -4260,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
@@ -4271,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
+1 -1
View File
@@ -358,7 +358,7 @@ local function ItemIndex()
local CatGet = Codex.Catalog and Codex.Catalog.GetItem
if Codex.Forever and Codex.Forever.ItemIds then
for id in pairs(Codex.Forever.ItemIds()) do
if not index[id] and (Util.GetItem(id) or (CatGet and CatGet(id))) then
if not index[id] and ((CatGet and CatGet(id)) or Util.GetItem(id)) then
local it = Codex.Forever.Item(id)
local f = { zones = {}, best = 0, fe = true }
if it then
+1 -1
View File
@@ -3,7 +3,7 @@
## Notes: Learns quests, creatures and drops while you play: who gives and takes a quest, rewards, objectives, drop chances.
## Notes-deDE: Lernt beim Spielen Quests, Kreaturen und Beute: wer eine Quest vergibt und annimmt, Belohnungen, Ziele, Drop-Chancen.
## Author: Lacustat
## Version: 0.1.155
## Version: 0.1.156
## Dependencies: Freewood-OctoWoW-Core
## OptionalDeps: Freewood-OctoWoW-CodexData, Freewood-OctoWoW-ForeverData