From 42c9fbf7498087f6827ed85ff9f7b5026fc3df79 Mon Sep 17 00:00:00 2001 From: mcmlxxix <> Date: Wed, 3 Jun 2009 18:30:17 +0000 Subject: [PATCH] Game now notifies you via telegram if you lose disabled "forfeit" option if game hasn't started (duh) --- xtrn/seabattle/battle.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xtrn/seabattle/battle.js b/xtrn/seabattle/battle.js index 39a6705b81..55de04f21a 100644 --- a/xtrn/seabattle/battle.js +++ b/xtrn/seabattle/battle.js @@ -163,6 +163,8 @@ function GameSession(game,join) { if(file_exists(this.game.gamefile.name)) file_remove(this.game.gamefile.name); + if(file_exists(gameroot + this.name + ".his")) + file_remove(gameroot + this.name + ".his"); } } return true; @@ -180,10 +182,12 @@ function GameSession(game,join) if(!this.game.started || this.game.turn!=this.currentplayer.id || this.game.finished) { this.menu.disable(["A"]); + this.menu.disable(["F"]); } else { this.menu.enable(["A"]); + this.menu.enable(["F"]); } } this.Commands=function() @@ -773,6 +777,7 @@ function GameSession(game,join) { ldata.losses++; gameplayers.StorePlayer(loser.id); + this.game.NotifyLoser(loser.id); } this.game.winner=winner.id; this.game.End(); @@ -1268,6 +1273,16 @@ function GameData(gamefile) this.NotifyPlayer(); return true; } + this.NotifyLoser=function(id) + { + if(!gamechat.FindUser(id)) + { + var loser=gameplayers.players[id].name; + var unum=system.matchuser(loser); + var message="\1n\1gYour fleet has been destroyed in \1c\1hSea\1n\1c-\1hBattle\1n\1g game #\1h" + this.gamenumber + "\1n\1g!\r\n\r\n"; + system.put_telegram(unum, message); + } + } this.NotifyPlayer=function() { var currentplayer=this.FindCurrentUser(); -- GitLab