phanx-wow / BetterBattlePetTooltip

WoW AddOn — Adds your highest collected level and quality to battle pet tooltips.
Other
2 stars 0 forks source link

SetBackdropBorderColor LUA error when hovering over wild pets profile in battle #16

Open nearlysober80 opened 3 years ago

nearlysober80 commented 3 years ago

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 functionPetBattleUnitTooltip_UpdateForUnit'

Locals:

nearlysober80 commented 3 years ago

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]": in function BattlePetToolTip_Show' [string "@Interface\FrameXML\BattlePetTooltip.lua"]:10: in functionBattlePetToolTip_ShowLink' [string "@Interface\AddOns\Blizzard_AuctionHouseUI\Blizzard_AuctionHouseUtil.lua"]:527: in function SetAuctionHouseTooltip' [string "@Interface\AddOns\Blizzard_AuctionHouseUI\Blizzard_AuctionHouseUtil.lua"]:565: in functionlineOnEnterCallback' [string "@Interface\AddOns\Blizzard_AuctionHouseUI\Blizzard_AuctionHouseItemList.lua"]:176: in function OnEnterListLine' [string "@Interface\AddOns\Blizzard_AuctionHouseUI\Blizzard_AuctionHouseItemList.lua"]:21: in functionOnLineEnter' [string "@Interface\SharedXML\TableBuilder.lua"]:42: in function <Interface\SharedXML\TableBuilder.lua:41>

Locals:

ObiWahn86 commented 3 years ago

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.