Better Battle Pet Tooltip

Better Battle Pet Tooltip

74.7k Downloads

SetBackdropBorderColor LUA error when hovering over wild pets profile in battle

nearlysober80 opened this issue ยท 2 comments

commented

When in battle with a wild pet, if you hover over the pet you're fighting to get more info, the following LUA pops up.

I believe this was set by changes to backdrop commands in 9.0.1:

Message: Interface\AddOns\BetterBattlePetTooltip\Core.lua:312: attempt to call method 'SetBackdropBorderColor' (a nil value)
Time: Fri Nov 27 11:27:23 2020
Count: 7
Stack: Interface\AddOns\BetterBattlePetTooltip\Core.lua:312: attempt to call method 'SetBackdropBorderColor' (a nil value)
[string "=[C]"]: in function SetBackdropBorderColor' [string "@Interface\AddOns\BetterBattlePetTooltip\Core.lua"]:312: in function <Interface\AddOns\BetterBattlePetTooltip\Core.lua:299> [string "@Interface\AddOns\BetterBattlePetTooltip\Core.lua"]:334: in function <Interface\AddOns\BetterBattlePetTooltip\Core.lua:328> [string "=[C]"]: in function PetBattleUnitTooltip_UpdateForUnit'
[string ":OnEnter"]:2: in function <[string ":OnEnter"]:1>
[string "=[C]"]: ?

Locals:

commented

Similar error when hovering over pets in the AH UI related to the changes in SetBackDropBorderColor:

Message: Interface\AddOns\BetterBattlePetTooltip\Core.lua:312: attempt to call method 'SetBackdropBorderColor' (a nil value)
Time: Thu Dec 3 13:20:05 2020
Count: 17
Stack: Interface\AddOns\BetterBattlePetTooltip\Core.lua:312: attempt to call method 'SetBackdropBorderColor' (a nil value)
[string "=[C]"]: in function SetBackdropBorderColor' [string "@Interface\AddOns\BetterBattlePetTooltip\Core.lua"]:312: in function <Interface\AddOns\BetterBattlePetTooltip\Core.lua:299> [string "@Interface\AddOns\BetterBattlePetTooltip\Core.lua"]:363: in function <Interface\AddOns\BetterBattlePetTooltip\Core.lua:356> [string "@Interface\AddOns\BetterBattlePetTooltip\Core.lua"]:384: in function <Interface\AddOns\BetterBattlePetTooltip\Core.lua:383> [string "=[C]"]: ? [string "=[C]"]: in function BattlePetToolTip_Show'
[string "@interface\FrameXML\BattlePetTooltip.lua"]:10: in function BattlePetToolTip_ShowLink' [string "@Interface\AddOns\Blizzard_AuctionHouseUI\Blizzard_AuctionHouseUtil.lua"]:527: in function SetAuctionHouseTooltip'
[string "@interface\AddOns\Blizzard_AuctionHouseUI\Blizzard_AuctionHouseUtil.lua"]:565: in function lineOnEnterCallback' [string "@Interface\AddOns\Blizzard_AuctionHouseUI\Blizzard_AuctionHouseItemList.lua"]:176: in function OnEnterListLine'
[string "@interface\AddOns\Blizzard_AuctionHouseUI\Blizzard_AuctionHouseItemList.lua"]:21: in function `OnLineEnter'
[string "@interface\SharedXML\TableBuilder.lua"]:42: in function <Interface\SharedXML\TableBuilder.lua:41>

Locals:

commented

The problem is caused in 9.0 because to improve performance frames don't have backdrops anymore unless they import or inherit the backdrop template.
Following an advice on wowinterface I added the following after line 76 in Core.lua:
local f = CreateFrame("Frame", nil, self, BackdropTemplateMixin and "BackdropTemplate")
and changed self in line 312 (that is line 313 after the insert) to f:
f:SetBackdropBorderColor(r, g, b)
That fixed the problem for me.