Ejemplo n.º 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;
            }
        }
Ejemplo n.º 2
0
 public static Invasion GetInvasion(InvasionSerial uid)
 {
     if (Invasions.ContainsKey(uid))
     {
         return(Invasions[uid]);
     }
     return(null);
 }
Ejemplo n.º 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>();
        }
Ejemplo n.º 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>();
        }
Ejemplo n.º 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>();
        }
Ejemplo n.º 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>();
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 8
0
 public static Invasion GetInvasion(InvasionSerial uid)
 {
     if (Invasions.ContainsKey(uid))
         return Invasions[uid];
     return null;
 }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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;
            }
        }