Added: Details:DoesCombatWithUIDExists(uniqueCombatId); Details:GetCombatByUID(uniqueCombatId); combat:GetCombatUID()

This commit is contained in:
Tercio Jose
2023-07-04 18:46:22 -03:00
parent 9cf94ead8c
commit f3c49ec02e
2 changed files with 37 additions and 0 deletions
+30
View File
@@ -57,6 +57,36 @@ function Details:GetCombat(combat)
return nil
end
---get a unique combat id and check if exists a combat with this id
---@param uniqueCombatId number
---@return boolean bExistsCombat
function Details:DoesCombatWithUIDExists(uniqueCombatId)
local segmentsTable = Details:GetCombatSegments()
for segmentId, combatObject in ipairs(segmentsTable) do
if (combatObject.combat_counter == uniqueCombatId) then
return true
end
end
return false
end
---get a unique combat id and return the combat object
---@param uniqueCombatId number
---@return combat|boolean combatObject
function Details:GetCombatByUID(uniqueCombatId)
local segmentsTable = Details:GetCombatSegments()
for segmentId, combatObject in ipairs(segmentsTable) do
if (combatObject.combat_counter == uniqueCombatId) then
return combatObject
end
end
return false
end
---remove a segment from the segments table
---@param segmentIndex number
---@return boolean, combat