Fixed bug

This commit is contained in:
FlightControl 2016-04-26 10:16:17 +02:00
parent 2538308e4e
commit 60005abfbd

View File

@ -423,7 +423,7 @@ function SCORING:_EventOnHit( Event )
2, 2,
"/PENALTY" .. InitPlayerName .. "/" .. InitUnitName "/PENALTY" .. InitPlayerName .. "/" .. InitUnitName
):ToAll() ):ToAll()
self:ScoreAdd( InitPlayerName, "HIT_PENALTY", 1, -25, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) self:ScoreCSV( InitPlayerName, "HIT_PENALTY", 1, -25, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
else else
self.Players[InitPlayerName].Score = self.Players[InitPlayerName].Score + 10 self.Players[InitPlayerName].Score = self.Players[InitPlayerName].Score + 10
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score + 1 self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score = self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score + 1
@ -435,7 +435,7 @@ function SCORING:_EventOnHit( Event )
2, 2,
"/SCORE" .. InitPlayerName .. "/" .. InitUnitName "/SCORE" .. InitPlayerName .. "/" .. InitUnitName
):ToAll() ):ToAll()
self:ScoreAdd( InitPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) self:ScoreCSV( InitPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
end end
end end
end end
@ -701,12 +701,12 @@ function SCORING:OpenCSV( ScoringCSV )
self.ScoringCSV = ScoringCSV self.ScoringCSV = ScoringCSV
local fdir = lfs.writedir() .. [[Logs\]] .. self.ScoringCSV .. os.date( "%Y-%m-%d_%H-%M-%S" ) .. ".csv" local fdir = lfs.writedir() .. [[Logs\]] .. self.ScoringCSV .. os.date( "%Y-%m-%d_%H-%M-%S" ) .. ".csv"
self.StatFile, self.err = io.open( fdir, "w+" ) self.CSVFile, self.err = io.open( fdir, "w+" )
if not self.StatFile then if not self.CSVFile then
error( "Error: Cannot open CSV file in " .. lfs.writedir() ) error( "Error: Cannot open CSV file in " .. lfs.writedir() )
end end
self.StatFile:write( '"GameName","RunTime","Time","PlayerName","ScoreType","PlayerUnitCoaltion","PlayerUnitCategory","PlayerUnitType","PlayerUnitName","TargetUnitCoalition","TargetUnitCategory","TargetUnitType","TargetUnitName","Times","Score"\n' ) self.CSVFile:write( '"GameName","RunTime","Time","PlayerName","ScoreType","PlayerUnitCoaltion","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
@ -785,7 +785,7 @@ function SCORING:ScoreCSV( PlayerName, ScoreType, ScoreTimes, ScoreAmount, Playe
end end
if lfs then if lfs then
self.StatFile:write( self.CSVFile:write(
'"' .. self.GameName .. '"' .. ',' .. '"' .. self.GameName .. '"' .. ',' ..
'"' .. self.RunTime .. '"' .. ',' .. '"' .. self.RunTime .. '"' .. ',' ..
'' .. ScoreTime .. '' .. ',' .. '' .. ScoreTime .. '' .. ',' ..
@ -803,14 +803,14 @@ function SCORING:ScoreCSV( PlayerName, ScoreType, ScoreTimes, ScoreAmount, Playe
'' .. ScoreAmount '' .. ScoreAmount
) )
self.StatFile:write( "\n" ) self.CSVFile:write( "\n" )
end end
end end
function LogClose() function SCORING:CloseCSV()
if lfs then if lfs then
self.StatFile:close() self.CSVFile:close()
end end
end end