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
```
91 lines
2.8 KiB
TeX
91 lines
2.8 KiB
TeX
## Interface: 30300
|
|
## Title: WeakAuras
|
|
## Author: The WeakAuras Team
|
|
## Version: 5.19.3
|
|
## X-Flavor: 3.3.5
|
|
## Notes: A powerful, comprehensive utility for displaying graphics and information based on buffs, debuffs, and other triggers.
|
|
## Notes-esES: Potente y completa aplicación que te permitirá mostrar por pantalla múltiples diseños, basados en beneficios, perjuicios y otros activadores.
|
|
## Notes-esMX: Potente y completa aplicación que te permitirá mostrar por pantalla múltiples diseños, basados en beneficios, perjuicios y otros activadores.
|
|
## Notes-deDE: Ein leistungsfähiges, umfassendes Addon zur grafischen Darstellung von Informationen von Auren, Cooldowns, Timern und vielem mehr.
|
|
## Notes-ruRU: Мощный, многосторонний инструмент для отображения графики и информации, основанной на баффах, дебаффах и других триггерах.
|
|
## Notes-zhTW: 一個強大且全面實用的顯示圖形和訊息基於增益,減益和其它觸發。
|
|
## X-Category: Interface Enhancements
|
|
## Globe-Post: WeakAurasOptions, WeakAurasModelPaths, WeakAurasTemplates
|
|
## X-Website: https://www.curseforge.com/wow/addons/weakauras
|
|
## X-Curse-Project-ID: 65387
|
|
## X-WoWI-ID: 24910
|
|
## X-Wago-ID: VBNBxKx5
|
|
## DefaultState: Enabled
|
|
## LoadOnDemand: 0
|
|
## SavedVariables: WeakAurasSaved
|
|
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibGetFrame-1.0, LibGroupTalents, !!AddonLocale, CustomNames, BigWigs, DBM-Core
|
|
|
|
Templates.lua
|
|
Templates.xml
|
|
Compatibility.lua
|
|
Pools.lua
|
|
|
|
# External code + initialization
|
|
embeds.xml
|
|
Init.lua
|
|
locales.xml
|
|
TimeUtil.lua
|
|
ArchiveTypes\Repository.lua
|
|
DefaultOptions.lua
|
|
|
|
# Core files
|
|
Types_TBC.lua
|
|
Types_Wrath.lua
|
|
Types.lua
|
|
Prototypes.lua
|
|
Profiling.lua
|
|
WeakAuras.lua
|
|
History.lua
|
|
Transmission.lua
|
|
Modernize.lua
|
|
Animations.lua
|
|
Conditions.lua
|
|
AnchorToWeakAuras.lua
|
|
|
|
# Trigger systems
|
|
LibGroupTalentsWrapper.lua
|
|
BuffTrigger2.lua
|
|
GenericTrigger.lua
|
|
BossMods.lua
|
|
|
|
# Helper Systems
|
|
TSUHelpers.lua
|
|
AuraWarnings.lua
|
|
AuraEnvironment.lua
|
|
DebugLog.lua
|
|
SubscribableObject.lua
|
|
|
|
# Region support
|
|
RegionTypes\SmoothStatusBarMixin.lua
|
|
RegionTypes\RegionPrototype.lua
|
|
RegionTypes\Empty.lua
|
|
RegionTypes\ProgressTexture.lua
|
|
BaseRegions\Texture.lua
|
|
RegionTypes\Texture.lua
|
|
RegionTypes\AuraBar.lua
|
|
RegionTypes\Icon.lua
|
|
RegionTypes\Text.lua
|
|
RegionTypes\Group.lua
|
|
RegionTypes\DynamicGroup.lua
|
|
BaseRegions\StopMotion.lua
|
|
RegionTypes\StopMotion.lua
|
|
RegionTypes\Model.lua
|
|
|
|
# Sub-region support
|
|
SubRegionTypes\Background.lua
|
|
SubRegionTypes\SubText.lua
|
|
SubRegionTypes\Border.lua
|
|
SubRegionTypes\Glow.lua
|
|
SubRegionTypes\Tick.lua
|
|
SubRegionTypes\Model.lua
|
|
SubRegionTypes\StopMotion.lua
|
|
SubRegionTypes\Texture.lua
|
|
|
|
#Misc
|
|
DiscordList.lua
|