public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            case 1:                     //OK
            {
                for (int i = 0; i < m_ButtonIDs.Count; ++i)
                {
                    if (info.IsSwitched(m_ButtonIDs[i]))
                    {
                        try
                        {
                            DuelArena arena = DuelCore.Arenas[m_ButtonIDs[i] - 3];

                            BaseCreature.TeleportPets(from, arena.Home, arena.Map);

                            from.MoveToWorld(arena.Home, arena.Map);

                            from.PlaySound(0x1FE);
                        }
                        catch
                        {
                            from.SendMessage("There was a problem in using the gate. Please try again.");
                        }

                        break;
                    }
                }

                break;
            }
            }
        }
        private string GetIndexFor(DuelArena from)
        {
            for (int i = 0; i < DuelCore.Arenas.Count; ++i)
            {
                if (DuelCore.Arenas[i] == from)
                {
                    return(i.ToString());
                }
            }

            return("0");
        }
示例#3
0
        public static void LoadData()
        {
            if (File.Exists(SavePath))
            {
                using (FileStream fs = new FileStream(SavePath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    try
                    {
                        BinaryReader     br     = new BinaryReader(fs);
                        BinaryFileReader reader = new BinaryFileReader(br);

                        int version = reader.ReadInt();

                        int count = reader.ReadInt();

                        for (int i = 0; i < count; ++i)
                        {
                            Serial   serial = reader.ReadInt();
                            DuelInfo info   = new DuelInfo(null);

                            info.Deserialize(reader);

                            m_Infos.Add(serial, info);
                        }

                        count = reader.ReadInt();

                        for (int i = 0; i < count; ++i)
                        {
                            DuelArena arena = new DuelArena("Loading...");
                            arena.Deserialize(reader);

                            m_Arenas.Add(arena);
                        }

                        m_Enabled = reader.ReadBool();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                    finally
                    {
                        fs.Close();
                    }
                }
            }
        }
示例#4
0
        public void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            m_SpectatorCoords.Start = reader.ReadPoint3D();
            m_SpectatorCoords.End   = reader.ReadPoint3D();

            m_DuelCoords.Start = reader.ReadPoint3D();
            m_DuelCoords.End   = reader.ReadPoint3D();

            m_Home = reader.ReadPoint3D();
            m_Name = reader.ReadString();

            m_Map     = reader.ReadMap();
            m_Enabled = reader.ReadBool();

            m_Instance = this;
        }
        public DuelArenaEditorGump(DuelArena arena)
            : base(0, 0)
        {
            m_Arena = arena;

            this.Closable   = true;
            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;
            this.AddPage(0);
            this.AddBackground(22, 59, 411, 259, 5120);
            this.AddLabel(43, 72, 1153, @"Milt's Dueling System");
            this.AddImage(242, 62, 105);
            this.AddImage(355, 62, 106);
            this.AddImage(301, 129, 107);
            this.AddImage(273, 202, 108);
            this.AddImage(245, 129, 109);
            this.AddImage(298, 62, 110);
            this.AddImage(353, 129, 111);
            this.AddImage(321, 202, 112);
            this.AddLabel(43, 95, 792, @"-Arena Editor");
            this.AddBackground(358, 295, 101, 48, 5120);
            this.AddButton(376, 306, 4014, 4015, (int)Buttons.btnHome, GumpButtonType.Reply, 0);
            this.AddLabel(412, 308, 0, @"Home");
            this.AddButton(32, 166, 4011, 4012, (int)Buttons.btnSetArena, GumpButtonType.Reply, 0);
            this.AddLabel(76, 166, 792, @"Set arena bounds");
            this.AddButton(33, 196, 4011, 4012, (int)Buttons.btnSetSpec, GumpButtonType.Reply, 0);
            this.AddLabel(76, 196, 792, @"Set spectator bounds");
            this.AddButton(33, 226, 4011, 4012, (int)Buttons.btnSetHome, GumpButtonType.Reply, 0);
            this.AddButton(33, 256, 4011, 4012, (int)Buttons.btnShowArena, GumpButtonType.Reply, 0);
            this.AddLabel(76, 226, 792, @"Set arena home");
            this.AddLabel(76, 256, 792, @"Show arena bounds");
            this.AddButton(76, 287, 4014, 4015, (int)Buttons.btnPageDown, GumpButtonType.Reply, 0);
            this.AddButton(111, 287, 4005, 4006, (int)Buttons.btnPageUp, GumpButtonType.Reply, 1);
            this.AddLabel(149, 287, 862, @"Page 1/2");
            this.AddBackground(43, 117, 145, 24, 9350);
            this.AddTextEntry(48, 119, 137, 21, 862, 100, m_Arena.Name);
            this.AddButton(194, 119, 4011, 4012, (int)Buttons.btnSubmitName, GumpButtonType.Reply, 0);
        }
示例#6
0
        public DuelArenaEditorGump2(DuelArena arena)
            : base(0, 0)
        {
            m_Arena = arena;

            this.Closable   = true;
            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;
            this.AddPage(0);
            this.AddBackground(22, 59, 411, 259, 5120);
            this.AddLabel(43, 72, 1153, @"Milt's Dueling System");
            this.AddImage(242, 62, 105);
            this.AddImage(355, 62, 106);
            this.AddImage(301, 129, 107);
            this.AddImage(273, 202, 108);
            this.AddImage(245, 129, 109);
            this.AddImage(298, 62, 110);
            this.AddImage(353, 129, 111);
            this.AddImage(321, 202, 112);
            this.AddLabel(43, 95, 792, @"-Arena Editor");
            this.AddBackground(358, 295, 101, 48, 5120);
            this.AddButton(376, 306, 4014, 4015, (int)Buttons.btnHome, GumpButtonType.Page, 0);
            this.AddLabel(412, 308, 0, @"Home");
            this.AddButton(32, 166, 4011, 4012, (int)Buttons.btnShowSpec, GumpButtonType.Reply, 0);
            this.AddLabel(76, 166, 792, @"Show spectator bounds");
            this.AddButton(33, 196, 4011, 4012, (int)Buttons.btnStop, GumpButtonType.Reply, 0);
            this.AddLabel(76, 196, 792, @"Stop current duel");
            this.AddButton(33, 226, 4011, 4012, (int)Buttons.btnEnable, GumpButtonType.Reply, 0);
            this.AddButton(33, 256, 4011, 4012, (int)Buttons.btnDelete, GumpButtonType.Reply, 0);
            this.AddLabel(50, 120, 862, m_Arena.Name);
            this.AddLabel(76, 226, 792, String.Format("Enable/Disable arena ({0})", m_Arena.Enabled ? "Enabled" : "Disabled"));
            this.AddLabel(76, 256, 792, @"Delete arena");
            this.AddButton(76, 287, 4014, 4015, (int)Buttons.btnPageDown, GumpButtonType.Reply, 0);
            this.AddButton(111, 287, 4005, 4006, (int)Buttons.btnPageUp, GumpButtonType.Reply, 0);
            this.AddLabel(149, 287, 862, @"Page 2/2");
        }
 public DuelSpectatorRegion(DuelArena arena, Map map, params Rectangle3D[] area) : base(arena.Name + " - Spectator", map, 51, area)
 {
     m_Arena = arena;
 }
示例#8
0
        public static void InitializeDuel(Duel duel)
        {
            if (duel.Attacker == null || duel.Defender == null)
            {
                CancelDuel(duel);
                return;
            }

            List <DuelArena> open = new List <DuelArena>();

            for (int i = 0; i < m_Arenas.Count; ++i)
            {
                if (m_Arenas[i].Usable)
                {
                    open.Add(m_Arenas[i]);
                }
            }

            if (open.Count == 0)
            {
                duel.Attacker.SendMessage("There were no available arenas to duel in. Please try again later.");
                duel.Defender.SendMessage("There were no available arenas to duel in. Please try again later.");
                CancelDuel(duel);
                return;
            }

            DuelArena arena = open[Utility.Random(open.Count)];             //Random open arena

            arena.Duel = duel;
            duel.Arena = arena;

            PrepareFighter(duel.Attacker, duel);
            PrepareFighter(duel.Defender, duel);

            GetInfo(duel.Attacker).Last = duel.Attacker.Location;
            GetInfo(duel.Defender).Last = duel.Defender.Location;

            Moongate gate = new Moongate(duel.Arena.Home, duel.Arena.Map);

            gate.Dispellable = false;
            gate.Hue         = 1015;
            gate.Name        = "a spectator gate";
            gate.MoveToWorld(duel.Attacker.Location, Map.Felucca);

            Timer.DelayCall(TimeSpan.FromSeconds(15.0), new TimerStateCallback(delegate(object state)
            {
                if (gate != null && !gate.Deleted)
                {
                    gate.Delete();
                }
            }), null);

            duel.Attacker.MoveToWorld(arena.GetAttackerLocation(), arena.Map);
            duel.Defender.MoveToWorld(arena.GetDefenderLocation(), arena.Map);

            duel.Attacker.Blessed = true;
            duel.Defender.Blessed = true;

            duel.Attacker.Frozen = true;
            duel.Defender.Frozen = true;

            WallOfStoneEast wall = new WallOfStoneEast();

            wall.MoveToWorld(arena.GetCenter(), arena.Map);

            duel.Attacker.SendMessage("The duel will start in 10 seconds.");
            duel.Defender.SendMessage("The duel will start in 10 seconds.");

            duel.State = DuelState.Duel;

            Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(FinalizeDuel), new object[] { wall, duel });
        }
示例#9
0
 public DuelArena(string name)
 {
     m_Name     = name;
     m_Instance = this;
     m_Map      = Map.Felucca;
 }
示例#10
0
 public DuelRegion(DuelArena arena, Map map, params Rectangle3D[] area) : base(arena.Name, map, 52, area)
 {
     m_Arena = arena;
 }