Exemple #1
0
        public override void Deserialize(GenericReader reader)
        {
            SpecificInvasionScores = new Dictionary <InvasionSerial, 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 InvasionSerial(reader);
                        int amt = reader.ReadInt();
                        SpecificInvasionScores.Add(p, amt);
                    }
                }
            }
            break;
            }
        }
 public static Invasion GetInvasion(InvasionSerial uid)
 {
     if (Invasions.ContainsKey(uid))
     {
         return(Invasions[uid]);
     }
     return(null);
 }
Exemple #3
0
        public Invasion(Invasion invasion)
        {
            UID = new InvasionSerial();

            InvasionName       = invasion.InvasionName;
            RegionName         = invasion.RegionName;
            DateStarted        = DateTime.UtcNow;
            Invaders           = new List <Mobile>();
            Status             = InvasionStatus.Waiting;
            Levels             = invasion.Levels;
            CurrentLevel       = invasion.Levels.First();
            ParticipantsScores = new Dictionary <PlayerMobile, int>();
        }
Exemple #4
0
        public Invasion(Invasion invasion)
        {
            UID = new InvasionSerial();

            InvasionName = invasion.InvasionName;
            RegionName = invasion.RegionName;
            DateStarted = DateTime.UtcNow;
            Invaders = new List<Mobile>();
            Status = InvasionStatus.Waiting;
            Levels = invasion.Levels;
            CurrentLevel = invasion.Levels.First();
            ParticipantsScores = new Dictionary<PlayerMobile, int>();
        }
Exemple #5
0
        public Invasion(string invasionname, string regionname, DateTime date, List <Level> levels, bool gates)
        {
            UID = new InvasionSerial();

            InvasionName       = invasionname;
            RegionName         = regionname;
            DateStarted        = date;
            Invaders           = new List <Mobile>();
            Status             = InvasionStatus.Waiting;
            Levels             = levels;
            CurrentLevel       = Levels.First();
            ParticipantsScores = new Dictionary <PlayerMobile, int>();
            SpawnTownGates     = gates;
            TownGates          = new List <Moongate>();
        }
Exemple #6
0
        public Invasion(string invasionname, string regionname, DateTime date, List<Level> levels, bool gates)
        {
            UID = new InvasionSerial();

            InvasionName = invasionname;
            RegionName = regionname;
            DateStarted = date;
            Invaders = new List<Mobile>();
            Status = InvasionStatus.Waiting;
            Levels = levels;
            CurrentLevel = Levels.First();
            ParticipantsScores = new Dictionary<PlayerMobile, int>();
            SpawnTownGates = gates;
            TownGates = new List<Moongate>();
        }
Exemple #7
0
        private static bool DeserializeInvasions(GenericReader reader)
        {
            reader.GetVersion();

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

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

                return(new KeyValuePair <InvasionSerial, Invasion>(s, c));
            },
                Invasions);

            return(true);
        }
 public static Invasion GetInvasion(InvasionSerial uid)
 {
     if (Invasions.ContainsKey(uid))
         return Invasions[uid];
     return null;
 }
Exemple #9
0
        public override void Deserialize(GenericReader reader)
        {
            Invaders           = new List <Mobile>();
            Levels             = new List <Level>();
            ParticipantsScores = new Dictionary <PlayerMobile, int>();
            TownGates          = new List <Moongate>();

            base.Deserialize(reader);

            int version = reader.ReadInt();

            UID = new InvasionSerial(reader);

            switch (version)
            {
            case 1:
            {
                SpawnTownGates = reader.ReadBool();
                int countgates = reader.ReadInt();

                if (countgates > 0)
                {
                    for (int i = 0; i < countgates; i++)
                    {
                        var gate = reader.ReadItem <Moongate>();
                        if (gate != null)
                        {
                            TownGates.Add(gate);
                        }
                    }
                }


                goto case 0;
            }

            case 0:
            {
                InvasionName      = reader.ReadString();
                RegionName        = reader.ReadString();
                DateStarted       = reader.ReadDateTime();
                Status            = (InvasionStatus)reader.ReadInt();
                _CoreTicks        = reader.ReadInt();
                CurrentLevelKills = reader.ReadInt();

                int count = reader.ReadInt();

                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        Mobile invader = reader.ReadMobile();
                        if (invader != null)
                        {
                            ((BaseCreature)invader).Invasion = this;
                            Invaders.Add(invader);
                        }
                    }
                }

                count = reader.ReadInt();

                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        var level = new Level(reader);
                        Levels.Add(level);
                    }
                }

                count = reader.ReadInt();

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

                CurrentLevel = new Level(reader);
            }
            break;
            }
        }
        public override void Deserialize(GenericReader reader)
        {
            SpecificInvasionScores = new Dictionary<InvasionSerial, 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 InvasionSerial(reader);
                            int amt = reader.ReadInt();
                            SpecificInvasionScores.Add(p, amt);
                        }
                    }
                }
                    break;
            }
        }
Exemple #11
0
        public override void Deserialize(GenericReader reader)
        {
            Invaders = new List<Mobile>();
            Levels = new List<Level>();
            ParticipantsScores = new Dictionary<PlayerMobile, int>();
            TownGates = new List<Moongate>();

            base.Deserialize(reader);

            int version = reader.ReadInt();

            UID = new InvasionSerial(reader);

            switch (version)
            {
                case 1:
                {
                    SpawnTownGates = reader.ReadBool();
                    int countgates = reader.ReadInt();

                    if (countgates > 0)
                    {
                        for (int i = 0; i < countgates; i++)
                        {
                            var gate = reader.ReadItem<Moongate>();
                            if (gate != null)
                            {
                                TownGates.Add(gate);
                            }
                        }
                    }


                    goto case 0;
                }
                case 0:
                {
                    InvasionName = reader.ReadString();
                    RegionName = reader.ReadString();
                    DateStarted = reader.ReadDateTime();
                    Status = (InvasionStatus) reader.ReadInt();
                    _CoreTicks = reader.ReadInt();
                    CurrentLevelKills = reader.ReadInt();

                    int count = reader.ReadInt();

                    if (count > 0)
                    {
                        for (int i = 0; i < count; i++)
                        {
                            Mobile invader = reader.ReadMobile();
                            if (invader != null)
                            {
                                ((BaseCreature) invader).Invasion = this;
                                Invaders.Add(invader);
                            }
                        }
                    }

                    count = reader.ReadInt();

                    if (count > 0)
                    {
                        for (int i = 0; i < count; i++)
                        {
                            var level = new Level(reader);
                            Levels.Add(level);
                        }
                    }

                    count = reader.ReadInt();

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

                    CurrentLevel = new Level(reader);
                }
                    break;
            }
        }