protected override OptionResult Run(GameHitParameters <GameObject> parameters) { Dictionary <ResourceKey, CASParts.Wrapper> lookup = new Dictionary <ResourceKey, CASParts.Wrapper>(); foreach (CASParts.Wrapper part in CASParts.GetParts(null)) { if (lookup.ContainsKey(part.mPart.Key)) { continue; } lookup.Add(part.mPart.Key, part); } List <RemoveBlacklistPart.Item> choices = new List <RemoveBlacklistPart.Item>(); foreach (ResourceKey key in InvalidPartBooter.InvalidPartKeys) { CASParts.Wrapper part; if (lookup.TryGetValue(key, out part)) { choices.Add(new RemoveBlacklistPart.Item(part)); } else { choices.Add(new RemoveBlacklistPart.Item(key)); } } new CommonSelection <RemoveBlacklistPart.Item>(Name, choices).SelectMultiple(); return(OptionResult.Failure); }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { Dictionary <ResourceKey, CASParts.Wrapper> lookup = new Dictionary <ResourceKey, CASParts.Wrapper>(); foreach (CASParts.Wrapper part in CASParts.GetParts(null)) { if (lookup.ContainsKey(part.mPart.Key)) { continue; } lookup.Add(part.mPart.Key, part); } List <Item> choices = new List <Item>(); foreach (ResourceKey key in MasterController.Settings.BlacklistKeys) { CASParts.Wrapper part; if (lookup.TryGetValue(key, out part)) { choices.Add(new Item(part)); } else { choices.Add(new Item(key)); } } CommonSelection <Item> .Results results = new CommonSelection <Item>(Name, choices).SelectMultiple(); if ((results == null) || (results.Count == 0)) { return(OptionResult.Failure); } foreach (Item item in results) { MasterController.Settings.RemoveBlacklistKey(item.Value); } MasterController.Settings.ApplyBlacklistParts(); return(OptionResult.SuccessClose); }
public static void Transform(SimDescription sim) { if (!Hybrid.Settings.mSpecialWerewolfOutfit) { return; } SimOutfit outfit = sim.GetSpecialOutfit(sWerewolfOutfitKey); if (outfit == null) { SimOutfit sourceOutfit = sim.GetOutfit(OutfitCategories.Everyday, 0); foreach (CASPart part in sourceOutfit.Parts) { if (part.BodyType == BodyTypes.FullBody) { return; } } if (sParts == null) { sParts = CASParts.GetParts(PartMatches); } List <CASParts.PartPreset> parts = new List <CASParts.PartPreset>(); foreach (CASParts.Wrapper part in sParts) { if (!part.ValidFor(sim)) { continue; } if (RandomUtil.CoinFlip()) { continue; } CASParts.PartPreset preset = part.GetRandomPreset(); if (preset == null) { continue; } parts.Add(preset); } if (parts.Count > 0) { using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(sWerewolfOutfitKey), sourceOutfit)) { foreach (CASParts.PartPreset part in parts) { builder.Builder.RemoveParts(new BodyTypes[] { part.mPart.BodyType }); builder.ApplyPartPreset(part); } } } outfit = sim.GetSpecialOutfit(sWerewolfOutfitKey); if (outfit == null) { return; } } SwitchOutfits.SwitchNoSpin(sim.CreatedSim, new CASParts.Key(sWerewolfOutfitKey)); }