Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public void WriteToObjectMod(Map.Object obj)
        {
            MemoryStream ms = new MemoryStream();
            NoxBinaryWriter bw = new NoxBinaryWriter(ms, CryptApi.NoxCryptFormat.NONE);

            bw.Write(SizeX);
            bw.Write(SizeY);
            bw.WriteColor(EdgeColor);
            bw.WriteColor(BackColor);
            bw.Write(UnkInt1);
            bw.WriteScriptEvent(ScriptOnPressed);
            bw.WriteScriptEvent(ScriptOnReleased);
            bw.WriteScriptEvent(ScriptOnCollided);
            bw.Write(AllowedObjClass);
            bw.Write(IgnoredObjClass);
            bw.Write(AllowedTeamID);
            bw.Write(IgnoredTeamID);
            bw.Write(TriggerState);
            bw.Write(Unk7);
            bw.Write(UnkInt2);
            bw.Flush();

            obj.modbuf = ms.ToArray();
            obj.ReadRule1 = 0x3D;
            bw.Close();
        }