Commit Graph

15 Commits

Author SHA1 Message Date
NoM0Re 417faf1b00 (fix/anchor)band-aid for anchoring to hidden nameplates 2025-04-14 17:23:56 +02:00
NoM0Re 7c7869494e 5.19.3
Add methods to the states/allstates table that helps with creating,
updating or remove states in an optimized way

## Advantage of using this function instead of doing a states[key] = {
... }

- If already created, update existing state, and return true if any
value was changed, this can help reduce amount of resources an aura use

- Automatically `return true` when using these functions and any change
was made

## Examples

```Lua
function(states, event, ...)
    if event == "PLAYER_TARGET_CHANGED" then
        if UnitExists("target") then
            -- if state exists it's updated, not replaced
            -- show & changed fields can be skipped
            states:Update("", {
                    name = UnitName("target"),
                    duration = 5,
                    expirationTime = GetTime() + 5,
                    progressType = "timed",
                    autoHide = true
            })
        else
            -- wipe
            states:RemoveAll()
        end
    end
    -- no need to return true
end
```

with clones

```Lua
function(states, event, ...)
    local currentEssence = UnitPower("player", Enum.PowerType.Essence)
    local maxEssence = UnitPowerMax("player", Enum.PowerType.Essence)
    for i = 1, 6 do
        if i > maxEssence then
            states:Remove(i) -- wipe allstates[6]
        else
            local value = currentEssence >= i and 1 or 0
            local newState = {
                progressType = "static",
                value = value,
                total = 1
            }
            states:Update(i, newState)
        end
    end
    -- no need to return true
end
```
2025-02-24 22:10:45 +01:00
NoM0Re 02fe8164f6 from retail 2025-02-16 20:50:05 +01:00
NoM0Re 2e91a460da fix elvui np 2025-02-15 14:50:44 +01:00
NoM0Re 91641b31f2 port LibGetFrame to newest
depends on AceTimer, can have regressions due to lack of testing
2025-02-04 17:27:16 +01:00
NoM0Re a3d856372e fix elvui np anchoring 2025-01-17 13:12:05 +01:00
NoM0Re 909f61f102 add nameplate trigger/anchor with awesome wotlk 2024-06-29 18:33:34 +02:00
Bunny67 83218cc87c update LibGetFrame 2021-03-12 01:04:36 +03:00
Bunny67 7cbc40c959 beta 2020-11-15 23:43:10 +03:00
Bunny67 1fab884928 update libs 2020-07-11 22:49:45 +03:00
Bunny67 bbb4ac1c37 fix #33 2020-07-10 17:05:49 +03:00
Bunny67 7e15296d21 abandon C_Timer 2020-06-29 18:45:14 +03:00
Bunny67 de72394bda from retail 2020-06-09 23:31:40 +03:00
Bunny67 b2cede99f0 change C_Timer 2020-06-03 16:43:25 +03:00
Bunny67 f2e1a0928d init 2020-06-02 23:40:06 +03:00