protected override void AnnounceWinner() { base.AnnounceWinner(); if (Players.Count == 1) { Players[0].SendGump(new BoardGameWonGump(Players[0], this)); BoardGameData.ChangeScore(GameName, Players[0], BombermanSettings.WIN_SCORE); BoardGameData.AddWin(GameName, Players[0]); BombBag bag = (BombBag)Players[0].Backpack.FindItemByType(typeof(BombBag)); if (bag != null) { //don't let players run around blowing stuff up outside the game while they wait for others to finish bag.Active = false; } PublicOverheadMessage(MessageType.Regular, 1153, false, Players[0].Name + " wins the game!"); } else { PublicOverheadMessage(MessageType.Regular, 1153, false, "It's a draw!"); } }
public void CheckForMobileVictims(Point3D location, Map map, BombBag sourcebag) { IPooledEnumerable ie = map.GetMobilesInRange(location, 0); List <Mobile> tomove = new List <Mobile>(); foreach (Mobile m in ie) { if (Players.IndexOf(m) > -1) { if (m != sourcebag.Owner) { m.SendMessage("You've been blown up by " + sourcebag.Owner.Name + "'s blast!"); //handle scoring BoardGameData.ChangeScore(GameName, sourcebag.Owner, BombermanSettings.KILL_SCORE); BoardGameData.ChangeScore(GameName, m, BombermanSettings.DEATH_SCORE); BoardGameData.AddLose(GameName, m); } else { m.SendMessage("You just blew yourself up!!"); BoardGameData.ChangeScore(GameName, m, BombermanSettings.SUICIDE_SCORE); } m.PlaySound(m.Female? 0x32E : 0x549); //0x54A - yelp1 tomove.Add(m); } } ie.Free(); foreach (Mobile m in tomove) { m.MoveToWorld(new Point3D(X - 1, Y - 1, Z), Map); m.SendGump(new BoardGameLostGump(m, this)); Players.Remove(m); BombBag bag = (BombBag)m.Backpack.FindItemByType(typeof(BombBag)); if (bag != null) { //don't let players run around blowing stuff up outside the game while they wait for others to finish bag.Active = false; } //start the timer to check for endgame, delay for 1s } //test big bomb chain! StartEndGameTimer(TimeSpan.FromSeconds(1)); }
//public BoardGameScoresGump( Mobile owner, String gameName) : this( owner, gameName, 0 ) //{ //} //public BoardGameScoresGump( Mobile owner, String gameName, int page ) : base( owner, (BoardGameControlItem)null ) //{ // _Page = page; // // AddLabel( 40, 20, 1152, "Game:" ); // // AddLabel( 140, 20, 1172, gameName); // // AddLabel( 40, 50, 1152, "Scores" ); // // _PlayerScores = BoardGameData.GetScores( gameName ); // // if( _PlayerScores == null || _PlayerScores.Count == 0 ) // { // AddLabel( 40, 80, 1152, "- NO SCORES SET YET -" ); // return; // } // // _PlayerScores.Sort(); // // _X = 20; // _Y = 80; // // _MaxPages = _PlayerScores.Count / ENTRIES_PER_PAGE + 1; // // if( _PlayerScores.Count % ENTRIES_PER_PAGE == 0 ) // { // _MaxPages -= 1; // } // // _Page = Math.Max( 0, Math.Min( _Page, _MaxPages ) ); // // int listingstart = _Page * ENTRIES_PER_PAGE; // int listingend = Math.Min( _PlayerScores.Count, (_Page + 1 ) * ENTRIES_PER_PAGE ); // // AddLabel( _X, _Y, 1152, "Name" ); // if ( gameName != "Dueling" ) // AddLabel( _X + 150, _Y, 1152, "Score" ); // AddLabel( _X+ 200, _Y, 1152, "Wins" ); // AddLabel( _X + 250, _Y, 1152, "Losses" ); // // for( int i = listingstart; i < listingend; i++ ) // { // AddLabel( _X, _Y += 20, 1152, _PlayerScores[i].Player.Name ); // if ( gameName != "Dueling" ) // AddLabel( _X + 150, _Y, 1152, _PlayerScores[i].Score.ToString() ); // AddLabel( _X + 200, _Y, 1152, _PlayerScores[i].Wins.ToString() ); // AddLabel( _X + 250, _Y, 1152, _PlayerScores[i].Losses.ToString() ); // } // // AddPageButtons(); // // AddButton( 60, Height - 40, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0 ); //} public BoardGameScoresGump(Mobile owner, BoardGameControlItem controlitem, int page) : base(owner, controlitem) { _Page = page; AddLabel(40, 20, 1152, "Game:"); AddLabel(140, 20, 1172, _ControlItem.GameName); AddLabel(40, 50, 1152, "Scores"); _PlayerScores = BoardGameData.GetScores(_ControlItem.GameName); if (_PlayerScores == null || _PlayerScores.Count == 0) { AddLabel(40, 80, 1152, "- NO SCORES SET YET -"); return; } if (_Page == 0) { _PlayerScores.Sort(); } _X = 20; _Y = 80; _MaxPages = _PlayerScores.Count / ENTRIES_PER_PAGE + 1; if (_PlayerScores.Count % ENTRIES_PER_PAGE == 0) { _MaxPages -= 1; } _Page = Math.Max(0, Math.Min(_Page, _MaxPages)); int listingstart = _Page * ENTRIES_PER_PAGE; int listingend = Math.Min(_PlayerScores.Count, (_Page + 1) * ENTRIES_PER_PAGE); AddLabel(_X, _Y, 1152, "Name"); AddLabel(_X + 150, _Y, 1152, "Score"); AddLabel(_X + 200, _Y, 1152, "Wins"); AddLabel(_X + 250, _Y, 1152, "Losses"); for (int i = listingstart; i < listingend; i++) { AddLabel(_X, _Y += 20, 1152, _PlayerScores[i].Player.Name); AddLabel(_X + 150, _Y, 1152, _PlayerScores[i].Score.ToString()); AddLabel(_X + 200, _Y, 1152, _PlayerScores[i].Wins.ToString()); AddLabel(_X + 250, _Y, 1152, _PlayerScores[i].Losses.ToString()); } AddPageButtons(); AddButton(60, Height - 40, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (info.ButtonID == 1) { BoardGameData.ResetScores(_ControlItem.GameName); _Owner.SendMessage("You have now reset all the scores."); } }
public void EndField(int teamid) { if (Handeling == null) { return; } if (EndTimer != null) { EndTimer.Stop(); } Handeling.EchoMessage(String.Format("The field duel has ended, team {0} has won!", teamid.ToString())); HasStarted = false; InUse = false; Handeling.InProgress = false; if (!Handeling.Ended) { IEnumerator key = Handeling.Teams.Keys.GetEnumerator(); for (int i = 0; i < Handeling.Teams.Count; ++i) { key.MoveNext(); Field_Team d_team = (Field_Team)Handeling.Teams[(int)key.Current]; for (int i2 = 0; i2 < d_team.Players.Count; ++i2) { if (d_team.Players[i2] != "@null") { object o = (object)d_team.Players[i2]; if (o is PlayerMobile && o != "@null") { PlayerMobile pm = (PlayerMobile)o; if (teamid != 0) { if ((int)key.Current == teamid) { //GiveHeads(pm, teamid); //BoardGameData.ChangeScore( GameName, pm, 1 ); BoardGameData.AddWin(GameName, pm); } else { //BoardGameData.ChangeScore( GameName, pm, -1 ); BoardGameData.AddLose(GameName, pm); } int score = BoardGameData.getWins(GameName, pm) - BoardGameData.getLosses(GameName, pm); BoardGameData.SetScore(GameName, pm, score); if ((int)key.Current == teamid && AllKilled && !Handeling.IsRematch) { PayBuyIn(pm, teamid); } } else if (!AllKilled && !Handeling.IsRematch) { Handeling.RefundBuyIn(pm); } Handeling.Teams[(int)key.Current].Accepted[pm] = false; ResurrectPlayer(pm); ResurrectPets(pm); LoadPlayer(pm); PlayerNoto(pm); PetNoto(pm); } } } } if (InsuredItems != null) { for (int i = 0; i < InsuredItems.Count; ++i) { Item item = (Item)InsuredItems[i]; item.Insured = true; } } if (FrozenItems != null) { for (int i = 0; i < FrozenItems.Count; ++i) { Item item = (Item)FrozenItems[i]; item.Movable = true; } } UnInvul(); } //PlayerLocations = null; //PlayerMaps = null; //PlayerItems = null; //ItemLocations = null; InsuredItems = null; FrozenItems = null; DeleteTrees(); Trees = null; DeleteTraps(); Traps = null; Handeling.UpdateAllPending(); Handeling.BuyIn = 0; Handeling.IsRematch = true; //Handeling = null; }