protected void WriteSpells(NoxBinaryWriter wtr) { wtr.Write((long)0); //save a spot for the length long startPos = wtr.BaseStream.Position; wtr.Write((short)0x0003); //UNKNOWN, but always the same foreach (Spell spell in spellset) { wtr.Write((byte)spell.Flags); wtr.Write(spell.Name); } wtr.Write((byte)0x00); //first byte of last entry is null wtr.Write((byte)ActiveSpellset); wtr.Write((byte)ActiveTrap); wtr.Write((byte)0x04); //UNKNOWN, but constant //go back and write in the length long length = wtr.BaseStream.Position - startPos; wtr.Seek((int)startPos - 8, SeekOrigin.Begin); wtr.Write((long)length); wtr.Seek(0, SeekOrigin.End); }
protected void WriteCharacterInfo(NoxBinaryWriter wtr) { wtr.Write((long)0); //save a spot for the length long startPos = wtr.BaseStream.Position; wtr.Write((short)0x000C); //UNKNOWN, but constant wtr.Write((int)0x00000002); //UNKOWN, but constant wtr.Write((short)SavePath.Length); wtr.Write(SavePath.ToCharArray()); wtr.Write((byte)0x00); //extra terminator //TODO: allow user specified datetime? DateTime time = DateTime.Now; wtr.Write((short)time.Year); wtr.Write((short)time.Month); wtr.Write((short)time.DayOfWeek); wtr.Write((short)time.Day); wtr.Write((short)time.Hour); wtr.Write((short)time.Minute); wtr.Write((short)time.Second); wtr.Write((short)time.Millisecond); wtr.WriteColor(HairColor); wtr.WriteColor(SkinColor); wtr.WriteColor(MustacheColor); wtr.WriteColor(BeardColor); wtr.WriteColor(SideburnsColor); wtr.WriteUserColor(PantsColor); wtr.WriteUserColor(ShirtColor); wtr.WriteUserColor(ShirtTrimColor); wtr.WriteUserColor(ShoesColor); wtr.WriteUserColor(ShoesTrimColor); wtr.Write((byte)(Encoding.Unicode.GetByteCount(Name) / 2)); wtr.Write(Encoding.Unicode.GetBytes(Name)); wtr.Write((byte)Class); wtr.Write((short)0x0A00); //UNKNOWN, but constant -- may be character level, but this is always reset to 10, so what's the point of storing it in the file?! wtr.Write(LastMapPlayed); wtr.Write((byte)0x00); //null terminator not counted in stringlength //go back and write in the length long length = wtr.BaseStream.Position - startPos; wtr.Seek((int)startPos - 8, SeekOrigin.Begin); wtr.Write((long)length); wtr.Seek(0, SeekOrigin.End); }
protected void WriteSpells(NoxBinaryWriter wtr) { wtr.Write((long) 0);//save a spot for the length long startPos = wtr.BaseStream.Position; wtr.Write((short) 0x0003);//UNKNOWN, but always the same foreach (Spell spell in spellset) { wtr.Write((byte) spell.Flags); wtr.Write(spell.Name); } wtr.Write((byte) 0x00);//first byte of last entry is null wtr.Write((byte) ActiveSpellset); wtr.Write((byte) ActiveTrap); wtr.Write((byte) 0x04);//UNKNOWN, but constant //go back and write in the length long length = wtr.BaseStream.Position - startPos; wtr.Seek((int) startPos - 8, SeekOrigin.Begin); wtr.Write((long) length); wtr.Seek(0, SeekOrigin.End); }
protected void WriteCharacterInfo(NoxBinaryWriter wtr) { wtr.Write((long) 0);//save a spot for the length long startPos = wtr.BaseStream.Position; wtr.Write((short) 0x000C);//UNKNOWN, but constant wtr.Write((int) 0x00000002);//UNKOWN, but constant wtr.Write((short) SavePath.Length); wtr.Write(SavePath.ToCharArray()); wtr.Write((byte) 0x00);//extra terminator //TODO: allow user specified datetime? DateTime time = DateTime.Now; wtr.Write((short) time.Year); wtr.Write((short) time.Month); wtr.Write((short) time.DayOfWeek); wtr.Write((short) time.Day); wtr.Write((short) time.Hour); wtr.Write((short) time.Minute); wtr.Write((short) time.Second); wtr.Write((short) time.Millisecond); wtr.WriteColor(HairColor); wtr.WriteColor(SkinColor); wtr.WriteColor(MustacheColor); wtr.WriteColor(BeardColor); wtr.WriteColor(SideburnsColor); wtr.WriteUserColor(PantsColor); wtr.WriteUserColor(ShirtColor); wtr.WriteUserColor(ShirtTrimColor); wtr.WriteUserColor(ShoesColor); wtr.WriteUserColor(ShoesTrimColor); wtr.Write((byte) (Encoding.Unicode.GetByteCount(Name) / 2)); wtr.Write(Encoding.Unicode.GetBytes(Name)); wtr.Write((byte) Class); wtr.Write((short) 0x0A00);//UNKNOWN, but constant -- may be character level, but this is always reset to 10, so what's the point of storing it in the file?! wtr.Write(LastMapPlayed); wtr.Write((byte) 0x00);//null terminator not counted in stringlength //go back and write in the length long length = wtr.BaseStream.Position - startPos; wtr.Seek((int) startPos - 8, SeekOrigin.Begin); wtr.Write((long) length); wtr.Seek(0, SeekOrigin.End); }