Esempio n. 1
0
        public bool NoneFlagged()
        {
            IEnumerator key = Handeling.Teams.Keys.GetEnumerator();

            for (int i = 0; i < Handeling.Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team team = (RVS_Team)Handeling.Teams[(int)key.Current];

                for (int i2 = 0; i2 < team.Players.Count; ++i2)
                {
                    object o = (object)team.Players[i2];

                    if (o is PlayerMobile)
                    {
                        PlayerMobile pm = (PlayerMobile)o;

                        if (pm.Combatant != null || pm.Aggressed.Count > 0)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Esempio n. 2
0
        public bool NoneInJail()
        {
            IEnumerator key = Handeling.Teams.Keys.GetEnumerator();

            for (int i = 0; i < Handeling.Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team team = (RVS_Team)Handeling.Teams[(int)key.Current];

                for (int i2 = 0; i2 < team.Players.Count; ++i2)
                {
                    object o = (object)team.Players[i2];

                    if (o is PlayerMobile)
                    {
                        PlayerMobile pm = (PlayerMobile)o;

                        if (pm.Region.IsPartOf(typeof(Server.Regions.Jail)) || pm.Map == Map.Malas)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Esempio n. 3
0
        public RVSSetup_Pending(RVS d) : base(0, 0)
        {
            Handeling = d;

            Closable  = false;
            Dragable  = true;
            Resizable = false;

            int bh = (PlayerCount() * 38);

            AddBackground(212, 177, 251, bh, 9250);
            AddBackground(219, 185, 235, (bh - 15), 9350);

            int         y   = 190;
            IEnumerator key = Handeling.Teams.Keys.GetEnumerator();

            for (int i = 0; i < Handeling.Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team d_team = (RVS_Team)Handeling.Teams[(int)key.Current];

                for (int i2 = 0; i2 < d_team.Players.Count; ++i2)
                {
                    object o = (object)d_team.Players[i2];
                    if (o is PlayerMobile)
                    {
                        PlayerMobile pm = (PlayerMobile)o;
                        AddLabel(250, y, 0, String.Format("{0}", pm.Name));
                        AddImage(225, y, ImageID((bool)d_team.Accepted[pm]));
                        y += 30;
                    }
                }
            }
        }
Esempio n. 4
0
        public bool AllAlive()
        {
            IEnumerator key = Handling.Teams.Keys.GetEnumerator();

            for (int i = 0; i < Handling.Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team team = (RVS_Team)Handling.Teams[(int)key.Current];

                for (int i2 = 0; i2 < team.Players.Count; ++i2)
                {
                    object o = (object)team.Players[i2];

                    if (o is PlayerMobile)
                    {
                        PlayerMobile pm = (PlayerMobile)o;

                        if (!pm.Alive)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Esempio n. 5
0
        public bool CheckLoggedIn()
        {
            IEnumerator key = Handling.Teams.Keys.GetEnumerator();

            for (int i = 0; i < Handling.Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team team = (RVS_Team)Handling.Teams[(int)key.Current];

                bool alllogged = true;
                for (int i2 = 0; i2 < team.Players.Count; ++i2)
                {
                    object o = (object)team.Players[i2];

                    if (o is PlayerMobile)
                    {
                        PlayerMobile pm = (PlayerMobile)o;

                        if (pm.NetState == null)
                        {
                            alllogged = false;
                            Handling.Teams[(int)key.Current].Players[i2] = "@null";
                            Handling.Teams[(int)key.Current].Accepted.Remove(pm);
                        }
                    }
                }

                if (!alllogged)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 6
0
        public RVSSetup_ViewParticipants(RVS d, int teamid, int id, int teamid2)
            : base(0, 0)
        {
            Handeling = d;
            TeamID    = teamid;
            Index     = id;

            Closable  = true;
            Dragable  = true;
            Resizable = false;

            int bh = 34 + (Handeling.Teams[teamid2].Players.Count * 20);

            AddBackground(182, 269, 205, bh, 9300);
            AddLabel(204, 276, 70, String.Format(@"View Team {0} Participants", teamid2.ToString()));

            int      y      = 47;
            RVS_Team d_team = (RVS_Team)Handeling.Teams[teamid2];

            for (int i = 0; i < d_team.Players.Count; ++i)
            {
                object o = (object)d_team.Players[i];
                if (o is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)o;
                    AddLabel(186, 297, y, String.Format(@"{0}: {1}", (i + 1).ToString(), pm.Name));
                }
                else
                {
                    AddLabel(186, 297, y, String.Format(@"{0}: Empty Slot", (i + 1).ToString()));
                }

                y += 20;
            }
        }
Esempio n. 7
0
        public int FilledTeams(RVS d)
        {
            int         filled = 0;
            IEnumerator key    = Handling.Teams.Keys.GetEnumerator();

            for (int i = 0; i < Handling.Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team d_team = (RVS_Team)Handling.Teams[(int)key.Current];

                bool hasplayers = false;
                for (int i2 = 0; i2 < d_team.Players.Count; ++i2)
                {
                    object o = (object)d_team.Players[i2];

                    if (o is PlayerMobile)
                    {
                        hasplayers = true;
                    }
                }

                if (hasplayers)
                {
                    filled += 1;
                }
            }

            return(filled);
        }
 public RVS_AddTarget(RVS d, int team, int i)
     : base(16, false, TargetFlags.None)
 {
     Handeling = d;
     TeamID    = team;
     Index     = i;
     D_Team    = (RVS_Team)Handeling.Teams[TeamID];
 }
        public int TeamPlayers(RVS_Team team)
        {
            int toreturn = 0;

            for (int i = 0; i < team.Players.Count; ++i)
            {
                if (team.Players[i] != "@null")
                    toreturn += 1;
            }

            return toreturn;
        }
Esempio n. 10
0
        public int TeamPlayers(RVS_Team team)
        {
            int toreturn = 0;

            for (int i = 0; i < team.Players.Count; ++i)
            {
                if (team.Players[i] != "@null")
                {
                    toreturn += 1;
                }
            }

            return(toreturn);
        }
Esempio n. 11
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
                RVS_Team d_team = (RVS_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(RVSSetup_Pending));
                        }
                        else if ((bool)d_team.Accepted[pm])
                        {
                            pm.CloseGump(typeof(RVSSetup_Pending));
                            pm.SendGump(new RVSSetup_Pending(this));
                        }
                        else
                        {
                            pm.CloseGump(typeof(RVSSetup_Rules_View));
                            pm.SendGump(new RVSSetup_Rules_View(this, (int)key.Current, i2));
                        }
                    }
                }
            }

            if (start)
            {
                EchoMessage("RVS Duel Starting....");
                StartTimer = new RVS_StartTimer(this, 1, 1);
            }
        }
Esempio n. 12
0
        public int PlayerCount(RVS_Team d_team)
        {
            int count = 0;

            for (int i = 0; i < d_team.Players.Count; ++i)
            {
                if (d_team.Players[i] != "@null")
                {
                    count += 1;
                }
            }

            return(count);
        }
Esempio n. 13
0
        public Dictionary <int, RVS_Team> Teams;       // Declares the dictionary to keep track of all the teams involved in the duel

        public RVS(PlayerMobile starter)               // The constructor for RVS, initializes required variables
        {
            Caller = starter;                          // sets the caller
            Teams  = new Dictionary <int, RVS_Team>(); // initializes the Teams dictionary so it does not = null
            Teams.Add(1, new RVS_Team(1));             // creates & adds two default teams 1 & 2 to the Teams dictionary
            Teams.Add(2, new RVS_Team(2));
            RVS_Team TeamOne = (RVS_Team)Teams[1];     // creates a variable reference to the default team 1

            TeamOne.AddPlayer(starter);                // adds the callers as the first player to the default team 1
            RVS_Team TeamTwo = (RVS_Team)Teams[2];     // creates a variable reference to the defualt team 2

            TeamTwo.Players.Add("@null");              // installs one empty slot into the default team 2

            InProgress = false;
            IsRematch  = false;
            Ended      = false;
        }
Esempio n. 14
0
        public bool InRVS(PlayerMobile m)
        {
            IEnumerator key = (IEnumerator)Teams.Keys.GetEnumerator();

            for (int i = 0; i < Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team team = (RVS_Team)Teams[(int)key.Current];

                if (team.Players.Contains(m))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 15
0
        public void EchoMessage(string msg)
        {
            IEnumerator key = Teams.Keys.GetEnumerator();

            for (int i = 0; i < Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team team = (RVS_Team)Teams[(int)key.Current];

                for (int i2 = 0; i2 < team.Players.Count; ++i2)
                {
                    if (team.Players[i2] != "@null")
                    {
                        PlayerMobile player = (PlayerMobile)team.Players[i2];
                        player.SendMessage(msg);
                    }
                }
            }
        }
        public RVSSetup_ParticipantSetup(RVS d, int id) : base(0, 0)
        {
            Handeling = d;
            TeamID    = id;
            D_Team    = (RVS_Team)Handeling.Teams[TeamID];

            Closable  = true;
            Dragable  = true;
            Resizable = false;

            int bh = 121 + (D_Team.Size * 20);

            AddBackground(115, 85, 215, bh, 9300);
            AddLabel(164, 91, 70, @"Participant Setup");
            AddLabel(123, 113, 113, String.Format(@"Team Size: {0}", D_Team.Size.ToString()));

            AddButton(145, 138, 1209, 1210, 1, GumpButtonType.Reply, 0);
            AddLabel(166, 135, 144, @"Increase Size");
            AddButton(145, 158, 1209, 1210, 2, GumpButtonType.Reply, 0);
            AddLabel(166, 155, 144, @"Decrease Size");

            AddLabel(177, 180, 70, @"Team Players");
            int y = 204, bi = 3;

            for (int i = 0; i < D_Team.Size; ++i)
            {
                if (Handeling.Teams[TeamID].Players[i] == "@null")
                {
                    AddLabel(144, (y - 3), 254, String.Format(@"{0}: Empty", (i + 1).ToString()));
                }
                else
                {
                    PlayerMobile pm = (PlayerMobile)D_Team.Players[i];
                    AddLabel(144, (y - 3), 254, String.Format(@"{0}: {1}", (i + 1).ToString(), pm.Name));
                }
                AddButton(123, y, 1209, 1210, bi, GumpButtonType.Reply, 0);

                y  += 20;
                bi += 1;
            }
        }
Esempio n. 17
0
        public int PlayerCount()
        {
            int         count = 0;
            IEnumerator key   = Handeling.Teams.Keys.GetEnumerator();

            for (int i = 0; i < Handeling.Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team d_team = (RVS_Team)Handeling.Teams[(int)key.Current];

                for (int i2 = 0; i2 < d_team.Players.Count; ++i2)
                {
                    if (d_team.Players[i2] != "@null")
                    {
                        count += 1;
                    }
                }
            }

            return(count);
        }
Esempio n. 18
0
        public static bool IsEnemy(PlayerMobile from, PlayerMobile target)
        {
            for (int i = 0; i < Registry.Count; ++i)
            {
                RVS d = (RVS)Registry[i];

                IEnumerator key = d.Teams.Keys.GetEnumerator();
                for (int i2 = 0; i2 < d.Teams.Count; ++i2)
                {
                    key.MoveNext();
                    RVS_Team d_team = (RVS_Team)d.Teams[(int)key.Current];

                    if (d_team.Players.Contains(from) && !d_team.Players.Contains(target) || !d_team.Players.Contains(from) && d_team.Players.Contains(target))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 19
0
        public static bool RVSStarted(PlayerMobile pm)
        {
            for (int i = 0; i < Registry.Count; ++i)
            {
                RVS d = (RVS)Registry[i];

                IEnumerator key = d.Teams.Keys.GetEnumerator();
                for (int i2 = 0; i2 < d.Teams.Count; ++i2)
                {
                    key.MoveNext();
                    RVS_Team d_team = (RVS_Team)d.Teams[(int)key.Current];

                    if (d_team.Players.Contains(pm) && d.InProgress)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 20
0
        public void SendControllerSetup()
        {
            if (IsRematch)
            {
                EndSelf();
                return;
            }
            PauseRVS();

            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
                RVS_Team d_team = (RVS_Team)Teams[(int)key.Current]; // creates a variable referencing the currently iterated team

                for (int i2 = 0; i2 < d_team.Players.Count; ++i2)
                {
                    object o = (object)d_team.Players[i2];

                    if (o is PlayerMobile)
                    {
                        PlayerMobile pm = (PlayerMobile)d_team.Players[i2];

                        if (pm == Caller)
                        {
                            pm.CloseGump(typeof(RVSSetup_Pending));
                            pm.SendGump(new RVSSetup_Main(this));
                        }
                        else
                        {
                            pm.CloseGump(typeof(RVSSetup_Pending));
                            pm.CloseGump(typeof(RVSSetup_Rules_View));
                        }
                    }
                }
            }

            EchoMessage("A player has left the RVS duel, start has been delayed.");
        }
Esempio n. 21
0
        public RVSSetup_Main(RVS d) : base(0, 0)
        {
            Handling = d;

            Closable  = true;
            Dragable  = true;
            Resizable = false;

            int bh = 165 + (Handling.Teams.Count * 20);

            AddBackground(281, 144, 279, bh, 9300);
            AddLabel(381, 151, 70, @"RVS Setup");
            AddLabel(315, 172, 40, @"Rules");
            AddLabel(315, 192, 70, @"Start RVS");
            //AddLabel(315, 212, 53, @"Set Buy In");
            //AddLabel(315, 232, 104, @"Add A Team");
            //AddLabel(315, 252, 142, @"Remove A Team");
            AddLabel(376, 278, 104, @"Participants");
            AddButton(290, 175, 1209, 1210, 2, GumpButtonType.Reply, 0); // Rules
            AddButton(290, 195, 1209, 1210, 1, GumpButtonType.Reply, 0); // Start RVS
            //AddButton(290, 215, 1209, 1210, 5, GumpButtonType.Reply, 0); // Set Buy In
            //AddButton(290, 235, 1209, 1210, 3, GumpButtonType.Reply, 0); // Add A Team
            //AddButton(290, 255, 1209, 1210, 4, GumpButtonType.Reply, 0); // Remove A Team

            int         y   = 298;
            int         id  = 6;
            IEnumerator key = Handling.Teams.Keys.GetEnumerator();

            for (int i = 0; i < Handling.Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team team = (RVS_Team)Handling.Teams[(int)key.Current];
                AddLabel(315, (y - 3), 104, String.Format(@"Team {0}: {1} out of {2} players", team.TeamID.ToString(), TeamPlayers(team).ToString(), team.Size.ToString()));
                AddButton(290, y, 1209, 1210, id, GumpButtonType.Reply, 0); // View A Team

                y  += 20;
                id += 1;
            }
        }
Esempio n. 22
0
        public bool IsEnemy(PlayerMobile from, PlayerMobile to)
        {
            bool        isaenemy = false;
            IEnumerator key      = (IEnumerator)Teams.Keys.GetEnumerator();

            for (int i = 0; i < Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team team = (RVS_Team)Teams[(int)key.Current];

                if (team.Players.Contains(from) && !team.Players.Contains(to))
                {
                    isaenemy = true;
                }
            }

            if (isaenemy)
            {
                return(true);
            }

            return(false);
        }
		public RVSSetup_ParticipantSetup(RVS d, int id) : base(0, 0)
		{
            Handeling = d;
            TeamID = id;
            D_Team = (RVS_Team)Handeling.Teams[TeamID];

			Closable = true;
			Dragable = true;
			Resizable = false;

            int bh = 121 + (D_Team.Size * 20);
            AddBackground(115, 85, 215, bh, 9300);
            AddLabel(164, 91, 70, @"Participant Setup");
            AddLabel(123, 113, 113, String.Format(@"Team Size: {0}", D_Team.Size.ToString()));

            AddButton(145, 138, 1209, 1210, 1, GumpButtonType.Reply, 0);
            AddLabel(166, 135, 144, @"Increase Size");
            AddButton(145, 158, 1209, 1210, 2, GumpButtonType.Reply, 0);
            AddLabel(166, 155, 144, @"Decrease Size");

            AddLabel(177, 180, 70, @"Team Players");
            int y = 204, bi = 3;
            for (int i = 0; i < D_Team.Size; ++i)
            {
                if (Handeling.Teams[TeamID].Players[i] == "@null")
                    AddLabel(144, (y - 3), 254, String.Format(@"{0}: Empty", (i +1).ToString()));
                else
                {
                    PlayerMobile pm = (PlayerMobile)D_Team.Players[i];
                    AddLabel(144, (y - 3), 254, String.Format(@"{0}: {1}", (i + 1).ToString(), pm.Name));
                }
                AddButton(123, y, 1209, 1210, bi, GumpButtonType.Reply, 0);

                y += 20;
                bi += 1;
            }
		}
        public RVSSetup_AddParticipant(RVS d, int team, int i)
            : base(0, 0)
        {
            Handeling = d;
            TeamID    = team;
            Index     = i;
            D_Team    = (RVS_Team)Handeling.Teams[TeamID];

            Closable  = true;
            Dragable  = true;
            Resizable = false;

            AddBackground(187, 187, 260, 216, 9300);
            AddLabel(239, 193, 40, @"Incoming RVS Challenge");

            AddHtml(192, 217, 248, 85, @"You have been challenged to a duel by another player, you can choose to either accept or decline this challenge. If you choose to accept the challenge  you will be added to the duel, if you choose to decline the challenge you will not be added to the duel. To accept some duel's you must pay a lump sum, this is known as dueling for cash, the gold is given to the winning team of the duel.", (bool)true, (bool)true);
            AddLabel(200, 310, 33, String.Format(@"Challenger: {0}", Handeling.Caller.Name));
            AddLabel(200, 330, 54, String.Format(@"Buy In: {0}gp", Handeling.BuyIn.ToString()));

            AddButton(200, 360, 1209, 1210, 1, GumpButtonType.Reply, 0);
            AddLabel(225, 357, 42, @"I will accept the duel");
            AddButton(200, 380, 1209, 1210, 2, GumpButtonType.Reply, 0);
            AddLabel(225, 377, 67, @"I will decline the duel");
        }
Esempio n. 25
0
        public bool AllAccepted()
        {
            IEnumerator key = Teams.Keys.GetEnumerator();

            for (int i = 0; i < Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team team = (RVS_Team)Teams[(int)key.Current];

                for (int i2 = 0; i2 < team.Players.Count; ++i2)
                {
                    object o = (object)team.Players[i2];
                    if (o is PlayerMobile)
                    {
                        if (!(bool)team.Accepted[(PlayerMobile)o])
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Esempio n. 26
0
        public RVSSetup_Rules_View(RVS d, int team, int id)
            : base(0, 0)
        {
            Handeling = d;
            TeamID    = team;
            Index     = id;

            Closable  = false;
            Dragable  = true;
            Resizable = false;

            int bh = 309 + (20 * Handeling.Teams.Count);

            AddBackground(221, 179, 194, bh, 9300);
            AddLabel(266, 186, 70, @"View RVS Rules");

            AddButton(225, 209, 1209, 1210, 11, GumpButtonType.Reply, 0);
            AddLabel(245, 206, 57, @"I accept these rules");
            AddButton(225, 230, 1209, 1210, 0, GumpButtonType.Reply, 0);
            AddLabel(245, 227, 38, @"I do not accept these rules");

            AddButton(225, 256, 1209, 1210, 1, GumpButtonType.Reply, 0);
            AddLabel(245, 253, 54, @"Monster Types");
            //AddButton(225, 256, 1209, 1210, 1, GumpButtonType.Reply, 0);
            //AddLabel(245, 253, 54, @"Spells");
            //AddCheck(225, 256, 1209, 1210, Handeling.Weapons, 1);
            //AddLabel(245, 253, 54, @"Rabbits Vs Sheep");
            //AddButton(225, 276, 1209, 1210, 2, GumpButtonType.Reply, 0);
            //AddLabel(245, 273, 54, @"Combat Abilities");
            //AddCheck(225, 276, 1209, 1210, Handeling.Weapons, 1);
            //AddLabel(245, 273, 54, @"Orc Massacre");
            //AddButton(225, 296, 1209, 1210, 3, GumpButtonType.Reply, 0);
            //AddLabel(245, 293, 54, @"Skills");
            //AddCheck(225, 296, 1209, 1210, Handeling.Weapons, 1);
            //AddLabel(245, 293, 54, @"Lizardmen Lair");
            //AddButton(225, 316, 1209, 1210, 4, GumpButtonType.Reply, 0);
            //AddLabel(245, 313, 54, @"Weapons");
            //AddCheck(225, 316, 1209, 1210, Handeling.Weapons, 1);
            //AddLabel(245, 313, 54, @"Ratmen Rampage");
            //AddButton(225, 336, 1209, 1210, 5, GumpButtonType.Reply, 0);
            //AddLabel(245, 333, 54, @"Armor");
            //AddCheck(225, 336, 1209, 1210, Handeling.Weapons, 1);
            //AddLabel(245, 333, 54, @"Dark Ritual");
            //AddButton(225, 356, 1209, 1210, 6, GumpButtonType.Reply, 0);
            //AddLabel(245, 353, 54, @"Items");
            //AddLabel(325, 376, 1263, Handeling.AllowTrees.ToString() );
            //AddLabel(245, 373, 54, @"Allow Trees=");
            //AddLabel(245, 393, 54, Handeling.NumberOfTrees.ToString() );
            //AddLabel(325, 410, 1263, Handeling.AllowTraps.ToString() );
            //AddLabel(245, 407, 54, @"Allow Traps=");
            //AddLabel(245, 427, 54, Handeling.NumberOfTraps.ToString() );
            //AddButton(225, 376, 1209, 1210, 7, GumpButtonType.Reply, 0);
            //AddLabel(245, 373, 54, @"Samurai Spells");
            //AddButton(225, 396, 1209, 1210, 8, GumpButtonType.Reply, 0);
            //AddLabel(245, 393, 54, @"Chivalry");
            //AddButton(225, 416, 1209, 1210, 9, GumpButtonType.Reply, 0);
            //AddLabel(245, 413, 54, @"Necromancy");
            //AddButton(225, 436, 1209, 1210, 10, GumpButtonType.Reply, 0);
            //AddLabel(245, 433, 54, @"Ninja Spells");

            AddLabel(256, 463, 70, @"View Participants");
            int         y = 486, bid = 12;
            IEnumerator key = Handeling.Teams.Keys.GetEnumerator();

            for (int i = 0; i < Handeling.Teams.Count; ++i)
            {
                key.MoveNext();
                RVS_Team d_team = (RVS_Team)Handeling.Teams[(int)key.Current];
                AddButton(225, y, 1209, 1210, bid, GumpButtonType.Reply, 0);
                AddLabel(245, (y - 3), 12, String.Format(@"Team {0}: {1} out of {2} players", d_team.TeamID.ToString(), TeamPlayers(d_team).ToString(), d_team.Size.ToString()));

                y   += 20;
                bid += 1;
            }
        }
        public RVSSetup_AddParticipant(RVS d, int team, int i)
            : base(0, 0)
        {
            Handeling = d;
            TeamID = team;
            Index = i;
            D_Team = (RVS_Team)Handeling.Teams[TeamID];

            Closable = true;
            Dragable = true;
            Resizable = false;

            AddBackground(187, 187, 260, 216, 9300);
            AddLabel(239, 193, 40, @"Incoming RVS Challenge");

            AddHtml(192, 217, 248, 85, @"You have been challenged to a duel by another player, you can choose to either accept or decline this challenge. If you choose to accept the challenge  you will be added to the duel, if you choose to decline the challenge you will not be added to the duel. To accept some duel's you must pay a lump sum, this is known as dueling for cash, the gold is given to the winning team of the duel.", (bool)true, (bool)true);
            AddLabel(200, 310, 33, String.Format(@"Challenger: {0}", Handeling.Caller.Name));
            AddLabel(200, 330, 54, String.Format(@"Buy In: {0}gp", Handeling.BuyIn.ToString()));

            AddButton(200, 360, 1209, 1210, 1, GumpButtonType.Reply, 0);
            AddLabel(225, 357, 42, @"I will accept the duel");
            AddButton(200, 380, 1209, 1210, 2, GumpButtonType.Reply, 0);
            AddLabel(225, 377, 67, @"I will decline the duel");
        }
 public RVS_AddTarget(RVS d, int team, int i)
     : base(16, false, TargetFlags.None)
 {
     Handeling = d;
     TeamID = team;
     Index = i;
     D_Team = (RVS_Team)Handeling.Teams[TeamID];
 }
Esempio n. 29
0
        public void EndSelf()
        {
            if (Ended)
            {
                return;
            }

            if (InProgress)
            {
                Controller.EndRVS(0);
            }

            Ended = true;

            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
                RVS_Team d_team = (RVS_Team)Teams[(int)key.Current]; // creates a variable referencing the currently iterated team

                for (int i2 = 0; i2 < d_team.Players.Count; ++i2)
                {
                    object o = (object)d_team.Players[i2];

                    if (o is PlayerMobile)
                    {
                        PlayerMobile pm = (PlayerMobile)d_team.Players[i2];

                        RefundBuyIn(pm);

                        pm.CloseGump(typeof(RVSSetup_Main));
                        pm.CloseGump(typeof(RVSSetup_Pending));
                        pm.CloseGump(typeof(RVSSetup_ParticipantSetup));
                        pm.CloseGump(typeof(RVSSetup_AddParticipant));
                        pm.CloseGump(typeof(RVSSetup_Rules_View));
                        pm.CloseGump(typeof(RVSSetup_ViewParticipants));
                        pm.CloseGump(typeof(RVSSetup_Rules_Armor_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Combat_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Items_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Skills_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Weapons_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Spells_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Spells_1st_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Spells_2nd_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Spells_3rd_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Spells_4th_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Spells_5th_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Spells_6th_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Spells_7th_View));
                        pm.CloseGump(typeof(RVSSetup_Rules_Spells_8th_View));
                    }
                }
            }

            EchoMessage(String.Format("The RVS duel has been cancelled."));
            if (RVS_Config.Registry.Contains(this))
            {
                RVS_Config.Registry.Remove(this);
            }
        }
Esempio n. 30
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            case 0:     // Close
            {
                Handling.EndSelf();
                return;
            }

            case 1:     // Start
            {
                if (FilledTeams(Handling) < 2)
                {
                    Handling.EchoMessage("You must have at least two participating teams to start a duel.");
                    from.SendGump(new RVSSetup_Main(Handling));
                    return;
                }
                else if (!CheckLoggedIn())
                {
                    Handling.EchoMessage("One or more players participating in this duel have logged out, duel start delayed.");
                    from.SendGump(new RVSSetup_Main(Handling));
                    return;
                }
                else if (!AllAlive())
                {
                    Handling.EchoMessage("Not all players participating in the duel are alive, duel start delayed.");
                    from.SendGump(new RVSSetup_Main(Handling));
                    return;
                }
                else         // Start RVS
                {
                    Handling.UpdateAllPending();
                    return;
                }
            }

            case 2:     // Rules
            {
                from.SendGump(new RVSSetup_Rules(Handling));
                from.SendMessage("If the box next to something is checked, it is allowed.");
                return;
            }

            case 3:     // Add A Team
            {
                if (Handling.Teams.Count >= 8)
                {
                    from.SendMessage("There is a maximum of 8 teams");
                    from.SendGump(new RVSSetup_Main(Handling));
                    return;
                }

                RVS_Team toadd = new RVS_Team((Handling.Teams.Count + 1));
                toadd.Players.Add("@null");
                Handling.Teams.Add((Handling.Teams.Count + 1), toadd);
                from.SendGump(new RVSSetup_Main(Handling));
                return;
            }

            case 4:     // Remove A Team
            {
                if (Handling.Teams.Count <= 2)
                {
                    from.SendMessage("Cannot have less then 2 teams.");
                    from.SendGump(new RVSSetup_Main(Handling));
                    return;
                }

                RVS_Team toremove = (RVS_Team)Handling.Teams[Handling.Teams.Count];

                if (toremove.Players.Count <= 1 && toremove.Players[0] == "@null")
                {
                    Handling.Teams.Remove(Handling.Teams.Count);
                }
                else
                {
                    from.SendMessage("You can not remove a team that contains players, move the players to a higher team.");
                }

                from.SendGump(new RVSSetup_Main(Handling));
                return;
            }

            case 5:     // Set Buy In
            {
                if (FilledTeams(Handling) != 1)
                {
                    from.SendMessage("You cannot set the duel buy in after you have already added players.");
                    from.SendGump(new RVSSetup_Main(Handling));
                    return;
                }

                from.SendGump(new RVSSetup_SetBuyIn(Handling));
                return;
            }
            }

            if (info.ButtonID >= 6)
            {
                int id = (info.ButtonID - 5);
                from.SendGump(new RVSSetup_ParticipantSetup(Handling, id));
            }
        }
Esempio n. 31
0
		public override void OnResponse( NetState sender, RelayInfo info )
		{
			Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
                case 0: // Close
                    {
                        Handling.EndSelf();
                        return;
                    }
                case 1: // Start
                    {
                        if (FilledTeams(Handling) < 2)
                        {
                            Handling.EchoMessage("You must have at least two participating teams to start a duel.");
                            from.SendGump(new RVSSetup_Main(Handling));
                            return;
                        }
                        else if (!CheckLoggedIn())
                        {
                            Handling.EchoMessage("One or more players participating in this duel have logged out, duel start delayed.");
                            from.SendGump(new RVSSetup_Main(Handling));
                            return;
                        }
                        else if (!AllAlive())
                        {
                            Handling.EchoMessage("Not all players participating in the duel are alive, duel start delayed.");
                            from.SendGump(new RVSSetup_Main(Handling));
                            return;
                        }
                        else // Start RVS
                        {
                            Handling.UpdateAllPending();
                            return;
                        }
                    }
                case 2: // Rules
                    {
                        from.SendGump(new RVSSetup_Rules(Handling));
                        from.SendMessage("If the box next to something is checked, it is allowed.");
                        return;
                    }
                case 3: // Add A Team
                    {
                        if (Handling.Teams.Count >= 8)
                        {
                            from.SendMessage("There is a maximum of 8 teams");
                            from.SendGump(new RVSSetup_Main(Handling));
                            return;
                        }

                        RVS_Team toadd = new RVS_Team((Handling.Teams.Count + 1));
                        toadd.Players.Add("@null");
                        Handling.Teams.Add((Handling.Teams.Count + 1), toadd);
                        from.SendGump(new RVSSetup_Main(Handling));
                        return;
                    }
                case 4: // Remove A Team
                    {
                        if (Handling.Teams.Count <= 2)
                        {
                            from.SendMessage("Cannot have less then 2 teams.");
                            from.SendGump(new RVSSetup_Main(Handling));
                            return;
                        }

                        RVS_Team toremove = (RVS_Team)Handling.Teams[Handling.Teams.Count];

                        if (toremove.Players.Count <= 1 && toremove.Players[0] == "@null")
                            Handling.Teams.Remove(Handling.Teams.Count);
                        else
                            from.SendMessage("You can not remove a team that contains players, move the players to a higher team.");

                        from.SendGump(new RVSSetup_Main(Handling));
                        return;
                    }
                case 5: // Set Buy In
                    {
                        if (FilledTeams(Handling) != 1)
                        {
                            from.SendMessage("You cannot set the duel buy in after you have already added players.");
                            from.SendGump(new RVSSetup_Main(Handling));
                            return;
                        }

                        from.SendGump(new RVSSetup_SetBuyIn(Handling));
                        return;
                    }
            }

            if (info.ButtonID >= 6)
            {
                int id = (info.ButtonID - 5);
                from.SendGump(new RVSSetup_ParticipantSetup(Handling, id));
            }
		}