private static void StopEvent_Target(Mobile from, object o, object state) { if (o is BaseGame) { BaseGame game = (BaseGame)o; try { game.EndGameCommand(); from.SendMessage("The game has been stopped."); } catch (EventException e) { from.SendMessage(e.ToString()); } } else if (o is DMStone) { DMStone game = (DMStone)o; game.Started = false; } else if (o is TournamentStone) { TournamentStone game = (TournamentStone)o; game.Started = false; } else { from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(StopEvent_Target), false); from.SendMessage("Target the game stone."); } }
private static bool AllowDMJoin(Mobile from, DMStone dmStone) { if (dmStone != null) { if (dmStone.UseSphereRules) { if (dmStone.EventSupplier != null) { dmStone.AddPlayer(from); return(true); } from.SendAsciiMessage("There is no event supplier connected to the death match"); } else { from.SendGump(new PvpAcceptGump(dmStone)); return(true); } } else { from.SendMessage("Either a deathmatch has not been started or is full and not accepting players."); } return(false); }
public static void TryShowScoreBoard(Mobile from) { if (IsInDeathmatch(from)) { DMStone s = GetPlayerStone(from); if (s != null) { s.ShowScore(from); } } }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch( version ) { case 0: { m_Link = ( DMStone )reader.ReadItem(); break; } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 0: { m_Link = ( DMStone )reader.ReadItem(); break; } } }
private static void CloseEvent_Target(Mobile from, object o, object state) { if (o is BaseGame) { BaseGame game = (BaseGame)o; if (game.Open) { game.Open = false; from.SendMessage("The game has been closed."); } else { from.SendMessage("The game already closed."); } } else if (o is DMStone) { DMStone game = (DMStone)o; if (game.Started) { game.AcceptingContestants = false; from.SendAsciiMessage("The game is now closed for players"); } else { from.SendAsciiMessage("This game is not running"); } } else if (o is TournamentStone) { TournamentStone game = (TournamentStone)o; if (game.Started) { game.AcceptingContestants = false; from.SendAsciiMessage("The game is now closed for players"); } else { from.SendAsciiMessage("This game is not running"); } } else { from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(CloseEvent_Target), false); from.SendMessage("Target the game stone."); } }
private static void OpenEvent_Target(Mobile from, object o, object state) { if (o is BaseGame) { BaseGame game = (BaseGame)o; if (!game.Open) { game.Open = true; from.SendMessage("The game has been opened."); } else { from.SendMessage("The game is already open."); } } else if (o is DMStone) { DMStone game = (DMStone)o; if (game.Started) { game.AcceptingContestants = true; from.SendAsciiMessage("The game is now open for players"); } else { from.SendAsciiMessage("You must start the game first"); } } else if (o is TournamentStone) { TournamentStone game = (TournamentStone)o; if (game.Started) { game.AcceptingContestants = true; from.SendAsciiMessage("The game is now open for players"); } else { from.SendAsciiMessage("You must start the game first"); } } else { from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(OpenEvent_Target), false); from.SendMessage("Target the game stone."); } }
private static void EventSink_PlayerDeath(PlayerDeathEventArgs e) { Mobile m = e.Mobile; if (m == null) { return; } if (IsInDeathmatch(m)) { DMStone stone = GetPlayerStone(m); if (stone != null) { stone.HandleDeath(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 static bool TryJoinDM(Mobile from, DMStone dmStone) { if (Factions.Sigil.ExistsOn(from)) { from.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (IsInDeathmatch(from)) { from.SendMessage("You are already in a deathmatch. Say \"i wish to leave the deathmatch\" to leave."); } else if (from.IsInEvent) { from.SendMessage("You cannot join a tournament while in an event"); } else if (from.Spell != null) { from.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. } else if (!from.Alive) { from.SendMessage("You cannot join a deathmatch while dead."); } else if (from.IsBodyMod && !from.Body.IsHuman) { from.SendMessage("You cannot join a deathmatch while polymorphed."); } else if (DMStones.Count < 1) { from.SendMessage("No deathmatch system exists on the server."); } else if (from.AccessLevel > AccessLevel.Player) { from.SendMessage("You cannot join a deathmatch as staff"); } else { return(AllowDMJoin(from, dmStone)); } return(false); }
public static void TryLeaveDM(Mobile from, bool kicked) { if (IsInDeathmatch(from)) { DMStone s = GetPlayerStone(from); from.Frozen = false; if (!from.Alive) { from.Resurrect(); } if (s != null) { if (kicked) { s.RemovePlayer(from, true); } else { s.RemovePlayer(from, false); } } } }
private static void StartEvent_Target(Mobile from, object o, object state) { if (o is BaseGame) { BaseGame game = (BaseGame)o; if (game.Open) { try { game.StartCommand(from); } catch (EventException e) { from.SendMessage(e.ToString()); } } else { from.SendMessage("You have to open the game first."); } } else if (o is DMStone) { DMStone game = (DMStone)o; game.Started = true; } else if (o is TournamentStone) { TournamentStone game = (TournamentStone)o; game.Started = true; } else { from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(StartEvent_Target), false); from.SendMessage("Target the game stone."); } }
private static void EventSink_Speech(SpeechEventArgs e) { Mobile m = e.Mobile; if (m == null || !m.Player) { return; } if (e.Speech.ToLower().IndexOf("i wish to join the deathmatch") >= 0) { if (Factions.Sigil.ExistsOn(m)) { m.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (IsInDeathmatch(m)) { m.SendMessage("You are already in a deathmatch. Say \"i wish to leave the deathmatch\" to leave."); } else if ((( PlayerMobile )m).Young) { m.SendMessage("You cannot join a deathmatch while Young"); } else if (m.Spell != null) { m.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. } else if (!m.Alive) { m.SendMessage("You cannot join a deathmatch while dead."); } else if (DMStones.Count < 1) { m.SendMessage("No deathmatch system exists on the server."); } else { AllowDMJoin(m); } } if (e.Speech.ToLower().IndexOf("i wish to leave the deathmatch") >= 0) { if (IsInDeathmatch(m)) { DMStone s = GetPlayerStone(m); if (s != null) { s.RemovePlayer(m); } } } if (e.Speech.ToLower().IndexOf("scoreboard") >= 0) { if (IsInDeathmatch(m)) { DMStone s = GetPlayerStone(m); if (s != null) { s.ShowScore(m); } } } }