Automate Quests - user config added

This commit is contained in:
Sattva
2024-03-27 11:50:33 +03:00
parent b9028bdd76
commit ae404dd1e6
2 changed files with 44 additions and 28 deletions
+2
View File
@@ -27,6 +27,8 @@ Manage Debuffs - make it somehow to be movable even if there are no debuffs show
-- What needs to be tested:
--------------------------------------------------------------------------------
Manage Debuffs - if debuff button reset working fine.
ElvUI - Need to see what disabled for when ElvUI is loaded. May be something is not made in 3.3.5 ElvUI backport, but still disabled.
Auto-Ress in BG - With option "Exclude Alterac" will it not auto-res in Alterac BG ?
+42 -28
View File
@@ -2319,11 +2319,38 @@
----------------------------------------------------------------------
-- Automate quests (no reload required)
-- Code from idQuestAutomation 2.4.3
----------------------------------------------------------------------
do
local addon = CreateFrame('Frame')
addon.completedQuests = {}
addon.uncompletedQuests = {}
function addon:OnEvent(event, ...)
if self[event] then
self[event](self, ...)
end
end
addon:SetScript('OnEvent', addon.OnEvent)
-- Function to setup events
local function SetupEvents()
if LeaPlusLC["AutomateQuests"] == "On" then
addon:RegisterEvent('GOSSIP_SHOW')
addon:RegisterEvent('QUEST_COMPLETE')
addon:RegisterEvent('QUEST_DETAIL')
addon:RegisterEvent('QUEST_FINISHED')
addon:RegisterEvent('QUEST_GREETING')
addon:RegisterEvent('QUEST_LOG_UPDATE')
addon:RegisterEvent('QUEST_PROGRESS')
else
addon:UnregisterAllEvents()
end
end
-- Create configuration panel
local QuestPanel = LeaPlusLC:CreatePanel("Automate quests", "QuestPanel")
@@ -2332,7 +2359,11 @@
LeaPlusLC:MakeCB(QuestPanel, "AutoQuestCompleted", "Turn-in completed quests automatically", 16, -112, false, "If checked, completed quests will be turned-in automatically.")
LeaPlusLC:MakeCB(QuestPanel, "AutoQuestShift", "Require override key for quest automation", 16, -132, false, "If checked, you will need to hold the override key down for quests to be automated.|n|nIf unchecked, holding the override key will prevent quests from being automated.")
LeaPlusLC:CreateDropDown("AutoQuestKeyMenu", "Override key", QuestPanel, 146, "TOPLEFT", 356, -115, {L["SHIFT"], L["ALT"], L["CONTROL"], L["CMD (MAC)"]}, "")
LeaPlusLC:CreateDropDown("AutoQuestKeyMenu", "Override key", QuestPanel, 146, "TOPLEFT", 356, -115, {L["SHIFT"], L["ALT"], L["CONTROL"]}, "")
-- Setup events when option is clicked and on startup (if option is enabled)
LeaPlusCB["AutomateQuests"]:HookScript("OnClick", SetupEvents)
if LeaPlusLC["AutomateQuests"] == "On" then SetupEvents() end
-- Help button hidden
QuestPanel.h:Hide()
@@ -2340,6 +2371,7 @@
-- Back button handler
QuestPanel.b:SetScript("OnClick", function()
QuestPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page1"]:Show();
SetupEvents()
return
end)
@@ -2354,7 +2386,7 @@
-- Refresh panel
QuestPanel:Hide(); QuestPanel:Show()
SetupEvents()
end)
-- Show panal when options panel button is clicked
@@ -2369,20 +2401,16 @@
QuestPanel:Show()
LeaPlusLC:HideFrames()
end
SetupEvents()
end)
local addon = CreateFrame('Frame')
addon.completedQuests = {}
addon.uncompletedQuests = {}
--===== Config Panel Setup END =====--
-- Function to determine if override key is being held (from 2nd code)
local function IsOverrideKeyDown()
if LeaPlusLC["AutoQuestKeyMenu"] == 1 and IsShiftKeyDown()
or LeaPlusLC["AutoQuestKeyMenu"] == 2 and IsAltKeyDown()
or LeaPlusLC["AutoQuestKeyMenu"] == 3 and IsControlKeyDown()
or LeaPlusLC["AutoQuestKeyMenu"] == 4 and IsMetaKeyDown()
then
return true
end
@@ -2392,7 +2420,6 @@
if LeaPlusLC["AutoQuestCompleted"] == "Off" or (LeaPlusLC["AutoQuestShift"] == "On" and not IsOverrideKeyDown()) or (LeaPlusLC["AutoQuestShift"] == "Off" and IsOverrideKeyDown()) then
return false
else
print(LeaPlusLC["AutoQuestCompleted"] == "Off")
return true
end
end
@@ -2485,22 +2512,6 @@
end
end
function addon:OnEvent(event, ...)
if self[event] then
self[event](self, ...)
end
end
addon:SetScript('OnEvent', addon.OnEvent)
addon:RegisterEvent('GOSSIP_SHOW')
addon:RegisterEvent('QUEST_COMPLETE')
addon:RegisterEvent('QUEST_DETAIL')
addon:RegisterEvent('QUEST_FINISHED')
addon:RegisterEvent('QUEST_GREETING')
addon:RegisterEvent('QUEST_LOG_UPDATE')
addon:RegisterEvent('QUEST_PROGRESS')
_G.Leatrix_Plus = addon
@@ -11344,8 +11355,10 @@
LeaPlusLC["DebuffButton1X"] = -205
LeaPlusLC["DebuffButton1Y"] = -205
LeaPlusLC["DebuffButton1Scale"] = 1
DebuffButton1:ClearAllPoints()
DebuffButton1:SetPoint(LeaPlusLC["DebuffButton1A"], UIParent, LeaPlusLC["DebuffButton1R"], LeaPlusLC["DebuffButton1X"], LeaPlusLC["DebuffButton1Y"])
if DebuffButton1 then
DebuffButton1:ClearAllPoints()
DebuffButton1:SetPoint(LeaPlusLC["DebuffButton1A"], UIParent, LeaPlusLC["DebuffButton1R"], LeaPlusLC["DebuffButton1X"], LeaPlusLC["DebuffButton1Y"])
end
-- Refresh configuration panel
DeBuffPanel:Hide(); DeBuffPanel:Show()
@@ -11358,6 +11371,7 @@
-- Show configuration panel when options panel button is clicked
LeaPlusCB["ManageDeBuffsButton"]:SetScript("OnClick", function()
if not DebuffButton1 then print("Leatrix Plus: In order to move debuffs, need to have one. \nFor example Ghost.") return end
if IsShiftKeyDown() and IsControlKeyDown() then
-- Preset profile
LeaPlusLC["DebuffButton1A"] = "TOPRIGHT"