Skip to content

Commit

Permalink
force load item if not found, fixes on second load
Browse files Browse the repository at this point in the history
  • Loading branch information
sogladev committed Aug 7, 2024
1 parent 64ba05c commit bfe8426
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions DKPClient.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,24 @@ function Item:CreateForId(itemId)
return itemInfo
end

-- Define ForceLoadItemData outside of ItemSlotRightCheck
local hiddenTooltip = CreateFrame("GameTooltip", "HiddenTooltipFrame", UIParent, "GameTooltipTemplate")
hiddenTooltip:SetSize(1, 1)
hiddenTooltip:SetPoint("CENTER", UIParent, "CENTER")
hiddenTooltip:Hide()
function DKP.ForceLoadItemData(itemID)
hiddenTooltip:SetOwner(UIParent, "ANCHOR_NONE")
hiddenTooltip:SetHyperlink("item:" .. itemID)
end

function Item:PopulateStaticProperties()
print("Item:PopulateStaticProperties")
print(self.id)
self.name, self.link, self.quality, self.ilvl, self.minLevel, self.itemType, self.itemSubType, _, self.equipLoc, self.texture, _, self.classId, self.subclassId = GetItemInfo(self.id)
if not self.name then
DKP.Error(string.format("Invalid name, item likely not in cache: %d", self.id))
DKP.Error(string.format("Item id: %d not in cache, force loading data..., fixed on next reload or manually sync (.dkp sync)", self.id))
DKP.ForceLoadItemData(self.id)
end
end


function Item:Decode(encodedStr)
DKP.print("Item:Decode")
print(encodedStr)
Expand Down Expand Up @@ -411,7 +418,6 @@ function Client:CreateRow(parent, item)
end
end


local incrementButton = CreateFrame("Button", nil, row)
incrementButton:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollUp-Up")
incrementButton:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight")
Expand Down Expand Up @@ -506,7 +512,7 @@ DKP.client = client
client.window = client:CreateWindow()
-- add test items
-- local testStr = "1^39252^1+2^39251^1+3^23070^1"
-- local testStr = "1^39252^1+2^39251^1+3^23070^1+4^23000^1+5^22801^1+6^22808^1+7^22803^1+8^22353^1+9^22804^1+10^22805^1" -- cache
-- DKPHandlers.SyncResponse(nil, testStr)
local testStr = "1^39252^1+2^39251^1+3^23070^1+4^23000^1+5^22801^1+6^22808^1+7^22803^1+8^22353^1+9^22804^1+10^22805^1" -- cache
DKPHandlers.SyncResponse(nil, testStr)

print(DKP.items)

0 comments on commit bfe8426

Please sign in to comment.