public static List <Lump> Serialize() { List <Lump> lumps = new List <Lump> { new Lump("NAME", Encoding.ASCII.GetBytes(CurrentLocal.RPGName)), new Lump("PROFESSION", Encoding.ASCII.GetBytes(CurrentLocal.RPGProfession)), new Lump("PORTRAIT", BitConverter.GetBytes(CurrentLocal.Portrait)), new Lump("BADGE", BitConverter.GetBytes(CurrentLocal.Badge)), new Lump("LEVEL", BitConverter.GetBytes(CurrentLocal.Level)), new Lump("DIFFICULTY", BitConverter.GetBytes((int)Difficulty.CurrentDifficulty)), new Lump("CURRENTMAP", Encoding.ASCII.GetBytes(CurrentLocal.CurrentMap)), new Lump("SHAREDSTASH", BitConverter.GetBytes(Difficulty.SharedStash)), new Lump("PERMADEATH", BitConverter.GetBytes(Difficulty.PermanentDeath)), new Lump("PDAMAGE", BitConverter.GetBytes(Difficulty.PlayerDamage)), new Lump("EDAMAGE", BitConverter.GetBytes(Difficulty.EnemyDamage)), }; //faction colors { MemoryStream stream = new MemoryStream(); BinaryWriter bw = new BinaryWriter(stream); foreach (Color c in CurrentLocal.FactionColors) { bw.Write(c.r); bw.Write(c.g); bw.Write(c.b); bw.Write(c.a); } lumps.Add(new Lump("COLORS", stream.ToArray())); bw.Close(); stream.Close(); } for (int i = 0; i < CurrentLocal.PlayerWeapons.Length; i++) { if (CurrentLocal.PlayerWeapons[i] == null) { lumps.Add(new Lump("null", new byte[0])); continue; } lumps.Add(CurrentLocal.PlayerWeapons[i].ToLump()); } for (int i = 0; i < CurrentLocal.PlayerSkills.Length; i++) { if (CurrentLocal.PlayerSkills[i] == null) { lumps.Add(new Lump("null", new byte[0])); continue; } lumps.Add(CurrentLocal.PlayerSkills[i].ToLump()); } for (int i = 0; i < CurrentLocal.PlayerAccessories.Length; i++) { if (CurrentLocal.PlayerAccessories[i] == null) { lumps.Add(new Lump("null", new byte[0])); continue; } lumps.Add(CurrentLocal.PlayerAccessories[i].ToLump()); } if (CurrentLocal.CursorItem == null) { lumps.Add(new Lump("null", new byte[0])); } else { lumps.Add(CurrentLocal.CursorItem.Serialize()); } lumps.Add(new Lump("LASTWEAPON", BitConverter.GetBytes(CurrentLocal.LastPlayerWeaponSwap))); //talents { MemoryStream stream = new MemoryStream(); BinaryWriter bw = new BinaryWriter(stream); bw.Write(CurrentLocal.TalentPoints); foreach (Talent talent in CurrentLocal.Talents) { bw.Write(Wad.FixedLength(talent.ReferenceName)); } lumps.Add(new Lump("TALENTS", stream.ToArray())); bw.Close(); stream.Close(); } return(lumps); }