protected virtual void GetPotentialSkills(List <SkillNames> skills) { SimData data = Options.GetSim(Sim); Career career = Sim.Occupation as Career; if (career != null) { foreach (PerfMetric metric in career.CurLevel.Metrics) { MetricSkillX skillMetric = metric as MetricSkillX; if (skillMetric == null) { continue; } Skill skill = Sim.SkillManager.GetSkill <Skill>(skillMetric.SkillGuid); if (skill != null) { if (skill.ReachedMaxLevel()) { continue; } } if (!Skills.AllowSkill(this, Sim, data, skillMetric.SkillGuid)) { continue; } skills.Add(skillMetric.SkillGuid); } } if (skills.Count == 0) { if (RandomUtil.RandomChance(AddScoring("GeneralSkilling", Sim))) { foreach (Skill staticSkill in SkillManager.SkillDictionary) { Skill skill = Sim.SkillManager.GetSkill <Skill>(staticSkill.Guid); if (skill != null) { if (skill.ReachedMaxLevel()) { continue; } } if (!Skills.AllowSkill(this, Sim, data, staticSkill.Guid)) { continue; } skills.Add(staticSkill.Guid); } } } }
protected override bool PrivateUpdate(ScenarioFrame frame) { base.PrivateUpdate(frame); if (sSkills == null) { sSkills = new Dictionary <Sims3.Gameplay.Skills.SkillNames, InteractionDefinition>(); sSkills.Add(Sims3.Gameplay.Skills.SkillNames.Guitar, GuitarPlayForTips.Singleton); sSkills.Add(Sims3.Gameplay.Skills.SkillNames.BassGuitar, BassGuitarPlayForTips.Singleton); sSkills.Add(Sims3.Gameplay.Skills.SkillNames.Piano, PianoPlayForTips.Singleton); sSkills.Add(Sims3.Gameplay.Skills.SkillNames.Drums, DrumsPlayForTips.Singleton); sSkills.Add(Sims3.Gameplay.Skills.SkillNames.LaserHarp, LaserHarpPlayForTips.Singleton); } List <Sims3.Gameplay.Skills.SkillNames> choices = new List <Sims3.Gameplay.Skills.SkillNames>(); SimData data = Options.GetSim(Sim); foreach (Sims3.Gameplay.Skills.SkillNames skill in sSkills.Keys) { if (!Skills.AllowSkill(this, Sim, data, skill)) { continue; } choices.Add(skill); } if (choices.Count == 0) { IncStat("No Choices"); return(false); } BandInstrument instrument = null; InteractionDefinition definition = null; RandomUtil.RandomizeListOfObjects(choices); foreach (Sims3.Gameplay.Skills.SkillNames skill in choices) { switch (skill) { case Sims3.Gameplay.Skills.SkillNames.Guitar: instrument = Inventories.InventoryFind <Guitar>(Sim); if (instrument == null) { instrument = ManagedBuyProduct <Guitar> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills); } break; case Sims3.Gameplay.Skills.SkillNames.BassGuitar: instrument = Inventories.InventoryFind <BassGuitar>(Sim); if (instrument == null) { instrument = ManagedBuyProduct <BassGuitar> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills); } break; case Sims3.Gameplay.Skills.SkillNames.Piano: instrument = Inventories.InventoryFind <Piano>(Sim); if (instrument == null) { instrument = ManagedBuyProduct <Piano> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills); } break; case Sims3.Gameplay.Skills.SkillNames.Drums: instrument = Inventories.InventoryFind <Drums>(Sim); if (instrument == null) { instrument = ManagedBuyProduct <Drums> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills); } break; case Sims3.Gameplay.Skills.SkillNames.LaserHarp: instrument = Inventories.InventoryFind <LaserHarp>(Sim); if (instrument == null) { instrument = ManagedBuyProduct <LaserHarp> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills); } break; } if (instrument != null) { definition = sSkills[skill]; break; } } if (instrument == null) { IncStat("No Instrument"); return(false); } Lot lot = Sim.CreatedSim.LotCurrent; if ((Sim.LotHome == lot) || (lot.IsWorldLot) || (lot.IsResidentialLot)) { if (!Situations.PushVisit(this, Sim, Lots.GetCommunityLot(Sim.CreatedSim, null, true))) { IncStat("Push Lot Fail"); return(false); } } return(Situations.PushInteraction(this, Sim, instrument, definition)); }