コード例 #1
0
ファイル: DuelRegion.cs プロジェクト: seanrgraff/The-Basement
 public DuelRegion(DuelController dc)
     : base(String.Format("DuelRegion{0}", Count.ToString()), dc.ThisRegionMap, 100, dc.ThisRegionPoint)
 {
     Controller = dc;
     this.Register();
     Count += 1;
 }
コード例 #2
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;
            }
        }
コード例 #3
0
        public virtual void On_ShutDown(ShutdownEventArgs args)
        {
            for (int i = 0; i < Duel_Config.Controllers.Count; ++i)
            {
                DuelController d = (DuelController)Duel_Config.Controllers[i];

                if (d.HasStarted && d.Handeling != null)
                {
                    d.EndDuel(0);
                }
            }
        }
コード例 #4
0
        public static void InitializeRegions()
        {
            for (int i = 0; i < Controllers.Count; ++i)
            {
                DuelController controller = (DuelController)Controllers[i];

                if (controller.ThisRegion != null)
                {
                    controller.ThisRegion.Unregister();
                }

                controller.ThisRegion = new DuelRegion(controller);
            }
            Console.WriteLine("Duel regions have been initialized.");
        }
コード例 #5
0
        public DuelController PickRandomArena()
        {
            DuelController c     = Duel_Config.Controllers[Utility.Random(Duel_Config.Controllers.Count)];
            int            count = 0;

            while (c.InUse || !c.Enabled && count != 100)
            {
                c = Duel_Config.Controllers[Utility.Random(Duel_Config.Controllers.Count)];
                count++;
            }

            if (count == 100)
            {
                return(null);
            }
            else
            {
                return(c);
            }
        }