Skip to content

Commit

Permalink
Merge pull request #149 from Elesario/Fishing-automation-update
Browse files Browse the repository at this point in the history
Fish tracking fix and restore tracking for "spell" types
  • Loading branch information
cdmichaelb authored Oct 9, 2023
2 parents e56a0fc + 7cc26e2 commit 4aa396f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
19 changes: 14 additions & 5 deletions Outfitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7315,21 +7315,30 @@ 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

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

Expand Down
15 changes: 11 additions & 4 deletions OutfitterScripting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,12 @@ if event == "OUTFIT_EQUIPPED" then
end
if setting.EnableFishTracking then
setting.savedTracking = Outfitter:GetTrackingEnabled(133888)
Outfitter:SetTrackingEnabled(133888, 1)
setting.didSetTracking = true
local _, vIndex = Outfitter:GetTrackingEnabled(133888)
if vIndex then
setting.savedTracking = Outfitter:GetCurrentSpellTrackingEnabled()
Outfitter:SetTrackingEnabled(133888, 1)
setting.didSetTracking = true
end
end
if setting.DisableClicktoMove then
Expand All @@ -848,7 +851,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
Expand Down

0 comments on commit 4aa396f

Please sign in to comment.