View Single Post
04/21/24, 04:25 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,004
By searching in esoui sources for event_justice I found the bounty display control.

At this function it seems to update your currently active bounty currency (gold to pay):
https://github.com/esoui/esoui/blob/...isplay.lua#L49

ZO_BountyDisplay is the "class" here and via ZO_BountyDisplay:New you create the object of that class, which can be accessed ingame (and inspected via tbug too).
So searching for ZO_BountyDisplay:New ->
You will get here
https://github.com/esoui/esoui/blob/...oard.lua#L1192
STATS_BOUNTY_DISPLAY is your global object then

So you can hook that function like this I guess to react on any update, check the current currency value or use other ApI to check current bounty values and react on that with your addon:

Lua Code:
  1. SecurePostHook("STATS_BOUNTY_DISPLAY", function()
  2. if IsJusticeEnabled() then
  3. --local self = STATS_BOUNTY_DISPLAY --> Justt o explain what the self in the original function ZO_BountyDisplay:OnBountyUpdated relates to!
  4.  
  5.  
  6. local currentBounty = GetFullBountyPayoffAmount()
  7. if currentBounty >= x then
  8. -- do your bounty value related stuff 1
  9. else
  10. -- do your bounty value related stuff 2
  11. end
  12. end
  13. end)


There might be better ways to achieve your goal, but I hope it expalins enough how to search esoui sources and get to the point where the UI controls update and show things "the ZOs way" (vanilla code).
Maybe you can find an even better point to hook into then.
  Reply With Quote