Esempio n. 1
0
        public override void Deserialize(GenericReader reader)
        {
            SpecificPortalScores = new Dictionary <PortalSerial, int>();

            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                Owner = reader.ReadMobile <PlayerMobile>();

                OverallScore = reader.ReadInt();

                int count = reader.ReadInt();

                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        var p   = new PortalSerial(reader);
                        int amt = reader.ReadInt();
                        SpecificPortalScores.Add(p, amt);
                    }
                }
            }
            break;
            }
        }
Esempio n. 2
0
 public static Portal GetPortal(PortalSerial uid)
 {
     if (PortalList.ContainsKey(uid))
     {
         return(PortalList[uid]);
     }
     return(null);
 }
Esempio n. 3
0
        public Portal(PortalType ptype, DateTime date)
        {
            UID = new PortalSerial();

            PortalType          = ptype;
            DateStarted         = date;
            Mobs                = new List <Mobile>();
            PortalCrystals      = new List <PortalCrystal>();
            ParticipantsScores  = new Dictionary <PlayerMobile, int>();
            BossSpawned         = false;
            CurrentParticipants = new List <Mobile>();
            GetPortalLocation();
            StartPortal();
        }
Esempio n. 4
0
        public Portal(PortalType ptype, DateTime date)
        {
            UID = new PortalSerial();

            PortalType = ptype;
            DateStarted = date;
            Mobs = new List<Mobile>();
            PortalCrystals = new List<PortalCrystal>();
            ParticipantsScores = new Dictionary<PlayerMobile, int>();
            BossSpawned = false;
            CurrentParticipants = new List<Mobile>();
            GetPortalLocation();
            StartPortal();
        }
Esempio n. 5
0
        private static bool DeserializePortals(GenericReader reader)
        {
            reader.GetVersion();

            reader.ReadBlockDictionary(
                () =>
            {
                var c = reader.ReadTypeCreate <Portal>(reader);

                PortalSerial s = c != null ? c.UID : null;

                return(new KeyValuePair <PortalSerial, Portal>(s, c));
            },
                PortalList);

            return(true);
        }
Esempio n. 6
0
        public override void Deserialize(GenericReader reader)
        {
            Mobs                = new List <Mobile>();
            PortalCrystals      = new List <PortalCrystal>();
            ParticipantsScores  = new Dictionary <PlayerMobile, int>();
            CurrentParticipants = new List <Mobile>();
            ValidSpawnPoints    = new List <Point3D>();

            base.Deserialize(reader);

            int version = reader.ReadInt();

            UID = new PortalSerial(reader);

            switch (version)
            {
            case 0:
            {
                PortalItem      = reader.ReadItem <PortalItem>();
                PortalItem2     = reader.ReadItem <PortalItem>();
                Boss            = reader.ReadMobile <BaseCreature>();
                PortalType      = (PortalType)reader.ReadInt();
                PortalEntrance  = reader.ReadPoint3D();
                RegionName      = reader.ReadString();
                DungeonEntrance = reader.ReadPoint3D();
                DungeonMap      = reader.ReadMap();
                DateStarted     = reader.ReadDateTime();
                Status          = (PortalStatus)reader.ReadInt();
                PortalCompleted = reader.ReadBool();
                BossSpawned     = reader.ReadBool();
                _CoreTicks      = reader.ReadInt();
                Anim1           = reader.ReadMobile <FireElemental>();
                Anim2           = reader.ReadMobile <FireElemental>();

                int count = reader.ReadInt();

                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        Mobile mob = reader.ReadMobile();
                        if (!mob.Deleted)
                        {
                            ((BaseCreature)mob).Portal = this;
                            Mobs.Add(mob);
                        }
                    }
                }

                count = reader.ReadInt();

                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        var crystal = reader.ReadItem <PortalCrystal>();
                        if (!crystal.Deleted)
                        {
                            PortalCrystals.Add(crystal);
                        }
                    }
                }

                count = reader.ReadInt();

                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        var player = reader.ReadMobile <PlayerMobile>();
                        int score  = reader.ReadInt();
                        ParticipantsScores.Add(player, score);
                    }
                }
            }
            break;
            }
        }
        public override void Deserialize(GenericReader reader)
        {
            SpecificPortalScores = new Dictionary<PortalSerial, int>();

            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                {
                    Owner = reader.ReadMobile<PlayerMobile>();

                    OverallScore = reader.ReadInt();

                    int count = reader.ReadInt();

                    if (count > 0)
                    {
                        for (int i = 0; i < count; i++)
                        {
                            var p = new PortalSerial(reader);
                            int amt = reader.ReadInt();
                            SpecificPortalScores.Add(p, amt);
                        }
                    }
                }
                    break;
            }
        }
Esempio n. 8
0
 public static Portal GetPortal(PortalSerial uid)
 {
     if (PortalList.ContainsKey(uid))
         return PortalList[uid];
     return null;
 }
Esempio n. 9
0
        public override void Deserialize(GenericReader reader)
        {
            Mobs = new List<Mobile>();
            PortalCrystals = new List<PortalCrystal>();
            ParticipantsScores = new Dictionary<PlayerMobile, int>();
            CurrentParticipants = new List<Mobile>();
            ValidSpawnPoints = new List<Point3D>();

            base.Deserialize(reader);

            int version = reader.ReadInt();

            UID = new PortalSerial(reader);

            switch (version)
            {
                case 0:
                {
                    PortalItem = reader.ReadItem<PortalItem>();
                    PortalItem2 = reader.ReadItem<PortalItem>();
                    Boss = reader.ReadMobile<BaseCreature>();
                    PortalType = (PortalType) reader.ReadInt();
                    PortalEntrance = reader.ReadPoint3D();
                    RegionName = reader.ReadString();
                    DungeonEntrance = reader.ReadPoint3D();
                    DungeonMap = reader.ReadMap();
                    DateStarted = reader.ReadDateTime();
                    Status = (PortalStatus) reader.ReadInt();
                    PortalCompleted = reader.ReadBool();
                    BossSpawned = reader.ReadBool();
                    _CoreTicks = reader.ReadInt();
                    Anim1 = reader.ReadMobile<FireElemental>();
                    Anim2 = reader.ReadMobile<FireElemental>();

                    int count = reader.ReadInt();

                    if (count > 0)
                    {
                        for (int i = 0; i < count; i++)
                        {
                            Mobile mob = reader.ReadMobile();
                            if (!mob.Deleted)
                            {
                                ((BaseCreature) mob).Portal = this;
                                Mobs.Add(mob);
                            }
                        }
                    }

                    count = reader.ReadInt();

                    if (count > 0)
                    {
                        for (int i = 0; i < count; i++)
                        {
                            var crystal = reader.ReadItem<PortalCrystal>();
                            if (!crystal.Deleted)
                            {
                                PortalCrystals.Add(crystal);
                            }
                        }
                    }

                    count = reader.ReadInt();

                    if (count > 0)
                    {
                        for (int i = 0; i < count; i++)
                        {
                            var player = reader.ReadMobile<PlayerMobile>();
                            int score = reader.ReadInt();
                            ParticipantsScores.Add(player, score);
                        }
                    }
                }
                    break;
            }
        }