From 3dcf49989d2511330dc803e37eacb4b37c7507f6 Mon Sep 17 00:00:00 2001 From: Alar of Daggerspine Date: Thu, 21 Jan 2016 23:22:20 +0100 Subject: [PATCH] Doesnt get stuck if Mission Control is already open --- quick.lua | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/quick.lua b/quick.lua index f91f9dc..a6c8223 100644 --- a/quick.lua +++ b/quick.lua @@ -14,23 +14,29 @@ function qm:RunQuick() --@end-debug@ while not qm.Mission do if GarrisonCommanderQuickMissionComplete:IsVisible() then +--@debug@ print("Quickcompletion") +--@end-debug@ GarrisonCommanderQuickMissionComplete:Click() return -- Waits to be rescheeduled by mission completion end if not GMF.MissionControlTab:IsVisible() then +--@debug@ print("MissionControl") +--@end-debug@ GMF.tabMC:Click() break end if (GMF.MissionControlTab.runButton:IsEnabled()) then +--@debug@ print("Run Missions") +--@end-debug@ GMF.MissionControlTab.runButton:Click() end break -- Never loop or we get stuck end watchdog=watchdog+1 - if watchdog > 100 then + if watchdog > 10 then ns.quick=false end if ns.quick then @@ -42,10 +48,23 @@ function addon:RunQuick(force) --@debug@ print("Runquick called") --@end-debug@ + if GMF.tabMC:GetChecked() then + self:OpenMissionControlTab() + self:ScheduleTimer("RunQuick",0.2) + return + end if not IsShiftKeyDown() and not force then - self:Popup(L["Are you sure to start Garrison Commander Auto Pilot?\n(Keep shift pressed while clicking to avoid this question)"],10,function() return addon:RunQuick(true) end,function() end) + self:Popup(L["Are you sure to start Garrison Commander Auto Pilot?\n(Keep shift pressed while clicking to avoid this question)"],10, + function() + StaticPopup_Hide("LIBINIT_POPUP") + return addon:RunQuick(true) + end, + function() + StaticPopup_Hide("LIBINIT_POPUP") + end) else ns.quick=true - return qm:RunQuick() + qm.watchdog=0 + return addon.ScheduleTimer(qm,"RunQuick",0.2) end end \ No newline at end of file -- 1.7.9.5