Example #1
0
        public void AttemptStart()
        {
            if (!CheckLoggedIn())
            {
                Handeling.Caller.SendGump(new DuelSetup_Main(Handeling));
                Handeling.EchoMessage("One or more players have logged out, the duel could not start.");
                this.Stop();
                return;
            }
            else if (!AllAlive())
            {
                Handeling.EchoMessage("Not all players are alive, duel start delayed.");
                Duel_StartTimer tmr = new Duel_StartTimer(Handeling, (C + 1), (A + 1));
                this.Stop();
                return;
            }
            else if (!AllDismounted())
            {
                Handeling.EchoMessage("Not all participants are dismounted, duel start delayed.");
                Duel_StartTimer tmr = new Duel_StartTimer(Handeling, (C + 1), (A + 1));
                this.Stop();
                return;
            }
            else if (!NoneFlagged())
            {
                //Handeling.EchoMessage("Some participants have been in combat to recently for the duel to start, duel start delayed.");
                //Duel_StartTimer tmr = new Duel_StartTimer(Handeling, (C + 1), (A + 1));
                //this.Stop();
                //return;
            }
            else if (!NoneInJail())
            {
                Handeling.EchoMessage("Some participants are in areas where duels cannot take place, duel start delayed.");
                Duel_StartTimer tmr = new Duel_StartTimer(Handeling, (C + 1), (A + 1));
                this.Stop();
                return;
            }
            DuelController avail = PickRandomArena();

            if (avail == null)
            {
                avail = ArenaAvaiable();
            }

            if (avail != null)
            {
                Handeling.EchoMessage("Duel starting!");

                avail.StartDuel(Handeling);

                return;
            }
            else
            {
                Handeling.Caller.SendGump(new DuelSetup_Main(Handeling));
                Handeling.EchoMessage("No arena's avaiable, please wait before trying to restart the duel.");
                this.Stop();
                return;
            }
        }
Example #2
0
        protected override void OnTick()
        {
            if (Handeling.Ended)
            {
                this.Stop();
                return;
            }

            Handeling.EchoMessage(C.ToString());

            if (A >= 4)
            {
                Handeling.Caller.SendGump(new DuelSetup_Main(Handeling));
                Handeling.EchoMessage("Duel starting timed out, please wait.");
                this.Stop();
                return;
            }

            if (C >= Duel_Config.DuelStartDelay)
            {
                C = 0;
                AttemptStart();
            }
            else
            {
                this.Stop();
                Duel_StartTimer tmr = new Duel_StartTimer(Handeling, (C + 1), A);
            }
        }
Example #3
0
        public void UpdateAllPending()
        {
            // This sub is used to send all players the required gumps to view the rules of the duel and
            // eventually accept/decline the duel, after a player has not already accepted the duel they
            // are sent the gump to accept/decline the duel, if they have accepted the duel, they are
            // sent the gump to view all the players that have/have not accepted the duel
            // if all players have accepted the duel this sub will then begin the process of starting the
            // duel

            bool        start = false;                                 // bool to determine weather to start the duel or not
            IEnumerator key   = Teams.Keys.GetEnumerator();            // creates the key variable so we can iterate through the Teams dictionary

            for (int i = 0; i < Teams.Count; ++i)                      // Iterates through the Teams dictionary using a for loop
            {
                key.MoveNext();                                        // Moves the enumerator to its next item
                Duel_Team d_team = (Duel_Team)Teams[(int)key.Current]; // creates a variable referencing the currently iterated team

                for (int i2 = 0; i2 < d_team.Players.Count; ++i2)      // creates a second for loop to iterate through all the players in the current teams
                {
                    object o = (object)d_team.Players[i2];             // creates the currently iterated object in the teams Players variable as an object to be type safe

                    if (o is PlayerMobile)                             // checks if o is infact a Player, if it isn't it is just an empty slot
                    {
                        PlayerMobile pm = (PlayerMobile)o;             // o is a playermobile so we create a variable to reference it as a playermobile

                        if (AllAccepted())
                        {
                            start = true;
                            pm.CloseGump(typeof(DuelSetup_Pending));
                        }
                        else if ((bool)d_team.Accepted[pm])
                        {
                            pm.CloseGump(typeof(DuelSetup_Pending));
                            pm.SendGump(new DuelSetup_Pending(this));
                        }
                        else
                        {
                            pm.CloseGump(typeof(DuelSetup_Rules_View));
                            pm.SendGump(new DuelSetup_Rules_View(this, (int)key.Current, i2));
                        }
                    }
                }
            }

            if (start)
            {
                EchoMessage("Duel Starting....");
                StartTimer = new Duel_StartTimer(this, 1, 1);
            }
        }
Example #4
0
        public void UpdateAllPending()
        {
            // This sub is used to send all players the required gumps to view the rules of the duel and
            // eventually accept/decline the duel, after a player has not already accepted the duel they
            // are sent the gump to accept/decline the duel, if they have accepted the duel, they are 
            // sent the gump to view all the players that have/have not accepted the duel
            // if all players have accepted the duel this sub will then begin the process of starting the
            // duel

            bool start = false; // bool to determine weather to start the duel or not
            IEnumerator key = Teams.Keys.GetEnumerator(); // creates the key variable so we can iterate through the Teams dictionary
            for (int i = 0; i < Teams.Count; ++i) // Iterates through the Teams dictionary using a for loop
            {
                key.MoveNext(); // Moves the enumerator to its next item
                Duel_Team d_team = (Duel_Team)Teams[(int)key.Current]; // creates a variable referencing the currently iterated team

                for (int i2 = 0; i2 < d_team.Players.Count; ++i2) // creates a second for loop to iterate through all the players in the current teams
                {
                    object o = (object)d_team.Players[i2]; // creates the currently iterated object in the teams Players variable as an object to be type safe

                    if (o is PlayerMobile) // checks if o is infact a Player, if it isn't it is just an empty slot
                    {
                        PlayerMobile pm = (PlayerMobile)o; // o is a playermobile so we create a variable to reference it as a playermobile

                        if (AllAccepted())
                        {
                            start = true;
                            pm.CloseGump(typeof(DuelSetup_Pending));
                        }
                        else if ((bool)d_team.Accepted[pm])
                        {
                            pm.CloseGump(typeof(DuelSetup_Pending));
                            pm.SendGump(new DuelSetup_Pending(this));
                        }
                        else
                        {
                            pm.CloseGump(typeof(DuelSetup_Rules_View));
                            pm.SendGump(new DuelSetup_Rules_View(this, (int)key.Current, i2));
                        }
                    }
                }
            }

            if (start)
            {
                EchoMessage("Duel Starting....");
                StartTimer = new Duel_StartTimer(this, 1, 1);
            }
        }
Example #5
0
        public void AttemptStart()
        {
            if (!CheckLoggedIn())
            {
                Handeling.Caller.SendGump(new DuelSetup_Main(Handeling));
                Handeling.EchoMessage("One or more players have logged out, the duel could not start.");
                this.Stop();
                return;
            }
            else if (!AllAlive())
            {
                Handeling.EchoMessage("Not all players are alive, duel start delayed.");
                Duel_StartTimer tmr = new Duel_StartTimer(Handeling, (C + 1), (A + 1));
                this.Stop();
                return;
            }
            else if (!AllDismounted())
            {
                Handeling.EchoMessage("Not all participants are dismounted, duel start delayed.");
                Duel_StartTimer tmr = new Duel_StartTimer(Handeling, (C + 1), (A + 1));
                this.Stop();
                return;
            }
            else if (!NoneFlagged())
            {
                //Handeling.EchoMessage("Some participants have been in combat to recently for the duel to start, duel start delayed.");
                //Duel_StartTimer tmr = new Duel_StartTimer(Handeling, (C + 1), (A + 1));
                //this.Stop();
                //return;
            }
	    else if (!NoneInJail())
	    {
                Handeling.EchoMessage("Some participants are in areas where duels cannot take place, duel start delayed.");
                Duel_StartTimer tmr = new Duel_StartTimer(Handeling, (C + 1), (A + 1));
                this.Stop();
                return;
            }
	    DuelController avail = PickRandomArena();
		
	    if (avail == null)
            	avail = ArenaAvaiable();

            if (avail != null)
            {
                Handeling.EchoMessage("Duel starting!");

                avail.StartDuel(Handeling);

                return;
            }
            else
            {
                Handeling.Caller.SendGump(new DuelSetup_Main(Handeling));
                Handeling.EchoMessage("No arena's avaiable, please wait before trying to restart the duel.");
                this.Stop();
                return;
            }

        }
Example #6
0
        protected override void OnTick()
        {
            if (Handeling.Ended)
            {
                this.Stop();
                return;
            }

            Handeling.EchoMessage(C.ToString());

            if (A >= 4)
            {
                Handeling.Caller.SendGump(new DuelSetup_Main(Handeling));
                Handeling.EchoMessage("Duel starting timed out, please wait.");
                this.Stop();
                return;
            }

            if (C >= Duel_Config.DuelStartDelay)
            {
                C = 0;
                AttemptStart();
            }
            else
            {
                this.Stop();
                Duel_StartTimer tmr = new Duel_StartTimer(Handeling, (C + 1), A);
            }
        }