protected static void CheckOutfits() { foreach (Sim sim in new List <Sim>(LotManager.Actors)) { try { OutfitCategories currentCategory = sim.CurrentOutfitCategory; int currentIndex = sim.CurrentOutfitIndex; SimOutfit outfit = sim.SimDescription.GetOutfit(currentCategory, currentIndex); if ((outfit == null) || (!outfit.IsValid)) { outfit = sim.SimDescription.GetOutfit(OutfitCategories.Everyday, 0); if ((outfit != null) && (outfit.IsValid)) { new ChangeOutfitTask(sim.SimDescription, OutfitCategories.Everyday).AddToSimulator(); } } } catch (Exception e) { Common.Exception(sim, e); } } }
public override bool Run() { try { OutfitCategories firstOutfit = base.Target.GetFirstOutfit(); OutfitCategories newFirstOutfit = ShowFirstOutfitTuningDialog(firstOutfit); OutfitCategories lastOutfit = base.Target.GetLastOutfit(); OutfitCategories newLastOutfit = ShowLastOutfitTuningDialog(lastOutfit); //Message.Sender.Show("Old outfits were: " + firstOutfit + " - " + lastOutfit); float showDuration = base.Target.ShowDurationMins; float[] showTimes = base.Target.ShowTimes; float newShowDuration; float[] newShowTimes; bool ok = ShowTimeTuningDialog(showDuration, showTimes, out newShowDuration, out newShowTimes); if (ok || firstOutfit != newFirstOutfit || lastOutfit != newLastOutfit) { base.Target.TuningChanged(newShowTimes, newShowDuration, newFirstOutfit, newLastOutfit); } } catch (Exception e) { Message.Sender.ShowError(base.Target, "Tuning failed, please try again", false, e); } return(true); }
private static bool SwitchToOutfitWithoutSpin(Sim ths, OutfitCategories category, int index) { if (!ths.AcceptableClothingCategoryForAge(category)) { return(false); } if (!ths.SwitchToOutfitTraitTest(Sim.ClothesChangeReason.Force, ref category)) { return(false); } SimOutfit outfit = CASParts.GetOutfit(ths.mSimDescription, new CASParts.Key(category, index), false); if ((outfit == null) || (outfit.Key == ResourceKey.kInvalidResourceKey)) { return(false); } if (ths.SimDescription.IsSupernaturalForm) { if (ths.BuffManager.TransformBuffInst != null) { if (ths.BuffManager.TransformBuffInst.GenerateTransformOutfit(outfit)) { int superIndex = ths.SimDescription.GetOutfitCount(OutfitCategories.Supernatural) - 0x1; outfit = CASParts.GetOutfit(ths.SimDescription, new CASParts.Key(OutfitCategories.Supernatural, superIndex), false); } } } ths.SwitchToOutfitWithoutSpin(category, outfit, index); return(true); }
protected override CASMode GetMode(SimDescription sim, ref OutfitCategories startCategory, ref int startIndex, ref EditType editType) { editType = mEditType; if (mStartCategory != OutfitCategories.None) { startCategory = mStartCategory; startIndex = 0; } if (sim == null) { return CASMode.Dresser; } else if (sim.IsEP11Bot) { return CASMode.EditABot; } else if (sim.IsHuman) { return CASMode.Dresser; } else if (sim.IsHorse) { return CASMode.Tack; } else if (sim.IsCat || sim.IsADogSpecies) { return CASMode.Collar; } else { return CASMode.Dresser; } }
public static void RemoveOutfits(SimDescriptionCore sim, OutfitCategories category, bool alternate) { for (int i = GetOutfitCount(sim, category, alternate) - 1; i >= 0; i--) { RemoveOutfit(sim, new Key(category, i), alternate); } }
protected override CASMode GetMode(SimDescription sim, ref OutfitCategories startCategory, ref int startIndex, ref EditType editType) { editType = mEditType; if (mStartCategory != OutfitCategories.None) { startCategory = mStartCategory; startIndex = 0; } if (sim == null) { return(CASMode.Stylist); } else if (sim.IsEP11Bot) { return(CASMode.EditABot); } else if (sim.IsHuman) { return(CASMode.Stylist); } else if (sim.IsHorse) { return(CASMode.Tack); } else if (sim.IsCat || sim.IsADogSpecies) { return(CASMode.Collar); } else { return(CASMode.Stylist); } }
public static void OnSimOutfitCategoryChanged(OutfitCategories outfitCategory) { try { CASClothingState state = CASClothing.CASClothingStateFromOutfitCategory(outfitCategory); if (CASPuck.Instance != null) { CASPuck.Instance.OnDynamicUpdateCurrentSimThumbnail(); } CASController controller = CASController.Singleton; if (controller != null) { controller.SetCurrentState(new CASState(CASTopState.CreateASim, CASMidState.Clothing, CASPhysicalState.None, state)); controller.Activate(true); } CASClothing ths = CASClothing.gSingleton; if (ths != null) { ths.UpdateState(state); } } catch (Exception e) { Common.Exception("OnSimOutfitCategoryChanged", e); } }
protected ShindigScenario(ShindigScenario scenario) : base (scenario) { mName = scenario.mName; mChanceOfHomeLot = scenario.mChanceOfHomeLot; mPartyAttire = scenario.mPartyAttire; mSuccess = scenario.mSuccess; }
protected ShindigScenario(ShindigScenario scenario) : base(scenario) { mName = scenario.mName; mChanceOfHomeLot = scenario.mChanceOfHomeLot; mPartyAttire = scenario.mPartyAttire; mSuccess = scenario.mSuccess; }
public void Set(OutfitCategories categories, List <WorldType> worldTypes, OutfitCategoriesExtended extended, CASAgeGenderFlags age, CASAgeGenderFlags gender, CASAgeGenderFlags species) { mCategories = categories; mExtended = extended; mAge = age; mGender = gender; mSpecies = species; mWorldTypes = worldTypes; }
public static bool isnraasloaded = false; //AssemblyCheckByNiec.IsInstalled("NRaasMasterController"); public static void NRCASParts_RemoveOutfits(SimDescriptionCore sim, OutfitCategories category, bool alternate) { //if (!isnraasloaded) { sim.RemoveOutfits(category, true); return; } //NiecNraTask.NraFunction temp = delegate //{ // NRaas.CommonSpace.Helpers.CASParts.RemoveOutfits(sim, category, alternate); //}; //temp(); sim.RemoveOutfits(category, true); }
public static ArrayList GetOutfits(SimDescriptionCore sim, OutfitCategories category, bool alternate) { if (alternate) { return(sim.Outfits[category] as ArrayList); } else { return(sim.GetCurrentOutfits()[category] as ArrayList); } }
public ClothingInfo() { Price = 250; Name = "Pedestal#"; SelectedPose = 1; IsVisible = true; PoseRotation = false; //AllowAutonomous = false; Gender = CASAgeGenderFlags.Female; Age = CASAgeGenderFlags.YoungAdult; OutfitCategory = OutfitCategories.Everyday; }
// Externalized to Dresser public static bool Allow(CASPart part, CASAgeGenderFlags age, CASAgeGenderFlags gender, CASAgeGenderFlags species, bool maternity, OutfitCategories category) { try { return (InvalidPartBooter.Allow(new CASParts.Wrapper(part), age, gender, species, maternity, category) == InvalidPartBase.Reason.None); } catch (Exception e) { Common.Exception("Allow", e); return true; } }
public Key(Sim sim) { mCategory = OutfitCategories.None; mIndex = 0; mSpecialKey = null; if (sim != null) { try{ mCategory = sim.CurrentOutfitCategory; mIndex = sim.CurrentOutfitIndex; }catch {} } }
public static int GetOutfitCount(SimDescriptionCore sim, OutfitCategories category, bool alternate) { ArrayList outfits = CASParts.GetOutfits(sim, OutfitCategories.Special, alternate); if (outfits == null) { return(0); } else { return(outfits.Count); } }
public void TuningChanged(float[] newShowTimes, float newShowDuration, OutfitCategories newFirstOutfit, OutfitCategories newLastOutfit) { if (newShowTimes.Length > 0) { mShowTimes = newShowTimes; for (int i = 0; i < mShowTimes.Length; i++) { if (mShowTimes[i] < 0) { mShowTimes[i] = 0; } if (mShowTimes[i] > 24) { mShowTimes[i] = 24; } } } mShowDurationMins = newShowDuration; if (mShowDurationMins < 0) { mShowDurationMins = 5; } if (mShowDurationMins > 300) { mShowDurationMins = 300; } if (newFirstOutfit == newLastOutfit) { mShowOutfits = new OutfitCategories[] { newFirstOutfit }; } else if (newLastOutfit == OutfitCategories.Naked) { mShowOutfits = new OutfitCategories[] { newFirstOutfit, OutfitCategories.Sleepwear, newLastOutfit }; } else { mShowOutfits = new OutfitCategories[] { newFirstOutfit, newLastOutfit }; } CalculateRoleTimes(); Message.Sender.Show(this, "new Show outfits are: " + OutfitsToString(mShowOutfits, " - ")); if (Message.Sender.IsDebugging()) { Message.Sender.Debug(this, "new Show outfits are: " + OutfitsToString(mShowOutfits, " - ")); } ResetRole(); }
public static string GetCategoryName(OutfitCategories category) { switch (category) { case OutfitCategories.None: return("(" + Common.LocalizeEAString("Ui/Caption/ObjectPicker:All") + ")"); case OutfitCategories.Bridle: return(Common.LocalizeEAString("Ui/Caption/ObjectPicker:BridleOnly")); default: return(Common.LocalizeEAString("Ui/Caption/ObjectPicker:" + category)); } }
public static string GetLocalizedClothingStyle(OutfitCategories category) { switch (category) { case OutfitCategories.Everyday: return(Common.LocalizeEAString("Ui/Caption/Party:Casual")); case OutfitCategories.Formalwear: return(Common.LocalizeEAString("Ui/Caption/Party:FormalAttire")); case OutfitCategories.Swimwear: return(Common.LocalizeEAString("Ui/Caption/Party:Swim")); } return(string.Empty); }
public static string GetLocalizedClothingStyle(OutfitCategories category) { switch (category) { case OutfitCategories.Everyday: return Common.LocalizeEAString("Ui/Caption/Party:Casual"); case OutfitCategories.Formalwear: return Common.LocalizeEAString("Ui/Caption/Party:FormalAttire"); case OutfitCategories.Swimwear: return Common.LocalizeEAString("Ui/Caption/Party:Swim"); } return string.Empty; }
public bool Import(Persistence.Lookup settings) { mAge = settings.GetEnum <CASAgeGenderFlags>("Age", CASAgeGenderFlags.None); mGender = settings.GetEnum <CASAgeGenderFlags>("Gender", CASAgeGenderFlags.None); mSpecies = settings.GetEnum <CASAgeGenderFlags>("Species", CASAgeGenderFlags.None); mCategories = settings.GetEnum <OutfitCategories>("Categories", OutfitCategories.None); mExtended = settings.GetEnum <OutfitCategoriesExtended>("Extended", (OutfitCategoriesExtended)0x0); mWorldTypes = new ToWorldType().Convert(settings.GetString("WorldTypes")); return(true); }
protected override CASMode GetMode(SimDescription sim, ref OutfitCategories startCategory, ref int startIndex, ref EditType editType) { if (!mAlwaysCAS) { if (mCAB) { return(CASMode.CreateABot); } else if (sim.IsEP11Bot) { return(CASMode.EditABot); } } return(CASMode.Full); }
protected override CASMode GetMode(SimDescription sim, ref OutfitCategories startCategory, ref int startIndex, ref EditType editType) { if (!mAlwaysCAS) { if (mCAB) { return CASMode.CreateABot; } else if (sim.IsEP11Bot) { return CASMode.EditABot; } } return CASMode.Full; }
public static void OnRemoval(OccultGenie ths, SimDescription simDes, bool alterOutfit) { if (ths.mGenieMagicPoints != null) { ths.mGenieMagicPoints.RestorePoints(); } OutfitCategories everyday = OutfitCategories.Everyday; int index = 0x0; Sim createdSim = simDes.CreatedSim; if (createdSim != null) { createdSim.SetOpacity(1f, 0f); createdSim.Motives.RestoreDecays(); everyday = createdSim.CurrentOutfitCategory; index = createdSim.CurrentOutfitIndex; } simDes.MotivesDontDecay = false; simDes.Marryable = true; simDes.AgingEnabled = true; if (simDes.TraitManager.HasElement(TraitNames.ImmuneToFire)) { simDes.TraitManager.RemoveElement(TraitNames.ImmuneToFire); } if (simDes.TraitManager.HasElement(TraitNames.GenieHiddenTrait)) { simDes.TraitManager.RemoveElement(TraitNames.GenieHiddenTrait); } if (alterOutfit) { simDes.SetSkinToneForAllOutfits(simDes.Age, CASSkinTones.NoSkinTone | CASSkinTones.HumanSkinTone, ths.mOldSkinToneIndex); if (createdSim != null) { Sim.SwitchOutfitHelper helper = new Sim.SwitchOutfitHelper(createdSim, everyday, index); helper.Start(); helper.Wait(false); helper.ChangeOutfit(); helper.Dispose(); } } }
private static OutfitCategories ShowFirstOutfitTuningDialog(OutfitCategories outfit) { Dictionary <string, object> regTypes = new Dictionary <string, object>(); regTypes.Add(OutfitCategories.Career.ToString(), OutfitCategories.Career.ToString()); regTypes.Add(OutfitCategories.Everyday.ToString(), OutfitCategories.Everyday.ToString()); regTypes.Add(OutfitCategories.Formalwear.ToString(), OutfitCategories.Formalwear.ToString()); regTypes.Add(OutfitCategories.Sleepwear.ToString(), OutfitCategories.Sleepwear.ToString()); regTypes.Add(OutfitCategories.Swimwear.ToString(), OutfitCategories.Swimwear.ToString()); regTypes.Add(OutfitCategories.Athletic.ToString(), OutfitCategories.Athletic.ToString()); object result = ComboSelectionDialog.Show("Dancer Starts In", regTypes, outfit.ToString()); OutfitCategories newOutfit = outfit; if (result is string) { newOutfit = (OutfitCategories)Enum.Parse(typeof(OutfitCategories), result as string, true); } return(newOutfit); }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); mChanceOfHomeLot = row.GetInt("ChanceOfHome", mChanceOfHomeLot); mPartyAttire = row.GetEnum <OutfitCategories>("Attire", OutfitCategories.None); if (mPartyAttire == OutfitCategories.None) { error = "Unknown Attire: " + row.GetString("Attire"); return(false); } mSuccess = new WeightScenarioHelper(Origin.FromSocialization); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return(false); } return(base.Parse(row, ref error)); }
protected override CASMode GetMode(SimDescription sim, ref OutfitCategories startCategory, ref int startIndex, ref EditType editType) { if (!mAlwaysCAS) { if (mCAB) { return(CASMode.CreateABot); } else if (sim.IsEP11Bot) { return(CASMode.EditABot); } } // Intergration using EA Edit in CAS will bring the bot into the human CAS if (sim.IsEP11Bot) { return(CASMode.EditABot); } return(CASMode.Full); }
protected void OnChangeOutfit() { bool useFormal = StoryProgression.Main.GetValue <UseForAllOption, bool>(); if ((!StoryProgression.Main.HasValue <PublicAssignSchoolScenario.ConsiderPublicOption, OccupationNames>(Actor.School.Guid)) && (StoryProgression.Main.GetValue <Option, bool>())) { useFormal = true; } if (Actor.Posture == Actor.Standing) { if (useFormal) { if (Actor.SimDescription.GetOutfitCount(OutfitCategories.Formalwear) > 1) { Actor.SwitchToOutfitWithoutSpin(OutfitCategories.Formalwear, 1); } else { Actor.SwitchToOutfitWithoutSpin(OutfitCategories.Formalwear); } } else { Actor.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToSchool); } } else if (Actor.LotCurrent != Target.LotCurrent) { OutfitCategories category = OutfitCategories.Formalwear; if (!useFormal) { Actor.GetOutfitForClothingChange(Sim.ClothesChangeReason.GoingToSchool, out category); } Actor.OutfitCategoryToUseForRoutingOffLot = category; } }
public int GetOutfitCount(OutfitCategories category, bool alternate) { Dictionary <int, SavedOutfit> outfits; if (alternate) { if (mAltOutfits == null) { return(0); } if (!mAltOutfits.mOutfits.TryGetValue(category, out outfits)) { return(0); } } else { if (!mOutfits.TryGetValue(category, out outfits)) { return(0); } } int maximum = 0; foreach (KeyValuePair <int, SavedOutfit> index in outfits) { if (maximum < (index.Key + 1)) { maximum = index.Key + 1; } } return(maximum); }
public void RequestStateOutfit(OutfitCategories category, int index, SimOutfit newOutfit) { mCASModel.RequestStateOutfit(category, index, newOutfit); }
public static void MakeupManagement(Sim sim, bool addRemove) { try { SimBuilder builder = new SimBuilder(); SimDescription simDescription = sim.SimDescription; OutfitCategories currentOutfitCategory = sim.CurrentOutfitCategory; int currentOutfitIndex = sim.CurrentOutfitIndex; builder.Clear(false); SimOutfit currentOutfit = sim.CurrentOutfit; OutfitUtils.SetOutfit(builder, currentOutfit, simDescription); if (addRemove) { sendDebugMsg(sim.FullName + "\nAdding eyes."); string designPreset = CASUtils.PartDataGetPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex)); builder.AddPart(ThirstMask); if (sim.SimDescription.YoungAdultOrAbove) { sim.BuffManager.AddElement(0xB110CC43B0C44B1C, (Origin)ResourceUtils.HashString64("ByAppearanceOfRedEyes")); } CASUtils.ApplyPresetToPart(builder, ThirstMask, designPreset); builder.SetPartPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex), designPreset); } else { builder.RemovePart(ThirstMask); sim.BuffManager.RemoveElement(0xB110CC43B0C44B1C); } SimOutfit outfit = new SimOutfit(builder.CacheOutfit(simDescription.FullName + currentOutfitCategory.ToString() + currentOutfitIndex.ToString())); if (simDescription.GetOutfitCount(currentOutfitCategory) > currentOutfitIndex) { simDescription.RemoveOutfit(currentOutfitCategory, currentOutfitIndex, true); } simDescription.AddOutfit(outfit, currentOutfitCategory, currentOutfitIndex); if (simDescription.CreatedSim != null) { sendDebugMsg("Updated: " + currentOutfitCategory.ToString() + "-" + currentOutfitIndex.ToString()); simDescription.CreatedSim.RefreshCurrentOutfit(false); } foreach (OutfitCategories categories2 in Enum.GetValues(typeof(OutfitCategories))) { if (categories2 != OutfitCategories.Special) { ArrayList list = simDescription.GetCurrentOutfits()[categories2] as ArrayList; if (list != null) { int count = list.Count; for (int i = 0; i < count; i++) { if ((categories2 != currentOutfitCategory) || (i != currentOutfitIndex)) { builder.Clear(false); SimOutfit outfit3 = list[i] as SimOutfit; OutfitUtils.SetOutfit(builder, outfit3, simDescription); if (addRemove) { string str2 = CASUtils.PartDataGetPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex)); builder.AddPart(ThirstMask); sim.BuffManager.AddElement(0xB110CC43B0C44B1C, (Origin)ResourceUtils.HashString64("ByAppearanceOfRedEyes")); CASUtils.ApplyPresetToPart(builder, ThirstMask, str2); builder.SetPartPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex), str2); } else { builder.RemovePart(ThirstMask); sim.BuffManager.RemoveElement(0xB110CC43B0C44B1C); } SimOutfit outfit4 = new SimOutfit(builder.CacheOutfit(simDescription.FullName + categories2.ToString() + i.ToString())); if (simDescription.GetOutfitCount(categories2) > i) { simDescription.RemoveOutfit(categories2, i, true); } simDescription.AddOutfit(outfit4, categories2, i); sendDebugMsg("Updated: " + categories2.ToString() + "-" + i.ToString()); Sleep(0); } } } } } SimOutfit outfit5 = simDescription.GetOutfit(OutfitCategories.Everyday, 0); if (outfit5 != null) { ThumbnailManager.GenerateHouseholdSimThumbnail(outfit5.Key, outfit5.Key.InstanceId, 0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, simDescription.AgeGenderSpecies); } } catch (Exception exception) { SimpleMessageDialog.Show("Vampire Tweaker - Thirst Effect", sim.Name + "\nApply makeup failed!\n" + exception); } }
protected static CASMode OnGetMode(SimDescription sim, ref OutfitCategories startCategory, ref int startIndex, ref Sims.CASBase.EditType editType) { return(CASMode.Full); }
public Key(string specialKey) { mCategory = OutfitCategories.Special; mIndex = -1; mSpecialKey = specialKey; }
public Key(OutfitCategories category, int index) { mCategory = category; mIndex = index; mSpecialKey = null; }
public SimOutfit GetSimOutfitFromSimDescriptionKey(ResourceKey key, OutfitCategories outfitCategory) { return mCASModel.GetSimOutfitFromSimDescriptionKey(key, outfitCategory); }
public void RequestRemoveOutfit(OutfitCategories category, int index, bool undoable) { mCASModel.RequestRemoveOutfit(category, index, undoable); }
public static void RemoveOutfits(SimDescriptionCore sim, OutfitCategories category, bool alternate) { for (int i = GetOutfitCount(sim, category, alternate)-1; i >= 0; i--) { RemoveOutfit(sim, new Key(category, i), alternate); } }
public static int AddOutfit(SimDescriptionCore sim, OutfitCategories category, SimBuilder builder, bool alternate) { return ReplaceOutfit(sim, new Key(category, -1), builder, alternate); }
public static int GetOutfitCount(SimDescriptionCore sim, OutfitCategories category, bool alternate) { ArrayList outfits = CASParts.GetOutfits(sim, OutfitCategories.Special, alternate); if (outfits == null) { return 0; } else { return outfits.Count; } }
public static ArrayList GetOutfits(SimDescriptionCore sim, OutfitCategories category, bool alternate) { if (alternate) { return sim.Outfits[category] as ArrayList; } else { return sim.GetCurrentOutfits()[category] as ArrayList; } }
public static string GetOutfitName(SimDescriptionCore sim, OutfitCategories category, bool maternity) { return GetOutfitName(sim, new Key(category, sim.GetOutfitCount(category)), maternity); }
protected override CASMode GetMode(SimDescription sim, ref OutfitCategories startCategory, ref int startIndex, ref EditType editType) { editType = EditType.None; return CASMode.Mirror; }
public void AddOutfit(OutfitCategories category) { mCASModel.AddOutfit(category); }
public static string ConvertToString(OutfitCategories flags) { string results = null; foreach (OutfitCategories flag in Enum.GetValues(typeof(OutfitCategories))) { switch (flag) { case OutfitCategories.None: continue; } if ((flags & flag) == flag) { results += ", " + flag.ToString(); } } return results; }
public void OnSimOutfitCategoryChangedProxy(OutfitCategories outfitCategory) { try { if (OnSimOutfitCategoryChanged != null) { OnSimOutfitCategoryChanged(outfitCategory); } } catch (Exception e) { Common.Exception("OnSimOutfitCategoryChangedProxy", e); } }
protected Key() { mCategory = OutfitCategories.None; mIndex = -1; mSpecialKey = null; }
public void RemoveOutfit(OutfitCategories category, int index, int newOutfitIndex) { mCASModel.RemoveOutfit(category, index, newOutfitIndex); }
public Key(OutfitCategories category, SimDescriptionCore sim) { mCategory = category; mIndex = sim.GetOutfitCount(category); mSpecialKey = null; }
public Key(Sim sim) { mCategory = OutfitCategories.None; mIndex = 0; mSpecialKey = null; if (sim != null) { try { mCategory = sim.CurrentOutfitCategory; mIndex = sim.CurrentOutfitIndex; } catch { } } }
public ArrayList GetOutfits(OutfitCategories category) { return mCASModel.GetOutfits(category); }
protected override CASMode GetMode(SimDescription sim, ref OutfitCategories startCategory, ref int startIndex, ref EditType editType) { return CASMode.Tattoo; }
protected static bool Allow(CASParts.Wrapper part, CASAgeGenderFlags age, CASAgeGenderFlags gender, CASAgeGenderFlags species, bool maternity, OutfitCategories category, out string reason) { if (!IsValidProductVersion(part)) { reason = "ProductVersion Fail"; return false; } if (Dresser.Settings.mUseMasterControllerBlackList) { if (sMasterControllerAllow.Valid) { if (!sMasterControllerAllow.Invoke<bool>(new object[] { part.mPart, age, gender, species, maternity, category })) { reason = "MasterController Blacklist Fail"; return false; } } else { Common.Notify("sMasterControllerAllow.Valid = False"); } } InvalidPartBase.Reason result = InvalidPartBooter.Allow(part, age, gender, species, maternity, category); if (result != InvalidPartBase.Reason.None) { reason = "Dresser Blacklist Fail: " + result; return false; } if ((part.ExtendedCategory & OutfitCategoriesExtended.IsHat) == OutfitCategoriesExtended.IsHat) { if ((!Dresser.Settings.mAllowHats) || (Dresser.Settings.mInvalidHatCategories.Contains(category))) { reason = "Hat Category Fail"; return false; } } reason = null; return true; }
public void RequestAddSelectOutfit(OutfitCategories category) { mCASModel.RequestAddSelectOutfit(category); }
protected static CASParts.PartPreset GetRandomPreset(BodyTypes location, OutfitCategories category, CASAgeGenderFlags age, CASAgeGenderFlags gender, CASAgeGenderFlags species, bool maternity, StringBuilder log) { try { log.Append(Common.NewLine + " Location: " + location); log.Append(Common.NewLine + " Category: " + category); log.Append(Common.NewLine + " Age: " + age); log.Append(Common.NewLine + " Gender: " + gender); log.Append(Common.NewLine + " Species: " + species); log.Append(Common.NewLine + " Maternity: " + maternity); Dictionary<ResourceKey, CASParts.Wrapper> parts; if (AllParts.TryGetValue(location, out parts)) { log.Append(Common.NewLine + " Parts Found: " + parts.Count); List<CASParts.Wrapper> choices = new List<CASParts.Wrapper>(); Dictionary<string,int> reasons = new Dictionary<string,int>(); foreach (CASParts.Wrapper test in parts.Values) { ProcessOptions type = GetType(test.mPart.BodyType); if ((type != ProcessOptions.BodyHair) || (!Dresser.Settings.mIgnoreBodyHairGender)) { if ((test.Gender & gender) != gender) { Add(reasons, "Gender Fail"); continue; } } if ((test.Age & age) != age) { Add(reasons, "Age Fail"); continue; } if (test.Species != species) { Add(reasons, "Species Fail"); continue; } if ((test.Category & category) != category) { Add(reasons, "Category Fail"); continue; } string reason = null; if (!Allow(test, age, gender, species, maternity, category, out reason)) { Add(reasons, reason); continue; } if ((test.ExtendedCategory & OutfitCategoriesExtended.IsHiddenInCAS) != 0x0) { Add(reasons, "HiddenInCAS Fail"); continue; } bool testIgnore = false; switch(type) { case ProcessOptions.Beard: case ProcessOptions.BodyHair: testIgnore = !Dresser.Settings.mIgnoreValidForRandomBodyHair; break; case ProcessOptions.Hair: testIgnore = !Dresser.Settings.mIgnoreValidForRandomHair; break; case ProcessOptions.Accessories: testIgnore = !Dresser.Settings.mIgnoreValidForRandomAccessories; break; case ProcessOptions.Makeup: testIgnore = !Dresser.Settings.mSameMakeupForAllCategories; break; default: testIgnore = !Dresser.Settings.mIgnoreValidForRandomClothing; break; } if ((testIgnore) && (test.ExtendedCategory & OutfitCategoriesExtended.ValidForRandom) == 0) { Add(reasons, "ValidForRandom Fail"); continue; } if (maternity) { if ((test.ExtendedCategory & OutfitCategoriesExtended.ValidForMaternity) == 0) { Add(reasons, "ValidForMaternity Fail"); continue; } } choices.Add(test); } foreach (KeyValuePair<string, int> reason in reasons) { log.Append(Common.NewLine + " " + reason.Key + ": " + reason.Value); } log.Append(Common.NewLine + " Final Count: " + choices.Count + Common.NewLine); if (choices.Count > 0) { int tries = 0; while (tries < 10) { tries++; CASParts.PartPreset preset = RandomUtil.GetRandomObjectFromList(choices).GetRandomPreset(); if (preset != null) { return preset; } } } } else { log.Append(Common.NewLine + " No Parts Found" + Common.NewLine); } } catch (Exception e) { Common.Exception(location.ToString(), e); } return null; }