translated code to English and a few bug fixes from latest alpha

This commit is contained in:
Tercio Jose
2023-06-21 17:27:58 -03:00
parent a2c5e926c9
commit 9fb2b0d66b
36 changed files with 3523 additions and 2679 deletions
+1617 -1615
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -401,7 +401,8 @@ function _detalhes:TrackSpecsNow (track_everything)
end
else
local combatlist = {}
for _, combat in ipairs(_detalhes.tabela_historico.tabelas) do
local segmentsTable = Details:GetCombatSegments()
for _, combat in ipairs(segmentsTable) do
tinsert(combatlist, combat)
end
tinsert(combatlist, _detalhes.tabela_vigente)
+65 -42
View File
@@ -98,10 +98,10 @@ local classTypeUtility = Details.atributos.misc
local overallCombatObject = Details.tabela_overall
---@type combat[]
local allSegments = Details.tabela_historico.tabelas
local segmentsTable = Details:GetCombatSegments()
--retore the call "combat()" functionality
for _, combatObject in ipairs(allSegments) do
for _, combatObject in ipairs(segmentsTable) do
combatObject.__call = Details.call_combate
end
@@ -118,8 +118,8 @@ local classTypeUtility = Details.atributos.misc
local bIsInInstance = IsInInstance()
--inicia a recuperao das tabelas e montagem do overall
if (#allSegments > 0) then
for index, thisCombatObject in ipairs(allSegments) do
if (#segmentsTable > 0) then
for index, thisCombatObject in ipairs(segmentsTable) do
---@cast thisCombatObject combat
--set the metatable, __call and __index
@@ -338,14 +338,15 @@ local classTypeUtility = Details.atributos.misc
---remove all .owner references from actors, this unlink pets from owners but still leave the actor.ownerName member to rebuild later
function Details:RemoveOwnerFromPets()
---@type combat[]
local combatTables = Details.tabela_historico.tabelas or {}
local segmentsTable = Details:GetCombatSegments() or {}
local bOverallAdded
if (not Details.overall_clear_logout) then
table.insert(combatTables, Details.tabela_overall)
table.insert(segmentsTable, Details.tabela_overall)
bOverallAdded = true
end
for _, combatObject in ipairs(combatTables) do
for _, combatObject in ipairs(segmentsTable) do
---@cast combatObject combat
for _, actorContainer in ipairs(combatObject) do
---@cast actorContainer actorcontainer
@@ -357,22 +358,22 @@ local classTypeUtility = Details.atributos.misc
end
if (bOverallAdded) then
table.remove(combatTables, #combatTables)
table.remove(segmentsTable, #segmentsTable)
end
end
function Details:DoClassesCleanup()
---@type combat[]
local combatTables = Details.tabela_historico.tabelas or {}
local segmentsTable = Details:GetCombatSegments() or {}
local bOverallAdded = false
if (not Details.overall_clear_logout) then
--add the overall segment to the cleanup within the other segments
--it is removed after the cleanup
table.insert(combatTables, Details.tabela_overall)
table.insert(segmentsTable, Details.tabela_overall)
bOverallAdded = true
end
for index, combatObject in ipairs(combatTables) do
for index, combatObject in ipairs(segmentsTable) do
---@cast combatObject combat
for classType, actorContainer in ipairs(combatObject) do
---@cast actorContainer actorcontainer
@@ -400,20 +401,20 @@ local classTypeUtility = Details.atributos.misc
if (bOverallAdded) then
--remove the overall segment from the regular segments
table.remove(combatTables, #combatTables)
table.remove(segmentsTable, #segmentsTable)
end
end
function Details:DoContainerCleanup()
---@type combat[]
local combatTables = Details.tabela_historico.tabelas or {}
local segmentsTable = Details:GetCombatSegments() or {}
local bOverallAdded
if (not Details.overall_clear_logout) then
table.insert(combatTables, Details.tabela_overall)
table.insert(segmentsTable, Details.tabela_overall)
bOverallAdded = true
end
for _, combatObject in ipairs(combatTables) do
for _, combatObject in ipairs(segmentsTable) do
---@cast combatObject combat
Details.clear:c_combate(combatObject)
for _, actorContainer in ipairs(combatObject) do
@@ -423,27 +424,27 @@ local classTypeUtility = Details.atributos.misc
end
if (bOverallAdded) then
table.remove(combatTables, #combatTables)
table.remove(segmentsTable, #segmentsTable)
end
end
function Details:DoContainerIndexCleanup()
---@type combat[]
local allSegments = Details.tabela_historico.tabelas or {}
local segmentsTable = Details:GetCombatSegments() or {}
local bOverallAdded
if (not Details.overall_clear_logout) then
table.insert(allSegments, Details.tabela_overall)
table.insert(segmentsTable, Details.tabela_overall)
bOverallAdded = true
end
for _, combatObject in ipairs(allSegments) do
for _, combatObject in ipairs(segmentsTable) do
for _, actorContainer in ipairs(combatObject) do
Details.clear:c_container_combatentes_index(actorContainer)
end
end
if (bOverallAdded) then
table.remove(allSegments, #allSegments)
table.remove(segmentsTable, #segmentsTable)
end
end
@@ -460,26 +461,32 @@ local classTypeUtility = Details.atributos.misc
---@type combat[]
local combatTables = {}
---@type combat[]
local allSegments = Details.tabela_historico.tabelas or {}
local segmentsTable = Details:GetCombatSegments() or {}
--remove segments marked as 'trash'
for i = #allSegments, 1, -1 do
for i = #segmentsTable, 1, -1 do
---@type combat
local combatObject = allSegments[i]
if (combatObject:IsTrash()) then --error, IsTrash is not a function, probably because the combat got destroyed
table.remove(allSegments, i)
Details:DestroyCombat(combatObject) --no need to send DETAILS_DATA_SEGMENTREMOVED due to this be in the logout process
local combatObject = segmentsTable[i]
if (combatObject.__destroyed) then
table.remove(segmentsTable, i)
end
end
--remove segments marked as 'trash'
for i = #segmentsTable, 1, -1 do
---@type combat
local combatObject = segmentsTable[i]
if (combatObject:IsTrash()) then
table.remove(segmentsTable, i)
end
end
segmentsTable = Details:GetCombatSegments() or {}
--remove segments > of the segment limit to save
if (Details.segments_amount_to_save and Details.segments_amount_to_save < Details.segments_amount) then
for i = Details.segments_amount, Details.segments_amount_to_save + 1, -1 do
if (Details.tabela_historico.tabelas[i]) then
---@type combat
local combatObject = Details.tabela_historico.tabelas[i]
table.remove(Details.tabela_historico.tabelas, i)
Details:DestroyCombat(combatObject)
if (segmentsTable[i]) then
table.remove(segmentsTable, i)
end
end
end
@@ -488,7 +495,6 @@ local classTypeUtility = Details.atributos.misc
if (Details.overall_clear_logout) then
Details.tabela_overall = nil
_detalhes_database.tabela_overall = nil
Details:DestroyCombat(Details.tabela_overall)
else
---@type combat
local overallCombatObject = Details.tabela_overall
@@ -538,7 +544,7 @@ local classTypeUtility = Details.atributos.misc
end
end
for i, combatObject in ipairs(allSegments) do
for i, combatObject in ipairs(segmentsTable) do
---@cast combatObject combat
combatTables[#combatTables+1] = combatObject
end
@@ -805,21 +811,38 @@ local classTypeUtility = Details.atributos.misc
---@type number
local amountRemoved = 0
--create a list of all combats except the current one
---@type table<number, combat>
local allSegments = Details:GetCombatSegments()
---@type table
local segmentsList = {}
---@type combat
local currentCombat = Details:GetCurrentCombat()
for _, combatObject in ipairs(allSegments) do
--create a list of all combats except the current one
---@type table<number, combat>
local segmentsTable = Details:GetCombatSegments()
--collect destroyed combat objects
local bGotSegmentsRemoved = false
for i = #segmentsTable, 1, -1 do
local combatObject = segmentsTable[i]
if (combatObject ~= currentCombat) then
if (combatObject.__destroyed) then
table.remove(segmentsTable, i)
bGotSegmentsRemoved = true
end
end
end
if (bGotSegmentsRemoved) then
Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
end
---@type table
local segmentsList = {}
--add all segments except the current one
for _, combatObject in ipairs(segmentsTable) do
if (combatObject ~= currentCombat) then
segmentsList[#segmentsList+1] = combatObject
end
end
--add the current segment at the end of the list
segmentsList[#segmentsList+1] = currentCombat
+37 -23
View File
@@ -1062,10 +1062,10 @@
--~activity time
if (not sourceActor.dps_started) then
--register on time machine
sourceActor:Iniciar(true)
sourceActor:GetOrChangeActivityStatus(true)
if (ownerActor and not ownerActor.dps_started) then
ownerActor:Iniciar(true)
ownerActor:GetOrChangeActivityStatus(true)
if (ownerActor.end_time) then
ownerActor.end_time = nil
else
@@ -1983,7 +1983,7 @@
local jogador_alvo, alvo_dono = healing_cache [alvo_serial]
if (not jogador_alvo) then
jogador_alvo, alvo_dono, alvo_name = _current_heal_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true)
if (not alvo_dono and alvo_flags and also_serial ~= "") then
if (not alvo_dono and alvo_flags and alvo_serial ~= "") then
healing_cache [alvo_serial] = jogador_alvo
end
end
@@ -2261,10 +2261,10 @@
------------------------------------------------------------------------------------------------
--~activity time
if (not sourceActor.iniciar_hps) then
sourceActor:Iniciar (true) --inicia o hps do jogador
sourceActor:GetOrChangeActivityStatus (true) --inicia o hps do jogador
if (ownerActor and not ownerActor.iniciar_hps) then
ownerActor:Iniciar (true)
ownerActor:GetOrChangeActivityStatus (true)
if (ownerActor.end_time) then
ownerActor.end_time = nil
else
@@ -4898,7 +4898,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--end
end
Details:DispatchAutoRunCode("on_zonechanged")
Details222.AutoRunCode.DispatchAutoRunCode("on_zonechanged")
Details:SchedulePetUpdate(7)
Details:CheckForPerformanceProfile()
end
@@ -5183,7 +5183,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
end
Details:DispatchAutoRunCode("on_entercombat")
Details222.AutoRunCode.DispatchAutoRunCode("on_entercombat")
Details.tabela_vigente.CombatStartedAt = GetTime()
end
@@ -5284,7 +5284,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if (not OnRegenEnabled) then
Details:Destroy(bitfield_swap_cache)
Details:Destroy(empower_cache)
Details:DispatchAutoRunCode("on_leavecombat")
Details222.AutoRunCode.DispatchAutoRunCode("on_leavecombat")
end
if (Details.solo and Details.PluginCount.SOLO > 0) then --code too old and I don't have documentation for it
@@ -5596,7 +5596,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details:CheckVersion()
Details:SendEvent("GROUP_ONENTER")
Details:DispatchAutoRunCode("on_groupchange")
Details222.AutoRunCode.DispatchAutoRunCode("on_groupchange")
Details:Destroy(Details.trusted_characters)
C_Timer.After(5, Details.ScheduleSyncPlayerActorData)
@@ -5614,7 +5614,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details:InstanceCall(Details.AdjustAlphaByContext)
Details:CheckSwitchOnLogon()
Details:SendEvent("GROUP_ONLEAVE")
Details:DispatchAutoRunCode("on_groupchange")
Details222.AutoRunCode.DispatchAutoRunCode("on_groupchange")
Details:Destroy(Details.trusted_characters)
else
--player is still in a group
@@ -5670,7 +5670,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
function Details:CreateBattlegroundSegment()
if (_in_combat) then
Details.tabela_vigente.discard_segment = true
Details222.discardSegment = true
Details:EndCombat()
end
@@ -5693,6 +5693,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return
end
Details222.AutoRunCode.Code = {}
Details.popup = _G.GameCooltip
Details.in_group = IsInGroup() or IsInRaid()
Details.temp_table1 = {}
@@ -5731,7 +5733,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details:UpdateParserGears()
--load auto run code
Details:StartAutoRun()
Details222.AutoRunCode.StartAutoRun()
Details.isLoaded = true
end
@@ -5856,6 +5858,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
---@type string current step of the logout process, used to log which is the current step when an error happens
local currentStep = ""
Details222.AutoRunCode.OnLogout()
--save the time played on this class, run protected
local savePlayTimeClass, savePlayTimeErrorText = pcall(function() Details.SavePlayTimeOnClass() end)
@@ -6037,6 +6041,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return damage_cache[value] or damage_cache_pets[value] or damage_cache_petsOwners[value]
end
---return tables containing the cache of actors
---@return table damageCache, table damageCachePets, table damageCachePetOwners, table healingCache
function Details222.Cache.GetParserCacheTables()
return damage_cache, damage_cache_pets, damage_cache_petsOwners, healing_cache
end
function Details:PrintParserCacheIndexes()
local amount = 0
for n, nn in pairs(damage_cache) do
@@ -6455,9 +6465,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
--get an actor
function Details:GetActor(combat, attribute, actorName)
if (not combat) then
combat = "current" --current combat
function Details:GetActor(combatId, attribute, actorName)
if (not combatId) then
combatId = "current" --current combat
end
if (not attribute) then
@@ -6468,7 +6478,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
actorName = Details.playername
end
if (combat == 0 or combat == "current") then
if (combatId == 0 or combatId == "current") then
local actor = Details.tabela_vigente(attribute, actorName)
if (actor) then
return actor
@@ -6476,7 +6486,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return nil
end
elseif (combat == -1 or combat == "overall") then
elseif (combatId == -1 or combatId == "overall") then
local actor = Details.tabela_overall(attribute, actorName)
if (actor) then
return actor
@@ -6484,12 +6494,16 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return nil
end
elseif (type(combat) == "number") then
local combatTables = Details.tabela_historico.tabelas[combat]
if (combatTables) then
local actor = combatTables(attribute, actorName)
if (actor) then
return actor
elseif (type(combatId) == "number") then
local segmentsTable = Details:GetCombatSegments()
---@type combat
local combatObject = segmentsTable[combatId]
if (combatObject) then
---@type actor
local actorObject = combatObject(attribute, actorName)
if (actorObject) then
return actorObject
else
return nil
end