Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local global,character
- local found = nil
- local debug = nil
- local QuestItems = {}
- --API
- --NOCOMBAT (2.0) CreateMacro("name", icon, "body", perCharacter, isLocal) - Create a new macro.
- --CursorHasMacro() - Returns 1 if the cursor is currently dragging a macro. (New: 2.0.3)
- --DeleteMacro(id or "name") - Deletes a macro.
- --NOCOMBAT (2.0) EditMacro(index, "name", iconIndex, "body", isLocal, perCharacter) - Saves a macro.
- --GetMacroBody(id or "name") - Returns the body (macro text) of a macro.
- --GetMacroIconInfo(index) - Returns texture of the icons provided by Blizzard.
- --GetMacroItemIconInfo(index) - Returns texture of the item icons provided by Blizzard
- --GetMacroIndexByName("name") - Returns macro index.
- --GetMacroInfo(id or "name") - Returns "name", "iconTexture", "body", isLocal.
- --GetNumMacroIcons() - Returns the number of usable icons provided by Blizzard.
- --GetNumMacroItemIcons() - Returns the number of usable item icons provided by Blizzard.
- function QQI_UpdateMacro(unit)
- global,character = GetNumMacros()
- found = nil
- for i=1,global do
- local name = GetMacroInfo(i)
- if name == "QQI_MACRO" then
- found = true
- if unit then
- print(unit)
- --check quest items for 'unit' update macro to use parsed item
- else
- if not InCombatLockdown() end
- EditMacro(i, "QQI_MACRO",1,"#showtooltip\n--QQI_MACRO--\n/cast Mage Armor",nil,nil)
- end
- end
- end
- end
- if not found then
- QQI_CreateMacro()
- end
- end
- function QQI_CreateMacro()
- found = nil
- global,character = GetNumMacros()
- if global < 36 then -- Checks to make sure there is macro space.
- for i=1,global do
- local name = GetMacroInfo(i)
- if name == "QQI_MACRO" then
- found = true
- QQI_UpdateMacro()
- print("Macro Updated!")
- end
- end
- if not found and not InCombatLockdown() then
- CreateMacro("QQI_MACRO",1,"--QQI_MACRO--",nil,nil)
- print("Macro Created!")
- end
- else
- print("No macro space.")
- end
- end
- local QQI = CreateFrame("Frame","QQI")
- QQI:SetScript("OnEvent",function(self,event,...)
- local arg1,arg2,arg3,arg4 = ...
- if event == "ADDON_LOADED" then
- self:UnregisterEvent("ADDON_LOADED")
- elseif event == "PLAYER_ENTERING_WORLD" then
- QQI_CreateMacro()
- elseif event == "PLAYER_TARGET_CHANGED" then
- QQI_UpdateMacro("target")
- elseif event == "UPDATE_MOUSEOVER_UNIT" then
- QQI_UpdateMacro("mouseover")
- --elseif event == "Quest event name here" then
- --ParseInventoryForQuestItems()
- else
- if debug then
- if arg2 then
- print(event.." "..arg1.." "..arg2)
- elseif arg1 then
- print(event.." "..arg1)
- else
- print(event)
- end
- end
- end
- end)
- QQI:RegisterEvent("ADDON_LOADED")
- QQI:RegisterEvent("PLAYER_FOCUS_CHANGED")
- QQI:RegisterEvent("PLAYER_TARGET_CHANGED")
- QQI:RegisterEvent("PLAYER_ENTERING_WORLD")
- QQI:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
- -- Register quest update events to check for any new quest items with 'use' abilities
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement