Esempio n. 1
0
 public override void Deserialize(IGenericReader reader)
 {
     base.Deserialize(reader);
     var version = reader.ReadInt();
 }
Esempio n. 2
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            {
                m_ReplenishesCharges = reader.ReadBool();

                if (m_ReplenishesCharges)
                {
                    m_LastReplenished = reader.ReadDateTime();
                }

                goto case 2;
            }

            case 2:
            {
                m_Crafter = reader.ReadEntity <Mobile>();

                m_Quality = (InstrumentQuality)reader.ReadEncodedInt();
                m_Slayer  = (SlayerName)reader.ReadEncodedInt();
                m_Slayer2 = (SlayerName)reader.ReadEncodedInt();

                UsesRemaining = reader.ReadEncodedInt();

                m_WellSound  = reader.ReadEncodedInt();
                m_BadlySound = reader.ReadEncodedInt();

                break;
            }

            case 1:
            {
                m_Crafter = reader.ReadEntity <Mobile>();

                m_Quality = (InstrumentQuality)reader.ReadEncodedInt();
                m_Slayer  = (SlayerName)reader.ReadEncodedInt();

                UsesRemaining = reader.ReadEncodedInt();

                m_WellSound  = reader.ReadEncodedInt();
                m_BadlySound = reader.ReadEncodedInt();

                break;
            }

            case 0:
            {
                m_WellSound   = reader.ReadInt();
                m_BadlySound  = reader.ReadInt();
                UsesRemaining = Utility.RandomMinMax(InitMinUses, InitMaxUses);

                break;
            }
            }

            CheckReplenishUses();
        }
Esempio n. 3
0
 public void Deserialize(IGenericReader reader)
 {
     // Should not actually be saved
     Timer.DelayCall(Delete);
 }
Esempio n. 4
0
        public FactionState(IGenericReader reader)
        {
            var version = reader.ReadEncodedInt();

            switch (version)
            {
                case 5:
                    {
                        LastAtrophy = reader.ReadDateTime();
                        goto case 4;
                    }
                case 4:
                    {
                        var count = reader.ReadEncodedInt();

                        for (var i = 0; i < count; ++i)
                        {
                            var time = reader.ReadDateTime();

                            if (i < m_LastBroadcasts.Length)
                                m_LastBroadcasts[i] = time;
                        }

                        goto case 3;
                    }
                case 3:
                case 2:
                case 1:
                    {
                        Election = new Election(reader);

                        goto case 0;
                    }
                case 0:
                    {
                        m_Faction = Faction.ReadReference(reader);

                        m_Commander = reader.ReadMobile();

                        if (version < 5)
                            LastAtrophy = DateTime.UtcNow;

                        if (version < 4)
                        {
                            var time = reader.ReadDateTime();

                            if (m_LastBroadcasts.Length > 0)
                                m_LastBroadcasts[0] = time;
                        }

                        Tithe = reader.ReadEncodedInt();
                        Silver = reader.ReadEncodedInt();

                        var memberCount = reader.ReadEncodedInt();

                        Members = new List<PlayerState>();

                        for (var i = 0; i < memberCount; ++i)
                        {
                            var pl = new PlayerState(reader, m_Faction, Members);

                            if (pl.Mobile != null)
                                Members.Add(pl);
                        }

                        m_Faction.State = this;

                        m_Faction.ZeroRankOffset = Members.Count;
                        Members.Sort();

                        for (var i = Members.Count - 1; i >= 0; i--)
                        {
                            var player = Members[i];

                            if (player.KillPoints <= 0)
                                m_Faction.ZeroRankOffset = i;
                            else
                                player.RankIndex = i;
                        }

                        FactionItems = new List<FactionItem>();

                        if (version >= 2)
                        {
                            var factionItemCount = reader.ReadEncodedInt();

                            for (var i = 0; i < factionItemCount; ++i)
                            {
                                var factionItem = new FactionItem(reader, m_Faction);

                                Timer.DelayCall(factionItem.CheckAttach); // sandbox attachment
                            }
                        }

                        Traps = new List<BaseFactionTrap>();

                        if (version >= 3)
                        {
                            var factionTrapCount = reader.ReadEncodedInt();

                            for (var i = 0; i < factionTrapCount; ++i)
                                if (reader.ReadItem() is BaseFactionTrap trap && !trap.CheckDecay())
                                    Traps.Add(trap);
                        }

                        break;
                    }
            }

            if (version < 1)
                Election = new Election(m_Faction);
        }
Esempio n. 5
0
 public virtual void ChildDeserialize(IGenericReader reader)
 {
     var version = reader.ReadEncodedInt();
 }
Esempio n. 6
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();
        }
Esempio n. 7
0
        public override void ChildDeserialize(IGenericReader reader)
        {
            int version = reader.ReadEncodedInt();

            m_MaxProgress = reader.ReadInt();
        }
Esempio n. 8
0
        public Skill(Skills owner, SkillInfo info, IGenericReader reader)
        {
            Owner = owner;
            Info  = info;

            int version = reader.ReadByte();

            switch (version)
            {
            case 0:
            {
                m_Base = reader.ReadUShort();
                m_Cap  = reader.ReadUShort();
                Lock   = (SkillLock)reader.ReadByte();

                break;
            }

            case 0xFF:
            {
                m_Base = 0;
                m_Cap  = 1000;
                Lock   = SkillLock.Up;

                break;
            }

            default:
            {
                if ((version & 0xC0) == 0x00)
                {
                    if ((version & 0x1) != 0)
                    {
                        m_Base = reader.ReadUShort();
                    }

                    if ((version & 0x2) != 0)
                    {
                        m_Cap = reader.ReadUShort();
                    }
                    else
                    {
                        m_Cap = 1000;
                    }

                    if ((version & 0x4) != 0)
                    {
                        Lock = (SkillLock)reader.ReadByte();
                    }
                }

                break;
            }
            }

            if (Lock < SkillLock.Up || Lock > SkillLock.Locked)
            {
                Console.WriteLine("Bad skill lock -> {0}.{1}", owner.Owner, Lock);
                Lock = SkillLock.Up;
            }
        }
Esempio n. 9
0
 public ReaderService(IGenericReader genericReader)
 {
     this.genericReader = genericReader;
 }
Esempio n. 10
0
        public override void Deserialize(IGenericReader reader) // Default Deserialize method
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
Esempio n. 11
0
        public MultiComponentList(IGenericReader reader)
        {
            int version = reader.ReadInt();

            m_Min  = reader.ReadPoint2D();
            m_Max  = reader.ReadPoint2D();
            Center = reader.ReadPoint2D();
            Width  = reader.ReadInt();
            Height = reader.ReadInt();

            int length = reader.ReadInt();

            MultiTileEntry[] allTiles = List = new MultiTileEntry[length];

            if (version == 0)
            {
                for (int i = 0; i < length; ++i)
                {
                    int id = reader.ReadShort();
                    if (id >= 0x4000)
                    {
                        id -= 0x4000;
                    }

                    allTiles[i].m_ItemID  = (ushort)id;
                    allTiles[i].m_OffsetX = reader.ReadShort();
                    allTiles[i].m_OffsetY = reader.ReadShort();
                    allTiles[i].m_OffsetZ = reader.ReadShort();
                    allTiles[i].m_Flags   = reader.ReadInt();
                }
            }
            else
            {
                for (int i = 0; i < length; ++i)
                {
                    allTiles[i].m_ItemID  = reader.ReadUShort();
                    allTiles[i].m_OffsetX = reader.ReadShort();
                    allTiles[i].m_OffsetY = reader.ReadShort();
                    allTiles[i].m_OffsetZ = reader.ReadShort();
                    allTiles[i].m_Flags   = reader.ReadInt();
                }
            }

            TileList[][] tiles = new TileList[Width][];
            Tiles = new StaticTile[Width][][];

            for (int x = 0; x < Width; ++x)
            {
                tiles[x] = new TileList[Height];
                Tiles[x] = new StaticTile[Height][];

                for (int y = 0; y < Height; ++y)
                {
                    tiles[x][y] = new TileList();
                }
            }

            for (int i = 0; i < allTiles.Length; ++i)
            {
                if (i == 0 || allTiles[i].m_Flags != 0)
                {
                    int xOffset = allTiles[i].m_OffsetX + Center.m_X;
                    int yOffset = allTiles[i].m_OffsetY + Center.m_Y;

                    tiles[xOffset][yOffset].Add(allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ);
                }
            }

            for (int x = 0; x < Width; ++x)
            {
                for (int y = 0; y < Height; ++y)
                {
                    Tiles[x][y] = tiles[x][y].ToArray();
                }
            }
        }
Esempio n. 12
0
 public FacialHairInfo(IGenericReader reader)
     : base(reader)
 {
 }
Esempio n. 13
0
 public HairInfo(IGenericReader reader)
     : base(reader)
 {
 }