public override void OnPlayerKilled(Mobile killer, Mobile killed) { if (killed == null) { return; } if (AutoRes) { // prepare the autores callback Timer.DelayCall(RespawnTime, new TimerStateCallback(XmlPoints.AutoRes_Callback), new object[] { killed, false }); } // find the player in the participants list and set their status to Dead if (m_Participants != null) { foreach (IChallengeEntry entry in m_Participants) { if (entry.Participant == killed && entry.Status != ChallengeStatus.Forfeit) { entry.Status = ChallengeStatus.Dead; // clear up their noto RefreshSymmetricNoto(killed); GameBroadcast(100314, killed.Name); // "{0} has been killed" } } } TeamLMSGump.RefreshAllGumps(this, true); // see if the game is over CheckForGameEnd(); }
public override void CheckForGameEnd() { if (Participants == null || !GameInProgress) { return; } ArrayList Remaining = new ArrayList(); // determine how many teams remain foreach (IChallengeEntry entry in Participants) { if (entry.Status == ChallengeStatus.Active) { if (!Remaining.Contains(entry.Team)) { Remaining.Add(entry.Team); } } } // and then check to see if this is the last team standing if (Remaining.Count == 1) { // declare the winner and end the game Winner = (int)Remaining[0]; GameBroadcast(100414, Winner); // "Team {0} is the winner!" AwardTeamWinnings(Winner, TotalPurse); EndGame(); TeamLMSGump.RefreshAllGumps(this, true); } if (Remaining.Count < 1) { // declare a tie and keep the fees GameBroadcast(100313); // "The match is a draw" EndGame(); TeamLMSGump.RefreshAllGumps(this, true); } }
public void CheckForDisqualification() { if (Participants == null || !GameInProgress) { return; } bool statuschange = false; foreach (IChallengeEntry entry in Participants) { if (entry.Participant == null || entry.Status == ChallengeStatus.Forfeit || entry.Status == ChallengeStatus.Disqualified) { continue; } bool hadcaution = (entry.Caution != ChallengeStatus.None); // and a map check if (entry.Participant.Map != Map) { // check to see if they are offline if (entry.Participant.Map == Map.Internal) { // then give them a little time to return before disqualification if (entry.Caution == ChallengeStatus.Offline) { // were previously out of bounds so check for disqualification // check to see how long they have been out of bounds if (DateTime.Now - entry.LastCaution > MaximumOfflineDuration) { entry.Status = ChallengeStatus.Disqualified; GameBroadcast(100308, entry.Participant.Name); // "{0} has been disqualified" RefreshSymmetricNoto(entry.Participant); statuschange = true; } } else { entry.LastCaution = DateTime.Now; statuschange = true; } entry.Caution = ChallengeStatus.Offline; } else { // changing to any other map is instant disqualification entry.Status = ChallengeStatus.Disqualified; GameBroadcast(100308, entry.Participant.Name); // "{0} has been disqualified" RefreshSymmetricNoto(entry.Participant); statuschange = true; } } else // make a range check if (m_ArenaSize > 0 && !Utility.InRange(entry.Participant.Location, Location, m_ArenaSize) || (IsInChallengeGameRegion && !(Region.Find(entry.Participant.Location, entry.Participant.Map) is ChallengeGameRegion))) { if (entry.Caution == ChallengeStatus.OutOfBounds) { // were previously out of bounds so check for disqualification // check to see how long they have been out of bounds if (DateTime.Now - entry.LastCaution > MaximumOutOfBoundsDuration) { entry.Status = ChallengeStatus.Disqualified; GameBroadcast(100308, entry.Participant.Name); // "{0} has been disqualified" RefreshSymmetricNoto(entry.Participant); statuschange = true; } } else { entry.LastCaution = DateTime.Now; // inform the player XmlPoints.SendText(entry.Participant, 100309, MaximumOutOfBoundsDuration.TotalSeconds); // "You are out of bounds! You have {0} seconds to return" statuschange = true; } entry.Caution = ChallengeStatus.OutOfBounds; } else // make a hiding check if (entry.Participant.Hidden) { if (entry.Caution == ChallengeStatus.Hidden) { // were previously hidden so check for disqualification // check to see how long they have hidden if (DateTime.Now - entry.LastCaution > MaximumHiddenDuration) { entry.Status = ChallengeStatus.Disqualified; GameBroadcast(100308, entry.Participant.Name); // "{0} has been disqualified" RefreshSymmetricNoto(entry.Participant); statuschange = true; } } else { entry.LastCaution = DateTime.Now; // inform the player XmlPoints.SendText(entry.Participant, 100310, MaximumHiddenDuration.TotalSeconds); // "You have {0} seconds become unhidden" statuschange = true; } entry.Caution = ChallengeStatus.Hidden; } else { entry.Caution = ChallengeStatus.None; } if (hadcaution && entry.Caution == ChallengeStatus.None) { statuschange = true; } } if (statuschange) { // update gumps with the new status TeamLMSGump.RefreshAllGumps(this, false); } // it is possible that the game could end like this so check CheckForGameEnd(); }