private static void AddPregnancyWeek(ChaFileControl chaFile)
        {
            var data = ExtendedSave.GetExtendedDataById(chaFile, PregnancyPlugin.GUID);

            if (data == null)
            {
                return;
            }

            PregnancyDataUtils.DeserializeData(data, out var week, out var gameplayEnabled, out var fertility, out var schedule);
            // Advance the week of pregnancy. If week is 0 the character is not pregnant
            if (gameplayEnabled && week > 0)
            {
                if (week < PregnancyDataUtils.LeaveSchoolWeek)
                {
                    // Advance through in-school at full configured speed
                    var weekChange = PregnancyPlugin.PregnancyProgressionSpeed.Value;
                    week = Mathf.Min(PregnancyDataUtils.LeaveSchoolWeek, week + weekChange);
                }
                else if (week < PregnancyDataUtils.ReturnToSchoolWeek)
                {
                    // Make sure at least one week is spent out of school
                    var weekChange = Mathf.Min(PregnancyDataUtils.ReturnToSchoolWeek - PregnancyDataUtils.LeaveSchoolWeek - 1, PregnancyPlugin.PregnancyProgressionSpeed.Value);
                    week = week + weekChange;
                }

                if (week >= PregnancyDataUtils.ReturnToSchoolWeek)
                {
                    week = 0;
                }

                //Logger.Log(LogLevel.Debug, $"Preg - pregnancy week for {chaFile.parameter.fullname} is now {week}");
                ExtendedSave.SetExtendedDataById(chaFile, PregnancyPlugin.GUID, PregnancyDataUtils.SerializeData(week, true, fertility, schedule));
            }
        }
        private static void StartPregnancy(ChaFileControl chaFile)
        {
            var data = ExtendedSave.GetExtendedDataById(chaFile, PregnancyPlugin.GUID);

            PregnancyDataUtils.DeserializeData(data, out var week, out var gameplayEnabled, out var fertility, out var schedule);

            // If week is 0 the character is not pregnant
            if (gameplayEnabled && week <= 0)
            {
                //Logger.Log(LogLevel.Debug, "Preg - starting pregnancy on " + chaFile.parameter.fullname + ", new week is " + 1);

                ExtendedSave.SetExtendedDataById(chaFile, PregnancyPlugin.GUID, PregnancyDataUtils.SerializeData(1, true, fertility, schedule));
            }
        }
            private static void GetMenstruationOverridePrefix()
            {
                if (_lastHeroine != null)
                {
                    // Get a schedule directly this way since the controller is not spawned in class roster
                    var schedule = _lastHeroine.GetRelatedChaFiles().Select(control =>
                    {
                        var d = ExtendedSave.GetExtendedDataById(control, GUID);
                        if (d == null)
                        {
                            return(PregnancyDataUtils.MenstruationSchedule.Default);
                        }
                        PregnancyDataUtils.DeserializeData(d, out _, out _, out _, out var s);
                        return(s);
                    }).FirstOrDefault(x => x != PregnancyDataUtils.MenstruationSchedule.Default);

                    _menstruationsBackup = HFlag.menstruations;
                    HFlag.menstruations  = PregnancyCharaController.GetMenstruationsArr(schedule);
                }
            }
            private static bool CanGetSpawned(SaveData.Heroine heroine)
            {
                var isOnLeave = heroine.GetRelatedChaFiles()
                                .Any(c =>
                {
                    var data = ExtendedSave.GetExtendedDataById(heroine.charFile, GUID);

                    if (data == null)
                    {
                        return(false);
                    }

                    PregnancyDataUtils.DeserializeData(data, out var week, out var gameplayEnabled, out _, out _);
                    if (gameplayEnabled && week >= PregnancyDataUtils.LeaveSchoolWeek)
                    {
                        return(true);
                    }

                    return(false);
                });

                return(!isOnLeave);
            }