v9.7.2: Ebonhold Database integration and core logic refinements
This commit is contained in:
@@ -0,0 +1,220 @@
|
||||
---@type QuestieAuto
|
||||
local QuestieAuto = QuestieLoader:ImportModule("QuestieAuto")
|
||||
local _QuestieAuto = QuestieAuto.private
|
||||
|
||||
|
||||
-- NPC Id based.
|
||||
---@see QuestieAutoPrivate
|
||||
_QuestieAuto.disallowedNPC = {
|
||||
-- AQ
|
||||
-- Ally
|
||||
[15458] = true, -- Commander Stronghammer (Alliance Ambassador)
|
||||
[15701] = true, -- Field Marshal Snowfall (War Effort Commander)
|
||||
-- Horde
|
||||
[15539] = true, -- General Zog (Horde Ambassador)
|
||||
[15700] = true, -- Warlord Gorchuk (War Effort Commander)
|
||||
-- Commendations
|
||||
[15764] = true, -- Officer Ironbeard (Ironforge Commendations)
|
||||
[15762] = true, -- Officer Lunalight (Darnassus Commendations)
|
||||
[15766] = true, -- Officer Maloof (Stormwind Commendations)
|
||||
[15763] = true, -- Officer Porterhouse (Gnomeregan Commendations)
|
||||
[15768] = true, -- Officer Gothena (Undercity Commendations)
|
||||
[15765] = true, -- Officer Redblade (Orgrimmar Commendations)
|
||||
[15767] = true, -- Officer Thunderstrider (Thunder Bluff Commendations)
|
||||
[15761] = true, -- Officer Vu'Shalay (Darkspear Commendations)
|
||||
[15731] = true, -- Darnassus Commendation Officer
|
||||
[15737] = true, -- Darkspear Commendation Officer
|
||||
[15735] = true, -- Stormwind Commendation Officer
|
||||
[15739] = true, -- Thunder Bluff Commendation Officer
|
||||
[15736] = true, -- Orgrimmar Commendation Officer
|
||||
[15734] = true, -- Ironforge Commendation Officer
|
||||
[15738] = true, -- Undercity Commendation Officer
|
||||
[15733] = true, -- Gnomeregan Commendation Officer
|
||||
-- AQ gear turnin
|
||||
[15378] = true,
|
||||
[15380] = true,
|
||||
[15498] = true,
|
||||
[15499] = true,
|
||||
[15500] = true,
|
||||
[15503] = true,
|
||||
-- Stray
|
||||
[7802] = true, -- Galvan the Ancient (Blacksmith recipes, Stranglethorn Vale)
|
||||
[12944] = true, -- Lokhtos Darkbargainer (Thorium Brotherhood, Blackrock Depths)
|
||||
[14567] = true, -- Derotain Mudsipper (Blacksmith recipes, Tanaris)
|
||||
[14828] = true, -- Gelvas Grimegate (Darkmoon Faire Ticket Redemption)
|
||||
[14921] = true, -- Rin'wosho the Trader (Zul'Gurub Isle, Stranglethorn Vale)
|
||||
[15192] = true, -- Anachronos (Caverns of Time)
|
||||
[15909] = true, -- Fariel Starsong <Coin of Ancestry Collector> (Lunar Festival)
|
||||
[18166] = true, -- Khadgar (Allegiance to Aldor/Scryer, Shattrath)
|
||||
[18253] = true, -- Archmage Leryda (Violet Eye)
|
||||
[18471] = true, -- Gurgthock (The Ring of Blood)
|
||||
[19935] = true, -- Soridormi (The Scale of Sands)
|
||||
[19936] = true, -- Arazmodu (The Scale of Sands)
|
||||
[25112] = true, -- Anchorite Ayuri (Shattered Sun Offensive Charity NPC)
|
||||
[25163] = true, -- Anchorite Kairthos (Shattered Sun Offensive Title NPC)
|
||||
|
||||
-- SoD Waylaid supply officers
|
||||
[213077] = true,
|
||||
[214070] = true,
|
||||
[214096] = true,
|
||||
[214098] = true,
|
||||
[214099] = true,
|
||||
[214101] = true,
|
||||
}
|
||||
|
||||
---@see QuestieAutoPrivate
|
||||
_QuestieAuto.disallowedQuests = {
|
||||
-- Escort Quests
|
||||
[155] = true, -- The Defias Traitor (The Defias Brotherhood)
|
||||
[219] = true, -- Corporal Keeshan (Missing In Action)
|
||||
[309] = true, -- Miran (Protecting the Shipment)
|
||||
[349] = true, -- Stranglethorn Fever (Consumes items)
|
||||
[434] = true, -- Tyrion (The Attack!)
|
||||
[435] = true, -- Deathstalker Erland (Escorting Erland)
|
||||
[648] = true, -- Homing Robot OOX-17/TN (Rescue OOX-17/TN!)
|
||||
[660] = true, -- Kinelory (Hints of a New Plague?)
|
||||
[665] = true, -- Professor Phizzlethorpe (Sunken Treasure)
|
||||
[667] = true, -- Shakes O'Breen (Death From Below)
|
||||
[731] = true, -- Prospector Remtravel (The Absent Minded Prospector)
|
||||
[836] = true, -- Homing Robot OOX-09/HL (Rescue OOX-09/HL!)
|
||||
[863] = true, -- Wizzlecrank's Shredder (The Escape)
|
||||
[898] = true, -- Gilthares Firebough (Free From the Hold)
|
||||
[938] = true, -- Mist (Mist)
|
||||
[945] = true, -- Therylune (Therylune's Escape)
|
||||
[976] = true, -- Feero Ironhand (Supplies to Auberdine)
|
||||
[994] = true, -- Volcor (Escape Through Force)
|
||||
[995] = true, -- Volcor (Escape Through Stealth)
|
||||
[1144] = true, -- Willix the Importer (Willix the Importer)
|
||||
[1120] = true, -- Get the Gnomes Drunk
|
||||
[1121] = true, -- Get the Goblins Drunk
|
||||
[1222] = true, -- Stinky Ignatz (Stinky's Escape)
|
||||
[1270] = true, -- Stinky Ignatz (Stinky's Escape)
|
||||
[1273] = true, -- Ogron (Questioning Reethe)
|
||||
[1324] = true, -- Private Hendel (The Missing Diplomat)
|
||||
[1393] = true, -- Galen Goodward (Galen's Escape)
|
||||
[1440] = true, -- Dalinda Malem (Return to Vahlarriel)
|
||||
[1560] = true, -- Tooga (Tooga's Quest)
|
||||
[2742] = true, -- Rin'ji (Rin'ji is Trapped!)
|
||||
[2767] = true, -- Homing Robot OOX-22/FE (Rescue OOX-22/FE!)
|
||||
[2845] = true, -- Shay Leafrunner (Wandering Shay)
|
||||
[2904] = true, -- Kernobee (A Fine Mess)
|
||||
[3367] = true, -- Dorius Stonetender (Suntara Stones)
|
||||
[3382] = true, -- Captain Vanessa Beltis (A Crew Under Fire)
|
||||
[3525] = true, -- Belnistrasz (Extinguishing the Idol)
|
||||
[3982] = true, -- Commander Gor'shak (What Is Going On?)
|
||||
[4121] = true, -- Grark Lorkrub (Precarious Predicament)
|
||||
[4245] = true, -- A-Me 01 (Chasing A-Me 01)
|
||||
[4261] = true, -- Arei (Ancient Spirit)
|
||||
[4322] = true, -- Marshal Windsor (Jail Break!)
|
||||
[4491] = true, -- Ringo (A Little Help From My Friends)
|
||||
[4770] = true, -- Pao'ka Swiftmountain (Homeward Bound)
|
||||
[4901] = true, -- Ranshalla (Guardians of the Altar)
|
||||
[4904] = true, -- Lakota Windsong (Free at Last)
|
||||
[4962] = true, -- Shard of a Felhound Warlock special quest
|
||||
[4963] = true, -- Shard of an Infernal Warlock special quest
|
||||
[4966] = true, -- Kanati Greycloud (Protect Kanati Greycloud)
|
||||
[5203] = true, -- Captured Arko'narin (Rescue From Jaedenar)
|
||||
[5321] = true, -- Kerlonian Evershade (The Sleeper Has Awakened)
|
||||
[5713] = true, -- Sentinel Aynasha (One Shot. One Kill.)
|
||||
[5821] = true, -- Cork Gizelton (Bodyguard for Hire)
|
||||
[5943] = true, -- Rigger Gizelton (Gizelton Caravan)
|
||||
[5944] = true, -- Highlord Taelan Fordring (In Dreams)
|
||||
[6132] = true, -- Melizza Brimbuzzle (Get Me Out of Here!)
|
||||
[6403] = true, -- Reginald Windsor (The Great Masquerade)
|
||||
[6482] = true, -- Ruul Snowhoof (Freedom to Ruul)
|
||||
[6523] = true, -- Kaya Flathoof (Protect Kaya)
|
||||
[6544] = true, -- Torek (Torek's Assault)
|
||||
[6641] = true, -- Muglash (Vorsha the Lasher)
|
||||
[7046] = true, -- Celebras the Redeemed (The Scepter of Celebras)
|
||||
[7637] = true, -- Emphasis on Sacrifice (Paladin quest)
|
||||
[3375] = true,
|
||||
[2948] = true,
|
||||
[2199] = true,
|
||||
[2950] = true,
|
||||
[4781] = true,
|
||||
[4083] = true,
|
||||
[5166] = true,
|
||||
[5167] = true,
|
||||
[5067] = true,
|
||||
[5063] = true,
|
||||
[5068] = true,
|
||||
[8196] = true,
|
||||
[9212] = true, -- Escape from the Catacombs
|
||||
[9338] = true, -- Allegiance to Cenarion Circle
|
||||
[9446] = true, -- Tomb of the Lightbringer
|
||||
[9528] = true, -- A Cry For Help
|
||||
[9729] = true, -- Fhwoor Smash!
|
||||
[9752] = true, -- Escape from Umbrafen
|
||||
[9868] = true, -- The Totem of Kar'dash
|
||||
[9879] = true, -- The Totem of Kar'dash
|
||||
[10051] = true, -- Escape from Firewing Point!
|
||||
[10052] = true, -- Escape from Firewing Point!
|
||||
[10191] = true, -- Mark V is Alive!
|
||||
[10218] = true, -- Someone Else's Hard Work Pays Off
|
||||
[10310] = true, -- Sabotage the Warp-Gate!
|
||||
[10337] = true, -- When the Cows Come Home
|
||||
[10346] = true, -- Gryphoneer Windbellow (Return to the Abyssal Shelf) (Alliance)
|
||||
[10347] = true, -- Wing Commander Brack (Return to the Abyssal Shelf) (Horde)
|
||||
[10406] = true, -- Delivering the Message
|
||||
[10425] = true, -- Escape from the Staging Grounds
|
||||
[10451] = true, -- Escape from Coilskar Cistern
|
||||
[10898] = true, -- Skywing
|
||||
[10922] = true, -- Digging Through Bones
|
||||
[10975] = true, -- Purging the Chambers of Bash'ir
|
||||
[11085] = true, -- Escape from Skettis
|
||||
[11189] = true, -- One Last Time
|
||||
[11241] = true, -- Trail of Fire
|
||||
[11570] = true, -- Escape from the Winterfin Caverns
|
||||
[11673] = true, -- Get Me Outa Here!
|
||||
[11930] = true, -- Across Transborea
|
||||
[12082] = true, -- Dun-da-Dun-tah!
|
||||
[12570] = true, -- Fortunate Misunderstandings
|
||||
[12832] = true, -- Bitter Departure
|
||||
[13221] = true, -- I'm Not Dead Yet!
|
||||
[13229] = true, -- I'm Not Dead Yet!
|
||||
[13284] = true, -- Assault by Ground
|
||||
[13301] = true, -- Assault by Ground
|
||||
[13481] = true, -- Let's Get Out of Here!
|
||||
[13482] = true, -- Let's Get Out of Here
|
||||
-- Netherwing Drake quests
|
||||
[11109] = true,
|
||||
[11110] = true,
|
||||
[11111] = true,
|
||||
[11112] = true,
|
||||
[11113] = true,
|
||||
[11114] = true,
|
||||
-- The Barrens Bloodshard quests
|
||||
[889] = true,
|
||||
[5042] = true,
|
||||
[5043] = true,
|
||||
[5044] = true,
|
||||
[5045] = true,
|
||||
[5046] = true,
|
||||
-- AQ
|
||||
[8548] = true,
|
||||
[8572] = true,
|
||||
[8573] = true,
|
||||
[8574] = true,
|
||||
[8288] = true,
|
||||
-- Aldor/scryer quests
|
||||
[10551] = true,
|
||||
[10552] = true,
|
||||
-- PvP token quests
|
||||
[8367] = true,
|
||||
[8388] = true,
|
||||
[8371] = true,
|
||||
[8385] = true,
|
||||
[64845] = true,
|
||||
--
|
||||
[12174] = true, -- Flies you across Dragonblight
|
||||
[12567] = true, -- Blessing of Zim'Abwa repeatable
|
||||
[12618] = true, -- Blessing of Zim'Torga repeatable
|
||||
[12656] = true, -- Blessing of Zim'Rhuk repeatable
|
||||
|
||||
[11705] = true, -- Foolish Endeavors
|
||||
[11733] = true, -- Traversing the Rift
|
||||
[12671] = true, -- Reconnaissance Flight
|
||||
|
||||
[13926] = true, -- Little Orphan Roo of the Oracles
|
||||
[13927] = true, -- Little Orphan Kekek of the Wolvar
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
---@type QuestieAuto
|
||||
local QuestieAuto = QuestieLoader:ImportModule("QuestieAuto")
|
||||
---@class QuestieAutoPrivate
|
||||
---@field disallowedNPC table<NpcId, boolean>
|
||||
---@field disallowedQuests table<QuestId, boolean>
|
||||
local _QuestieAuto = QuestieAuto.private
|
||||
|
||||
--- COMPATIBILITY ---
|
||||
local UnitGUID = QuestieCompat.UnitGUID
|
||||
local GetQuestID = QuestieCompat.GetQuestID
|
||||
|
||||
function _QuestieAuto:AllQuestWindowsClosed()
|
||||
if GossipFrame and (not GossipFrame:IsVisible())
|
||||
and GossipFrameGreetingPanel and (not GossipFrameGreetingPanel:IsVisible())
|
||||
and QuestFrameGreetingPanel and (not QuestFrameGreetingPanel:IsVisible())
|
||||
and QuestFrameDetailPanel and (not QuestFrameDetailPanel:IsVisible())
|
||||
and QuestFrameProgressPanel and (not QuestFrameProgressPanel:IsVisible())
|
||||
and QuestFrameRewardPanel and (not QuestFrameRewardPanel:IsVisible()) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function _QuestieAuto:AcceptQuestFromGossip(index, availableQuests, modulo)
|
||||
local title = availableQuests[index]
|
||||
local isTrivial = availableQuests[index + 2]
|
||||
local isRepeatable = availableQuests[index + 4]
|
||||
|
||||
if _QuestieAuto:IsAllowedQuest(true, title) and ((not isTrivial) or Questie.db.profile.acceptTrivial) then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Checking available quest: \"" .. title .. "\"",
|
||||
"isTrivial", isTrivial, "isRepeatable", isRepeatable, "index",
|
||||
index)
|
||||
QuestieCompat.SelectAvailableQuest(math.floor(index / modulo) + 1)
|
||||
end
|
||||
end
|
||||
|
||||
function _QuestieAuto:CompleteQuestFromGossip(index, availableQuests, modulo)
|
||||
local title = availableQuests[index]
|
||||
local isComplete = availableQuests[index + 3]
|
||||
|
||||
if _QuestieAuto:IsAllowedQuest() and isComplete and title then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Checking active quest: \"" .. title .. "\"", "index", index)
|
||||
QuestieCompat.SelectActiveQuest(math.floor(index / modulo) + 1)
|
||||
else
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] \"" .. title .. "\" is not complete. Index:", index)
|
||||
end
|
||||
end
|
||||
|
||||
function _QuestieAuto:TurnInQuest(rewardIndex)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "Turn in!")
|
||||
|
||||
-- We really want to disable this in instances, mostly to prevent retards from ruining groups.
|
||||
if (Questie.db.profile.autocomplete and _QuestieAuto:IsAllowedNPC() and _QuestieAuto:IsAllowedQuest()) then
|
||||
GetQuestReward(rewardIndex)
|
||||
end
|
||||
end
|
||||
|
||||
function _QuestieAuto:IsAllowedNPC()
|
||||
local npcGuid = UnitGUID("target") or nil
|
||||
local allowed = true
|
||||
if npcGuid then
|
||||
---@type string, string, string, string, string, string
|
||||
local _, _, _, _, _, npcIDStr = strsplit("-", npcGuid)
|
||||
if npcIDStr then
|
||||
local npcId = tonumber(npcIDStr)
|
||||
if (_QuestieAuto.disallowedNPC[npcId] ~= nil) then
|
||||
allowed = false
|
||||
end
|
||||
Questie:Debug(Questie.DEBUG_INFO, "[QuestieAuto] Is NPC-ID", npcId, "allowed:", allowed)
|
||||
end
|
||||
end
|
||||
|
||||
return allowed
|
||||
end
|
||||
|
||||
function _QuestieAuto:IsAllowedQuest(questStarter, title)
|
||||
local questId = GetQuestID(questStarter, title)
|
||||
local allowed = true
|
||||
if questId > 0 then
|
||||
if (_QuestieAuto.disallowedQuests[questId] ~= nil) then
|
||||
allowed = false
|
||||
end
|
||||
Questie:Debug(Questie.DEBUG_INFO, "[QuestieAuto]", "Is questId", questId, "allowed:", allowed)
|
||||
end
|
||||
|
||||
return allowed
|
||||
end
|
||||
|
||||
local bindTruthTable = {
|
||||
['shift'] = function()
|
||||
return IsShiftKeyDown()
|
||||
end,
|
||||
['ctrl'] = function()
|
||||
return IsControlKeyDown()
|
||||
end,
|
||||
['alt'] = function()
|
||||
return IsAltKeyDown()
|
||||
end,
|
||||
['disabled'] = function() return false; end,
|
||||
}
|
||||
|
||||
function _QuestieAuto:IsBindTrue(bind)
|
||||
return bind and bindTruthTable[bind]()
|
||||
end
|
||||
@@ -0,0 +1,307 @@
|
||||
---@class QuestieAuto
|
||||
---@field private private QuestieAutoPrivate
|
||||
local QuestieAuto = QuestieLoader:CreateModule("QuestieAuto");
|
||||
local _QuestieAuto = QuestieAuto.private
|
||||
---@type QuestieDB
|
||||
local QuestieDB = QuestieLoader:ImportModule("QuestieDB");
|
||||
|
||||
--- COMPATIBILITY ---
|
||||
local C_Timer = QuestieCompat.C_Timer
|
||||
local GetQuestID = QuestieCompat.GetQuestID
|
||||
|
||||
local shouldRunAuto = true
|
||||
local doneTalking = false
|
||||
|
||||
local cameFromProgressEvent = false
|
||||
local isAllowedNPC = false
|
||||
local lastAmountOfAvailableQuests = 0
|
||||
local lastNPCTalkedTo
|
||||
local doneWithAccept = false
|
||||
local lastIndexTried = 1
|
||||
local lastEvent
|
||||
|
||||
local MOP_INDEX_AVAILABLE = 7 -- was '5' in Cataclysm
|
||||
local MOP_INDEX_COMPLETE = 6 -- was '4' in Cataclysm
|
||||
|
||||
-- forward declarations
|
||||
local _SelectAvailableQuest
|
||||
|
||||
|
||||
local function ResetModifier()
|
||||
shouldRunAuto = true
|
||||
lastEvent = nil
|
||||
end
|
||||
|
||||
function QuestieAuto:GOSSIP_SHOW(event, ...)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto][EVENT] GOSSIP_SHOW", event, ...)
|
||||
doneTalking = false
|
||||
|
||||
if (not shouldRunAuto) then
|
||||
return
|
||||
elseif _QuestieAuto:IsBindTrue(Questie.db.profile.autoModifier) then
|
||||
shouldRunAuto = false
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Modifier-Key down: Disabling QuestieAuto for now")
|
||||
return
|
||||
end
|
||||
lastEvent = "GOSSIP_SHOW"
|
||||
|
||||
local availableQuests = { QuestieCompat.GetAvailableQuests() }
|
||||
local currentNPC = UnitName("target")
|
||||
if lastNPCTalkedTo ~= currentNPC or #availableQuests ~= lastAmountOfAvailableQuests then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Greeted by a new NPC")
|
||||
lastNPCTalkedTo = currentNPC
|
||||
isAllowedNPC = _QuestieAuto:IsAllowedNPC()
|
||||
lastIndexTried = 1
|
||||
lastAmountOfAvailableQuests = #availableQuests
|
||||
doneWithAccept = false
|
||||
end
|
||||
|
||||
if cameFromProgressEvent then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Last event was Progress")
|
||||
cameFromProgressEvent = false
|
||||
lastIndexTried = lastIndexTried + MOP_INDEX_AVAILABLE
|
||||
end
|
||||
|
||||
-- Turn in complete quests
|
||||
if Questie.db.profile.autocomplete and isAllowedNPC then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Checking active quests from gossip")
|
||||
local completeQuests = { QuestieCompat.GetActiveQuests() }
|
||||
|
||||
for index = 1, #completeQuests, MOP_INDEX_COMPLETE do
|
||||
_QuestieAuto:CompleteQuestFromGossip(index, completeQuests, MOP_INDEX_COMPLETE)
|
||||
end
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] DONE. Checked all complete quests")
|
||||
end
|
||||
|
||||
-- Accept new quests
|
||||
if Questie.db.profile.autoaccept and (not doneWithAccept) and isAllowedNPC then
|
||||
if lastIndexTried < #availableQuests then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Checking available quests from gossip")
|
||||
_QuestieAuto:AcceptQuestFromGossip(lastIndexTried, availableQuests, MOP_INDEX_AVAILABLE)
|
||||
return
|
||||
else
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] DONE. Checked all available quests")
|
||||
doneWithAccept = true
|
||||
lastIndexTried = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function QuestieAuto:QUEST_PROGRESS(event, ...)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto][EVENT] QUEST_PROGRESS", event, ...)
|
||||
doneTalking = false
|
||||
|
||||
if (not shouldRunAuto) then
|
||||
return
|
||||
elseif _QuestieAuto:IsBindTrue(Questie.db.profile.autoModifier) then
|
||||
shouldRunAuto = false
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Modifier-Key down: Disabling QuestieAuto for now")
|
||||
return
|
||||
end
|
||||
|
||||
if Questie.db.profile.autocomplete then
|
||||
if _QuestieAuto:IsAllowedNPC() and _QuestieAuto:IsAllowedQuest() then
|
||||
if IsQuestCompletable() then
|
||||
CompleteQuest()
|
||||
return
|
||||
else
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Quest not completeable. Index", lastIndexTried)
|
||||
end
|
||||
end
|
||||
|
||||
-- Close the QuestFrame if no quest is completeable again
|
||||
if QuestFrameGoodbyeButton and lastEvent ~= nil then
|
||||
QuestFrameGoodbyeButton:Click()
|
||||
end
|
||||
cameFromProgressEvent = true
|
||||
end
|
||||
lastEvent = "QUEST_PROGRESS"
|
||||
end
|
||||
|
||||
_SelectAvailableQuest = function(index)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Selecting available quest at index", index)
|
||||
SelectAvailableQuest(index)
|
||||
end
|
||||
|
||||
function QuestieAuto:QUEST_ACCEPT_CONFIRM(event, ...)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto][EVENT] QUEST_ACCEPT_CONFIRM", event, ...)
|
||||
lastEvent = "QUEST_ACCEPT_CONFIRM"
|
||||
doneTalking = false
|
||||
-- Escort stuff
|
||||
if (Questie.db.profile.autoaccept) then
|
||||
ConfirmAcceptQuest()
|
||||
end
|
||||
end
|
||||
|
||||
function QuestieAuto:QUEST_GREETING(event, ...)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto][EVENT] QUEST_GREETING", event, GetNumActiveQuests(), ...)
|
||||
lastEvent = "QUEST_GREETING"
|
||||
doneTalking = false
|
||||
|
||||
if (not shouldRunAuto) then
|
||||
return
|
||||
elseif _QuestieAuto:IsBindTrue(Questie.db.profile.autoModifier) then
|
||||
shouldRunAuto = false
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Modifier-Key down: Disabling QuestieAuto for now")
|
||||
return
|
||||
end
|
||||
|
||||
if cameFromProgressEvent then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Last event was Progress")
|
||||
cameFromProgressEvent = false
|
||||
lastIndexTried = lastIndexTried + 1
|
||||
end
|
||||
|
||||
-- Quest already taken
|
||||
if (Questie.db.profile.autocomplete) then
|
||||
for index = 1, GetNumActiveQuests() do
|
||||
local quest, isComplete = GetActiveTitle(index)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, quest, isComplete)
|
||||
if isComplete then SelectActiveQuest(index) end
|
||||
end
|
||||
end
|
||||
|
||||
if (Questie.db.profile.autoaccept) then
|
||||
local availableQuestsCount = GetNumAvailableQuests()
|
||||
if lastIndexTried == 0 or lastIndexTried > availableQuestsCount then
|
||||
lastIndexTried = 1
|
||||
end
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] lastIndex:", lastIndexTried)
|
||||
if availableQuestsCount > 0 and lastIndexTried < availableQuestsCount then
|
||||
_SelectAvailableQuest(lastIndexTried)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function QuestieAuto:QUEST_DETAIL(event, ...)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto][EVENT] QUEST_DETAIL", event, ...)
|
||||
lastEvent = "QUEST_DETAIL"
|
||||
doneTalking = false
|
||||
|
||||
if (not shouldRunAuto) then
|
||||
return
|
||||
elseif _QuestieAuto:IsBindTrue(Questie.db.profile.autoModifier) then
|
||||
shouldRunAuto = false
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Modifier-Key down: Disabling QuestieAuto for now")
|
||||
return
|
||||
end
|
||||
|
||||
-- We really want to disable this in instances, mostly to prevent retards from ruining groups.
|
||||
if (Questie.db.profile.autoaccept and _QuestieAuto:IsAllowedNPC() and _QuestieAuto:IsAllowedQuest(true)) then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] INSIDE", event, ...)
|
||||
|
||||
local questId = GetQuestID(true)
|
||||
local questLevel
|
||||
|
||||
if questId and questId ~= 0 then
|
||||
questLevel = QuestieDB.QueryQuestSingle(questId, "questLevel")
|
||||
end
|
||||
|
||||
if not questLevel then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] No quest object, retrying in 1 second")
|
||||
C_Timer.After(1, function()
|
||||
questId = GetQuestID(true)
|
||||
if questId and questId ~= 0 then
|
||||
questLevel = QuestieDB.QueryQuestSingle(questId, "questLevel")
|
||||
if not questLevel then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] retry failed. Quest", questId, "might not be in the DB!")
|
||||
elseif (not QuestieDB.IsTrivial(questLevel)) or Questie.db.profile.acceptTrivial then
|
||||
Questie:Debug(Questie.DEBUG_INFO, "[QuestieAuto] Questie Auto-Accepting quest:", questId)
|
||||
AcceptQuest()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if (not QuestieDB.IsTrivial(questLevel)) or Questie.db.profile.acceptTrivial then
|
||||
Questie:Debug(Questie.DEBUG_INFO, "[QuestieAuto] Questie Auto-Accepting quest:", questId)
|
||||
AcceptQuest()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- I was forced to make decision on offhand, cloak and shields separate from armor but I can't pick up my mind about the reason...
|
||||
function QuestieAuto:QUEST_COMPLETE(event, ...)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[EVENT] QUEST_COMPLETE", event, ...)
|
||||
lastEvent = "QUEST_COMPLETE"
|
||||
doneTalking = false
|
||||
|
||||
if (not shouldRunAuto) then
|
||||
return
|
||||
elseif _QuestieAuto:IsBindTrue(Questie.db.profile.autoModifier) then
|
||||
shouldRunAuto = false
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Modifier-Key down: Disabling QuestieAuto for now")
|
||||
return
|
||||
end
|
||||
|
||||
-- blasted Lands citadel wonderful NPC. They do not trigger any events except quest_complete.
|
||||
-- if not AllowedToHandle() then
|
||||
-- return
|
||||
-- end
|
||||
if (Questie.db.profile.autocomplete) then
|
||||
local questname = GetTitleText()
|
||||
local numOptions = GetNumQuestChoices()
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, event, questname, numOptions, ...)
|
||||
|
||||
if numOptions > 1 then
|
||||
Questie:Debug(Questie.DEBUG_INFO, "[QuestieAuto] Multiple rewards (" .. numOptions .. ")! Please choose appropriate reward!")
|
||||
else
|
||||
_QuestieAuto:TurnInQuest(1)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] Completed quest!")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local _QuestFinishedCallback = function()
|
||||
if _QuestieAuto:AllQuestWindowsClosed() then
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] All quest windows closed! Resetting shouldRunAuto")
|
||||
ResetModifier()
|
||||
end
|
||||
end
|
||||
|
||||
function QuestieAuto:QUEST_FINISHED()
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto][EVENT] QUEST_FINISHED")
|
||||
|
||||
C_Timer.After(0.5, _QuestFinishedCallback)
|
||||
end
|
||||
|
||||
function QuestieAuto:QUEST_ACCEPTED()
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto][EVENT] QUEST_ACCEPTED")
|
||||
if Questie.db.profile.bugWorkarounds == true and QuestFrameDetailPanel:IsVisible() == true then
|
||||
QuestFrameCloseButton:Click()
|
||||
end
|
||||
end
|
||||
|
||||
--[[ TODO: This function already exsists in Privates.lua line 8. Does it belong here or in Privates?
|
||||
function _QuestieAuto:AllQuestWindowsClosed()
|
||||
if GossipFrame and (not GossipFrame:IsVisible())
|
||||
and GossipFrameGreetingPanel and (not GossipFrameGreetingPanel:IsVisible())
|
||||
and QuestFrameGreetingPanel and (not QuestFrameGreetingPanel:IsVisible())
|
||||
and QuestFrameDetailPanel and (not QuestFrameDetailPanel:IsVisible())
|
||||
and QuestFrameProgressPanel and (not QuestFrameProgressPanel:IsVisible())
|
||||
and QuestFrameRewardPanel and (not QuestFrameRewardPanel:IsVisible()) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
--]]
|
||||
--- The closingCounter needs to reach 1 for QuestieAuto to reset
|
||||
--- Whenever the gossip frame is closed this event is called once, HOWEVER
|
||||
--- when totally stop talking to an NPC this event is called twice.
|
||||
--- Another special case is: If you run away from the NPC the event is called
|
||||
--- just once.
|
||||
function QuestieAuto:GOSSIP_CLOSED()
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto][EVENT] GOSSIP_CLOSED")
|
||||
lastEvent = "GOSSIP_CLOSED"
|
||||
|
||||
if doneTalking then
|
||||
doneTalking = false
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieAuto] We are done talking to an NPC! Resetting shouldRunAuto")
|
||||
shouldRunAuto = true
|
||||
lastEvent = nil
|
||||
else
|
||||
doneTalking = true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user