protected override void OnTick() { count--; if (m_TournamentStone != null && m_TournamentStone.Started) { if (count <= 0) { if (m_TournamentStone.Contestants.Count >= 2) { CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, "An automated tournament has begun"); m_TournamentStone.AcceptingContestants = false; m_TournamentStone.AddFighters(true); Stop(); } else { TournamentCore.SendMessage(m_TournamentStone.Contestants, "Not enough players joined, ending tournament"); m_TournamentStone.EndTournament(false); Stop(); } } else if (count <= 10) { CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, string.Format("An automated and supplied 1v1 tournament will start in {0} minute{1}! Type .jointour to join or .watchtour to watch", count, count == 1 ? "" : "s")); } } else { Stop(); } }
public void AddFighters(bool firstRound) { if (firstRound) { m_Participants = Contestants.Count; Contestants = new List <Mobile>(RandomizeGenericList(Contestants)); //Randomize } if (Contestants.Count > 1) { if (!firstRound && Fighting.Count <= 0) { for (int i = 0; i < Winners.Count; ++i) { Winners[i].MoveToWorld(JoinLocation, JoinMap); } TournamentCore.SendMessage(Contestants, "Next round will start in 60 seconds!"); Contestants = new List <Mobile>(RandomizeGenericList(Contestants)); //Randomize Winners.Clear(); Timer.DelayCall(TimeSpan.FromSeconds(60), new TimerCallback(SpawnContestants)); } else { SpawnContestants(); } } else { EndTournament(true); } }
public void AddPlayer(Mobile m) { if (m_Started && AcceptingContestants) { string joinMessage = string.Format("{0} has entered the tournament", m.Name); TournamentCore.SendMessage(Contestants, joinMessage, true); ReadyPlayer(m); m.SendMessage(38, "If you wish to leave, please type .leavetour"); } else { m.SendMessage("This event is either closed or full, please try again later"); } }
public void RemovePlayer(Mobile m, bool defeated, bool kicked) { SupplySystem.RemoveEventGear(m); m.IsInEvent = false; m.Blessed = false; m.MoveToWorld(LeaveLocation, LeaveMap); if (Contestants.Contains(m)) { Contestants.Remove(m); } if (Fighting.Contains(m)) { Fighting.Remove(m); } if (Winners.Contains(m)) { Winners.Remove(m); } // Rob if (NeedRestock.Contains(m)) { NeedRestock.Remove(m); } // end Rob if (m.NetState != null) { if (defeated) { m.SendAsciiMessage(38, "You have been defeated"); } else if (kicked) { m.SendAsciiMessage(38, "You have been kicked from the tournament"); } else { m.SendAsciiMessage(38, "You have left the tournament"); } } //Only print the message if the match is onging if (!m_Started) { return; } string leaveMessage; if (defeated) { leaveMessage = string.Format("{0} has been defeated", m.Name); } else if (kicked) { leaveMessage = string.Format("{0} has been kicked from a tournament", m.Name); } else { leaveMessage = string.Format("{0} has left a tournament", m.Name); } TournamentCore.SendMessage(Contestants, leaveMessage, true); }