From a98fe0f1e17550fb5c2391289e1c2fc66ef5127b Mon Sep 17 00:00:00 2001 From: p3lim Date: Tue, 28 Dec 2010 02:23:55 +0100 Subject: [PATCH] Rename file and remove Rewards.lua --- Automate.lua | 86 ---------------------------------------------------------- Monomyth.lua | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Monomyth.toc | 3 +- 3 files changed, 87 insertions(+), 88 deletions(-) delete mode 100644 Automate.lua create mode 100644 Monomyth.lua diff --git a/Automate.lua b/Automate.lua deleted file mode 100644 index 245f40e..0000000 --- a/Automate.lua +++ /dev/null @@ -1,86 +0,0 @@ -local addon = CreateFrame('Frame') -addon:SetScript('OnEvent', function(self, event, ...) self[event](...) end) - -local AVAILABLE = [=[Interface\GossipFrame\AvailableQuestIcon]=] -local COMPLETE = [=[Interface\GossipFrame\ActiveQuestIcon]=] - -function addon:Register(event, func) - self:RegisterEvent(event) - self[event] = function(...) - if(not IsShiftKeyDown()) then - func(...) - end - end -end - -addon:Register('GOSSIP_SHOW', function() - for index = 1, NUMGOSSIPBUTTONS do - local button = _G['GossipTitleButton' .. index] - - if(button and button:IsVisible()) then - local icon = _G['GossipTitleButton' .. index .. 'GossipIcon'] - - if(button.type == 'Available' and icon:GetTexture() == AVAILABLE) then - return button:Click() - elseif(button.type == 'Active' and icon:GetTexture() == COMPLETE) then - return button:Click() - end - end - end -end) - -addon:Register('QUEST_DETAIL', function() - if(QuestGetAutoAccept()) then - HideUIPanel(QuestFrame) - else - AcceptQuest() - end -end) - -addon:Register('QUEST_PROGRESS', function() - if(IsQuestCompletable()) then - CompleteQuest() - end -end) - -addon:Register('QUEST_COMPLETE', function() - if(GetNumQuestChoices() <= 1) then - GetQuestReward(QuestFrameRewardPanel.itemChoice) - elseif(GetNumQuestChoices() > 1) then - local bestValue, bestIndex = 0 - - for index = 1, GetNumQuestChoices() do - local item, _, _, _, _, _, _, _, _, _, value = GetItemInfo(GetQuestItemLink('choice', index)) - - if(value > bestValue) then - bestValue, bestIndex = value, index - end - end - - QuestInfoItem_OnClick(_G['QuestInfoItem' .. bestIndex]) - end -end) - -addon:Register('QUEST_AUTOCOMPLETE', function() - for index = 1, GetNumAutoQuestPopUps() do - local quest, type = GetAutoQuestPopUp(index) - - if(type == 'COMPLETE') then - ShowQuestComplete(GetQuestLogIndexByID(quest)) - end - end -end) - -addon:Register('ITEM_PUSH', function(bag) - -- This is some weird shit - if(bag > 0) then - bag = bag - CharacterBag0Slot:GetID() + 1 - end - - for slot = 1, GetContainerNumSlots(bag) do - local _, id, active = GetContainerItemQuestInfo(bag, slot) - if(id and not active) then - UseContainerItem(bag, slot) - end - end -end) diff --git a/Monomyth.lua b/Monomyth.lua new file mode 100644 index 0000000..245f40e --- /dev/null +++ b/Monomyth.lua @@ -0,0 +1,86 @@ +local addon = CreateFrame('Frame') +addon:SetScript('OnEvent', function(self, event, ...) self[event](...) end) + +local AVAILABLE = [=[Interface\GossipFrame\AvailableQuestIcon]=] +local COMPLETE = [=[Interface\GossipFrame\ActiveQuestIcon]=] + +function addon:Register(event, func) + self:RegisterEvent(event) + self[event] = function(...) + if(not IsShiftKeyDown()) then + func(...) + end + end +end + +addon:Register('GOSSIP_SHOW', function() + for index = 1, NUMGOSSIPBUTTONS do + local button = _G['GossipTitleButton' .. index] + + if(button and button:IsVisible()) then + local icon = _G['GossipTitleButton' .. index .. 'GossipIcon'] + + if(button.type == 'Available' and icon:GetTexture() == AVAILABLE) then + return button:Click() + elseif(button.type == 'Active' and icon:GetTexture() == COMPLETE) then + return button:Click() + end + end + end +end) + +addon:Register('QUEST_DETAIL', function() + if(QuestGetAutoAccept()) then + HideUIPanel(QuestFrame) + else + AcceptQuest() + end +end) + +addon:Register('QUEST_PROGRESS', function() + if(IsQuestCompletable()) then + CompleteQuest() + end +end) + +addon:Register('QUEST_COMPLETE', function() + if(GetNumQuestChoices() <= 1) then + GetQuestReward(QuestFrameRewardPanel.itemChoice) + elseif(GetNumQuestChoices() > 1) then + local bestValue, bestIndex = 0 + + for index = 1, GetNumQuestChoices() do + local item, _, _, _, _, _, _, _, _, _, value = GetItemInfo(GetQuestItemLink('choice', index)) + + if(value > bestValue) then + bestValue, bestIndex = value, index + end + end + + QuestInfoItem_OnClick(_G['QuestInfoItem' .. bestIndex]) + end +end) + +addon:Register('QUEST_AUTOCOMPLETE', function() + for index = 1, GetNumAutoQuestPopUps() do + local quest, type = GetAutoQuestPopUp(index) + + if(type == 'COMPLETE') then + ShowQuestComplete(GetQuestLogIndexByID(quest)) + end + end +end) + +addon:Register('ITEM_PUSH', function(bag) + -- This is some weird shit + if(bag > 0) then + bag = bag - CharacterBag0Slot:GetID() + 1 + end + + for slot = 1, GetContainerNumSlots(bag) do + local _, id, active = GetContainerItemQuestInfo(bag, slot) + if(id and not active) then + UseContainerItem(bag, slot) + end + end +end) diff --git a/Monomyth.toc b/Monomyth.toc index cc89810..d6b69a6 100644 --- a/Monomyth.toc +++ b/Monomyth.toc @@ -4,5 +4,4 @@ ## Title: Monomyth ## Notes: Questing enhancements -Automate.lua -Rewards.lua +Monomyth.lua -- 1.7.9.5