share/hedgewars/Data/Scripts/Utils.lua
changeset 14591 b4089fa16b34
parent 14525 029f40c609b4
child 14811 d65e25e211d4
equal deleted inserted replaced
14590:c5f18710a184 14591:b4089fa16b34
    42 		return string.format(loc("Team's longest time: %.3fs"), value/1000)
    42 		return string.format(loc("Team's longest time: %.3fs"), value/1000)
    43 	elseif recordType == "Highscore" then
    43 	elseif recordType == "Highscore" then
    44 		return string.format(loc("Team highscore: %d"), value)
    44 		return string.format(loc("Team highscore: %d"), value)
    45 	elseif recordType == "Lowscore" then
    45 	elseif recordType == "Lowscore" then
    46 		return string.format(loc("Team lowscore: %d"), value)
    46 		return string.format(loc("Team lowscore: %d"), value)
       
    47 	elseif recordType == "AccuracyRecord" then
       
    48 		return string.format(loc("Team's top accuracy: %d%"), value)
    47 	end
    49 	end
    48 end
    50 end
    49 
    51 
    50 function getReadableChallengeRecord(recordType)
    52 function getReadableChallengeRecord(recordType)
    51 	local record = tonumber(GetMissionVar(recordType))
    53 	local record = tonumber(GetMissionVar(recordType))
    58 
    60 
    59 function updateChallengeRecord(recordType, value, stat)
    61 function updateChallengeRecord(recordType, value, stat)
    60 	local oldRecord = tonumber(GetMissionVar(recordType))
    62 	local oldRecord = tonumber(GetMissionVar(recordType))
    61 	local newRecord = false
    63 	local newRecord = false
    62 	if stat == nil then
    64 	if stat == nil then
    63 		stat = true
    65 		stat = recordType ~= "AccuracyRecord"
    64 	end
    66 	end
    65 	if type(oldRecord) ~= "number" then
    67 	if type(oldRecord) ~= "number" then
    66 		newRecord = true
    68 		newRecord = true
    67 	else
    69 	else
    68 		local recordBeaten = false
    70 		local recordBeaten = false