AllHearthToyIndex[206195]=412555--Path of the Naaru
--These need covenat checks, can't use it unless you are one. Also, covenant check can't occur until fully loaded; moving this to check along stone checking.
-- Get the current setting for the toybox so we can set it back after we're done.
ToyCollSetting=C_ToyBox.GetCollectedShown()
ToyUnCollSetting=C_ToyBox.GetUncollectedShown()
ToyUsableSetting=C_ToyBox.GetUnusableShown()
C_ToyBox.SetCollectedShown(true)-- List collected toys
C_ToyBox.SetUncollectedShown(false)-- Don't list uncollected toys
C_ToyBox.SetUnusableShown(false)-- Don't list unusable toys in the the collection.
-- Go through all the toys to find the usable stons.
fori=1,C_ToyBox.GetNumFilteredToys()do
-- Go through all the stone to see if this toy is a stone.
forkinpairs(AllHearthToyIndex)do
ifk==C_ToyBox.GetToyFromIndex(i)then
UsableHearthToyIndex[k]=1
end
end
end
-- Reset the toybox filter
C_ToyBox.SetCollectedShown(ToyCollSetting)
C_ToyBox.SetUncollectedShown(ToyUnCollSetting)
C_ToyBox.SetUnusableShown(ToyUsableSetting)
ifnext(UsableHearthToyIndex)then
RHTInitialized=true
end
end
-- We've removed the name from the macro, so now we need to find it so we know which one to edit.
functionGetMacroIndex()
localnumg,numc=GetNumMacros()
fori=1,numgdo
localmacroCont=GetMacroBody(i)
-- Hopefully no other macro ever made has "RHT.b" in it...
ifstring.find(macroCont,"RHT.b")then
RHTIndex=i
end
end
end
-- Have we found the macro yet? Also, make sure the macro we're editing is the right one in case the user rearranged things or deleted it. If not, go find it.
functionCheckMacroIndex()
localmacroCont=GetMacroBody(RHTIndex)
ifmacroContthen
ifstring.find(macroCont,"RHT.b")then
return
end
end
GetMacroIndex()
end
-- Macro writing time.
functionGenMacro(itemID,toyName)
-- Did we find the index? If so, edit that. The macro changes the button to the next stone, but only if we aren't in combat; can't SetAttribute. It then "clicks" the RHTB button
EditMacro(RHTIndex,"","INV_MISC_QUESTIONMARK","#showtooltip item:"..itemID.."\r/run if not InCombatLockdown() then RHT.b:SetAttribute(\"item\",\""..toyName.."\") end\r/click RHTB X "..GetCVar("ActionButtonUseKeyDown"))
CreateMacro("RHT","INV_MISC_QUESTIONMARK","#showtooltip item:"..itemID.."\r/run if not InCombatLockdown() then RHT.b:SetAttribute(\"item\",\""..toyName.."\") end\r/click RHTB X "..GetCVar("ActionButtonUseKeyDown"))