public static bool HasMetric(Career job, SkillNames skill) { if (job == null) { return(false); } if (job.CurLevel == null) { return(false); } foreach (PerfMetric metric in job.CurLevel.Metrics) { MetricSkillX skillMetric = metric as MetricSkillX; if (skillMetric == null) { continue; } if (skillMetric.SkillGuid == skill) { return(true); } } return(false); }
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); } } } }
public MetricMusicSkill(MetricSkillX metric) : base (new StubXmlDbRow(), 0) { mMap0 = metric.mMap0; mMap3 = metric.mMap3; mMapNeg3 = metric.mMapNeg3; SkillGuid = metric.SkillGuid; }
public MetricMusicSkill(MetricSkillX metric) : base(new StubXmlDbRow(), 0) { mMap0 = metric.mMap0; mMap3 = metric.mMap3; mMapNeg3 = metric.mMapNeg3; SkillGuid = metric.SkillGuid; }
public void OnPreLoad() { try { Career music = CareerManager.GetStaticCareer(OccupationNames.Music); if (music == null) { return; } BooterLogger.AddTrace("Replace Metric Music Skill"); foreach (Dictionary <int, CareerLevel> value in music.CareerLevels.Values) { foreach (CareerLevel level in value.Values) { List <PerfMetric> metrics = new List <PerfMetric>(level.Metrics); foreach (PerfMetric metric in metrics) { MetricSkillX skillMetric = metric as MetricSkillX; if (skillMetric == null) { continue; } if (skillMetric.SkillGuid == SkillNames.Guitar) { BooterLogger.AddTrace("Metric Replaced: " + level.BranchName + " " + level.Level); level.Metrics.Remove(metric); level.Metrics.Add(new MetricMusicSkill(skillMetric)); } } } } } catch (Exception e) { Common.Exception("OnPreLoad", e); } }
public override bool ShouldAddTone(Career career) { try { if (!GameUtils.IsInstalled(mVersion)) { return(false); } if (!base.ShouldAddTone(career)) { return(false); } if (!string.IsNullOrEmpty(mBranch)) { if (career.CurLevelBranchName != mBranch) { return(false); } } if (mMinLevel > career.CareerLevel) { return(false); } if (mMaxLevel < career.CareerLevel) { return(false); } if (career.OwnerDescription == null) { return(false); } if (career.OwnerDescription.SkillManager == null) { return(false); } if (mMetrics.Count > 0) { foreach (MetricRate rate in mMetrics) { switch (rate.mMetric) { case MetricRate.MetricType.Reports: LawEnforcement law = OmniCareer.Career <LawEnforcement>(career); if (law != null) { if (!OmniCareer.HasMetric <LawEnforcement.MetricReportsWritten>(career)) { return(false); } } break; case MetricRate.MetricType.StoriesAndReviews: Journalism journalism = OmniCareer.Career <Journalism>(career); if (journalism != null) { if (!OmniCareer.HasMetric <Journalism.MetricStoriesAndReviews>(career)) { return(false); } } break; } } } if (mSkills.Count > 0) { bool needed = false; foreach (SkillRate skill in mSkills) { if (mMustHaveVisibleSkill) { if (!career.OwnerDescription.SkillManager.IsPlayerVisible(skill.mSkill)) { return(false); } } if (skill.mSkill == SkillNames.Athletic) { if ((career.OwnerDescription.CreatedSim != null) && (career.OwnerDescription.CreatedSim.BuffManager != null) && (career.OwnerDescription.CreatedSim.BuffManager.HasElement(BuffNames.Fatigued))) { return(false); } } if (mOnlyMetric) { bool found = false; foreach (PerfMetric metric in career.CurLevel.Metrics) { MetricSkillX skillMetric = metric as MetricSkillX; if (skillMetric == null) { continue; } if (skillMetric.SkillGuid == skill.mSkill) { found = true; break; } } if (!found) { return(false); } } Skill simSkill = career.OwnerDescription.SkillManager.GetSkill <Skill>(skill.mSkill); if ((simSkill == null) || (simSkill.SkillLevel < simSkill.MaxSkillLevel)) { needed = true; } } if ((!needed) && (mOnlySkill)) { return(false); } } return(true); } catch (Exception exception) { Common.Exception(career.OwnerDescription, exception); } return(false); }