Skip to content

Instantly share code, notes, and snippets.

@Ravendwyr
Created July 31, 2016 21:56
Show Gist options
  • Save Ravendwyr/964b9e81b53e0dc1bb6c11f134bbb0a9 to your computer and use it in GitHub Desktop.
Save Ravendwyr/964b9e81b53e0dc1bb6c11f134bbb0a9 to your computer and use it in GitHub Desktop.
Geppetto for 7.0.3
Geppetto = {}
--[[=====================================
Scanning tooltip
--=====================================]]
local tip = CreateFrame("GameTooltip")
local linecache = {}
tip:SetOwner(WorldFrame, "ANCHOR_NONE")
for i=1,40 do
linecache[i] = tip:CreateFontString()
tip:AddFontStrings(linecache[i], tip:CreateFontString())
end
local function SetTooltipLink(link)
tip:ClearLines()
if not tip:IsOwned(WorldFrame) then
tip:SetOwner(WorldFrame, "ANCHOR_NONE")
end
tip:SetHyperlink(link)
end
local function SetTooltipID(link)
tip:ClearLines()
if not tip:IsOwned(WorldFrame) then
tip:SetOwner(WorldFrame, "ANCHOR_NONE")
end
tip:SetItemByID(link)
end
--[[=====================================
Main window
--=====================================]]
local frame = CreateFrame("Frame", "GeppettoFrame", UIParent, "HelpPlateBox")
frame:SetPoint("CENTER", 0, 0)
frame:SetSize(320, 144)
frame.BG:SetTexture(0,0,0,0.9)
frame:EnableMouse(true)
frame:SetMovable(true)
--[[
frame:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 32, edgeSize = 32,
insets = { left = 8, right = 8, top = 8, bottom = 8 }
})
]]
frame:SetScript("OnMouseDown", function(self) self:StartMoving() end)
frame:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end)
frame:SetScript("OnEnter", nil)
frame:SetScript("OnLeave", nil)
local title = frame:CreateFontString("GeppettoTitle", "ARTWORK", "GameFontNormalLarge")
title:SetPoint("TOP", 0, -12)
title:SetText("Geppetto")
local button = CreateFrame("Button", "GeppettoButton", frame, "SecureActionButtonTemplate, ActionButtonTemplate")
button:SetPoint("TOPRIGHT", -20, -40)
button.icon:SetTexture("Interface\\ICONS\\INV_Misc_QuestionMark")
local closeButton = CreateFrame("Button", "GeppettoClose", frame, "UIPanelButtonTemplate")
closeButton:SetText("Close")
closeButton:SetWidth(48)
closeButton:SetHeight(24)
closeButton:SetPoint("BOTTOM", 0, 10)
closeButton:SetScript("OnClick", function() Geppetto:SetState("CLOSED") Geppetto.frame:Hide() end)
local text = frame:CreateFontString("GeppettoFrame", "ARTWORK", "GameFontWhite")
text:SetPoint("TOPLEFT", 20, -40)
text:SetWidth(frame:GetWidth() - button:GetWidth() - 20 - 30 - 10)
text:SetJustifyH("LEFT")
frame.text = text
Geppetto.frame = frame
Geppetto.button = button
Geppetto.text = text
--[[=====================================
Logic
--=====================================]]
function Geppetto:SetState(newState, name, texture)
assert(newState == "LEARNABLE" or newState == "DELETABLE" or newState == "LEARNING" or newState == "LEARNED" or newState == "COMPLETE" or newState == "DELETECONFIRM" or newState == "CLOSED" or newState == "WITHDRAWL" or newState == "SALEABLE" or newState == "SELLNOW")
if InCombatLockdown() then return end
-- if self:GetState() == "COMPLETE" then return end
self.state = newState
-- print("Setting state to ".. newState)
if newState == "LEARNABLE" then
self.text:SetText("Click the button to the left to learn the next Toy from your inventory.")
self.button.icon:SetTexture(texture)
self.button:SetAttribute("type", "item")
self.button:SetAttribute("item", name)
self.button:Enable()
self.frame:Show()
elseif newState == "WITHDRAWL" then
self.text:SetText("Click to withdraw all Toys from your bank.")
self.button.icon:SetTexture("Interface\\ICONS\\INV_Misc_QuestionMark")
self.button:SetAttribute("type", "macro")
self.button:SetAttribute("macrotext", "/run local d=Geppetto:GetWithdrawlList() for _,loc in pairs(d) do UseContainerItem(loc.i, loc.j) end")
self.button:Enable()
self.frame:Show()
elseif newState == "LEARNED" then
self.button:SetAttribute("type", "item")
self.button:SetAttribute("item", nil)
self:RecheckState()
self.button:Enable()
self.frame:Show()
elseif newState == "DELETABLE" then
self.text:SetText("Congratulations!\nAll of your Toys have been learned.\nClick twice more to DELETE any unsaleable Toys, without confirmation, or close below.")
self.button.icon:SetTexture("Interface\\ICONS\\INV_Misc_QuestionMark")
self.button:SetAttribute("type", "macro")
self.button:SetAttribute("macrotext", "")
self.button:Enable()
self.frame:Show()
elseif newState == "DELETECONFIRM" then
self.text:SetText("WARNING:\n\nIf you click again, ALL unsaleable Toys in your inventory will be DELETED.")
self.button:SetAttribute("type", "macro")
self.button:SetAttribute("macrotext", "/run local d=Geppetto:GetDeletionList() for _,loc in pairs(d) do PickupContainerItem(loc.i, loc.j) DeleteCursorItem() end Geppetto:SetState(\"COMPLETE\")")
self.button:Enable()
self.frame:Show()
elseif newState == "SALEABLE" then
self.text:SetText("Visit a vendor to sell any remaining extra Toys.")
self.button.icon:SetTexture("Interface\\ICONS\\INV_Misc_Coin_01")
self.button:SetAttribute("type", "macro")
self.button:SetAttribute("macrotext", "")
self.button:Disable()
self.frame:Show()
elseif newState == "SELLNOW" then
self.text:SetText("Click to SELL any extra Toys in your bags.")
self.button.icon:SetTexture("Interface\\ICONS\\INV_Misc_Coin_01")
self.button:SetAttribute("type", "macro")
self.button:SetAttribute("macrotext", "/run local d=Geppetto:GetSellList() for _,loc in pairs(d) do UseContainerItem(loc.i, loc.j) end")
self.button:Enable()
self.frame:Show()
elseif newState == "LEARNING" then
self.text:SetText("Learning...")
self.button:Disable()
self.frame:Show()
elseif newState == "CLOSED" then
self.frame:Hide()
elseif newState == "COMPLETE" then
self.text:SetText("All done!\nYou have no remaining Toys.\n\nClick to close.")
self.button:SetAttribute("type", "macro")
self.button:SetAttribute("macrotext", "/run Geppetto:SetState(\"CLOSED\")")
self.button:Enable()
end
end
function Geppetto:GetState()
return self.state
end
function Geppetto:IsLinkToy(link)
SetTooltipLink(link)
for i=1, tip:NumLines() do
if strfind(linecache[i]:GetText(), "^"..TOY.."$") then
return true
end
end
end
function Geppetto:IsToyLearned(link)
SetTooltipLink(link)
for i=1, tip:NumLines() do
if strfind(linecache[i]:GetText(), "^"..ITEM_SPELL_KNOWN.."$") then
return true
end
end
end
function Geppetto:GetNumToys()
local count = 0
for i = 0, NUM_BAG_SLOTS+NUM_BANKBAGSLOTS+1 do
if i == NUM_BAG_SLOTS+NUM_BANKBAGSLOTS+1 then i = -1 end
for j = 1, GetContainerNumSlots(i) do
local texture, _, _, _, _, _, link = GetContainerItemInfo(i, j)
if link and self:IsLinkToy(link) then
count = count + 1
end
end
end
return count
end
function Geppetto:GetNextLearnable()
for i = 0, NUM_BAG_SLOTS+NUM_BANKBAGSLOTS+1 do
if i == NUM_BAG_SLOTS+NUM_BANKBAGSLOTS+1 then i = -1 end
for j = 1, GetContainerNumSlots(i) do
local texture, _, _, _, _, _, link = GetContainerItemInfo(i, j)
if link and self:IsLinkToy(link) and not self:IsToyLearned(link) then
local name = string.match(link, "%[(.+)%]")
-- print(format("Found new toy %s", name))
local inBank = (i == -1) or (i > NUM_BAG_SLOTS)
return name, texture, inBank
end
end
end
return nil
end
function Geppetto:GetDeletionList()
local d = {}
for i = 0, NUM_BAG_SLOTS+NUM_BANKBAGSLOTS+1 do
if i == NUM_BAG_SLOTS+NUM_BANKBAGSLOTS+1 then i = -1 end
for j = 1, GetContainerNumSlots(i) do
local texture, _, _, _, _, _, link = GetContainerItemInfo(i, j)
-- Learned toys with no vendor price.
if link and self:IsLinkToy(link) and self:IsToyLearned(link) and select(11, GetItemInfo(link)) == 0 then
tinsert(d, {["i"]=i, ["j"]=j})
end
end
end
return d
end
function Geppetto:GetSellList()
local d = {}
for i = 0, NUM_BAG_SLOTS+NUM_BANKBAGSLOTS+1 do
if i == NUM_BAG_SLOTS+NUM_BANKBAGSLOTS+1 then i = -1 end
for j = 1, GetContainerNumSlots(i) do
local texture, _, _, _, _, _, link = GetContainerItemInfo(i, j)
-- Learned toys with no vendor price.
if link and self:IsLinkToy(link) and self:IsToyLearned(link) and select(11, GetItemInfo(link)) > 0 then
tinsert(d, {["i"]=i, ["j"]=j})
end
end
end
return d
end
function Geppetto:GetWithdrawlList()
local d = {}
for i = NUM_BAG_SLOTS+1, NUM_BAG_SLOTS+NUM_BANKBAGSLOTS+1 do
if i == NUM_BAG_SLOTS+NUM_BANKBAGSLOTS+1 then i = -1 end
for j = 1, GetContainerNumSlots(i) do
local texture, _, _, _, _, _, link = GetContainerItemInfo(i, j)
if link and self:IsLinkToy(link) then
tinsert(d, {["i"]=i, ["j"]=j})
end
end
end
return d
end
function Geppetto:RecheckState(learnCompleted, deleteConfirmed)
if learnCompleted then
self:SetState("LEARNED")
end
if self:GetState() == "LEARNING" then
return
end
local numRemaining = self:GetNumToys()
if numRemaining == 0 then
self:SetState("COMPLETE")
else
local lName, lTex, lInBank = self:GetNextLearnable()
if lName then
if lInBank then
self:SetState("WITHDRAWL")
else
self:SetState("LEARNABLE", lName, lTex)
end
else
if self:GetState() == "DELETABLE" and deleteConfirmed then
self:SetState("DELETECONFIRM")
elseif #self:GetDeletionList() > 0 then
self:SetState("DELETABLE")
elseif MerchantFrame:IsShown() then
self:SetState("SELLNOW")
else
self:SetState("SALEABLE")
end
end
end
end
button:HookScript("OnClick", function()
if Geppetto:GetState() == "LEARNABLE" then
Geppetto:SetState("LEARNING")
else
Geppetto:RecheckState(nil, true)
end
end)
local warlordsEpoch = time({year=2014,month=11,day=13});
local toys = {
[86589] = {"Ai-Li's Skymirror", nil},
[119217] = {"Alliance Flag of Victory", 1},
[69776] = {"Ancient Amber", nil},
[113570] = {"Ancient's Bloom", 1},
[117550] = {"Angry Beehive", 1},
[108735] = {"Arena Master's War Horn", 1},
[46843] = {"Argent Crusader's Banner", nil},
[64456] = {"Arrival of the Naaru", nil},
[118427] = {"Autographed Hearthstone Card", 1},
[90067] = {"B. F. F. Necklace", nil},
[119178] = {"Black Whirlwind", 1},
[104302] = {"Blackflame Daggers", nil},
[115503] = {"Blazing Diamond Pendant", 1},
[116115] = {"Blazing Wings", nil},
[64481] = {"Blessing of the Old God", nil},
[113096] = {"Bloodmane Charm", 1},
[54343] = {"Blue Crashin' Thrashin' Racer Controller", nil},
[97921] = {"Bom'bay's Color-Seein' Sauce", 0}, -- 5.3, Barrens
[64646] = {"Bones of Transformation", nil},
[119432] = {"Botani Camouflage", 1},
[34686] = {"Brazier of Dancing Flames", nil},
[116758] = {"Brewfest Banner", nil},
[71137] = {"Brewfest Keg Pony", nil},
[33927] = {"Brewfest Pony Keg", nil},
[114227] = {"Bubble Wand", 1},
[116440] = {"Burning Defender's Medallion", nil},
[116122] = {"Burning Legion Missive", 1},
[103685] = {"Celestial Defender's Medallion", nil},
[86575] = {"Chalice of Secrets", nil},
[64373] = {"Chalice of the Mountain Kings", nil},
[89222] = {"Cloud Ring", nil},
[116435] = {"Cozy Bonfire", nil},
[104318] = {"Crashin' Thrashin' Flyer Controller", 0}, -- Winter Veil 2013
[37710] = {"Crashin' Thrashin' Racer Controller", 0}, -- Winter Veil 2008
[23767] = {"Crashin' Thrashin' Robot", nil},
[116763] = {"Crashin' Thrashin' Shredder Controller", 1},
[88589] = {"Cremating Torch", nil},
[38301] = {"D.I.S.C.O.", nil},
[90899] = {"Darkmoon Whistle", nil},
[54653] = {"Darkspear Pride", 0}, -- 3.3.5, Cata Pre-event
[45021] = {"Darnassus Banner", nil},
[36863] = {"Decahedral Dwarven Dice", nil},
[108743] = {"Deceptia's Smoldering Boots", 1},
[79769] = {"Demon Hunter's Aspect", nil},
[64361] = {"Druid and Priest Statue Set", nil},
[21540] = {"Elune's Lantern", nil},
[104309] = {"Eternal Kiln", nil},
[89999] = {"Everlasting Alliance Firework", 0}, -- 85 Theramore Scenario
[90000] = {"Everlasting Horde Firework", 0}, -- 85 Theramore Scenario
[45020] = {"Exodar Banner", nil},
[53057] = {"Faded Wizard Hat", nil},
[86581] = {"Farwater Conch", nil},
[119145] = {"Firefury Totem", 1},
[33223] = {"Fishing Chair", nil},
[75042] = {"Flimsy Yellow Balloon", nil},
[88801] = {"Flippable Table", nil},
[45063] = {"Foam Sword Rack", nil},
[69227] = {"Fool's Gold", nil},
[90888] = {"Foot Ball", 0}, -- Winter Veil 2012
[104324] = {"Foot Ball", nil},
[88802] = {"Foxicopter Controller", nil},
[44719] = {"Frenzyheart Brew", nil},
[119083] = {"Fruit Basket", 1},
[116692] = {"Fuzzy Green Lounge Cushion", 1},
[118937] = {"Gamon's Braid", 1},
[98136] = {"Gastropod Shell", nil},
[117569] = {"Giant Deathweb Egg", 1},
[90175] = {"Gin-Ji Knife Set", nil},
[95589] = {"Glorious Standard of the Kirin Tor Offensive", nil},
[95590] = {"Glorious Standard of the Sunreaver Onslaught", nil},
[45019] = {"Gnomeregan Banner", nil},
[54651] = {"Gnomeregan Pride", 0}, -- 3.3.5, Cata Pre-event
[40895] = {"Gnomish X-Ray Specs", nil},
[33219] = {"Goblin Gumbo Kettle", nil},
[35227] = {"Goblin Weather Machine - Prototype 01-B", nil},
[88417] = {"Gokk'lok's Shell", nil},
[118716] = {"Goren Garb", 1},
[69895] = {"Green Balloon", nil},
[67097] = {"Grim Campfire", nil},
[69777] = {"Haunted War Drum", nil},
[116139] = {"Haunting Memento", nil},
[119210] = {"Hearthstone Board", 1},
[64358] = {"Highborne Soul Mirror", nil},
[87528] = {"Honorary Brewmaster Keg", nil},
[119218] = {"Horde Flag of Victory", 1},
[86593] = {"Hozen Beach Ball", nil},
[88385] = {"Hozen Idol", nil},
[113631] = {"Hypnosis Goggles", 1},
[32542] = {"Imp in a Ball", nil},
[54212] = {"Instant Statue Pedestal", nil},
[43499] = {"Iron Boot Flask", nil},
[118244] = {"Iron Buccaneer's Hat", 1},
[45018] = {"Ironforge Banner", nil},
[88579] = {"Jin Warmkeg's Brew", nil},
[64383] = {"Kaldorei Wind Chimes", nil},
[68806] = {"Kalytha's Haunted Locket", nil},
[86571] = {"Kang's Bindstone", nil},
[88580] = {"Ken-Ken's Mask", nil},
[116125] = {"Klikixx's Webspinner", 1},
[88566] = {"Krastinov's Bag of Horrors", nil},
[88531] = {"Lao Chin's Last Mug", nil},
[71259] = {"Leyara's Locket", nil},
[119039] = {"Lilian's Warning Sign", 1},
[70722] = {"Little Wickerman", nil},
[63269] = {"Loaded Gnomish Dice", nil},
[72159] = {"Magical Ogre Idol", nil},
[118938] = {"Manastorm's Duplicator", 1},
[46709] = {"MiniZep Controller", nil},
[101571] = {"Moonfang Shroud", nil},
[105898] = {"Moonfang's Paw", nil},
[113670] = {"Mournful Moan of Murmur", 1},
[86568] = {"Mr. Smite's Brass Compass", nil},
[52201] = {"Muradin's Favor", nil},
[70161] = {"Mushroom Chair", nil},
[70159] = {"Mylune's Call", nil},
[86596] = {"Nat's Fishing Chair", nil},
[112324] = {"Nightmarish Hitching Post", nil},
[104262] = {"Odd Polished Stone", nil},
[46780] = {"Ogre Pinata", nil},
[1973] = {"Orb of Deception", nil},
[35275] = {"Orb of the Sin'dorei", nil},
[45014] = {"Orgrimmar Banner", nil},
[120276] = {"Outrider's Bridle Chain", 1},
[90427] = {"Pandaren Brewpack", nil},
[86588] = {"Pandaren Firework Launcher", nil},
[89869] = {"Pandaren Scarecrow", nil},
[86586] = {"Panflute of Pandaria", nil},
[34499] = {"Paper Flying Machine Kit", nil},
[64881] = {"Pendant of the Scarab Storm", nil},
[115468] = {"Permanent Frost Essence", 1},
[49703] = {"Perpetual Purple Firework", nil},
[118221] = {"Petrification Stone", 1},
[32566] = {"Picnic Basket", nil},
[116689] = {"Pineapple Lounge Cushion", 1},
[30690] = {"Power Converter", nil},
[108739] = {"Pretty Draenor Pearl", 1},
[88370] = {"Puntable Marmot", nil},
[64482] = {"Puzzle Box of Yogg-Saron", nil},
[104294] = {"Rime of the Time-Lost Mariner", nil},
[116067] = {"Ring of Broken Promises", nil},
[119215] = {"Robo-Gnomebulator", nil},
[34480] = {"Romantic Picnic Basket", nil},
[71628] = {"Sack of Starfish", nil},
[116690] = {"Safari Lounge Cushion", 1},
[45015] = {"Sen'jin Banner", nil},
[119421] = {"Sha'tari Defender's Medallion", 1},
[98132] = {"Shado-Pan Geyser Gun", nil},
[88387] = {"Shushen's Spittoon", nil},
[116400] = {"Silver-Plated Turkey Shooter", nil},
[45017] = {"Silvermoon City Banner", nil},
[88381] = {"Silversage Incense", nil},
[17716] = {"Snowmaster 9000", nil},
[119182] = {"Soul Evacuation Crystal", 1},
[118222] = {"Spirit of Bashiok", 1},
[72161] = {"Spurious Sarcophagus", nil},
[91904] = {"Stackable Stag", nil},
[109739] = {"Star Chart", 1},
[66888] = {"Stave of Fur and Claw", nil},
[116757] = {"Steamworks Sausage Grill", nil},
[111476] = {"Stolen Breath", 1},
[45011] = {"Stormwind Banner", nil},
[37254] = {"Super Simian Sphere", nil},
[52253] = {"Sylvanas' Music Box", nil},
[38578] = {"The Flag of Ownership", nil},
[80822] = {"The Golden Banana", nil},
[50471] = {"The Heartbreaker", nil},
[104323] = {"The Pigskin", nil},
[90883] = {"The Pigskin", 0}, -- Winter Veil 2012
[45013] = {"Thunder Bluff Banner", nil},
[119160] = {"Tickle Totem", 1},
[32782] = {"Time-Lost Figurine", nil},
[54438] = {"Tiny Blue Ragdoll", nil},
[54437] = {"Tiny Green Ragdoll", nil},
[44430] = {"Titanium Seal of Dalaran", nil},
[64997] = {"Tol Barad Searchlight", nil},
[63141] = {"Tol Barad Searchlight", nil},
[88584] = {"Totem of Harmony", nil},
[119144] = {"Touch of the Naaru", 1},
[44606] = {"Toy Train Set", nil},
[116651] = {"True Love Prism", nil},
[88377] = {"Turnip Paint \"Gun\"", nil},
[45016] = {"Undercity Banner", nil},
[45984] = {"Unusual Compass", nil},
[113375] = {"Vindicator's Armor Polish Kit", 1},
[119003] = {"Void Totem", 1},
[69775] = {"Vrykul Drinking Horn", nil},
[69215] = {"War Party Hitching Post", nil},
[119219] = {"Warlord's Flag of Victory", 1},
[104331] = {"Warning Sign", nil},
[117573] = {"Wayfarer's Bonfire", 1},
[45057] = {"Wind-Up Train Wrecker", nil},
[119212] = {"Winning Hand", 1},
[17712] = {"Winter Veil Disguise Kit", nil},
[64651] = {"Wisp Amulet", nil},
[18660] = {"World Enlarger", nil},
[109183] = {"World Shrinker", nil},
[36862] = {"Worn Troll Dice", nil},
[116691] = {"Zhevra Lounge Cushion", 1},
}
function Geppetto:AddBlizzFootnote(button)
-- local name = button:GetName();
-- local gFootnote = _G[name.."GeppettoNote"];
-- if not gFootnote then
-- local toyString = _G[name.."ToyName"];
if not button.gFootnote then
local toyString = button.name
button.gFootnote = button:CreateFontString(nil, "ARTWORK", "GameFontNormalOutline")
button.gFootnote:SetTextColor(0.6, 0.0, 0.0, 1);
button.gFootnote:SetPoint("BOTTOMLEFT", toyString, "TOPLEFT", 0, 0)
end
end
function Geppetto:UpdateBlizzButton(button)
-- local name = button:GetName();
local itemID, toyName, icon = C_ToyBox.GetToyInfo(button.itemID);
local toyString = button.name
local iconTextureUncollected = button.iconTextureUncollected
local gFootnote = button.gFootnote
if toys[itemID] then
-- local toyString = _G[name.."ToyName"];
-- local iconTextureUncollected = _G[name.."IconTextureUncollected"];
-- local gFootnote = _G[name.."GeppettoNote"];
if PlayerHasToy(itemID) then
iconTextureUncollected:SetVertexColor(1.0, 1.0, 1.0, 0.2);
gFootnote:SetText("")
else
-- Unobtainable
if (toys[itemID][2] == 0) then
iconTextureUncollected:SetVertexColor(0.6, 0, 0, 0.2);
toyString:SetTextColor(0.6, 0.0, 0.0, 1);
gFootnote:SetText(UNAVAILABLE)
-- Warlords
elseif (toys[itemID][2] == 1) --[[ and (time() < warlordsEpoch) ]] then
iconTextureUncollected:SetVertexColor(0.6, 0, 0, 0.2);
toyString:SetTextColor(0.6, 0.0, 0.0, 1);
gFootnote:SetText(EXPANSION_NAME5)
else
iconTextureUncollected:SetVertexColor(1.0, 1.0, 1.0, 0.2);
gFootnote:SetText("")
end
end
elseif itemID > 0 then
-- print(itemID, toyName, "is not on Geppetto's list!")
iconTextureUncollected:SetVertexColor(1.0, 1.0, 1.0, 0.2);
gFootnote:SetText(EXPANSION_NAME6)
end
end
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("ADDON_LOADED")
f:SetScript("OnEvent", function(self, event, a1)
if event == "PLAYER_LOGIN" then
Geppetto:RecheckState()
self:RegisterEvent("BAG_UPDATE")
self:RegisterEvent("BANKFRAME_OPENED")
self:RegisterEvent("BANKFRAME_CLOSED")
self:RegisterEvent("TOYS_UPDATED")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("MERCHANT_SHOW")
self:RegisterEvent("MERCHANT_CLOSED")
elseif event == "PLAYER_ENTERING_WORLD" then
-- In case the player hit a loading screen while in the COMPLETE state
-- TODO: What if we load while in a different state?
if Geppetto:GetState() == "COMPLETE" then
Geppetto:SetState("CLOSED")
end
elseif event == "BAG_UPDATE" or event == "BANKFRAME_OPENED" or event == "BANKFRAME_CLOSED" then
Geppetto:RecheckState()
elseif event == "TOYS_UPDATED" then
Geppetto:RecheckState(true)
elseif event == "MERCHANT_SHOW" or event == "MERCHANT_CLOSED" then
Geppetto:RecheckState()
elseif event == "ADDON_LOADED" and a1 == "Blizzard_Collections" then
for i = 1, 18 do
Geppetto:AddBlizzFootnote(ToyBox.iconsFrame["spellButton"..i])
-- Geppetto:AddBlizzFootnote(_G["ToySpellButton"..i])
end
-- Disable in red any unobtainable items.
hooksecurefunc("ToySpellButton_UpdateButton", function(button)
Geppetto:UpdateBlizzButton(button)
end)
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment