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 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); }
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 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); }