mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Update Scoring.lua (#1674)
Code formatting and minor typo/documentation fixes.
This commit is contained in:
parent
00d1aec210
commit
d6cfaa5050
@ -67,7 +67,7 @@
|
|||||||
--
|
--
|
||||||
-- * Upload scoring to a database or a BI tool to publish the scoring results to the player community.
|
-- * Upload scoring to a database or a BI tool to publish the scoring results to the player community.
|
||||||
-- * Upload scoring in an (online) Excel like tool, using pivot tables and pivot charts to show mission results.
|
-- * Upload scoring in an (online) Excel like tool, using pivot tables and pivot charts to show mission results.
|
||||||
-- * Share scoring amoung players after the mission to discuss mission results.
|
-- * Share scoring among players after the mission to discuss mission results.
|
||||||
--
|
--
|
||||||
-- Scores can be **reported**. **Menu options** are automatically added to **each player group** when a player joins a client slot or a CA unit.
|
-- Scores can be **reported**. **Menu options** are automatically added to **each player group** when a player joins a client slot or a CA unit.
|
||||||
-- Use the radio menu F10 to consult the scores while running the mission.
|
-- Use the radio menu F10 to consult the scores while running the mission.
|
||||||
@ -88,7 +88,6 @@
|
|||||||
-- @module Functional.Scoring
|
-- @module Functional.Scoring
|
||||||
-- @image Scoring.JPG
|
-- @image Scoring.JPG
|
||||||
|
|
||||||
|
|
||||||
--- @type SCORING
|
--- @type SCORING
|
||||||
-- @field Players A collection of the current players that have joined the game.
|
-- @field Players A collection of the current players that have joined the game.
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
@ -99,7 +98,6 @@
|
|||||||
--
|
--
|
||||||
-- local Scoring = SCORING:New( "Scoring File" )
|
-- local Scoring = SCORING:New( "Scoring File" )
|
||||||
--
|
--
|
||||||
--
|
|
||||||
-- # Set the destroy score or penalty scale:
|
-- # Set the destroy score or penalty scale:
|
||||||
--
|
--
|
||||||
-- Score scales can be set for scores granted when enemies or friendlies are destroyed.
|
-- Score scales can be set for scores granted when enemies or friendlies are destroyed.
|
||||||
@ -147,11 +145,11 @@
|
|||||||
--
|
--
|
||||||
-- # (Decommissioned) Configure fratricide level.
|
-- # (Decommissioned) Configure fratricide level.
|
||||||
--
|
--
|
||||||
-- **This functionality is decomissioned until the DCS bug concerning Unit:destroy() not being functional in multi player for player units has been fixed by ED**.
|
-- **This functionality is decommissioned until the DCS bug concerning Unit:destroy() not being functional in multi player for player units has been fixed by ED**.
|
||||||
--
|
--
|
||||||
-- When a player commits too much damage to friendlies, his penalty score will reach a certain level.
|
-- When a player commits too much damage to friendlies, his penalty score will reach a certain level.
|
||||||
-- Use the method @{#SCORING.SetFratricide}() to define the level when a player gets kicked.
|
-- Use the method @{#SCORING.SetFratricide}() to define the level when a player gets kicked.
|
||||||
-- By default, the fratricide level is the default penalty mutiplier * 2 for the penalty score.
|
-- By default, the fratricide level is the default penalty multiplier * 2 for the penalty score.
|
||||||
--
|
--
|
||||||
-- # Penalty score when a player changes the coalition.
|
-- # Penalty score when a player changes the coalition.
|
||||||
--
|
--
|
||||||
@ -190,8 +188,8 @@
|
|||||||
--
|
--
|
||||||
-- --Sanitize Mission Scripting environment
|
-- --Sanitize Mission Scripting environment
|
||||||
-- --This makes unavailable some unsecure functions.
|
-- --This makes unavailable some unsecure functions.
|
||||||
-- --Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions.
|
-- --Mission downloaded from server to client may contain potentially harmful lua code that may use these functions.
|
||||||
-- --You can remove the code below and make availble these functions at your own risk.
|
-- --You can remove the code below and make available these functions at your own risk.
|
||||||
--
|
--
|
||||||
-- The MOOSE designer cannot take any responsibility of any damage inflicted as a result of the de-sanitization.
|
-- The MOOSE designer cannot take any responsibility of any damage inflicted as a result of the de-sanitization.
|
||||||
-- That being said, I hope that the SCORING class provides you with a great add-on to score your squad mates achievements.
|
-- That being said, I hope that the SCORING class provides you with a great add-on to score your squad mates achievements.
|
||||||
@ -229,20 +227,18 @@ SCORING = {
|
|||||||
Players = {},
|
Players = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
local _SCORINGCoalition =
|
local _SCORINGCoalition = {
|
||||||
{
|
|
||||||
[1] = "Red",
|
[1] = "Red",
|
||||||
[2] = "Blue",
|
[2] = "Blue",
|
||||||
}
|
}
|
||||||
|
|
||||||
local _SCORINGCategory =
|
local _SCORINGCategory = {
|
||||||
{
|
|
||||||
[Unit.Category.AIRPLANE] = "Plane",
|
[Unit.Category.AIRPLANE] = "Plane",
|
||||||
[Unit.Category.HELICOPTER] = "Helicopter",
|
[Unit.Category.HELICOPTER] = "Helicopter",
|
||||||
[Unit.Category.GROUND_UNIT] = "Vehicle",
|
[Unit.Category.GROUND_UNIT] = "Vehicle",
|
||||||
[Unit.Category.SHIP] = "Ship",
|
[Unit.Category.SHIP] = "Ship",
|
||||||
[Unit.Category.STRUCTURE] = "Structure",
|
[Unit.Category.STRUCTURE] = "Structure",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates a new SCORING object to administer the scoring achieved by players.
|
--- Creates a new SCORING object to administer the scoring achieved by players.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
@ -264,7 +260,6 @@ function SCORING:New( GameName )
|
|||||||
error( "A game name must be given to register the scoring results" )
|
error( "A game name must be given to register the scoring results" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Additional Object scores
|
-- Additional Object scores
|
||||||
self.ScoringObjects = {}
|
self.ScoringObjects = {}
|
||||||
|
|
||||||
@ -297,21 +292,18 @@ function SCORING:New( GameName )
|
|||||||
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
||||||
self:HandleEvent( EVENTS.Hit, self._EventOnHit )
|
self:HandleEvent( EVENTS.Hit, self._EventOnHit )
|
||||||
self:HandleEvent( EVENTS.Birth )
|
self:HandleEvent( EVENTS.Birth )
|
||||||
--self:HandleEvent( EVENTS.PlayerEnterUnit )
|
-- self:HandleEvent( EVENTS.PlayerEnterUnit )
|
||||||
self:HandleEvent( EVENTS.PlayerLeaveUnit )
|
self:HandleEvent( EVENTS.PlayerLeaveUnit )
|
||||||
|
|
||||||
-- During mission startup, especially for single player,
|
-- During mission startup, especially for single player,
|
||||||
-- iterate the database for the player that has joined, and add him to the scoring, and set the menu.
|
-- iterate the database for the player that has joined, and add him to the scoring, and set the menu.
|
||||||
-- But this can only be started one second after the mission has started, so i need to schedule this ...
|
-- But this can only be started one second after the mission has started, so i need to schedule this ...
|
||||||
self.ScoringPlayerScan = BASE:ScheduleOnce( 1,
|
self.ScoringPlayerScan = BASE:ScheduleOnce( 1, function()
|
||||||
function()
|
|
||||||
for PlayerName, PlayerUnit in pairs( _DATABASE:GetPlayerUnits() ) do
|
for PlayerName, PlayerUnit in pairs( _DATABASE:GetPlayerUnits() ) do
|
||||||
self:_AddPlayerFromUnit( PlayerUnit )
|
self:_AddPlayerFromUnit( PlayerUnit )
|
||||||
self:SetScoringMenu( PlayerUnit:GetGroup() )
|
self:SetScoringMenu( PlayerUnit:GetGroup() )
|
||||||
end
|
end
|
||||||
end
|
end )
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
-- Create the CSV file.
|
-- Create the CSV file.
|
||||||
self:OpenCSV( GameName )
|
self:OpenCSV( GameName )
|
||||||
@ -329,7 +321,6 @@ function SCORING:SetDisplayMessagePrefix( DisplayMessagePrefix )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set the scale for scoring valid destroys (enemy destroys).
|
--- Set the scale for scoring valid destroys (enemy destroys).
|
||||||
-- A default calculated score is a value between 1 and 10.
|
-- A default calculated score is a value between 1 and 10.
|
||||||
-- The scale magnifies the scores given to the players.
|
-- The scale magnifies the scores given to the players.
|
||||||
@ -411,7 +402,6 @@ function SCORING:RemoveStaticScore( ScoreStatic )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Specify a special additional score for a @{Wrapper.Group}.
|
--- Specify a special additional score for a @{Wrapper.Group}.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param Wrapper.Group#GROUP ScoreGroup The @{Wrapper.Group} for which each @{Wrapper.Unit} a Score is given.
|
-- @param Wrapper.Group#GROUP ScoreGroup The @{Wrapper.Group} for which each @{Wrapper.Unit} a Score is given.
|
||||||
@ -464,7 +454,6 @@ function SCORING:RemoveZoneScore( ScoreZone )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Configure to send messages after a target has been hit.
|
--- Configure to send messages after a target has been hit.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param #boolean OnOff If true is given, the messages are sent.
|
-- @param #boolean OnOff If true is given, the messages are sent.
|
||||||
@ -571,10 +560,9 @@ function SCORING:IfMessagesToCoalition()
|
|||||||
return self.MessagesAudience == 2
|
return self.MessagesAudience == 2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- When a player commits too much damage to friendlies, his penalty score will reach a certain level.
|
--- When a player commits too much damage to friendlies, his penalty score will reach a certain level.
|
||||||
-- Use this method to define the level when a player gets kicked.
|
-- Use this method to define the level when a player gets kicked.
|
||||||
-- By default, the fratricide level is the default penalty mutiplier * 2 for the penalty score.
|
-- By default, the fratricide level is the default penalty multiplier * 2 for the penalty score.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param #number Fratricide The amount of maximum penalty that may be inflicted by a friendly player before he gets kicked.
|
-- @param #number Fratricide The amount of maximum penalty that may be inflicted by a friendly player before he gets kicked.
|
||||||
-- @return #SCORING
|
-- @return #SCORING
|
||||||
@ -614,7 +602,6 @@ function SCORING:SetCoalitionChangePenalty( CoalitionChangePenalty )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Sets the scoring menu.
|
--- Sets the scoring menu.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @return #SCORING
|
-- @return #SCORING
|
||||||
@ -627,7 +614,6 @@ function SCORING:SetScoringMenu( ScoringGroup )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Add a new player entering a Unit.
|
--- Add a new player entering a Unit.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param Wrapper.Unit#UNIT UnitData
|
-- @param Wrapper.Unit#UNIT UnitData
|
||||||
@ -670,12 +656,11 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
|||||||
if self.Players[PlayerName].UnitCoalition ~= UnitCoalition and self.penaltyoncoalitionchange then
|
if self.Players[PlayerName].UnitCoalition ~= UnitCoalition and self.penaltyoncoalitionchange then
|
||||||
self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + self.CoalitionChangePenalty or 50
|
self.Players[PlayerName].Penalty = self.Players[PlayerName].Penalty + self.CoalitionChangePenalty or 50
|
||||||
self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1
|
self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' changed coalition from " .. _SCORINGCoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. _SCORINGCoalition[UnitCoalition] ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' changed coalition from " .. _SCORINGCoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. _SCORINGCoalition[UnitCoalition] .. "(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). " ..
|
||||||
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). ".. self.CoalitionChangePenalty .."Penalty points added.",
|
self.CoalitionChangePenalty .. "Penalty points added.",
|
||||||
MESSAGE.Type.Information
|
MESSAGE.Type.Information )
|
||||||
):ToAll()
|
:ToAll()
|
||||||
self:ScoreCSV( PlayerName, "", "COALITION_PENALTY", 1, -1*self.CoalitionChangePenalty, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
|
self:ScoreCSV( PlayerName, "", "COALITION_PENALTY", 1, -1 * self.CoalitionChangePenalty, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType, UnitName, _SCORINGCoalition[UnitCoalition], _SCORINGCategory[UnitCategory], UnitData:GetTypeName() )
|
||||||
UnitName, _SCORINGCoalition[UnitCoalition], _SCORINGCategory[UnitCategory], UnitData:GetTypeName() )
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -691,22 +676,21 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
|||||||
if self.Players[PlayerName].Penalty > self.Fratricide * 0.50 and self.penaltyonfratricide then
|
if self.Players[PlayerName].Penalty > self.Fratricide * 0.50 and self.penaltyonfratricide then
|
||||||
if self.Players[PlayerName].PenaltyWarning < 1 then
|
if self.Players[PlayerName].PenaltyWarning < 1 then
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than " .. self.Fratricide .. ", you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than " .. self.Fratricide .. ", you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
|
||||||
MESSAGE.Type.Information
|
MESSAGE.Type.Information )
|
||||||
):ToAll()
|
:ToAll()
|
||||||
self.Players[PlayerName].PenaltyWarning = self.Players[PlayerName].PenaltyWarning + 1
|
self.Players[PlayerName].PenaltyWarning = self.Players[PlayerName].PenaltyWarning + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Players[PlayerName].Penalty > self.Fratricide and self.penaltyonfratricide then
|
if self.Players[PlayerName].Penalty > self.Fratricide and self.penaltyonfratricide then
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' committed FRATRICIDE, he will be COURT MARTIALED and is DISMISSED from this mission!",
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' committed FRATRICIDE, he will be COURT MARTIALED and is DISMISSED from this mission!",
|
||||||
MESSAGE.Type.Information
|
MESSAGE.Type.Information )
|
||||||
):ToAll()
|
:ToAll()
|
||||||
UnitData:GetGroup():Destroy()
|
UnitData:GetGroup():Destroy()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Add a goal score for a player.
|
--- Add a goal score for a player.
|
||||||
-- The method takes the Player name for which the Goal score needs to be set.
|
-- The method takes the Player name for which the Goal score needs to be set.
|
||||||
-- The GoalTag is a string or identifier that is taken into the CSV file scoring log to identify the goal.
|
-- The GoalTag is a string or identifier that is taken into the CSV file scoring log to identify the goal.
|
||||||
@ -729,14 +713,14 @@ function SCORING:AddGoalScorePlayer( PlayerName, GoalTag, Text, Score )
|
|||||||
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
||||||
PlayerData.Score = PlayerData.Score + Score
|
PlayerData.Score = PlayerData.Score + Score
|
||||||
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. Text, MESSAGE.Type.Information ):ToAll()
|
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
|
||||||
|
MESSAGE.Type.Information )
|
||||||
|
:ToAll()
|
||||||
|
|
||||||
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, nil )
|
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, nil )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Add a goal score for a player.
|
--- Add a goal score for a player.
|
||||||
-- The method takes the PlayerUnit for which the Goal score needs to be set.
|
-- The method takes the PlayerUnit for which the Goal score needs to be set.
|
||||||
-- The GoalTag is a string or identifier that is taken into the CSV file scoring log to identify the goal.
|
-- The GoalTag is a string or identifier that is taken into the CSV file scoring log to identify the goal.
|
||||||
@ -761,13 +745,14 @@ function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
|
|||||||
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
||||||
PlayerData.Score = PlayerData.Score + Score
|
PlayerData.Score = PlayerData.Score + Score
|
||||||
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. Text, MESSAGE.Type.Information ):ToAll()
|
MESSAGE:NewType( self.DisplayMessagePrefix .. Text,
|
||||||
|
MESSAGE.Type.Information )
|
||||||
|
:ToAll()
|
||||||
|
|
||||||
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
|
self:ScoreCSV( PlayerName, "", "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Registers Scores the players completing a Mission Task.
|
--- Registers Scores the players completing a Mission Task.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param Tasking.Mission#MISSION Mission
|
-- @param Tasking.Mission#MISSION Mission
|
||||||
@ -797,7 +782,9 @@ function SCORING:_AddMissionTaskScore( Mission, PlayerUnit, Text, Score )
|
|||||||
PlayerData.Score = self.Players[PlayerName].Score + Score
|
PlayerData.Score = self.Players[PlayerName].Score + Score
|
||||||
PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
|
PlayerData.Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
|
||||||
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. Mission:GetText() .. " : " .. Text .. " Score: " .. Score, MESSAGE.Type.Information ):ToAll()
|
MESSAGE:NewType( self.DisplayMessagePrefix .. Mission:GetText() .. " : " .. Text .. " Score: " .. Score,
|
||||||
|
MESSAGE.Type.Information )
|
||||||
|
:ToAll()
|
||||||
|
|
||||||
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() )
|
self:ScoreCSV( PlayerName, "", "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:GetName() )
|
||||||
end
|
end
|
||||||
@ -858,26 +845,24 @@ function SCORING:_AddMissionScore( Mission, Text, Score )
|
|||||||
PlayerData.Score = PlayerData.Score + Score
|
PlayerData.Score = PlayerData.Score + Score
|
||||||
PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score
|
PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score
|
||||||
|
|
||||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' has " .. Text .. " in " .. Mission:GetText() .. ". " ..
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' has " .. Text .. " in " .. Mission:GetText() .. ". " .. Score .. " mission score!",
|
||||||
Score .. " mission score!",
|
MESSAGE.Type.Information )
|
||||||
MESSAGE.Type.Information ):ToAll()
|
:ToAll()
|
||||||
|
|
||||||
self:ScoreCSV( PlayerName, "", "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
|
self:ScoreCSV( PlayerName, "", "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Handles the OnPlayerEnterUnit event for the scoring.
|
--- Handles the OnPlayerEnterUnit event for the scoring.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event
|
||||||
--function SCORING:OnEventPlayerEnterUnit( Event )
|
-- function SCORING:OnEventPlayerEnterUnit( Event )
|
||||||
-- if Event.IniUnit then
|
-- if Event.IniUnit then
|
||||||
-- self:_AddPlayerFromUnit( Event.IniUnit )
|
-- self:_AddPlayerFromUnit( Event.IniUnit )
|
||||||
-- self:SetScoringMenu( Event.IniGroup )
|
-- self:SetScoringMenu( Event.IniGroup )
|
||||||
-- end
|
-- end
|
||||||
--end
|
-- end
|
||||||
|
|
||||||
--- Handles the OnBirth event for the scoring.
|
--- Handles the OnBirth event for the scoring.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
@ -903,12 +888,11 @@ function SCORING:OnEventPlayerLeaveUnit( Event )
|
|||||||
local Menu = self:GetState( Event.IniUnit:GetGroup(), "ScoringMenu" ) -- Core.Menu#MENU_GROUP
|
local Menu = self:GetState( Event.IniUnit:GetGroup(), "ScoringMenu" ) -- Core.Menu#MENU_GROUP
|
||||||
if Menu then
|
if Menu then
|
||||||
-- TODO: Check if this fixes #281.
|
-- TODO: Check if this fixes #281.
|
||||||
--Menu:Remove()
|
-- Menu:Remove()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Handles the OnHit event for the scoring.
|
--- Handles the OnHit event for the scoring.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event
|
||||||
@ -953,9 +937,9 @@ function SCORING:_EventOnHit( Event )
|
|||||||
InitPlayerName = Event.IniPlayerName
|
InitPlayerName = Event.IniPlayerName
|
||||||
|
|
||||||
InitCoalition = Event.IniCoalition
|
InitCoalition = Event.IniCoalition
|
||||||
--TODO: Workaround Client DCS Bug
|
-- TODO: Workaround Client DCS Bug
|
||||||
--InitCategory = InitUnit:getCategory()
|
-- InitCategory = InitUnit:getCategory()
|
||||||
--InitCategory = InitUnit:getDesc().category
|
-- InitCategory = InitUnit:getDesc().category
|
||||||
InitCategory = Event.IniCategory
|
InitCategory = Event.IniCategory
|
||||||
InitType = Event.IniTypeName
|
InitType = Event.IniTypeName
|
||||||
|
|
||||||
@ -963,10 +947,9 @@ function SCORING:_EventOnHit( Event )
|
|||||||
InitUnitCategory = _SCORINGCategory[InitCategory]
|
InitUnitCategory = _SCORINGCategory[InitCategory]
|
||||||
InitUnitType = InitType
|
InitUnitType = InitType
|
||||||
|
|
||||||
self:T( { InitUnitName, InitGroupName, InitPlayerName, InitCoalition, InitCategory, InitType , InitUnitCoalition, InitUnitCategory, InitUnitType } )
|
self:T( { InitUnitName, InitGroupName, InitPlayerName, InitCoalition, InitCategory, InitType, InitUnitCoalition, InitUnitCategory, InitUnitType } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if Event.TgtDCSUnit then
|
if Event.TgtDCSUnit then
|
||||||
|
|
||||||
TargetUnit = Event.TgtDCSUnit
|
TargetUnit = Event.TgtDCSUnit
|
||||||
@ -977,9 +960,9 @@ function SCORING:_EventOnHit( Event )
|
|||||||
TargetPlayerName = Event.TgtPlayerName
|
TargetPlayerName = Event.TgtPlayerName
|
||||||
|
|
||||||
TargetCoalition = Event.TgtCoalition
|
TargetCoalition = Event.TgtCoalition
|
||||||
--TODO: Workaround Client DCS Bug
|
-- TODO: Workaround Client DCS Bug
|
||||||
--TargetCategory = TargetUnit:getCategory()
|
-- TargetCategory = TargetUnit:getCategory()
|
||||||
--TargetCategory = TargetUnit:getDesc().category
|
-- TargetCategory = TargetUnit:getDesc().category
|
||||||
TargetCategory = Event.TgtCategory
|
TargetCategory = Event.TgtCategory
|
||||||
TargetType = Event.TgtTypeName
|
TargetType = Event.TgtTypeName
|
||||||
|
|
||||||
@ -1040,21 +1023,15 @@ function SCORING:_EventOnHit( Event )
|
|||||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1
|
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1
|
||||||
|
|
||||||
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly player '" .. TargetPlayerName .. "' " ..
|
|
||||||
TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " ..
|
|
||||||
"Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty,
|
"Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update
|
MESSAGE.Type.Update )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
else
|
else
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit friendly target " ..
|
|
||||||
TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.PenaltyHit .. " times. " ..
|
|
||||||
"Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty,
|
"Penalty: -" .. PlayerHit.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update
|
MESSAGE.Type.Update )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
end
|
end
|
||||||
@ -1064,33 +1041,26 @@ function SCORING:_EventOnHit( Event )
|
|||||||
PlayerHit.Score = PlayerHit.Score + 1
|
PlayerHit.Score = PlayerHit.Score + 1
|
||||||
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
||||||
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " ..
|
|
||||||
TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
|
||||||
"Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
"Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update
|
MESSAGE.Type.Update )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
else
|
else
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy target " ..
|
|
||||||
TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
|
||||||
"Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
"Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update
|
MESSAGE.Type.Update )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
end
|
end
|
||||||
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
end
|
end
|
||||||
else -- A scenery object was hit.
|
else -- A scenery object was hit.
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit scenery object.",
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit scenery object.",
|
MESSAGE.Type.Update )
|
||||||
MESSAGE.Type.Update
|
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
|
|
||||||
self:ScoreCSV( InitPlayerName, "", "HIT_SCORE", 1, 0, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, "", "Scenery", TargetUnitType )
|
self:ScoreCSV( InitPlayerName, "", "HIT_SCORE", 1, 0, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, "", "Scenery", TargetUnitType )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1142,40 +1112,35 @@ function SCORING:_EventOnHit( Event )
|
|||||||
if InitCoalition then -- A coalition object was hit, probably a static.
|
if InitCoalition then -- A coalition object was hit, probably a static.
|
||||||
if InitCoalition == TargetCoalition then
|
if InitCoalition == TargetCoalition then
|
||||||
-- TODO: Penalty according scale
|
-- TODO: Penalty according scale
|
||||||
Player.Penalty = Player.Penalty + 10 --* self.ScaleDestroyPenalty
|
Player.Penalty = Player.Penalty + 10 -- * self.ScaleDestroyPenalty
|
||||||
PlayerHit.Penalty = PlayerHit.Penalty + 10 --* self.ScaleDestroyPenalty
|
PlayerHit.Penalty = PlayerHit.Penalty + 10 -- * self.ScaleDestroyPenalty
|
||||||
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1 * self.ScaleDestroyPenalty
|
PlayerHit.PenaltyHit = PlayerHit.PenaltyHit + 1 * self.ScaleDestroyPenalty
|
||||||
|
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit friendly target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit friendly target " ..
|
|
||||||
TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
|
||||||
"Penalty: -" .. PlayerHit.Penalty .. " = " .. Player.Score - Player.Penalty,
|
"Penalty: -" .. PlayerHit.Penalty .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update
|
MESSAGE.Type.Update )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
|
|
||||||
self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
else
|
else
|
||||||
Player.Score = Player.Score + 1
|
Player.Score = Player.Score + 1
|
||||||
PlayerHit.Score = PlayerHit.Score + 1
|
PlayerHit.Score = PlayerHit.Score + 1
|
||||||
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit enemy target " ..
|
|
||||||
TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
|
||||||
"Score: +" .. PlayerHit.Score .. " = " .. Player.Score - Player.Penalty,
|
"Score: +" .. PlayerHit.Score .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Update
|
MESSAGE.Type.Update )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
|
|
||||||
self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_SCORE", 1, 1, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_SCORE", 1, 1, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
end
|
end
|
||||||
else -- A scenery object was hit.
|
else -- A scenery object was hit.
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit scenery object.",
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit scenery object.",
|
MESSAGE.Type.Update )
|
||||||
MESSAGE.Type.Update
|
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesHit() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||||
|
|
||||||
self:ScoreCSV( Event.WeaponPlayerName, "", "HIT_SCORE", 1, 0, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, "", "Scenery", TargetUnitType )
|
self:ScoreCSV( Event.WeaponPlayerName, "", "HIT_SCORE", 1, 0, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, "", "Scenery", TargetUnitType )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1211,8 +1176,8 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
TargetPlayerName = Event.IniPlayerName
|
TargetPlayerName = Event.IniPlayerName
|
||||||
|
|
||||||
TargetCoalition = Event.IniCoalition
|
TargetCoalition = Event.IniCoalition
|
||||||
--TargetCategory = TargetUnit:getCategory()
|
-- TargetCategory = TargetUnit:getCategory()
|
||||||
--TargetCategory = TargetUnit:getDesc().category -- Workaround
|
-- TargetCategory = TargetUnit:getDesc().category -- Workaround
|
||||||
TargetCategory = Event.IniCategory
|
TargetCategory = Event.IniCategory
|
||||||
TargetType = Event.IniTypeName
|
TargetType = Event.IniTypeName
|
||||||
|
|
||||||
@ -1261,7 +1226,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
local ThreatLevelTarget = TargetThreatLevel
|
local ThreatLevelTarget = TargetThreatLevel
|
||||||
local ThreatTypeTarget = TargetThreatType
|
local ThreatTypeTarget = TargetThreatType
|
||||||
local ThreatLevelPlayer = Player.ThreatLevel / 10 + 1
|
local ThreatLevelPlayer = Player.ThreatLevel / 10 + 1
|
||||||
local ThreatPenalty = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyPenalty / 10 )
|
local ThreatPenalty = math.ceil( (ThreatLevelTarget / ThreatLevelPlayer) * self.ScaleDestroyPenalty / 10 )
|
||||||
self:F( { ThreatLevel = ThreatPenalty, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
|
self:F( { ThreatLevel = ThreatPenalty, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
|
||||||
|
|
||||||
Player.Penalty = Player.Penalty + ThreatPenalty
|
Player.Penalty = Player.Penalty + ThreatPenalty
|
||||||
@ -1269,33 +1234,27 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1
|
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1
|
||||||
|
|
||||||
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " ..
|
|
||||||
TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
|
||||||
"Penalty: -" .. TargetDestroy.Penalty .. " = " .. Player.Score - Player.Penalty,
|
"Penalty: -" .. TargetDestroy.Penalty .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information
|
MESSAGE.Type.Information )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||||
else
|
else
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly target " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly target " ..
|
|
||||||
TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
|
||||||
"Penalty: -" .. TargetDestroy.Penalty .. " = " .. Player.Score - Player.Penalty,
|
"Penalty: -" .. TargetDestroy.Penalty .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information
|
MESSAGE.Type.Information )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||||
end
|
end
|
||||||
|
|
||||||
Destroyed = true
|
|
||||||
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_PENALTY", 1, ThreatPenalty, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_PENALTY", 1, ThreatPenalty, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
|
Destroyed = true
|
||||||
else
|
else
|
||||||
|
|
||||||
local ThreatLevelTarget = TargetThreatLevel
|
local ThreatLevelTarget = TargetThreatLevel
|
||||||
local ThreatTypeTarget = TargetThreatType
|
local ThreatTypeTarget = TargetThreatType
|
||||||
local ThreatLevelPlayer = Player.ThreatLevel / 10 + 1
|
local ThreatLevelPlayer = Player.ThreatLevel / 10 + 1
|
||||||
local ThreatScore = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.ScaleDestroyScore / 10 )
|
local ThreatScore = math.ceil( (ThreatLevelTarget / ThreatLevelPlayer) * self.ScaleDestroyScore / 10 )
|
||||||
|
|
||||||
self:F( { ThreatLevel = ThreatScore, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
|
self:F( { ThreatLevel = ThreatScore, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } )
|
||||||
|
|
||||||
@ -1303,39 +1262,33 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
TargetDestroy.Score = TargetDestroy.Score + ThreatScore
|
TargetDestroy.Score = TargetDestroy.Score + ThreatScore
|
||||||
TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1
|
TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1
|
||||||
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " ..
|
|
||||||
TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
|
||||||
"Score: +" .. TargetDestroy.Score .. " = " .. Player.Score - Player.Penalty,
|
"Score: +" .. TargetDestroy.Score .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information
|
MESSAGE.Type.Information )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||||
else
|
else
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy " ..
|
|
||||||
TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
|
||||||
"Score: +" .. TargetDestroy.Score .. " = " .. Player.Score - Player.Penalty,
|
"Score: +" .. TargetDestroy.Score .. " = " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information
|
MESSAGE.Type.Information )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||||
end
|
end
|
||||||
Destroyed = true
|
|
||||||
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, ThreatScore, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, ThreatScore, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
|
Destroyed = true
|
||||||
|
|
||||||
local UnitName = TargetUnit:GetName()
|
local UnitName = TargetUnit:GetName()
|
||||||
local Score = self.ScoringObjects[UnitName]
|
local Score = self.ScoringObjects[UnitName]
|
||||||
if Score then
|
if Score then
|
||||||
Player.Score = Player.Score + Score
|
Player.Score = Player.Score + Score
|
||||||
TargetDestroy.Score = TargetDestroy.Score + Score
|
TargetDestroy.Score = TargetDestroy.Score + Score
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Special target '" .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. " destroyed! " ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Special target '" .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. " destroyed! " ..
|
|
||||||
"Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! Total: " .. Player.Score - Player.Penalty,
|
"Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! Total: " .. Player.Score - Player.Penalty,
|
||||||
MESSAGE.Type.Information
|
MESSAGE.Type.Information )
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesScore() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesScore() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesScore() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesScore() and self:IfMessagesToCoalition() )
|
||||||
|
|
||||||
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
Destroyed = true
|
Destroyed = true
|
||||||
end
|
end
|
||||||
@ -1348,13 +1301,12 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
if ScoreZone:IsVec2InZone( TargetUnit:GetVec2() ) then
|
if ScoreZone:IsVec2InZone( TargetUnit:GetVec2() ) then
|
||||||
Player.Score = Player.Score + Score
|
Player.Score = Player.Score + Score
|
||||||
TargetDestroy.Score = TargetDestroy.Score + Score
|
TargetDestroy.Score = TargetDestroy.Score + Score
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Target destroyed in zone '" .. ScoreZone:GetName() .. "'." ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Target destroyed in zone '" .. ScoreZone:GetName() .. "'." ..
|
"Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! " .. "Total: " .. Player.Score - Player.Penalty,
|
||||||
"Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! " ..
|
|
||||||
"Total: " .. Player.Score - Player.Penalty,
|
|
||||||
MESSAGE.Type.Information )
|
MESSAGE.Type.Information )
|
||||||
:ToAllIf( self:IfMessagesZone() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesZone() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesZone() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesZone() and self:IfMessagesToCoalition() )
|
||||||
|
|
||||||
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
self:ScoreCSV( PlayerName, TargetPlayerName, "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
Destroyed = true
|
Destroyed = true
|
||||||
end
|
end
|
||||||
@ -1370,16 +1322,14 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
if ScoreZone:IsVec2InZone( TargetUnit:GetVec2() ) then
|
if ScoreZone:IsVec2InZone( TargetUnit:GetVec2() ) then
|
||||||
Player.Score = Player.Score + Score
|
Player.Score = Player.Score + Score
|
||||||
TargetDestroy.Score = TargetDestroy.Score + Score
|
TargetDestroy.Score = TargetDestroy.Score + Score
|
||||||
MESSAGE
|
MESSAGE:NewType( self.DisplayMessagePrefix .. "Scenery destroyed in zone '" .. ScoreZone:GetName() .. "'." ..
|
||||||
:NewType( self.DisplayMessagePrefix .. "Scenery destroyed in zone '" .. ScoreZone:GetName() .. "'." ..
|
"Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! " .. "Total: " .. Player.Score - Player.Penalty,
|
||||||
"Player '" .. PlayerName .. "' receives an extra " .. Score .. " points! " ..
|
MESSAGE.Type.Information )
|
||||||
"Total: " .. Player.Score - Player.Penalty,
|
|
||||||
MESSAGE.Type.Information
|
|
||||||
)
|
|
||||||
:ToAllIf( self:IfMessagesZone() and self:IfMessagesToAll() )
|
:ToAllIf( self:IfMessagesZone() and self:IfMessagesToAll() )
|
||||||
:ToCoalitionIf( InitCoalition, self:IfMessagesZone() and self:IfMessagesToCoalition() )
|
:ToCoalitionIf( InitCoalition, self:IfMessagesZone() and self:IfMessagesToCoalition() )
|
||||||
Destroyed = true
|
|
||||||
self:ScoreCSV( PlayerName, "", "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, "", "Scenery", TargetUnitType )
|
self:ScoreCSV( PlayerName, "", "DESTROY_SCORE", 1, Score, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, "", "Scenery", TargetUnitType )
|
||||||
|
Destroyed = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1395,7 +1345,6 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Produce detailed report of player hit scores.
|
--- Produce detailed report of player hit scores.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param #string PlayerName The name of the player.
|
-- @param #string PlayerName The name of the player.
|
||||||
@ -1437,7 +1386,7 @@ function SCORING:ReportDetailedPlayerHits( PlayerName )
|
|||||||
PlayerScore = PlayerScore + Score
|
PlayerScore = PlayerScore + Score
|
||||||
PlayerPenalty = PlayerPenalty + Penalty
|
PlayerPenalty = PlayerPenalty + Penalty
|
||||||
else
|
else
|
||||||
--ScoreMessageHits = ScoreMessageHits .. string.format( "%s:%d ", string.format(CategoryName, 1, 1), 0 )
|
-- ScoreMessageHits = ScoreMessageHits .. string.format( "%s:%d ", string.format(CategoryName, 1, 1), 0 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if ScoreMessageHits ~= "" then
|
if ScoreMessageHits ~= "" then
|
||||||
@ -1448,7 +1397,6 @@ function SCORING:ReportDetailedPlayerHits( PlayerName )
|
|||||||
return ScoreMessage, PlayerScore, PlayerPenalty
|
return ScoreMessage, PlayerScore, PlayerPenalty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Produce detailed report of player destroy scores.
|
--- Produce detailed report of player destroy scores.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param #string PlayerName The name of the player.
|
-- @param #string PlayerName The name of the player.
|
||||||
@ -1495,7 +1443,7 @@ function SCORING:ReportDetailedPlayerDestroys( PlayerName )
|
|||||||
PlayerScore = PlayerScore + Score
|
PlayerScore = PlayerScore + Score
|
||||||
PlayerPenalty = PlayerPenalty + Penalty
|
PlayerPenalty = PlayerPenalty + Penalty
|
||||||
else
|
else
|
||||||
--ScoreMessageDestroys = ScoreMessageDestroys .. string.format( "%s:%d ", string.format(CategoryName, 1, 1), 0 )
|
-- ScoreMessageDestroys = ScoreMessageDestroys .. string.format( "%s:%d ", string.format(CategoryName, 1, 1), 0 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if ScoreMessageDestroys ~= "" then
|
if ScoreMessageDestroys ~= "" then
|
||||||
@ -1614,7 +1562,6 @@ function SCORING:ReportDetailedPlayerMissions( PlayerName )
|
|||||||
return ScoreMessage, PlayerScore, PlayerPenalty
|
return ScoreMessage, PlayerScore, PlayerPenalty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Report Group Score Summary
|
--- Report Group Score Summary
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param Wrapper.Group#GROUP PlayerGroup The player group.
|
-- @param Wrapper.Group#GROUP PlayerGroup The player group.
|
||||||
@ -1654,8 +1601,7 @@ function SCORING:ReportScoreGroupSummary( PlayerGroup )
|
|||||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyGoals + PenaltyMissions
|
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyGoals + PenaltyMissions
|
||||||
|
|
||||||
PlayerMessage =
|
PlayerMessage = string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
||||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
|
||||||
PlayerName,
|
PlayerName,
|
||||||
PlayerScore - PlayerPenalty,
|
PlayerScore - PlayerPenalty,
|
||||||
PlayerScore,
|
PlayerScore,
|
||||||
@ -1706,8 +1652,7 @@ function SCORING:ReportScoreGroupDetailed( PlayerGroup )
|
|||||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||||
|
|
||||||
PlayerMessage =
|
PlayerMessage = string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )%s%s%s%s%s",
|
||||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )%s%s%s%s%s",
|
|
||||||
PlayerName,
|
PlayerName,
|
||||||
PlayerScore - PlayerPenalty,
|
PlayerScore - PlayerPenalty,
|
||||||
PlayerScore,
|
PlayerScore,
|
||||||
@ -1762,8 +1707,7 @@ function SCORING:ReportScoreAllSummary( PlayerGroup )
|
|||||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||||
|
|
||||||
PlayerMessage =
|
PlayerMessage = string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
||||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
|
||||||
PlayerName,
|
PlayerName,
|
||||||
PlayerScore - PlayerPenalty,
|
PlayerScore - PlayerPenalty,
|
||||||
PlayerScore,
|
PlayerScore,
|
||||||
@ -1775,17 +1719,16 @@ function SCORING:ReportScoreAllSummary( PlayerGroup )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function SCORING:SecondsToClock( sSeconds )
|
||||||
function SCORING:SecondsToClock(sSeconds)
|
|
||||||
local nSeconds = sSeconds
|
local nSeconds = sSeconds
|
||||||
if nSeconds == 0 then
|
if nSeconds == 0 then
|
||||||
--return nil;
|
-- return nil;
|
||||||
return "00:00:00";
|
return "00:00:00";
|
||||||
else
|
else
|
||||||
nHours = string.format("%02.f", math.floor(nSeconds/3600));
|
nHours = string.format( "%02.f", math.floor( nSeconds / 3600 ) );
|
||||||
nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60)));
|
nMins = string.format( "%02.f", math.floor( nSeconds / 60 - (nHours * 60) ) );
|
||||||
nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60));
|
nSecs = string.format( "%02.f", math.floor( nSeconds - nHours * 3600 - nMins * 60 ) );
|
||||||
return nHours..":"..nMins..":"..nSecs
|
return nHours .. ":" .. nMins .. ":" .. nSecs
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1810,9 +1753,9 @@ function SCORING:OpenCSV( ScoringCSV )
|
|||||||
error( "Error: Cannot open CSV file in " .. lfs.writedir() )
|
error( "Error: Cannot open CSV file in " .. lfs.writedir() )
|
||||||
end
|
end
|
||||||
|
|
||||||
self.CSVFile:write( '"GameName","RunTime","Time","PlayerName","TargetPlayerName","ScoreType","PlayerUnitCoaltion","PlayerUnitCategory","PlayerUnitType","PlayerUnitName","TargetUnitCoalition","TargetUnitCategory","TargetUnitType","TargetUnitName","Times","Score"\n' )
|
self.CSVFile:write( '"GameName","RunTime","Time","PlayerName","TargetPlayerName","ScoreType","PlayerUnitCoalition","PlayerUnitCategory","PlayerUnitType","PlayerUnitName","TargetUnitCoalition","TargetUnitCategory","TargetUnitType","TargetUnitName","Times","Score"\n' )
|
||||||
|
|
||||||
self.RunTime = os.date("%y-%m-%d_%H-%M-%S")
|
self.RunTime = os.date( "%y-%m-%d_%H-%M-%S" )
|
||||||
else
|
else
|
||||||
error( "A string containing the CSV file name must be given." )
|
error( "A string containing the CSV file name must be given." )
|
||||||
end
|
end
|
||||||
@ -1822,7 +1765,6 @@ function SCORING:OpenCSV( ScoringCSV )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Registers a score for a player.
|
--- Registers a score for a player.
|
||||||
-- @param #SCORING self
|
-- @param #SCORING self
|
||||||
-- @param #string PlayerName The name of the player.
|
-- @param #string PlayerName The name of the player.
|
||||||
@ -1840,7 +1782,7 @@ end
|
|||||||
-- @param #string TargetUnitType The type of the target unit.
|
-- @param #string TargetUnitType The type of the target unit.
|
||||||
-- @return #SCORING self
|
-- @return #SCORING self
|
||||||
function SCORING:ScoreCSV( PlayerName, TargetPlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
function SCORING:ScoreCSV( PlayerName, TargetPlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||||
--write statistic information to file
|
-- write statistic information to file
|
||||||
local ScoreTime = self:SecondsToClock( timer.getTime() )
|
local ScoreTime = self:SecondsToClock( timer.getTime() )
|
||||||
PlayerName = PlayerName:gsub( '"', '_' )
|
PlayerName = PlayerName:gsub( '"', '_' )
|
||||||
|
|
||||||
@ -1852,7 +1794,7 @@ function SCORING:ScoreCSV( PlayerName, TargetPlayerName, ScoreType, ScoreTimes,
|
|||||||
|
|
||||||
if PlayerUnit then
|
if PlayerUnit then
|
||||||
if not PlayerUnitCategory then
|
if not PlayerUnitCategory then
|
||||||
--PlayerUnitCategory = SCORINGCategory[PlayerUnit:getCategory()]
|
-- PlayerUnitCategory = SCORINGCategory[PlayerUnit:getCategory()]
|
||||||
PlayerUnitCategory = _SCORINGCategory[PlayerUnit:getDesc().category]
|
PlayerUnitCategory = _SCORINGCategory[PlayerUnit:getDesc().category]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1905,7 +1847,6 @@ function SCORING:ScoreCSV( PlayerName, TargetPlayerName, ScoreType, ScoreTimes,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function SCORING:CloseCSV()
|
function SCORING:CloseCSV()
|
||||||
if lfs and io and os then
|
if lfs and io and os then
|
||||||
self.CSVFile:close()
|
self.CSVFile:close()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user