ascott18 / TellMeWhen

TellMeWhen is a combat tracking AddOn for World of Warcraft Retail and Classic
https://wow.curseforge.com/projects/tellmewhen
GNU General Public License v3.0
80 stars 11 forks source link

New icon type for user-supplied custom lua values #1908

Closed zjx2172 closed 2 years ago

zjx2172 commented 3 years ago

I've added an icon type called "Custom Value". It allows the user to provide some Lua code that returns a current value and maximum value, which is then shown as bar icon similar to the "Resources" type.

For example, to have a bar that shows the player's valor points, the following code could be used:

local valorInfo = C_CurrencyInfo.GetCurrencyInfo(1191)
local curValor = valorInfo["quantity"]
local maxValor = valorInfo["maxQuantity"]
return curValor, maxValor

I think it adds many possibilities for users to expand their TMW capabilities, only limited by the WoW API. I was motivated by wanting to track the power absorbed by my "Primordial Arcanic Pulsar" druid legendary. Other possibilities include tracking the amount remaining on an absorb shield, tracking how much conquest is needed for an upgrade, or showing one's current haste relative to a soft cap.

I spliced together code from a few different places and got it working. There may be some unnecessary or duplicate code. Feel free to edit as you see fit.

zjx2172 commented 3 years ago

Addresses #1843 "Resource bar with data from the Lua script". Could be used to address #1322 "For Bar/BarV, add an option to change the data source to the icon's stacks"

zjx2172 commented 2 years ago

Responded to first round of comments with commit 9652a96

zjx2172 commented 2 years ago

Added three commits to address requested changes