private static void Dump(Dumping.Dumper dumper, Dictionary <Guid, Dumping.PartitionMap.PartitionInfo> partitionMap, string outputPath) { Logger.Info("Loading globalmaster..."); var globalMaster = new LocalizedStringFile(); using (var input = dumper.LoadResource("game/localization/config/texttable/en/game/globalmaster", "localizedstringresource")) { globalMaster.Deserialize(input); } var blueprintNames = new List <string>() { "dev/characters/player/player", }; Logger.Info("Loading bundlecollection_partymember..."); var partyMemberCollectionReader = dumper.LoadEbx("game/characters/party/bundlecollection_partymember"); if (partyMemberCollectionReader == null) { Logger.Fatal("Failed to load bundlecollection_partymember."); return; } using (partyMemberCollectionReader) { var partyMemberCollection = partyMemberCollectionReader .GetObjectsOfSpecificType("BlueprintBundleCollection").First(); foreach (var bundle in partyMemberCollection.Bundles) { string bundleName = bundle.Name; var blueprintBundleReader = dumper.LoadEbx(bundleName.ToLowerInvariant()); if (blueprintBundleReader == null) { Logger.Fatal("Failed to load {0}.", bundle.Name); continue; } using (blueprintBundleReader) { var blueprintBundle = blueprintBundleReader.GetObjectsOfSpecificType("BlueprintBundle").First(); var blueprint = blueprintBundle.Blueprint; Dumping.PartitionMap.PartitionInfo partitionInfo; if (partitionMap.TryGetValue(blueprint.PartitionId, out partitionInfo) == false) { Logger.Warn("Failed to find partition info for {0}!", blueprint.PartitionId); continue; } blueprintNames.Add(partitionInfo.Name); Logger.Info("Found '{0}' => '{1}'.", bundleName, partitionInfo.Name); } } } var partyMembers = new List <PartyMemberInfo>(); foreach (var blueprintName in blueprintNames) { var blueprintReader = dumper.LoadEbx(blueprintName); if (blueprintReader == null) { Logger.Fatal("Failed to load {0}.", blueprintName); continue; } Logger.Info("Processing '{0}'...", blueprintName); using (blueprintReader) { var soldierBlueprint = blueprintReader.GetObjectsOfSpecificType("MESoldierBlueprint").First(); var soldier = soldierBlueprint.Object; if (soldier == null) { Logger.Fatal("Missing MESoldierBlueprint!"); continue; } var soldierBodyComponent = GetComponent(soldier, "SoldierBodyComponentData"); if (soldierBodyComponent == null) { Logger.Fatal("Missing SoldierBodyComponentData!"); continue; } var partyMemberComponent = GetComponent(soldierBodyComponent, "MEPartyMemberComponentData"); if (partyMemberComponent == null) { Logger.Fatal("Missing MEPartyMemberComponentData!"); continue; } var progressionComponent = GetComponent(soldierBodyComponent, "ProgressionComponentData"); if (progressionComponent == null) { Logger.Fatal("Missing ProgressionComponentData!"); continue; } var targetableComponent = GetComponent(soldierBodyComponent, "AIMETargetableComponentData"); Dumping.PartitionMap.PartitionInfo skillProgressionPartitionInfo; if (partitionMap.TryGetValue(progressionComponent.SkillProgressionAsset.PartitionId, out skillProgressionPartitionInfo) == false) { Logger.Warn("Failed to find partition info for {0}!", progressionComponent.SkillProgressionAsset.PartitionId); continue; } var skillProgressionReader = dumper.LoadEbx(skillProgressionPartitionInfo.Name); if (skillProgressionReader == null) { Logger.Fatal("Failed to load {0}.", skillProgressionPartitionInfo.Name); continue; } using (skillProgressionReader) { var skillProgression = skillProgressionReader.GetObjectsOfSpecificType("SkillProgression").First(); PartyMemberInfo partyMember; partyMember.Id = partyMemberComponent.CharacterId; if (targetableComponent == null) { partyMember.Name = "Ryder"; } else { int nameId = targetableComponent.ARInfoPanelData.TargetName.StringId; partyMember.Name = Decode(globalMaster, (uint)nameId); } partyMember.ExcludeProfiles = skillProgression.ExcludeProfiles; partyMember.ExcludePresets = skillProgression.ExcludePresets; partyMembers.Add(partyMember); } } } using (var textWriter = new StreamWriter(outputPath, false, Encoding.UTF8)) using (var writer = new JsonTextWriter(textWriter)) { writer.Formatting = Formatting.Indented; writer.IndentChar = ' '; writer.Indentation = 2; writer.WriteStartObject(); foreach (var partyMember in partyMembers.OrderBy(i => i.Id)) { writer.WritePropertyName(partyMember.Id.ToString(CultureInfo.InvariantCulture)); writer.WriteStartObject(); writer.WritePropertyName("name"); writer.WriteValue(partyMember.Name); writer.WritePropertyName("exclude_profiles"); writer.WriteValue(partyMember.ExcludeProfiles); writer.WritePropertyName("exclude_presets"); writer.WriteValue(partyMember.ExcludePresets); writer.WriteEndObject(); } writer.WriteEndObject(); } }
private static void Dump(Dumping.Dumper dumper, Dictionary <Guid, Dumping.PartitionMap.PartitionInfo> partitionMap, string outputPath) { var itemTypes = new Dictionary <string, ItemInfo>(); Logger.Info("Loading globalmaster..."); var globalMaster = new LocalizedStringFile(); using (var input = dumper.LoadResource("game/localization/config/texttable/en/game/globalmaster", "localizedstringresource")) { globalMaster.Deserialize(input); } Logger.Info("Loading masteritemlist..."); var masterItemListReader = dumper.LoadEbx("game/items/masteritemlist"); if (masterItemListReader == null) { Logger.Fatal("Failed to load masteritemlist."); return; } using (masterItemListReader) { var masterItemList = masterItemListReader.GetObjectsOfSpecificType("MasterItemList").First(); foreach (var itemAsset in masterItemList.ItemAssets) { Dumping.PartitionMap.PartitionInfo partitionInfo; if (partitionMap.TryGetValue(itemAsset.PartitionId, out partitionInfo) == false) { Logger.Warn("Failed to find partition info for {0}!", itemAsset.PartitionId); continue; } dumper.MountSuperbundle(partitionInfo.Superbundles.First()); Logger.Info("Loading item '{0}'...", partitionInfo.Name); var itemDataReader = dumper.LoadEbx(partitionInfo.Name, typeof(ItemType)); if (itemDataReader == null) { Logger.Warn("Failed to load item data '{0}'!", partitionInfo.Name); continue; } using (itemDataReader) { var itemData = itemDataReader.GetObject(itemAsset.InstanceId); var type = (ItemType)itemData.ItemType; int tier = itemData.HasMember("TierValue") == false || itemData.TierValue == null ? -1 : itemData.TierValue.ConstValue; var itemInfo = new ItemInfo() { Type = type, ItemHash = itemData.ItemHash, Name = globalMaster.Get((uint)itemData.DisplayName.StringId), Tier = tier, IsHidden = itemData.HideInInventory, }; itemTypes[partitionInfo.Name] = itemInfo; } } } using (var textWriter = new StreamWriter(outputPath, false, Encoding.UTF8)) using (var writer = new JsonTextWriter(textWriter)) { writer.Formatting = Formatting.Indented; writer.IndentChar = ' '; writer.Indentation = 2; writer.WriteStartObject(); foreach (var kv in itemTypes.OrderBy(kv => kv.Key)) { var info = kv.Value; writer.WritePropertyName(kv.Key); writer.WriteStartObject(); writer.WritePropertyName("type"); writer.WriteValue(info.Type.ToString()); writer.WritePropertyName("item_hash"); writer.WriteValue(info.ItemHash); if (string.IsNullOrEmpty(info.Name) == false) { writer.WritePropertyName("name"); writer.WriteValue(Decode(globalMaster, info.Name)); } if (info.Tier >= 0) { writer.WritePropertyName("tier"); writer.WriteValue(info.Tier); } if (info.IsHidden == true) { writer.WritePropertyName("is_hidden"); writer.WriteValue(true); } writer.WriteEndObject(); } writer.WriteEndObject(); } }