Added: Details:DoesCombatWithUIDExists(uniqueCombatId); Details:GetCombatByUID(uniqueCombatId); combat:GetCombatUID()
This commit is contained in:
@@ -76,6 +76,13 @@
|
||||
end
|
||||
classCombat.__call = Details.call_combate
|
||||
|
||||
---get the unique combat identifier
|
||||
---@param self combat
|
||||
---@return number
|
||||
function classCombat:GetCombatUID()
|
||||
return self.combat_counter
|
||||
end
|
||||
|
||||
--get the start date and end date
|
||||
function classCombat:GetDate()
|
||||
return self.data_inicio, self.data_fim
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user