General Fixes and Improvements

This commit is contained in:
Tercio Jose
2023-05-16 15:21:04 -03:00
parent 7fb0ae469c
commit cebe150e16
10 changed files with 483 additions and 455 deletions
+113 -29
View File
@@ -33,7 +33,7 @@ do
_detalhes.atributo_damage = {}
_detalhes.atributo_damage.__index = _detalhes.atributo_damage
setmetatable(_detalhes.atributo_damage, _detalhes.container_combatentes)
-------------------------------- cura das habilidades.
_detalhes.atributo_heal = {}
_detalhes.atributo_heal.__index = _detalhes.atributo_heal
@@ -43,17 +43,17 @@ do
_detalhes.atributo_energy = {}
_detalhes.atributo_energy.__index = _detalhes.atributo_energy
setmetatable(_detalhes.atributo_energy, _detalhes.container_combatentes)
-------------------------------- outros atributos
_detalhes.atributo_misc = {}
_detalhes.atributo_misc.__index = _detalhes.atributo_misc
setmetatable(_detalhes.atributo_misc, _detalhes.container_combatentes)
-------------------------------- atributos customizados
_detalhes.atributo_custom = {}
_detalhes.atributo_custom.__index = _detalhes.atributo_custom
setmetatable(_detalhes.atributo_custom, _detalhes.container_combatentes)
-------------------------------- armazena as classes de habilidades usadas pelo combatente
_detalhes.container_habilidades = {}
_detalhes.container_habilidades.__index = _detalhes.container_habilidades
@@ -63,12 +63,12 @@ do
_detalhes.habilidade_cura = {}
_detalhes.habilidade_cura.__index = _detalhes.habilidade_cura
setmetatable(_detalhes.habilidade_cura, _detalhes.container_habilidades)
---------------------------------------- classe das habilidades que do danos
_detalhes.habilidade_dano = {}
_detalhes.habilidade_dano.__index = _detalhes.habilidade_dano
setmetatable(_detalhes.habilidade_dano, _detalhes.container_habilidades)
---------------------------------------- classe das habilidades que do e_energy
_detalhes.habilidade_e_energy = {}
_detalhes.habilidade_e_energy.__index = _detalhes.habilidade_e_energy
@@ -78,13 +78,13 @@ do
_detalhes.habilidade_misc = {}
_detalhes.habilidade_misc.__index = _detalhes.habilidade_misc
setmetatable(_detalhes.habilidade_misc, _detalhes.container_habilidades)
---------------------------------------- classe dos alvos das habilidads
_detalhes.alvo_da_habilidade = {}
_detalhes.alvo_da_habilidade.__index = _detalhes.alvo_da_habilidade
setmetatable(_detalhes.alvo_da_habilidade, _detalhes.container_combatentes)
--[[ Armazena os diferentes tipos de containers ]] --[[ Container Types ]]
_detalhes.container_type = {
@@ -121,10 +121,10 @@ do
self.spec = initialSpecListOverride[specId] or specId
end
function _detalhes:Name (actor)
function _detalhes:Name(actor)
return self.nome or actor and actor.nome
end
function _detalhes:GetName (actor)
function _detalhes:GetName(actor)
return self.nome or actor and actor.nome
end
@@ -133,7 +133,7 @@ do
return Details:GetOnlyName(name)
end
function _detalhes:GetDisplayName (actor)
function _detalhes:GetDisplayName(actor)
return self.displayName or actor and actor.displayName
end
@@ -152,16 +152,16 @@ do
end
return self.nome:gsub(("%-.*"), "")
end
function _detalhes:RemoveOwnerName (string)
function _detalhes:RemoveOwnerName(string)
if (string) then
return string:gsub((" <.*"), "")
end
return self.nome:gsub((" <.*"), "")
end
function _detalhes:GetCLName(id)
local name, realm = UnitName (id)
local name, realm = UnitName(id)
if (name) then
if (realm and realm ~= "") then
name = name .. "-" .. realm
@@ -169,50 +169,134 @@ do
return name
end
end
function _detalhes:Class (actor)
function Details:Class(actor)
return self.classe or actor and actor.classe
end
function _detalhes:GetActorClass (actor)
function Details:GetActorClass(actor)
return self.classe or actor and actor.classe
end
function _detalhes:GetGUID (actor)
function Details:GetGUID(actor)
return self.serial or actor and actor.serial
end
function _detalhes:GetFlag (actor)
function Details:GetFlag(actor)
return self.flag_original or actor and actor.flag_original
end
function _detalhes:GetSpells()
return self.spells._ActorTable
end
function _detalhes:GetActorSpells()
function Details:GetSpells()
return self.spells._ActorTable
end
function _detalhes:GetSpell(spellid)
function Details:GetActorSpells()
return self.spells._ActorTable
end
function Details:GetSpell(spellid)
return self.spells._ActorTable [spellid]
end
---return an array of pet names
---@return table
function _detalhes:GetPets()
function Details:GetPets()
return self.pets
end
---return an array of pet names
---@return table
function _detalhes:Pets()
function Details:Pets()
return self.pets
end
function _detalhes:GetSpec(actor)
function Details:GetSpec(actor)
return self.spec or actor and actor.spec
end
function _detalhes:Spec(actor)
function Details:Spec(actor)
return self.spec or actor and actor.spec
end
---add the class color to the string passed
---@param thisString string
---@param class string
---@return string
function Details:AddColorString(thisString, class)
--check if the class colors exists
local classColors = _G["RAID_CLASS_COLORS"]
if (classColors) then
local color = classColors[class]
--check if the player name is valid
if (type(thisString) == "string" and color) then
thisString = "|c" .. color.colorStr .. thisString .. "|r"
return thisString
end
end
--if failed, return the string without modifications
return thisString
end
---add the role icon to the string passed
---@param thisString string
---@param role string
---@param size number|nil default is 14
---@return string
function Details:AddRoleIcon(thisString, role, size)
--check if is a valid role
local roleIcon = Details.role_texcoord [role]
if (type(thisString) == "string" and roleIcon and role ~= "NONE") then
--add the role icon
size = size or 14
thisString = "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. size .. ":" .. size .. ":0:0:256:256:" .. roleIcon .. "|t " .. thisString
return thisString
end
--if failed, return the string without modifications
return thisString
end
---add the spec icon or class icon to the string passed
---@param thisString string
---@param class string|nil
---@param spec number|nil
---@param iconSize number|nil default is 16
---@param useAlphaIcons boolean|nil default is false
---@return string
function Details:AddClassOrSpecIcon(thisString, class, spec, iconSize, useAlphaIcons)
iconSize = iconSize or 16
if (spec) then
local specString = ""
local L, R, T, B = unpack(Details.class_specs_coords[spec])
if (L) then
if (useAlphaIcons) then
specString = "|TInterface\\AddOns\\Details\\images\\spec_icons_normal_alpha:" .. iconSize .. ":" .. iconSize .. ":0:0:512:512:" .. (L * 512) .. ":" .. (R * 512) .. ":" .. (T * 512) .. ":" .. (B * 512) .. "|t"
else
specString = "|TInterface\\AddOns\\Details\\images\\spec_icons_normal:" .. iconSize .. ":" .. iconSize .. ":0:0:512:512:" .. (L * 512) .. ":" .. (R * 512) .. ":" .. (T * 512) .. ":" .. (B * 512) .. "|t"
end
return specString .. " " .. thisString
end
end
if (class) then
local classString = ""
local L, R, T, B = unpack(Details.class_coords[class])
if (L) then
local imageSize = 128
if (useAlphaIcons) then
classString = "|TInterface\\AddOns\\Details\\images\\classes_small_alpha:" .. iconSize .. ":" .. iconSize .. ":0:0:" .. imageSize .. ":" .. imageSize .. ":" .. (L * imageSize) .. ":" .. (R * imageSize) .. ":" .. (T * imageSize) .. ":" .. (B * imageSize) .. "|t"
else
classString = "|TInterface\\AddOns\\Details\\images\\classes_small:" .. iconSize .. ":" .. iconSize .. ":0:0:" .. imageSize .. ":" .. imageSize .. ":" .. (L * imageSize) .. ":" .. (R * imageSize) .. ":" .. (T * imageSize) .. ":" .. (B * imageSize) .. "|t"
end
return classString .. " " .. thisString
end
end
return thisString
end
--inherits to all actors without placing it on _detalhes namespace.
_detalhes.container_combatentes.guid = _detalhes.GetGUID
_detalhes.container_combatentes.name = _detalhes.GetName