From 1c385da1332ce28e4e0b228a1e08308ab14d8e70 Mon Sep 17 00:00:00 2001 From: Elesario <60847546+Elesario@users.noreply.github.com> Date: Wed, 5 Jul 2023 20:21:47 +0100 Subject: [PATCH 1/4] Update Outfitter.lua to fix fishing tracking script Fixed the tracking functions GetNumTrackingTypes(), GetTrackingInfo(index), & SetTracking(index, enabled) to use the C_Minimap global space. Was erroring in WotLK previously. Also added new function GetCurrentSpellTrackingEnabled(). Previously when fish tracking was enabled it would overwrite the previous tracking state, as you can only track one type of thing in WotLK. This function returns the texture ID for the currently active tracking, or nil if no active tracking found. Found that only those of type == "spell" are relevant. The other tracking options, e.g. mailboxes, seem to be listed as "other". Don't know if there's any other types I should be checking. --- Outfitter.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Outfitter.lua b/Outfitter.lua index 8b766ab..a4718f3 100644 --- a/Outfitter.lua +++ b/Outfitter.lua @@ -7315,13 +7315,22 @@ function Outfitter:PlayerIsOnQuestID(pQuestID) return false end -function Outfitter:GetTrackingEnabled(pTexture) - local vNumTypes = GetNumTrackingTypes() +function Outfitter:GetCurrentSpellTrackingEnabled() + local vNumTypes = C_Minimap.GetNumTrackingTypes(); + for vIndex = 1, vNumTypes do + local vName, vTexture, vActive, vType = C_Minimap.GetTrackingInfo(vIndex); + if vActive and vType == "spell" then + return vTexture; + end + end +end +function Outfitter:GetTrackingEnabled(pTexture) + local vNumTypes = C_Minimap.GetNumTrackingTypes(); for vIndex = 1, vNumTypes do - local vName, vTexture, vActive = GetTrackingInfo(vIndex) + local vName, vTexture, vActive = C_Minimap.GetTrackingInfo(vIndex); if vTexture == pTexture then - return vActive, vIndex + return vActive, vIndex; end end end @@ -7329,7 +7338,7 @@ end function Outfitter:SetTrackingEnabled(pTexture, pEnabled) local vActive, vIndex = self:GetTrackingEnabled(pTexture) if vActive ~= pEnabled then - SetTracking(vIndex, pEnabled == true or pEnabled == 1) + C_Minimap.SetTracking(vIndex, pEnabled == true or pEnabled == 1) end end From 6080fb1fb889b9df14c54d38ae824de97a88b477 Mon Sep 17 00:00:00 2001 From: Elesario <60847546+Elesario@users.noreply.github.com> Date: Wed, 5 Jul 2023 20:38:46 +0100 Subject: [PATCH 2/4] Update OutfitterScripting.lua to use new spell tracking function Previously the fish tracking enabled option was checking to see if fish tracking was already on and maintaining it, but was overwriting and not restoring any other kind of tracking. Changed the script to use the new GetCurrentSpellTrackingEnabled() function to identify what tracking was previously active (if any) and restore the state when the fishing outfit was removed. I expect the original script was designed for Retail, where you can have multiple kinds of tracking together. --- OutfitterScripting.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OutfitterScripting.lua b/OutfitterScripting.lua index 7bc877e..12c94f2 100644 --- a/OutfitterScripting.lua +++ b/OutfitterScripting.lua @@ -821,7 +821,7 @@ if event == "OUTFIT_EQUIPPED" then end if setting.EnableFishTracking then - setting.savedTracking = Outfitter:GetTrackingEnabled(133888) + setting.savedTracking = Outfitter:GetCurrentSpellTrackingEnabled() Outfitter:SetTrackingEnabled(133888, 1) setting.didSetTracking = true end @@ -848,7 +848,11 @@ elseif event == "OUTFIT_UNEQUIPPED" then end if setting.EnableFishTracking and setting.didSetTracking then - Outfitter:SetTrackingEnabled(133888, setting.savedTracking) + if setting.savedTracking then + Outfitter:SetTrackingEnabled(setting.savedTracking, true) + else + Outfitter:SetTrackingEnabled(133888, false) -- no spell tracking was enabled + end setting.didSetTracking = nil setting.savedTracking = nil end From da8f5c0644a51e00325f17213f0fa3840200faf3 Mon Sep 17 00:00:00 2001 From: Elesario <60847546+Elesario@users.noreply.github.com> Date: Thu, 6 Jul 2023 14:22:04 +0100 Subject: [PATCH 3/4] Update OutfitterScripting.lua to prevent error if no fish tracking available Found I'd introduced bug when no fish tracking available. This fixes for that case. --- OutfitterScripting.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OutfitterScripting.lua b/OutfitterScripting.lua index 12c94f2..6213213 100644 --- a/OutfitterScripting.lua +++ b/OutfitterScripting.lua @@ -821,9 +821,11 @@ if event == "OUTFIT_EQUIPPED" then end if setting.EnableFishTracking then - setting.savedTracking = Outfitter:GetCurrentSpellTrackingEnabled() - Outfitter:SetTrackingEnabled(133888, 1) - setting.didSetTracking = true + if Outfitter:GetTrackingEnabled(133888) then + setting.savedTracking = Outfitter:GetCurrentSpellTrackingEnabled() + Outfitter:SetTrackingEnabled(133888, 1) + setting.didSetTracking = true + end end if setting.DisableClicktoMove then From 7cc26e215c3bd51edd57a2330494017a76592784 Mon Sep 17 00:00:00 2001 From: Elesario <60847546+Elesario@users.noreply.github.com> Date: Thu, 6 Jul 2023 23:10:03 +0100 Subject: [PATCH 4/4] Update OutfitterScripting.lua again Previous fix stopped the tracking implementation working when character knew the spell (oops). --- OutfitterScripting.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OutfitterScripting.lua b/OutfitterScripting.lua index 6213213..682f54c 100644 --- a/OutfitterScripting.lua +++ b/OutfitterScripting.lua @@ -821,7 +821,8 @@ if event == "OUTFIT_EQUIPPED" then end if setting.EnableFishTracking then - if Outfitter:GetTrackingEnabled(133888) then + local _, vIndex = Outfitter:GetTrackingEnabled(133888) + if vIndex then setting.savedTracking = Outfitter:GetCurrentSpellTrackingEnabled() Outfitter:SetTrackingEnabled(133888, 1) setting.didSetTracking = true