Ejemplo n.º 1
0
 public ArenaExitBanner(int itemid, PVPArena arena)
     : base(itemid)
 {
     Arena   = arena;
     Movable = false;
     Weight  = 0;
 }
Ejemplo n.º 2
0
        public ArenaDuel(PVPArena arena, PlayerMobile host)
        {
            Host = host;

            var entry = PVPArenaSystem.Instance.GetPlayerEntry <PlayerStatsEntry>(host);

            if (entry.Profile != null)
            {
                ConfigureFromProfile(entry.Profile);
            }
            else
            {
                ConfigureDefault();
            }

            Arena = arena;

            Teams      = new List <ArenaTeam>();
            KillRecord = new Dictionary <string, string>();
            Banned     = new List <PlayerMobile>();
            Warned     = new List <PlayerMobile>();

            Teams.Add(new ArenaTeam(host));
            Teams.Add(new ArenaTeam());

            Complete = false;
        }
Ejemplo n.º 3
0
        public static void ResetStats_OnTarget(CommandEventArgs e)
        {
            Mobile m = e.Mobile;

            m.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, (fro, targeted) =>
            {
                if (m is PlayerMobile && targeted is ArenaStone)
                {
                    ArenaStone stone = (ArenaStone)targeted;

                    if (stone.Arena != null)
                    {
                        PVPArena arena = stone.Arena;

                        BaseGump.SendGump(new GenericConfirmCallbackGump <PVPArena>((PlayerMobile)m,
                                                                                    String.Format("Reset {0} Statistics?", arena.Definition.Name),
                                                                                    "By selecting yes, you will permanently wipe the stats associated to this arena.",
                                                                                    arena,
                                                                                    null,
                                                                                    (from, a) =>
                        {
                            ColUtility.Free(a.TeamRankings);
                            ColUtility.Free(a.SurvivalRankings);
                            from.SendMessage("Arena stats cleared.");
                        }));
                    }
                }
            });
        }
Ejemplo n.º 4
0
        public ArenaDuel(GenericReader reader, PVPArena arena)
        {
            int version = reader.ReadInt();

            Arena = arena;

            Teams      = new List <ArenaTeam>();
            KillRecord = new Dictionary <string, string>();
            Banned     = new List <PlayerMobile>();
            Warned     = new List <PlayerMobile>();

            Host = reader.ReadMobile() as PlayerMobile;
            Pot  = reader.ReadInt();

            Entries              = reader.ReadInt();
            RoomType             = (RoomType)reader.ReadInt();
            BattleMode           = (BattleMode)reader.ReadInt();
            Ranked               = reader.ReadBool();
            TimeLimit            = (TimeLimit)reader.ReadInt();
            EntryFee             = (EntryFee)reader.ReadInt();
            PetSlots             = reader.ReadInt();
            RidingFlyingAllowed  = reader.ReadBool();
            RangedWeaponsAllowed = reader.ReadBool();
            SummonSpellsAllowed  = reader.ReadBool();
            FieldSpellsAllowed   = reader.ReadBool();
            PotionRules          = (PotionRules)reader.ReadInt();

            HasBegun      = reader.ReadBool();
            Complete      = reader.ReadBool();
            InPreFight    = reader.ReadBool();
            StartTime     = reader.ReadDateTime();
            EntryDeadline = reader.ReadDateTime();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                Teams.Add(new ArenaTeam(reader));
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                string a = reader.ReadString();
                string b = reader.ReadString();

                KillRecord[a] = b;
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                PlayerMobile pm = reader.ReadMobile() as PlayerMobile;

                if (pm != null)
                {
                    Warned.Add(pm);
                }
            }
        }
Ejemplo n.º 5
0
        public ArenaManager(PVPArena arena)
        {
            Title = "The Arena Manager";

            Arena    = arena;
            CantWalk = true;
        }
Ejemplo n.º 6
0
 public ArenaRegion(PVPArena arena)
     : base(String.Format("Duel Arena {0}", arena.Definition.Name),
            arena.Definition.Map,
            Region.DefaultPriority,
            arena.Definition.RegionBounds)
 {
     Arena = arena;
 }
Ejemplo n.º 7
0
        public ArenaStone(PVPArena arena)
            : base(0xEDD)
        {
            Arena = arena;

            Movable = false;
            Hue     = 1194;
        }
Ejemplo n.º 8
0
 public ArenaRegion(PVPArena arena)
     : base($"Duel Arena {arena.Definition.Name}",
            arena.Definition.Map,
            DefaultPriority,
            arena.Definition.RegionBounds)
 {
     Arena = arena;
 }
Ejemplo n.º 9
0
        public void Unregister(PVPArena arena)
        {
            if (Arenas != null)
            {
                Arenas.Remove(arena);
            }

            arena.Unregister();
        }
Ejemplo n.º 10
0
        public void Register(PVPArena arena)
        {
            if (Arenas == null)
            {
                Arenas = new List <PVPArena>();
            }

            if (!Arenas.Contains(arena))
            {
                Arenas.Add(arena);
            }
        }
Ejemplo n.º 11
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            SystemInitialized = true;

            int version = reader.ReadInt();

            if (version < 2)
            {
                InitializeArenas();
            }

            switch (version)
            {
            case 2:
            case 1:
                int c = reader.ReadInt();

                for (int i = 0; i < c; i++)
                {
                    if (BlockedArenas == null)
                    {
                        BlockedArenas = new List <string>();
                    }

                    BlockedArenas.Add(reader.ReadString());
                }
                goto case 0;

            case 0:
                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    if (Arenas == null)
                    {
                        Arenas = new List <PVPArena>();
                    }

                    if (version >= 2)
                    {
                        PVPArena arena = new PVPArena(GetDefinition(reader.ReadString()));
                        Register(arena);
                        arena.Deserialize(reader);
                    }
                    else
                    {
                        Arenas[i].Deserialize(reader);
                    }
                }
                break;
            }
        }
Ejemplo n.º 12
0
        public void AddBlockedArena(PVPArena arena)
        {
            if (BlockedArenas == null)
            {
                BlockedArenas = new List <string>();
            }

            if (!IsBlocked(arena.Definition))
            {
                Utility.WriteConsoleColor(ConsoleColor.Green, "Adding blocked EA PVP Arena: {0}", arena.Definition.Name);
                BlockedArenas.Add(arena.Definition.Name);
                Unregister(arena);
            }
        }
Ejemplo n.º 13
0
        public List <ArenaDuel> GetBookedDuels()
        {
            List <ArenaDuel> booked = new List <ArenaDuel>();

            for (var index = 0; index < Arenas.Count; index++)
            {
                PVPArena arena = Arenas[index];

                if (arena.BookedDuels.Count > 0)
                {
                    booked.AddRange(arena.BookedDuels);
                }
            }

            return(booked);
        }
Ejemplo n.º 14
0
        public void RemoveBlockedArena(ArenaDefinition def)
        {
            if (BlockedArenas == null)
            {
                return;
            }

            BlockedArenas.Remove(def.Name);

            if (Arenas == null || Arenas.Count == 0)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), () => Instance.OnTick());
            }

            PVPArena arena = new PVPArena(def);

            Instance.Register(arena);
            Utility.WriteConsoleColor(ConsoleColor.Green, "Removing blocked EA PVP Arena: {0}", arena.Definition.Name);
            arena.ConfigureArena();
        }
Ejemplo n.º 15
0
        public ArenaDuel GetBookedDuel(PlayerMobile pm)
        {
            for (var index = 0; index < Arenas.Count; index++)
            {
                PVPArena arena = Arenas[index];

                if (arena.BookedDuels.Count > 0)
                {
                    for (var i = 0; i < arena.BookedDuels.Count; i++)
                    {
                        ArenaDuel duel = arena.BookedDuels[i];

                        if (duel.IsParticipant(pm))
                        {
                            return(duel);
                        }
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 16
0
        public static void Initialize()
        {
            if (Enabled)
            {
                if (!SystemInitialized)
                {
                    InitializeArenas();
                    SystemInitialized = true;
                }

                if (Arenas != null)
                {
                    for (var index = 0; index < Arenas.Count; index++)
                    {
                        PVPArena arena = Arenas[index];

                        arena.ConfigureArena();
                    }

                    Timer.DelayCall(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), () => Instance.OnTick());
                }
            }
        }
Ejemplo n.º 17
0
        public void Unregister(PVPArena arena)
        {
            Arenas?.Remove(arena);

            arena.Unregister();
        }