public AudioClip GetVoiceClip(string Tag) { AudioClip tmp = null; VoiceSet voice = new VoiceSet(); for (int i = 0; i < VoiceSets.Length; i++) { if (VoiceSets[i].Name == Tag) { voice = VoiceSets[i]; } } if (voice.Clips.Length > 1) { int WillPlay = Random.Range(0, voice.Probability + 1); if (WillPlay == voice.Probability) { int RNG = Random.Range(0, voice.Clips.Length); tmp = voice.Clips[RNG]; } else { tmp = null; } } else if (voice.Clips.Length == 1) { tmp = voice.Clips[0]; } return(tmp); }
public static void SaveVoiceLines(ICLIFlags flags, HashSet <ulong> lines, VoiceSet voiceSet, string directory) { FindLogic.Combo.ComboInfo fakeComboInfo = new FindLogic.Combo.ComboInfo(); foreach (ulong line in lines) { VoiceLineInstance voiceLineInstance = voiceSet.VoiceLines[line]; SaveVoiceLine(flags, voiceLineInstance, directory, fakeComboInfo); } }
/// <summary> /// Loads clips and initiates character /// </summary> public void loadClips(VoiceSet voiceSet) { victoryClips = new List <AudioClip>(); lossClips = new List <AudioClip>(); if (voiceSet == VoiceSet.None) { return; } string set = voiceSet.ToString(); int i = 0; AudioClip newClip; while (true) { newClip = Resources.Load <AudioClip>("Voices/" + set + "/Victory" + i.ToString()); if (newClip == null) { break; } else { victoryClips.Add(newClip); } i++; } i = 0; while (true) { newClip = Resources.Load <AudioClip>("Voices/" + set + "/Loss" + i.ToString()); if (newClip == null) { break; } else { lossClips.Add(newClip); } i++; } }
internal static Dictionary <ulong, ulong[]> GenerateVoicelineConversationMapping(Dictionary <ushort, HashSet <ulong> > trackedFiles) { var @return = new Dictionary <ulong, ulong[]>(); foreach (var guid in trackedFiles[0x5F]) { var voiceSet = new VoiceSet(STUHelper.GetInstance <STUVoiceSet>(guid)); if (voiceSet.VoiceLines == null) { continue; } foreach (var voiceSetVoiceLine in voiceSet.VoiceLines) { @return[voiceSetVoiceLine.Key] = voiceSetVoiceLine.Value.VoiceSounds; } } return(@return); }
public static void SaveUnlock(ICLIFlags flags, Unlock unlock, string path, string eventKey, Dictionary <string, ParsedArg> config, Dictionary <string, TagExpectedValue> tags, VoiceSet voiceSet, STUHero hero) { string rarity; if (tags != null) { if (unlock.STU.m_0B1BA7C1 == null) { rarity = unlock.Rarity.ToString(); tags["leagueTeam"] = new TagExpectedValue("none"); } else { TeamDefinition teamDef = new TeamDefinition(unlock.STU.m_0B1BA7C1); tags["leagueTeam"] = new TagExpectedValue(teamDef.Abbreviation, // NY teamDef.Location, // New York teamDef.Name, // Excelsior teamDef.FullName, // New York Excelsior (teamDef.Division == Enum_5A789F71.None && teamDef.Abbreviation == null) ? "none" : "*", "*"); // all // nice file structure rarity = ""; eventKey = "League"; } tags["rarity"] = new TagExpectedValue(unlock.Rarity.ToString()); tags["special"] = new TagExpectedValue(unlock.Tag ?? "none"); } else { rarity = ""; // for general unlocks } var eventMap = GetEventConfig(); if (unlock.STU.m_BEE9BCDA != null) { var formalEventKey = unlock.STU.m_BEE9BCDA.FirstOrDefault(x => eventMap.ContainsKey(x)); if (eventMap.ContainsKey(formalEventKey)) { eventKey = eventMap[formalEventKey]; } } string thisPath = Path.Combine(path, unlock.GetTypeNameEnum(), eventKey, rarity, GetValidFilename(unlock.GetName())); if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SprayPaint))) { SprayAndIcon.Save(flags, thisPath, unlock); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_AvatarPortrait))) { SprayAndIcon.Save(flags, thisPath, unlock); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_POTGAnimation))) { AnimationItem.Save(flags, thisPath, unlock); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Emote))) { AnimationItem.Save(flags, thisPath, unlock); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Pose))) { AnimationItem.Save(flags, thisPath, unlock); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_VoiceLine))) { VoiceLine.Save(flags, thisPath, unlock, voiceSet); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SkinTheme))) { SkinTheme.Save(flags, thisPath, unlock, hero); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_PortraitFrame))) { thisPath = Path.Combine(path, unlock.Type); PortraitFrame.Save(flags, thisPath, unlock); } }
public static void SaveUnlocks(ICLIFlags flags, Unlock[] unlocks, string path, string eventKey, Dictionary <string, ParsedArg> config, Dictionary <string, TagExpectedValue> tags, VoiceSet voiceSet, STUHero hero) { if (unlocks == null) { return; } foreach (Unlock unlock in unlocks) { SaveUnlock(flags, unlock, path, eventKey, config, tags, voiceSet, hero); } }
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); } } } }
public void ExtractHeroConvos(ICLIFlags toolFlags) { string basePath; if (toolFlags is ExtractFlags flags) { basePath = flags.OutputPath; } else { throw new Exception("no output path"); } if (flags.Positionals.Length < 4) { QueryHelp(QueryTypes); return; } string path = Path.Combine(basePath, Container); Dictionary <string, Dictionary <string, ParsedArg> > parsedTypes = ParseQuery(flags, QueryTypes, QueryNameOverrides); if (parsedTypes == null) { return; } Dictionary <ulong, VoiceSet> allVoiceSets = new Dictionary <ulong, VoiceSet>(); foreach (var voiceSetGUID in Program.TrackedFiles[0x5F]) { STUVoiceSet set = GetInstance <STUVoiceSet>(voiceSetGUID); if (set?.m_voiceLineInstances == null) { continue; } allVoiceSets[voiceSetGUID] = new VoiceSet(set); } // Dictionary<uint, string> mapNames = new Dictionary<uint, string>(); // foreach (ulong mapGuid in Program.TrackedFiles[0x9F]) { // STUMapHeader mapHeader = GetInstance<STUMapHeader>(mapGuid); // if (mapHeader == null) continue; // // mapNames[teResourceGUID.Index(mapGuid)] = GetValidFilename(GetString(mapHeader.m_1C706502) ?? GetString(mapHeader.m_displayName)); // } Combo.ComboInfo comboInfo = new Combo.ComboInfo(); foreach (ulong heroGuid in Program.TrackedFiles[0x75]) { STUHero hero = GetInstance <STUHero>(heroGuid); if (hero == null) { continue; } STUVoiceSetComponent voiceSetComponent = GetInstance <STUVoiceSetComponent>(hero.m_gameplayEntity); if (voiceSetComponent?.m_voiceDefinition == null || !allVoiceSets.TryGetValue(voiceSetComponent.m_voiceDefinition, out var set)) { Debugger.Log(0, "DataTool.SaveLogic.Unlock.VoiceLine", "[DataTool.SaveLogic.Unlock.VoiceLine]: VoiceSet not found\r\n"); continue; } string heroNameActual = (GetString(hero.m_0EDCE350) ?? $"Unknown{teResourceGUID.Index(heroGuid)}").TrimEnd(' '); Dictionary <string, ParsedArg> config = GetQuery(parsedTypes, heroNameActual.ToLowerInvariant(), "*"); if (config.Count == 0) { continue; } Log($"Processing data for {heroNameActual}"); heroNameActual = GetValidFilename(heroNameActual); foreach (VoiceLineInstance lineInstance in set.VoiceLines.Values) { // if (lineInstance.STU.m_voiceLineRuntime.m_4FF98D41 != null) { // var cond = lineInstance.STU.m_voiceLineRuntime.m_4FF98D41; // // HandleCondition(flags, comboInfo, lineInstance, path, heroNameActual, cond, mapNames); // } if (lineInstance.VoiceConversation == 0) { continue; } STUVoiceConversation conversation = GetInstance <STUVoiceConversation>(lineInstance.VoiceConversation); if (conversation == null) { continue; // wtf, blizz pls } string convoDir = Path.Combine(path, heroNameActual, GetFileName(lineInstance.VoiceConversation)); foreach (STUVoiceConversationLine line in conversation.m_voiceConversationLine) { string linePath = Path.Combine(convoDir, line.m_B4D405A1.ToString()); foreach (VoiceSet voiceSet in allVoiceSets.Values) { if (voiceSet.VoiceLines.ContainsKey(line.m_lineGUID)) { VoiceLine.SaveVoiceLine(flags, voiceSet.VoiceLines[line.m_lineGUID], linePath, comboInfo); } } } } } }
public static void Save(ICLIFlags flags, string directory, DataModels.Unlock unlock, VoiceSet voiceSet) { if (voiceSet == null) { return; } if (!(unlock.STU is STUUnlock_VoiceLine vl)) { return; } HashSet <ulong> voiceLines = new HashSet <ulong>(); using (Stream vlStream = IO.OpenFile(vl.m_F57B051E)) { teChunkedData chunkedData = new teChunkedData(vlStream); foreach (teEffectComponentVoiceStimulus voiceStimulus in chunkedData.GetChunks <teEffectComponentVoiceStimulus>()) { if (voiceSet.Stimuli.TryGetValue(voiceStimulus.Header.VoiceStimulus, out var stimuliLines)) { foreach (var voiceLine in stimuliLines) { voiceLines.Add(voiceLine); } } } } SaveVoiceLines(flags, voiceLines, voiceSet, directory); }
public static void SaveUnlock(ICLIFlags flags, Unlock unlock, string path, string eventKey, Dictionary <string, ParsedArg> config, Dictionary <string, TagExpectedValue> tags, VoiceSet voiceSet, STUHero hero) { string rarity; if (tags != null) { if (unlock.STU.m_0B1BA7C1 == null) { rarity = unlock.Rarity.ToString(); tags["leagueTeam"] = new TagExpectedValue("none"); } else { TeamDefinition teamDef = new TeamDefinition(unlock.STU.m_0B1BA7C1); tags["leagueTeam"] = new TagExpectedValue(teamDef.Abbreviation, // NY teamDef.Location, // New York teamDef.Name, // Excelsior teamDef.FullName, // New York Excelsior "*"); // all // nice file structure rarity = ""; eventKey = "League"; } tags["rarity"] = new TagExpectedValue(unlock.Rarity.ToString()); //if (UnlockData.SummerGames2016.Contains(unlock.GUID)) { // tags["special"] = new TagExpectedValue("sg2016"); //} if (UnlockData.SummerGames2017.Contains(unlock.GUID)) { // tags["special"] = new TagExpectedValue("sg2017"); //} else if (UnlockData.SummerGames2018.Contains(unlock.GUID)) { tags["special"] = new TagExpectedValue("sg2018"); } else { tags["special"] = new TagExpectedValue("none"); } } else { rarity = ""; // for general unlocks } string thisPath = Path.Combine(path, unlock.Type, eventKey, rarity, GetValidFilename(unlock.GetName())); if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SprayPaint))) { SprayAndIcon.Save(flags, thisPath, unlock); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_AvatarPortrait))) { SprayAndIcon.Save(flags, thisPath, unlock); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_POTGAnimation))) { AnimationItem.Save(flags, thisPath, unlock); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Emote))) { AnimationItem.Save(flags, thisPath, unlock); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Pose))) { AnimationItem.Save(flags, thisPath, unlock); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_VoiceLine))) { VoiceLine.Save(flags, thisPath, unlock, voiceSet); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SkinTheme))) { SkinTheme.Save(flags, thisPath, unlock, hero); } if (ShouldDo(unlock, config, tags, typeof(STUUnlock_PortraitFrame))) { thisPath = Path.Combine(path, unlock.Type); PortraitFrame.Save(flags, thisPath, unlock); } }