View Single Post
12/20/15, 08:45 PM   #8
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
It sounds like you are all talking about scanning the bag for lures. Why not use the lure indices to store the information then all you need is this?
Lua Code:
  1. local name, icon, stack, sellPrice, quality  = GetFishingLureInfo(lureIndex)

This is probably not what you need, but you asked for a way to detect when the bait count changes.
I see no way to know when you loose bait, catch something, or stop fishing (when you don't react to a fish on the line). This is the closest I could think of that would work for all situations. There is a delay though, it updates 30 seconds after you cast which was my estimate of the longest time you could have a line in the water before the line is retracted.
Warning: Spoiler


If you only need to know the lure counts when a map pin tooltip is displayed use the lureIndices. I don't know how your storing the lure information, but since your adding information about the lure to the pin tooltip, you must know which lure it is. If you use the lureIndices to identify/store that information about the lures then when you add the info to the pin you already know the lureindex so just update the stack count first with this:
Lua Code:
  1. -- example
  2. local lureCounts = {
  3.     [lureIndex] = {},
  4. }
  5.  
  6. local name, icon, stack, sellPrice, quality  = GetFishingLureInfo(lureIndex)
  7. lureCounts[lureIndex].stack = stack
  8. -- do whatever to add info to pin
  Reply With Quote