View Single Post
12/23/15, 01:46 PM   #25
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
First, merry christmas, happy hanuka, or whatever

With the great help from all you guys, then I ended with what I think is my final code.
I may no have used what you all suggested, but you still inspired me
function:
Lua Code:
  1. local function UpdateBaitAmount()
  2.     if DestinationsSV.filters[PINS_FISHING_SHOW_BAIT_LEFT] then
  3.         local numLures = GetNumFishingLures()
  4.         local oldBaitCount = defaults.data.FoulBaitLeft + defaults.data.FoulSBaitLeft + defaults.data.RiverBaitLeft + defaults.data.RiverSBaitLeft + defaults.data.OceanBaitLeft + defaults.data.OceanSBaitLeft + defaults.data.LakeBaitLeft + defaults.data.LakeSBaitLeft + defaults.data.GeneralBait
  5.         local baitCount = 0
  6.         for lureIndex=1, numLures do
  7.             if stack then
  8.                 baitCount = baitCount + stack
  9.             end
  10.         end
  11.         if baitCount ~= oldBaitCount then
  12.             LMP:RefreshPins(PINS_FISHING)
  13.         end
  14.     end
  15. end
call:
Lua Code:
  1. ZO_PreHookHandler(ZO_WorldMap, "OnShow", UpdateBaitAmount)
I know I COULD have chosen to just fire the LMP:RefreshPins(PINS_FISHING) every time the map opens to skip the comparison of stacks, but I think this will have a smaller impact on the game.
  Reply With Quote