From 5b3ed090f760dce28b632c9ee7efd4ac49561ecd Mon Sep 17 00:00:00 2001 From: Alar of Runetotem Date: Mon, 27 Feb 2017 12:46:50 +0100 Subject: [PATCH] Revamped and improved autologout --- quick.lua | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/quick.lua b/quick.lua index 3a09897..3f5c51c 100644 --- a/quick.lua +++ b/quick.lua @@ -13,6 +13,7 @@ local NavalDomination={ Alliance=39068, Horde=39246 } +local autologout=false local questid=NavalDomination[UnitFactionGroup("player")] function qm:OnInitialized() ns.step="none" @@ -103,22 +104,29 @@ function addon:LogoutPopup(timeout) end msg=C(msg,'green').."\n" end - end - local popup=addon:Popup(msg .. CAMP_TIMER,timeout or 10, + if not autologout then + msg=msg .. LOGOUT + else + msg=msg .. CAMP_TIMER + end + local popup=addon:Popup(msg,timeout or 10, function(dialog,data,data2) addon:Unhook(dialog,"OnUpdate") Logout() end, function(dialog,data,timeout) addon:Unhook(dialog,"OnUpdate") - if timeout=="timeout" then Logout() end + if timeout=="timeout" and autologout then Logout() end + autologout=false missionDone=false shipyardDone=false StaticPopup_Hide("LIBINIT_POPUP") end ) - self:SecureHookScript(popup, "OnUpdate", "LogoutTimer") + if autologout then + self:SecureHookScript(popup, "OnUpdate", "LogoutTimer") + end end function qm:RunQuick() local completeButton=GMF:IsVisible() and GarrisonCommanderQuickMissionComplete or GCQuickShipMissionCompletionButton @@ -130,6 +138,8 @@ function qm:RunQuick() end if missionDone and shipyardDone then addon:LogoutPopup(5) + else + autologout=false end return end @@ -156,6 +166,9 @@ function qm:RunQuick() end end +function addon:EnableAutoLogout() + autologout=true +end function addon:RunQuick(force) local main=GMF:IsVisible() and GMF or GSF if main.tabMC:GetChecked() then -- 1.7.9.5