internal static IEnumerator ReloadCharacterUncensor(ChaControl chaControl, BodyData bodyData, PenisData penisData, bool penisVisible, BallsData ballsData, bool ballsVisible) { while (chaControl.objBody == null) { yield return(null); } if (ExType(chaControl) == 0) //exType of 1 indicates Janitor, don't modify his body. { ReloadCharacterBody(chaControl, bodyData); } ReloadCharacterPenis(chaControl, penisData, penisVisible); ReloadCharacterBalls(chaControl, ballsData, ballsVisible); UpdateSkin(chaControl, bodyData); if (ExType(chaControl) == 0) { chaControl.updateBustSize = true; Traverse.Create(chaControl).Method("UpdateSiru", new object[] { true }).GetValue(); SetChestNormals(chaControl, bodyData); chaControl.customMatBody.SetTexture(ChaShader._AlphaMask, Traverse.Create(chaControl).Property("texBodyAlphaMask").GetValue() as Texture); Traverse.Create(chaControl).Property("updateAlphaMask").SetValue(true); } }
/// <summary> /// Read all the manifest.xml files and generate a dictionary of uncensors to be used in config manager dropdown /// </summary> private static void PopulateUncensorLists() { BodyDictionary.Clear(); BodyConfigListFull.Clear(); PenisDictionary.Clear(); PenisConfigListFull.Clear(); BallsDictionary.Clear(); BallsConfigListFull.Clear(); //Add the default body options BodyConfigListFull["Random"] = "Random"; #if KK || EC BodyData DefaultMale = new BodyData(0, DefaultBodyMaleGUID, "Default Body M"); BodyDictionary[DefaultMale.BodyGUID] = DefaultMale; BodyConfigListFull[$"[{(DefaultMale.Sex == 0 ? "Male" : "Female")}] {DefaultMale.DisplayName}"] = DefaultMale.BodyGUID; #endif BodyData DefaultFemale = new BodyData(1, DefaultBodyFemaleGUID, "Default Body F"); BodyDictionary[DefaultFemale.BodyGUID] = DefaultFemale; BodyConfigListFull[$"[{(DefaultFemale.Sex == 0 ? "Male" : "Female")}] {DefaultFemale.DisplayName}"] = DefaultFemale.BodyGUID; //Add the default penis options PenisConfigListFull["Random"] = "Random"; PenisData DefaultPenis = new PenisData(DefaultPenisGUID, "Mosaic Penis"); PenisDictionary[DefaultPenis.PenisGUID] = DefaultPenis; PenisConfigListFull[DefaultPenis.DisplayName] = DefaultPenis.PenisGUID; //Add the default balls options BallsConfigListFull["Random"] = "Random"; BallsData DefaultBalls = new BallsData(DefaultBallsGUID, "Mosaic Balls"); BallsDictionary[DefaultBalls.BallsGUID] = DefaultBalls; BallsConfigListFull[DefaultBalls.DisplayName] = DefaultBalls.BallsGUID; var loadedManifests = Sideloader.Sideloader.Manifests; foreach (var manifest in loadedManifests.Values) { XDocument manifestDocument = manifest.manifestDocument; XElement uncensorSelectorElement = manifestDocument?.Root?.Element(PluginNameInternal); if (uncensorSelectorElement != null && uncensorSelectorElement.HasElements) { foreach (XElement uncensorElement in uncensorSelectorElement.Elements("body")) { BodyData bodyData = new BodyData(uncensorElement); if (bodyData.BodyGUID == null) { Logger.LogWarning("Body failed to load due to missing GUID."); continue; } if (bodyData.DisplayName == null) { Logger.LogWarning("Body failed to load due to missing display name."); continue; } if (bodyData.OOBase == Defaults.OOBase) { Logger.LogWarning("Body was not loaded because oo_base is the default."); continue; } BodyDictionary[bodyData.BodyGUID] = bodyData; BodyConfigListFull[$"[{(bodyData.Sex == 0 ? "Male" : "Female")}] {bodyData.DisplayName}"] = bodyData.BodyGUID; foreach (var part in bodyData.AdditionalParts) { AllAdditionalParts.Add(part); } } foreach (XElement uncensorElement in uncensorSelectorElement.Elements("penis")) { PenisData penisData = new PenisData(uncensorElement); if (penisData.PenisGUID == null) { Logger.LogWarning("Penis failed to load due to missing GUID."); continue; } if (penisData.DisplayName == null) { Logger.LogWarning("Penis failed to load due to missing display name."); continue; } if (penisData.File == null) { Logger.LogWarning("Penis failed to load due to missing file."); continue; } if (penisData.Asset == null) { Logger.LogWarning("Penis failed to load due to missing asset."); continue; } PenisDictionary[penisData.PenisGUID] = penisData; PenisConfigListFull[penisData.DisplayName] = penisData.PenisGUID; } foreach (XElement uncensorElement in uncensorSelectorElement.Elements("balls")) { BallsData ballsData = new BallsData(uncensorElement); if (ballsData.BallsGUID == null) { Logger.LogWarning("Balls failed to load due to missing GUID."); continue; } if (ballsData.DisplayName == null) { Logger.LogWarning("Balls failed to load due to missing display name."); continue; } if (ballsData.File == null) { Logger.LogWarning("Balls failed to load due to missing file."); continue; } if (ballsData.Asset == null) { Logger.LogWarning("Balls failed to load due to missing asset."); continue; } BallsDictionary[ballsData.BallsGUID] = ballsData; BallsConfigListFull[ballsData.DisplayName] = ballsData.BallsGUID; } foreach (XElement uncensorElement in uncensorSelectorElement.Elements("migration")) { MigrationData migrationData = new MigrationData(uncensorElement); if (migrationData.UncensorGUID == null) { Logger.LogWarning("Migration data failed to load due to missing Uncensor GUID."); continue; } if (migrationData.BodyGUID == null) { Logger.LogWarning("Migration data failed to load due to missing Body GUID."); continue; } MigrationDictionary[migrationData.UncensorGUID] = migrationData; } } } }
/// <summary> /// Set the skin gloss for every color matching object configured in the manifest.xml /// </summary> internal static void SetSkinGloss(ChaControl chaControl, BodyData bodyData, PenisData penisData, BallsData ballsData) { SetSkinGloss(chaControl, bodyData); SetSkinGloss(chaControl, penisData); SetSkinGloss(chaControl, ballsData); }
/// <summary> /// Read all the manifest.xml files and generate a dictionary of uncensors to be used in config manager dropdown /// </summary> private static void PopulateUncensorLists() { BodyDictionary.Clear(); BodyConfigListFull.Clear(); PenisDictionary.Clear(); PenisConfigListFull.Clear(); BallsDictionary.Clear(); BallsConfigListFull.Clear(); //Add the default body options BodyConfigListFull.Add("Random", "Random"); BodyData DefaultMale = new BodyData(0, "Default.Body.Male", "Default Body M"); BodyDictionary.Add(DefaultMale.BodyGUID, DefaultMale); BodyConfigListFull.Add($"[{(DefaultMale.Sex == 0 ? "Male" : "Female")}] {DefaultMale.DisplayName}", DefaultMale.BodyGUID); BodyData DefaultFemale = new BodyData(1, "Default.Body.Female", "Default Body F"); BodyDictionary.Add(DefaultFemale.BodyGUID, DefaultFemale); BodyConfigListFull.Add($"[{(DefaultFemale.Sex == 0 ? "Male" : "Female")}] {DefaultFemale.DisplayName}", DefaultFemale.BodyGUID); //Add the default penis options PenisConfigListFull.Add("Random", "Random"); PenisData DefaultPenis = new PenisData("Default.Penis", "Mosaic Penis"); PenisDictionary.Add(DefaultPenis.PenisGUID, DefaultPenis); PenisConfigListFull.Add(DefaultPenis.DisplayName, DefaultPenis.PenisGUID); //Add the default balls options BallsConfigListFull.Add("Random", "Random"); BallsData DefaultBalls = new BallsData("Default.Balls", "Mosaic Balls"); BallsDictionary.Add(DefaultBalls.BallsGUID, DefaultBalls); BallsConfigListFull.Add(DefaultBalls.DisplayName, DefaultBalls.BallsGUID); #if KK var loadedManifests = Sideloader.Sideloader.LoadedManifests; #elif EC var loadedManifests = Sideloader.LoadedManifests; #endif foreach (var manifest in loadedManifests) { XDocument manifestDocument = manifest.manifestDocument; XElement uncensorSelectorElement = manifestDocument?.Root?.Element(PluginNameInternal); if (uncensorSelectorElement != null && uncensorSelectorElement.HasElements) { foreach (XElement uncensorElement in uncensorSelectorElement.Elements("body")) { BodyData bodyData = new BodyData(uncensorElement); if (bodyData.BodyGUID == null) { Log(LogLevel.Warning, "Body failed to load due to missing GUID."); continue; } if (bodyData.DisplayName == null) { Log(LogLevel.Warning, "Body failed to load due to missing display name."); continue; } if (bodyData.OOBase == Defaults.OOBase) { Log(LogLevel.Warning, "Body was not loaded because oo_base is the default."); continue; } BodyDictionary.Add(bodyData.BodyGUID, bodyData); BodyConfigListFull.Add($"[{(bodyData.Sex == 0 ? "Male" : "Female")}] {bodyData.DisplayName}", bodyData.BodyGUID); foreach (var part in bodyData.AdditionalParts) { AllAdditionalParts.Add(part); } } foreach (XElement uncensorElement in uncensorSelectorElement.Elements("penis")) { PenisData penisData = new PenisData(uncensorElement); if (penisData.PenisGUID == null) { Log(LogLevel.Warning, "Penis failed to load due to missing GUID."); continue; } if (penisData.DisplayName == null) { Log(LogLevel.Warning, "Penis failed to load due to missing display name."); continue; } if (penisData.File == null) { Log(LogLevel.Warning, "Penis failed to load due to missing file."); continue; } if (penisData.Asset == null) { Log(LogLevel.Warning, "Penis failed to load due to missing asset."); continue; } PenisDictionary.Add(penisData.PenisGUID, penisData); PenisConfigListFull.Add(penisData.DisplayName, penisData.PenisGUID); } foreach (XElement uncensorElement in uncensorSelectorElement.Elements("balls")) { BallsData ballsData = new BallsData(uncensorElement); if (ballsData.BallsGUID == null) { Log(LogLevel.Warning, "Balls failed to load due to missing GUID."); continue; } if (ballsData.DisplayName == null) { Log(LogLevel.Warning, "Balls failed to load due to missing display name."); continue; } if (ballsData.File == null) { Log(LogLevel.Warning, "Balls failed to load due to missing file."); continue; } if (ballsData.Asset == null) { Log(LogLevel.Warning, "Balls failed to load due to missing asset."); continue; } BallsDictionary.Add(ballsData.BallsGUID, ballsData); BallsConfigListFull.Add(ballsData.DisplayName, ballsData.BallsGUID); } foreach (XElement uncensorElement in uncensorSelectorElement.Elements("migration")) { MigrationData migrationData = new MigrationData(uncensorElement); if (migrationData.UncensorGUID == null) { Log(LogLevel.Warning, "Migration data failed to load due to missing Uncensor GUID."); continue; } if (migrationData.BodyGUID == null) { Log(LogLevel.Warning, "Migration data failed to load due to missing Body GUID."); continue; } MigrationDictionary.Add(migrationData.UncensorGUID, migrationData); } } } }
/// <summary> /// Set the skin line visibility for every color matching object configured in the manifest.xml /// </summary> internal static void SetLineVisibility(ChaControl chaControl, BodyData bodyData, PenisData penisData, BallsData ballsData) { SetLineVisibility(chaControl, bodyData); SetLineVisibility(chaControl, penisData); SetLineVisibility(chaControl, ballsData); }