protected static bool ApplyOccupationUniform(SimDescription ths, SimOutfit uniform) { if (((uniform != null) && uniform.IsValid) && !ths.OccultManager.DisallowClothesChange()) { SimOutfit source = CASParts.GetOutfit(ths, CASParts.sPrimary, false); if (source == null) return false; CASParts.Key schoolKey = new CASParts.Key("NRaasSchoolOutfit"); SimOutfit schoolOutfit = CASParts.GetOutfit(ths, schoolKey, false); if (schoolOutfit == null) { using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(ths, schoolKey, source)) { new SavedOutfit(uniform).Apply(builder, true); } } schoolOutfit = CASParts.GetOutfit(ths, schoolKey, false); if (schoolOutfit != null) { Sim createdSim = ths.CreatedSim; if (createdSim != null) { SwitchOutfits.SwitchNoSpin(createdSim, schoolKey); return true; } } } return false; }
protected static bool ApplyOccupationUniform(SimDescription ths, SimOutfit uniform) { if (((uniform != null) && uniform.IsValid) && !ths.OccultManager.DisallowClothesChange()) { SimOutfit source = CASParts.GetOutfit(ths, CASParts.sPrimary, false); if (source == null) { return(false); } CASParts.Key schoolKey = new CASParts.Key("NRaasSchoolOutfit"); SimOutfit schoolOutfit = CASParts.GetOutfit(ths, schoolKey, false); if (schoolOutfit == null) { using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(ths, schoolKey, source)) { new SavedOutfit(uniform).Apply(builder, true); } } schoolOutfit = CASParts.GetOutfit(ths, schoolKey, false); if (schoolOutfit != null) { Sim createdSim = ths.CreatedSim; if (createdSim != null) { SwitchOutfits.SwitchNoSpin(createdSim, schoolKey); return(true); } } } return(false); }
protected override bool Allow(SimDescription sim, ref CASParts.Key outfitKey, ref bool alternate, ref CASParts.Key displayKey) { CASParts.Key currentKey = new CASParts.Key(sim.CreatedSim); if (outfitKey == currentKey) return false; return true; }
protected override bool Run(SimDescription me, bool singleSelection) { if (!ApplyAll) { List<OutfitCategories> categories = new List<OutfitCategories>(); foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories))) { if (category == OutfitCategories.Special) continue; categories.Add(category); } List<Item> allOptions = GetOptions(me, categories); CommonSelection<Item>.Results choices = new CommonSelection<Item>(Name, me.FullName, allOptions).SelectMultiple(); if ((choices == null) || (choices.Count == 0)) return false; mOutfits.Clear(); mOutfits.AddRange(choices); } CASParts.Key currentKey = new CASParts.Key(me.CreatedSim); // Remove them in reverse to ensure that removing earlier indices doesn't alter the index of later ones for(int i=mOutfits.Count-1; i>=0; i--) { Item item = mOutfits[i]; if (item.Value == currentKey) continue; me.RemoveOutfit(item.Category, item.Index, true); } return true; }
protected override bool Allow(SimDescription sim, ref CASParts.Key outfitKey, ref bool alternate, ref CASParts.Key displayKey) { displayKey = new CASParts.Key(sCategories[outfitKey.GetIndex()], 0); outfitKey = new CASParts.Key(Dresser.GetStoreOutfitKey(sCategories[outfitKey.GetIndex()], sim.IsUsingMaternityOutfits)); alternate = true; if (CASParts.GetOutfit(sim, outfitKey, true) == null) return false; return true; }
public bool Apply(SimBuilder builder, CASParts.Key key, bool applyHairColor, IEnumerable <BodyTypes> types, IEnumerable <BodyTypes> notTypes) { SavedOutfit outfit = Load(key); if (outfit == null) { return(false); } outfit.Apply(builder, applyHairColor, types, notTypes); return(true); }
public bool ApplyColors(SimDescriptionCore sim, CASParts.Key key) { SavedOutfit outfit = Load(key); if (outfit == null) { return(false); } outfit.mStore.Apply(sim); return(true); }
public SavedOutfit Store(CASParts.Key key, SavedOutfit outfit) { Dictionary <int, SavedOutfit> indices; if (!mOutfits.TryGetValue(key.mCategory, out indices)) { indices = new Dictionary <int, SavedOutfit>(); mOutfits.Add(key.mCategory, indices); } indices[key.GetIndex()] = outfit; return(outfit); }
public SavedOutfit Replace(CASParts.Key key, SimBuilder builder, bool applyHairColor) { if (!applyHairColor) { SavedOutfit oldOutfit = Load(key); if (oldOutfit != null) { oldOutfit.mStore.Apply(builder); } } return(Store(key, new SavedOutfit(builder))); }
public bool PropagateGenetics(SimDescriptionCore sim, CASParts.Key geneKey) { SimOutfit origOutfit = CASParts.GetOutfit(sim, geneKey, false); if (origOutfit == null) { return(false); } foreach (Key outfit in Outfits) { if (outfit.mKey == geneKey) { continue; } using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, outfit.mKey, origOutfit)) { outfit.Apply(builder, true, null, CASParts.GeneticBodyTypes); } } if (mAltOutfits != null) { foreach (Key outfit in mAltOutfits.Outfits) { if (outfit.mKey == geneKey) { continue; } using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, outfit.mKey, origOutfit)) { outfit.Apply(builder, true, null, CASParts.GeneticBodyTypes); } } } SimDescription simDesc = sim as SimDescription; if ((simDesc != null) && (simDesc.CreatedSim != null)) { simDesc.CreatedSim.RefreshCurrentOutfit(false); } Common.Sleep(); return(true); }
public SavedOutfit Load(CASParts.Key key) { Dictionary <int, SavedOutfit> indices; if (!mOutfits.TryGetValue(key.mCategory, out indices)) { return(null); } SavedOutfit outfit; if (!indices.TryGetValue(key.GetIndex(), out outfit)) { return(null); } return(outfit); }
protected override void Perform(SimDescription sim, CASParts.Key outfitKey, CASParts.Key displayKey) { CASParts.Key currentKey = new CASParts.Key(sim.CreatedSim); if (outfitKey == currentKey) return; switch (outfitKey.mCategory) { case OutfitCategories.Everyday: case OutfitCategories.Athletic: case OutfitCategories.Formalwear: case OutfitCategories.Swimwear: case OutfitCategories.Sleepwear: case OutfitCategories.Career: case OutfitCategories.Outerwear: // Don't allow the user to remove the last of a category if (sim.GetOutfitCount(outfitKey.mCategory) == 1) return; break; } CASParts.RemoveOutfit(sim, outfitKey, false); }
public static void SwitchNoSpin(Sim ths, CASParts.Key key) { SwitchNoSpinTaskB.Perform(ths, key.mCategory, key.GetIndex(ths.SimDescription, false)); }
public Key(CASParts.Key key, SavedOutfit outfit) { mKey = key; mOutfit = outfit; }
/* * public bool Apply(SimBuilder builder, OutfitCategories category, int index, bool applyHairColor) * { * return Apply(builder, category, index, applyHairColor, null, null); * } */ public bool Apply(CASParts.OutfitBuilder builder, CASParts.Key key, bool applyHairColor, IEnumerable <BodyTypes> types, IEnumerable <BodyTypes> notTypes) { return(Apply(builder.Builder, key, applyHairColor, types, notTypes)); }