Skip to content

Commit 4f6da59

Browse files
committed
adding /ahdb infoscan to complete the item db
1 parent 92b9f69 commit 4f6da59

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

AuctionDB/AuctionDB.lua

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,36 @@ function ADB:AHendOfScanCB()
408408
end
409409
end
410410

411+
function ADB:ItemInfoScan()
412+
local idb = self.savedVar[self.itemDBKey]
413+
ADB:PrintDefault(L["Scanning item db for item info, starting with % items, % with info"], idb._count_, idb._infoCount_)
414+
local count = 0
415+
local infoCount = 0
416+
for key, link in pairs(idb) do
417+
if key:sub(1,1) == "_" then
418+
ADB:PrintDefault(L["Meta information key % value %"], key, link)
419+
else
420+
count = count + 1
421+
if ADB:HasItemInfo(link) then
422+
infoCount = infoCount + 1
423+
else
424+
local added
425+
idb[key], added = ADB:AddItemInfo(link)
426+
infoCount = infoCount + added
427+
idb._infoCount_ = idb._infoCount_ + added
428+
end
429+
end
430+
end
431+
ADB:PrintDefault(L["Found % total items and % with info"], count, infoCount)
432+
if idb._count_ ~= count then
433+
ADB:Warning("Mismatch in count % vs %", count, idb._count_)
434+
end
435+
if idb._infoCount_ ~= infoCount then
436+
ADB:Warning("Fixing mismatch in info count % (was %)", infoCount, idb._infoCount_)
437+
idb._infoCount_ = infoCount
438+
end
439+
end
440+
411441
function ADB:Help(msg)
412442
ADB:PrintDefault("AHDB: " .. msg .. "\n" .. "/ahdb config -- open addon config\n" ..
413443
"/ahdb scan -- manual full scan\n" .. "/ahdb bug -- report a bug\n" ..
@@ -440,6 +470,8 @@ function ADB.Slash(arg) -- can't be a : because used directly as slash command
440470
ADB:AHSaveAll()
441471
elseif ADB:StartsWith(arg, "context") then
442472
ADB:AHContext()
473+
elseif ADB:StartsWith(arg, "infoscan") then
474+
ADB:ItemInfoScan()
443475
elseif cmd == "c" then
444476
-- Show config panel
445477
-- InterfaceOptionsList_DisplayPanel(ADB.optionsPanel)

ChangeLog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Coming next:
77
v1.03.00 July 24th 2020
88
- Auction Item Database schema v5, now contains itemSellPrice, itemStackCount, itemClassID,
99
itemSubClassID, itemRarity, itemMinLevel prefix before the link (MoLib change)
10+
- The internal item database will enrich automatically with item info as you scan but if you have
11+
a large one you want to manually update, do `/ahdb infoscan` a few times (wait a bit and /reload in between)
12+
- See the matching schema change in https://github.com/mooreatv/AHDBapp
1013

1114
v1.02.02 July 8th 2020
1215
- Updated for Classic 1.13.5

0 commit comments

Comments
 (0)