Ejemplo n.º 1
0
        public Zone(ref FileStream file)
        {
            //ID
            this.ID = BinarySerializer.ReadUInt16(ref file);

            //Name
            this.Name = BinarySerializer.ReadString(ref file, Encoding.ASCII);

            //Property
            this.Property = (byte)file.ReadByte();

            //MusicID
            this.MusicID = BinarySerializer.ReadUInt16(ref file);

            //FileName
            this.FileName = BinarySerializer.ReadString(ref file, Encoding.ASCII);

            //InfoFileName
            this.InfoFileName = BinarySerializer.ReadString(ref file, Encoding.ASCII);

            //TeenFileName
            this.TeenFileName = BinarySerializer.ReadString(ref file, Encoding.ASCII);

            //SoundIDList
            UInt32 soundidlistsize = BinarySerializer.ReadUInt32(ref file);

            this.SoundIDList = new List <UInt16>();

            for (int i = 0; i < soundidlistsize; i++)
            {
                UInt16 soundid = BinarySerializer.ReadUInt16(ref file);
                this.SoundIDList.Add(soundid);
            }

            //Safety
            this.Safety = BinarySerializer.ReadBool(ref file);

            //CreatureColorSet
            this.CreatureColorSet = BinarySerializer.ReadUInt16(ref file);

            //MinimapSpriteID
            this.MinimapSpriteID = BinarySerializer.ReadUInt16(ref file);

            //HolyLand
            this.HolyLand = BinarySerializer.ReadBool(ref file);
            //ChatMaskByRace
            this.ChatMaskByRace = BinarySerializer.ReadBool(ref file);
            //CannotAttackInSafe
            this.CannotAttackInSafe = BinarySerializer.ReadBool(ref file);
            //CannotUseSpecialItem
            this.CannotUseSpecialItem = BinarySerializer.ReadBool(ref file);
            //CompetenceZone
            this.CompetenceZone = BinarySerializer.ReadBool(ref file);

            //PKType
            this.PKType = BinarySerializer.ReadByte(ref file);

            //WorldMapType
            this.WorldMapType = BinarySerializer.ReadInt32(ref file);

            if (this.WorldMapType == 0)
            {
                //PaymentType
                this.PaymentType = BinarySerializer.ReadInt32(ref file);

                //WorldMapPosition_X
                this.WorldMapPosition_X = BinarySerializer.ReadInt32(ref file);

                //WorldMapPosition_Y
                this.WorldMapPosition_Y = BinarySerializer.ReadInt32(ref file);

                //WorldMapPosition_Width
                this.WorldMapPosition_Width = BinarySerializer.ReadInt32(ref file);

                //WorldMapPosition_Height
                this.WorldMapPosition_Height = BinarySerializer.ReadInt32(ref file);

                //EncourageSlayerLevelMin
                this.EncourageSlayerLevelMin = BinarySerializer.ReadByte(ref file);
                //EncourageSlayerLevelMax
                this.EncourageSlayerLevelMax = BinarySerializer.ReadByte(ref file);
                //EncourageVampireLevelMin
                this.EncourageVampireLevelMin = BinarySerializer.ReadByte(ref file);
                //EncourageVampireLevelMax
                this.EncourageVampireLevelMax = BinarySerializer.ReadByte(ref file);
                //EncourageOustersLevelMin
                this.EncourageOustersLevelMin = BinarySerializer.ReadByte(ref file);
                //EncourageOustersLevelMax
                this.EncourageOustersLevelMax = BinarySerializer.ReadByte(ref file);

                //MiscDescription
                this.MiscDescription = BinarySerializer.ReadString(ref file, Encoding.ASCII);
            }

            //MapShapeList
            byte mapshapelistsize = BinarySerializer.ReadByte(ref file);

            this.MapShapeList = new List <string>();

            for (int i = 0; i < mapshapelistsize; i++)
            {
                this.MapShapeList.Add(BinarySerializer.ReadString(ref file, Encoding.ASCII));
            }

            //NewValue668

            /*UInt32 newvalue668size = BinarySerializer.ReadUInt32(ref file);
             *
             * this.NewValue668 = new List<UInt32>();
             *
             * for (UInt32 i = 0; i < newvalue668size; i++)
             * {
             *  thisNewValue668.Add(BinarySerializer.ReadUInt32(ref file));
             * }*/
        }
Ejemplo n.º 2
0
        public void SaveToFile(ref FileStream file)
        {
            //ID
            byte[] id = BitConverter.GetBytes(this.ID);
            file.Write(id, 0, id.Length);

            //Name
            BinarySerializer.WriteString(ref file, Encoding.ASCII, this.Name);

            //Property
            BinarySerializer.WriteByte(ref file, this.Property);

            //MusicID
            BinarySerializer.WriteUInt16(ref file, this.MusicID);

            //FileName
            BinarySerializer.WriteString(ref file, Encoding.ASCII, this.FileName);

            //InfoFileName
            BinarySerializer.WriteString(ref file, Encoding.ASCII, this.InfoFileName);

            //TeenFileName
            BinarySerializer.WriteString(ref file, Encoding.ASCII, this.TeenFileName);

            //SoundIDList
            BinarySerializer.WriteUInt32(ref file, (UInt32)this.SoundIDList.Count);

            for (int i = 0; i < this.SoundIDList.Count; i++)
            {
                BinarySerializer.WriteUInt16(ref file, this.SoundIDList[i]);
            }

            //Safety
            BinarySerializer.WriteBool(ref file, this.Safety);

            //CreatureColorSet
            BinarySerializer.WriteUInt16(ref file, this.CreatureColorSet);

            //MinimapSpriteID
            BinarySerializer.WriteUInt16(ref file, this.MinimapSpriteID);

            //HolyLand
            BinarySerializer.WriteBool(ref file, this.HolyLand);
            //ChatMaskByRace
            BinarySerializer.WriteBool(ref file, this.ChatMaskByRace);
            //CannotAttackInSafe
            BinarySerializer.WriteBool(ref file, this.CannotAttackInSafe);
            //CannotUseSpecialItem
            BinarySerializer.WriteBool(ref file, this.CannotUseSpecialItem);
            //CompetenceZone
            BinarySerializer.WriteBool(ref file, this.CompetenceZone);

            //PKType
            BinarySerializer.WriteByte(ref file, this.PKType);

            //WorldMapType
            BinarySerializer.WriteInt32(ref file, this.WorldMapType);

            if (this.WorldMapType == 0)
            {
                //PaymentType
                BinarySerializer.WriteInt32(ref file, this.PaymentType);

                //WorldMapPosition_X
                BinarySerializer.WriteInt32(ref file, this.WorldMapPosition_X);

                //WorldMapPosition_Y
                BinarySerializer.WriteInt32(ref file, this.WorldMapPosition_Y);

                //WorldMapPosition_Width
                BinarySerializer.WriteInt32(ref file, this.WorldMapPosition_Width);

                //WorldMapPosition_Height
                BinarySerializer.WriteInt32(ref file, this.WorldMapPosition_Height);

                //EncourageSlayerLevelMin
                BinarySerializer.WriteByte(ref file, EncourageSlayerLevelMin);
                //EncourageSlayerLevelMax
                BinarySerializer.WriteByte(ref file, EncourageSlayerLevelMax);
                //EncourageVampireLevelMin
                BinarySerializer.WriteByte(ref file, EncourageVampireLevelMin);
                //EncourageVampireLevelMax
                BinarySerializer.WriteByte(ref file, EncourageVampireLevelMax);
                //EncourageOustersLevelMin
                BinarySerializer.WriteByte(ref file, EncourageOustersLevelMin);
                //EncourageOustersLevelMax
                BinarySerializer.WriteByte(ref file, EncourageOustersLevelMax);

                //MiscDescription
                BinarySerializer.WriteString(ref file, Encoding.ASCII, this.MiscDescription);
            }

            //MapShapeList
            BinarySerializer.WriteByte(ref file, (byte)this.MapShapeList.Count);

            for (int i = 0; i < this.MapShapeList.Count; i++)
            {
                BinarySerializer.WriteString(ref file, Encoding.ASCII, this.MapShapeList[i]);
            }

            //NewValue668

            /*BinarySerializer.WriteUInt32(ref file, (UInt32)this.NewValue668.Count);
             *
             * for (int i = 0; i < this.NewValue668.Count; i++)
             * {
             *  BinarySerializer.WriteUInt32(ref file, this.NewValue668[i]);
             * }*/
        }
Ejemplo n.º 3
0
        public Creature(ref FileStream file)
        {
            //Name
            this.Name = BinarySerializer.ReadString(ref file, Encoding.ASCII);

            //SpriteTypes
            int stc = BinarySerializer.ReadInt32(ref file);

            this.SpriteTypes = new List <Int32>();
            for (int i = 0; i < stc; i++)
            {
                this.SpriteTypes.Add(BinarySerializer.ReadInt32(ref file));
            }

            //bMale
            this.bMale = BinarySerializer.ReadBool(ref file);

            //CreatureTribe
            this.CreatureTribe = (CREATURETRIBE)BinarySerializer.ReadByte(ref file);

            //MoveTimes
            this.MoveTimes = BinarySerializer.ReadByte(ref file);

            //MoveRatio
            this.MoveRatio = BinarySerializer.ReadByte(ref file);

            //MoveTimesMotor
            this.MoveTimesMotor = BinarySerializer.ReadByte(ref file);

            //Height, Width
            this.Height = BinarySerializer.ReadInt32(ref file);
            this.Width  = BinarySerializer.ReadInt32(ref file);

            //DeadHeight
            this.DeadHeight = BinarySerializer.ReadInt32(ref file);

            //DeadActionInfo
            this.DeadActionInfo = BinarySerializer.ReadUInt16(ref file);

            //ColorSet
            this.ColorSet = BinarySerializer.ReadInt32(ref file);

            //bFlyingCreature
            this.bFlyingCreature = BinarySerializer.ReadBool(ref file);

            //FlyingHeight
            this.FlyingHeight = BinarySerializer.ReadInt32(ref file);

            //bHeadCut
            this.bHeadCut = BinarySerializer.ReadInt32(ref file);

            //HPBarWidth
            this.HPBarWidth = BinarySerializer.ReadInt32(ref file);

            //ChangeColorSet
            this.ChangeColorSet = BinarySerializer.ReadUInt16(ref file);

            //ShadowCount
            this.ShadowCount = BinarySerializer.ReadUInt16(ref file);

            //EffectStatus
            this.EffectStatus = BinarySerializer.ReadInt32(ref file);

            //Level
            this.Level = BinarySerializer.ReadInt32(ref file);

            //ActionSound
            this.ActionSound = new UInt16[this.GetActionMax()];
            for (int i = 0; i < this.ActionSound.Length; i++)
            {
                this.ActionSound[i] = BinarySerializer.ReadUInt16(ref file);
            }

            //ActionCount
            this.ActionCount = new Int32[this.GetActionMax()];
            for (int i = 0; i < this.ActionCount.Length; i++)
            {
                this.ActionCount[i] = BinarySerializer.ReadInt32(ref file);
            }

            //ItemWearInfo
            if (BinarySerializer.ReadBool(ref file)) // ItemWearInfo exists
            {
                this.ItemWearInfo = new ItemWearInfo(ref file);
            }

            //bFade
            this.bFade = BinarySerializer.ReadBool(ref file);

            //bFadeShadow
            this.bFadeShadow = BinarySerializer.ReadBool(ref file);

            //NewValue668

            /*this.NewValue668 = new byte[8];
             * for (int i = 0; i < 8; i++)
             *  this.NewValue668[i] = BinarySerializer.ReadByte(ref file);*/
        }
Ejemplo n.º 4
0
        public void SaveToFile(ref FileStream file)
        {
            //Name
            BinarySerializer.WriteString(ref file, Encoding.ASCII, this.Name);

            //SpriteTypes
            BinarySerializer.WriteInt32(ref file, this.SpriteTypes.Count);
            foreach (Int32 i in this.SpriteTypes)
            {
                BinarySerializer.WriteInt32(ref file, i);
            }

            //bMale
            BinarySerializer.WriteBool(ref file, this.bMale);

            //CreatureTribe
            BinarySerializer.WriteByte(ref file, (byte)this.CreatureTribe);

            //MoveTimes
            BinarySerializer.WriteByte(ref file, this.MoveTimes);

            //MoveRatio
            BinarySerializer.WriteByte(ref file, this.MoveRatio);

            //MoveTimesMotor
            BinarySerializer.WriteByte(ref file, this.MoveTimesMotor);

            //Height, Width
            BinarySerializer.WriteInt32(ref file, this.Height);
            BinarySerializer.WriteInt32(ref file, this.Width);

            //DeadHeight
            BinarySerializer.WriteInt32(ref file, this.DeadHeight);

            //DeadActionInfo
            BinarySerializer.WriteUInt16(ref file, this.DeadActionInfo);

            //ColorSet
            BinarySerializer.WriteInt32(ref file, this.ColorSet);

            //bFlyingCreature
            BinarySerializer.WriteBool(ref file, this.bFlyingCreature);

            //FlyingHeight
            BinarySerializer.WriteInt32(ref file, this.FlyingHeight);

            //bHeadCut
            BinarySerializer.WriteInt32(ref file, this.bHeadCut);

            //HPBarWidth
            BinarySerializer.WriteInt32(ref file, this.HPBarWidth);

            //ChangeColorSet
            BinarySerializer.WriteUInt16(ref file, this.ChangeColorSet);

            //ShadowCount
            BinarySerializer.WriteUInt16(ref file, this.ShadowCount);

            //EffectStatus
            BinarySerializer.WriteInt32(ref file, this.EffectStatus);

            //Level
            BinarySerializer.WriteInt32(ref file, this.Level);

            //ActionSound
            foreach (UInt16 i in this.ActionSound)
            {
                BinarySerializer.WriteUInt16(ref file, i);
            }

            //ActionCount
            foreach (Int32 i in this.ActionCount)
            {
                BinarySerializer.WriteInt32(ref file, i);
            }

            //ItemWearInfo
            if (this.ItemWearInfo == null)
            {
                BinarySerializer.WriteBool(ref file, false);
            }
            else
            {
                BinarySerializer.WriteBool(ref file, true);
                this.ItemWearInfo.SaveToFile(ref file);
            }

            //bFade
            BinarySerializer.WriteBool(ref file, this.bFade);

            //bFadeShadow
            BinarySerializer.WriteBool(ref file, this.bFadeShadow);

            //NewValue668

            /*for (int i = 0; i < 8; i++)
             *  BinarySerializer.WriteByte(ref file, this.NewValue668[i]);*/
        }
Ejemplo n.º 5
0
        }                 // JSON.Net bug workaround

        public Item(ref FileStream file)
        {
            //HName
            this.HName = BinarySerializer.ReadString(ref file, Encoding.ASCII);

            Console.WriteLine(HName);

            //EName
            this.EName = BinarySerializer.ReadString(ref file, Encoding.ASCII);

            //Description
            this.Description = BinarySerializer.ReadString(ref file, Encoding.ASCII);

            //FrameID's
            this.TileFrameID        = BinarySerializer.ReadUInt16(ref file);
            this.InventoryFrameID   = BinarySerializer.ReadUInt16(ref file);
            this.GearFrameID        = BinarySerializer.ReadUInt16(ref file);
            this.DropFrameID        = BinarySerializer.ReadUInt16(ref file);
            this.AddonMaleFrameID   = BinarySerializer.ReadUInt16(ref file);
            this.AddonFemaleFrameID = BinarySerializer.ReadUInt16(ref file);
            this.UseFrameID         = BinarySerializer.ReadUInt16(ref file);

            //SoundID's
            this.UseSoundID       = BinarySerializer.ReadUInt16(ref file);
            this.TileSoundID      = BinarySerializer.ReadUInt16(ref file);
            this.InventorySoundID = BinarySerializer.ReadUInt16(ref file);
            this.GearSoundID      = BinarySerializer.ReadUInt16(ref file);

            //GridSize
            this.GridWidth  = BinarySerializer.ReadByte(ref file);
            this.GridHeight = BinarySerializer.ReadByte(ref file);

            //Price
            this.Price = BinarySerializer.ReadUInt32(ref file);

            //Weight
            this.Weight = BinarySerializer.ReadUInt16(ref file);

            //Values
            this.Value1 = BinarySerializer.ReadInt32(ref file);
            this.Value2 = BinarySerializer.ReadInt32(ref file);
            this.Value3 = BinarySerializer.ReadInt32(ref file);
            this.Value4 = BinarySerializer.ReadInt32(ref file);
            this.Value5 = BinarySerializer.ReadInt32(ref file);
            this.Value6 = BinarySerializer.ReadInt32(ref file);
            this.Value7 = BinarySerializer.ReadInt32(ref file);

            //Requirements
            this.RequireSTR = BinarySerializer.ReadByte(ref file);
            this.RequireDEX = BinarySerializer.ReadByte(ref file);
            this.RequireINT = BinarySerializer.ReadByte(ref file);

            //RequireSUM
            this.RequireSUM = BinarySerializer.ReadUInt16(ref file);

            //RequireLevels
            this.RequireLevel            = BinarySerializer.ReadByte(ref file);
            this.RequireAdvancementLevel = BinarySerializer.ReadByte(ref file);

            //Sex Restrictions
            this.bMaleOnly   = BinarySerializer.ReadBool(ref file);
            this.bFemaleOnly = BinarySerializer.ReadBool(ref file);

            //UseActionInfo
            this.UseActionInfo = BinarySerializer.ReadUInt32(ref file);

            //Silver Max
            this.SilverMax = BinarySerializer.ReadInt32(ref file);

            //ToHit
            this.ToHit = BinarySerializer.ReadInt32(ref file);

            //Max Number
            this.MaxNumber = BinarySerializer.ReadUInt32(ref file);

            //Critical Hit
            this.CriticalHit = BinarySerializer.ReadInt32(ref file);

            //DefaultOptionList
            this.DefaultOptionList = new List <byte>();
            int _dolsize = BinarySerializer.ReadByte(ref file);

            for (int i = 0; i < _dolsize; i++)
            {
                byte _opt = BinarySerializer.ReadByte(ref file);
                this.DefaultOptionList.Add(_opt);
            }

            //Item Style
            this.ItemStyle = BinarySerializer.ReadInt32(ref file);

            //ElementalType
            this.ElementalType = BinarySerializer.ReadInt32(ref file);

            //Elemental
            this.Elemental = BinarySerializer.ReadUInt16(ref file);

            //Race
            this.Race = BinarySerializer.ReadByte(ref file);

            //DescriptionFrameID
            this.DescriptionFrameID = BinarySerializer.ReadUInt16(ref file);

            //ItemMoveControl
            this.ItemMoveControl = BinarySerializer.ReadByte(ref file);

            //ItemCanAdvance
            this.ItemCanAdvance = BinarySerializer.ReadByte(ref file);

            //DropItemNameTag
            this.DropItemNameTag = BinarySerializer.ReadUInt32(ref file);

            //NormalItemGrade
            this.NormalItemGrade = BinarySerializer.ReadInt32(ref file);

            //NewValue668

            /*byte[] _nv668count = new byte[4];
             * file.Read(_nv668count, 0, 4);
             * int nv668count = 0;
             * this.NewValue668 = new List<byte>();
             * for (int i = 0; i < nv668count; i++)
             *  this.NewValue668.Add((byte)file.ReadByte());*/
        }
Ejemplo n.º 6
0
        public void SaveToFile(ref FileStream file)
        {
            //HName
            BinarySerializer.WriteString(ref file, Encoding.ASCII, this.HName);

            //EName
            BinarySerializer.WriteString(ref file, Encoding.ASCII, this.EName);

            //Description
            BinarySerializer.WriteString(ref file, Encoding.ASCII, this.Description);

            //FrameID's
            BinarySerializer.WriteUInt16(ref file, this.TileFrameID);
            BinarySerializer.WriteUInt16(ref file, this.InventoryFrameID);
            BinarySerializer.WriteUInt16(ref file, this.GearFrameID);
            BinarySerializer.WriteUInt16(ref file, this.DropFrameID);
            BinarySerializer.WriteUInt16(ref file, this.AddonMaleFrameID);
            BinarySerializer.WriteUInt16(ref file, this.AddonFemaleFrameID);
            BinarySerializer.WriteUInt16(ref file, this.UseFrameID);

            //SoundID's
            BinarySerializer.WriteUInt16(ref file, this.UseSoundID);
            BinarySerializer.WriteUInt16(ref file, this.TileSoundID);
            BinarySerializer.WriteUInt16(ref file, this.InventorySoundID);
            BinarySerializer.WriteUInt16(ref file, this.GearSoundID);

            //Grid Size
            BinarySerializer.WriteByte(ref file, this.GridWidth);
            BinarySerializer.WriteByte(ref file, this.GridHeight);

            //Price
            BinarySerializer.WriteUInt32(ref file, this.Price);

            //Weight
            BinarySerializer.WriteUInt16(ref file, this.Weight);

            //Values
            BinarySerializer.WriteInt32(ref file, this.Value1);
            BinarySerializer.WriteInt32(ref file, this.Value2);
            BinarySerializer.WriteInt32(ref file, this.Value3);
            BinarySerializer.WriteInt32(ref file, this.Value4);
            BinarySerializer.WriteInt32(ref file, this.Value5);
            BinarySerializer.WriteInt32(ref file, this.Value6);
            BinarySerializer.WriteInt32(ref file, this.Value7);

            //Requirements
            BinarySerializer.WriteByte(ref file, this.RequireSTR);
            BinarySerializer.WriteByte(ref file, this.RequireDEX);
            BinarySerializer.WriteByte(ref file, this.RequireINT);

            //RequireSUM
            BinarySerializer.WriteUInt16(ref file, this.RequireSUM);


            //RequireLevels
            BinarySerializer.WriteByte(ref file, this.RequireLevel);
            BinarySerializer.WriteByte(ref file, this.RequireAdvancementLevel);

            //Sex Restrictions
            BinarySerializer.WriteBool(ref file, this.bMaleOnly);
            BinarySerializer.WriteBool(ref file, this.bFemaleOnly);

            //UseActionInfo
            BinarySerializer.WriteUInt32(ref file, this.UseActionInfo);

            //Silver Max
            BinarySerializer.WriteInt32(ref file, this.SilverMax);

            //ToHit
            BinarySerializer.WriteInt32(ref file, this.ToHit);

            //Max Number
            BinarySerializer.WriteUInt32(ref file, this.MaxNumber);

            //Critical Hit
            BinarySerializer.WriteInt32(ref file, this.CriticalHit);

            //DefaultOptionsList
            BinarySerializer.WriteByte(ref file, (byte)this.DefaultOptionList.Count);

            foreach (byte b in this.DefaultOptionList)
            {
                BinarySerializer.WriteByte(ref file, b);
            }


            //ItemStyle
            BinarySerializer.WriteInt32(ref file, this.ItemStyle);

            //ElementalType
            BinarySerializer.WriteInt32(ref file, this.ElementalType);

            //Elemental
            BinarySerializer.WriteUInt16(ref file, this.Elemental);

            //Race
            BinarySerializer.WriteByte(ref file, this.Race);

            //DescriptionFrameID
            BinarySerializer.WriteUInt16(ref file, this.DescriptionFrameID);

            //ItemMoveControl
            BinarySerializer.WriteByte(ref file, this.ItemMoveControl);

            //ItemCanAdvance
            BinarySerializer.WriteByte(ref file, this.ItemCanAdvance);

            //DropItemNameTag
            BinarySerializer.WriteUInt32(ref file, this.DropItemNameTag);


            //NormalItemGrade
            BinarySerializer.WriteInt32(ref file, this.NormalItemGrade);

            //NewValue668

            /*file.WriteByte((byte)this.NewValue668.Count);
             * foreach (byte b in NewValue668)
             * {
             *  file.WriteByte(b);
             * }*/
        }