2020-01-22 14:25:58 +00:00
|
|
|
-- Copyright (c) 2020 David Vogel
|
|
|
|
--
|
|
|
|
-- This software is released under the MIT License.
|
|
|
|
-- https://opensource.org/licenses/MIT
|
|
|
|
|
2018-08-03 09:22:18 +00:00
|
|
|
function D3stats.Map_Message(roundend, ply)
|
2016-10-09 16:11:56 +00:00
|
|
|
local map = game.GetMap()
|
2018-08-03 09:22:18 +00:00
|
|
|
local count, wins, avg_players = D3stats.Storage.Map_Get(map)
|
2016-10-09 16:11:56 +00:00
|
|
|
|
|
|
|
local Message
|
|
|
|
if count > 0 then
|
|
|
|
if roundend == true then
|
2018-08-03 09:22:18 +00:00
|
|
|
Message = string.format(D3stats.Message.MapStats_End, map, wins, count, wins / count * 100)
|
2016-10-09 16:11:56 +00:00
|
|
|
else
|
2018-08-03 09:22:18 +00:00
|
|
|
Message = string.format(D3stats.Message.MapStats, map, wins, count, wins / count * 100)
|
2016-10-09 16:11:56 +00:00
|
|
|
end
|
|
|
|
else
|
2018-08-03 09:22:18 +00:00
|
|
|
Message = string.format(D3stats.Message.MapStats_Zero, map)
|
2016-10-09 16:11:56 +00:00
|
|
|
end
|
2018-08-03 09:22:18 +00:00
|
|
|
|
2016-10-09 16:11:56 +00:00
|
|
|
if ply then
|
2018-08-03 09:22:18 +00:00
|
|
|
ply:ChatPrint(Message)
|
2016-10-09 16:11:56 +00:00
|
|
|
else
|
2018-08-03 09:22:18 +00:00
|
|
|
PrintMessage(HUD_PRINTTALK, Message)
|
2016-10-09 16:11:56 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-08-03 09:22:18 +00:00
|
|
|
function D3stats.Map_End(won)
|
2016-10-09 16:11:56 +00:00
|
|
|
local map = game.GetMap()
|
2016-10-13 21:59:52 +00:00
|
|
|
local players = #player.GetAll()
|
2016-10-09 16:11:56 +00:00
|
|
|
|
2016-10-13 21:59:52 +00:00
|
|
|
if players > 0 then
|
2018-08-03 09:22:18 +00:00
|
|
|
D3stats.Storage.Map_AddOutcome(map, won, players)
|
|
|
|
D3stats.Map_Message(true)
|
2016-10-13 21:59:52 +00:00
|
|
|
end
|
2016-10-09 16:11:56 +00:00
|
|
|
end
|
|
|
|
|
2018-08-03 09:22:18 +00:00
|
|
|
--D3stats.Map_End(false)
|
2016-10-09 16:11:56 +00:00
|
|
|
|
2018-08-03 09:22:18 +00:00
|
|
|
--D3stats.Map_Message(false, player.GetByID(1))
|