/keys now only show the player name, before was showing the player name and the realm name
This commit is contained in:
@@ -172,15 +172,21 @@ function Details:ContainerSort (container, amount, keyName2) --[[exported]]
|
||||
end
|
||||
end
|
||||
|
||||
---return true if the actor is or was in the player group
|
||||
---@param self table
|
||||
---@return boolean|nil
|
||||
function Details:IsGroupPlayer() --[[exported]]
|
||||
return self.grupo
|
||||
end
|
||||
|
||||
|
||||
---return true if the player is a pet or guardian
|
||||
---@return boolean
|
||||
function Details:IsPetOrGuardian() --[[exported]]
|
||||
return self.owner and true or false
|
||||
end
|
||||
|
||||
---return true if the actor is a player
|
||||
---@return boolean
|
||||
function Details:IsPlayer() --[[exported]]
|
||||
if (self.flag_original) then
|
||||
if (bitBand(self.flag_original, OBJECT_TYPE_PLAYER) ~= 0) then
|
||||
@@ -190,6 +196,8 @@ function Details:IsPlayer() --[[exported]]
|
||||
return false
|
||||
end
|
||||
|
||||
---return true if the actor is an enemy of neutral npc
|
||||
---@return boolean
|
||||
function Details:IsNeutralOrEnemy() --[[exported]]
|
||||
if (self.flag_original) then
|
||||
if (bitBand(self.flag_original, 0x00000060) ~= 0) then
|
||||
@@ -203,6 +211,8 @@ function Details:IsNeutralOrEnemy() --[[exported]]
|
||||
return false
|
||||
end
|
||||
|
||||
---return true if the actor is a friendly npc
|
||||
---@return boolean
|
||||
function Details:IsFriendlyNpc() --[[exported]]
|
||||
local flag = self.flag_original
|
||||
if (flag) then
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--constants
|
||||
|
||||
local combatente = _detalhes.combatente
|
||||
local container_combatentes = _detalhes.container_combatentes
|
||||
local actorContainer = _detalhes.container_combatentes
|
||||
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
|
||||
local atributo_damage = _detalhes.atributo_damage
|
||||
local atributo_heal = _detalhes.atributo_heal
|
||||
@@ -103,8 +103,12 @@
|
||||
["None"] = 0,
|
||||
--]=]
|
||||
|
||||
--attempt to get the owner of rogue's Akaari's Soul from Secrect Technique
|
||||
function Details222.Pets.AkaarisSoulOwner(petGUID, petName)
|
||||
---attempt to get the owner of rogue's Akaari's Soul from Secrect Technique
|
||||
---@param petGUID string
|
||||
---@return string|any
|
||||
---@return string|any
|
||||
---@return number|any
|
||||
function Details222.Pets.AkaarisSoulOwner(petGUID)
|
||||
local tooltipData = C_TooltipInfo.GetHyperlink("unit:" .. petGUID)
|
||||
local args = tooltipData.args
|
||||
|
||||
@@ -232,79 +236,94 @@ end
|
||||
end
|
||||
end
|
||||
|
||||
function container_combatentes:GetActor(actorName)
|
||||
---return the actor object for a given actor name
|
||||
---@param actorName string
|
||||
---@return table|nil
|
||||
function actorContainer:GetActor(actorName)
|
||||
local index = self._NameIndexTable [actorName]
|
||||
if (index) then
|
||||
return self._ActorTable [index]
|
||||
end
|
||||
end
|
||||
|
||||
function container_combatentes:GetSpellSource (spellid)
|
||||
|
||||
---return an actor name which used the spell passed 'spellId'
|
||||
---@param spellId number
|
||||
---@return string|nil
|
||||
function actorContainer:GetSpellSource(spellId)
|
||||
local t = self._ActorTable
|
||||
--print("getting the source", spellid, #t)
|
||||
for i = 1, #t do
|
||||
if (t[i].spells._ActorTable [spellid]) then
|
||||
if (t[i].spells._ActorTable[spellId]) then
|
||||
return t[i].nome
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function container_combatentes:GetAmount (actorName, key)
|
||||
|
||||
---return the value stored in the 'key' for an actor, the key can be any value stored in the actor table such like 'total', 'damage_taken', 'heal', 'interrupt', etc
|
||||
---@param actorName string
|
||||
---@param key string
|
||||
---@return number
|
||||
function actorContainer:GetAmount(actorName, key)
|
||||
key = key or "total"
|
||||
local index = self._NameIndexTable [actorName]
|
||||
local index = self._NameIndexTable[actorName]
|
||||
if (index) then
|
||||
return self._ActorTable [index] [key] or 0
|
||||
return self._ActorTable[index][key] or 0
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
function container_combatentes:GetTotal (key)
|
||||
|
||||
---return the total value stored in the 'key' for all actors, the key can be any value stored in the actor table such like 'total', 'damage_taken', 'heal', 'interrupt', etc
|
||||
---@param key string
|
||||
---@return number
|
||||
function actorContainer:GetTotal(key)
|
||||
local total = 0
|
||||
key = key or "total"
|
||||
for _, actor in ipairs(self._ActorTable) do
|
||||
total = total + (actor [key] or 0)
|
||||
total = total + (actor[key] or 0)
|
||||
end
|
||||
|
||||
return total
|
||||
end
|
||||
|
||||
function container_combatentes:GetTotalOnRaid (key, combat)
|
||||
|
||||
function actorContainer:GetTotalOnRaid(key, combat)
|
||||
local total = 0
|
||||
key = key or "total"
|
||||
local roster = combat.raid_roster
|
||||
for _, actor in ipairs(self._ActorTable) do
|
||||
if (roster [actor.nome]) then
|
||||
total = total + (actor [key] or 0)
|
||||
total = total + (actor[key] or 0)
|
||||
end
|
||||
end
|
||||
|
||||
return total
|
||||
end
|
||||
|
||||
function container_combatentes:ListActors()
|
||||
---return an ipairs iterator for all actors stored in this Container
|
||||
---usage: for index, actorObject in container:ListActors() do
|
||||
---@return function
|
||||
function actorContainer:ListActors()
|
||||
return ipairs(self._ActorTable)
|
||||
end
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--internals
|
||||
|
||||
--build a new actor container
|
||||
function container_combatentes:NovoContainer (tipo_do_container, combat_table, combat_id)
|
||||
local _newContainer = {
|
||||
funcao_de_criacao = container_combatentes:FuncaoDeCriacao (tipo_do_container),
|
||||
|
||||
tipo = tipo_do_container,
|
||||
|
||||
combatId = combat_id,
|
||||
|
||||
---create a new actor container, can be a damage container, heal container, enemy container or utility container
|
||||
---actors can be added by using newContainer.GetOrCreateActor
|
||||
---actors can be retrieved using the same function above
|
||||
---@param containerType number
|
||||
---@param combatObject table
|
||||
---@param combatId number
|
||||
---@return table
|
||||
function actorContainer:NovoContainer(containerType, combatObject, combatId)
|
||||
local newContainer = {
|
||||
funcao_de_criacao = actorContainer:FuncaoDeCriacao(containerType),
|
||||
tipo = containerType,
|
||||
combatId = combatId,
|
||||
_ActorTable = {},
|
||||
_NameIndexTable = {}
|
||||
}
|
||||
|
||||
setmetatable(_newContainer, container_combatentes)
|
||||
|
||||
return _newContainer
|
||||
setmetatable(newContainer, actorContainer)
|
||||
return newContainer
|
||||
end
|
||||
|
||||
--try to get the actor class from name
|
||||
@@ -709,12 +728,17 @@ end
|
||||
end
|
||||
end
|
||||
|
||||
--english alias
|
||||
function container_combatentes:GetOrCreateActor (serial, nome, flag, criar)
|
||||
return self:PegarCombatente (serial, nome, flag, criar)
|
||||
---get an actor from the container, if the actor doesn't exists, and the bShouldCreate is true, create a new actor
|
||||
---@param serial string
|
||||
---@param actorName string
|
||||
---@param actorFlags number
|
||||
---@param bShouldCreate boolean
|
||||
---@return table
|
||||
function actorContainer:GetOrCreateActor (serial, actorName, actorFlags, bShouldCreate)
|
||||
return self:PegarCombatente(serial, actorName, actorFlags, criar)
|
||||
end
|
||||
|
||||
function container_combatentes:PegarCombatente (serial, nome, flag, criar)
|
||||
function actorContainer:PegarCombatente (serial, nome, flag, criar)
|
||||
--[[statistics]]-- _detalhes.statistics.container_calls = _detalhes.statistics.container_calls + 1
|
||||
|
||||
--if (flag and nome:find("Kastfall") and bit.band(flag, 0x2000) ~= 0) then
|
||||
@@ -986,7 +1010,7 @@ end
|
||||
table.wipe(petBlackList)
|
||||
end
|
||||
|
||||
function container_combatentes:FuncaoDeCriacao (tipo)
|
||||
function actorContainer:FuncaoDeCriacao (tipo)
|
||||
if (tipo == container_damage_target) then
|
||||
return alvo_da_habilidade.NovaTabela
|
||||
|
||||
@@ -1018,7 +1042,7 @@ end
|
||||
end
|
||||
|
||||
--chama a fun��o para ser executada em todos os atores
|
||||
function container_combatentes:ActorCallFunction (funcao, ...)
|
||||
function actorContainer:ActorCallFunction (funcao, ...)
|
||||
for index, actor in ipairs(self._ActorTable) do
|
||||
funcao (nil, actor, ...)
|
||||
end
|
||||
@@ -1029,18 +1053,18 @@ end
|
||||
return (t1 [bykey] or 0) > (t2 [bykey] or 0)
|
||||
end
|
||||
|
||||
function container_combatentes:SortByKey (key)
|
||||
function actorContainer:SortByKey (key)
|
||||
assert(type(key) == "string", "Container:SortByKey() expects a keyname on parameter 1.")
|
||||
bykey = key
|
||||
_table_sort (self._ActorTable, sort)
|
||||
self:remapear()
|
||||
end
|
||||
|
||||
function container_combatentes:Remap()
|
||||
function actorContainer:Remap()
|
||||
return self:remapear()
|
||||
end
|
||||
|
||||
function container_combatentes:remapear()
|
||||
function actorContainer:remapear()
|
||||
local mapa = self._NameIndexTable
|
||||
local conteudo = self._ActorTable
|
||||
for i = 1, #conteudo do
|
||||
@@ -1052,7 +1076,7 @@ end
|
||||
--reconstr�i meta e indexes
|
||||
setmetatable(container, _detalhes.container_combatentes)
|
||||
container.__index = _detalhes.container_combatentes
|
||||
container.funcao_de_criacao = container_combatentes:FuncaoDeCriacao (container.tipo)
|
||||
container.funcao_de_criacao = actorContainer:FuncaoDeCriacao (container.tipo)
|
||||
|
||||
--repara mapa
|
||||
local mapa = {}
|
||||
|
||||
@@ -11,56 +11,58 @@ local addonName, Details222 = ...
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--constants
|
||||
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
|
||||
local container_heal = _detalhes.container_type.CONTAINER_HEAL_CLASS
|
||||
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
|
||||
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
|
||||
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
|
||||
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
|
||||
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
|
||||
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
|
||||
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
|
||||
|
||||
local habilidade_dano = _detalhes.habilidade_dano
|
||||
local habilidade_cura = _detalhes.habilidade_cura
|
||||
local habilidade_e_energy = _detalhes.habilidade_e_energy
|
||||
local habilidade_misc = _detalhes.habilidade_misc
|
||||
|
||||
local container_habilidades = _detalhes.container_habilidades
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--internals
|
||||
|
||||
|
||||
function container_habilidades:NovoContainer (tipo_do_container)
|
||||
local _newContainer = {
|
||||
funcao_de_criacao = container_habilidades:FuncaoDeCriacao (tipo_do_container),
|
||||
tipo = tipo_do_container,
|
||||
_ActorTable = {}
|
||||
}
|
||||
|
||||
|
||||
setmetatable(_newContainer, container_habilidades)
|
||||
|
||||
|
||||
return _newContainer
|
||||
end
|
||||
|
||||
function container_habilidades:GetSpell (id)
|
||||
return self._ActorTable [id]
|
||||
---get the spellTable for the passed spellId
|
||||
---@param spellId number
|
||||
---@return table
|
||||
function container_habilidades:GetSpell (spellId)
|
||||
return self._ActorTable[spellId]
|
||||
end
|
||||
|
||||
function container_habilidades:GetAmount (id, key)
|
||||
local spell = self._ActorTable [id]
|
||||
|
||||
---return the value of the spellTable[key] for the passed spellId
|
||||
---@param spellId number
|
||||
---@param key string
|
||||
---@return any
|
||||
function container_habilidades:GetAmount(spellId, key)
|
||||
local spell = self._ActorTable[spellId]
|
||||
if (spell) then
|
||||
return spell [key]
|
||||
return spell[key]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---return an iterator for all spellTables in this container
|
||||
---@return fun(table: table<<K>, <V>>, index?: <K>):<K>, <V>
|
||||
function container_habilidades:ListActors()
|
||||
return pairs(self._ActorTable)
|
||||
end
|
||||
|
||||
function container_habilidades:ListActors()
|
||||
--same as the function above, just an alias
|
||||
function container_habilidades:ListSpells()
|
||||
return pairs(self._ActorTable)
|
||||
end
|
||||
|
||||
@@ -69,18 +71,18 @@ local addonName, Details222 = ...
|
||||
end
|
||||
|
||||
function container_habilidades:PegaHabilidade (id, criar, token)
|
||||
|
||||
|
||||
local esta_habilidade = self._ActorTable [id]
|
||||
|
||||
|
||||
if (esta_habilidade) then
|
||||
return esta_habilidade
|
||||
else
|
||||
if (criar) then
|
||||
|
||||
|
||||
local novo_objeto = self.funcao_de_criacao (nil, id, nil, token)
|
||||
|
||||
|
||||
self._ActorTable [id] = novo_objeto
|
||||
|
||||
|
||||
return novo_objeto
|
||||
else
|
||||
return nil
|
||||
@@ -91,16 +93,16 @@ local addonName, Details222 = ...
|
||||
function container_habilidades:FuncaoDeCriacao (tipo)
|
||||
if (tipo == container_damage) then
|
||||
return habilidade_dano.NovaTabela
|
||||
|
||||
|
||||
elseif (tipo == container_heal) then
|
||||
return habilidade_cura.NovaTabela
|
||||
|
||||
elseif (tipo == container_energy) then
|
||||
return habilidade_e_energy.NovaTabela
|
||||
|
||||
|
||||
elseif (tipo == container_misc) then
|
||||
return habilidade_misc.NovaTabela
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user