hedgewars/uStats.pas
changeset 4374 bcefeeabaa33
parent 4370 d1d5c1a57a50
child 4376 9654205a9424
equal deleted inserted replaced
4373:fe0e3903bb9e 4374:bcefeeabaa33
    33 procedure Skipped;
    33 procedure Skipped;
    34 procedure TurnReaction;
    34 procedure TurnReaction;
    35 procedure SendStats;
    35 procedure SendStats;
    36 
    36 
    37 implementation
    37 implementation
    38 uses uTeams, uSound, uMisc, uLocale, uWorld, uVariables;
    38 uses uTeams, uSound, uMisc, uLocale, uWorld, uVariables, uUtils;
    39 
    39 
    40 var DamageGiven : Longword = 0;
    40 var DamageGiven : Longword = 0;
    41     DamageClan  : Longword = 0;
    41     DamageClan  : Longword = 0;
    42     DamageTotal : Longword = 0;
    42     DamageTotal : Longword = 0;
    43     KillsClan   : LongWord = 0;
    43     KillsClan   : LongWord = 0;
   156                 end;
   156                 end;
   157 
   157 
   158 for t:= 0 to Pred(ClansCount) do
   158 for t:= 0 to Pred(ClansCount) do
   159     with ClansArray[t]^ do
   159     with ClansArray[t]^ do
   160         begin
   160         begin
   161         SendStat(siClanHealth, inttostr(Color) + ' ' + inttostr(ClanHealth));
   161         SendStat(siClanHealth, IntToStr(Color) + ' ' + IntToStr(ClanHealth));
   162         end;
   162         end;
   163 
   163 
   164 Kills:= 0;
   164 Kills:= 0;
   165 KillsClan:= 0;
   165 KillsClan:= 0;
   166 DamageGiven:= 0;
   166 DamageGiven:= 0;
   216                     end;
   216                     end;
   217         end;
   217         end;
   218 
   218 
   219         { send player stats for winner teams }
   219         { send player stats for winner teams }
   220         if Clan^.ClanHealth > 0 then begin
   220         if Clan^.ClanHealth > 0 then begin
   221             SendStat(siPlayerKills, inttostr(Clan^.Color) + ' ' +
   221             SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' +
   222                 inttostr(stats.Kills) + ' ' + TeamName);
   222                 IntToStr(stats.Kills) + ' ' + TeamName);
   223         end;
   223         end;
   224 
   224 
   225         { determine maximum values of TeamKills, TurnSkips, TeamDamage }
   225         { determine maximum values of TeamKills, TurnSkips, TeamDamage }
   226         if stats.TeamKills > maxTeamKills then begin
   226         if stats.TeamKills > maxTeamKills then begin
   227             maxTeamKills := stats.TeamKills;
   227             maxTeamKills := stats.TeamKills;
   240 
   240 
   241 { now send player stats for loser teams }
   241 { now send player stats for loser teams }
   242 for t:= 0 to Pred(TeamsCount) do begin
   242 for t:= 0 to Pred(TeamsCount) do begin
   243     with TeamsArray[t]^ do begin
   243     with TeamsArray[t]^ do begin
   244         if Clan^.ClanHealth = 0 then begin
   244         if Clan^.ClanHealth = 0 then begin
   245             SendStat(siPlayerKills, inttostr(Clan^.Color) + ' ' +
   245             SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' +
   246                 inttostr(stats.Kills) + ' ' + TeamName);
   246                 IntToStr(stats.Kills) + ' ' + TeamName);
   247         end;
   247         end;
   248     end;
   248     end;
   249 end;
   249 end;
   250 
   250 
   251 if msdhh <> nil then
   251 if msdhh <> nil then
   252     SendStat(siMaxStepDamage, inttostr(msd) + ' ' + msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')');
   252     SendStat(siMaxStepDamage, IntToStr(msd) + ' ' + msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')');
   253 if mskcnt = 1 then
   253 if mskcnt = 1 then
   254     SendStat(siMaxStepKills, inttostr(msk) + ' ' + mskhh^.Name + ' (' + mskhh^.Team^.TeamName + ')');
   254     SendStat(siMaxStepKills, IntToStr(msk) + ' ' + mskhh^.Name + ' (' + mskhh^.Team^.TeamName + ')');
   255 
   255 
   256 if maxTeamKills > 1 then
   256 if maxTeamKills > 1 then
   257     SendStat(siMaxTeamKills, inttostr(maxTeamKills) + ' ' + maxTeamKillsName);
   257     SendStat(siMaxTeamKills, IntToStr(maxTeamKills) + ' ' + maxTeamKillsName);
   258 if maxTurnSkips > 2 then
   258 if maxTurnSkips > 2 then
   259     SendStat(siMaxTurnSkips, inttostr(maxTurnSkips) + ' ' + maxTurnSkipsName);
   259     SendStat(siMaxTurnSkips, IntToStr(maxTurnSkips) + ' ' + maxTurnSkipsName);
   260 if maxTeamDamage > 30 then
   260 if maxTeamDamage > 30 then
   261     SendStat(siMaxTeamDamage, inttostr(maxTeamDamage) + ' ' + maxTeamDamageName);
   261     SendStat(siMaxTeamDamage, IntToStr(maxTeamDamage) + ' ' + maxTeamDamageName);
   262 
   262 
   263 if KilledHHs > 0 then SendStat(siKilledHHs, inttostr(KilledHHs));
   263 if KilledHHs > 0 then SendStat(siKilledHHs, IntToStr(KilledHHs));
   264 end;
   264 end;
   265 
   265 
   266 procedure initModule;
   266 procedure initModule;
   267 begin
   267 begin
   268     TotalRounds:= -1;
   268     TotalRounds:= -1;