/* * public void RemoveSim(ulong sim) * { * Sims.Remove(new SimID(sim)); * * int index = 0; * while (index < mSimData.Count) * { * SimData data = mSimData[index]; * * if (SimID.Matches (data.SimID, sim)) * { * mSimData.RemoveAt(index); * } * else * { * index++; * } * } * } */ public CasteOptions GetNewCasteOptions(string defaultName, string name, out bool created) { created = false; if (!string.IsNullOrEmpty(defaultName)) { ManagerCaste.AddDefaultCaste(defaultName); foreach (CasteOptions option in AllCastes) { if (option.DefaultName == defaultName) { StoryProgression.Main.GetOption <ManagerCaste.CreatedCastesOption>().AddValue(defaultName); return(option); } } if (StoryProgression.Main.GetValue <ManagerCaste.CreatedCastesOption, List <string> >().Contains(defaultName)) { return(null); } } if (mNextCasteID == 0) { foreach (ulong id in Castes.Keys) { if (mNextCasteID < id) { mNextCasteID = id; } } } mNextCasteID++; CasteOptions options = GetCasteOptions(mNextCasteID); if (options == null) { return(null); } options.SetValue <CasteNameOption, string>(name); if (!string.IsNullOrEmpty(defaultName)) { options.SetValue <CasteDefaultNameOption, string>(defaultName); StoryProgression.Main.GetOption <ManagerCaste.CreatedCastesOption>().AddValue(defaultName); } created = true; return(options); }
public void RemoveCaste(CasteOptions caste) { mCasteOptions.Remove(caste); Castes.Remove(caste.ID); ValidateCasteOptions(Castes); InvalidateCache(); }
public CasteOptions GetCasteOptions(ulong id) { CasteOptions result; if (!Castes.TryGetValue(id, out result)) { result = new CasteOptions(id); mCasteOptions.Add(result); Castes.Add(id, result); } return(result); }
public CasteFilter(CasteOptions options) { mPriority = options.GetValue <CastePriorityOption, int>(); mAutomatic = options.GetValue <CasteAutoOption, bool>(); foreach (CASAgeGenderFlags flag in options.GetValue <CasteAgeOption, List <CASAgeGenderFlags> >()) { mAgeGender |= flag; } foreach (CASAgeGenderFlags flag in options.GetValue <CasteGenderOption, List <CASAgeGenderFlags> >()) { mAgeGender |= flag; } mSpecies = new Dictionary <CASAgeGenderFlags, bool>(); foreach (CASAgeGenderFlags flag in options.GetValue <CasteSpeciesOption, List <CASAgeGenderFlags> >()) { mSpecies.Add(flag, true); } mTypes = new List <SimType>(options.GetValue <CasteTypeOption, List <SimType> >()); mMatchAll = options.GetValue <CasteMatchAllTypeOption, bool>(); mMinNetWorth = options.GetValue <CasteFundsMinOption, int>(); mMaxNetWorth = options.GetValue <CasteFundsMaxOption, int>(); string scoring = options.GetValue <CasteScoringOption, string>(); if (!string.IsNullOrEmpty(scoring)) { mScoring = ScoringLookup.GetScoring(scoring) as IScoringMethod <SimDescription, SimScoringParameters>; } mPersonalityLeaders = new Dictionary <string, bool>(); foreach (string personality in options.GetValue <CastePersonalityLeaderOption, List <string> >()) { mPersonalityLeaders[personality] = true; } mPersonalityMembers = new Dictionary <string, bool>(); foreach (string personality in options.GetValue <CastePersonalityMemberOption, List <string> >()) { mPersonalityMembers[personality] = true; } mRequiredTraits = new Dictionary <TraitNames, bool>(); foreach (TraitNames trait in options.GetValue <CasteTraitRequireOption, List <TraitNames> >()) { mRequiredTraits[trait] = true; } mDeniedTraits = new Dictionary <TraitNames, bool>(); foreach (TraitNames trait in options.GetValue <CasteTraitDenyOption, List <TraitNames> >()) { mDeniedTraits[trait] = true; } // I need to refactor this but she works for now mSkill = new List <SkillNames>(); foreach (string skill in options.GetValue <CasteSkillFilterOption, List <string> >()) { // we aren't storing this as skillnames cause twallan didn't for some reason. // I assume changing it will wipe existing DisallowSkill settings SkillNames skillName; if (ParserFunctions.TryParseEnum <SkillNames>(skill, out skillName, SkillNames.None)) { mSkill.Add(skillName); } } mSkillLevel = new Dictionary <SkillNames, List <int> >(); foreach (string skillLevel in options.GetValue <CasteSkillLevelFilterOption, List <string> >()) { string[] split = skillLevel.Split('-'); if (split.Length == 2) { SkillNames skillName; if (ParserFunctions.TryParseEnum <SkillNames>(split[0], out skillName, SkillNames.None)) { if (!mSkillLevel.ContainsKey(skillName)) { mSkillLevel.Add(skillName, new List <int>()); } int result; if (int.TryParse(split[1], out result)) { if (skillName != SkillNames.None && result > 0) { mSkillLevel[skillName].Add(result); } } } } } mCareer = new List <OccupationNames>(); foreach (OccupationNames career in options.GetValue <CasteCareerFilterOption, List <OccupationNames> >()) { mCareer.Add(career); } mCareerLevel = new Dictionary <OccupationNames, List <int> >(); foreach (string careerLevel in options.GetValue <CasteCareerLevelFilterOption, List <string> >()) { string[] split = careerLevel.Split('-'); if (split.Length == 2) { OccupationNames careerName; if (ParserFunctions.TryParseEnum <OccupationNames>(split[0], out careerName, OccupationNames.Undefined)) { if (!mCareerLevel.ContainsKey(careerName)) { mCareerLevel.Add(careerName, new List <int>()); } int result; if (int.TryParse(split[1], out result)) { if (careerName != OccupationNames.Undefined && result > 0) { mCareerLevel[careerName].Add(result); } } } } } mZodiac = new List <Zodiac>(); foreach (Zodiac zodiac in options.GetValue <CasteZodiacFilterOption, List <Zodiac> >()) { mZodiac.Add(zodiac); } mDegree = new List <AcademicDegreeNames>(); foreach (AcademicDegreeNames degree in options.GetValue <CasteDegreeFilterOption, List <AcademicDegreeNames> >()) { mDegree.Add(degree); } }
public static int SortByPriority(CasteOptions l, CasteOptions r) { return(l.Priority.CompareTo(r.Priority)); }
public bool Contains(CasteOptions caste) { return(Other.SimCastes.Contains(caste)); }