Files
coa-details/classes/container_habilidades.lua
T
tercio 710a1e6031 - Emergencial fix for death logs which sometimes was breaking the addon data capture.
- Fixed window alerts which was showing behind the bars.
- Fixed a issue where Details! windows wasn't hidden when a pet battle starts.
- Fixed a issue with segments menu when a window is placed on the right side of the screen.
- Fixed death log issue with friendly fire hits.
2014-06-03 16:42:40 -03:00

125 lines
4.3 KiB
Lua

-- spells container file
local _detalhes = _G._detalhes
local _
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _setmetatable = setmetatable --lua local
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> 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]
end
function container_habilidades:PegaHabilidade (id, criar, token, cria_shadow)
local esta_habilidade = self._ActorTable [id]
if (esta_habilidade) then
return esta_habilidade
else
if (criar) then
if (cria_shadow) then
local novo_objeto = self.funcao_de_criacao (nil, id, nil, "")
self._ActorTable [id] = novo_objeto
return novo_objeto
end
local shadow = self.shadow
local shadow_objeto = nil
if (shadow) then
--> apenas verifica se ele existe ou não
shadow_objeto = shadow:PegaHabilidade (id)
--> se não existir, cria-lo
if (not shadow_objeto) then
shadow_objeto = shadow:PegaHabilidade (id, true, token)
end
end
local novo_objeto = self.funcao_de_criacao (nil, id, shadow_objeto, token)
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
self._ActorTable [id] = novo_objeto
return novo_objeto
else
return nil
end
end
end
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
function _detalhes.refresh:r_container_habilidades (container, shadow)
--> reconstrói meta e indexes
_setmetatable (container, _detalhes.container_habilidades)
container.__index = _detalhes.container_habilidades
local func_criacao = container_habilidades:FuncaoDeCriacao (container.tipo)
container.funcao_de_criacao = func_criacao
--> seta a shadow
container.shadow = shadow
end
function _detalhes.clear:c_container_habilidades (container)
--container.__index = {}
container.__index = nil
container.shadow = nil
container.funcao_de_criacao = nil
end