private static void KickPlayerFromEvent_Target(Mobile from, object o, object state) { if (o is PlayerMobile) { PlayerMobile player = (PlayerMobile)o; if (player.CurrentEvent != null) { player.CurrentEvent.RemovePlayer(player); from.SendMessage("The player has been kicked."); } else if (PvpCore.IsInDeathmatch(player)) { PvpCore.TryLeaveDM(player, true); from.SendMessage("The player has been kicked."); } else if (TournamentCore.IsInTournament(player)) { TournamentCore.TryLeaveTournament(player, true); from.SendMessage("The player has been kicked."); } else { from.SendMessage("That player is not in a game"); } } else { from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(KickPlayerFromEvent_Target), false); from.SendMessage("Target the player."); } }
public void SpawnMobile(Mobile m) { if (DMSpawnPoints.Count > 0) { DMSpawnPoint spawnPoint; do { spawnPoint = m_DMSpawnPoints[Utility.RandomMinMax(0, DMSpawnPoints.Count - 1)]; if (spawnPoint.Deleted || spawnPoint.StoneLink != this) { m_DMSpawnPoints.Remove(spawnPoint); } else { if (LatestSpawnPoint != null) { if (LatestSpawnPoint.ContainsKey(m.Serial)) { DMSpawnPoint latestSpawn; LatestSpawnPoint.TryGetValue(m.Serial, out latestSpawn); LatestSpawnPoint[m.Serial] = spawnPoint; if (m_DMSpawnPoints.Count > 1 && latestSpawn != null && spawnPoint == latestSpawn) { continue; } } else { LatestSpawnPoint.Add(m.Serial, spawnPoint); } } else { LatestSpawnPoint = new Dictionary <Serial, DMSpawnPoint> { { m.Serial, spawnPoint } } }; break; } } while (m_DMSpawnPoints.Count > 0); if (m_DMSpawnPoints.Count != 0) { m.MoveToWorld(spawnPoint.Location, spawnPoint.Map); } else { PvpCore.SendMessage(Contestants, string.Format("Error: Cannot spawn player {0} to deathmatch, no spawn points exists.", m)); RemovePlayer(m, false); } } else { PvpCore.SendMessage(Contestants, string.Format("Error: Cannot spawn player {0} to deathmatch, no spawn points exists.", m)); RemovePlayer(m, false); } }
protected override void OnTick() { if (m_DMStone != null && m_DMStone.m_Started && PvpCore.IsInDeathmatch(m_From)) { m_From.Frozen = false; m_From.Resurrect(); m_DMStone.RemovePlayer(m_From, true); } }
private static void Execute(CommandEventArgs e) { Mobile from = e.Mobile; DMStone stone = PvpCore.GetPlayerStone(e.Mobile); if (stone != null && stone.Started && PvpCore.IsInDeathmatch(from) && !from.Alive) { stone.doResurrection(from); } }
private static void KickDM_Target(Mobile from, object o) { if (o is Mobile) { Mobile mob = (Mobile)o; PvpCore.TryLeaveDM(mob, true); } else { from.SendMessage("That is not a player."); } }
protected override void OnTick() { if (m_From.Alive || !PvpCore.IsInDeathmatch(m_From)) { Stop(); } else if (m_Count <= 0) { Stop(); } else { m_From.SendMessage(String.Format(m_DeathMessage, m_Count * 10)); m_Count--; } }
private static void ScoreEvent_Command(CommandEventArgs e) { BaseGame Game = ((PlayerMobile)e.Mobile).CurrentEvent; if (Game != null) { Game.AnnounceScore(e.Mobile); } else if (PvpCore.IsInDeathmatch(e.Mobile)) { PvpCore.TryShowScoreBoard(e.Mobile); } else { e.Mobile.SendAsciiMessage("You are not in an event."); } }
public void EndDeathmatch(bool worldLoaded) { if (m_MatchTimer != null) { m_MatchTimer.Stop(); } PvpCore.RemoveRunningDM(); CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, "A deathmatch has ended"); if (m_ScoreTable != null && m_ScoreTable.Count > 0) { List <ScoreKeeper> scoreKeeperList = new List <ScoreKeeper>(m_ScoreTable.Values); scoreKeeperList.Sort(); if (scoreKeeperList[0] != null && worldLoaded) { CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, String.Format("{0} has won the deathmatch!", scoreKeeperList[0].Player.Name)); RewardPlayers(scoreKeeperList); } } if (Contestants != null && Contestants.Count > 0) { List <Mobile> removeList = new List <Mobile>(Contestants); foreach (Mobile m in removeList) { ShowScore(m); RemovePlayer(m, false); } } m_Started = false; m_AcceptingContestants = false; m_ScoreTable = new Dictionary <Serial, ScoreKeeper>(); m_LatestSpawnPoint = new Dictionary <Serial, DMSpawnPoint>(); Contestants = new List <Mobile>(); if (EndlessMatches) { Started = true; } }
public override void OnDoubleClick(Mobile from) { if (from.AccessLevel >= AccessLevel.GameMaster) { if (!m_UseSphereRules) { from.CloseGump(typeof(PvpKitRulesGump)); from.SendGump(new PvpKitRulesGump(this, "Deathmatch", PvpCore.DeathmatchVersion)); } else { from.SendAsciiMessage("Staff members can not join. If you intended to change rules, please set UseSphereRules to false first."); } } else { PvpCore.TryJoinDM(from, this); } }
private static void Execute(CommandEventArgs e) { Mobile m = e.Mobile; CustomRegion cR = m.Region as CustomRegion; if (cR != null && !cR.Controller.CanUseStuckMenu) { m.SendAsciiMessage("You cannot join the deathmatch from where you are right now"); return; } if (m.HasTrade) { m.SendLocalizedMessage(1004041); return; } if (m.Region.IsPartOf(typeof(Jail))) { m.SendLocalizedMessage(1114345, "", 0x35); // You'll need a better jailbreak plan than that! return; } if (SpellHelper.CheckCombat(m)) { m.SendAsciiMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? return; } if (m.SolidHueOverride != -1) { m.SendAsciiMessage("You cannot join an event while using a teleporter"); return; } if (m.Hits < m.HitsMax) { m.SendAsciiMessage("You must be fully healed to join the deatmatch!"); return; } PvpCore.TryJoinDM(m); }
private static void ShowScore_Target(Mobile from, object o) { if (o is PlayerMobile) { PlayerMobile pm = o as PlayerMobile; BaseGame Game = pm.CurrentEvent; if (Game != null) { Game.AnnounceScore(from); } else if (PvpCore.IsInDeathmatch(pm)) { DMStone s = PvpCore.GetPlayerStone(pm); if (s != null) { s.ShowScore(from); } } else { from.BeginTarget(-1, false, TargetFlags.None, ShowScore_Target); from.SendMessage("Target a player in a game or a deathmatch stone"); } } else if (o is DMStone) { DMStone game = (DMStone)o; if (game.Started) { game.ShowScore(from); } else { from.SendAsciiMessage("This deathmatch is not running"); } } else { from.BeginTarget(-1, false, TargetFlags.None, ShowScore_Target); from.SendMessage("Target a player in a game or a deathmatch stone"); } }
public override void AddPlayer(Mobile m) { if (m_Started && m_AcceptingContestants) { if (CheckPlayer(m)) { string joinMessage = string.Format("{0} has entered a deathmatch", m.Name); PvpCore.SendMessage(Contestants, joinMessage, true); ReadyPlayer(m); m.SendMessage(38, "If you wish to leave at any time, please say \".LeaveDM\"."); } else { m.SendMessage("You do not meet the requirements for this current match"); } } else { m.SendMessage("This event is either closed or full, please try again later"); } }
public override bool OnMoveOver(Mobile m) { if (!Visible) { return(true); } if (m == null || !m.Player) { return(true); } if (!PvpCore.IsInDeathmatch(m)) { return(true); } Visible = false; StatMod mod = m.GetStatMod(String.Format("[DM] {0}", m_PowerUp)); if (mod != null) { m.RemoveStatMod(String.Format("[DM] {0}", m_PowerUp)); } switch (m_PowerUp) { case PowerUpType.Dex: { m.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist); m.PlaySound(0x1E6); m.AddStatMod(new StatMod(StatType.Dex, String.Format("[DM] {0}", m_PowerUp), 5, TimeSpan.FromMinutes(1.0))); break; } case PowerUpType.Fury: { m.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist); m.PlaySound(0x1E6); m.AddStatMod(new StatMod(StatType.All, String.Format("[DM] {0}", m_PowerUp), 5, TimeSpan.FromMinutes(1.0))); break; } case PowerUpType.Int: { m.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist); m.PlaySound(0x1E6); m.AddStatMod(new StatMod(StatType.Int, String.Format("[DM] {0}", m_PowerUp), 5, TimeSpan.FromMinutes(1.0))); break; } case PowerUpType.Rage: { m.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist); m.PlaySound(0x1E6); m.AddStatMod(new StatMod(StatType.All, String.Format("[DM] {0}", m_PowerUp), 10, TimeSpan.FromMinutes(1.0))); break; } case PowerUpType.Spirit: { m.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist); m.PlaySound(0x1E6); m.AddStatMod(new StatMod(StatType.Int, String.Format("[DM] {0}", m_PowerUp), 15, TimeSpan.FromMinutes(1.0))); break; } case PowerUpType.Str: { m.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist); m.PlaySound(0x1E6); m.AddStatMod(new StatMod(StatType.Str, String.Format("[DM] {0}", m_PowerUp), 5, TimeSpan.FromMinutes(1.0))); break; } case PowerUpType.Supremacy: { m.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist); m.PlaySound(0x1E6); m.AddStatMod(new StatMod(StatType.All, String.Format("[DM] {0}", m_PowerUp), 20, TimeSpan.FromSeconds(20.0))); break; } } new RespawnTimer(this).Start(); return(true); }
public void RemovePlayer(Mobile m, bool kicked) { SupplySystem.RemoveEventGear(m); m.IsInEvent = false; m.Frozen = false; if (!m.Alive && m is PlayerMobile) { ((PlayerMobile)m).ForceResurrect(); } m.MoveToWorld(m_LeaveLocation, m_LeaveMap); if (m_MountCollection.ContainsKey(m.Serial)) { BaseCreature bc = m_MountCollection[m.Serial]; if (bc != null) { bc.ControlTarget = m; bc.ControlOrder = OrderType.Stay; bc.SetControlMaster(m); bc.SummonMaster = m; bc.IsStabled = false; bc.MoveToWorld(m.Location, m.Map); m.Stabled.Remove(bc); m.Aggressed.Clear(); m.Aggressors.Clear(); m.Hits = m.HitsMax; m.Stam = m.StamMax; m.Mana = m.ManaMax; m.DamageEntries.Clear(); m.Combatant = null; } } if (m_Contestants.Contains(m)) { m_Contestants.Remove(m); } if (m.NetState != null) { if (kicked) { m.SendMessage(38, "You have been kicked from the deathmatch"); } else { m.SendMessage(38, "You have left the deathmatch"); } } DMHorse.TryRemoveHorse(m); if (m_ResurrectionTimers.ContainsKey(m.Serial)) { Timer t = m_ResurrectionTimers[m.Serial]; if (t != null) { t.Stop(); m_ResurrectionTimers.Remove(m.Serial); } } //Only print the message if the match is onging if (!m_Started) { return; } string leaveMessage = ""; if (kicked) { leaveMessage = string.Format("{0} has been kicked from a deathmatch", m.Name); } else { leaveMessage = string.Format("{0} has left a deathmatch", m.Name); } PvpCore.SendMessage(Contestants, leaveMessage, true); }
private static void Execute(CommandEventArgs e) { PvpCore.TryShowScoreBoard(e.Mobile); }
private static void Execute(CommandEventArgs e) { PvpCore.TryLeaveDM(e.Mobile, false); }