public void Parse(ICLIFlags toolFlags) { var unlocks = GetUnlocks(); if (toolFlags is ListFlags flags) { if (flags.JSON) { ParseJSON(unlocks, flags); return; } } ListHeroUnlocks.DisplayUnlocks("Other", unlocks.OtherUnlocks); if (unlocks.LootBoxesUnlocks != null) { foreach (LootBoxUnlocks lootBoxUnlocks in unlocks.LootBoxesUnlocks) { string boxName = LootBox.GetName(lootBoxUnlocks.LootBoxType); ListHeroUnlocks.DisplayUnlocks(boxName, lootBoxUnlocks.Unlocks); } } if (unlocks.AdditionalUnlocks != null) { foreach (AdditionalUnlocks additionalUnlocks in unlocks.AdditionalUnlocks) { ListHeroUnlocks.DisplayUnlocks($"Level {additionalUnlocks.Level}", additionalUnlocks.Unlocks); } } }
public void Parse(ICLIFlags toolFlags) { Dictionary <string, ProgressionUnlocks> unlocks = GetUnlocks(); if (toolFlags is ListFlags flags) { if (flags.JSON) { if (flags.Flatten) { var @out = unlocks.ToDictionary(x => x.Key, x => x.Value.IterateUnlocks()); OutputJSON(@out, flags); } else { OutputJSON(unlocks, flags); } return; } } foreach (KeyValuePair <string, ProgressionUnlocks> heroPair in unlocks) { Log("Unlocks for {0}", heroPair.Key); if (heroPair.Value.LevelUnlocks != null) { foreach (LevelUnlocks levelUnlocks in heroPair.Value.LevelUnlocks) { DisplayUnlocks("Default", levelUnlocks.Unlocks); } } if (heroPair.Value.OtherUnlocks != null) { var owlUnlocks = heroPair.Value.OtherUnlocks.Where(u => u.STU.m_0B1BA7C1 != null).ToArray(); var otherUnlocks = heroPair.Value.OtherUnlocks.Where(u => u.STU.m_0B1BA7C1 == null).ToArray(); DisplayUnlocks("Other", otherUnlocks); DisplayUnlocks("OWL", owlUnlocks); } if (heroPair.Value.LootBoxesUnlocks != null) { foreach (LootBoxUnlocks lootBoxUnlocks in heroPair.Value.LootBoxesUnlocks) { string boxName = LootBox.GetName(lootBoxUnlocks.LootBoxType); DisplayUnlocks(boxName, lootBoxUnlocks.Unlocks); } } Log(); // New line } }
public void GetLootboxes(ICLIFlags toolFlags) { string basePath; if (toolFlags is ExtractFlags flags) { basePath = flags.OutputPath; } else { throw new Exception("no output path"); } foreach (ulong key in TrackedFiles[0xCF]) { STULootBox lootbox = GetInstance <STULootBox>(key); if (lootbox == null) { continue; } string name = LootBox.GetName(lootbox.m_lootboxType); Combo.ComboInfo info = Combo.Find(null, lootbox.m_baseEntity); // 003 Combo.Find(info, lootbox.m_chestEntity); // 003 Combo.Find(info, lootbox.m_idleEffect); // 00D Combo.Find(info, lootbox.m_FEC3ED62); // 00D Combo.Find(info, lootbox.m_FFE7768F); // 00D Combo.Find(info, lootbox.m_baseModelLook); // 01A Combo.Find(info, lootbox.m_modelLook); Combo.Find(info, 0x400000000001456); // coin chest, todo // 00000000315A.00C in 000000001456.003 (288230376151716950) if (lootbox.m_shopCards != null) { foreach (STULootBoxShopCard lootboxShopCard in lootbox.m_shopCards) { Combo.Find(info, lootboxShopCard.m_cardTexture); // 004 } } var context = new SaveLogic.Combo.SaveContext(info); SaveLogic.Combo.SaveLooseTextures(flags, Path.Combine(basePath, Container, name, "ShopCards"), context); SaveLogic.Combo.Save(flags, Path.Combine(basePath, Container, name), context); context.Wait(); SaveScratchDatabase(); } }
public void GetGeneralUnlocks(ICLIFlags toolFlags) { string basePath; if (toolFlags is ExtractFlags flags) { basePath = flags.OutputPath; } else { throw new Exception("no output path"); } string path = Path.Combine(basePath, "General"); foreach (var key in TrackedFiles[0x54]) { STUGenericSettings_PlayerProgression progression = GetInstance <STUGenericSettings_PlayerProgression>(key); if (progression == null) { continue; } PlayerProgression playerProgression = new PlayerProgression(progression); if (playerProgression.LootBoxesUnlocks != null) { foreach (LootBoxUnlocks lootBoxUnlocks in playerProgression.LootBoxesUnlocks) { string boxName = LootBox.GetName(lootBoxUnlocks.LootBoxType); ExtractHeroUnlocks.SaveUnlocks(flags, lootBoxUnlocks.Unlocks, path, boxName, null, null, null, null); } } if (playerProgression.AdditionalUnlocks != null) { foreach (AdditionalUnlocks additionalUnlocks in playerProgression.AdditionalUnlocks) { ExtractHeroUnlocks.SaveUnlocks(flags, additionalUnlocks.Unlocks, path, "Standard", null, null, null, null); } } if (playerProgression.OtherUnlocks != null) { ExtractHeroUnlocks.SaveUnlocks(flags, playerProgression.OtherUnlocks, path, "Achievement", null, null, null, null); } SaveScratchDatabase(); } }
public void Parse(ICLIFlags toolFlags) { Dictionary <string, ProgressionUnlocks> unlocks = GetUnlocks(); if (toolFlags is ListFlags flags) { if (flags.JSON) { ParseJSON(unlocks, flags); return; } } foreach (KeyValuePair <string, ProgressionUnlocks> heroPair in unlocks) { Log("Unlocks for {0}", heroPair.Key); if (heroPair.Value.LevelUnlocks != null) { foreach (LevelUnlocks levelUnlocks in heroPair.Value.LevelUnlocks) { DisplayUnlocks("Default", levelUnlocks.Unlocks); } } DisplayUnlocks("Other", heroPair.Value.OtherUnlocks); if (heroPair.Value.LootBoxesUnlocks != null) { foreach (LootBoxUnlocks lootBoxUnlocks in heroPair.Value.LootBoxesUnlocks) { string boxName = LootBox.GetName(lootBoxUnlocks.LootBoxType); DisplayUnlocks(boxName, lootBoxUnlocks.Unlocks); } } } }
public void SaveUnlocksForHeroes(ICLIFlags flags, IEnumerable <STUHero> heroes, string basePath, bool npc = false) { if (flags.Positionals.Length < 4) { QueryHelp(QueryTypes); return; } Dictionary <string, Dictionary <string, ParsedArg> > parsedTypes = ParseQuery(flags, QueryTypes, QueryNameOverrides); if (parsedTypes == null) { return; } foreach (STUHero hero in heroes) { if (hero == null) { continue; } string heroNameActual = GetString(hero.m_0EDCE350); if (heroNameActual == null) { continue; } Dictionary <string, ParsedArg> config = GetQuery(parsedTypes, heroNameActual.ToLowerInvariant(), "*"); heroNameActual = heroNameActual.TrimEnd(' '); string heroFileName = GetValidFilename(heroNameActual); if (config.Count == 0) { continue; } string heroPath = Path.Combine(basePath, RootDir, heroFileName); VoiceSet voiceSet = new VoiceSet(hero); ProgressionUnlocks progressionUnlocks = new ProgressionUnlocks(hero); if (progressionUnlocks.LevelUnlocks == null && !npc) { continue; } if (progressionUnlocks.LootBoxesUnlocks != null && npc) { continue; } Log($"Processing unlocks for {heroNameActual}"); { Combo.ComboInfo guiInfo = new Combo.ComboInfo(); foreach (STU_1A496D3C tex in hero.m_8203BFE1) { Combo.Find(guiInfo, tex.m_texture); guiInfo.SetTextureName(tex.m_texture, teResourceGUID.AsString(tex.m_id)); } SaveLogic.Combo.SaveLooseTextures(flags, Path.Combine(heroPath, "GUI"), guiInfo); } if (progressionUnlocks.OtherUnlocks != null) // achievements and stuff { Dictionary <string, TagExpectedValue> tags = new Dictionary <string, TagExpectedValue> { { "event", new TagExpectedValue("base") } }; SaveUnlocks(flags, progressionUnlocks.OtherUnlocks, heroPath, "Achievement", config, tags, voiceSet, hero); } if (npc) { foreach (var skin in hero.m_skinThemes) { if (!config.ContainsKey("skin") || !config["skin"].ShouldDo(GetFileName(skin.m_5E9665E3))) { continue; } SkinTheme.Save(flags, Path.Combine(heroPath, Unlock.GetTypeName(typeof(STUUnlock_SkinTheme)), string.Empty, GetFileName(skin.m_5E9665E3)), skin, hero); } continue; } if (progressionUnlocks.LevelUnlocks != null) // default unlocks { Dictionary <string, TagExpectedValue> tags = new Dictionary <string, TagExpectedValue> { { "event", new TagExpectedValue("base") } }; foreach (LevelUnlocks levelUnlocks in progressionUnlocks.LevelUnlocks) { SaveUnlocks(flags, levelUnlocks.Unlocks, heroPath, "Default", config, tags, voiceSet, hero); } } if (progressionUnlocks.LootBoxesUnlocks != null) { foreach (LootBoxUnlocks lootBoxUnlocks in progressionUnlocks.LootBoxesUnlocks) { if (lootBoxUnlocks.Unlocks == null) { continue; } string lootboxName = LootBox.GetName(lootBoxUnlocks.LootBoxType); var tags = new Dictionary <string, TagExpectedValue> { { "event", new TagExpectedValue(LootBox.GetBasicName(lootBoxUnlocks.LootBoxType)) } }; SaveUnlocks(flags, lootBoxUnlocks.Unlocks, heroPath, lootboxName, config, tags, voiceSet, hero); } } } }