private void CheckAloneFighter() { for (int i = 0; i < m_Areas.Count; ++i) { IPooledEnumerable eable = JoinMap.GetMobilesInBounds(m_Areas[i]); List <Mobile> players = new List <Mobile>(); foreach (Mobile mob in eable) { if (Contestants.Contains(mob)) { players.Add(mob); } } eable.Free(); if (players.Count == 1) //Alone { Mobile m = players[0]; m.MoveToWorld(WinLocation, WinMap); m.PublicOverheadMessage(MessageType.Regular, 38, true, "Skipping to next round..."); m.Blessed = true; Fighting.Remove(m); Winners.Add(m); UpdateScores(null, m); AddFighters(false); } } }
public void HandleDeath(Mobile m) { if (!m_Started) { return; } List <Mobile> opponents = new List <Mobile>(); List <Mobile> referees = new List <Mobile>(); Rectangle2D area = GetArea(m); // Rob - remove and stop the Match or EndMatch timer if (m_MatchTimers.ContainsKey(area)) { Timer t = m_MatchTimers[area]; t.Stop(); m_MatchTimers.Remove(area); } // end Rob IPooledEnumerable eable = JoinMap.GetMobilesInBounds(area); foreach (Mobile mob in eable) { if (mob != m && Contestants.Contains(mob)) { opponents.Add(mob); } else if (mob is Referee) { referees.Add(mob); } } eable.Free(); for (int i = 0; i < opponents.Count && opponents.Count <= 1; ++i) { Mobile mob = opponents[i]; UpdateScores(m, mob); mob.MoveToWorld(WinLocation, WinMap); FixPlayer(mob); mob.Blessed = true; Fighting.Remove(mob); Winners.Add(mob); //Rob -re-add gear in case gear was removed if (ForceEnd == ForceEndType.ItemRemoval && NeedRestock.Contains(mob)) { SupplySystem.RemoveEventGear(mob); SupplySystem.SupplyGear(mob, EventSupplier); NeedRestock.Remove(mob); mob.SendAsciiMessage("You have been resupplied!"); } } NeedRestock.Remove(m); // loser doesn't need a restock // end - Rob for (int i = 0; i < referees.Count; ++i) { Mobile mob = referees[i]; mob.Delete(); } Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(ResurrectPlayer), m); HandleCorpse(m); Fighting.Remove(m); RemovePlayer(m, true, false); m.LastKiller = null; AddFighters(false); }
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); }