hedgewars/uStats.pas
changeset 9397 7b7ee65f82ad
parent 9180 d19c09670ec8
child 9405 efc5409a141d
--- a/hedgewars/uStats.pas	Sat Aug 17 14:10:09 2013 -0400
+++ b/hedgewars/uStats.pas	Tue Aug 06 00:26:07 2013 +0400
@@ -35,9 +35,10 @@
 procedure TurnReaction;
 procedure SendStats;
 procedure hedgehogFlight(Gear: PGear; time: Longword);
+procedure declareAchievement(id, teamname: shortstring; value: LongInt);
 
 implementation
-uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uDebug, uMisc, uConsole;
+uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uDebug, uMisc, uConsole, uScript;
 
 var DamageClan  : Longword = 0;
     DamageTotal : Longword = 0;
@@ -300,13 +301,23 @@
 	if winnersClan <> nil then 
 		begin
 		WriteLnToConsole('WINNERS');
+        WriteLnToConsole(inttostr(winnersClan^.TeamsNumber));
 		for t:= 0 to winnersClan^.TeamsNumber - 1 do
 			WriteLnToConsole(winnersClan^.Teams[t]^.TeamName);
 		end
 	else
 		WriteLnToConsole('DRAW');
+		
+    ScriptCall('onAchievementsDeclaration');
+end;
 
-	WriteLnToConsole('');
+procedure declareAchievement(id, teamname: shortstring; value: LongInt);
+begin
+    if (length(id) = 0) or (length(teamname) = 0) then exit;
+    WriteLnToConsole('ACHIEVEMENT');
+    WriteLnToConsole(id);
+    WriteLnToConsole(teamname);
+    WriteLnToConsole(inttostr(value));
 end;
 
 procedure initModule;