Exemplo n.º 1
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();
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static bool InADuel(PlayerMobile m)
        {
            for (int i = 0; i < Registry.Count; ++i)
            {
                Duel d = (Duel)Registry[i];

                if (d.InDuel(m) || d.Caller == m)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 3
0
        public void HandleDeath(object o)
        {
            PlayerMobile died = (PlayerMobile)o;

            if (Handeling == null)
            {
                return;
            }

            if (!Handeling.InDuel(died))
            {
                return;
            }

            if (!HasStarted)
            {
                return;
            }

            Handeling.EchoMessage(String.Format("{0} has been killed!", died.Name));

            int teamid = 0;
            int alive  = 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];

                if (!d_team.AllDead())
                {
                    alive += 1;
                    teamid = (int)key.Current;
                }
            }

            if (alive == 1 || alive == 0)
            {
                AllKilled = true;
                EndDuel(teamid);
            }
        }