public static bool SetTone <TActor, TTarget>(InteractionInstance <TActor, TTarget> interaction, List <ITone> allTones, ref string toneName) where TActor : class, IActor where TTarget : class, IGameObject { List <ITone> tonechoices = new List <ITone>(); List <SkillNames> skills = new List <SkillNames>(); GatherChoices(interaction.InstanceActor, allTones, tonechoices, skills); GatherSkillTones(skills, allTones, tonechoices); ITone tone = null; if (tonechoices.Count > 0) { tone = RandomUtil.GetRandomObjectFromList(tonechoices); } if ((tone == null) && (allTones.Count > 0)) { tone = RandomUtil.GetRandomObjectFromList(allTones); } interaction.CurrentITone = null; if (tone != null) { try { interaction.CurrentITone = tone; toneName = tone.Name(); return(true); } catch (Exception e) { Common.DebugException(tone.Name(), e); } } return(false); }
protected static bool IsPracticeTone(ITone tone, SkillNames skill) { List <SkillNames> customTone = new List <SkillNames>(); Assembly careerMod = Common.AssemblyCheck.FindAssembly("nraascareer"); if (careerMod != null) { Type type = careerMod.GetType("NRaas.Gameplay.Tones.CareerToneEx"); if (type != null) { if (type.IsInstanceOfType(tone)) { MethodInfo method = type.GetMethod("GetSkills"); if (method != null) { method.Invoke(tone, new object[] { customTone }); } } } } if (skill == SkillNames.None) { if (customTone.Count > 0) { return(true); } if (tone is ProSports.WorkOutInGym) { return(true); } if (tone is LawEnforcement.WorkoutTone) { return(true); } if (tone is Criminal.PracticeIllicitActivities) { return(true); } if (tone is Journalism.PracticeWriting) { return(true); } if (tone is Music.StudyMusicTheoryTone) { return(true); } if (tone is Culinary.PracticeCookingTone) { return(true); } } else { if (customTone.Contains(skill)) { return(true); } switch (skill) { case SkillNames.Athletic: if (tone is ProSports.WorkOutInGym) { return(true); } if (tone is LawEnforcement.WorkoutTone) { return(true); } if (tone is Criminal.PracticeIllicitActivities) { return(true); } break; case SkillNames.Writing: if (tone is Journalism.PracticeWriting) { return(true); } break; case SkillNames.Guitar: if (tone is Music.StudyMusicTheoryTone) { return(true); } break; case SkillNames.Cooking: if (tone is Culinary.PracticeCookingTone) { return(true); } break; } } return(false); }