public void Deserialize(SaveStream input) { if (input.ReadStaticString(4) != "PLYR") { throw new FormatException("not player data"); } this.Version = input.ReadValueU32(); if (this.Version != 35) { throw new FormatException("unsupported player data version (" + this.Version.ToString() + ")"); } this.Character = input.ReadString(); this.Level = input.ReadValueU32(); this.Experience = input.ReadValueU32(); this.SkillPoints = input.ReadValueU32(); this.Unknown03 = input.ReadValueU32(); this.Money = input.ReadValueU32(); this.MaybePlaythroughUnlocked = input.ReadValueU32(); // Skills { uint count = input.ReadValueU32(); this.Skills.Clear(); for (uint i = 0; i < count; i++) { Skill skill = new Skill(); skill.Deserialize(input); this.Skills.Add(skill); } } this.Unknown07 = input.ReadValueU32(); this.Unknown08 = input.ReadValueU32(); this.Unknown09 = input.ReadValueU32(); this.Unknown10 = input.ReadValueU32(); // Ammo Pools { uint count = input.ReadValueU32(); this.AmmoPools.Clear(); for (uint i = 0; i < count; i++) { AmmoPool pool = new AmmoPool(); pool.Deserialize(input); this.AmmoPools.Add(pool); } } // Items { uint count = input.ReadValueU32(); this.Items.Clear(); for (uint i = 0; i < count; i++) { Item item = new Item(); item.Deserialize(input); this.Items.Add(item); } } this.BackpackSlots = input.ReadValueU32(); this.WeaponSlots = input.ReadValueU32(); // Weapons { uint count = input.ReadValueU32(); this.Weapons.Clear(); for (uint i = 0; i < count; i++) { Weapon weapon = new Weapon(); weapon.Deserialize(input); this.Weapons.Add(weapon); } } this.Stats = input.ReadBuffer(); // Visited Zones { uint count = input.ReadValueU32(); this.VisitedStations.Clear(); for (uint i = 0; i < count; i++) { this.VisitedStations.Add(input.ReadString()); } } this.CurrentStation = input.ReadString(); // Unknown19 { uint count = input.ReadValueU32(); if (count != 0) { throw new Exception(); } } // Unknown20 { uint count = input.ReadValueU32(); if (count != 0) { throw new Exception(); } } this.Unknown21 = input.ReadString();; this.Unknown22 = input.ReadValueU32(); this.Unknown23 = input.ReadValueU32(); this.SaveSlot = input.ReadValueU32(); this.ExtraDataVersion = input.ReadValueU32(); if (this.ExtraDataVersion >= 27) { this.Unknown26 = input.ReadValueU32(); } if (this.ExtraDataVersion >= 28 && this.ExtraDataVersion <= 31) { // junk input.ReadString(); { uint count = input.ReadValueU32(); for (uint i = 0; i < count; i++) { input.ReadString(); } } } if (this.ExtraDataVersion >= 29) { // Mission Zones { uint count = input.ReadValueU32(); this.MissionPlaythroughs.Clear(); for (uint i = 0; i < count; i++) { MissionPlaythrough missionZone = new MissionPlaythrough(); missionZone.Deserialize(input); this.MissionPlaythroughs.Add(missionZone); } } } if (this.ExtraDataVersion >= 30) { this.PlayTime = input.ReadValueU32(); this.SaveTime = input.ReadString(); } if (this.ExtraDataVersion >= 31) { this.Name = input.ReadString(); this.Color1 = input.ReadValueU32(); this.Color2 = input.ReadValueU32(); this.Color3 = input.ReadValueU32(); } if (this.ExtraDataVersion >= 32) { this.Unknown34 = input.ReadValueU32(); // Unknown35 { uint count = input.ReadValueU32(); this.Unknown35.Clear(); for (uint i = 0; i < count; i++) { this.Unknown35.Add(input.ReadValueU32()); } } } if (this.ExtraDataVersion >= 33) { // Unknown36 { uint count = input.ReadValueU32(); this.Unknown36.Clear(); for (uint i = 0; i < count; i++) { this.Unknown36.Add(input.ReadValueU32()); } } } if (this.ExtraDataVersion >= 34) { // Echo Zones { uint count = input.ReadValueU32(); this.EchoPlaythroughs.Clear(); for (uint i = 0; i < count; i++) { EchoPlaythrough echoZone = new EchoPlaythrough(); echoZone.Deserialize(input); this.EchoPlaythroughs.Add(echoZone); } } } if (this.ExtraDataVersion >= 35) { // Unknown38 this.Unknown38 = input.ReadBuffer(); } }
public static Save.Player Create() { Save.Player player = new Save.Player(); player.SaveSlot = 1; player.PlayTime = 1; player.SaveTime = "20091026000000"; // Version player.Version = 35; player.ExtraDataVersion = 35; // Zone player.CurrentStation = "None"; // Attributes player.Level = 1; player.Experience = 0; player.SkillPoints = 0; player.Money = 80; player.Character = "gd_Brick.Character.CharacterClass_Brick"; // Backpack player.WeaponSlots = 2; player.BackpackSlots = 12; // Weapons player.Weapons.Add( new Save.Weapon() { Grade = "gd_itemgrades.StarterGear.ItemGrade_StarterGear", Type = "gd_weap_combat_shotgun.A_Weapon.WeaponType_combat_shotgun", Prefix = "gd_weap_names_shared.Prefix_Starter.Prefix__BrickShotgun_Busted", Title = "gd_weap_combat_shotgun.Title.Title__Shotgun", Manufacturer = "gd_manufacturers.Manufacturers.Vladof", ClipSize = 0, EquipSlot = 1, Quality = 0, Accessory = "None", Action = "None", Barrel = "gd_weap_combat_shotgun.Barrel.barrel2", Body = "gd_weap_combat_shotgun.Body.body1", Grip = "gd_weap_combat_shotgun.Grip.grip3a", Magazine = "gd_weap_combat_shotgun.mag.mag1", Material = "gd_weap_shared_materialparts.ManufacturerMaterials.Material_Vladof_0_starter", Sight = "gd_weap_combat_shotgun.Sight.sightnone", Stock = "gd_weap_combat_shotgun.Stock.stock_none", }); // Ammo player.AmmoPools.Add( new Save.AmmoPool() { Name = "d_resources.AmmoResources.Ammo_Combat_Shotgun", Pool = "d_resourcepools.AmmoPools.Ammo_Combat_Shotgun_Pool", Quantity = 30.0f, UpgradeLevel = 0, }); // New-U player.Name = "Brick"; player.Color1 = 0xFF667391; player.Color2 = 0xFF667391; player.Color3 = 0xFF6699B3; // Missions Save.MissionPlaythrough missionZone; missionZone = new Save.MissionPlaythrough(); missionZone.Playthrough = 0; missionZone.ActiveMission = "Z0_Missions.Missions.M_IntroStateSaver"; missionZone.Missions.Add( new Save.Mission() { Name = "Z0_Missions.Missions.M_IntroStateSaver", Unknown1 = 2, Unknown2 = 0, Unknown3 = 0, }); player.MissionPlaythroughs.Add(missionZone); missionZone = new Save.MissionPlaythrough(); missionZone.Playthrough = 1; missionZone.ActiveMission = "Z0_Missions.Missions.M_IntroStateSaver"; missionZone.Missions.Add( new Save.Mission() { Name = "Z0_Missions.Missions.M_IntroStateSaver", Unknown1 = 2, Unknown2 = 0, Unknown3 = 0, }); player.MissionPlaythroughs.Add(missionZone); missionZone = new Save.MissionPlaythrough(); missionZone.Playthrough = 2; missionZone.ActiveMission = "Z0_Missions.Missions.M_IntroStateSaver"; missionZone.Missions.Add( new Save.Mission() { Name = "Z0_Missions.Missions.M_IntroStateSaver", Unknown1 = 2, Unknown2 = 0, Unknown3 = 0, }); player.MissionPlaythroughs.Add(missionZone); // Echo Zones player.EchoPlaythroughs.Add( new Save.EchoPlaythrough() { Playthrough = 0, }); // Unknowns player.Unknown03 = 0; player.MaybePlaythroughUnlocked = 0; player.Unknown07 = 0; player.Unknown08 = 0; player.Unknown09 = 0; player.Unknown10 = 0; player.Unknown21 = ""; player.Unknown22 = 26; player.Unknown23 = 42915336; player.Unknown26 = 1; player.Unknown34 = 0; return(player); }