You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							84 lines
						
					
					
						
							2.5 KiB
						
					
					
				
			
		
		
	
	
							84 lines
						
					
					
						
							2.5 KiB
						
					
					
				| --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
 | |
| -- Lua Library inline imports
 | |
| local function __TS__ArrayForEach(self, callbackFn, thisArg)
 | |
|     for i = 1, #self do
 | |
|         callbackFn(thisArg, self[i], i - 1, self)
 | |
|     end
 | |
| end
 | |
| -- End of Lua Library inline imports
 | |
| local ____exports = {}
 | |
| local _, _Mekanome = ...
 | |
| local Mekanome = _Mekanome
 | |
| local function New(token)
 | |
|     local auras = {}
 | |
|     local helpfulSlots = {C_UnitAuras.GetAuraSlots(token, "HELPFUL", 200, nil)}
 | |
|     __TS__ArrayForEach(
 | |
|         helpfulSlots,
 | |
|         function(____, s)
 | |
|             if s ~= nil then
 | |
|                 local aura = C_UnitAuras.GetAuraDataBySlot(token, s)
 | |
|                 if aura then
 | |
|                     auras[aura.auraInstanceID] = aura
 | |
|                 end
 | |
|             end
 | |
|         end
 | |
|     )
 | |
|     local harmfulSlots = {C_UnitAuras.GetAuraSlots(token, "HARMFUL", 200, nil)}
 | |
|     __TS__ArrayForEach(
 | |
|         harmfulSlots,
 | |
|         function(____, s)
 | |
|             if s ~= nil then
 | |
|                 local aura = C_UnitAuras.GetAuraDataBySlot(token, s)
 | |
|                 if aura then
 | |
|                     auras[aura.auraInstanceID] = aura
 | |
|                 end
 | |
|             end
 | |
|         end
 | |
|     )
 | |
|     return auras
 | |
| end
 | |
| local function GetUpdatedAuras(updateInfo, mob)
 | |
|     local auras = {}
 | |
|     if updateInfo.isFullUpdate then
 | |
|         return New(mob.token)
 | |
|     end
 | |
|     if mob.auras ~= nil then
 | |
|         for instanceId, aura in pairs(mob.auras) do
 | |
|             auras[instanceId] = aura
 | |
|         end
 | |
|     end
 | |
|     if updateInfo.removedAuraInstanceIDs ~= nil then
 | |
|         __TS__ArrayForEach(
 | |
|             updateInfo.removedAuraInstanceIDs,
 | |
|             function(____, id)
 | |
|                 if auras[id] ~= nil then
 | |
|                     auras[id] = nil
 | |
|                 end
 | |
|             end
 | |
|         )
 | |
|     end
 | |
|     if updateInfo.addedAuras ~= nil then
 | |
|         __TS__ArrayForEach(
 | |
|             updateInfo.addedAuras,
 | |
|             function(____, data)
 | |
|                 auras[data.auraInstanceID] = data
 | |
|             end
 | |
|         )
 | |
|     end
 | |
|     if updateInfo.updatedAuraInstanceIDs then
 | |
|         __TS__ArrayForEach(
 | |
|             updateInfo.updatedAuraInstanceIDs,
 | |
|             function(____, id)
 | |
|                 local data = C_UnitAuras.GetAuraDataByAuraInstanceID(mob.token, id)
 | |
|                 if data then
 | |
|                     auras[data.auraInstanceID] = data
 | |
|                 end
 | |
|             end
 | |
|         )
 | |
|     end
 | |
|     return auras
 | |
| end
 | |
| local _AuraManager = {New = New, GetUpdatedAuras = GetUpdatedAuras}
 | |
| Mekanome.AuraManager = _AuraManager
 | |
| ____exports.default = {}
 | |
| return ____exports
 | |
| 
 |