Open Hemario opened 5 years ago
This issue comes from the team having set a random pet in Rematch.
function Addon:GetPetTip(id)
if not id then
return ' '
end
+ if id:find('random:') == 1 then
+ return 'A random pet'
+ end
local _, customName, _, _, _, _, _, name, icon, petType = C_PetJournal.GetPetInfoByPetID(id)
if not name then
return ' '
end
local health, maxHealth, power, speed, rarity = C_PetJournal.GetPetStats(id)
return format('|T%s:20|t %s%s|r', icon, ITEM_QUALITY_COLORS[rarity-1].hex, customName or name)
end
will fix/avoid it.
this will not fix "ignored" pets and error is still present!
Better way to fix this is just to replace if not id then
with if (not id) or (not string.find(id, "BattlePet.*")) then
so ANY non Pet-GUID will be ignored
Complete Function:
function Addon:GetPetTip(id)
if (not id) or (not string.find(id, "BattlePet.*")) then
return ' '
end
local _, customName, _, _, _, _, _, name, icon, petType = C_PetJournal.GetPetInfoByPetID(id)
if not name then
return ' '
end
local health, maxHealth, power, speed, rarity = C_PetJournal.GetPetStats(id)
return format('|T%s:20|t %s%s|r', icon, ITEM_QUALITY_COLORS[rarity-1].hex, customName or name)
end
I have a fix for this that uses the proper Rematch API for fetching pet data instead of trying to do it using the Blizz APIs in this file.
LUA error occurs when mousing over the script selector on the top of the window duting a pet battle.