Example #1
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 #2
0
        public static void On_Logout(LogoutEventArgs args)
        {
            PlayerMobile pm = (PlayerMobile)args.Mobile;

            for (int i = 0; i < Registry.Count; ++i)
            {
                Duel d = (Duel)Registry[i];

                if (d.Caller == pm)
                {
                    Registry.Remove(d);
                    d.EndSelf();
                }
                else if (d.InDuel(pm))
                {
                    if (!d.InProgress)
                    {
                        d.RefundBuyIn(pm);
                        d.SendControllerSetup();
                    }
                    else
                    {
                        d.EchoMessage("A player disconnected, duel must end.");
                        d.EndSelf();
                    }
                }
            }
        }
        public void UnInvul()
        {
            if (Handeling == null)
            {
                return;
            }
            if (Handeling.Ended)
            {
                EndDuel(0);
            }

            IEnumerator key = Handeling.Teams.Keys.GetEnumerator();

            for (int i = 0; i < Handeling.Teams.Count; ++i)
            {
                key.MoveNext();
                Duel_Team d_team = (Duel_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;
                        pm.Blessed = false;
                        pm.Frozen  = false;
                    }
                }
            }

            if (HasStarted)
            {
                Handeling.EchoMessage("You can now fight!");
            }
        }
Example #4
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 DuelSetup_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 DuelSetup_Main(Handling));
                    return;
                }
                else if (!AllAlive())
                {
                    Handling.EchoMessage("Not all players participating in the duel are alive, duel start delayed.");
                    from.SendGump(new DuelSetup_Main(Handling));
                    return;
                }
                else         // Start Duel
                {
                    Handling.UpdateAllPending();
                    return;
                }
            }

            case 2:     // Rules
            {
                from.SendGump(new DuelSetup_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 >= 4)
                {
                    from.SendMessage("There is a maximum of 4 teams");
                    from.SendGump(new DuelSetup_Main(Handling));
                    return;
                }

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

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

                Duel_Team toremove = (Duel_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 DuelSetup_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 DuelSetup_Main(Handling));
                    return;
                }

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

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

            switch (info.ButtonID)
            {
            case 0:     // Close
            {
                PlayerMobile pm = (PlayerMobile)Handeling.Teams[TeamID].Players[Index];
                Handeling.Teams[TeamID].Players[Index] = "@null";
                Handeling.Teams[TeamID].Accepted.Remove(pm);
                Handeling.EchoMessage(String.Format("{0} has declined the duel, and has been removed.", pm.Name));
                Handeling.RefundBuyIn(pm);

                Handeling.SendControllerSetup();
                break;
            }

            case 1:     // Spells
            {
                from.SendGump(new DuelSetup_Rules_Spells_View(Handeling, TeamID, Index));
                break;
            }

            case 2:     // Combat Abilities
            {
                from.SendGump(new DuelSetup_Rules_Combat_View(Handeling, TeamID, Index));
                break;
            }

            case 3:     // Skills
            {
                from.SendGump(new DuelSetup_Rules_Skills_View(Handeling, TeamID, Index));
                break;
            }

            case 4:      // Weapons
            {
                from.SendGump(new DuelSetup_Rules_Weapons_View(Handeling, TeamID, Index));
                break;
            }

            case 5:     // Armor
            {
                from.SendGump(new DuelSetup_Rules_Armor_View(Handeling, TeamID, Index));
                break;
            }

            case 6:     // Items
            {
                from.SendGump(new DuelSetup_Rules_Items_View(Handeling, TeamID, Index));
                break;
            }

            case 7:     // Samurai
            {
                from.SendGump(new DuelSetup_Rules_Samurai_View(Handeling, TeamID, Index));
                break;
            }

            case 8:     // Chivalry
            {
                from.SendGump(new DuelSetup_Rules_Chivalry_View(Handeling, TeamID, Index));
                break;
            }

            case 9:     // Necromancy
            {
                from.SendGump(new DuelSetup_Rules_Necromancy_View(Handeling, TeamID, Index));
                break;
            }

            case 10:     // Ninjitsu
            {
                from.SendGump(new DuelSetup_Rules_Ninjitsu_View(Handeling, TeamID, Index));
                break;
            }

            case 11:     //Accepted
            {
                PlayerMobile pm = (PlayerMobile)Handeling.Teams[TeamID].Players[Index];
                Handeling.Teams[TeamID].Accepted[pm] = true;
                Handeling.UpdateAllPending();
                Handeling.EchoMessage(String.Format("{0} has accepted the duel.", pm.Name));
                break;
            }
            }

            if (info.ButtonID > 11)
            {
                int teamid2 = (info.ButtonID - 11);
                from.SendGump(new DuelSetup_ViewParticipants(Handeling, TeamID, Index, teamid2));
            }
        }