/// <summary> /// If the current characters mesh is set by the Uncensor plugin we need to know this to correctly shift the mesh's localspace vertex positions /// The LS positions for uncensor match that of HS2 and AI, but not the defulat KK body mesh (This took forever to track down!) /// </summary> internal static bool IsUncensorBody(ChaControl chaControl, string UncensorCOMName) { //grab the active uncensor controller of it exists var uncensorController = PregnancyPlusHelper.GetCharacterBehaviorController <CharaCustomFunctionController>(chaControl, UncensorCOMName); if (uncensorController == null) { return(false); } //Get the body type name, and see if it is the default mesh name var bodyData = uncensorController.GetType().GetProperty("BodyData")?.GetValue(uncensorController, null); if (bodyData == null) { return(false); } var bodyGUID = Traverse.Create(bodyData).Field("BodyGUID")?.GetValue <string>(); if (bodyGUID == null) { return(false); } return(bodyGUID != PregnancyPlusCharaController.DefaultBodyFemaleGUID && bodyGUID != PregnancyPlusCharaController.DefaultBodyMaleGUID); }
/// <summary> /// Will fetch number of weeks from KK_Pregnancy data for this character /// </summary> internal static int GetWeeksFromPregnancyPluginData(ChaControl chaControl, string targetBehaviorId) { var kkPregCtrlInst = PregnancyPlusHelper.GetCharacterBehaviorController <CharaCustomFunctionController>(chaControl, targetBehaviorId); if (kkPregCtrlInst == null) { return(-1); } //Get the pregnancy data object var data = kkPregCtrlInst.GetType().GetProperty("Data")?.GetValue(kkPregCtrlInst, null); if (data == null) { return(-1); } var week = Traverse.Create(data).Field("Week").GetValue <int>(); if (week.Equals(null) || week < -1) { return(-1); } return(week); }
/// <summary> /// On Restore, set sliders to last non zero shape, and set characters belly state /// </summary> public static void OnRestore(List <MakerSlider> _sliders, PregnancyPlusData restoreToState = null) { if (!MakerAPI.InsideAndLoaded) { return; } if (_sliders == null || _sliders.Count <= 0 || !_sliders[0].Exists) { return; } var chaControl = MakerAPI.GetCharacterControl(); var charCustFunCtrl = PregnancyPlusHelper.GetCharacterBehaviorController <PregnancyPlusCharaController>(chaControl, PregnancyPlusPlugin.GUID); if (charCustFunCtrl == null) { return; } var _infConfig = restoreToState != null ? restoreToState : PregnancyPlusPlugin.lastBellyState; //For each slider, set to default which will reset the belly shape foreach (var slider in _sliders) { //Get the private slider object name from the game GUI var settingName = Traverse.Create(slider).Field("_settingName").GetValue <string>(); if (settingName == null) { continue; } if (PregnancyPlusPlugin.DebugLog.Value) { PregnancyPlusPlugin.Logger.LogInfo($" Restoring slider > {settingName}"); } //Set the correct slider with it's old config value switch (settingName) { #region Look away! im being lazy again case var _ when settingName == inflationSizeMaker: //Ohh boy, cant have const and static strings in switch case, thus this was created! slider.SetValue(_infConfig.inflationSize); continue; case var _ when settingName == inflationMultiplierMaker: slider.SetValue(_infConfig.inflationMultiplier); continue; case var _ when settingName == inflationMoveYMaker: slider.SetValue(_infConfig.inflationMoveY); continue; case var _ when settingName == inflationMoveZMaker: slider.SetValue(_infConfig.inflationMoveZ); continue; case var _ when settingName == inflationStretchXMaker: slider.SetValue(_infConfig.inflationStretchX); continue; case var _ when settingName == inflationStretchYMaker: slider.SetValue(_infConfig.inflationStretchY); continue; case var _ when settingName == inflationShiftYMaker: slider.SetValue(_infConfig.inflationShiftY); continue; case var _ when settingName == inflationShiftZMaker: slider.SetValue(_infConfig.inflationShiftZ); continue; case var _ when settingName == inflationTaperYMaker: slider.SetValue(_infConfig.inflationTaperY); continue; case var _ when settingName == inflationTaperZMaker: slider.SetValue(_infConfig.inflationTaperZ); continue; case var _ when settingName == inflationClothOffsetMaker: slider.SetValue(_infConfig.inflationClothOffset); continue; case var _ when settingName == inflationFatFoldMaker: slider.SetValue(_infConfig.inflationFatFold); continue; case var _ when settingName == inflationRoundnessMaker: slider.SetValue(_infConfig.inflationRoundness); continue; default: continue; #endregion } } }