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 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); }
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 void Perform(SimDescription sim, CASParts.Key outfitKey, CASParts.Key displayKey) { SimOutfit source = CASParts.GetOutfit(sim, outfitKey, false); using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(Dresser.GetStoreOutfitKey(outfitKey.mCategory, sim.IsUsingMaternityOutfits)), source, true)) { } }
protected override void Perform(SimDescription sim, CASParts.Key outfitKey, CASParts.Key displayKey) { SimOutfit geneOutfit = CASParts.GetOutfit(sim, CASParts.sPrimary, false); SimOutfit source = CASParts.GetOutfit(sim, outfitKey, true); using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(displayKey.mCategory, sim), geneOutfit)) { new SavedOutfit(source).Apply(builder, false, null, CASParts.GeneticBodyTypes); } }
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 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 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); }
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); }
private Cache(SimDescriptionCore sim, bool alternate) { if ((alternate) && (!sim.IsUsingMaternityOutfits)) { return; } foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories))) { if (category == OutfitCategories.Supernatural) { continue; } ArrayList outfits = CASParts.GetOutfits(sim, category, alternate); if (outfits != null) { for (int i = 0x0; i < outfits.Count; i++) { SimOutfit outfit = outfits[i] as SimOutfit; if (outfit == null) { continue; } Store(new CASParts.Key(category, i), new SavedOutfit(outfit)); } } } if (!alternate) { mAltOutfits = new Cache(sim, true); } }
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)); }
protected override bool Allow(SimDescription sim, ref CASParts.Key outfitKey, ref bool alternate, ref CASParts.Key displayKey) { return true; }
public void Apply(CASParts.OutfitBuilder builder, bool applyHairColor, IEnumerable<BodyTypes> argTypes, IEnumerable<BodyTypes> argNotTypes) { mOutfit.Apply(builder, applyHairColor, argTypes, argNotTypes); }
public override string ToString() { return(CASParts.PartToString(mPart)); }
public Key(CASParts.Key key, SavedOutfit outfit) { mKey = key; mOutfit = outfit; }
public static void SwitchNoSpin(Sim ths, CASParts.Key key) { SwitchNoSpinTaskB.Perform(ths, key.mCategory, key.GetIndex(ths.SimDescription, false)); }
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 static bool CopyGenetics(SimDescriptionCore source, SimDescriptionCore destination, bool onlyNonZero, bool onlySliders) { SimOutfit sourceOutfit = CASParts.GetOutfit(source, CASParts.sPrimary, false); if (sourceOutfit == null) { return(false); } SimOutfit sourceWerewolfOutfit = CASParts.GetOutfit(source, new CASParts.Key(OutfitCategories.Supernatural, 0), false); SimDescription sourceDesc = source as SimDescription; SimDescription destDesc = destination as SimDescription; if ((!onlySliders) && (!SimTypes.IsSkinJob(sourceDesc)) && (!SimTypes.IsSkinJob(destDesc))) { destDesc.SkinToneKey = sourceDesc.SkinToneKey; destDesc.SkinToneIndex = sourceDesc.SkinToneIndex; } destDesc.SecondaryNormalMapWeights = sourceDesc.SecondaryNormalMapWeights.Clone() as float[]; using (SimBuilder sourceBuilder = new SimBuilder()) { OutfitUtils.SetOutfit(sourceBuilder, sourceOutfit, source); using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(destination, CASParts.sPrimary)) { if (!builder.OutfitValid) { return(false); } if ((!onlySliders) && (destDesc != null)) { builder.Builder.SkinTone = destDesc.SkinToneKey; builder.Builder.SkinToneIndex = destDesc.SkinToneIndex; } foreach (FacialBlend blend in FaceBlends) { float amount = GetBlendAmount(sourceBuilder, blend); if (onlyNonZero) { if (amount == 0.0) { continue; } } SetBlendAmount(builder.Builder, blend, amount); } foreach (FacialBlend blend in FurBlends) { float amount = GetBlendAmount(sourceBuilder, blend); if (onlyNonZero) { if (amount == 0.0) { continue; } } SetBlendAmount(builder.Builder, blend, amount); } if (!onlySliders) { builder.CopyGeneticParts(sourceOutfit); } } sourceBuilder.Clear(); if ((sourceWerewolfOutfit != null) && (destDesc.IsWerewolf)) { OutfitUtils.SetOutfit(sourceBuilder, sourceWerewolfOutfit, source); using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(destination, new CASParts.Key(OutfitCategories.Supernatural, 0))) { if ((!onlySliders) && (destDesc != null)) { builder.Builder.SkinTone = destDesc.SkinToneKey; builder.Builder.SkinToneIndex = destDesc.SkinToneIndex; } foreach (FacialBlend blend in FaceBlends) { float amount = GetBlendAmount(sourceBuilder, blend); if (onlyNonZero) { if (amount == 0.0) { continue; } } SetBlendAmount(builder.Builder, blend, amount); } builder.Components = CASLogic.sWerewolfPreserveComponents; } } } return(true); }
/* public bool ApplyAlt(SimBuilder builder, CASParts.Key key, bool applyHairColor) { return ApplyAlt(builder, key, applyHairColor, null, null); } */ public bool ApplyAlt(SimBuilder builder, CASParts.Key key, bool applyHairColor, IEnumerable<BodyTypes> types, IEnumerable<BodyTypes> notTypes) { if (mAltOutfits == null) return false; SavedOutfit outfit = mAltOutfits.Load(key); if (outfit == null) return false; outfit.Apply(builder, applyHairColor, types, notTypes); return true; }
/* 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); }
public bool ApplyColors(SimDescriptionCore sim, CASParts.Key key) { SavedOutfit outfit = Load(key); if (outfit == null) return false; outfit.mStore.Apply(sim); return true; }
/* public void Apply(SimBuilder builder, bool applyHairColor) { List<BodyTypes> types = new List<BodyTypes>(); foreach (SavedPart part in mParts) { if (types.Contains(part.mPart.BodyType)) continue; types.Add(part.mPart.BodyType); } Apply(builder, applyHairColor, types, null); } */ public void Apply(CASParts.OutfitBuilder builder, bool applyHairColor) { Apply(builder, applyHairColor, UsedSingleBodyTypes, null); }
public static void OnAddition(OccultUnicorn ths, SimDescription simDes, bool alterOutfit) { if (alterOutfit) { if (simDes.HorseManager == null) { return; } Color[] maneColors = simDes.HorseManager.ActiveManeHairColors; simDes.HorseManager.ActiveUnicornBeardHairColors = maneColors; if (sParts == null) { sParts = CASParts.GetParts(PartMatches); } List <CASParts.PartPreset> parts = new List <CASParts.PartPreset>(); foreach (CASParts.Wrapper part in sParts) { if (!part.ValidFor(simDes)) { continue; } CASParts.PartPreset preset = part.GetRandomPreset(); if (preset == null) { continue; } parts.Add(preset); } if (parts.Count > 0) { GeneticsPet.SpeciesSpecificData speciesData = new GeneticsPet.SpeciesSpecificData(); speciesData.UnicornBeardHairColors = simDes.HorseManager.ActiveUnicornBeardHairColors; foreach (OutfitCategories category in simDes.ListOfCategories) { switch (category) { case OutfitCategories.All: case OutfitCategories.CategoryMask: case OutfitCategories.None: case OutfitCategories.PrimaryCategories: case OutfitCategories.PrimaryHorseCategories: case OutfitCategories.Special: continue; default: for (int i = 0x0; i < simDes.GetOutfitCount(category); i++) { using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(simDes, new CASParts.Key(category, i))) { foreach (CASParts.PartPreset part in parts) { builder.Builder.RemoveParts(new BodyTypes[] { part.mPart.BodyType }); builder.ApplyPartPreset(part); if (part.mPart.BodyType == BodyTypes.PetBeard) { OutfitUtils.AdjustPresetForHorseHairColor(builder.Builder, part.mPart, speciesData); } } } } break; } } if (simDes.CreatedSim != null) { simDes.CreatedSim.UpdateOutfitInfo(); simDes.CreatedSim.RefreshCurrentOutfit(false); } } } }
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 static bool IsValidProductVersion(CASParts.Wrapper part) { ProductVersion productVersion = part.GetVersion(); if (Dresser.Settings.mInvalidProductVersionGeneral.Contains(productVersion)) return false; switch (GetType(part.BodyType)) { case ProcessOptions.BodyHair: case ProcessOptions.Beard: if (Dresser.Settings.mInvalidProductVersionBodyHair.Contains(productVersion)) return false; break; case ProcessOptions.Accessories: if (Dresser.Settings.mInvalidProductVersionAccessories.Contains(productVersion)) return false; break; case ProcessOptions.Hair: if (Dresser.Settings.mInvalidProductVersionHair.Contains(productVersion)) return false; break; case ProcessOptions.Makeup: if (Dresser.Settings.mInvalidProductVersionMakeup.Contains(productVersion)) return false; break; } 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 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; }
protected static bool PartMatches(CASParts.Wrapper part) { if (part.mPart.Key.GroupId != 0x48000000) return false; return sUnicornParts.ContainsKey(part.mPart.Key.InstanceId); }