General Fixes
This commit is contained in:
+23
-13
@@ -181,25 +181,33 @@
|
||||
end
|
||||
|
||||
---return the amount of casts of a spells from an actor
|
||||
---@param self combat
|
||||
---@param actorName string
|
||||
---@param spellId number
|
||||
---@param spellName string
|
||||
---@return number
|
||||
function combate:GetSpellCastAmount(actorName, spellId)
|
||||
---@type actorcontainer
|
||||
local utilityContainer = self:GetContainer(DETAILS_ATTRIBUTE_MISC)
|
||||
---@type actor
|
||||
local actorObject = utilityContainer:GetActor(actorName)
|
||||
if (actorObject) then
|
||||
if (actorObject.spell_cast) then
|
||||
return actorObject.spell_cast[spellId] or 0
|
||||
else
|
||||
return 0
|
||||
end
|
||||
function combate:GetSpellCastAmount(actorName, spellName)
|
||||
return self.amountCasts[actorName] and self.amountCasts[actorName][spellName] or 0
|
||||
end
|
||||
|
||||
---return the cast amount table
|
||||
---@param self combat
|
||||
---@param actorName string|nil
|
||||
---@return table
|
||||
function combate:GetSpellCastTable(actorName)
|
||||
if (actorName) then
|
||||
return self.amountCasts[actorName] or {}
|
||||
else
|
||||
return 0
|
||||
return self.amountCasts
|
||||
end
|
||||
end
|
||||
|
||||
---delete an actor from the spell casts amount
|
||||
---@param self combat
|
||||
---@param actorName string
|
||||
function combate:RemoveActorFromSpellCastTable(actorName)
|
||||
self.amountCasts[actorName] = nil
|
||||
end
|
||||
|
||||
---return the uptime of a buff from an actor
|
||||
---@param actorName string
|
||||
---@param spellId number
|
||||
@@ -548,6 +556,8 @@
|
||||
|
||||
setmetatable(esta_tabela, combate)
|
||||
|
||||
esta_tabela.amountCasts = {}
|
||||
|
||||
_detalhes.combat_counter = _detalhes.combat_counter + 1
|
||||
esta_tabela.combat_counter = _detalhes.combat_counter
|
||||
|
||||
|
||||
@@ -1748,7 +1748,7 @@
|
||||
desc = Loc ["STRING_CUSTOM_MYSPELLS_DESC"],
|
||||
source = false,
|
||||
target = false,
|
||||
script_version = 9,
|
||||
script_version = 10,
|
||||
script = [[
|
||||
--get the parameters passed
|
||||
local combat, instance_container, instance = ...
|
||||
@@ -1824,7 +1824,7 @@
|
||||
|
||||
local spellschool, schooltext = spell.spellschool, ""
|
||||
if (spellschool) then
|
||||
local t = _detalhes.spells_school [spellschool]
|
||||
local t = Details.spells_school [spellschool]
|
||||
if (t and t.name) then
|
||||
schooltext = t.formated
|
||||
end
|
||||
@@ -1834,28 +1834,20 @@
|
||||
local combat_time = instance.showing:GetCombatTime()
|
||||
|
||||
local debuff_uptime_total, cast_string = "", ""
|
||||
local misc_actor = instance.showing (4, _detalhes.playername)
|
||||
local misc_actor = instance.showing (4, Details.playername)
|
||||
if (misc_actor) then
|
||||
local debuff_uptime = misc_actor.debuff_uptime_spells and misc_actor.debuff_uptime_spells._ActorTable [spell.id] and misc_actor.debuff_uptime_spells._ActorTable [spell.id].uptime
|
||||
if (debuff_uptime) then
|
||||
debuff_uptime_total = floor(debuff_uptime / instance.showing:GetCombatTime() * 100)
|
||||
end
|
||||
|
||||
local spell_cast = misc_actor.spell_cast and misc_actor.spell_cast [spell.id]
|
||||
local spellName = GetSpellInfo(spell.id)
|
||||
local amountOfCasts = combat:GetSpellCastAmount(Details.playername, spellName)
|
||||
|
||||
if (not spell_cast and misc_actor.spell_cast) then
|
||||
local spellname = GetSpellInfo(spell.id)
|
||||
for casted_spellid, amount in pairs(misc_actor.spell_cast) do
|
||||
local casted_spellname = GetSpellInfo(casted_spellid)
|
||||
if (casted_spellname == spellname) then
|
||||
spell_cast = amount .. " (|cFFFFFF00?|r)"
|
||||
end
|
||||
end
|
||||
if (amountOfCasts == 0) then
|
||||
amountOfCasts = "(|cFFFFFF00?|r)"
|
||||
end
|
||||
if (not spell_cast) then
|
||||
spell_cast = "(|cFFFFFF00?|r)"
|
||||
end
|
||||
cast_string = cast_string .. spell_cast
|
||||
cast_string = cast_string .. amountOfCasts
|
||||
end
|
||||
|
||||
--Cooltip code
|
||||
|
||||
@@ -5272,33 +5272,17 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance)
|
||||
|
||||
local misc_actor = info.instancia.showing (4, self:name())
|
||||
if (misc_actor) then
|
||||
|
||||
local uptime_spellid = spellTable.id
|
||||
--if (uptime_spellid == 233490) then
|
||||
-- uptime_spellid = 233496
|
||||
-- uptime_spellid = 233490
|
||||
--end
|
||||
|
||||
local debuff_uptime = misc_actor.debuff_uptime_spells and misc_actor.debuff_uptime_spells._ActorTable [uptime_spellid] and misc_actor.debuff_uptime_spells._ActorTable [uptime_spellid].uptime
|
||||
if (debuff_uptime) then
|
||||
hits_string = hits_string .. " |cFFDDDD44(" .. _math_floor(debuff_uptime / info.instancia.showing:GetCombatTime() * 100) .. "% uptime)|r"
|
||||
end
|
||||
|
||||
local spell_cast = misc_actor.spell_cast and misc_actor.spell_cast [spellId]
|
||||
|
||||
if (not spell_cast and misc_actor.spell_cast) then
|
||||
local spellname = GetSpellInfo(spellId)
|
||||
for casted_spellid, amount in pairs(misc_actor.spell_cast) do
|
||||
local casted_spellname = GetSpellInfo(casted_spellid)
|
||||
if (casted_spellname == spellname) then
|
||||
spell_cast = amount .. " (|cFFFFFF00?|r)"
|
||||
end
|
||||
end
|
||||
local amountOfCasts = info.instancia.showing:GetSpellCastAmount(self:Name(), spellName)
|
||||
if (amountOfCasts == 0) then
|
||||
amountOfCasts = "(|cFFFFFF00?|r)"
|
||||
end
|
||||
if (not spell_cast) then
|
||||
spell_cast = "(|cFFFFFF00?|r)"
|
||||
end
|
||||
cast_string = cast_string .. spell_cast
|
||||
cast_string = cast_string .. amountOfCasts
|
||||
end
|
||||
|
||||
if (spellTable.e_total) then
|
||||
|
||||
+5
-15
@@ -2403,7 +2403,7 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra)
|
||||
end
|
||||
|
||||
--icone direito superior
|
||||
local _, _, icone = _GetSpellInfo(spellid)
|
||||
local spellName, _, icone = _GetSpellInfo(spellid)
|
||||
info.spell_icone:SetTexture(icone)
|
||||
|
||||
local total = self.total
|
||||
@@ -2457,21 +2457,11 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra)
|
||||
hits_string = hits_string .. " |cFFDDDD44(" .. _math_floor(buff_uptime / info.instancia.showing:GetCombatTime() * 100) .. "% uptime)|r"
|
||||
end
|
||||
|
||||
local spell_cast = misc_actor.spell_cast and misc_actor.spell_cast [spellid]
|
||||
|
||||
if (not spell_cast and misc_actor.spell_cast) then
|
||||
local spellname = GetSpellInfo(spellid)
|
||||
for casted_spellid, amount in pairs(misc_actor.spell_cast) do
|
||||
local casted_spellname = GetSpellInfo(casted_spellid)
|
||||
if (casted_spellname == spellname) then
|
||||
spell_cast = amount .. " (|cFFFFFF00?|r)"
|
||||
end
|
||||
end
|
||||
local amountOfCasts = info.instancia.showing:GetSpellCastAmount(self:Name(), spellName)
|
||||
if (not amountOfCasts) then
|
||||
amountOfCasts = "(|cFFFFFF00?|r)"
|
||||
end
|
||||
if (not spell_cast) then
|
||||
spell_cast = "(|cFFFFFF00?|r)"
|
||||
end
|
||||
cast_string = cast_string .. spell_cast
|
||||
cast_string = cast_string .. amountOfCasts
|
||||
end
|
||||
|
||||
gump:SetaDetalheInfoTexto( index, 100,
|
||||
|
||||
@@ -135,30 +135,9 @@ end
|
||||
---attempt to get the amount of casts of a spell
|
||||
---@param combat table the combat object
|
||||
---@param actorName string name of the actor
|
||||
---@param spellId number spell id
|
||||
function Details:GetSpellCastAmount(combat, actorName, spellId) --[[exported]]
|
||||
local actorUtilityObject = combat:GetActor(4, actorName)
|
||||
if (actorUtilityObject) then
|
||||
local castAmountTable = actorUtilityObject.spell_cast
|
||||
if (castAmountTable) then
|
||||
local castAmount = castAmountTable[spellId]
|
||||
if (castAmount) then
|
||||
return castAmount
|
||||
|
||||
elseif (not castAmount) then
|
||||
--if the amount of casts is not found, attempt to find a spell with the same name and get the amount of casts of that spell instead
|
||||
local spellName = GetSpellInfo(spellId)
|
||||
for thisSpellId, thisCastAmount in pairs(castAmountTable) do
|
||||
local thisSpellName = GetSpellInfo(thisSpellId)
|
||||
if (thisSpellName == spellName and thisCastAmount and thisCastAmount > 0) then
|
||||
return thisCastAmount
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return 0
|
||||
---@param spellName string
|
||||
function Details:GetSpellCastAmount(combat, actorName, spellName) --[[exported]]
|
||||
return combat:GetSpellCastAmount(actorName, spellName)
|
||||
end
|
||||
|
||||
function atributo_misc:NovaTabela(serial, nome, link)
|
||||
@@ -2414,16 +2393,6 @@ function atributo_misc:r_onlyrefresh_shadow (actor)
|
||||
|
||||
_detalhes.refresh:r_atributo_misc (actor, shadow)
|
||||
|
||||
--spell cast
|
||||
if (actor.spell_cast) then
|
||||
if (not shadow.spell_cast) then
|
||||
shadow.spell_cast = {}
|
||||
end
|
||||
for spellid, _ in pairs(actor.spell_cast) do
|
||||
shadow.spell_cast [spellid] = shadow.spell_cast [spellid] or 0
|
||||
end
|
||||
end
|
||||
|
||||
--cc done
|
||||
if (actor.cc_done) then
|
||||
refresh_alvos (shadow.cc_done_targets, actor.cc_done_targets)
|
||||
@@ -2551,16 +2520,6 @@ function atributo_misc:r_connect_shadow (actor, no_refresh, combat_object)
|
||||
DetailsFramework.table.addunique (shadow.pets, petName)
|
||||
end
|
||||
|
||||
if (actor.spell_cast) then
|
||||
if (not shadow.spell_cast) then
|
||||
shadow.spell_cast = {}
|
||||
end
|
||||
|
||||
for spellid, amount in pairs(actor.spell_cast) do
|
||||
shadow.spell_cast [spellid] = (shadow.spell_cast [spellid] or 0) + amount
|
||||
end
|
||||
end
|
||||
|
||||
if (actor.cc_done) then
|
||||
if (not shadow.cc_done_targets) then
|
||||
shadow.cc_done = _detalhes:GetOrderNumber()
|
||||
@@ -2761,13 +2720,6 @@ function _detalhes.refresh:r_atributo_misc(thisActor, shadow)
|
||||
|
||||
thisActor.__index = _detalhes.atributo_misc
|
||||
|
||||
--refresh spell cast
|
||||
if (thisActor.spell_cast) then
|
||||
if (shadow and not shadow.spell_cast) then
|
||||
shadow.spell_cast = {}
|
||||
end
|
||||
end
|
||||
|
||||
--refresh cc done
|
||||
if (thisActor.cc_done) then
|
||||
if (shadow and not shadow.cc_done_targets) then
|
||||
@@ -2903,13 +2855,6 @@ function _detalhes.clear:c_atributo_misc (este_jogador)
|
||||
end
|
||||
|
||||
atributo_misc.__add = function(tabela1, tabela2)
|
||||
|
||||
if (tabela2.spell_cast) then
|
||||
for spellid, amount in pairs(tabela2.spell_cast) do
|
||||
tabela1.spell_cast [spellid] = (tabela1.spell_cast [spellid] or 0) + amount
|
||||
end
|
||||
end
|
||||
|
||||
if (tabela2.cc_done) then
|
||||
tabela1.cc_done = tabela1.cc_done + tabela2.cc_done
|
||||
|
||||
@@ -3169,13 +3114,6 @@ local subtrair_keys = function(habilidade, habilidade_tabela1)
|
||||
end
|
||||
|
||||
atributo_misc.__sub = function(tabela1, tabela2)
|
||||
|
||||
if (tabela2.spell_cast) then
|
||||
for spellid, amount in pairs(tabela2.spell_cast) do
|
||||
tabela1.spell_cast [spellid] = (tabela1.spell_cast [spellid] or 0) - amount
|
||||
end
|
||||
end
|
||||
|
||||
if (tabela2.cc_done) then
|
||||
tabela1.cc_done = tabela1.cc_done - tabela2.cc_done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user