Skip to content

Commit

Permalink
0.2.2
Browse files Browse the repository at this point in the history
- additional check to fix rare error
  • Loading branch information
anzz1 authored Aug 21, 2022
1 parent bc9bbad commit 5373abe
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 27 deletions.
2 changes: 1 addition & 1 deletion TacoTip.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 11304
## Version: 0.2.1
## Version: 0.2.2
## Title: TacoTip
## Notes: TacoTip (GearScore & Talents)
## Author: kebabstorm
Expand Down
58 changes: 32 additions & 26 deletions gearscore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ local function itemcacheCB(tbl, id)
end


function TT_GS:GetScore(unitorguid, callbackFunc)
function TT_GS:GetScore(unitorguid, useCallback)
local guid = getPlayerGUID(unitorguid)
if (guid) then
if (guid ~= UnitGUID("player")) then
Expand All @@ -235,7 +235,7 @@ function TT_GS:GetScore(unitorguid, callbackFunc)

local cb_table

if (callbackFunc) then
if (useCallback) then
cb_table = {["guid"] = guid, ["items"] = {}}
end

Expand All @@ -244,14 +244,16 @@ function TT_GS:GetScore(unitorguid, callbackFunc)
mainHandLink = mainHandItem:GetItemLink()
else
IsReady = false
if (callbackFunc) then
local id = mainHandItem:GetItemID()
table.insert(cb_table.items, id)
mainHandItem:ContinueOnItemLoad(function()
itemcacheCB(cb_table, id)
end)
else
C_Item.RequestLoadItemDataByID(mainHandItem:GetItemID())
local itemID = mainHandItem:GetItemID()
if (itemID) then
if (useCallback) then
table.insert(cb_table.items, itemID)
mainHandItem:ContinueOnItemLoad(function()
itemcacheCB(cb_table, itemID)
end)
else
C_Item.RequestLoadItemDataByID(itemID)
end
end
end
end
Expand All @@ -260,14 +262,16 @@ function TT_GS:GetScore(unitorguid, callbackFunc)
offHandLink = offHandItem:GetItemLink()
else
IsReady = false
if (callbackFunc) then
local id = offHandItem:GetItemID()
table.insert(cb_table.items, id)
offHandItem:ContinueOnItemLoad(function()
itemcacheCB(cb_table, id)
end)
else
C_Item.RequestLoadItemDataByID(offHandItem:GetItemID())
local itemID = offHandItem:GetItemID()
if (itemID) then
if (useCallback) then
table.insert(cb_table.items, itemID)
offHandItem:ContinueOnItemLoad(function()
itemcacheCB(cb_table, itemID)
end)
else
C_Item.RequestLoadItemDataByID(itemID)
end
end
end
end
Expand Down Expand Up @@ -314,14 +318,16 @@ function TT_GS:GetScore(unitorguid, callbackFunc)
LevelTotal = LevelTotal + ItemLevel
else
IsReady = false
if (callbackFunc) then
local id = item:GetItemID()
table.insert(cb_table.items, id)
item:ContinueOnItemLoad(function()
itemcacheCB(cb_table, id)
end)
else
C_Item.RequestLoadItemDataByID(item:GetItemID())
local itemID = item:GetItemID()
if (itemID) then
if (useCallback) then
table.insert(cb_table.items, itemID)
item:ContinueOnItemLoad(function()
itemcacheCB(cb_table, itemID)
end)
else
C_Item.RequestLoadItemDataByID(itemID)
end
end
end
end
Expand Down

0 comments on commit 5373abe

Please sign in to comment.