1- if not WeakAuras .IsLibsOK () then return end
1+ if not WeakAuras .IsLibsOK () then
2+ return
3+ end
24local AddonName , Private = ...
35
46local WeakAuras = WeakAuras
@@ -14,11 +16,13 @@ local UnitAura = UnitAura
1416-- Unit Aura functions that return info about the first Aura matching the spellName or spellID given on the unit.
1517local WA_GetUnitAura = function (unit , spell , filter )
1618 if filter and not filter :upper ():find (" FUL" ) then
17- filter = filter .. " |HELPFUL"
19+ filter = filter .. " |HELPFUL"
1820 end
1921 for i = 1 , 255 do
2022 local name , _ , _ , _ , _ , _ , _ , _ , _ , spellId = UnitAura (unit , i , filter )
21- if not name then return end
23+ if not name then
24+ return
25+ end
2226 if spell == spellId or spell == name then
2327 return UnitAura (unit , i , filter )
2428 end
@@ -32,33 +36,33 @@ if WeakAuras.IsClassic() then
3236 if spellId then
3337 local durationNew , expirationTimeNew = LCD :GetAuraDurationByUnit (unit , spellId , source , name )
3438 if duration == 0 and durationNew then
35- duration = durationNew
36- expirationTime = expirationTimeNew
39+ duration = durationNew
40+ expirationTime = expirationTimeNew
3741 end
3842 end
3943 return name , icon , count , debuffType , duration , expirationTime , source , isStealable , nameplateShowPersonal , spellId , canApplyAura , isBossDebuff , castByPlayer , nameplateShowAll , timeMod
4044 end
4145end
4246
4347local WA_GetUnitBuff = function (unit , spell , filter )
44- filter = filter and filter .. " |HELPFUL" or " HELPFUL"
48+ filter = filter and filter .. " |HELPFUL" or " HELPFUL"
4549 return WA_GetUnitAura (unit , spell , filter )
4650end
4751
4852local WA_GetUnitDebuff = function (unit , spell , filter )
49- filter = filter and filter .. " |HARMFUL" or " HARMFUL"
53+ filter = filter and filter .. " |HARMFUL" or " HARMFUL"
5054 return WA_GetUnitAura (unit , spell , filter )
5155end
5256
5357-- Function to assist iterating group members whether in a party or raid.
5458local WA_IterateGroupMembers = function (reversed , forceParty )
55- local unit = (not forceParty and IsInRaid ()) and ' raid' or ' party'
56- local numGroupMembers = unit == ' party' and GetNumSubgroupMembers () or GetNumGroupMembers ()
57- local i = reversed and numGroupMembers or (unit == ' party' and 0 or 1 )
59+ local unit = (not forceParty and IsInRaid ()) and " raid" or " party"
60+ local numGroupMembers = unit == " party" and GetNumSubgroupMembers () or GetNumGroupMembers ()
61+ local i = reversed and numGroupMembers or (unit == " party" and 0 or 1 )
5862 return function ()
5963 local ret
60- if i == 0 and unit == ' party' then
61- ret = ' player'
64+ if i == 0 and unit == " party" then
65+ ret = " player"
6266 elseif i <= numGroupMembers and i > 0 then
6367 ret = unit .. i
6468 end
@@ -93,7 +97,7 @@ local WA_Utf8Sub = function(input, size)
9397 return output
9498 end
9599 local i = 1
96- while ( size > 0 ) do
100+ while size > 0 do
97101 local byte = input :byte (i )
98102 if not byte then
99103 return output
@@ -114,7 +118,7 @@ local WA_Utf8Sub = function(input, size)
114118 end
115119
116120 -- Add any bytes that are part of the sequence
117- while ( true ) do
121+ while true do
118122 local byte = input :byte (i )
119123 if byte and byte >= 128 and byte < 192 then
120124 output = output .. input :sub (i , i )
@@ -135,7 +139,7 @@ WeakAuras.HideOverlayGlow = LCG.ButtonGlow_Stop
135139
136140local LGF = LibStub (" LibGetFrame-1.0" )
137141WeakAuras .GetUnitFrame = LGF .GetUnitFrame
138- WeakAuras .GetUnitNameplate = function (unit )
142+ WeakAuras .GetUnitNameplate = function (unit )
139143 if Private .multiUnitUnits .nameplate [unit ] then
140144 return LGF .GetUnitNameplate (unit )
141145 end
@@ -170,7 +174,7 @@ local blockedFunctions = {
170174 GuildUninvite = true ,
171175 securecall = true ,
172176 DeleteCursorItem = true ,
173- ChatEdit_SendText = true
177+ ChatEdit_SendText = true ,
174178}
175179
176180local blockedTables = {
@@ -180,7 +184,7 @@ local blockedTables = {
180184 MailFrameTab2 = true ,
181185 ChatFrame1 = true ,
182186 WeakAurasOptions = true ,
183- WeakAurasOptionsSaved = true
187+ WeakAurasOptionsSaved = true ,
184188}
185189
186190local aura_environments = {}
@@ -209,7 +213,7 @@ local current_aura_env = nil
209213local aura_env_stack = {}
210214
211215function Private .ClearAuraEnvironment (id )
212- environment_initialized [id ] = nil ;
216+ environment_initialized [id ] = nil
213217end
214218
215219function Private .ActivateAuraEnvironmentForRegion (region , onlyConfig )
@@ -240,7 +244,7 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig)
240244 current_aura_env .states = states
241245 current_aura_env .region = region
242246 -- Push the new environment onto the stack
243- tinsert (aura_env_stack , {current_aura_env , data .uid })
247+ tinsert (aura_env_stack , { current_aura_env , data .uid })
244248 elseif onlyConfig then
245249 environment_initialized [id ] = 1
246250 aura_environments [id ] = {}
@@ -251,7 +255,7 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig)
251255 current_aura_env .state = state
252256 current_aura_env .states = states
253257 current_aura_env .region = region
254- tinsert (aura_env_stack , {current_aura_env , data .uid })
258+ tinsert (aura_env_stack , { current_aura_env , data .uid })
255259
256260 if not data .controlledChildren then
257261 current_aura_env .config = CopyTable (data .config )
@@ -268,7 +272,7 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig)
268272 current_aura_env .states = states
269273 current_aura_env .region = region
270274 -- push new environment onto the stack
271- tinsert (aura_env_stack , {current_aura_env , data .uid })
275+ tinsert (aura_env_stack , { current_aura_env , data .uid })
272276
273277 if data .controlledChildren then
274278 current_aura_env .child_envs = {}
@@ -291,7 +295,7 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig)
291295 end
292296 -- Finally, run the init function if supplied
293297 local actions = data .actions .init
294- if ( actions and actions .do_custom and actions .custom ) then
298+ if actions and actions .do_custom and actions .custom then
295299 local func = Private .customActionsFunctions [id ][" init" ]
296300 if func then
297301 xpcall (func , Private .GetErrorHandlerId (id , " init" ))
@@ -306,28 +310,26 @@ local function DebugPrint(...)
306310end
307311
308312local function blocked (key )
309- Private .AuraWarnings .UpdateWarning (current_uid , " SandboxForbidden" , " error" ,
310- string.format (L [" Forbidden function or table: %s" ], key ))
313+ Private .AuraWarnings .UpdateWarning (current_uid , " SandboxForbidden" , " error" , string.format (L [" Forbidden function or table: %s" ], key ))
311314end
312315
313316local function MakeReadOnly (input , options )
314- return setmetatable ({},
315- {
317+ return setmetatable ({}, {
316318 __index = function (t , k )
317- if options .blockedFunctions [k ] then
318- options .blocked (k )
319- return function () end
320- elseif options .blockedTables [k ] then
321- options .blocked (k )
322- return {}
323- elseif options .override [k ] then
324- return options .override [k ]
325- else
326- return input [k ]
327- end
328- end ,
329- __newindex = options .setBlocked ,
330- __metatable = false
319+ if options .blockedFunctions [k ] then
320+ options .blocked (k )
321+ return function () end
322+ elseif options .blockedTables [k ] then
323+ options .blocked (k )
324+ return {}
325+ elseif options .override [k ] then
326+ return options .override [k ]
327+ else
328+ return input [k ]
329+ end
330+ end ,
331+ __newindex = options .setBlocked ,
332+ __metatable = false ,
331333 })
332334end
333335
@@ -384,17 +386,16 @@ local FakeWeakAurasMixin = {
384386 frames = true ,
385387 loadFrame = true ,
386388 unitLoadFrame = true ,
387- loaded = true
389+ loaded = true ,
388390 },
389391 override = {
390392 me = GetUnitName (" player" , true ),
391- myGUID = UnitGUID (" player" )
393+ myGUID = UnitGUID (" player" ),
392394 },
393395 blocked = blocked ,
394396 setBlocked = function ()
395- Private .AuraWarnings .UpdateWarning (current_uid , " FakeWeakAurasSet" , " error" ,
396- L [" Writing to the WeakAuras table is not allowed." ], true )
397- end
397+ Private .AuraWarnings .UpdateWarning (current_uid , " FakeWeakAurasSet" , " error" , L [" Writing to the WeakAuras table is not allowed." ], true )
398+ end ,
398399}
399400
400401local FakeWeakAuras = MakeReadOnly (WeakAuras , FakeWeakAurasMixin )
@@ -408,12 +409,11 @@ local overridden = {
408409 WA_Utf8Sub = WA_Utf8Sub ,
409410 ActionButton_ShowOverlayGlow = WeakAuras .ShowOverlayGlow ,
410411 ActionButton_HideOverlayGlow = WeakAuras .HideOverlayGlow ,
411- WeakAuras = FakeWeakAuras
412+ WeakAuras = FakeWeakAuras ,
412413}
413414
414415local env_getglobal
415- local exec_env = setmetatable ({},
416- {
416+ local exec_env = setmetatable ({}, {
417417 __index = function (t , k )
418418 if k == " _G" then
419419 return t
@@ -437,12 +437,11 @@ local exec_env = setmetatable({},
437437 end ,
438438 __newindex = function (table , key , value )
439439 if _G [key ] then
440- Private .AuraWarnings .UpdateWarning (current_uid , " OverridingGlobal" , " warning" ,
441- string.format (L [" The aura has overwritten the global '%s', this might affect other auras." ], key ))
440+ Private .AuraWarnings .UpdateWarning (current_uid , " OverridingGlobal" , " warning" , string.format (L [" The aura has overwritten the global '%s', this might affect other auras." ], key ))
442441 end
443442 rawset (table , key , value )
444443 end ,
445- __metatable = false
444+ __metatable = false ,
446445})
447446
448447function env_getglobal (k )
0 commit comments