private static void RandomizeAudio(IMEPackage package, int topLevelUIndex, bool female) { var audioToChange = package.Exports.Where(x => x.idxLink == topLevelUIndex && x.ClassName == "WwiseStream").ToList(); var audioSources = MERFileSystem.LoadedFiles.Keys.Where(x => x.Contains("_LOC_INT", StringComparison.InvariantCultureIgnoreCase) && x.Contains("Bio")).ToList(); foreach (var aExp in audioToChange) { bool installed = false; while (!installed) { var rAudioSourceF = audioSources.RandomElement(); var rAudioSourceP = MEPackageHandler.OpenMEPackage(MERFileSystem.GetPackageFile(rAudioSourceF)); var audioOptions = rAudioSourceP.Exports.Where(x => x.ClassName == "WwiseStream").ToList(); if (!audioOptions.Any()) { continue; } var audioChoice = audioOptions.RandomElement(); // Repoint the TLK to match what's going to be said var nTlk = WwiseTools.ExtractTLKIdFromExportName(audioChoice); var oTlk = WwiseTools.ExtractTLKIdFromExportName(aExp); if (nTlk != -1 && oTlk != -1 && !string.IsNullOrWhiteSpace(TLKHandler.TLKLookupByLang(nTlk, "INT"))) { TLKHandler.ReplaceString(oTlk, TLKHandler.TLKLookupByLang(nTlk, "INT")); WwiseTools.RepointWwiseStream(audioChoice, aExp); installed = true; } } } }
public Talent(ExportEntry powerClass, bool isEvolution = false) { PowerExport = powerClass; IsEvolution = isEvolution; var baseClass = powerClass; var baseClassObj = baseClass.GetDefaults().GetProperty <ObjectProperty>("EvolvedPowerClass1"); while (baseClassObj == null || baseClassObj.Value == 0) { baseClass = (ExportEntry)baseClass.SuperClass; baseClassObj = baseClass.GetDefaults().GetProperty <ObjectProperty>("EvolvedPowerClass1"); } BasePower = baseClass; if (BasePower.ObjectName.Name.Contains("Passive")) { IsPassive = true; } else { var baseName = baseClass.GetDefaults().GetProperty <NameProperty>("BaseName"); while (baseName == null) { baseClass = (ExportEntry)baseClass.SuperClass; baseName = baseClass.GetDefaults().GetProperty <NameProperty>("BaseName"); } BaseName = baseName.Value.Name; } // Setup name var superDefaults = PowerExport.GetDefaults(); var displayNameProps = superDefaults.GetProperties(); var superProps = displayNameProps; var displayName = superProps.GetProp <StringRefProperty>("DisplayName"); while (displayName == null) { superDefaults = ((superDefaults.Class as ExportEntry).SuperClass as ExportEntry).GetDefaults(); superProps = superDefaults.GetProperties(); superProps.GetProp <StringRefProperty>("DisplayName"); displayName = superProps.GetProp <StringRefProperty>("DisplayName"); } PowerName = TLKHandler.TLKLookupByLang(displayName.Value, "INT"); if (IsEvolution) { // Setup the blurb var blurbDesc = TLKHandler.TLKLookupByLang(displayNameProps.GetProp <StringRefProperty>("TalentDescription").Value, "INT").Split('\n')[0]; EvolvedBlurb = $"{PowerName}: {blurbDesc}"; } IsAmmoPower = PowerName.Contains("Ammo"); IsCombatPower = !IsAmmoPower && !IsPassive; }