예제 #1
0
        public void AttemptStart()
        {
            if (!CheckLoggedIn())
            {
                Handeling.Caller.SendGump(new FieldSetup_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.");
                Field_StartTimer tmr = new Field_StartTimer(Handeling, (C + 1), (A + 1));
                this.Stop();
                return;
            }
            else if (!AllDismounted())
            {
                //Handeling.EchoMessage("Not all participants are dismounted, duel start delayed.");
                //Field_StartTimer tmr = new Field_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.");
                //Field_StartTimer tmr = new Field_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.");
                Field_StartTimer tmr = new Field_StartTimer(Handeling, (C + 1), (A + 1));
                this.Stop();
                return;
            }
            FieldController avail = PickRandomArena();

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

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

                avail.StartField(Handeling);

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

            Handeling.EchoMessage(C.ToString());

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

            if (C >= Field_Config.FieldStartDelay)
            {
                C = 0;
                AttemptStart();
            }
            else
            {
                this.Stop();
                Field_StartTimer tmr = new Field_StartTimer(Handeling, (C + 1), A);
            }
        }
예제 #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
                Field_Team d_team = (Field_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(FieldSetup_Pending));
                        }
                        else if ((bool)d_team.Accepted[pm])
                        {
                            pm.CloseGump(typeof(FieldSetup_Pending));
                            pm.SendGump(new FieldSetup_Pending(this));
                        }
                        else
                        {
                            pm.CloseGump(typeof(FieldSetup_Rules_View));
                            pm.SendGump(new FieldSetup_Rules_View(this, (int)key.Current, i2));
                        }
                    }
                }
            }

            if (start)
            {
                EchoMessage("Field Duel Starting....");
                StartTimer = new Field_StartTimer(this, 1, 1);
            }
        }
예제 #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
                Field_Team d_team = (Field_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(FieldSetup_Pending));
                        }
                        else if ((bool)d_team.Accepted[pm])
                        {
                            pm.CloseGump(typeof(FieldSetup_Pending));
                            pm.SendGump(new FieldSetup_Pending(this));
                        }
                        else
                        {
                            pm.CloseGump(typeof(FieldSetup_Rules_View));
                            pm.SendGump(new FieldSetup_Rules_View(this, (int)key.Current, i2));
                        }
                    }
                }
            }

            if (start)
            {
                EchoMessage("Field Duel Starting....");
                StartTimer = new Field_StartTimer(this, 1, 1);
            }
        }
예제 #5
0
        public void AttemptStart()
        {
            if (!CheckLoggedIn())
            {
                Handeling.Caller.SendGump(new FieldSetup_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.");
                Field_StartTimer tmr = new Field_StartTimer(Handeling, (C + 1), (A + 1));
                this.Stop();
                return;
            }
            else if (!AllDismounted())
            {
                //Handeling.EchoMessage("Not all participants are dismounted, duel start delayed.");
                //Field_StartTimer tmr = new Field_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.");
                //Field_StartTimer tmr = new Field_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.");
                Field_StartTimer tmr = new Field_StartTimer(Handeling, (C + 1), (A + 1));
                this.Stop();
                return;
            }
	    FieldController avail = PickRandomArena();
		
	    if (avail == null)
            	avail = ArenaAvaiable();

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

                avail.StartField(Handeling);

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

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

            Handeling.EchoMessage(C.ToString());

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

            if (C >= Field_Config.FieldStartDelay)
            {
                C = 0;
                AttemptStart();
            }
            else
            {
                this.Stop();
                Field_StartTimer tmr = new Field_StartTimer(Handeling, (C + 1), A);
            }
        }