mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-18 21:25:58 +00:00
Update Scoring.lua
This commit is contained in:
@@ -1727,37 +1727,43 @@ function SCORING:ReportScoreGroupSummary( PlayerGroup )
|
|||||||
|
|
||||||
if PlayerName then
|
if PlayerName then
|
||||||
|
|
||||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
local Player=self.Players[PlayerName] --#SCORING.PlayerData
|
||||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
|
||||||
self:F( { ReportHits, ScoreHits, PenaltyHits } )
|
|
||||||
|
|
||||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
|
||||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
|
||||||
self:F( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
|
||||||
|
|
||||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
|
||||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
|
||||||
self:F( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
|
||||||
|
|
||||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
|
||||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
|
||||||
self:F( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
|
||||||
|
|
||||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
|
||||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
|
||||||
self:F( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
|
||||||
|
|
||||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
if Player then
|
||||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
|
||||||
|
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||||
|
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||||
|
self:F( { ReportHits, ScoreHits, PenaltyHits } )
|
||||||
|
|
||||||
PlayerMessage =
|
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||||
PlayerName,
|
self:F( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||||
PlayerScore - PlayerPenalty,
|
|
||||||
PlayerScore,
|
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||||
PlayerPenalty
|
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||||
)
|
self:F( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||||
MESSAGE:NewType( PlayerMessage, MESSAGE.Type.Detailed ):ToGroup( PlayerGroup )
|
|
||||||
|
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||||
|
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||||
|
self:F( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||||
|
|
||||||
|
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||||
|
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||||
|
self:F( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||||
|
|
||||||
|
local PlayerScore = Player.Score --ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||||
|
local PlayerPenalty = Player.Penalty --PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||||
|
|
||||||
|
PlayerMessage =
|
||||||
|
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
||||||
|
PlayerName,
|
||||||
|
PlayerScore - PlayerPenalty,
|
||||||
|
PlayerScore,
|
||||||
|
PlayerPenalty
|
||||||
|
)
|
||||||
|
MESSAGE:NewType( PlayerMessage, MESSAGE.Type.Detailed ):ToGroup( PlayerGroup )
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1776,45 +1782,50 @@ function SCORING:ReportScoreGroupDetailed( PlayerGroup )
|
|||||||
for UnitID, PlayerUnit in pairs( PlayerUnits ) do
|
for UnitID, PlayerUnit in pairs( PlayerUnits ) do
|
||||||
local PlayerUnit = PlayerUnit -- Wrapper.Unit#UNIT
|
local PlayerUnit = PlayerUnit -- Wrapper.Unit#UNIT
|
||||||
local PlayerName = PlayerUnit:GetPlayerName()
|
local PlayerName = PlayerUnit:GetPlayerName()
|
||||||
|
|
||||||
if PlayerName then
|
if PlayerName then
|
||||||
|
|
||||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
local Player=self.Players[PlayerName] --#SCORING.PlayerData
|
||||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
|
||||||
self:F( { ReportHits, ScoreHits, PenaltyHits } )
|
|
||||||
|
|
||||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
|
||||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
|
||||||
self:F( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
|
||||||
|
|
||||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
|
||||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
|
||||||
self:F( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
|
||||||
|
|
||||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
if Player then
|
||||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
|
||||||
self:F( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||||
|
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
self:F( { ReportHits, ScoreHits, PenaltyHits } )
|
||||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
|
||||||
self:F( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
|
||||||
|
|
||||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
|
||||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
|
||||||
|
|
||||||
PlayerMessage =
|
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )%s%s%s%s%s",
|
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||||
PlayerName,
|
self:F( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||||
PlayerScore - PlayerPenalty,
|
|
||||||
PlayerScore,
|
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||||
PlayerPenalty,
|
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||||
ReportHits,
|
self:F( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||||
ReportDestroys,
|
|
||||||
ReportCoalitionChanges,
|
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||||
ReportGoals,
|
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||||
ReportMissions
|
self:F( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||||
)
|
|
||||||
MESSAGE:NewType( PlayerMessage, MESSAGE.Type.Detailed ):ToGroup( PlayerGroup )
|
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||||
|
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||||
|
self:F( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||||
|
|
||||||
|
local PlayerScore = Player.Score --ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||||
|
local PlayerPenalty = Player.Penalty --PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||||
|
|
||||||
|
PlayerMessage =
|
||||||
|
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )%s%s%s%s%s",
|
||||||
|
PlayerName,
|
||||||
|
PlayerScore - PlayerPenalty,
|
||||||
|
PlayerScore,
|
||||||
|
PlayerPenalty,
|
||||||
|
ReportHits,
|
||||||
|
ReportDestroys,
|
||||||
|
ReportCoalitionChanges,
|
||||||
|
ReportGoals,
|
||||||
|
ReportMissions
|
||||||
|
)
|
||||||
|
MESSAGE:NewType( PlayerMessage, MESSAGE.Type.Detailed ):ToGroup( PlayerGroup )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1834,38 +1845,44 @@ function SCORING:ReportScoreAllSummary( PlayerGroup )
|
|||||||
self:T( { PlayerName = PlayerName, PlayerGroup = PlayerGroup } )
|
self:T( { PlayerName = PlayerName, PlayerGroup = PlayerGroup } )
|
||||||
|
|
||||||
if PlayerName then
|
if PlayerName then
|
||||||
|
|
||||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
|
||||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
|
||||||
self:F( { ReportHits, ScoreHits, PenaltyHits } )
|
|
||||||
|
|
||||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
local Player=self.Players[PlayerName] --#SCORING.PlayerData
|
||||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
|
||||||
self:F( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
|
||||||
|
|
||||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
|
||||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
|
||||||
self:F( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
|
||||||
|
|
||||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
|
||||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
|
||||||
self:F( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
|
||||||
|
|
||||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
|
||||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
|
||||||
self:F( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
|
||||||
|
|
||||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
if Player then
|
||||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
|
||||||
|
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||||
|
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||||
|
self:F( { ReportHits, ScoreHits, PenaltyHits } )
|
||||||
|
|
||||||
PlayerMessage =
|
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||||
PlayerName,
|
self:F( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||||
PlayerScore - PlayerPenalty,
|
|
||||||
PlayerScore,
|
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||||
PlayerPenalty
|
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||||
)
|
self:F( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||||
MESSAGE:NewType( PlayerMessage, MESSAGE.Type.Overview ):ToGroup( PlayerGroup )
|
|
||||||
|
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||||
|
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||||
|
self:F( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||||
|
|
||||||
|
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||||
|
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||||
|
self:F( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||||
|
|
||||||
|
local PlayerScore = Player.Score --ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||||
|
local PlayerPenalty = Player.Penalty --PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||||
|
|
||||||
|
PlayerMessage =
|
||||||
|
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
||||||
|
PlayerName,
|
||||||
|
PlayerScore - PlayerPenalty,
|
||||||
|
PlayerScore,
|
||||||
|
PlayerPenalty
|
||||||
|
)
|
||||||
|
MESSAGE:NewType( PlayerMessage, MESSAGE.Type.Overview ):ToGroup( PlayerGroup )
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1994,9 +2011,9 @@ function SCORING:LoadCSV(filename)
|
|||||||
-- Create player array if necessary.
|
-- Create player array if necessary.
|
||||||
self.CSVdata[result.PlayerName]=self.CSVdata[result.PlayerName] or {}
|
self.CSVdata[result.PlayerName]=self.CSVdata[result.PlayerName] or {}
|
||||||
|
|
||||||
local Player=self.Players[PlayerName] --#SCORING.PlayerData
|
|
||||||
|
|
||||||
if Player == nil then -- I believe this is the place where a Player gets a life in a mission when he enters a unit ...
|
-- Init player array if it does not exist.
|
||||||
|
if self.Players[PlayerName] == nil then
|
||||||
self.Players[PlayerName] = {}
|
self.Players[PlayerName] = {}
|
||||||
self.Players[PlayerName].Hit = {}
|
self.Players[PlayerName].Hit = {}
|
||||||
self.Players[PlayerName].Destroy = {}
|
self.Players[PlayerName].Destroy = {}
|
||||||
@@ -2009,8 +2026,12 @@ function SCORING:LoadCSV(filename)
|
|||||||
self.Players[PlayerName].PenaltyWarning = 0
|
self.Players[PlayerName].PenaltyWarning = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local Player=self.Players[PlayerName] --#SCORING.PlayerData
|
||||||
|
|
||||||
-- Restore player scores.
|
-- Restore player scores.
|
||||||
if result.ScoreType then
|
if result.ScoreType then
|
||||||
|
|
||||||
|
|
||||||
if result.ScoreType:find("PENALTY") then
|
if result.ScoreType:find("PENALTY") then
|
||||||
|
|
||||||
-- Penalty
|
-- Penalty
|
||||||
@@ -2021,11 +2042,15 @@ function SCORING:LoadCSV(filename)
|
|||||||
Player.PenaltyCoalition=Player.PenaltyCoalition+1
|
Player.PenaltyCoalition=Player.PenaltyCoalition+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if result.ScoreType:find("SCORE") then
|
if result.ScoreType:find("SCORE") then
|
||||||
Player.Score=Player.Score+result.Score
|
Player.Score=Player.Score+result.Score
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self:E(string.format("Player %s score = %d %d", PlayerName, Player.Score, self.Players[PlayerName].Score))
|
||||||
|
|
||||||
--self.Players[PlayerName].Score=self.Players[PlayerName].Score+result.Score
|
--self.Players[PlayerName].Score=self.Players[PlayerName].Score+result.Score
|
||||||
|
|
||||||
-- Add result to table.
|
-- Add result to table.
|
||||||
@@ -2101,21 +2126,21 @@ function SCORING:ScoreCSV( PlayerName, TargetPlayerName, ScoreType, ScoreTimes,
|
|||||||
|
|
||||||
if lfs and io and os then
|
if lfs and io and os then
|
||||||
self.CSVFile:write(
|
self.CSVFile:write(
|
||||||
'"' .. self.GameName .. '"' .. ',' ..
|
'' .. self.GameName .. '' .. ',' ..
|
||||||
'"' .. self.RunTime .. '"' .. ',' ..
|
'' .. self.RunTime .. '' .. ',' ..
|
||||||
'' .. ScoreTime .. '' .. ',' ..
|
'' .. ScoreTime .. '' .. ',' ..
|
||||||
'"' .. PlayerName .. '"' .. ',' ..
|
'' .. PlayerName .. '' .. ',' ..
|
||||||
'"' .. TargetPlayerName .. '"' .. ',' ..
|
'' .. TargetPlayerName .. '' .. ',' ..
|
||||||
'"' .. ScoreType .. '"' .. ',' ..
|
'' .. ScoreType .. '' .. ',' ..
|
||||||
'"' .. PlayerUnitCoalition .. '"' .. ',' ..
|
'' .. PlayerUnitCoalition .. '' .. ',' ..
|
||||||
'"' .. PlayerUnitCategory .. '"' .. ',' ..
|
'' .. PlayerUnitCategory .. '' .. ',' ..
|
||||||
'"' .. PlayerUnitType .. '"' .. ',' ..
|
'' .. PlayerUnitType .. '' .. ',' ..
|
||||||
'"' .. PlayerUnitName .. '"' .. ',' ..
|
'' .. PlayerUnitName .. '' .. ',' ..
|
||||||
'"' .. TargetUnitCoalition .. '"' .. ',' ..
|
'' .. TargetUnitCoalition .. '' .. ',' ..
|
||||||
'"' .. TargetUnitCategory .. '"' .. ',' ..
|
'' .. TargetUnitCategory .. '' .. ',' ..
|
||||||
'"' .. TargetUnitType .. '"' .. ',' ..
|
'' .. TargetUnitType .. '' .. ',' ..
|
||||||
'"' .. TargetUnitName .. '"' .. ',' ..
|
'' .. TargetUnitName .. '' .. ',' ..
|
||||||
'' .. ScoreTimes .. '' .. ',' ..
|
'' .. ScoreTimes .. '' .. ',' ..
|
||||||
'' .. ScoreAmount
|
'' .. ScoreAmount
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user