WoWInterface SVN idQuestAutomation

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 3 to Rev 4
    Reverse comparison

Rev 3 → Rev 4

idQuestAutomation.toc
1,3 → 1,8
## Interface: 20400
## Notes: Drive by quest NPC interaction
 
## LoadManagers: AddonLoader
## X-LoadOn-Events: GOSSIP_SHOW
## X-LoadOn-GOSSIP_SHOW: AddonLoader:LoadAddOn('idQuestAutomation') idQuestAutomation:GOSSIP_SHOW()
 
Addon.lua
Addon.lua
28,10 → 28,12
------------------------------------------------------------------------------]]
 
local _G = _G
local quests = {}
local frame = CreateFrame('Frame')
local addon = {}
 
local function stripText (t) -- thx Shadowed
addon.quests = {}
addon.eventframe = CreateFrame('Frame')
 
function addon:stripText (t) -- thx Shadowed
if not t then return end
t = t:gsub('%[.*%]%s*','')
t = t:gsub('|c%x%x%x%x%x%x%x%x(.+)|r','%1')
40,7 → 42,7
return t
end
 
local function GOSSIP_SHOW (event)
function addon:GOSSIP_SHOW (event)
if IsShiftKeyDown() then return end
 
local button
49,14 → 51,14
if GossipFrame.buttonIndex then
for i = 1, GossipFrame.buttonIndex do
button = _G['GossipTitleButton'..i]
text = stripText(button:GetText())
text = self:stripText(button:GetText())
 
if button:IsVisible() then
if button.type == 'Available' then
button:Click()
elseif button.type == 'Active' then
if quests[text] then
quests[text] = nil
if self.quests[text] then
self.quests[text] = nil
button:Click()
end
end
65,7 → 67,7
end
end
 
local function QUEST_GREETING (event)
function addon:QUEST_GREETING (event)
if IsShiftKeyDown() then return end
 
local button
75,12 → 77,12
button = _G['QuestTitleButton'..i]
 
if button then
text = stripText(button:GetText())
text = self:stripText(button:GetText())
 
if button:IsVisible() then
if button.isActive == 1 then
if quests[text] then
quests[text] = nil
if self.quests[text] then
self.quests[text] = nil
button:Click()
end
else
91,26 → 93,26
end
end
 
local function QUEST_DETAIL (event)
function addon:QUEST_DETAIL (event)
if IsShiftKeyDown() then return end
AcceptQuest()
end
 
local function QUEST_PROGRESS (event)
function addon:QUEST_PROGRESS (event)
if IsShiftKeyDown() then return end
if IsQuestCompletable() then
CompleteQuest()
end
end
 
local function QUEST_COMPLETE (event)
function addon:QUEST_COMPLETE (event)
if IsShiftKeyDown() then return end
if GetNumQuestChoices() <= 1 then
GetQuestReward(QuestFrameRewardPanel.itemChoice)
end
end
 
local function QUEST_LOG_UPDATE (event)
function addon:QUEST_LOG_UPDATE (event)
local startingQuestLogSelection = GetQuestLogSelection()
local numEntries, numQuests = GetNumQuestLogEntries()
local q
120,7 → 122,7
SelectQuestLogEntry(i)
q = {GetQuestLogTitle(i)}
if q and q[7] then
quests[q[1]] = true
self.quests[q[1]] = true
end
end
end
128,27 → 130,28
SelectQuestLogEntry(startingQuestLogSelection)
end
 
local function OnEvent (frame, event, ...)
AAA = {event, ...}
function addon.OnEvent (frame, event, ...)
if event == 'GOSSIP_SHOW' then
GOSSIP_SHOW(...)
addon:GOSSIP_SHOW(...)
elseif event == 'QUEST_GREETING' then
QUEST_GREETING(...)
addon:QUEST_GREETING(...)
elseif event == 'QUEST_DETAIL' then
QUEST_DETAIL(...)
addon:QUEST_DETAIL(...)
elseif event == 'QUEST_PROGRESS' then
QUEST_PROGRESS(...)
addon:QUEST_PROGRESS(...)
elseif event == 'QUEST_COMPLETE' then
QUEST_COMPLETE(...)
addon:QUEST_COMPLETE(...)
elseif event == 'QUEST_LOG_UPDATE' then
QUEST_LOG_UPDATE(...)
addon:QUEST_LOG_UPDATE(...)
end
end
 
frame:SetScript('OnEvent', OnEvent)
frame:RegisterEvent('GOSSIP_SHOW')
frame:RegisterEvent('QUEST_GREETING')
frame:RegisterEvent('QUEST_DETAIL')
frame:RegisterEvent('QUEST_PROGRESS')
frame:RegisterEvent('QUEST_COMPLETE')
frame:RegisterEvent('QUEST_LOG_UPDATE')
addon.eventframe:SetScript('OnEvent', addon.OnEvent)
addon.eventframe:RegisterEvent('GOSSIP_SHOW')
addon.eventframe:RegisterEvent('QUEST_GREETING')
addon.eventframe:RegisterEvent('QUEST_DETAIL')
addon.eventframe:RegisterEvent('QUEST_PROGRESS')
addon.eventframe:RegisterEvent('QUEST_COMPLETE')
addon.eventframe:RegisterEvent('QUEST_LOG_UPDATE')
 
_G.idQuestAutomation = addon