hedgewars/uStats.pas
changeset 9397 7b7ee65f82ad
parent 9180 d19c09670ec8
child 9405 efc5409a141d
equal deleted inserted replaced
9395:2659192d5af9 9397:7b7ee65f82ad
    33 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean);
    33 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean);
    34 procedure Skipped;
    34 procedure Skipped;
    35 procedure TurnReaction;
    35 procedure TurnReaction;
    36 procedure SendStats;
    36 procedure SendStats;
    37 procedure hedgehogFlight(Gear: PGear; time: Longword);
    37 procedure hedgehogFlight(Gear: PGear; time: Longword);
       
    38 procedure declareAchievement(id, teamname: shortstring; value: LongInt);
    38 
    39 
    39 implementation
    40 implementation
    40 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uDebug, uMisc, uConsole;
    41 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uDebug, uMisc, uConsole, uScript;
    41 
    42 
    42 var DamageClan  : Longword = 0;
    43 var DamageClan  : Longword = 0;
    43     DamageTotal : Longword = 0;
    44     DamageTotal : Longword = 0;
    44     DamageTurn  : Longword = 0;
    45     DamageTurn  : Longword = 0;
    45     KillsClan   : LongWord = 0;
    46     KillsClan   : LongWord = 0;
   298 
   299 
   299 	// now to console
   300 	// now to console
   300 	if winnersClan <> nil then 
   301 	if winnersClan <> nil then 
   301 		begin
   302 		begin
   302 		WriteLnToConsole('WINNERS');
   303 		WriteLnToConsole('WINNERS');
       
   304         WriteLnToConsole(inttostr(winnersClan^.TeamsNumber));
   303 		for t:= 0 to winnersClan^.TeamsNumber - 1 do
   305 		for t:= 0 to winnersClan^.TeamsNumber - 1 do
   304 			WriteLnToConsole(winnersClan^.Teams[t]^.TeamName);
   306 			WriteLnToConsole(winnersClan^.Teams[t]^.TeamName);
   305 		end
   307 		end
   306 	else
   308 	else
   307 		WriteLnToConsole('DRAW');
   309 		WriteLnToConsole('DRAW');
   308 
   310 		
   309 	WriteLnToConsole('');
   311     ScriptCall('onAchievementsDeclaration');
       
   312 end;
       
   313 
       
   314 procedure declareAchievement(id, teamname: shortstring; value: LongInt);
       
   315 begin
       
   316     if (length(id) = 0) or (length(teamname) = 0) then exit;
       
   317     WriteLnToConsole('ACHIEVEMENT');
       
   318     WriteLnToConsole(id);
       
   319     WriteLnToConsole(teamname);
       
   320     WriteLnToConsole(inttostr(value));
   310 end;
   321 end;
   311 
   322 
   312 procedure initModule;
   323 procedure initModule;
   313 begin
   324 begin
   314     TotalRounds:= -1;
   325     TotalRounds:= -1;