Exemple #1
0
            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();
                }
            }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
 private static void KickTour_Target(Mobile from, object o)
 {
     if (o is Mobile)
     {
         Mobile mob = (Mobile)o;
         TournamentCore.TryLeaveTournament(mob, true);
     }
     else
     {
         from.SendMessage("That is not a player.");
     }
 }
Exemple #4
0
        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");
            }
        }
Exemple #5
0
        public void EndTournament(bool worldLoaded)
        {
            if (m_CountdownTimer != null)
            {
                m_CountdownTimer.Stop();
            }

            TournamentCore.RemoveRunningTournament();
            CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, "A tournament has ended");

            if (ScoreTable != null && ScoreTable.Count > 0)
            {
                List <ScoreKeeper> scoreKeeperList = new List <ScoreKeeper>(ScoreTable.Values);

                scoreKeeperList.Sort();

                if (scoreKeeperList[0] != null && worldLoaded)
                {
                    CommandHandlers.BroadcastMessage(AccessLevel.Player, 38, String.Format("{0} has won the tournament!", scoreKeeperList[0].Player.Name));
                    RewardPlayers(scoreKeeperList);
                }
            }

            if (Contestants != null && Contestants.Count > 0)
            {
                List <Mobile> removeList = new List <Mobile>(Contestants);
                foreach (Mobile m in removeList)
                {
                    RemovePlayer(m, false, false);
                }
            }

            m_Started            = false;
            AcceptingContestants = false;

            ScoreTable    = new Dictionary <Serial, ScoreKeeper>();
            Contestants   = new List <Mobile>();
            Fighting      = new List <Mobile>();
            Winners       = new List <Mobile>();
            m_Areas       = new List <Rectangle2D>();
            m_MatchTimers = new Dictionary <Rectangle2D, Timer>();
            NeedRestock   = new List <Mobile>(); // - Rob
        }
Exemple #6
0
        private static void Execute(CommandEventArgs e)
        {
            CustomRegion cR = e.Mobile.Region as CustomRegion;
            Mobile       m  = e.Mobile;

            if (cR != null && !cR.Controller.CanUseStuckMenu)
            {
                m.SendAsciiMessage("You cannot watch the tournament from where you are right now");
                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.Hits < m.HitsMax)
            {
                m.SendAsciiMessage("You must be fully healed to watch the tournament!");
                return;
            }
            foreach (TournamentStone tStone in TournamentCore.TournamentStones)
            {
                if (tStone != null && tStone.Started)
                {
                    if (!TournamentCore.IsInTournament(m))
                    {
                        m.MoveToWorld(tStone.LeaveLocation, tStone.LeaveMap);
                    }
                    else
                    {
                        m.SendAsciiMessage("You are already in a tournament");
                    }
                    return;
                }
            }

            m.SendMessage("There is no automated tournament running to watch");
        }
Exemple #7
0
        private static void Execute(CommandEventArgs e)
        {
            CustomRegion cR = e.Mobile.Region as CustomRegion;
            Mobile       m  = e.Mobile;

            if (cR != null && !cR.Controller.CanUseStuckMenu)
            {
                m.SendAsciiMessage("You cannot join an event 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 tournament!");
                return;
            }

            TournamentCore.TryJoinTournament(m);
        }
Exemple #8
0
 public override void OnDoubleClick(Mobile from)
 {
     TournamentCore.TryJoinTournament(from, this);
 }
Exemple #9
0
        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);
        }
Exemple #10
0
 private static void Execute(CommandEventArgs e)
 {
     TournamentCore.TryLeaveTournament(e.Mobile, false);
 }