|
03-09-22, 08:16 AM | #1 |
Master Plan and setbackdrop
I'm trying to fix an abandoned addon which has the backdrop error: MasterPlan (https://www.curseforge.com/wow/addons/master-plan)
Error no. 1: Code:
1753x MasterPlan\GarrisonMissions.lua:644: attempt to call method 'SetBackdrop' (a nil value) [string "@MasterPlan\GarrisonMissions.lua"]:644: in main chunk [string "=[C]"]: in function `LoadAddOn' [string "@MasterPlan\PlanA\PlanA.lua"]:77: in function <MasterPlan\PlanA\PlanA.lua:74> [string "=[C]"]: ? [string "=[C]"]: in function `Show' [string "@FrameXML\UIParent.lua"]:2958: in function `SetUIPanel' [string "@FrameXML\UIParent.lua"]:2764: in function `ShowUIPanel' [string "@FrameXML\UIParent.lua"]:2671: in function <FrameXML\UIParent.lua:2667> [string "=[C]"]: in function `SetAttribute' [string "@FrameXML\UIParent.lua"]:3522: in function <FrameXML\UIParent.lua:3501> [string "=[C]"]: in function `ShowUIPanel' [string "@FrameXML\UIParent.lua"]:2214: in function <FrameXML\UIParent.lua:1287> Locals: _ = "MasterPlan" T = <table> { ShipMissionReplacements = <table> { } MaxTraitStack = <table> { } MissionRewardSets = <table> { } LockTraits = <table> { } TraitStack = <table> { } IsDescendantOf = <function> defined @MasterPlan\Libs/Reframe.lua:8 ItemLevelUpgrades = <table> { } UpdateMissionTabs = <function> defined @MasterPlan\MissionsUI.lua:41 After0 = <function> defined @MasterPlan\Libs/Reframe.lua:19 _SetMissionSeenTable = <function> defined @MasterPlan\GarrisonAPI.lua:895 CreateEdge = <function> defined @MasterPlan\Mark-50.lua:29 config = <table> { } Garrison = <table> { } CreateLazyItemButton = <function> defined @MasterPlan\Libs/Reframe.lua:106 XPMissions = <table> { } FOLLOWER_LEVEL_BASE = 30 EnvironmentGhosts = <table> { } EnvironmentBonus = <table> { } SetModifierSensitiveTip = <function> defined @MasterPlan\Libs/Reframe.lua:147 TraitDisplayMap = <table> { } ShipAffinityMap = <table> { } Mark = 50 TokenSlots = <table> { } CrateLevels = <table> { } StrongNavalThreats = <table> { } EquipmentTraitQuests = <table> { } FOLLOWER_ITEM_LEVEL_CAP = 675 SpecIcons = <table> { } MoreTraitStack = <table> { } Evie = <userdata> EquipmentCounters = <table> { } FOLLOWER_LEVEL_CAP = 40 Nine = <table> { } ShipInterestPool = <table> { } MissionCoalescing = <table> { } InterestPool = <table> { } Affinities = <table> { } MissionLocationBanners = <table> { } L = <userdata> MENTOR_FOLLOWER = 465 EnvironmentCounters = <table> { } AlwaysTraits = <table> { } SpecCounters = <table> { } EquipmentTraitItems = <table> { } MinorRewards = <table> { } UsableAffinities = <table> { } ShipTraitStack = <table> { } tentativeState = <table> { } _GetMissionSeenTable = <function> defined @MasterPlan\GarrisonAPI.lua:904 MissionExpire = <table> { } InterestMask = <table> { } UniqueTraits = <table> { } TraitCost = <table> { } EquivTrait = <table> { } MissionsUI = <table> { } GetMouseFocus = <function> defined @MasterPlan\Libs/Reframe.lua:4 TrackedMissionSets = <table> { } } EV = <userdata> G = <table> { GetMechanicInfo = <function> defined @MasterPlan\GarrisonAPI.lua:560 ExtendMissionInfoWithParty = <function> defined @MasterPlan\GarrisonAPI.lua:1806 SetDoubleCountersTooltip = <function> defined @MasterPlan\GarrisonAPI.lua:2925 SetGroupTooltip = <function> defined @MasterPlan\GarrisonAPI.lua:2848 DissolveAllTentativeParties = <function> defined @MasterPlan\GarrisonAPI.lua:97 SuppressFollowerEvents = <function> defined @MasterPlan\GarrisonAPI.lua:921 GetFollowerRerollConstraints = <function> defined @MasterPlan\GarrisonAPI.lua:2456 GetFilteredMissionGroups = <function> defined @MasterPlan\GarrisonAPI.lua:1080 GetFollowerTraits = <function> defined @MasterPlan\GarrisonAPI.lua:513 GetNumIdleCombatFollowers = <function> defined @MasterPlan\GarrisonAPI.lua:682 GetMissionDefaultGroupRank = <function> defined @MasterPlan\GarrisonAPI.lua:1503 GetFMLevel = <function> defined @MasterPlan\GarrisonAPI.lua:616 GetCounterInfo = <function> defined @MasterPlan\GarrisonAPI.lua:464 GetBestGroupInfo = <function> defined @MasterPlan\GarrisonAPI.lua:3179 GetFollowerLevelDescription = <function> defined @MasterPlan\GarrisonAPI.lua:623 SetCurrencyTraitTip = <function> defined @MasterPlan\GarrisonAPI.lua:2841 GetMissionSummary = <function> defined @MasterPlan\GarrisonAPI.lua:2333 SetItemTooltip = <function> defined @MasterPlan\GarrisonAPI.lua:2799 GetTimeStringFromSeconds = <function> defined @MasterPlan\GarrisonAPI.lua:203 AbortCompleteMissions = <function> defined @MasterPlan\G Code:
do -- Counter-follower lists -- local itip = CreateFrame("GameTooltip", "MPInnerTip", nil, "GameTooltipTemplate") do local itip = CreateFrame("GameTooltip", "MPInnerTip", nil, BackdropTemplateMixin and "GameTooltipTemplate") do itip:SetBackdrop(nil) itip:SetPadding(0, 0) itip:SetScript("OnHide", function(self) self:Hide() self:SetParent(nil) self:ClearAllPoints() end) itip:SetScript("OnUpdate", function(self) local atip = self:GetParent() if not atip then return self:Hide() end local il, al, at, iw = self:GetLeft(), atip:GetLeft(), atip:GetTop(), self:GetWidth() if not (il and al and at and iw) then return end local lm = il - al atip:SetWidth(math.max(245, lm + iw)) if atip.Description then atip.Description:SetWidth(atip:GetWidth()+atip:GetLeft()-atip.Description:GetLeft()-10) end local tw = atip:GetWidth() - lm - 18 if tw > self:GetWidth() then self:SetMinimumWidth(tw) self:Show() end self:Show() atip:SetHeight(at-self:GetTop()+self:GetHeight()+2) end) function itip:ActivateFor(owner, ...) if owner then self:SetParent(owner) self:SetOwner(owner, "ANCHOR_PRESERVE") self:ClearAllPoints() self:SetPoint(...) end end end Code:
163x MasterPlan\GarrisonAPI.lua:2701: attempt to call method 'SetBackdropColor' (a nil value) [string "@MasterPlan\GarrisonAPI.lua"]:2701: in function `SetClassSpecTooltip' [string "@MasterPlan\GarrisonFollowers.lua"]:408: in function <MasterPlan\GarrisonFollowers.lua:382> Locals: self = GameTooltip { 0 = <userdata> SetCurrencyByID = <function> defined =[C]:-1 textLeft1Font = "GameTooltipHeaderText" GetBackdropColor = <function> defined @TinyTooltip\Core.lua:858 SetHyperlink = <function> defined =[C]:-1 updateTooltipTimer = 0.130000 SetArtifactPowerByID = <function> defined =[C]:-1 textRight2Font = "GameTooltipText" comparing = false TopOverlay = <unnamed> { } GetBackdropBorderColor = <function> defined @TinyTooltip\Core.lua:859 style = <unnamed> { } SetUnitDebuff = <function> defined =[C]:-1 SetQuestItem = <function> defined =[C]:-1 waitingForData = false numMoneyFrames = 1 SetRecipeReagentItem = <function> defined =[C]:-1 layoutType = "TooltipDefaultLayout" shoppingTooltips = <table> { } hasMoney = 1 SetCurrencyTokenByID = <function> defined =[C]:-1 SetQuestLogItem = <function> defined =[C]:-1 BottomOverlay = <unnamed> { } __tamedCounts = false textRight1Font = "GameTooltipHeaderText" SetCurrencyToken = <function> defined =[C]:-1 NineSlice = <unnamed> { } textLeft2Font = "GameTooltipText" model = <unnamed> { } TextRight2 = GameTooltipTextRight2 { } TextLeft2 = GameTooltipTextLeft2 { } SetUnitAura = <function> defined =[C]:-1 TextLeft1 = GameTooltipTextLeft1 { } TextRight1 = GameTooltipTextRight1 { } ItemTooltip = <unnamed> { } needsReset = true SetUnitBuff = <function> defined =[C]:-1 GetBackdrop = <function> defined @TinyTooltip\Core.lua:857 BigFactionIcon = <unnamed> { } SetRecipeResultItem = <function> defined =[C]:-1 } specId = 4 specName = "Unheiligtodesritter" ab1 = nil ab2 = nil fi = <table> { displayHeight = 0.500000 followerTypeID = 1 abilities = <table> { } iLevel = 675 scale = 0.700000 classAtlas = "GarrMission_ClassIcon-DeathKnight" combatAllySpellIDs = <table> { } isTroop = false displayIDs = <table> { } autoCombatantStats = <table> { } classSpec = 4 displayScale = 1 level = 40 unlockableEquipment = <table> { } quality = 4 portraitIconID = 1066212 unlockableAbilities = <table> { } isFavorite = false isSoulbind = false isAutoTroop = false xp = 0 className = "Unheiligtodesritter" equipment = <table> { } isMaxLevel = true name = "Olaf Pestträger" followerID = "0x0000000026BBFB91" height = 1.200000 levelXP = 0 isCollected = true garrFollowerID = 242 } c = <table> { 1 = 1 2 = 2 3 = 7 4 = 8 5 = 10 } ci = <table> { 1 = <table> { } 2 = <table> { } 3 = <table> { } 4 = <table> { } 6 = <table> { } 7 = <table> { } 8 = <table> { } 9 = <table> { } 10 = <table> { } } finfo = <table> { 611705759 = <table> { } 621564966 = <table> { } 554861866 = <table> { } 564073912 = <table> { } 557008026 = <table> { } 649853841 = <table> { } 647456010 = <table> { } 558497649 = <table> { } 554811483 = <table> { } 628500002 = <table> { } 574020219 = <table> { } 644121922 = <table> { } 640011705 = <table> { } 554366730 = <table> { } 591313258 = <table> { } 577581114 = <table> { } 558484756 = <table> { } 554362970 = <table> { } 637676654 = <table> { } 600377894 = <table> { } 634410410 = <table> { } 554720426 = <table> { } 557029619 = <table> { } 624641191 = <table> { } 567243613 = <table> { } 555677904 = <table> { } 618581631 = <table> { } 568491898 = <table> { } 554792869 = <table> { } 585511669 = <table> { } 554785479 = <table> { } 570915827 = <table> { } 583237840 = <table> { } 604725544 = <table> { } 608325726 = <table> { } 554362419 = <table> { } 595615744 = <table> { } 615463396 = <table> { } 588212129 = <table> { } 560876254 = <table> { } 558481057 = <table> { } 554343297 = <table> { } 555782709 = <table> { } 555679993 = <table> { } 631337830 = <table> { } 569287289 = <table> { } 557002900 = <table> { } 554803148 = <table> { } 576729221 = <table> { } 568485522 = <table> { } 560171043 = <table> { } 580438516 = <table> { } 554862621 = <table> { } } dropCounter = nil dct = <table> { 807 = <table> { } 309 = <table> { } 903 = <table> { } -207 Code:
function api.SetClassSpecTooltip(self, specId, specName, ab1, ab2) -- trying to fix setbackdrop error if not self.SetBackdrop then Mixin(self, BackdropTemplateMixin) end local fi if type(specId) == "table" then fi, specId, specName = specId, specId.classSpec, specId.className end local c = T.SpecCounters[specId] if not c then return end self:ClearLines() local ci, finfo, dropCounter = api.GetCounterInfo(), api.GetFollowerInfo(), not ab2 and ab1 or nil local dct = api.GetDoubleCounters() if specName then self:AddLine(specName, 1,1,1) self:AddLine(L"Potential counters:") local lockedCounter = api.GetFollowerLockedCounterInfo(fi and (fi.garrFollowerID or fi.followerID)) local leftLine for i=1,#c do for j=lockedCounter and #c or (i+1), #c do local pc, lc = lockedCounter or c[j], c[i] local lct, lpt = dct[pc*100+lc], dct[-(pc*100+lc)] local _, _, pi = api.GetMechanicInfo(pc) local _, _, li = api.GetMechanicInfo(lc) local pt = "|T" .. pi .. ":16:16:0:0:64:64:5:59:5:59|t" if leftLine then local rt = pt .. "|T" .. li .. ":16:16:0:0:64:64:5:59:5:59|t" local rf, ra, rp = api.countFreeFollowers(lct, finfo), lct and #lct or 0, lpt and #lpt or 0 rt = (rf == 0 and ra == 0 and "0" or "") .. (rf > 0 and "|cff20ff20" .. rf .. "|r" or "") .. (ra > rf and (rf > 0 and "+" or "") .. "|cffccc78f" .. (ra - rf) .. "|r" or "") .. "|cffa0a0a0/" .. rp .. " " .. rt self:AddDoubleLine(leftLine, rt, 1,1,1, 1,1,1) leftLine = nil else local lt = pt .. "|T" .. li .. ":16:16:0:0:64:64:5:59:5:59|t" local lf, la, lp = api.countFreeFollowers(lct, finfo), lct and #lct or 0, lpt and #lpt or 0 leftLine = lt .. " " .. (lf == 0 and la == 0 and "0" or "") .. (lf > 0 and "|cff20ff20" .. lf .. "|r" or "") .. (la > lf and (lf > 0 and "+" or "") .. "|cffccc78f" .. (la - lf) .. "|r" or "") .. "|cffa0a0a0/" .. lp end end end if leftLine then self:AddLine(leftLine, 1,1,1) end else self:AddLine(ITEM_QUALITY_COLORS[4].hex .. L"Epic Ability") self:AddLine(L"An additional random ability is unlocked when this follower reaches epic quality." .. "|n ", 1,1,1, 1) self:AddLine(L"Potential counters:") for i=1,#c do if c[i] == dropCounter then dropCounter = nil else local _, name, ico = api.GetMechanicInfo(c[i]) local counters = ci[c[i]] local freeCount, totalCount = api.countFreeFollowers(counters, finfo), counters and #counters or 0 local counts = (freeCount > 0 and "|cff20ff20" .. freeCount or "0") .. "|r+|cffccc78f" .. (totalCount - freeCount) self:AddDoubleLine("|TInterface\\Buttons\\UI-Quickslot2:13:2:-1:0:64:64:31:32:31:32|t|T" .. ico .. ":0:0:0:0:64:64:5:59:5:59|t " .. name, counts, 1,1,1, 1,1,1) end end end self:SetBackdropColor(0,0,0) local novel, inact, _, rerollDesc = api.CountUniqueRerolls(c, fi and fi.followerID) if novel > 0 or inact > 0 then self:AddDoubleLine(L"Unique ability rerolls:", rerollDesc) end if fi and fi.quality >= 4 and fi.isCollected then local a1, a2 = C_Garrison.GetFollowerAbilityAtIndex(fi.followerID, 1), C_Garrison.GetFollowerAbilityAtIndex(fi.followerID, 2) a1, a2 = C_Garrison.GetFollowerAbilityCounterMechanicInfo(a1), C_Garrison.GetFollowerAbilityCounterMechanicInfo(a2) local sd = dct[a1 < a2 and (a1 * 100 + a2) or (a2 * 100 + a1)] if sd and #sd > 1 then self:AddLine(" ") self:AddLine(L"Duplicate counters" .. ":") addFollowerList(self, sd, finfo, nil, true, nil, fi.followerID) end end self:Show() return true end Last edited by kaimox : 03-10-22 at 08:29 AM. |
|
03-10-22, 03:47 PM | #2 |
The formatting of GarrisonMissions.lua is horrible. That out of the way, try changing line 644 to
Code:
itip:ClearBackdrop() |
|
03-10-22, 07:15 PM | #3 |
itip:ClearBackdrop() will also cause an error, since the BackdropTemplate still does not exist on the frame.
The first change didn't work because you aren't actually changing anything. "GameTooltipTemplate"These two lines do the exact same thing, passing just the GameTooltipTemplate string. The only difference is that the second one checks for the existence of BackdropTemplateMixin table before passing the GameTooltipTemplate string. The second line is Lua's basic form of a ternary operator. Logically, it acts like this: Lua Code:
So if BackdropTemplateMixin didn't exist, the created frame won't even get the GameTooltipTemplate string, just a false in that argument. Use either of these two options: Lua Code:
Lua Code:
You can also try just removing that SetBackdrop line entirely. I'm not too familiar with Backdrops, but these Backdrop errors you may be finding in searches since the release of Shadowlands were due to that template no longer included in every frame creation. If there's no Backdrop template, there should be no Backdrop to set to nil.
__________________
Last edited by Kanegasi : 03-10-22 at 09:49 PM. |
|
10-13-23, 11:05 PM | #4 |
I managed the fix and in the meantime the original author has picked up development again. But I totally forgot to thank you myrrodin and kanegasi for your helpful hints. :shameface
|
|
WoWInterface » Developer Discussions » Lua/XML Help » Master Plan and setbackdrop |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|