Fix totem casts erroring when a totem's cooldown was never read
GetTotemDurationAndHealth reads the totem description from tooltip line 5. When that line was empty it returned only duration and health, so the three-value assignment in ScanTotems left the rank's Cooldown nil, and dropping that totem failed in ActivateTotem with "COE_TotemLogic.lua:776: attempt to compare number with nil". - Always return duration, health and cooldown. - When line 5 is empty, read the description from the last tooltip line. It moves up when the tooltip is shorter, e.g. without the "Tools:" line while the totem item is not in the item cache. - Clear line 5 before SetSpell so a shorter tooltip cannot reuse the previous totem's text.
This commit is contained in:
+14
-1
@@ -464,13 +464,26 @@ end
|
||||
-------------------------------------------------------------------]]
|
||||
function COE:GetTotemDurationAndHealth(spellid)
|
||||
|
||||
COETotemTTTextLeft5:SetText(nil);
|
||||
COETotemTTTextRight3:SetText(nil);
|
||||
COETotemTT:SetSpell(spellid, BOOKTYPE_SPELL);
|
||||
text = COETotemTTTextLeft5:GetText();
|
||||
|
||||
-- the description is normally line 5 but moves up when the client
|
||||
-- leaves out the "Tools:" line (totem item not in the item cache).
|
||||
-- the description is always the last line
|
||||
-- -----------------------------------------------------------------
|
||||
if (not text) then
|
||||
local last = getglobal("COETotemTTTextLeft" .. COETotemTT:NumLines());
|
||||
if (last) then text = last:GetText(); end
|
||||
end
|
||||
|
||||
-- callers assign all three values: returning fewer leaves the
|
||||
-- rank's Cooldown nil and the cast errors in ActivateTotem
|
||||
-- ------------------------------------------------------------
|
||||
if (not text) then
|
||||
COE:DebugMessage("nil text with id: " .. spellid);
|
||||
return 0, 0;
|
||||
return 0, 0, 0;
|
||||
end
|
||||
|
||||
local duration = 0;
|
||||
|
||||
Reference in New Issue
Block a user