7c7869494e
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
```
62 lines
1.0 KiB
Lua
62 lines
1.0 KiB
Lua
if not WeakAuras.IsLibsOK() then return end
|
|
|
|
local AddonName, Private = ...
|
|
|
|
Private.DiscordList = {
|
|
[=[007bb]=],
|
|
[=[AcidWeb]=],
|
|
[=[aelen]=],
|
|
[=[Aishuu]=],
|
|
[=[Ariani Continuity]=],
|
|
[=[Azortharion]=],
|
|
[=[BadBrain]=],
|
|
[=[Bart]=],
|
|
[=[Boneshock]=],
|
|
[=[Boxthor]=],
|
|
[=[Burlis]=],
|
|
[=[Causese]=],
|
|
[=[Chab]=],
|
|
[=[Darian]=],
|
|
[=[Desik]=],
|
|
[=[DjinnFish]=],
|
|
[=[exality]=],
|
|
[=[Fatpala]=],
|
|
[=[Fels]=],
|
|
[=[Fenchurch]=],
|
|
[=[Guffin]=],
|
|
[=[Ifor]=],
|
|
[=[Ipwnturkeys]=],
|
|
[=[Ironi]=],
|
|
[=[Jods]=],
|
|
[=[kanegasi]=],
|
|
[=[Koxy]=],
|
|
[=[Listefano]=],
|
|
[=[Luckyone]=],
|
|
[=[Luxthos]=],
|
|
[=[m33shoq]=],
|
|
[=[Manabanana]=],
|
|
[=[MetalMusicMan]=],
|
|
[=[Murph]=],
|
|
[=[Mynze]=],
|
|
[=[Nona]=],
|
|
[=[NostraDumAzz]=],
|
|
[=[Oi]=],
|
|
[=[Ora]=],
|
|
[=[ParkSaeRoyi]=],
|
|
[=[phoenix7700]=],
|
|
[=[Pseiko]=],
|
|
[=[reggie]=],
|
|
[=[Reloe]=],
|
|
[=[Spaten]=],
|
|
[=[Tollo]=],
|
|
[=[Translit]=],
|
|
[=[update]=],
|
|
[=[vozochris]=],
|
|
[=[Wizeowel]=],
|
|
[=[Xepheris]=],
|
|
}
|
|
Private.DiscordListCJ = {
|
|
}
|
|
Private.DiscordListK = {
|
|
}
|