From d59d7fe6c1a47afdee14a25022e1df87d5f93232 Mon Sep 17 00:00:00 2001 From: Sattva Date: Wed, 14 Jun 2023 06:51:54 +0300 Subject: [PATCH] FlightTimer - improve, fix Test fix for such events as summon, BG/Arena entry to stop the bar and hide editbox (report frame). DebugString - now adds hops count (to avoid confusion i talked already about) To Do: Need to fix editbox for 3.3.5, it is right now not copyable and look of it is bad. Can take RecentChatWindow as a reference, as i already fixed that one. --- Changelog and Notes.txt | 2 ++ Leatrix_Plus.lua | 27 ++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Changelog and Notes.txt b/Changelog and Notes.txt index a996d5c..4499f1c 100644 --- a/Changelog and Notes.txt +++ b/Changelog and Notes.txt @@ -45,6 +45,8 @@ QueueTimer - Need to test if timer .After 0.1 is fine in SetupBar func (was LibCandyBar - Will it be conflicting with other addons that use 3.3.5 version of CandyBar lib? +ShowFlightPaths - Will StopLandingEvent work correctly on summon, BG/arena accept + -------------------------------------------------------------------------------- -- Stuff to-do: diff --git a/Leatrix_Plus.lua b/Leatrix_Plus.lua index f29f777..ddf6d4b 100644 --- a/Leatrix_Plus.lua +++ b/Leatrix_Plus.lua @@ -6309,8 +6309,7 @@ function LeaPlusLC:FriendCheck(name) --if PLAYER_ON_TAXI == false then print("unregister event") else print("event still registered") end if LeaPlusLC.FlightProgressBar then LeaPlusLC.FlightProgressBar:Stop() - LeaPlusLC.FlightProgressBar = nil - + LeaPlusLC.FlightProgressBar = nil end end end) @@ -6370,13 +6369,14 @@ function LeaPlusLC:FriendCheck(name) end debugString = debugString .. '"] = ' +local debugOnenumEnterHops = (GetNumRoutes(node) - 1) -- Add node names to debug string debugString = debugString .. " -- " .. nodeName -- If debug string does not contain destination, add it to the end if not string.find(debugString, barName) then - debugString = debugString .. ", " .. barName + debugString = debugString .. ", " .. barName .. " with " .. debugOnenumEnterHops .. " hops" end -- Print debug string (used for showing full routes for nodes) @@ -6404,11 +6404,11 @@ function LeaPlusLC:FriendCheck(name) end) function Leatrix_HandleFlightLanding() - print("ff script") + print("debug report script fire") local timeEnd = GetTime() local timeTaken = timeEnd - timeStart debugString = gsub(debugString, "TimeTakenPlaceHolder", string.format("%0.0f", timeTaken)) - local flightMsg = L["Flight details"] .. " (" .. L["WRATH"].. "): " .. nodeName .. " (" .. currentNode .. ") " .. L["to"] .. " " .. barName .. " (" .. destination .. ") (" .. faction .. ") " .. L["took"] .. " " .. string.format("%0.0f", timeTaken) .. " " .. L["seconds"] .. " (" .. numEnterHops .. " " .. L["hop"] ..").|n|n" .. debugString .. "|n|n" + local flightMsg = L["Flight details"] .. " (" .. L["WRATH"].. "): " .. nodeName .. " (" .. currentNode .. ") " .. L["to"] .. " " .. barName .. " (" .. destination .. ") (" .. faction .. ") " .. L["took"] .. " " .. string.format("%0.0f", timeTaken) .. " " .. L["seconds"] .. " (" .. debugOnenumEnterHops .. " " .. L["hop"] ..").|n|n" .. debugString .. "|n|n" if destination and data[faction] and data[faction][continent] and data[faction][continent][routeString] then local savedDuration = data[faction][continent][routeString] if savedDuration then @@ -6573,6 +6573,12 @@ function LeaPlusLC:FriendCheck(name) -- end -- end) + + -------------------------------------------------------------------------------- + -- Hook to the Node OnEnter blizzard func. + -------------------------------------------------------------------------------- + + -- Show flight time in node tooltips hooksecurefunc("TaxiNodeOnButtonEnter", function(button) @@ -6639,6 +6645,8 @@ function LeaPlusLC:FriendCheck(name) GameTooltip:Show() end + local debugTwonumEnterHops = (GetNumRoutes(index) - 1) + -- Add node names to debug string debugString = debugString .. " -- " .. nodeName -- for i = 20, numEnterHops do @@ -6655,7 +6663,7 @@ function LeaPlusLC:FriendCheck(name) -- If debug string does not contain destination, add it to the end if not string.find(debugString, barName) then - debugString = debugString .. ", " .. barName + debugString = debugString .. ", " .. barName .. " with " .. debugTwonumEnterHops .. " hops" end -- Print debug string (used for showing full routes for nodes) @@ -6665,9 +6673,14 @@ function LeaPlusLC:FriendCheck(name) end end) + -- FIXME 3.3.5 -- Unregister landing event for various reasons that stop taxi early local function StopLandingEvent() - LeaPlusLC.flightFrame:UnregisterEvent("PLAYER_CONTROL_GAINED") + if editFrame:IsShown() then editFrame:Hide() end + if LeaPlusLC.FlightProgressBar then + LeaPlusLC.FlightProgressBar:Stop() + LeaPlusLC.FlightProgressBar = nil + end end hooksecurefunc("TaxiNodeOnButtonEnter", StopLandingEvent)