General Fixes

This commit is contained in:
Tercio Jose
2023-04-30 23:23:56 -03:00
parent 6be5ab14f4
commit 11a6c48ddd
24 changed files with 420 additions and 696 deletions
+157 -187
View File
@@ -12,7 +12,7 @@ local addonName, Details222 = ...
--local helpers
local getCombatObject = function(segmentNumber)
local combatObject
--select which segment to use, use low level variables for performance
if (segmentNumber == -1) then
combatObject = _detalhes.tabela_overall
@@ -21,7 +21,7 @@ local getCombatObject = function(segmentNumber)
else
combatObject = _detalhes.tabela_historico.tabelas [segmentNumber]
end
return combatObject
end
@@ -46,17 +46,17 @@ end
--return the spell object and the spellId
local getSpellObject = function(playerObject, spellId, isLiteral)
local parameterType = type(spellId)
if (parameterType == "number" and isLiteral) then
--is the id of a spell and literal, directly get the spell object
return playerObject.spells._ActorTable [spellId], spellId
else
local passedSpellName
if (parameterType == "string") then
--passed a spell name, make the spell be in lower case
passedSpellName = spellId:lower()
elseif (parameterType == "number") then
--passed a number but with literal off, transform the spellId into a spell name
local spellName = GetSpellInfo(spellid)
@@ -64,7 +64,7 @@ local getSpellObject = function(playerObject, spellId, isLiteral)
passedSpellName = spellName:lower()
end
end
if (passedSpellName) then
for thisSpellId, spellObject in pairs(playerObject.spells._ActorTable) do
local spellName = Details.GetSpellInfo(thisSpellId)
@@ -120,17 +120,17 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.SegmentInfo (segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
local segmentInfo = {
}
if (not combatObject) then
return segmentInfo
end
return segmentInfo
end
@@ -161,11 +161,11 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.SegmentElapsedTime (segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
return combatObject:GetCombatTime()
end
@@ -216,34 +216,34 @@ function Details.SegmentDamagingUnits (includePlayerUnits, includeEnemyUnits, in
if (type(includePlayerUnits) ~= "boolean") then
includePlayerUnits = true
end
local combatObject = getCombatObject (segment)
local units = {}
local nextIndex = 1
if (not combatObject) then
return units
end
local damageContainer = combatObject:GetContainer (DETAILS_ATTRIBUTE_DAMAGE)
for i = 1, #damageContainer._ActorTable do
local playerObject = damageContainer._ActorTable [i]
if (includePlayerUnits and playerObject.grupo) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
elseif (includeEnemyUnits and playerObject:IsEnemy()) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
elseif (includeFriendlyPetUnits and playerObject:IsPetOrGuardian()) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
end
end
return units
end
@@ -295,34 +295,34 @@ function Details.SegmentHealingUnits (includePlayerUnits, includeEnemyUnits, inc
if (type(includePlayerUnits) ~= "boolean") then
includePlayerUnits = true
end
local combatObject = getCombatObject (segment)
local units = {}
local nextIndex = 1
if (not combatObject) then
return units
end
local damageContainer = combatObject:GetContainer (DETAILS_ATTRIBUTE_HEAL)
for i = 1, #damageContainer._ActorTable do
local playerObject = damageContainer._ActorTable [i]
if (includePlayerUnits and playerObject.grupo) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
elseif (includeEnemyUnits and playerObject:IsEnemy()) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
elseif (includeFriendlyPetUnits and playerObject:IsPetOrGuardian()) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
end
end
return units
end
@@ -354,11 +354,11 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.SegmentTotalDamage (segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
return floor(combatObject.totals_grupo [1])
end
@@ -391,11 +391,11 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.SegmentTotalHealing (segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
return floor(combatObject.totals_grupo [2])
end
@@ -427,20 +427,20 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.SegmentPhases (segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
local phases = {}
if (not combatObject) then
return phases
end
end
local phaseData = combatObject.PhaseData
for phaseChangeId, phaseTable in ipairs(phaseData) do
local phaseNumber = phaseTable [1]
DetailsFramework.table.addunique (phases, phaseNumber)
end
return phases
end
@@ -481,7 +481,7 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitInfo (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
local unitInfo = {
class = "UNKNOW", --old typo in details
spec = 0,
@@ -494,18 +494,18 @@ function Details.UnitInfo (unitId, segment)
isArenaEnemy = false,
arenaTeam = false,
}
if (not combatObject) then
return unitInfo
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return unitInfo
end
local specCache = Details.cached_specs
local unitSerial = UnitGUID(unitId)
local _, class = UnitClass(unitId)
@@ -566,7 +566,7 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitTexture (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
local textureInfo = {
classTexture = [[Interface\LFGFRAME\LFGROLE_BW]],
classLeft = 0.25,
@@ -579,32 +579,32 @@ function Details.UnitTexture (unitId, segment)
specTop = 0,
specBottom = 1,
}
if (not combatObject) then
return textureInfo
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return textureInfo
end
local texture, left, right, top, bottom = playerObject:GetClassIcon()
textureInfo.classTexture = texture
textureInfo.classLeft = left
textureInfo.classRight = right
textureInfo.classTop = top
textureInfo.classBottom = bottom
local texture, left, right, top, bottom = Details:GetSpecIcon (playerObject.spec)
textureInfo.specTexture = texture
textureInfo.specLeft = left
textureInfo.specRight = right
textureInfo.specTop = top
textureInfo.specBottom = bottom
return textureInfo
end
@@ -644,18 +644,18 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamage (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
return floor(playerObject.total or 0)
end
@@ -699,22 +699,22 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamageByPhase (unitId, phaseNumber, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
if (not phaseNumber) then
return 0
end
local unitName = getUnitName (unitId)
local damagePhaseData = combatObject.PhaseData.damage [phaseNumber]
if (not damagePhaseData) then
return 0
end
local phaseDamage = damagePhaseData [unitName] or 0
return floor(phaseDamage)
end
@@ -752,13 +752,13 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamageInfo (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local damageInfo = {
total = 0,
totalWithoutPet = 0,
@@ -767,19 +767,19 @@ function Details.UnitDamageInfo (unitId, segment)
friendlyFire = 0,
activityTime = 0,
}
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return damageInfo
end
damageInfo.total = floor(playerObject.total)
damageInfo.totalWithoutPet = floor(playerObject.total_without_pet)
damageInfo.damageAbsorbed = floor(playerObject.totalabsorbed)
damageInfo.damageTaken = floor(playerObject.damage_taken)
damageInfo.friendlyFire = playerObject.friendlyfire_total
damageInfo.activityTime = playerObject:Tempo()
return damageInfo
end
@@ -838,14 +838,14 @@ function Details.UnitDamageBySpell (unitId, spellId, isLiteral, segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
if (spellObject) then
@@ -903,15 +903,15 @@ function Details.UnitDamageSpellInfo (unitId, spellId, isLiteral, segment)
isLiteral = true
end
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local spellInfo = {
total = 0,
spellId = 0,
@@ -927,35 +927,20 @@ function Details.UnitDamageSpellInfo (unitId, spellId, isLiteral, segment)
criticalHits = 0,
criticalDamage = 0,
}
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
local playerObject = getActorObjectFromCombat(combatObject, 1, unitName)
if (not playerObject) then
return spellInfo
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
local spellObject, spellId = getSpellObject(playerObject, spellId, isLiteral)
if (not spellObject) then
return spellInfo
end
local miscPlayerObject = getActorObjectFromCombat (combatObject, 4, unitName)
if (miscPlayerObject) then
local spellName = GetSpellInfo(spellId)
local castedAmount = miscPlayerObject.spell_cast and miscPlayerObject.spell_cast [spellId]
if (castedAmount) then
spellInfo.casted = castedAmount
else
for castedSpellId, castedAmount in pairs(miscPlayerObject.spell_cast) do
local castedSpellName = GetSpellInfo(castedSpellId)
if (castedSpellName == spellName) then
spellInfo.casted = castedAmount
break
end
end
end
end
local spellName = GetSpellInfo(spellId)
spellInfo.casted = combatObject:GetSpellCastAmount(unitName, spellName)
if (spellObject) then
spellInfo.total = spellObject.total
spellInfo.count = spellObject.counter
@@ -970,7 +955,7 @@ function Details.UnitDamageSpellInfo (unitId, spellId, isLiteral, segment)
spellInfo.criticalHits = spellObject.c_amt
spellInfo.criticalDamage = spellObject.c_total
end
return spellInfo
end
@@ -1027,19 +1012,19 @@ function Details.UnitDamageSpellOnUnit (unitId, spellId, targetUnitId, isLiteral
isLiteral = true
end
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
if (spellObject) then
local targetName = getUnitName (targetUnitId)
@@ -1086,14 +1071,14 @@ function Details.UnitDamageTaken (unitId, segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
return floor(playerObject.damage_taken)
end
@@ -1136,18 +1121,18 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamageOnUnit (unitId, targetUnitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
local targetName = getUnitName (targetUnitId)
return playerObject.targets [targetName] or 0
end
@@ -1193,16 +1178,16 @@ function Details.UnitDamageTakenFromSpell (unitId, spellId, isLiteral, segment)
if (type(isLiteral) ~= "boolean") then
isLiteral = true
end
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local damageContainer = combatObject:GetContainer (DETAILS_ATTRIBUTE_DAMAGE)
local totalDamageTaken = 0
if (isLiteral and type(spellId) == "number") then
for i = 1, #damageContainer._ActorTable do
@@ -1265,20 +1250,20 @@ function Details.UnitDamagingSpells (unitId, segment)
if (not combatObject) then
return {}
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return {}
end
local unitSpells = playerObject.spells._ActorTable
local resultTable = {}
for spellId, spellObject in pairs(unitSpells) do
resultTable [#resultTable + 1] = spellId
end
return resultTable
end
@@ -1315,23 +1300,23 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamagingTargets (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local offensiveTargetNames = {}
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return offensiveTargetNames
end
for targetName, _ in pairs(playerObject.targets) do
offensiveTargetNames [#offensiveTargetNames + 1] = targetName
end
return offensiveTargetNames
end
@@ -1369,23 +1354,23 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamagingPets (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local petNames = {}
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return petNames
end
for i = 1, #playerObject.pets do
petNames [#petNames + 1] = playerObject.pets [i]
end
return petNames
end
@@ -1427,18 +1412,18 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitHealing (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return 0
end
return floor(playerObject.total or 0)
end
@@ -1476,13 +1461,13 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitHealingInfo (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local healingInfo = {
total = 0,
totalWithoutPet = 0,
@@ -1494,12 +1479,12 @@ function Details.UnitHealingInfo (unitId, segment)
healingTaken = 0,
activityTime = 0,
}
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return healingInfo
end
healingInfo.total = floor(playerObject.total)
healingInfo.totalWithoutPet = floor(playerObject.total_without_pet)
healingInfo.totalOverhealWithoutPet = floor(playerObject.totalover_without_pet)
@@ -1567,16 +1552,16 @@ function Details.UnitHealingBySpell (unitId, spellId, isLiteral, segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return 0
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
if (spellObject) then
return spellObject.total
else
@@ -1634,13 +1619,13 @@ function Details.UnitHealingSpellInfo (unitId, spellId, isLiteral, segment)
isLiteral = true
end
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local spellInfo = {
@@ -1658,35 +1643,20 @@ function Details.UnitHealingSpellInfo (unitId, spellId, isLiteral, segment)
criticalHits = 0,
criticalHealing = 0,
}
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return spellInfo
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
if (not spellObject) then
return spellInfo
end
local miscPlayerObject = getActorObjectFromCombat (combatObject, 4, unitName)
if (miscPlayerObject) then
local spellName = GetSpellInfo(spellId)
local castedAmount = miscPlayerObject.spell_cast and miscPlayerObject.spell_cast [spellId]
if (castedAmount) then
spellInfo.casted = castedAmount
else
for castedSpellId, castedAmount in pairs(miscPlayerObject.spell_cast) do
local castedSpellName = GetSpellInfo(castedSpellId)
if (castedSpellName == spellName) then
spellInfo.casted = castedAmount
break
end
end
end
end
local spellName = GetSpellInfo(spellId)
spellInfo.casted = combatObject:GetSpellCastAmount(unitName, spellName)
if (spellObject) then
spellInfo.total = spellObject.total
spellInfo.count = spellObject.counter
@@ -1701,7 +1671,7 @@ function Details.UnitHealingSpellInfo (unitId, spellId, isLiteral, segment)
spellInfo.criticalHits = spellObject.c_amt
spellInfo.criticalHealing = spellObject.c_total
end
return spellInfo
end
@@ -1759,19 +1729,19 @@ function Details.UnitHealingSpellOnUnit (unitId, spellId, targetUnitId, isLitera
isLiteral = true
end
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return 0
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
if (spellObject) then
local targetName = getUnitName (targetUnitId)
@@ -1820,14 +1790,14 @@ function Details.UnitHealingTaken (unitId, segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return 0
end
return floor(playerObject.healing_taken)
end
@@ -1872,18 +1842,18 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitHealingOnUnit (unitId, targetUnitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return 0
end
local targetName = getUnitName (targetUnitId)
return playerObject.targets [targetName] or 0
end
@@ -1932,16 +1902,16 @@ function Details.UnitHealingTakenFromSpell (unitId, spellId, isLiteral, segment)
if (type(isLiteral) ~= "boolean") then
isLiteral = true
end
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local healingContainer = combatObject:GetContainer (DETAILS_ATTRIBUTE_HEAL)
local totalHealingTaken = 0
if (isLiteral and type(spellId) == "number") then
for i = 1, #healingContainer._ActorTable do
@@ -2005,20 +1975,20 @@ function Details.UnitHealingSpells (unitId, segment)
if (not combatObject) then
return {}
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return {}
end
local unitSpells = playerObject.spells._ActorTable
local resultTable = {}
for spellId, spellObject in pairs(unitSpells) do
resultTable [#resultTable + 1] = spellId
end
return resultTable
end
@@ -2056,23 +2026,23 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitHealingTargets (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local healingTargetNames = {}
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return healingTargetNames
end
for targetName, _ in pairs(playerObject.targets) do
healingTargetNames [#healingTargetNames + 1] = targetName
end
return healingTargetNames
end
@@ -2111,24 +2081,24 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitHealingPets (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local petNames = {}
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return petNames
end
for i = 1, #playerObject.pets do
petNames [#petNames + 1] = playerObject.pets [i]
end
return petNames
end
--stop auto complete: doo ende endp elsez
--stop auto complete: doo ende endp elsez
+74 -76
View File
@@ -283,56 +283,60 @@ do
end
function _detalhes:ReGuessSpec (t)
local Actor, container = t[1], t[2]
local actorObject, container = t[1], t[2]
local SpecSpellList = _detalhes.SpecSpellList
---@type combat
local combatObject = Details:GetCurrentCombat()
--get from the spell cast list
if (_detalhes.tabela_vigente) then
local misc_actor = _detalhes.tabela_vigente(4, Actor.nome)
if (misc_actor and misc_actor.spell_cast) then
for spellid, _ in pairs(misc_actor.spell_cast) do
local spec = SpecSpellList [spellid]
if (spec) then
_detalhes.cached_specs [Actor.serial] = spec
if (combatObject) then
local spellCastTable = combatObject:GetSpellCastTable(actorObject.nome)
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Actor.guessing_spec = nil
for spellName in pairs(spellCastTable) do
local _, _, _, _, _, _, spellid = GetSpellInfo(spellName)
local spec = SpecSpellList[spellid]
if (spec) then
_detalhes.cached_specs[actorObject.serial] = spec
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
actorObject:SetSpecId(spec)
actorObject.classe = _detalhes.SpecIDToClass[spec] or actorObject.classe
actorObject.guessing_spec = nil
if (container) then
container.need_refresh = true
end
Details:SendEvent("UNIT_SPEC", nil, actorObject:GetUnitId(), spec, actorObject.serial)
if (Actor.minha_barra and type(Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
return spec
if (container) then
container.need_refresh = true
end
if (actorObject.minha_barra and type(actorObject.minha_barra) == "table") then
actorObject.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
return spec
end
end
else
if (Actor.spells) then
for spellid, _ in pairs(Actor.spells._ActorTable) do
if (actorObject.spells) then
for spellid, _ in pairs(actorObject.spells._ActorTable) do
local spec = SpecSpellList [spellid]
if (spec) then
if (spec ~= Actor.spec) then
_detalhes.cached_specs [Actor.serial] = spec
if (spec ~= actorObject.spec) then
_detalhes.cached_specs [actorObject.serial] = spec
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
actorObject:SetSpecId(spec)
actorObject.classe = _detalhes.SpecIDToClass [spec] or actorObject.classe
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
Details:SendEvent("UNIT_SPEC", nil, actorObject:GetUnitId(), spec, actorObject.serial)
if (container) then
container.need_refresh = true
end
if (Actor.minha_barra and type(Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
if (actorObject.minha_barra and type(actorObject.minha_barra) == "table") then
actorObject.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
@@ -343,9 +347,9 @@ do
end
end
if (Actor.classe == "HUNTER") then
if (actorObject.classe == "HUNTER") then
local container_misc = _detalhes.tabela_vigente[4]
local index = container_misc._NameIndexTable [Actor.nome]
local index = container_misc._NameIndexTable [actorObject.nome]
if (index) then
local misc_actor = container_misc._ActorTable [index]
local buffs = misc_actor.buff_uptime_spells and misc_actor.buff_uptime_spells._ActorTable
@@ -353,20 +357,20 @@ do
for spellid, spell in pairs(buffs) do
local spec = SpecSpellList [spellid]
if (spec) then
if (spec ~= Actor.spec) then
_detalhes.cached_specs [Actor.serial] = spec
if (spec ~= actorObject.spec) then
_detalhes.cached_specs [actorObject.serial] = spec
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
actorObject:SetSpecId(spec)
actorObject.classe = _detalhes.SpecIDToClass [spec] or actorObject.classe
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
Details:SendEvent("UNIT_SPEC", nil, actorObject:GetUnitId(), spec, actorObject.serial)
if (container) then
container.need_refresh = true
end
if (Actor.minha_barra and type(Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
if (actorObject.minha_barra and type(actorObject.minha_barra) == "table") then
actorObject.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
@@ -384,18 +388,13 @@ do
end
end
function _detalhes:GuessSpec (t)
function _detalhes:GuessSpec(t)
local Actor, container, tries = t[1], t[2], t[3]
if (not Actor) then
return false
end
local SpecSpellList = _detalhes.SpecSpellList
--local misc_actor = info.instancia.showing (4, self:name())
--spell_cast
--get from the spec cache
local spec = _detalhes.cached_specs [Actor.serial]
if (spec) then
@@ -418,21 +417,46 @@ do
--get from the spell cast list
if (_detalhes.tabela_vigente) then
local misc_actor = _detalhes.tabela_vigente(4, Actor.nome)
local spellCastTable = _detalhes.tabela_vigente:GetSpellCastTable(Actor.nome)
if (misc_actor and misc_actor.spell_cast) then
for spellid, _ in pairs(misc_actor.spell_cast) do
for spellName, _ in pairs(spellCastTable) do
local _, _, _, _, _, _, spellid = GetSpellInfo(spellName)
local spec = SpecSpellList[spellid]
if (spec) then
_detalhes.cached_specs [Actor.serial] = spec
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
Actor.guessing_spec = nil
if (container) then
container.need_refresh = true
end
if (Actor.minha_barra and type(Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
return spec
end
end
if (Actor.spells) then --correcao pros containers misc, precisa pegar os diferentes tipos de containers de l
for spellid, _ in pairs(Actor.spells._ActorTable) do
local spec = SpecSpellList [spellid]
if (spec) then
_detalhes.cached_specs [Actor.serial] = spec
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Actor.guessing_spec = nil
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
Actor.guessing_spec = nil
if (container) then
container.need_refresh = true
end
@@ -445,32 +469,6 @@ do
return spec
end
end
else
if (Actor.spells) then --correcao pros containers misc, precisa pegar os diferentes tipos de containers de l
for spellid, _ in pairs(Actor.spells._ActorTable) do
local spec = SpecSpellList [spellid]
if (spec) then
_detalhes.cached_specs [Actor.serial] = spec
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Actor.guessing_spec = nil
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
if (container) then
container.need_refresh = true
end
if (Actor.minha_barra and type(Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
return spec
end
end
end
end
else
+25 -21
View File
@@ -4113,40 +4113,44 @@ local SplitLoadFunc = function(self, deltaTime)
if (actorToIndex [containerName]) then
local spellList = actorToIndex [containerName]._ActorTable
if (spellList) then
local SpellPool = Details.spell_pool
local EncounterSpellPool = Details.encounter_spell_pool
local spellPool = Details.spell_pool
local encounterSpellPool = Details.encounter_spell_pool
for spellID, _ in pairs(spellList) do
if (not SpellPool [spellID]) then
SpellPool [spellID] = source
for spellId, _ in pairs(spellList) do
if (not spellPool[spellId]) then
spellPool[spellId] = source
end
if (encounterID and not EncounterSpellPool [spellID]) then
if (encounterID and not encounterSpellPool[spellId]) then
if (actorToIndex:IsEnemy()) then
EncounterSpellPool [spellID] = {encounterID, source}
encounterSpellPool[spellId] = {encounterID, source}
end
end
end
end
end
end
--[=[ .spell_cast is deprecated
--spells the actor casted
if (actorToIndex.spell_cast) then
local SpellPool = Details.spell_pool
local EncounterSpellPool = Details.encounter_spell_pool
for spellID, _ in pairs(actorToIndex.spell_cast) do
if (not SpellPool [spellID]) then
SpellPool [spellID] = source
end
if (encounterID and not EncounterSpellPool [spellID]) then
if (actorToIndex:IsEnemy()) then
EncounterSpellPool [spellID] = {encounterID, source}
end
end
local spellPool = Details.spell_pool
local encounterSpellPool = Details.encounter_spell_pool
for spellName, _ in pairs(actorToIndex.spell_cast) do
local _, _, _, _, _, _, spellId = GetSpellInfo(spellName)
if (spellId) then
if (not spellPool[spellId]) then
spellPool[spellId] = source
end
if (encounterID and not encounterSpellPool[spellId]) then
if (actorToIndex:IsEnemy()) then
encounterSpellPool[spellId] = {encounterID, source}
end
end
end
end
end
--]=]
end
end
end