/
## Interface: 20300 |
## Title: Industrial: Quest Automation |
## Credits: Industrial |
## Interface: 20400 |
## Notes: Drive by quest NPC interaction |
Libraries\LibStub.lua |
Libraries\idLibrary-1.1.lua |
Addon.lua |
--[[---------------------------------------------------------------------------- |
Copyright (c) 2007, Tom Wieland |
Copyright (c) 2008, Tom Wieland |
All rights reserved. |
Redistribution and use in source and binary forms, with or without |
------------------------------------------------------------------------------]] |
local _G = _G |
local lib = LibStub('idLibrary-1.1') |
local quests = {} |
local frame = CreateFrame('Frame') |
local function stripText (t) -- thx Shadowed |
if not t then return end |
end |
local function GOSSIP_SHOW (event) |
if IsShiftKeyDown() or not GossipFrame:IsVisible() then return end |
if IsShiftKeyDown() then return end |
local button |
local text |
local action |
for i = 1, GossipFrame.buttonIndex do |
button = _G['GossipTitleButton'..i] |
text = stripText(button:GetText()) |
if GossipFrame.buttonIndex then |
for i = 1, GossipFrame.buttonIndex do |
button = _G['GossipTitleButton'..i] |
text = stripText(button:GetText()) |
if button:IsVisible() then |
if button.type == 'Active' then |
if quests[text] then |
action = action or button |
quests[text] = nil |
if button:IsVisible() then |
if button.type == 'Available' then |
button:Click() |
elseif button.type == 'Active' then |
if quests[text] then |
quests[text] = nil |
button:Click() |
end |
end |
elseif button.type == 'Available' then |
action = action or button |
end |
end |
end |
if action then |
action:Click() |
end |
local function QUEST_GREETING (event) |
if IsShiftKeyDown() then return end |
local button |
local text |
for i = 1, 38 do |
button = _G['QuestTitleButton'..i] |
if button then |
text = stripText(button:GetText()) |
if button:IsVisible() then |
if button.isActive == 1 then |
if quests[text] then |
quests[text] = nil |
button:Click() |
end |
else |
button:Click() |
end |
end |
end |
end |
end |
AcceptQuest() |
end |
local function QUEST_ACCEPT_CONFIRM (event) |
if IsShiftKeyDown() then return end |
end |
local function QUEST_PROGRESS (event) |
if IsShiftKeyDown() then return end |
if IsQuestCompletable() then |
SelectQuestLogEntry(startingQuestLogSelection) |
end |
local function enable () |
lib:RegisterEvent('idQuestAutomation', 'GOSSIP_SHOW', GOSSIP_SHOW) |
lib:RegisterEvent('idQuestAutomation', 'QUEST_DETAIL', QUEST_DETAIL) |
lib:RegisterEvent('idQuestAutomation', 'QUEST_PROGRESS', QUEST_PROGRESS) |
lib:RegisterEvent('idQuestAutomation', 'QUEST_COMPLETE', QUEST_COMPLETE) |
lib:RegisterEvent('idQuestAutomation', 'QUEST_LOG_UPDATE', QUEST_LOG_UPDATE) |
local function OnEvent (frame, event, ...) |
AAA = {event, ...} |
if event == 'GOSSIP_SHOW' then |
GOSSIP_SHOW(...) |
elseif event == 'QUEST_GREETING' then |
QUEST_GREETING(...) |
elseif event == 'QUEST_DETAIL' then |
QUEST_DETAIL(...) |
elseif event == 'QUEST_PROGRESS' then |
QUEST_PROGRESS(...) |
elseif event == 'QUEST_COMPLETE' then |
QUEST_COMPLETE(...) |
elseif event == 'QUEST_LOG_UPDATE' then |
QUEST_LOG_UPDATE(...) |
end |
end |
local function disable () |
lib:UnregisterEvent('idQuestAutomation', 'GOSSIP_SHOW') |
lib:UnregisterEvent('idQuestAutomation', 'QUEST_DETAIL') |
lib:UnregisterEvent('idQuestAutomation', 'QUEST_PROGRESS') |
lib:UnregisterEvent('idQuestAutomation', 'QUEST_COMPLETE') |
lib:UnregisterEvent('idQuestAutomation', 'QUEST_LOG_UPDATE') |
end |
lib:RegisterEvent('idQuestAutomation-Enable', 'PLAYER_LOGIN', enable) |
lib:RegisterEvent('idQuestAutomation-Disable', 'PLAYER_LOGOUT', disable) |
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') |