using System; using System.Collections.Generic; using BackupParamAccessor; using MaidStatus; using PlayerStatus; using UnityEngine; using wf; namespace Schedule { public static class ScheduleAPI { public static void log(string text) { if (!ScheduleAPI.logOutput) { return; } if (ScheduleAPI.logs.Count > 500) { ScheduleAPI.logs.RemoveRange(0, 400); } ScheduleAPI.logs.Add(text); } public static int GetNoonTrainerWorkId() { foreach (KeyValuePair keyValuePair in ScheduleCSVData.AllData) { if (keyValuePair.Value.type == ScheduleTaskCtrl.TaskType.Training) { ScheduleCSVData.Training training = (ScheduleCSVData.Training)keyValuePair.Value; if (training.trainingType == ScheduleCSVData.TrainingType.Trainer) { return keyValuePair.Key; } } } Debug.LogWarning("ScheduleCSVData.GetNoonTrainerWorkId:昼のメイド研修(研修官)仕事IDが発見できませんでした。"); return 0; } public static int GetTraineeWorkId() { foreach (KeyValuePair keyValuePair in ScheduleCSVData.TrainingData) { if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Trainee) { return keyValuePair.Key; } } Debug.LogWarning("ScheduleCSVData.GetNoonTraineeWorkId:昼のメイド研修(研修生)仕事IDが発見できませんでした。"); return 0; } public static int GetTravelWorkId() { foreach (KeyValuePair keyValuePair in ScheduleCSVData.TrainingData) { if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Travel) { return keyValuePair.Key; } } Debug.LogWarning("ScheduleCSVData.GetNoonTravelWorkId:昼の旅行仕事IDが発見できませんでした。"); return 0; } public static int GetNightTrainerWorkId() { foreach (KeyValuePair keyValuePair in ScheduleCSVData.TrainingData) { if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Trainer) { return keyValuePair.Key; } } Debug.LogWarning("ScheduleCSVData.GetNightTrainerWorkId:夜のメイド研修(研修官)仕事IDが発見できませんでした。"); return 0; } public static int GetNightTraineeWorkId() { foreach (KeyValuePair keyValuePair in ScheduleCSVData.TrainingData) { if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Trainee) { return keyValuePair.Key; } } Debug.LogWarning("ScheduleCSVData.GetNightTraineeWorkId:夜のメイド研修(研修生)仕事IDが発見できませんでした。"); return 0; } public static int GetNightTravelWorkId() { foreach (KeyValuePair keyValuePair in ScheduleCSVData.YotogiData) { if (keyValuePair.Value.yotogiType == ScheduleCSVData.YotogiType.Travel) { return keyValuePair.Key; } } Debug.LogWarning("ScheduleCSVData.GetNightTravelWorkId:夜の旅行仕事IDが発見できませんでした。"); return 0; } public static int GetNightEntertainWorkId() { foreach (KeyValuePair keyValuePair in ScheduleCSVData.YotogiData) { if (keyValuePair.Value.yotogiType == ScheduleCSVData.YotogiType.Entertain) { return keyValuePair.Key; } } Debug.LogWarning("ScheduleCSVData.GetNightEntertainWorkId:夜のクラブ接待 仕事IDが発見できませんでした。"); return 0; } public static int GetNightRestWorkId() { foreach (KeyValuePair keyValuePair in ScheduleCSVData.YotogiData) { if (keyValuePair.Value.yotogiType == ScheduleCSVData.YotogiType.Rest) { return keyValuePair.Key; } } Debug.LogWarning("ScheduleCSVData.GetNightRestWorkId:夜の休息 仕事IDが発見できませんでした。"); return 0; } public static bool CheckNoProblemTravel(int nightWorkId) { ScheduleCSVData.ScheduleBase scheduleBase = null; foreach (KeyValuePair keyValuePair in ScheduleCSVData.AllData) { if (keyValuePair.Value.id == nightWorkId) { scheduleBase = keyValuePair.Value; break; } } if (scheduleBase == null) { return false; } if (scheduleBase.type != ScheduleTaskCtrl.TaskType.Yotogi) { return false; } ScheduleCSVData.YotogiType yotogiType = ((ScheduleCSVData.Yotogi)scheduleBase).yotogiType; return yotogiType != ScheduleCSVData.YotogiType.HaveSex && yotogiType != ScheduleCSVData.YotogiType.Vip && yotogiType != ScheduleCSVData.YotogiType.VipCall; } public static void BackupParam(SCENE_ID scene_id) { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null) { BackupParamAccessor.BackupParam(new int?(i), scene_id); } } } public static void BackUpScheduleSlot() { if (DailyMgr.IsLegacy) { GameMain.Instance.CharacterMgr.status.BackupScheduleSlot(ScheduleSlotBackup.Type.CM3D2); } else { GameMain.Instance.CharacterMgr.status.BackupScheduleSlot(ScheduleSlotBackup.Type.COM3D); } } public static Maid GetNoonTrainerMaid() { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && scheduleSlot.status.noonWorkId == ScheduleAPI.GetNoonTrainerWorkId()) { return scheduleSlot; } } return null; } public static Maid GetNoonTraineeMaid() { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && scheduleSlot.status.noonWorkId == ScheduleAPI.GetTraineeWorkId()) { return scheduleSlot; } } return null; } public static Maid GetNightTrainerMaid() { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && scheduleSlot.status.nightWorkId == ScheduleAPI.GetNightTrainerWorkId()) { return scheduleSlot; } } return null; } public static Maid GetNightTraineeMaid() { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && scheduleSlot.status.nightWorkId == ScheduleAPI.GetNightTraineeWorkId()) { return scheduleSlot; } } return null; } public static Maid GetTravelMaid() { int travelWorkId = ScheduleAPI.GetTravelWorkId(); if (travelWorkId != 0) { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId) { return scheduleSlot; } } } return null; } public static KeyValuePair> GetTravelBgData(bool time_is_noon) { int travelWorkId = ScheduleAPI.GetTravelWorkId(); if (travelWorkId != 0) { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId) { ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[travelWorkId]; foreach (int key in training.needEventItemIdList) { Shop.ItemDataEvent itemDataEvent = Shop.item_data_dic[key] as Shop.ItemDataEvent; if (itemDataEvent.is_have_item) { string key2 = itemDataEvent.free_text[(!time_is_noon) ? 1 : 0]; Vector3 key3 = Parse.Vector3("(" + itemDataEvent.free_text[2] + ")"); Vector3 value = Parse.Vector3("(" + itemDataEvent.free_text[3] + ")"); return new KeyValuePair>(key2, new KeyValuePair(key3, value)); } } } } } return new KeyValuePair>(string.Empty, new KeyValuePair(Vector3.zero, Vector3.zero)); } public static Maid GetStockMaidLeader() { int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount(); for (int i = 0; i < stockMaidCount; i++) { Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i); if (stockMaid != null && stockMaid.status.leader) { return stockMaid; } } return null; } public static bool VipCalledMaid(int workId, Maid maid) { NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId); return nightWorksState != null && !string.IsNullOrEmpty(nightWorksState.calledMaidGUID) && !(nightWorksState.calledMaidGUID == maid.status.guid); } public static int GetScheduleId(Maid maid, bool isDaytime) { if (maid == null) { return 0; } if (isDaytime) { return maid.status.noonWorkId; } return maid.status.nightWorkId; } public static int GetScheduleId(Maid maid, ScheduleMgr.ScheduleTime time) { return ScheduleAPI.GetScheduleId(maid, time == ScheduleMgr.ScheduleTime.DayTime); } public static ScheduleCSVData.ScheduleBase GetSchedule(Maid maid, bool isDaytime) { if (maid == null) { return null; } int key = maid.status.noonWorkId; if (isDaytime) { key = maid.status.noonWorkId; } else { key = maid.status.nightWorkId; } if (!ScheduleCSVData.AllData.ContainsKey(key)) { return null; } return ScheduleCSVData.AllData[key]; } public static ScheduleCSVData.ScheduleBase GetSchedule(Maid maid, ScheduleMgr.ScheduleTime time) { return ScheduleAPI.GetSchedule(maid, time == ScheduleMgr.ScheduleTime.DayTime); } private static bool CheckCommu(Maid m, bool isDaytime, bool checkCommuState) { if (checkCommuState) { if (isDaytime && !m.status.noonCommu) { return false; } if (!isDaytime && !m.status.nightCommu) { return false; } } int key; if (isDaytime) { key = m.status.noonWorkId; } else { key = m.status.nightWorkId; } if (ScheduleCSVData.AllData.ContainsKey(key)) { ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key]; if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work) { ScheduleMgr.ScheduleTime scheduleTime; if (isDaytime) { scheduleTime = ScheduleMgr.ScheduleTime.DayTime; } else { scheduleTime = ScheduleMgr.ScheduleTime.Night; } Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(m, scheduleTime); if (maidAssignedFacility == null || !maidAssignedFacility.IsOperation(scheduleTime)) { return false; } } if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Training || scheduleBase.type == ScheduleTaskCtrl.TaskType.Work) { ScheduleCSVData.Training training = (ScheduleCSVData.Training)scheduleBase; if (checkCommuState) { switch (training.trainingType) { case ScheduleCSVData.TrainingType.Basic: case ScheduleCSVData.TrainingType.Trainer: case ScheduleCSVData.TrainingType.Trainee: case ScheduleCSVData.TrainingType.Holiday: return true; } } else { ScheduleCSVData.TrainingType trainingType = training.trainingType; if (trainingType == ScheduleCSVData.TrainingType.Basic) { return true; } } } } return false; } public static Maid GetCommunicationMaid(bool isDaytime) { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && ScheduleAPI.CheckCommu(scheduleSlot, isDaytime, true)) { return scheduleSlot; } } return null; } public static List CanCommunicationMaids(bool isDaytime) { List list = new List(); for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && ScheduleAPI.CheckCommu(scheduleSlot, isDaytime, false)) { list.Add(scheduleSlot); } } return list; } public static List GetFacilityPowerUpMaids(bool isDaytime) { List list = new List(); for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null) { int num; if (isDaytime) { num = scheduleSlot.status.noonWorkId; } else { num = scheduleSlot.status.nightWorkId; } if (num == ScheduleCSVData.faclilityPowerUpWorkId) { list.Add(scheduleSlot); } } } return list; } public static List GetEntertainMaids() { List list = new List(); for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null) { ScheduleCSVData.YotogiType yotogiType = ScheduleCSVData.YotogiData[scheduleSlot.status.nightWorkId].yotogiType; if (yotogiType == ScheduleCSVData.YotogiType.Entertain) { list.Add(scheduleSlot); } } } return list; } public static List GetVipWorkMaids(bool isDaytime) { List list = new List(); for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null) { int key; if (isDaytime) { key = scheduleSlot.status.noonWorkId; } else { key = scheduleSlot.status.nightWorkId; } ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key]; if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi) { ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)scheduleBase; ScheduleCSVData.YotogiType yotogiType = yotogi.yotogiType; if (yotogiType == ScheduleCSVData.YotogiType.Vip || yotogiType == ScheduleCSVData.YotogiType.VipCall) { list.Add(scheduleSlot); } } } } return list; } public static List GetYotogiMaids(bool isDaytime) { List list = new List(); for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null) { int num; if (isDaytime) { num = scheduleSlot.status.noonWorkId; } else { num = scheduleSlot.status.nightWorkId; } if (!ScheduleCSVData.AllData.ContainsKey(num)) { Debug.LogError("ScheduleAPI:タスクID[" + num + "]のデータが見つかりませんでした"); } ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num]; if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi) { ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)scheduleBase; ScheduleCSVData.YotogiType yotogiType = yotogi.yotogiType; if (yotogiType == ScheduleCSVData.YotogiType.HaveSex) { list.Add(scheduleSlot); } } } } return list; } public static void DecideSuccess(WorkResultSceneMode sceneMode, int index, bool commu) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(index); ScheduleData scheduleData = GameMain.Instance.CharacterMgr.status.scheduleSlot[index]; if (scheduleSlot != null) { ScheduleData.WorkSuccessLv workSuccessLv; if (commu) { workSuccessLv = ScheduleData.WorkSuccessLv.Success; } else if (scheduleSlot.status.features.ContainsKey(Feature.GetData("疲労").id)) { workSuccessLv = ScheduleData.WorkSuccessLv.Miss; } else { int num = UnityEngine.Random.Range(1, 100); if (num <= ScheduleCSVData.workSuccessLvMissIncidence) { workSuccessLv = ScheduleData.WorkSuccessLv.Miss; } else if (num > 100 - ScheduleCSVData.workSuccessLvPerfectIncidence) { workSuccessLv = ScheduleData.WorkSuccessLv.Perfect; } else { workSuccessLv = ScheduleData.WorkSuccessLv.Success; } } int num2 = 0; if (sceneMode == WorkResultSceneMode.Noon) { num2 = scheduleSlot.status.noonWorkId; } else if (sceneMode == WorkResultSceneMode.Night) { num2 = scheduleSlot.status.nightWorkId; } if (num2 == ScheduleCSVData.faclilityPowerUpWorkId) { Facility facility; Facility.RecipeData recipeData; if (!GameMain.Instance.FacilityMgr.TryGetCacheFacilityPowerUpResult(scheduleSlot, out facility, out recipeData)) { workSuccessLv = ScheduleData.WorkSuccessLv.Unexecuted; } else { workSuccessLv = ScheduleData.WorkSuccessLv.Success; } } ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num2]; if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work && num2 != ScheduleCSVData.faclilityPowerUpWorkId) { ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime; if (sceneMode == WorkResultSceneMode.Noon) { scheduleTime = ScheduleMgr.ScheduleTime.DayTime; } else if (sceneMode == WorkResultSceneMode.Night) { scheduleTime = ScheduleMgr.ScheduleTime.Night; } Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(scheduleSlot, scheduleTime); if (maidAssignedFacility == null || !maidAssignedFacility.IsOperation(scheduleTime)) { workSuccessLv = ScheduleData.WorkSuccessLv.Unexecuted; } } if (sceneMode == WorkResultSceneMode.Noon) { scheduleData.noon_success_level = workSuccessLv; } else if (sceneMode == WorkResultSceneMode.Night) { scheduleData.night_success_level = workSuccessLv; } } } private static ScheduleAPI.TrainingResultSimulateParam TrainingResultSimulate(Maid maid, int workId, ScheduleData.WorkSuccessLv successLv = ScheduleData.WorkSuccessLv.Success, bool communicationBonus = false) { ScheduleAPI.TrainingResultSimulateParam trainingResultSimulateParam = new ScheduleAPI.TrainingResultSimulateParam(); if (maid == null) { return trainingResultSimulateParam; } ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[workId]; switch (training.trainingType) { case ScheduleCSVData.TrainingType.Basic: case ScheduleCSVData.TrainingType.Dispatch: { BonusStatus bonusStatusAsFeatureAndPropensitys = maid.status.GetBonusStatusAsFeatureAndPropensitys(); int workLvRevision = ScheduleAPI.NoonWorkLvToRevision(ScheduleAPI.NoonWorkPlayToLv(ScheduleAPI.NoonWorkPlayCount(maid, workId))); double successRevision = 1.0; if (successLv == ScheduleData.WorkSuccessLv.Unexecuted) { successRevision = 0.0; } else if (communicationBonus) { successRevision = 0.3; } else if (successLv != ScheduleData.WorkSuccessLv.Miss) { if (successLv != ScheduleData.WorkSuccessLv.Success) { if (successLv == ScheduleData.WorkSuccessLv.Perfect) { successRevision = 1.5; } } else { successRevision = 1.0; } } else { successRevision = 0.5; } trainingResultSimulateParam.study_rate = training.study_rate; trainingResultSimulateParam.reception = ScheduleAPI.NoonWorkResultSimulate_basic(training.reception, bonusStatusAsFeatureAndPropensitys.reception, workLvRevision, successRevision); trainingResultSimulateParam.care = ScheduleAPI.NoonWorkResultSimulate_basic(training.care, bonusStatusAsFeatureAndPropensitys.care, workLvRevision, successRevision); trainingResultSimulateParam.lovely = ScheduleAPI.NoonWorkResultSimulate_basic(training.lovely, bonusStatusAsFeatureAndPropensitys.lovely, workLvRevision, successRevision); trainingResultSimulateParam.elegance = ScheduleAPI.NoonWorkResultSimulate_basic(training.elegance, bonusStatusAsFeatureAndPropensitys.elegance, workLvRevision, successRevision); trainingResultSimulateParam.charm = ScheduleAPI.NoonWorkResultSimulate_basic(training.charm, bonusStatusAsFeatureAndPropensitys.charm, workLvRevision, successRevision); trainingResultSimulateParam.teach_rate = ScheduleAPI.NoonWorkResultSimulate_basic(training.teach_rate, bonusStatusAsFeatureAndPropensitys.teachRate, workLvRevision, successRevision); trainingResultSimulateParam.cooking = ScheduleAPI.NoonWorkResultSimulate_basic(training.cooking, bonusStatusAsFeatureAndPropensitys.cooking, workLvRevision, successRevision); trainingResultSimulateParam.vocal = ScheduleAPI.NoonWorkResultSimulate_basic(training.vocal, bonusStatusAsFeatureAndPropensitys.vocal, workLvRevision, successRevision); trainingResultSimulateParam.dance = ScheduleAPI.NoonWorkResultSimulate_basic(training.dance, bonusStatusAsFeatureAndPropensitys.dance, workLvRevision, successRevision); trainingResultSimulateParam.appealPoint = ScheduleAPI.NoonWorkResultSimulate_basic(training.appealPoint, bonusStatusAsFeatureAndPropensitys.appealPoint, workLvRevision, successRevision); trainingResultSimulateParam.income = ScheduleAPI.NoonWorkResultSimulate_basic(training.income, 0, workLvRevision, successRevision); trainingResultSimulateParam.income = (int)((double)trainingResultSimulateParam.income * (System.Math.Ceiling((double)maid.status.care / (double)ScheduleCSVData.dispatchIncomCoefficient) / 100.0 + 1.0)); trainingResultSimulateParam.exp = ScheduleAPI.NoonWorkResultSimulate_basic(training.exp, 0, workLvRevision, successRevision); if (communicationBonus) { trainingResultSimulateParam.study_rate = 0; } break; } case ScheduleCSVData.TrainingType.Trainee: { Maid stockMaidLeader = ScheduleAPI.GetStockMaidLeader(); if (stockMaidLeader != null) { int noonTrainerWorkId = ScheduleAPI.GetNoonTrainerWorkId(); int workLvRevision2 = ScheduleAPI.NoonWorkLvToRevision(ScheduleAPI.NoonWorkPlayToLv(ScheduleAPI.NoonWorkPlayCount(stockMaidLeader, noonTrainerWorkId))); int teachRevision = stockMaidLeader.status.teachRate / 50; MaidStatus.Status status = stockMaidLeader.status; trainingResultSimulateParam.study_rate = training.study_rate; trainingResultSimulateParam.reception = ScheduleAPI.NoonWorkResultSimulate_trainee(status.reception, workLvRevision2, teachRevision); trainingResultSimulateParam.care = ScheduleAPI.NoonWorkResultSimulate_trainee(status.care, workLvRevision2, teachRevision); trainingResultSimulateParam.lovely = ScheduleAPI.NoonWorkResultSimulate_trainee(status.lovely, workLvRevision2, teachRevision); trainingResultSimulateParam.elegance = ScheduleAPI.NoonWorkResultSimulate_trainee(status.elegance, workLvRevision2, teachRevision); trainingResultSimulateParam.charm = ScheduleAPI.NoonWorkResultSimulate_trainee(status.charm, workLvRevision2, teachRevision); trainingResultSimulateParam.inyoku = ScheduleAPI.NoonWorkResultSimulate_trainee(status.inyoku, workLvRevision2, teachRevision); trainingResultSimulateParam.mvalue = ScheduleAPI.NoonWorkResultSimulate_trainee(status.mvalue, workLvRevision2, teachRevision); trainingResultSimulateParam.hentai = ScheduleAPI.NoonWorkResultSimulate_trainee(status.hentai, workLvRevision2, teachRevision); trainingResultSimulateParam.housi = ScheduleAPI.NoonWorkResultSimulate_trainee(status.housi, workLvRevision2, teachRevision); } break; } } return trainingResultSimulateParam; } private static int NoonWorkResultSimulate_basic(int workParam, int maidRevision, int workLvRevision, double successRevision) { return (int)System.Math.Ceiling((double)workParam * (double)(100 + maidRevision + workLvRevision) / 100.0 * successRevision); } private static int NoonWorkResultSimulate_trainee(int trainerParam, int workLvRevision, int teachRevision) { return (int)System.Math.Ceiling((double)trainerParam / 25.0 * (double)(100 + workLvRevision + teachRevision) / 100.0); } public static Params OneDayParamDiff(int? slotId = null) { int num = 0; if (slotId == null) { for (int i = 0; i < 40; i++) { if (GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i) != null) { num = i; break; } } } else { num = ((slotId == null) ? 0 : slotId.Value); } if (GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num) != null) { return BackupParamAccessor.GetBackupParams(num, SCENE_ID.Start); } return null; } public static ScheduleAPI.YotogiResultSimulateParam YotogiResultSimulate(Maid maid, int workId) { ScheduleAPI.YotogiResultSimulateParam yotogiResultSimulateParam = new ScheduleAPI.YotogiResultSimulateParam(); if (maid == null) { return yotogiResultSimulateParam; } ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId]; switch (yotogi.yotogiType) { case ScheduleCSVData.YotogiType.Entertain: { int num = 0; int num2 = 0; int clubGrade = GameMain.Instance.CharacterMgr.status.clubGrade; int num3 = ScheduleCSVData.EntertainNumberData[clubGrade]; for (int i = 0; i < num3; i++) { int count = ScheduleCSVData.EntertainGuestData[clubGrade].Count; int index = UnityEngine.Random.Range(0, count); ScheduleCSVData.EntertainGuest entertainGuest = ScheduleCSVData.EntertainGuestData[clubGrade][index]; double num4 = 0.0; if (!entertainGuest.sexual) { num4 += System.Math.Ceiling((double)maid.status.lovely / 500.0); num4 += System.Math.Ceiling((double)maid.status.elegance / 500.0); num4 += System.Math.Ceiling((double)maid.status.charm / 500.0); num4 += System.Math.Ceiling((double)maid.status.reception / 500.0); num4 += System.Math.Ceiling((double)maid.status.cooking / 500.0); num4 += System.Math.Ceiling((double)maid.status.vocal / 500.0); num4 += System.Math.Ceiling((double)maid.status.dance / 500.0); num4 += System.Math.Ceiling((double)maid.status.appealPoint / 500.0); } else { num4 += System.Math.Ceiling((double)maid.status.inyoku / 500.0); num4 += System.Math.Ceiling((double)maid.status.mvalue / 500.0); num4 += System.Math.Ceiling((double)maid.status.hentai / 500.0); num4 += System.Math.Ceiling((double)maid.status.housi / 500.0); } num4 /= 2.0; num4 = num4 / 100.0 + 1.0; double num5 = 0.0; num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); for (int j = 0; j < maid.status.propensitys.Count; j++) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.inyoku >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.mvalue >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.hentai >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.housi >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.lovely >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.elegance >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.charm >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.reception >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.cooking >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.vocal >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.dance >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } if (maid.status.appealPoint >= ScheduleCSVData.entertainParameterRevisionThreshold) { num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10); } num5 = num5 / 100.0 + 1.0; if (num5 < (double)(ScheduleCSVData.entertainPropensityRevisionMin / 100)) { num5 = (double)(ScheduleCSVData.entertainPropensityRevisionMin / 100); } else if (num5 > (double)(ScheduleCSVData.entertainPropensityRevisionMax / 100)) { num5 = (double)(ScheduleCSVData.entertainPropensityRevisionMax / 100); } yotogiResultSimulateParam.otherPlayNumber++; if (entertainGuest.sexual) { Contract contract = maid.status.contract; if (contract != Contract.Trainee && contract != Contract.Free) { if (contract == Contract.Exclusive) { num5 /= 2.0; } } else { yotogiResultSimulateParam.playNumber++; } } int num6 = (int)((double)entertainGuest.baseIcome * num4 * num5); int num7 = (int)((double)entertainGuest.baseEvaluation * num4 * num5); num6 = (int)System.Math.Ceiling((double)num6 / 1000.0) * 1000; num += num6; num2 += num7; } yotogiResultSimulateParam.income = num; yotogiResultSimulateParam.evaluation = num2; break; } case ScheduleCSVData.YotogiType.HaveSex: if (maid.status.GetFlag("_YotogiPlayed") > 0) { } break; case ScheduleCSVData.YotogiType.Vip: case ScheduleCSVData.YotogiType.VipCall: { NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId); if (nightWorksState != null && !nightWorksState.finish) { yotogiResultSimulateParam.income = yotogi.income; yotogiResultSimulateParam.evaluation = yotogi.evaluation; } if (yotogi != null) { yotogiResultSimulateParam.playNumber += yotogi.add_play_number; yotogiResultSimulateParam.otherPlayNumber += yotogi.add_other_play_number; } break; } case ScheduleCSVData.YotogiType.EasyYotogi: { ScheduleCSVData.Yotogi.EasyYotogi easyYotogi = yotogi.easyYotogi; if (easyYotogi != null) { yotogiResultSimulateParam.study_rate = easyYotogi.study_rate; yotogiResultSimulateParam.care = easyYotogi.care; yotogiResultSimulateParam.reception = easyYotogi.reception; yotogiResultSimulateParam.teach_rate = easyYotogi.teach_rate; yotogiResultSimulateParam.study_rate = easyYotogi.study_rate; yotogiResultSimulateParam.inyoku = easyYotogi.inyoku; yotogiResultSimulateParam.hentai = easyYotogi.hentai; yotogiResultSimulateParam.mvalue = easyYotogi.msei; yotogiResultSimulateParam.housi = easyYotogi.housi; } break; } } return yotogiResultSimulateParam; } public static void AddYotogiWorkResultParam(ScheduleCSVData.Yotogi scheduleData, Maid maid, ScheduleAPI.YotogiResultSimulateParam param) { maid.status.studyRate += param.study_rate; maid.status.evaluation += param.evaluation; maid.status.totalEvaluations += (long)param.evaluation; maid.status.sales += (long)param.income; maid.status.totalSales += (long)param.income; GameMain.Instance.CharacterMgr.status.baseClubEvaluation += param.evaluation; GameMain.Instance.CharacterMgr.status.money += (long)param.income; maid.status.playCountNightWork += param.otherPlayNumber; maid.status.sexPlayNumberOfPeople += param.playNumber; maid.status.baseCare += param.care; maid.status.baseReception += param.reception; maid.status.baseTeachRate += param.teach_rate; maid.status.baseInyoku += param.inyoku; maid.status.baseHentai += param.hentai; maid.status.baseMvalue += param.mvalue; maid.status.baseHousi += param.housi; } public static bool EnableNoonWork(int workId, Maid maid = null) { if (!ScheduleCSVData.TrainingData.ContainsKey(workId)) { return false; } ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[workId]; if (training.condPackage.Count > 0) { for (int i = 0; i < training.condPackage.Count; i++) { if (!PluginData.IsEnabled(training.condPackage[i])) { return false; } } } if (maid != null) { if (training.trainingType == ScheduleCSVData.TrainingType.Trainer) { if (maid != ScheduleAPI.GetStockMaidLeader()) { return false; } if (maid.status.contract == Contract.Trainee) { return false; } } if (training.trainingType == ScheduleCSVData.TrainingType.Trainee) { if (maid == ScheduleAPI.GetStockMaidLeader()) { return false; } if (maid.status.studyRate < -training.study_rate) { return false; } bool flag = false; for (int j = 0; j < 40; j++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j); if (scheduleSlot != null && ScheduleAPI.EnableNoonWork(ScheduleAPI.GetNoonTrainerWorkId(), scheduleSlot)) { flag = true; break; } } if (!flag) { return false; } } if (training.condContract.Count > 0) { bool flag2 = false; for (int k = 0; k < training.condContract.Count; k++) { if (training.condContract[k] == maid.status.contract) { flag2 = true; break; } } if (!flag2) { return false; } } if (training.condMaidClass.Count > 0) { for (int l = 0; l < training.condMaidClass.Count; l++) { if (!maid.status.jobClass.Contains(training.condMaidClass[l])) { return false; } } } } return true; } public static bool VisibleNightWork(int workId, Maid maid = null, bool checkFinish = true) { ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId]; switch (yotogi.yotogiType) { case ScheduleCSVData.YotogiType.Vip: case ScheduleCSVData.YotogiType.VipCall: { NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId); if (nightWorksState == null) { return false; } if (checkFinish && nightWorksState.finish) { if (DailyMgr.IsLegacy) { return false; } if (GameMain.Instance.CharacterMgr.status.clubGrade < 5) { return false; } if (GameMain.Instance.CharacterMgr.status.days < ScheduleCSVData.vipFullOpenDay) { return false; } } break; } case ScheduleCSVData.YotogiType.Travel: return false; case ScheduleCSVData.YotogiType.EasyYotogi: { if (yotogi.easyYotogi == null) { return false; } int trophyId = yotogi.easyYotogi.trophyId; if (!GameMain.Instance.CharacterMgr.status.IsHaveTrophy(trophyId)) { return false; } break; } } if (yotogi.condPackage.Count > 0) { for (int i = 0; i < ScheduleCSVData.YotogiData[workId].condPackage.Count; i++) { if (!PluginData.IsEnabled(ScheduleCSVData.YotogiData[workId].condPackage[i])) { return false; } } } if (yotogi.condManVisibleFlag1.Count > 0) { for (int j = 0; j < yotogi.condManVisibleFlag1.Count; j++) { if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManVisibleFlag1[j]) < 1) { return false; } } } if (maid != null) { if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara) { return false; } if (yotogi.condPersonal.Count > 0) { bool flag = false; for (int k = 0; k < yotogi.condPersonal.Count; k++) { if (maid.status.personal.id == yotogi.condPersonal[k]) { flag = true; break; } } if (!flag) { return false; } } if (yotogi.subMaidUnipueName != string.Empty) { if (maid.status.heroineType != HeroineType.Sub) { return false; } if (yotogi.subMaidUnipueName != maid.status.subCharaData.uniqueName) { return false; } } else if (maid.status.heroineType == HeroineType.Sub) { return false; } } return true; } public static bool EnableNightWork(int workId, Maid maid = null, bool calledTargetCheck = true, bool withMaid = true) { ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId]; if (yotogi.condPackage.Count > 0) { for (int i = 0; i < yotogi.condPackage.Count; i++) { if (!PluginData.IsEnabled(yotogi.condPackage[i])) { return false; } } } if (yotogi.condSalonGrade > GameMain.Instance.CharacterMgr.status.clubGrade) { return false; } if (yotogi.easyYotogi != null) { int trophyId = yotogi.easyYotogi.trophyId; if (!GameMain.Instance.CharacterMgr.status.IsHaveTrophy(trophyId)) { return false; } } if (!DailyMgr.IsLegacy && yotogi.mode == ScheduleCSVData.ScheduleBase.Mode.CM3D2) { return false; } if (DailyMgr.IsLegacy && yotogi.mode == ScheduleCSVData.ScheduleBase.Mode.COM3D) { return false; } if (maid != null) { if (yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall && calledTargetCheck && !ScheduleAPI.VipCalledMaid(workId, maid)) { return false; } foreach (KeyValuePair keyValuePair in yotogi.condSkill) { if (!maid.status.yotogiSkill.Contains(keyValuePair.Key)) { return false; } YotogiSkillData yotogiSkillData = maid.status.yotogiSkill.Get(keyValuePair.Key); if (keyValuePair.Value > yotogiSkillData.level) { return false; } } if (yotogi.condMaidClass.Count > 0) { for (int j = 0; j < yotogi.condMaidClass.Count; j++) { if (!maid.status.jobClass.Contains(yotogi.condMaidClass[j])) { return false; } } } if (yotogi.condYotogiClass.Count > 0) { for (int k = 0; k < yotogi.condYotogiClass.Count; k++) { if (!maid.status.yotogiClass.Contains(yotogi.condYotogiClass[k])) { return false; } } } if (yotogi.condPropensity.Count > 0) { bool flag = false; for (int l = 0; l < yotogi.condPropensity.Count; l++) { if (maid.status.propensitys.ContainsKey(yotogi.condPropensity[l])) { flag = true; break; } } if (!flag) { return false; } } if (yotogi.condSeikeiken.Count > 0) { bool flag2 = false; for (int m = 0; m < yotogi.condSeikeiken.Count; m++) { if (yotogi.condSeikeiken[m] == maid.status.seikeiken) { flag2 = true; break; } } if (!flag2) { return false; } } if (yotogi.condFlag1.Count > 0) { for (int n = 0; n < yotogi.condFlag1.Count; n++) { if (ScheduleAPI.GetMaidFlag(maid, yotogi.condFlag1[n]) < 1) { return false; } } } if (yotogi.condFlag0.Count > 0) { for (int num = 0; num < yotogi.condFlag0.Count; num++) { if (ScheduleAPI.GetMaidFlag(maid, yotogi.condFlag0[num]) > 0) { return false; } } } if (DailyMgr.IsLegacy) { if (yotogi.condRelationOld.Count > 0) { bool flag3 = false; for (int num2 = 0; num2 < yotogi.condRelationOld.Count; num2++) { if (yotogi.condRelationOld[num2] == maid.status.OldStatus.relation) { flag3 = true; break; } } if (!flag3) { return false; } } } else if (yotogi.condRelation.Count > 0) { bool flag4 = false; for (int num3 = 0; num3 < yotogi.condRelation.Count; num3++) { if (yotogi.condRelation[num3] == maid.status.relation) { flag4 = true; break; } } if (!flag4) { return false; } } if (yotogi.condManFlag1.Count > 0) { for (int num4 = 0; num4 < yotogi.condManFlag1.Count; num4++) { if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag1[num4]) < 1) { return false; } } } if (yotogi.condManFlag0.Count > 0) { for (int num5 = 0; num5 < yotogi.condManFlag0.Count; num5++) { if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag0[num5]) > 0) { return false; } } } if (yotogi.condContract.Count > 0) { bool flag5 = false; for (int num6 = 0; num6 < yotogi.condContract.Count; num6++) { if (yotogi.condContract[num6] == maid.status.contract) { flag5 = true; break; } } if (!flag5) { return false; } } if (yotogi.condFacilityID.Count > 0) { foreach (List list in yotogi.condFacilityID) { bool flag6 = false; foreach (int num7 in list) { Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray(); foreach (Facility facility in facilityArray) { ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime; if (withMaid) { if (yotogi.id == maid.status.noonWorkId) { scheduleTime = ScheduleMgr.ScheduleTime.DayTime; } else if (yotogi.id == maid.status.nightWorkId) { scheduleTime = ScheduleMgr.ScheduleTime.Night; } } else { scheduleTime = ScheduleTaskViewer.ScheduleTime; } if (!(facility == null) && facility.defaultData.ID == num7) { if (facility.IsOperation(scheduleTime)) { flag6 = true; Maid[] allocationMaidArray = facility.GetAllocationMaidArray(scheduleTime); if (allocationMaidArray != null && allocationMaidArray.Length == facility.minMaidCount) { foreach (Maid y in allocationMaidArray) { if (maid == y) { flag6 = false; break; } } } if (flag6) { break; } } } } if (flag6) { break; } } if (!flag6) { ScheduleAPI.log("対象の施設が稼動していない"); return false; } } } if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara) { return false; } if (yotogi.condPersonal.Count > 0) { bool flag7 = false; for (int num10 = 0; num10 < yotogi.condPersonal.Count; num10++) { if (maid.status.personal.id == yotogi.condPersonal[num10]) { flag7 = true; break; } } if (!flag7) { return false; } } if (yotogi.subMaidUnipueName != string.Empty) { if (maid.status.heroineType != HeroineType.Sub) { return false; } if (yotogi.subMaidUnipueName != maid.status.subCharaData.uniqueName) { return false; } return true; } else { if (maid.status.heroineType == HeroineType.Sub) { return false; } return true; } bool result; return result; } return true; } private static int GetMaidFlag(Maid maid, string flagName) { if (DailyMgr.IsLegacy && maid.status.OldStatus.GetFlag(flagName) != 0) { return maid.status.OldStatus.GetFlag(flagName); } return maid.status.GetFlag(flagName); } public static void NightWorksStateErrorCheck(bool care = true) { foreach (KeyValuePair keyValuePair in ScheduleCSVData.YotogiData) { int key = keyValuePair.Key; ScheduleCSVData.Yotogi value = keyValuePair.Value; NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(key); if (nightWorksState != null) { if (!nightWorksState.finish) { bool flag = false; if (value.yotogiType == ScheduleCSVData.YotogiType.VipCall) { string calledMaidGUID = nightWorksState.calledMaidGUID; Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(calledMaidGUID); if (stockMaid == null) { flag = true; } else if (!ScheduleAPI.EnableNightWork(key, stockMaid, false, true)) { flag = true; } } if (flag) { GameMain.Instance.CharacterMgr.status.RemoveNightWorksState(key); } } } } if (care) { ScheduleAPI.MaidWorkIdErrorCheck(care); } } public static void SlotEmptyCheck() { bool flag = false; for (int i = 0; i < 40; i++) { Maid maid = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (maid != null) { flag = true; break; } } if (!flag) { if (DailyMgr.IsLegacy) { for (int j = 0; j < GameMain.Instance.CharacterMgr.GetStockMaidCount(); j++) { Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(j); if (stockMaid != null && stockMaid.status.isCompatiblePersonality) { GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = stockMaid.status.guid; break; } } } else { Maid maid = ScheduleAPI.GetStockMaidLeader(); if (maid != null) { GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = maid.status.guid; } else { for (int k = 0; k < GameMain.Instance.CharacterMgr.GetStockMaidCount(); k++) { Maid stockMaid2 = GameMain.Instance.CharacterMgr.GetStockMaid(k); if (stockMaid2 != null) { GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = stockMaid2.status.guid; break; } } } } } } public static void MaidWorkIdErrorCheck(bool care = true) { ScheduleAPI.SlotEmptyCheck(); Maid noonTrainerMaid = ScheduleAPI.GetNoonTrainerMaid(); Maid nightTrainerMaid = ScheduleAPI.GetNightTrainerMaid(); Maid noonTraineeMaid = ScheduleAPI.GetNoonTraineeMaid(); Maid nightTraineeMaid = ScheduleAPI.GetNightTraineeMaid(); if ((noonTrainerMaid != nightTrainerMaid || noonTraineeMaid != nightTraineeMaid || noonTrainerMaid == null || nightTrainerMaid == null || !ScheduleAPI.CanTrainee(noonTraineeMaid) || !ScheduleAPI.CanTrainee(nightTraineeMaid)) && (noonTrainerMaid != null || nightTrainerMaid != null || noonTraineeMaid != null || nightTraineeMaid != null)) { Debug.Log("MaidWorkIdErrorCheck:メイド研修の条件一致箇所があったためメイド研修をスロットから破棄します。"); if (noonTrainerMaid != null) { ScheduleAPI.WorkIdReset(noonTrainerMaid.status, ScheduleMgr.ScheduleTime.DayTime); } if (nightTrainerMaid != null) { ScheduleAPI.WorkIdReset(nightTrainerMaid.status, ScheduleMgr.ScheduleTime.Night); } if (noonTraineeMaid != null) { ScheduleAPI.WorkIdReset(noonTraineeMaid.status, ScheduleMgr.ScheduleTime.DayTime); } if (nightTraineeMaid != null) { ScheduleAPI.WorkIdReset(nightTraineeMaid.status, ScheduleMgr.ScheduleTime.Night); } } int travelWorkId = ScheduleAPI.GetTravelWorkId(); int nightTravelWorkId = ScheduleAPI.GetNightTravelWorkId(); Maid maid = null; for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && (scheduleSlot.status.noonWorkId == travelWorkId || scheduleSlot.status.nightWorkId == nightTravelWorkId)) { if (maid == null && scheduleSlot.status.noonWorkId == travelWorkId && scheduleSlot.status.nightWorkId == nightTravelWorkId) { maid = scheduleSlot; } else { if (scheduleSlot.status.noonWorkId == travelWorkId) { ScheduleAPI.WorkIdReset(scheduleSlot.status, ScheduleMgr.ScheduleTime.DayTime); } if (scheduleSlot.status.nightWorkId == nightTravelWorkId) { ScheduleAPI.WorkIdReset(scheduleSlot.status, ScheduleMgr.ScheduleTime.Night); } } } } if (maid != null) { for (int j = 0; j < 40; j++) { Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j); if (scheduleSlot2 != null && scheduleSlot2 != maid && scheduleSlot2.status.nightWorkId != 0 && !ScheduleAPI.CheckNoProblemTravel(scheduleSlot2.status.nightWorkId)) { ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime); ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night); break; } } } for (int k = 0; k < 40; k++) { Maid scheduleSlot3 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k); if (scheduleSlot3 != null) { ScheduleAPI.MaidWorkIdErrorCheck(scheduleSlot3, care); } } if (maid != null && maid.status.noonWorkId == travelWorkId && maid.status.nightWorkId == nightTravelWorkId) { int nightEntertainWorkId = ScheduleAPI.GetNightEntertainWorkId(); int nightRestWorkId = ScheduleAPI.GetNightRestWorkId(); for (int l = 0; l < 40; l++) { Maid scheduleSlot4 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(l); if (scheduleSlot4 != null && scheduleSlot4 != maid && ScheduleCSVData.YotogiData.ContainsKey(scheduleSlot4.status.nightWorkId) && !ScheduleAPI.CheckNoProblemTravel(scheduleSlot4.status.nightWorkId)) { if (scheduleSlot4.status.contract == Contract.Free) { scheduleSlot4.status.nightWorkId = nightRestWorkId; } else { scheduleSlot4.status.nightWorkId = nightEntertainWorkId; } } } } } private static void MaidWorkIdErrorCheck(Maid maid, bool care = true) { ScheduleAPI.SlotEmptyCheck(); ScheduleAPI.CheckTask(maid, ScheduleMgr.ScheduleTime.DayTime, care); ScheduleAPI.CheckTask(maid, ScheduleMgr.ScheduleTime.Night, care); if (care) { ScheduleAPI.EmptyToRandomWork(maid); } } private static void CheckTask(Maid maid, ScheduleMgr.ScheduleTime time, bool care) { int num = 0; if (time == ScheduleMgr.ScheduleTime.DayTime) { num = maid.status.noonWorkId; } else if (time == ScheduleMgr.ScheduleTime.Night) { num = maid.status.nightWorkId; } if (!ScheduleCSVData.AllData.ContainsKey(num)) { return; } ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num]; if ((DailyMgr.IsLegacy && scheduleBase.mode == ScheduleCSVData.ScheduleBase.Mode.COM3D) || (!DailyMgr.IsLegacy && scheduleBase.mode == ScheduleCSVData.ScheduleBase.Mode.CM3D2)) { ScheduleAPI.WorkIdReset(maid.status, time); return; } if (DailyMgr.IsLegacy && ((time == ScheduleMgr.ScheduleTime.DayTime && scheduleBase.type != ScheduleTaskCtrl.TaskType.Training) || (time == ScheduleMgr.ScheduleTime.Night && scheduleBase.type != ScheduleTaskCtrl.TaskType.Yotogi))) { ScheduleAPI.WorkIdReset(maid.status, time); } ScheduleTaskCtrl.TaskType type = scheduleBase.type; if (type != ScheduleTaskCtrl.TaskType.Training) { if (type != ScheduleTaskCtrl.TaskType.Yotogi) { if (type == ScheduleTaskCtrl.TaskType.Work) { ScheduleAPI.CheckWork(maid, num, care, time); } } else { ScheduleAPI.CheckYotogi(maid, num, time); } } else { ScheduleAPI.CheckTraining(maid, num, care, time); } } private static void CheckWork(Maid maid, int taskId, bool care, ScheduleMgr.ScheduleTime time) { if (ScheduleCSVData.WorkData.ContainsKey(taskId)) { ScheduleCSVData.Work work = ScheduleCSVData.WorkData[taskId]; if (taskId != ScheduleCSVData.faclilityPowerUpWorkId) { Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(maid, time); if (maidAssignedFacility == null || maidAssignedFacility.defaultData.workData.id != taskId) { ScheduleAPI.WorkIdReset(maid.status, time); } } } } private static void CheckTraining(Maid maid, int taskId, bool care, ScheduleMgr.ScheduleTime time) { if (ScheduleCSVData.TrainingData.ContainsKey(taskId)) { bool flag = false; ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[taskId]; ScheduleCSVData.TrainingType trainingType = training.trainingType; if (trainingType != ScheduleCSVData.TrainingType.Trainer) { if (trainingType != ScheduleCSVData.TrainingType.Trainee) { if (trainingType == ScheduleCSVData.TrainingType.Travel) { if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid)) { flag = true; } if (!flag && ScheduleCSVData.YotogiData[maid.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Travel) { flag = true; } if (!flag) { int num = 0; while (num < 40 && !flag) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num); if (!(scheduleSlot == maid)) { if (scheduleSlot != null && ScheduleCSVData.YotogiData.ContainsKey(scheduleSlot.status.nightWorkId) && ScheduleCSVData.YotogiData[scheduleSlot.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Entertain && ScheduleCSVData.YotogiData[scheduleSlot.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Rest) { flag = true; } } num++; } } if (flag) { ScheduleAPI.EmptyToRandomWork(maid); } } } else { if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid)) { flag = true; } if (!flag && maid.status.noonWorkId != maid.status.nightWorkId) { flag = true; } if (flag) { ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime); ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night); for (int i = 0; i < 40; i++) { Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot2 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot2.status.noonWorkId) && ScheduleCSVData.TrainingData[scheduleSlot2.status.noonWorkId].trainingType == ScheduleCSVData.TrainingType.Trainer) { ScheduleAPI.WorkIdReset(scheduleSlot2.status, ScheduleMgr.ScheduleTime.DayTime); ScheduleAPI.WorkIdReset(scheduleSlot2.status, ScheduleMgr.ScheduleTime.Night); if (care) { ScheduleAPI.EmptyToRandomWork(scheduleSlot2); } break; } } } } } else { if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid)) { flag = true; } if (!flag && maid.status.noonWorkId != maid.status.nightWorkId) { flag = true; } bool flag2 = false; for (int j = 0; j < 40; j++) { Maid scheduleSlot3 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j); if (scheduleSlot3 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot3.status.noonWorkId)) { ScheduleCSVData.Training training2 = ScheduleCSVData.TrainingData[scheduleSlot3.status.noonWorkId]; if (training2.trainingType == ScheduleCSVData.TrainingType.Trainee && scheduleSlot3.status.noonWorkId == scheduleSlot3.status.nightWorkId) { flag2 = true; break; } } } if (!flag2) { flag = true; } if (flag) { ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime); ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night); if (care) { ScheduleAPI.EmptyToRandomWork(maid); } for (int k = 0; k < 40; k++) { Maid scheduleSlot4 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k); if (scheduleSlot4 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot4.status.noonWorkId) && ScheduleCSVData.TrainingData[scheduleSlot4.status.noonWorkId].trainingType == ScheduleCSVData.TrainingType.Trainee) { ScheduleAPI.WorkIdReset(scheduleSlot4.status, ScheduleMgr.ScheduleTime.DayTime); ScheduleAPI.WorkIdReset(scheduleSlot4.status, ScheduleMgr.ScheduleTime.Night); if (care) { ScheduleAPI.EmptyToRandomWork(scheduleSlot4); } break; } } } } } else { ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime); } } private static void CheckYotogi(Maid maid, int taskId, ScheduleMgr.ScheduleTime time) { if (ScheduleCSVData.YotogiData.ContainsKey(taskId)) { bool flag = false; ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[taskId]; if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall)) { if (maid != null) { if (!ScheduleAPI.VisibleNightWork(taskId, maid, true)) { flag = true; } } else if (!ScheduleAPI.VisibleNightWork(taskId, null, true)) { flag = true; } } if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall)) { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && scheduleSlot != maid && (taskId == scheduleSlot.status.noonWorkId || taskId == scheduleSlot.status.nightWorkId)) { flag = true; break; } } } if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall || yotogi.yotogiType == ScheduleCSVData.YotogiType.Entertain || yotogi.yotogiType == ScheduleCSVData.YotogiType.Travel) && !ScheduleAPI.EnableNightWork(taskId, maid, true, true)) { flag = true; } if (flag) { ScheduleAPI.WorkIdReset(maid.status, time); } } else { ScheduleAPI.WorkIdReset(maid.status, time); } } private static void WorkIdReset(MaidStatus.Status maidStatus, ScheduleMgr.ScheduleTime time) { if (time == ScheduleMgr.ScheduleTime.DayTime) { maidStatus.noonWorkId = 0; } else if (time == ScheduleMgr.ScheduleTime.Night) { maidStatus.nightWorkId = 0; } } public static void ScheduleErrorAllCheck() { ScheduleAPI.SlotEmptyCheck(); ScheduleAPI.NightWorksStateErrorCheck(false); ScheduleAPI.MaidWorkIdErrorCheck(false); for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null) { ScheduleAPI.EmptyToRandomWork(scheduleSlot); } } } public static void DayStartManage() { bool flag = false; int travelWorkId = ScheduleAPI.GetTravelWorkId(); int num = 0; while (num < 40 && !flag) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num); if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId) { flag = true; } num++; } if (flag) { ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[travelWorkId]; foreach (int key in training.needEventItemIdList) { if (Shop.item_data_dic.ContainsKey(key) && Shop.item_data_dic[key].type == Shop.ItemDataBase.Type.Event) { Shop.ItemDataEvent itemDataEvent = Shop.item_data_dic[key] as Shop.ItemDataEvent; itemDataEvent.Reset(); } } } if (DailyMgr.IsLegacy) { GameMain.Instance.CharacterMgr.status.ApplyScheduleSlotBackup(ScheduleSlotBackup.Type.CM3D2); } else { GameMain.Instance.CharacterMgr.status.ApplyScheduleSlotBackup(ScheduleSlotBackup.Type.COM3D); } ScheduleAPI.ErrorCheck(); GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Noon_Resulted", 0); GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Night_Resulted", 0); ScheduleAPI.BackupParam(SCENE_ID.Start); } public static void ErrorCheck() { ScheduleAPI.SlotEmptyCheck(); ScheduleAPI.NightWorksStateErrorCheck(false); ScheduleAPI.OccurNightWork(); ScheduleAPI.MaidWorkIdErrorCheck(false); int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount(); for (int i = 0; i < stockMaidCount; i++) { Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i); ScheduleAPI.EmptyToRandomWork(stockMaid); } } public static void ThroughNoonResult() { if (GameMain.Instance.CharacterMgr.status.GetFlag("_Schedule_Noon_Resulted") > 0) { return; } GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Noon_Resulted", 1); for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null) { GameMain.Instance.CharacterMgr.status.scheduleSlot[i].noon_success_level = ScheduleData.WorkSuccessLv.Miss; BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.Morning); BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.Noon); BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.NoonBonus); } } } public static int NoonWorkPlayCount(Maid maid, int workId) { if (maid.status.workDatas.ContainsKey(workId)) { return (int)maid.status.workDatas.Get(workId).playCount; } return 0; } public static int NoonWorkPlayToLv(int noonWorkPlayCount) { if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp) { return 1; } if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp) { return 2; } return 3; } public static float NoonWorkPlayExpRatio(int noonWorkPlayCount) { if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp) { return (float)noonWorkPlayCount / (float)ScheduleCSVData.noonWorkLv2Exp; } if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp) { return (float)(noonWorkPlayCount - ScheduleCSVData.noonWorkLv2Exp) / (float)ScheduleCSVData.noonWorkLv3Exp; } return 0f; } public static int NoonWorkLvToRevision(int lv) { return (lv - 1) * 10; } public static bool EmptyToRandomWork(Maid maid) { bool result = false; if (maid.status.noonWorkId == 0) { int num = ScheduleAPI.NoonWorkRandom(maid); maid.status.noonWorkId = num; result = true; ScheduleAPI.AddTrainingFacility(maid, num, ScheduleMgr.ScheduleTime.DayTime); if (maid.status.heroineType == HeroineType.Sub) { ScheduleAPI.SubMaidDefaultFacility(maid, num, ScheduleMgr.ScheduleTime.DayTime); } } if (maid.status.nightWorkId == 0) { int num = ScheduleAPI.NightWorkRandom(maid); maid.status.nightWorkId = num; result = true; ScheduleAPI.AddTrainingFacility(maid, num, ScheduleMgr.ScheduleTime.Night); if (maid.status.heroineType == HeroineType.Sub) { ScheduleAPI.SubMaidDefaultFacility(maid, num, ScheduleMgr.ScheduleTime.Night); } } return result; } public static int NoonWorkRandom(Maid maid) { if (maid.status.heroineType == HeroineType.Sub) { return ScheduleCSVData.subMaidInitTaskId; } Dictionary db; if (DailyMgr.IsLegacy) { db = ScheduleCSVData.NoonWorkInitDataLegacy[maid.status.personal.id]; } else { db = ScheduleCSVData.NoonWorkInitData[maid.status.personal.id]; } return ScheduleAPI.WorkRandom(db); } public static int NightWorkRandom(Maid maid) { if (maid.status.heroineType == HeroineType.Sub) { return ScheduleCSVData.subMaidInitTaskId; } Dictionary db = ScheduleCSVData.NightWorkInitData[maid.status.personal.id]; return ScheduleAPI.WorkRandom(db); } public static void FacilitySlotReset(string maidGuid, ScheduleMgr.ScheduleTime time) { Maid maid = ScheduleAPI.IsSlotInMaid(maidGuid); if (maid == null) { return; } if (time == ScheduleMgr.ScheduleTime.DayTime) { maid.status.noonWorkId = 0; } else if (time == ScheduleMgr.ScheduleTime.Night) { maid.status.nightWorkId = 0; } } public static void AddTrainingFacility(Maid maid, int workId, ScheduleMgr.ScheduleTime time) { if (DailyMgr.IsLegacy) { return; } if (!ScheduleCSVData.TrainingData.ContainsKey(workId)) { return; } ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[workId]; if (training.trainingType != ScheduleCSVData.TrainingType.Basic) { return; } Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray(); foreach (Facility facility in facilityArray) { if (!(facility == null)) { if (facility.defaultData.ID == training.facilityId) { facility.AllocationMaid(maid, time); return; } } } } public static void SubMaidDefaultFacility(Maid maid, int workId, ScheduleMgr.ScheduleTime time) { if (DailyMgr.IsLegacy || maid.status.heroineType != HeroineType.Sub || !ScheduleCSVData.WorkData.ContainsKey(workId)) { return; } ScheduleCSVData.Work work = ScheduleCSVData.WorkData[workId]; Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray(); foreach (Facility facility in facilityArray) { if (facility.defaultData.ID == work.facility.ID) { facility.AllocationMaid(maid, time); return; } } } public static bool FacilitySlotActive(string maidGuid, Facility facility, ScheduleMgr.ScheduleTime time) { Maid maid = ScheduleAPI.IsSlotInMaid(maidGuid); if (maid == null) { return false; } int key = 0; if (time == ScheduleMgr.ScheduleTime.DayTime) { key = maid.status.noonWorkId; } if (time == ScheduleMgr.ScheduleTime.Night) { key = maid.status.nightWorkId; } if (ScheduleCSVData.AllData.ContainsKey(key)) { ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key]; if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work) { ScheduleCSVData.Work work = (ScheduleCSVData.Work)scheduleBase; if (work.facility == facility.defaultData && work.facilityId != ScheduleCSVData.faclilityPowerUpWorkId) { return true; } } else if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Training) { ScheduleCSVData.Training training = (ScheduleCSVData.Training)scheduleBase; if (training.facilityId == facility.defaultData.ID) { return true; } } } return false; } private static Maid IsSlotInMaid(string maidGuid) { for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null && scheduleSlot.status.guid == maidGuid) { return scheduleSlot; } } return null; } public static bool CanTrainee(Maid maid) { if (maid == null) { return false; } int num = 0; for (int i = 0; i < 40; i++) { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i); if (scheduleSlot != null) { num++; } } return num >= 3 && maid.status.studyRate >= 50; } private static int WorkRandom(Dictionary db) { if (db.Count == 0) { Debug.LogWarning("ScheduleAPI.WorkRandom:傾向情報がありませんでした。0を返します。"); return 0; } int num = 0; foreach (KeyValuePair keyValuePair in db) { num += keyValuePair.Value; } int num2 = UnityEngine.Random.Range(0, num); foreach (KeyValuePair keyValuePair2 in db) { num2 -= keyValuePair2.Value; if (num2 < 0) { return keyValuePair2.Key; } } Debug.LogWarning("ScheduleAPI.WorkRandom:本来通過するはずの無い箇所です。"); return 0; } public static string InfoReplace(int nightWorkId, string info) { NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(nightWorkId); if (nightWorksState != null) { string calledMaidGUID = nightWorksState.calledMaidGUID; Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(calledMaidGUID); if (stockMaid != null) { info = info.Replace("[HF]", stockMaid.status.firstName); } } return info; } private static List GetNightWorkMeetMaidList(int workId, bool calledTargetCheck = false) { List list = new List(); int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount(); for (int i = 0; i < stockMaidCount; i++) { Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i); if (ScheduleAPI.EnableNightWork(workId, stockMaid, calledTargetCheck, true)) { list.Add(stockMaid); } } return list; } public static void OccurNightWork() { foreach (KeyValuePair keyValuePair in ScheduleCSVData.YotogiData) { ScheduleCSVData.Yotogi value = keyValuePair.Value; ScheduleCSVData.YotogiType yotogiType = value.yotogiType; if (yotogiType != ScheduleCSVData.YotogiType.Vip) { if (yotogiType == ScheduleCSVData.YotogiType.VipCall) { if (GameMain.Instance.CharacterMgr.status.GetNightWorksState(value.id) == null && ScheduleAPI.EnableNightWork(value.id, null, true, true)) { List nightWorkMeetMaidList = ScheduleAPI.GetNightWorkMeetMaidList(value.id, false); if (nightWorkMeetMaidList.Count > 0) { NightWorkState nightWorkState = new NightWorkState(); nightWorkState.finish = false; nightWorkState.workId = keyValuePair.Key; int index = UnityEngine.Random.Range(0, nightWorkMeetMaidList.Count - 1); nightWorkState.calledMaidGUID = nightWorkMeetMaidList[index].status.guid; GameMain.Instance.CharacterMgr.status.AddNightWorksState(nightWorkState); } } } } else if (GameMain.Instance.CharacterMgr.status.GetNightWorksState(value.id) == null && ScheduleAPI.EnableNightWork(value.id, null, true, true)) { NightWorkState nightWorkState2 = new NightWorkState(); nightWorkState2.finish = false; nightWorkState2.workId = keyValuePair.Key; nightWorkState2.calledMaidGUID = null; GameMain.Instance.CharacterMgr.status.AddNightWorksState(nightWorkState2); } } } public static List logs = new List(); public static bool logOutput = false; public const string NOON_RESULTED_GENERAL_FLAG = "_Schedule_Noon_Resulted"; public const string NIGHT_RESULTED_GENERAL_FLAG = "_Schedule_Night_Resulted"; public class TrainingResultSimulateParam { public int study_rate; public int reception; public int care; public int lovely; public int elegance; public int charm; public int teach_rate; public int exp; public int cooking; public int vocal; public int dance; public int appealPoint; public int inyoku; public int mvalue; public int hentai; public int housi; public int income; public int commandExp; } public class YotogiResultSimulateParam { public int income; public int evaluation; public int playNumber; public int otherPlayNumber; public int study_rate; public int reception; public int care; public int teach_rate; public int inyoku; public int mvalue; public int hentai; public int housi; } } }