ScheduleAPI.cs 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485
  1. using System;
  2. using System.Collections.Generic;
  3. using BackupParamAccessor;
  4. using MaidStatus;
  5. using PlayerStatus;
  6. using UnityEngine;
  7. using wf;
  8. namespace Schedule
  9. {
  10. public static class ScheduleAPI
  11. {
  12. public static void log(string text)
  13. {
  14. if (!ScheduleAPI.logOutput)
  15. {
  16. return;
  17. }
  18. if (ScheduleAPI.logs.Count > 500)
  19. {
  20. ScheduleAPI.logs.RemoveRange(0, 400);
  21. }
  22. ScheduleAPI.logs.Add(text);
  23. }
  24. public static int GetNoonTrainerWorkId()
  25. {
  26. foreach (KeyValuePair<int, ScheduleCSVData.ScheduleBase> keyValuePair in ScheduleCSVData.AllData)
  27. {
  28. if (keyValuePair.Value.type == ScheduleTaskCtrl.TaskType.Training)
  29. {
  30. ScheduleCSVData.Training training = (ScheduleCSVData.Training)keyValuePair.Value;
  31. if (training.trainingType == ScheduleCSVData.TrainingType.Trainer)
  32. {
  33. return keyValuePair.Key;
  34. }
  35. }
  36. }
  37. Debug.LogWarning("ScheduleCSVData.GetNoonTrainerWorkId:昼のメイド研修(研修官)仕事IDが発見できませんでした。");
  38. return 0;
  39. }
  40. public static int GetTraineeWorkId()
  41. {
  42. foreach (KeyValuePair<int, ScheduleCSVData.Training> keyValuePair in ScheduleCSVData.TrainingData)
  43. {
  44. if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Trainee)
  45. {
  46. return keyValuePair.Key;
  47. }
  48. }
  49. Debug.LogWarning("ScheduleCSVData.GetNoonTraineeWorkId:昼のメイド研修(研修生)仕事IDが発見できませんでした。");
  50. return 0;
  51. }
  52. public static int GetTravelWorkId()
  53. {
  54. foreach (KeyValuePair<int, ScheduleCSVData.Training> keyValuePair in ScheduleCSVData.TrainingData)
  55. {
  56. if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Travel)
  57. {
  58. return keyValuePair.Key;
  59. }
  60. }
  61. Debug.LogWarning("ScheduleCSVData.GetNoonTravelWorkId:昼の旅行仕事IDが発見できませんでした。");
  62. return 0;
  63. }
  64. public static int GetNightTrainerWorkId()
  65. {
  66. foreach (KeyValuePair<int, ScheduleCSVData.Training> keyValuePair in ScheduleCSVData.TrainingData)
  67. {
  68. if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Trainer)
  69. {
  70. return keyValuePair.Key;
  71. }
  72. }
  73. Debug.LogWarning("ScheduleCSVData.GetNightTrainerWorkId:夜のメイド研修(研修官)仕事IDが発見できませんでした。");
  74. return 0;
  75. }
  76. public static int GetNightTraineeWorkId()
  77. {
  78. foreach (KeyValuePair<int, ScheduleCSVData.Training> keyValuePair in ScheduleCSVData.TrainingData)
  79. {
  80. if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Trainee)
  81. {
  82. return keyValuePair.Key;
  83. }
  84. }
  85. Debug.LogWarning("ScheduleCSVData.GetNightTraineeWorkId:夜のメイド研修(研修生)仕事IDが発見できませんでした。");
  86. return 0;
  87. }
  88. public static int GetNightTravelWorkId()
  89. {
  90. foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
  91. {
  92. if (keyValuePair.Value.yotogiType == ScheduleCSVData.YotogiType.Travel)
  93. {
  94. return keyValuePair.Key;
  95. }
  96. }
  97. Debug.LogWarning("ScheduleCSVData.GetNightTravelWorkId:夜の旅行仕事IDが発見できませんでした。");
  98. return 0;
  99. }
  100. public static int GetNightEntertainWorkId()
  101. {
  102. foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
  103. {
  104. if (keyValuePair.Value.yotogiType == ScheduleCSVData.YotogiType.Entertain)
  105. {
  106. return keyValuePair.Key;
  107. }
  108. }
  109. Debug.LogWarning("ScheduleCSVData.GetNightEntertainWorkId:夜のクラブ接待 仕事IDが発見できませんでした。");
  110. return 0;
  111. }
  112. public static int GetNightRestWorkId()
  113. {
  114. foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
  115. {
  116. if (keyValuePair.Value.yotogiType == ScheduleCSVData.YotogiType.Rest)
  117. {
  118. return keyValuePair.Key;
  119. }
  120. }
  121. Debug.LogWarning("ScheduleCSVData.GetNightRestWorkId:夜の休息 仕事IDが発見できませんでした。");
  122. return 0;
  123. }
  124. public static bool CheckNoProblemTravel(int nightWorkId)
  125. {
  126. ScheduleCSVData.ScheduleBase scheduleBase = null;
  127. foreach (KeyValuePair<int, ScheduleCSVData.ScheduleBase> keyValuePair in ScheduleCSVData.AllData)
  128. {
  129. if (keyValuePair.Value.id == nightWorkId)
  130. {
  131. scheduleBase = keyValuePair.Value;
  132. break;
  133. }
  134. }
  135. if (scheduleBase == null)
  136. {
  137. return false;
  138. }
  139. if (scheduleBase.type != ScheduleTaskCtrl.TaskType.Yotogi)
  140. {
  141. return false;
  142. }
  143. ScheduleCSVData.YotogiType yotogiType = ((ScheduleCSVData.Yotogi)scheduleBase).yotogiType;
  144. return yotogiType != ScheduleCSVData.YotogiType.HaveSex && yotogiType != ScheduleCSVData.YotogiType.NewSex && yotogiType != ScheduleCSVData.YotogiType.Vip && yotogiType != ScheduleCSVData.YotogiType.VipCall;
  145. }
  146. public static void BackupParam(SCENE_ID scene_id)
  147. {
  148. for (int i = 0; i < 40; i++)
  149. {
  150. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  151. if (scheduleSlot != null)
  152. {
  153. BackupParamAccessor.BackupParam(new int?(i), scene_id);
  154. }
  155. }
  156. }
  157. public static void BackUpScheduleSlot()
  158. {
  159. if (DailyMgr.IsLegacy)
  160. {
  161. GameMain.Instance.CharacterMgr.status.BackupScheduleSlot(ScheduleSlotBackup.Type.CM3D2);
  162. }
  163. else
  164. {
  165. GameMain.Instance.CharacterMgr.status.BackupScheduleSlot(ScheduleSlotBackup.Type.COM3D);
  166. }
  167. }
  168. public static Maid GetNoonTrainerMaid()
  169. {
  170. for (int i = 0; i < 40; i++)
  171. {
  172. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  173. if (scheduleSlot != null && scheduleSlot.status.noonWorkId == ScheduleAPI.GetNoonTrainerWorkId())
  174. {
  175. return scheduleSlot;
  176. }
  177. }
  178. return null;
  179. }
  180. public static Maid GetNoonTraineeMaid()
  181. {
  182. for (int i = 0; i < 40; i++)
  183. {
  184. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  185. if (scheduleSlot != null && scheduleSlot.status.noonWorkId == ScheduleAPI.GetTraineeWorkId())
  186. {
  187. return scheduleSlot;
  188. }
  189. }
  190. return null;
  191. }
  192. public static Maid GetNightTrainerMaid()
  193. {
  194. for (int i = 0; i < 40; i++)
  195. {
  196. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  197. if (scheduleSlot != null && scheduleSlot.status.nightWorkId == ScheduleAPI.GetNightTrainerWorkId())
  198. {
  199. return scheduleSlot;
  200. }
  201. }
  202. return null;
  203. }
  204. public static Maid GetNightTraineeMaid()
  205. {
  206. for (int i = 0; i < 40; i++)
  207. {
  208. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  209. if (scheduleSlot != null && scheduleSlot.status.nightWorkId == ScheduleAPI.GetNightTraineeWorkId())
  210. {
  211. return scheduleSlot;
  212. }
  213. }
  214. return null;
  215. }
  216. public static Maid GetTravelMaid()
  217. {
  218. int travelWorkId = ScheduleAPI.GetTravelWorkId();
  219. if (travelWorkId != 0)
  220. {
  221. for (int i = 0; i < 40; i++)
  222. {
  223. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  224. if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId)
  225. {
  226. return scheduleSlot;
  227. }
  228. }
  229. }
  230. return null;
  231. }
  232. public static KeyValuePair<string, KeyValuePair<Vector3, Vector3>> GetTravelBgData(bool time_is_noon)
  233. {
  234. int travelWorkId = ScheduleAPI.GetTravelWorkId();
  235. if (travelWorkId != 0)
  236. {
  237. for (int i = 0; i < 40; i++)
  238. {
  239. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  240. if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId)
  241. {
  242. ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[travelWorkId];
  243. foreach (int key in training.needEventItemIdList)
  244. {
  245. Shop.ItemDataEvent itemDataEvent = Shop.item_data_dic[key] as Shop.ItemDataEvent;
  246. if (itemDataEvent.is_have_item)
  247. {
  248. string key2 = itemDataEvent.free_text[(!time_is_noon) ? 1 : 0];
  249. Vector3 key3 = Parse.Vector3("(" + itemDataEvent.free_text[2] + ")");
  250. Vector3 value = Parse.Vector3("(" + itemDataEvent.free_text[3] + ")");
  251. return new KeyValuePair<string, KeyValuePair<Vector3, Vector3>>(key2, new KeyValuePair<Vector3, Vector3>(key3, value));
  252. }
  253. }
  254. }
  255. }
  256. }
  257. return new KeyValuePair<string, KeyValuePair<Vector3, Vector3>>(string.Empty, new KeyValuePair<Vector3, Vector3>(Vector3.zero, Vector3.zero));
  258. }
  259. public static Maid GetStockMaidLeader()
  260. {
  261. int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount();
  262. for (int i = 0; i < stockMaidCount; i++)
  263. {
  264. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
  265. if (stockMaid != null && stockMaid.status.leader)
  266. {
  267. return stockMaid;
  268. }
  269. }
  270. return null;
  271. }
  272. public static bool VipCalledMaid(int workId, Maid maid)
  273. {
  274. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId);
  275. return nightWorksState != null && !string.IsNullOrEmpty(nightWorksState.calledMaidGUID) && !(nightWorksState.calledMaidGUID == maid.status.guid);
  276. }
  277. public static int GetScheduleId(Maid maid, bool isDaytime)
  278. {
  279. if (maid == null)
  280. {
  281. return 0;
  282. }
  283. if (isDaytime)
  284. {
  285. return maid.status.noonWorkId;
  286. }
  287. return maid.status.nightWorkId;
  288. }
  289. public static int GetScheduleId(Maid maid, ScheduleMgr.ScheduleTime time)
  290. {
  291. return ScheduleAPI.GetScheduleId(maid, time == ScheduleMgr.ScheduleTime.DayTime);
  292. }
  293. public static ScheduleCSVData.ScheduleBase GetSchedule(Maid maid, bool isDaytime)
  294. {
  295. if (maid == null)
  296. {
  297. return null;
  298. }
  299. int key = maid.status.noonWorkId;
  300. if (isDaytime)
  301. {
  302. key = maid.status.noonWorkId;
  303. }
  304. else
  305. {
  306. key = maid.status.nightWorkId;
  307. }
  308. if (!ScheduleCSVData.AllData.ContainsKey(key))
  309. {
  310. return null;
  311. }
  312. return ScheduleCSVData.AllData[key];
  313. }
  314. public static ScheduleCSVData.ScheduleBase GetSchedule(Maid maid, ScheduleMgr.ScheduleTime time)
  315. {
  316. return ScheduleAPI.GetSchedule(maid, time == ScheduleMgr.ScheduleTime.DayTime);
  317. }
  318. private static bool CheckCommu(Maid m, bool isDaytime, bool checkCommuState)
  319. {
  320. if (checkCommuState)
  321. {
  322. if (isDaytime && !m.status.noonCommu)
  323. {
  324. return false;
  325. }
  326. if (!isDaytime && !m.status.nightCommu)
  327. {
  328. return false;
  329. }
  330. }
  331. int key;
  332. if (isDaytime)
  333. {
  334. key = m.status.noonWorkId;
  335. }
  336. else
  337. {
  338. key = m.status.nightWorkId;
  339. }
  340. if (ScheduleCSVData.AllData.ContainsKey(key))
  341. {
  342. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key];
  343. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work)
  344. {
  345. ScheduleMgr.ScheduleTime scheduleTime;
  346. if (isDaytime)
  347. {
  348. scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  349. }
  350. else
  351. {
  352. scheduleTime = ScheduleMgr.ScheduleTime.Night;
  353. }
  354. Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(m, scheduleTime);
  355. if (maidAssignedFacility == null || !maidAssignedFacility.IsOperation(scheduleTime))
  356. {
  357. return false;
  358. }
  359. }
  360. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Training || scheduleBase.type == ScheduleTaskCtrl.TaskType.Work)
  361. {
  362. ScheduleCSVData.Training training = (ScheduleCSVData.Training)scheduleBase;
  363. if (checkCommuState)
  364. {
  365. switch (training.trainingType)
  366. {
  367. case ScheduleCSVData.TrainingType.Basic:
  368. case ScheduleCSVData.TrainingType.Trainer:
  369. case ScheduleCSVData.TrainingType.Trainee:
  370. case ScheduleCSVData.TrainingType.Holiday:
  371. return true;
  372. }
  373. }
  374. else
  375. {
  376. ScheduleCSVData.TrainingType trainingType = training.trainingType;
  377. if (trainingType == ScheduleCSVData.TrainingType.Basic)
  378. {
  379. return true;
  380. }
  381. }
  382. }
  383. }
  384. return false;
  385. }
  386. public static Maid GetCommunicationMaid(bool isDaytime)
  387. {
  388. for (int i = 0; i < 40; i++)
  389. {
  390. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  391. if (scheduleSlot != null && ScheduleAPI.CheckCommu(scheduleSlot, isDaytime, true))
  392. {
  393. return scheduleSlot;
  394. }
  395. }
  396. return null;
  397. }
  398. public static List<Maid> CanCommunicationMaids(bool isDaytime)
  399. {
  400. List<Maid> list = new List<Maid>();
  401. for (int i = 0; i < 40; i++)
  402. {
  403. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  404. if (scheduleSlot != null && ScheduleAPI.CheckCommu(scheduleSlot, isDaytime, false))
  405. {
  406. list.Add(scheduleSlot);
  407. }
  408. }
  409. return list;
  410. }
  411. public static List<Maid> GetFacilityPowerUpMaids(bool isDaytime)
  412. {
  413. List<Maid> list = new List<Maid>();
  414. for (int i = 0; i < 40; i++)
  415. {
  416. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  417. if (scheduleSlot != null)
  418. {
  419. int num;
  420. if (isDaytime)
  421. {
  422. num = scheduleSlot.status.noonWorkId;
  423. }
  424. else
  425. {
  426. num = scheduleSlot.status.nightWorkId;
  427. }
  428. if (num == ScheduleCSVData.faclilityPowerUpWorkId)
  429. {
  430. list.Add(scheduleSlot);
  431. }
  432. }
  433. }
  434. return list;
  435. }
  436. public static List<Maid> GetEntertainMaids()
  437. {
  438. List<Maid> list = new List<Maid>();
  439. for (int i = 0; i < 40; i++)
  440. {
  441. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  442. if (scheduleSlot != null)
  443. {
  444. ScheduleCSVData.YotogiType yotogiType = ScheduleCSVData.YotogiData[scheduleSlot.status.nightWorkId].yotogiType;
  445. if (yotogiType == ScheduleCSVData.YotogiType.Entertain)
  446. {
  447. list.Add(scheduleSlot);
  448. }
  449. }
  450. }
  451. return list;
  452. }
  453. public static List<Maid> GetVipWorkMaids(bool isDaytime)
  454. {
  455. List<Maid> list = new List<Maid>();
  456. for (int i = 0; i < 40; i++)
  457. {
  458. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  459. if (scheduleSlot != null)
  460. {
  461. int key;
  462. if (isDaytime)
  463. {
  464. key = scheduleSlot.status.noonWorkId;
  465. }
  466. else
  467. {
  468. key = scheduleSlot.status.nightWorkId;
  469. }
  470. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key];
  471. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi)
  472. {
  473. ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)scheduleBase;
  474. ScheduleCSVData.YotogiType yotogiType = yotogi.yotogiType;
  475. if (yotogiType == ScheduleCSVData.YotogiType.Vip || yotogiType == ScheduleCSVData.YotogiType.VipCall)
  476. {
  477. list.Add(scheduleSlot);
  478. }
  479. }
  480. }
  481. }
  482. return list;
  483. }
  484. public static List<Maid> GetYotogiMaids(bool isDaytime)
  485. {
  486. List<Maid> list = new List<Maid>();
  487. for (int i = 0; i < 40; i++)
  488. {
  489. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  490. if (scheduleSlot != null)
  491. {
  492. int num;
  493. if (isDaytime)
  494. {
  495. num = scheduleSlot.status.noonWorkId;
  496. }
  497. else
  498. {
  499. num = scheduleSlot.status.nightWorkId;
  500. }
  501. if (!ScheduleCSVData.AllData.ContainsKey(num))
  502. {
  503. Debug.LogError("ScheduleAPI:タスクID[" + num + "]のデータが見つかりませんでした");
  504. }
  505. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num];
  506. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi)
  507. {
  508. ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)scheduleBase;
  509. if (yotogi.yotogiType == ScheduleCSVData.YotogiType.HaveSex)
  510. {
  511. list.Add(scheduleSlot);
  512. }
  513. }
  514. }
  515. }
  516. return list;
  517. }
  518. public static List<Maid> GetNewYotogiMaids(bool isDaytime)
  519. {
  520. List<Maid> list = new List<Maid>();
  521. for (int i = 0; i < 40; i++)
  522. {
  523. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  524. if (scheduleSlot != null)
  525. {
  526. int num;
  527. if (isDaytime)
  528. {
  529. num = scheduleSlot.status.noonWorkId;
  530. }
  531. else
  532. {
  533. num = scheduleSlot.status.nightWorkId;
  534. }
  535. if (!ScheduleCSVData.AllData.ContainsKey(num))
  536. {
  537. Debug.LogError("ScheduleAPI:タスクID[" + num + "]のデータが見つかりませんでした");
  538. }
  539. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num];
  540. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi)
  541. {
  542. ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)scheduleBase;
  543. if (yotogi.yotogiType == ScheduleCSVData.YotogiType.NewSex)
  544. {
  545. if (yotogi.pairCondPersonal.Count <= 0 || ScheduleAPI.GetNewYotogiHaremPairCandidateList(yotogi, yotogi.pairCondPersonal, scheduleSlot).Count > 0)
  546. {
  547. list.Add(scheduleSlot);
  548. }
  549. }
  550. }
  551. }
  552. }
  553. return list;
  554. }
  555. public static List<Maid> GetNewYotogiHaremPairCandidateList(ScheduleCSVData.Yotogi workData, List<int> condPersonalIds, Maid excludeMaid = null)
  556. {
  557. List<Maid> list = new List<Maid>();
  558. if (condPersonalIds == null || condPersonalIds.Count <= 0)
  559. {
  560. return list;
  561. }
  562. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetStockMaidCount(); i++)
  563. {
  564. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
  565. if (stockMaid != null && stockMaid.status.heroineType != HeroineType.Sub)
  566. {
  567. if (!(excludeMaid != null) || !(excludeMaid.status.guid == stockMaid.status.guid))
  568. {
  569. if (workData.id == 10072 && workData.isCheckGP002Personal)
  570. {
  571. if ((stockMaid.status.seikeiken == Seikeiken.Yes_No || stockMaid.status.seikeiken == Seikeiken.Yes_Yes) && condPersonalIds.Contains(stockMaid.status.personal.id) && PluginData.IsEnabledForGP002Personal(stockMaid.status.personal.uniqueName))
  572. {
  573. list.Add(stockMaid);
  574. }
  575. }
  576. else if (stockMaid.status.seikeiken == Seikeiken.Yes_Yes && stockMaid.status.relation >= Relation.Lover && condPersonalIds.Contains(stockMaid.status.personal.id))
  577. {
  578. if (workData.isCheckGP002Personal)
  579. {
  580. if (PluginData.IsEnabledForGP002Personal(stockMaid.status.personal.uniqueName))
  581. {
  582. list.Add(stockMaid);
  583. }
  584. }
  585. else
  586. {
  587. list.Add(stockMaid);
  588. }
  589. }
  590. }
  591. }
  592. }
  593. return list;
  594. }
  595. public static void DecideSuccess(WorkResultSceneMode sceneMode, int index, bool commu)
  596. {
  597. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(index);
  598. ScheduleData scheduleData = GameMain.Instance.CharacterMgr.status.scheduleSlot[index];
  599. if (scheduleSlot != null)
  600. {
  601. ScheduleData.WorkSuccessLv workSuccessLv;
  602. if (commu)
  603. {
  604. workSuccessLv = ScheduleData.WorkSuccessLv.Success;
  605. }
  606. else if (scheduleSlot.status.features.ContainsKey(Feature.GetData("疲労").id))
  607. {
  608. workSuccessLv = ScheduleData.WorkSuccessLv.Miss;
  609. }
  610. else
  611. {
  612. int num = UnityEngine.Random.Range(1, 100);
  613. if (num <= ScheduleCSVData.workSuccessLvMissIncidence)
  614. {
  615. workSuccessLv = ScheduleData.WorkSuccessLv.Miss;
  616. }
  617. else if (num > 100 - ScheduleCSVData.workSuccessLvPerfectIncidence)
  618. {
  619. workSuccessLv = ScheduleData.WorkSuccessLv.Perfect;
  620. }
  621. else
  622. {
  623. workSuccessLv = ScheduleData.WorkSuccessLv.Success;
  624. }
  625. }
  626. int num2 = 0;
  627. if (sceneMode == WorkResultSceneMode.Noon)
  628. {
  629. num2 = scheduleSlot.status.noonWorkId;
  630. }
  631. else if (sceneMode == WorkResultSceneMode.Night)
  632. {
  633. num2 = scheduleSlot.status.nightWorkId;
  634. }
  635. if (num2 == ScheduleCSVData.faclilityPowerUpWorkId)
  636. {
  637. Facility facility;
  638. Facility.RecipeData recipeData;
  639. if (!GameMain.Instance.FacilityMgr.TryGetCacheFacilityPowerUpResult(scheduleSlot, out facility, out recipeData))
  640. {
  641. workSuccessLv = ScheduleData.WorkSuccessLv.Unexecuted;
  642. }
  643. else
  644. {
  645. workSuccessLv = ScheduleData.WorkSuccessLv.Success;
  646. }
  647. }
  648. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num2];
  649. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work && num2 != ScheduleCSVData.faclilityPowerUpWorkId)
  650. {
  651. ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  652. if (sceneMode == WorkResultSceneMode.Noon)
  653. {
  654. scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  655. }
  656. else if (sceneMode == WorkResultSceneMode.Night)
  657. {
  658. scheduleTime = ScheduleMgr.ScheduleTime.Night;
  659. }
  660. Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(scheduleSlot, scheduleTime);
  661. if (maidAssignedFacility == null || !maidAssignedFacility.IsOperation(scheduleTime))
  662. {
  663. workSuccessLv = ScheduleData.WorkSuccessLv.Unexecuted;
  664. }
  665. }
  666. if (sceneMode == WorkResultSceneMode.Noon)
  667. {
  668. scheduleData.noon_success_level = workSuccessLv;
  669. }
  670. else if (sceneMode == WorkResultSceneMode.Night)
  671. {
  672. scheduleData.night_success_level = workSuccessLv;
  673. }
  674. }
  675. }
  676. private static ScheduleAPI.TrainingResultSimulateParam TrainingResultSimulate(Maid maid, int workId, ScheduleData.WorkSuccessLv successLv = ScheduleData.WorkSuccessLv.Success, bool communicationBonus = false)
  677. {
  678. ScheduleAPI.TrainingResultSimulateParam trainingResultSimulateParam = new ScheduleAPI.TrainingResultSimulateParam();
  679. if (maid == null)
  680. {
  681. return trainingResultSimulateParam;
  682. }
  683. ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[workId];
  684. switch (training.trainingType)
  685. {
  686. case ScheduleCSVData.TrainingType.Basic:
  687. case ScheduleCSVData.TrainingType.Dispatch:
  688. {
  689. BonusStatus bonusStatusAsFeatureAndPropensitys = maid.status.GetBonusStatusAsFeatureAndPropensitys();
  690. int workLvRevision = ScheduleAPI.NoonWorkLvToRevision(ScheduleAPI.NoonWorkPlayToLv(ScheduleAPI.NoonWorkPlayCount(maid, workId)));
  691. double successRevision = 1.0;
  692. if (successLv == ScheduleData.WorkSuccessLv.Unexecuted)
  693. {
  694. successRevision = 0.0;
  695. }
  696. else if (communicationBonus)
  697. {
  698. successRevision = 0.3;
  699. }
  700. else if (successLv != ScheduleData.WorkSuccessLv.Miss)
  701. {
  702. if (successLv != ScheduleData.WorkSuccessLv.Success)
  703. {
  704. if (successLv == ScheduleData.WorkSuccessLv.Perfect)
  705. {
  706. successRevision = 1.5;
  707. }
  708. }
  709. else
  710. {
  711. successRevision = 1.0;
  712. }
  713. }
  714. else
  715. {
  716. successRevision = 0.5;
  717. }
  718. trainingResultSimulateParam.study_rate = training.study_rate;
  719. trainingResultSimulateParam.reception = ScheduleAPI.NoonWorkResultSimulate_basic(training.reception, bonusStatusAsFeatureAndPropensitys.reception, workLvRevision, successRevision);
  720. trainingResultSimulateParam.care = ScheduleAPI.NoonWorkResultSimulate_basic(training.care, bonusStatusAsFeatureAndPropensitys.care, workLvRevision, successRevision);
  721. trainingResultSimulateParam.lovely = ScheduleAPI.NoonWorkResultSimulate_basic(training.lovely, bonusStatusAsFeatureAndPropensitys.lovely, workLvRevision, successRevision);
  722. trainingResultSimulateParam.elegance = ScheduleAPI.NoonWorkResultSimulate_basic(training.elegance, bonusStatusAsFeatureAndPropensitys.elegance, workLvRevision, successRevision);
  723. trainingResultSimulateParam.charm = ScheduleAPI.NoonWorkResultSimulate_basic(training.charm, bonusStatusAsFeatureAndPropensitys.charm, workLvRevision, successRevision);
  724. trainingResultSimulateParam.teach_rate = ScheduleAPI.NoonWorkResultSimulate_basic(training.teach_rate, bonusStatusAsFeatureAndPropensitys.teachRate, workLvRevision, successRevision);
  725. trainingResultSimulateParam.cooking = ScheduleAPI.NoonWorkResultSimulate_basic(training.cooking, bonusStatusAsFeatureAndPropensitys.cooking, workLvRevision, successRevision);
  726. trainingResultSimulateParam.vocal = ScheduleAPI.NoonWorkResultSimulate_basic(training.vocal, bonusStatusAsFeatureAndPropensitys.vocal, workLvRevision, successRevision);
  727. trainingResultSimulateParam.dance = ScheduleAPI.NoonWorkResultSimulate_basic(training.dance, bonusStatusAsFeatureAndPropensitys.dance, workLvRevision, successRevision);
  728. trainingResultSimulateParam.appealPoint = ScheduleAPI.NoonWorkResultSimulate_basic(training.appealPoint, bonusStatusAsFeatureAndPropensitys.appealPoint, workLvRevision, successRevision);
  729. trainingResultSimulateParam.income = ScheduleAPI.NoonWorkResultSimulate_basic(training.income, 0, workLvRevision, successRevision);
  730. trainingResultSimulateParam.income = (int)((double)trainingResultSimulateParam.income * (System.Math.Ceiling((double)maid.status.care / (double)ScheduleCSVData.dispatchIncomCoefficient) / 100.0 + 1.0));
  731. trainingResultSimulateParam.exp = ScheduleAPI.NoonWorkResultSimulate_basic(training.exp, 0, workLvRevision, successRevision);
  732. if (communicationBonus)
  733. {
  734. trainingResultSimulateParam.study_rate = 0;
  735. }
  736. break;
  737. }
  738. case ScheduleCSVData.TrainingType.Trainee:
  739. {
  740. Maid stockMaidLeader = ScheduleAPI.GetStockMaidLeader();
  741. if (stockMaidLeader != null)
  742. {
  743. int noonTrainerWorkId = ScheduleAPI.GetNoonTrainerWorkId();
  744. int workLvRevision2 = ScheduleAPI.NoonWorkLvToRevision(ScheduleAPI.NoonWorkPlayToLv(ScheduleAPI.NoonWorkPlayCount(stockMaidLeader, noonTrainerWorkId)));
  745. int teachRevision = stockMaidLeader.status.teachRate / 50;
  746. MaidStatus.Status status = stockMaidLeader.status;
  747. trainingResultSimulateParam.study_rate = training.study_rate;
  748. trainingResultSimulateParam.reception = ScheduleAPI.NoonWorkResultSimulate_trainee(status.reception, workLvRevision2, teachRevision);
  749. trainingResultSimulateParam.care = ScheduleAPI.NoonWorkResultSimulate_trainee(status.care, workLvRevision2, teachRevision);
  750. trainingResultSimulateParam.lovely = ScheduleAPI.NoonWorkResultSimulate_trainee(status.lovely, workLvRevision2, teachRevision);
  751. trainingResultSimulateParam.elegance = ScheduleAPI.NoonWorkResultSimulate_trainee(status.elegance, workLvRevision2, teachRevision);
  752. trainingResultSimulateParam.charm = ScheduleAPI.NoonWorkResultSimulate_trainee(status.charm, workLvRevision2, teachRevision);
  753. trainingResultSimulateParam.inyoku = ScheduleAPI.NoonWorkResultSimulate_trainee(status.inyoku, workLvRevision2, teachRevision);
  754. trainingResultSimulateParam.mvalue = ScheduleAPI.NoonWorkResultSimulate_trainee(status.mvalue, workLvRevision2, teachRevision);
  755. trainingResultSimulateParam.hentai = ScheduleAPI.NoonWorkResultSimulate_trainee(status.hentai, workLvRevision2, teachRevision);
  756. trainingResultSimulateParam.housi = ScheduleAPI.NoonWorkResultSimulate_trainee(status.housi, workLvRevision2, teachRevision);
  757. }
  758. break;
  759. }
  760. }
  761. return trainingResultSimulateParam;
  762. }
  763. private static int NoonWorkResultSimulate_basic(int workParam, int maidRevision, int workLvRevision, double successRevision)
  764. {
  765. return (int)System.Math.Ceiling((double)workParam * (double)(100 + maidRevision + workLvRevision) / 100.0 * successRevision);
  766. }
  767. private static int NoonWorkResultSimulate_trainee(int trainerParam, int workLvRevision, int teachRevision)
  768. {
  769. return (int)System.Math.Ceiling((double)trainerParam / 25.0 * (double)(100 + workLvRevision + teachRevision) / 100.0);
  770. }
  771. public static Params OneDayParamDiff(int? slotId = null)
  772. {
  773. int num = 0;
  774. if (slotId == null)
  775. {
  776. for (int i = 0; i < 40; i++)
  777. {
  778. if (GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i) != null)
  779. {
  780. num = i;
  781. break;
  782. }
  783. }
  784. }
  785. else
  786. {
  787. num = ((slotId == null) ? 0 : slotId.Value);
  788. }
  789. if (GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num) != null)
  790. {
  791. return BackupParamAccessor.GetBackupParams(num, SCENE_ID.Start);
  792. }
  793. return null;
  794. }
  795. public static ScheduleAPI.YotogiResultSimulateParam YotogiResultSimulate(Maid maid, int workId)
  796. {
  797. ScheduleAPI.YotogiResultSimulateParam yotogiResultSimulateParam = new ScheduleAPI.YotogiResultSimulateParam();
  798. if (maid == null)
  799. {
  800. return yotogiResultSimulateParam;
  801. }
  802. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
  803. switch (yotogi.yotogiType)
  804. {
  805. case ScheduleCSVData.YotogiType.Entertain:
  806. {
  807. int num = 0;
  808. int num2 = 0;
  809. int clubGrade = GameMain.Instance.CharacterMgr.status.clubGrade;
  810. int num3 = ScheduleCSVData.EntertainNumberData[clubGrade];
  811. for (int i = 0; i < num3; i++)
  812. {
  813. int count = ScheduleCSVData.EntertainGuestData[clubGrade].Count;
  814. int index = UnityEngine.Random.Range(0, count);
  815. ScheduleCSVData.EntertainGuest entertainGuest = ScheduleCSVData.EntertainGuestData[clubGrade][index];
  816. double num4 = 0.0;
  817. if (!entertainGuest.sexual)
  818. {
  819. num4 += System.Math.Ceiling((double)maid.status.lovely / 500.0);
  820. num4 += System.Math.Ceiling((double)maid.status.elegance / 500.0);
  821. num4 += System.Math.Ceiling((double)maid.status.charm / 500.0);
  822. num4 += System.Math.Ceiling((double)maid.status.reception / 500.0);
  823. num4 += System.Math.Ceiling((double)maid.status.cooking / 500.0);
  824. num4 += System.Math.Ceiling((double)maid.status.vocal / 500.0);
  825. num4 += System.Math.Ceiling((double)maid.status.dance / 500.0);
  826. num4 += System.Math.Ceiling((double)maid.status.appealPoint / 500.0);
  827. }
  828. else
  829. {
  830. num4 += System.Math.Ceiling((double)maid.status.inyoku / 500.0);
  831. num4 += System.Math.Ceiling((double)maid.status.mvalue / 500.0);
  832. num4 += System.Math.Ceiling((double)maid.status.hentai / 500.0);
  833. num4 += System.Math.Ceiling((double)maid.status.housi / 500.0);
  834. }
  835. num4 /= 2.0;
  836. num4 = num4 / 100.0 + 1.0;
  837. double num5 = 0.0;
  838. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  839. for (int j = 0; j < maid.status.propensitys.Count; j++)
  840. {
  841. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  842. }
  843. if (maid.status.inyoku >= ScheduleCSVData.entertainParameterRevisionThreshold)
  844. {
  845. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  846. }
  847. if (maid.status.mvalue >= ScheduleCSVData.entertainParameterRevisionThreshold)
  848. {
  849. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  850. }
  851. if (maid.status.hentai >= ScheduleCSVData.entertainParameterRevisionThreshold)
  852. {
  853. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  854. }
  855. if (maid.status.housi >= ScheduleCSVData.entertainParameterRevisionThreshold)
  856. {
  857. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  858. }
  859. if (maid.status.lovely >= ScheduleCSVData.entertainParameterRevisionThreshold)
  860. {
  861. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  862. }
  863. if (maid.status.elegance >= ScheduleCSVData.entertainParameterRevisionThreshold)
  864. {
  865. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  866. }
  867. if (maid.status.charm >= ScheduleCSVData.entertainParameterRevisionThreshold)
  868. {
  869. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  870. }
  871. if (maid.status.reception >= ScheduleCSVData.entertainParameterRevisionThreshold)
  872. {
  873. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  874. }
  875. if (maid.status.cooking >= ScheduleCSVData.entertainParameterRevisionThreshold)
  876. {
  877. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  878. }
  879. if (maid.status.vocal >= ScheduleCSVData.entertainParameterRevisionThreshold)
  880. {
  881. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  882. }
  883. if (maid.status.dance >= ScheduleCSVData.entertainParameterRevisionThreshold)
  884. {
  885. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  886. }
  887. if (maid.status.appealPoint >= ScheduleCSVData.entertainParameterRevisionThreshold)
  888. {
  889. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  890. }
  891. num5 = num5 / 100.0 + 1.0;
  892. if (num5 < (double)(ScheduleCSVData.entertainPropensityRevisionMin / 100))
  893. {
  894. num5 = (double)(ScheduleCSVData.entertainPropensityRevisionMin / 100);
  895. }
  896. else if (num5 > (double)(ScheduleCSVData.entertainPropensityRevisionMax / 100))
  897. {
  898. num5 = (double)(ScheduleCSVData.entertainPropensityRevisionMax / 100);
  899. }
  900. yotogiResultSimulateParam.otherPlayNumber++;
  901. if (entertainGuest.sexual)
  902. {
  903. Contract contract = maid.status.contract;
  904. if (contract != Contract.Trainee && contract != Contract.Free)
  905. {
  906. if (contract == Contract.Exclusive)
  907. {
  908. num5 /= 2.0;
  909. }
  910. }
  911. else
  912. {
  913. yotogiResultSimulateParam.playNumber++;
  914. }
  915. }
  916. int num6 = (int)((double)entertainGuest.baseIcome * num4 * num5);
  917. int num7 = (int)((double)entertainGuest.baseEvaluation * num4 * num5);
  918. num6 = (int)System.Math.Ceiling((double)num6 / 1000.0) * 1000;
  919. num += num6;
  920. num2 += num7;
  921. }
  922. yotogiResultSimulateParam.income = num;
  923. yotogiResultSimulateParam.evaluation = num2;
  924. break;
  925. }
  926. case ScheduleCSVData.YotogiType.HaveSex:
  927. case ScheduleCSVData.YotogiType.NewSex:
  928. if (maid.status.GetFlag("_YotogiPlayed") > 0)
  929. {
  930. }
  931. break;
  932. case ScheduleCSVData.YotogiType.Vip:
  933. case ScheduleCSVData.YotogiType.VipCall:
  934. {
  935. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId);
  936. if (nightWorksState != null && !nightWorksState.finish)
  937. {
  938. yotogiResultSimulateParam.income = yotogi.income;
  939. yotogiResultSimulateParam.evaluation = yotogi.evaluation;
  940. }
  941. if (yotogi != null)
  942. {
  943. yotogiResultSimulateParam.playNumber += yotogi.add_play_number;
  944. yotogiResultSimulateParam.otherPlayNumber += yotogi.add_other_play_number;
  945. }
  946. break;
  947. }
  948. case ScheduleCSVData.YotogiType.EasyYotogi:
  949. {
  950. ScheduleCSVData.Yotogi.EasyYotogi easyYotogi = yotogi.easyYotogi;
  951. if (easyYotogi != null)
  952. {
  953. yotogiResultSimulateParam.study_rate = easyYotogi.study_rate;
  954. yotogiResultSimulateParam.care = easyYotogi.care;
  955. yotogiResultSimulateParam.reception = easyYotogi.reception;
  956. yotogiResultSimulateParam.teach_rate = easyYotogi.teach_rate;
  957. yotogiResultSimulateParam.study_rate = easyYotogi.study_rate;
  958. yotogiResultSimulateParam.inyoku = easyYotogi.inyoku;
  959. yotogiResultSimulateParam.hentai = easyYotogi.hentai;
  960. yotogiResultSimulateParam.mvalue = easyYotogi.msei;
  961. yotogiResultSimulateParam.housi = easyYotogi.housi;
  962. }
  963. break;
  964. }
  965. }
  966. return yotogiResultSimulateParam;
  967. }
  968. public static void AddYotogiWorkResultParam(ScheduleCSVData.Yotogi scheduleData, Maid maid, ScheduleAPI.YotogiResultSimulateParam param)
  969. {
  970. maid.status.studyRate += param.study_rate;
  971. maid.status.evaluation += param.evaluation;
  972. maid.status.totalEvaluations += (long)param.evaluation;
  973. maid.status.sales += (long)param.income;
  974. maid.status.totalSales += (long)param.income;
  975. GameMain.Instance.CharacterMgr.status.baseClubEvaluation += param.evaluation;
  976. GameMain.Instance.CharacterMgr.status.money += (long)param.income;
  977. maid.status.playCountNightWork += param.otherPlayNumber;
  978. maid.status.sexPlayNumberOfPeople += param.playNumber;
  979. maid.status.baseCare += param.care;
  980. maid.status.baseReception += param.reception;
  981. maid.status.baseTeachRate += param.teach_rate;
  982. maid.status.baseInyoku += param.inyoku;
  983. maid.status.baseHentai += param.hentai;
  984. maid.status.baseMvalue += param.mvalue;
  985. maid.status.baseHousi += param.housi;
  986. }
  987. public static bool EnableNoonWork(int workId, Maid maid = null)
  988. {
  989. if (!ScheduleCSVData.TrainingData.ContainsKey(workId))
  990. {
  991. return false;
  992. }
  993. ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[workId];
  994. if (training.condPackage.Count > 0)
  995. {
  996. for (int i = 0; i < training.condPackage.Count; i++)
  997. {
  998. if (!PluginData.IsEnabled(training.condPackage[i]))
  999. {
  1000. return false;
  1001. }
  1002. }
  1003. }
  1004. if (maid != null)
  1005. {
  1006. if (training.trainingType == ScheduleCSVData.TrainingType.Trainer)
  1007. {
  1008. if (maid != ScheduleAPI.GetStockMaidLeader())
  1009. {
  1010. return false;
  1011. }
  1012. if (maid.status.contract == Contract.Trainee)
  1013. {
  1014. return false;
  1015. }
  1016. }
  1017. if (training.trainingType == ScheduleCSVData.TrainingType.Trainee)
  1018. {
  1019. if (maid == ScheduleAPI.GetStockMaidLeader())
  1020. {
  1021. return false;
  1022. }
  1023. if (maid.status.studyRate < -training.study_rate)
  1024. {
  1025. return false;
  1026. }
  1027. bool flag = false;
  1028. for (int j = 0; j < 40; j++)
  1029. {
  1030. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
  1031. if (scheduleSlot != null && ScheduleAPI.EnableNoonWork(ScheduleAPI.GetNoonTrainerWorkId(), scheduleSlot))
  1032. {
  1033. flag = true;
  1034. break;
  1035. }
  1036. }
  1037. if (!flag)
  1038. {
  1039. return false;
  1040. }
  1041. }
  1042. if (training.condContract.Count > 0)
  1043. {
  1044. bool flag2 = false;
  1045. for (int k = 0; k < training.condContract.Count; k++)
  1046. {
  1047. if (training.condContract[k] == maid.status.contract)
  1048. {
  1049. flag2 = true;
  1050. break;
  1051. }
  1052. }
  1053. if (!flag2)
  1054. {
  1055. return false;
  1056. }
  1057. }
  1058. if (training.condMaidClass.Count > 0)
  1059. {
  1060. for (int l = 0; l < training.condMaidClass.Count; l++)
  1061. {
  1062. if (!maid.status.jobClass.Contains(training.condMaidClass[l]))
  1063. {
  1064. return false;
  1065. }
  1066. }
  1067. }
  1068. }
  1069. return true;
  1070. }
  1071. public static bool VisibleNightWork(int workId, Maid maid = null, bool checkFinish = true)
  1072. {
  1073. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
  1074. switch (yotogi.yotogiType)
  1075. {
  1076. case ScheduleCSVData.YotogiType.Vip:
  1077. case ScheduleCSVData.YotogiType.VipCall:
  1078. {
  1079. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId);
  1080. if (nightWorksState == null)
  1081. {
  1082. return false;
  1083. }
  1084. if (checkFinish && nightWorksState.finish)
  1085. {
  1086. if (DailyMgr.IsLegacy)
  1087. {
  1088. return false;
  1089. }
  1090. if (GameMain.Instance.CharacterMgr.status.clubGrade < 5)
  1091. {
  1092. return false;
  1093. }
  1094. if (GameMain.Instance.CharacterMgr.status.days < ScheduleCSVData.vipFullOpenDay)
  1095. {
  1096. return false;
  1097. }
  1098. }
  1099. break;
  1100. }
  1101. case ScheduleCSVData.YotogiType.Travel:
  1102. return false;
  1103. case ScheduleCSVData.YotogiType.EasyYotogi:
  1104. {
  1105. if (yotogi.easyYotogi == null)
  1106. {
  1107. return false;
  1108. }
  1109. int trophyId = yotogi.easyYotogi.trophyId;
  1110. if (!GameMain.Instance.CharacterMgr.status.IsHaveTrophy(trophyId))
  1111. {
  1112. return false;
  1113. }
  1114. break;
  1115. }
  1116. }
  1117. if (yotogi.condPackage.Count > 0)
  1118. {
  1119. for (int i = 0; i < ScheduleCSVData.YotogiData[workId].condPackage.Count; i++)
  1120. {
  1121. if (!PluginData.IsEnabled(ScheduleCSVData.YotogiData[workId].condPackage[i]))
  1122. {
  1123. return false;
  1124. }
  1125. }
  1126. }
  1127. if (yotogi.condManVisibleFlag1.Count > 0)
  1128. {
  1129. for (int j = 0; j < yotogi.condManVisibleFlag1.Count; j++)
  1130. {
  1131. if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManVisibleFlag1[j]) < 1)
  1132. {
  1133. return false;
  1134. }
  1135. }
  1136. }
  1137. if (maid != null)
  1138. {
  1139. if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara)
  1140. {
  1141. return false;
  1142. }
  1143. if (yotogi.condPersonal.Count > 0)
  1144. {
  1145. bool flag = false;
  1146. for (int k = 0; k < yotogi.condPersonal.Count; k++)
  1147. {
  1148. if (maid.status.personal.id == yotogi.condPersonal[k])
  1149. {
  1150. flag = true;
  1151. break;
  1152. }
  1153. }
  1154. if (!flag)
  1155. {
  1156. return false;
  1157. }
  1158. }
  1159. if (yotogi.subMaidUnipueName != string.Empty)
  1160. {
  1161. if (maid.status.heroineType != HeroineType.Sub)
  1162. {
  1163. return false;
  1164. }
  1165. if (yotogi.subMaidUnipueName != maid.status.subCharaData.uniqueName)
  1166. {
  1167. return false;
  1168. }
  1169. }
  1170. else if (maid.status.heroineType == HeroineType.Sub)
  1171. {
  1172. return false;
  1173. }
  1174. }
  1175. return true;
  1176. }
  1177. public static bool EnableNightWork(int workId, Maid maid = null, bool calledTargetCheck = true, bool withMaid = true)
  1178. {
  1179. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
  1180. if (yotogi.condPackage.Count > 0)
  1181. {
  1182. for (int i = 0; i < yotogi.condPackage.Count; i++)
  1183. {
  1184. if (!PluginData.IsEnabled(yotogi.condPackage[i]))
  1185. {
  1186. return false;
  1187. }
  1188. }
  1189. }
  1190. if (yotogi.condSalonGrade > GameMain.Instance.CharacterMgr.status.clubGrade)
  1191. {
  1192. return false;
  1193. }
  1194. if (yotogi.easyYotogi != null)
  1195. {
  1196. int trophyId = yotogi.easyYotogi.trophyId;
  1197. if (!GameMain.Instance.CharacterMgr.status.IsHaveTrophy(trophyId))
  1198. {
  1199. return false;
  1200. }
  1201. }
  1202. if (!DailyMgr.IsLegacy && yotogi.mode == ScheduleCSVData.ScheduleBase.Mode.CM3D2)
  1203. {
  1204. return false;
  1205. }
  1206. if (DailyMgr.IsLegacy && yotogi.mode == ScheduleCSVData.ScheduleBase.Mode.COM3D)
  1207. {
  1208. return false;
  1209. }
  1210. if (maid != null)
  1211. {
  1212. if (yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall && calledTargetCheck && !ScheduleAPI.VipCalledMaid(workId, maid))
  1213. {
  1214. return false;
  1215. }
  1216. foreach (KeyValuePair<int, int> keyValuePair in yotogi.condSkill)
  1217. {
  1218. if (!maid.status.yotogiSkill.Contains(keyValuePair.Key))
  1219. {
  1220. return false;
  1221. }
  1222. YotogiSkillData yotogiSkillData = maid.status.yotogiSkill.Get(keyValuePair.Key);
  1223. if (keyValuePair.Value > yotogiSkillData.level)
  1224. {
  1225. return false;
  1226. }
  1227. }
  1228. if (yotogi.condMaidClass.Count > 0)
  1229. {
  1230. for (int j = 0; j < yotogi.condMaidClass.Count; j++)
  1231. {
  1232. if (!maid.status.jobClass.Contains(yotogi.condMaidClass[j]))
  1233. {
  1234. return false;
  1235. }
  1236. }
  1237. }
  1238. if (yotogi.condYotogiClass.Count > 0)
  1239. {
  1240. for (int k = 0; k < yotogi.condYotogiClass.Count; k++)
  1241. {
  1242. if (!maid.status.yotogiClass.Contains(yotogi.condYotogiClass[k]))
  1243. {
  1244. return false;
  1245. }
  1246. }
  1247. }
  1248. if (yotogi.condPropensity.Count > 0)
  1249. {
  1250. bool flag = false;
  1251. for (int l = 0; l < yotogi.condPropensity.Count; l++)
  1252. {
  1253. if (maid.status.propensitys.ContainsKey(yotogi.condPropensity[l]))
  1254. {
  1255. flag = true;
  1256. break;
  1257. }
  1258. }
  1259. if (!flag)
  1260. {
  1261. return false;
  1262. }
  1263. }
  1264. if (yotogi.condSeikeiken.Count > 0)
  1265. {
  1266. bool flag2 = false;
  1267. for (int m = 0; m < yotogi.condSeikeiken.Count; m++)
  1268. {
  1269. if (yotogi.condSeikeiken[m] == maid.status.seikeiken)
  1270. {
  1271. flag2 = true;
  1272. break;
  1273. }
  1274. }
  1275. if (!flag2)
  1276. {
  1277. return false;
  1278. }
  1279. }
  1280. if (yotogi.condFlag1.Count > 0)
  1281. {
  1282. for (int n = 0; n < yotogi.condFlag1.Count; n++)
  1283. {
  1284. if (ScheduleAPI.GetMaidFlag(maid, yotogi.condFlag1[n]) < 1)
  1285. {
  1286. return false;
  1287. }
  1288. }
  1289. }
  1290. if (yotogi.condFlag0.Count > 0)
  1291. {
  1292. for (int num = 0; num < yotogi.condFlag0.Count; num++)
  1293. {
  1294. if (ScheduleAPI.GetMaidFlag(maid, yotogi.condFlag0[num]) > 0)
  1295. {
  1296. return false;
  1297. }
  1298. }
  1299. }
  1300. if (DailyMgr.IsLegacy)
  1301. {
  1302. if (yotogi.condRelationOld.Count > 0)
  1303. {
  1304. bool flag3 = false;
  1305. for (int num2 = 0; num2 < yotogi.condRelationOld.Count; num2++)
  1306. {
  1307. if (yotogi.condRelationOld[num2] == maid.status.OldStatus.relation)
  1308. {
  1309. flag3 = true;
  1310. break;
  1311. }
  1312. }
  1313. if (!flag3)
  1314. {
  1315. return false;
  1316. }
  1317. }
  1318. }
  1319. else
  1320. {
  1321. if (yotogi.condRelation.Count > 0)
  1322. {
  1323. bool flag4 = false;
  1324. for (int num3 = 0; num3 < yotogi.condRelation.Count; num3++)
  1325. {
  1326. if (yotogi.condRelation[num3] == maid.status.relation)
  1327. {
  1328. flag4 = true;
  1329. break;
  1330. }
  1331. }
  1332. if (!flag4)
  1333. {
  1334. return false;
  1335. }
  1336. }
  1337. if (yotogi.condSpecialRelation.Count > 0)
  1338. {
  1339. bool flag5 = false;
  1340. for (int num4 = 0; num4 < yotogi.condSpecialRelation.Count; num4++)
  1341. {
  1342. if (yotogi.condSpecialRelation[num4] == maid.status.specialRelation)
  1343. {
  1344. flag5 = true;
  1345. break;
  1346. }
  1347. }
  1348. if (!flag5)
  1349. {
  1350. return false;
  1351. }
  1352. }
  1353. }
  1354. if (yotogi.condManFlag1.Count > 0)
  1355. {
  1356. for (int num5 = 0; num5 < yotogi.condManFlag1.Count; num5++)
  1357. {
  1358. if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag1[num5]) < 1)
  1359. {
  1360. return false;
  1361. }
  1362. }
  1363. }
  1364. if (yotogi.condManFlag0.Count > 0)
  1365. {
  1366. for (int num6 = 0; num6 < yotogi.condManFlag0.Count; num6++)
  1367. {
  1368. if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag0[num6]) > 0)
  1369. {
  1370. return false;
  1371. }
  1372. }
  1373. }
  1374. if (yotogi.condContract.Count > 0)
  1375. {
  1376. bool flag6 = false;
  1377. for (int num7 = 0; num7 < yotogi.condContract.Count; num7++)
  1378. {
  1379. if (yotogi.condContract[num7] == maid.status.contract)
  1380. {
  1381. flag6 = true;
  1382. break;
  1383. }
  1384. }
  1385. if (!flag6)
  1386. {
  1387. return false;
  1388. }
  1389. }
  1390. if (yotogi.condFacilityID.Count > 0)
  1391. {
  1392. foreach (List<int> list in yotogi.condFacilityID)
  1393. {
  1394. bool flag7 = false;
  1395. foreach (int num8 in list)
  1396. {
  1397. Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
  1398. foreach (Facility facility in facilityArray)
  1399. {
  1400. ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  1401. if (withMaid)
  1402. {
  1403. if (yotogi.id == maid.status.noonWorkId)
  1404. {
  1405. scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  1406. }
  1407. else if (yotogi.id == maid.status.nightWorkId)
  1408. {
  1409. scheduleTime = ScheduleMgr.ScheduleTime.Night;
  1410. }
  1411. }
  1412. else
  1413. {
  1414. scheduleTime = ScheduleTaskViewer.ScheduleTime;
  1415. }
  1416. if (!(facility == null) && facility.defaultData.ID == num8)
  1417. {
  1418. if (facility.IsOperation(scheduleTime))
  1419. {
  1420. flag7 = true;
  1421. Maid[] allocationMaidArray = facility.GetAllocationMaidArray(scheduleTime);
  1422. if (allocationMaidArray != null && allocationMaidArray.Length == facility.minMaidCount)
  1423. {
  1424. foreach (Maid y in allocationMaidArray)
  1425. {
  1426. if (maid == y)
  1427. {
  1428. flag7 = false;
  1429. break;
  1430. }
  1431. }
  1432. }
  1433. if (flag7)
  1434. {
  1435. break;
  1436. }
  1437. }
  1438. }
  1439. }
  1440. if (flag7)
  1441. {
  1442. break;
  1443. }
  1444. }
  1445. if (!flag7)
  1446. {
  1447. ScheduleAPI.log("対象の施設が稼動していない");
  1448. return false;
  1449. }
  1450. }
  1451. }
  1452. if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara)
  1453. {
  1454. return false;
  1455. }
  1456. if (yotogi.condPersonal.Count > 0)
  1457. {
  1458. bool flag8 = false;
  1459. for (int num11 = 0; num11 < yotogi.condPersonal.Count; num11++)
  1460. {
  1461. if (maid.status.personal.id == yotogi.condPersonal[num11])
  1462. {
  1463. flag8 = (!yotogi.isCheckGP002Personal || PluginData.IsEnabledForGP002Personal(maid.status.personal.uniqueName));
  1464. break;
  1465. }
  1466. }
  1467. if (!flag8)
  1468. {
  1469. return false;
  1470. }
  1471. }
  1472. if (yotogi.pairCondPersonal.Count > 0 && ScheduleAPI.GetNewYotogiHaremPairCandidateList(yotogi, yotogi.pairCondPersonal, maid).Count <= 0)
  1473. {
  1474. return false;
  1475. }
  1476. if (yotogi.subMaidUnipueName != string.Empty)
  1477. {
  1478. if (maid.status.heroineType != HeroineType.Sub)
  1479. {
  1480. return false;
  1481. }
  1482. if (yotogi.subMaidUnipueName != maid.status.subCharaData.uniqueName)
  1483. {
  1484. return false;
  1485. }
  1486. return true;
  1487. }
  1488. else
  1489. {
  1490. if (maid.status.heroineType == HeroineType.Sub)
  1491. {
  1492. return false;
  1493. }
  1494. return true;
  1495. }
  1496. bool result;
  1497. return result;
  1498. }
  1499. return true;
  1500. }
  1501. private static int GetMaidFlag(Maid maid, string flagName)
  1502. {
  1503. if (DailyMgr.IsLegacy && maid.status.OldStatus.GetFlag(flagName) != 0)
  1504. {
  1505. return maid.status.OldStatus.GetFlag(flagName);
  1506. }
  1507. return maid.status.GetFlag(flagName);
  1508. }
  1509. public static void NightWorksStateErrorCheck(bool care = true)
  1510. {
  1511. foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
  1512. {
  1513. int key = keyValuePair.Key;
  1514. ScheduleCSVData.Yotogi value = keyValuePair.Value;
  1515. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(key);
  1516. if (nightWorksState != null)
  1517. {
  1518. if (!nightWorksState.finish)
  1519. {
  1520. bool flag = false;
  1521. if (value.yotogiType == ScheduleCSVData.YotogiType.VipCall)
  1522. {
  1523. string calledMaidGUID = nightWorksState.calledMaidGUID;
  1524. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(calledMaidGUID);
  1525. if (stockMaid == null)
  1526. {
  1527. flag = true;
  1528. }
  1529. else if (!ScheduleAPI.EnableNightWork(key, stockMaid, false, true))
  1530. {
  1531. flag = true;
  1532. }
  1533. }
  1534. if (flag)
  1535. {
  1536. GameMain.Instance.CharacterMgr.status.RemoveNightWorksState(key);
  1537. }
  1538. }
  1539. }
  1540. }
  1541. if (care)
  1542. {
  1543. ScheduleAPI.MaidWorkIdErrorCheck(care);
  1544. }
  1545. }
  1546. public static void SlotEmptyCheck()
  1547. {
  1548. bool flag = false;
  1549. for (int i = 0; i < 40; i++)
  1550. {
  1551. Maid maid = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1552. if (maid != null)
  1553. {
  1554. flag = true;
  1555. break;
  1556. }
  1557. }
  1558. if (!flag)
  1559. {
  1560. if (DailyMgr.IsLegacy)
  1561. {
  1562. for (int j = 0; j < GameMain.Instance.CharacterMgr.GetStockMaidCount(); j++)
  1563. {
  1564. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(j);
  1565. if (stockMaid != null && stockMaid.status.isCompatiblePersonality)
  1566. {
  1567. GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = stockMaid.status.guid;
  1568. break;
  1569. }
  1570. }
  1571. }
  1572. else
  1573. {
  1574. Maid maid = ScheduleAPI.GetStockMaidLeader();
  1575. if (maid != null)
  1576. {
  1577. GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = maid.status.guid;
  1578. }
  1579. else
  1580. {
  1581. for (int k = 0; k < GameMain.Instance.CharacterMgr.GetStockMaidCount(); k++)
  1582. {
  1583. Maid stockMaid2 = GameMain.Instance.CharacterMgr.GetStockMaid(k);
  1584. if (stockMaid2 != null)
  1585. {
  1586. GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = stockMaid2.status.guid;
  1587. break;
  1588. }
  1589. }
  1590. }
  1591. }
  1592. }
  1593. }
  1594. public static void MaidWorkIdErrorCheck(bool care = true)
  1595. {
  1596. ScheduleAPI.SlotEmptyCheck();
  1597. Maid noonTrainerMaid = ScheduleAPI.GetNoonTrainerMaid();
  1598. Maid nightTrainerMaid = ScheduleAPI.GetNightTrainerMaid();
  1599. Maid noonTraineeMaid = ScheduleAPI.GetNoonTraineeMaid();
  1600. Maid nightTraineeMaid = ScheduleAPI.GetNightTraineeMaid();
  1601. if ((noonTrainerMaid != nightTrainerMaid || noonTraineeMaid != nightTraineeMaid || noonTrainerMaid == null || nightTrainerMaid == null || !ScheduleAPI.CanTrainee(noonTraineeMaid) || !ScheduleAPI.CanTrainee(nightTraineeMaid)) && (noonTrainerMaid != null || nightTrainerMaid != null || noonTraineeMaid != null || nightTraineeMaid != null))
  1602. {
  1603. Debug.Log("MaidWorkIdErrorCheck:メイド研修の条件一致箇所があったためメイド研修をスロットから破棄します。");
  1604. if (noonTrainerMaid != null)
  1605. {
  1606. ScheduleAPI.WorkIdReset(noonTrainerMaid.status, ScheduleMgr.ScheduleTime.DayTime);
  1607. }
  1608. if (nightTrainerMaid != null)
  1609. {
  1610. ScheduleAPI.WorkIdReset(nightTrainerMaid.status, ScheduleMgr.ScheduleTime.Night);
  1611. }
  1612. if (noonTraineeMaid != null)
  1613. {
  1614. ScheduleAPI.WorkIdReset(noonTraineeMaid.status, ScheduleMgr.ScheduleTime.DayTime);
  1615. }
  1616. if (nightTraineeMaid != null)
  1617. {
  1618. ScheduleAPI.WorkIdReset(nightTraineeMaid.status, ScheduleMgr.ScheduleTime.Night);
  1619. }
  1620. }
  1621. int travelWorkId = ScheduleAPI.GetTravelWorkId();
  1622. int nightTravelWorkId = ScheduleAPI.GetNightTravelWorkId();
  1623. Maid maid = null;
  1624. for (int i = 0; i < 40; i++)
  1625. {
  1626. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1627. if (scheduleSlot != null && (scheduleSlot.status.noonWorkId == travelWorkId || scheduleSlot.status.nightWorkId == nightTravelWorkId))
  1628. {
  1629. if (maid == null && scheduleSlot.status.noonWorkId == travelWorkId && scheduleSlot.status.nightWorkId == nightTravelWorkId)
  1630. {
  1631. maid = scheduleSlot;
  1632. }
  1633. else
  1634. {
  1635. if (scheduleSlot.status.noonWorkId == travelWorkId)
  1636. {
  1637. ScheduleAPI.WorkIdReset(scheduleSlot.status, ScheduleMgr.ScheduleTime.DayTime);
  1638. }
  1639. if (scheduleSlot.status.nightWorkId == nightTravelWorkId)
  1640. {
  1641. ScheduleAPI.WorkIdReset(scheduleSlot.status, ScheduleMgr.ScheduleTime.Night);
  1642. }
  1643. }
  1644. }
  1645. }
  1646. if (maid != null)
  1647. {
  1648. for (int j = 0; j < 40; j++)
  1649. {
  1650. Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
  1651. if (scheduleSlot2 != null && scheduleSlot2 != maid && scheduleSlot2.status.nightWorkId != 0 && !ScheduleAPI.CheckNoProblemTravel(scheduleSlot2.status.nightWorkId))
  1652. {
  1653. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1654. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
  1655. break;
  1656. }
  1657. }
  1658. }
  1659. for (int k = 0; k < 40; k++)
  1660. {
  1661. Maid scheduleSlot3 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k);
  1662. if (scheduleSlot3 != null)
  1663. {
  1664. ScheduleAPI.MaidWorkIdErrorCheck(scheduleSlot3, care);
  1665. }
  1666. }
  1667. if (maid != null && maid.status.noonWorkId == travelWorkId && maid.status.nightWorkId == nightTravelWorkId)
  1668. {
  1669. int nightEntertainWorkId = ScheduleAPI.GetNightEntertainWorkId();
  1670. int nightRestWorkId = ScheduleAPI.GetNightRestWorkId();
  1671. for (int l = 0; l < 40; l++)
  1672. {
  1673. Maid scheduleSlot4 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(l);
  1674. if (scheduleSlot4 != null && scheduleSlot4 != maid && ScheduleCSVData.YotogiData.ContainsKey(scheduleSlot4.status.nightWorkId) && !ScheduleAPI.CheckNoProblemTravel(scheduleSlot4.status.nightWorkId))
  1675. {
  1676. if (scheduleSlot4.status.contract == Contract.Free)
  1677. {
  1678. scheduleSlot4.status.nightWorkId = nightRestWorkId;
  1679. }
  1680. else
  1681. {
  1682. scheduleSlot4.status.nightWorkId = nightEntertainWorkId;
  1683. }
  1684. }
  1685. }
  1686. }
  1687. }
  1688. private static void MaidWorkIdErrorCheck(Maid maid, bool care = true)
  1689. {
  1690. ScheduleAPI.SlotEmptyCheck();
  1691. ScheduleAPI.CheckTask(maid, ScheduleMgr.ScheduleTime.DayTime, care);
  1692. ScheduleAPI.CheckTask(maid, ScheduleMgr.ScheduleTime.Night, care);
  1693. if (care)
  1694. {
  1695. ScheduleAPI.EmptyToRandomWork(maid);
  1696. }
  1697. }
  1698. private static void CheckTask(Maid maid, ScheduleMgr.ScheduleTime time, bool care)
  1699. {
  1700. int num = 0;
  1701. if (time == ScheduleMgr.ScheduleTime.DayTime)
  1702. {
  1703. num = maid.status.noonWorkId;
  1704. }
  1705. else if (time == ScheduleMgr.ScheduleTime.Night)
  1706. {
  1707. num = maid.status.nightWorkId;
  1708. }
  1709. if (!ScheduleCSVData.AllData.ContainsKey(num))
  1710. {
  1711. return;
  1712. }
  1713. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num];
  1714. if ((DailyMgr.IsLegacy && scheduleBase.mode == ScheduleCSVData.ScheduleBase.Mode.COM3D) || (!DailyMgr.IsLegacy && scheduleBase.mode == ScheduleCSVData.ScheduleBase.Mode.CM3D2))
  1715. {
  1716. ScheduleAPI.WorkIdReset(maid.status, time);
  1717. return;
  1718. }
  1719. if (DailyMgr.IsLegacy && ((time == ScheduleMgr.ScheduleTime.DayTime && scheduleBase.type != ScheduleTaskCtrl.TaskType.Training) || (time == ScheduleMgr.ScheduleTime.Night && scheduleBase.type != ScheduleTaskCtrl.TaskType.Yotogi)))
  1720. {
  1721. ScheduleAPI.WorkIdReset(maid.status, time);
  1722. }
  1723. ScheduleTaskCtrl.TaskType type = scheduleBase.type;
  1724. if (type != ScheduleTaskCtrl.TaskType.Training)
  1725. {
  1726. if (type != ScheduleTaskCtrl.TaskType.Yotogi)
  1727. {
  1728. if (type == ScheduleTaskCtrl.TaskType.Work)
  1729. {
  1730. ScheduleAPI.CheckWork(maid, num, care, time);
  1731. }
  1732. }
  1733. else
  1734. {
  1735. ScheduleAPI.CheckYotogi(maid, num, time);
  1736. }
  1737. }
  1738. else
  1739. {
  1740. ScheduleAPI.CheckTraining(maid, num, care, time);
  1741. }
  1742. }
  1743. private static void CheckWork(Maid maid, int taskId, bool care, ScheduleMgr.ScheduleTime time)
  1744. {
  1745. if (ScheduleCSVData.WorkData.ContainsKey(taskId))
  1746. {
  1747. ScheduleCSVData.Work work = ScheduleCSVData.WorkData[taskId];
  1748. if (taskId != ScheduleCSVData.faclilityPowerUpWorkId)
  1749. {
  1750. Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(maid, time);
  1751. if (maidAssignedFacility == null || maidAssignedFacility.defaultData.workData.id != taskId)
  1752. {
  1753. ScheduleAPI.WorkIdReset(maid.status, time);
  1754. }
  1755. }
  1756. }
  1757. }
  1758. private static void CheckTraining(Maid maid, int taskId, bool care, ScheduleMgr.ScheduleTime time)
  1759. {
  1760. if (ScheduleCSVData.TrainingData.ContainsKey(taskId))
  1761. {
  1762. bool flag = false;
  1763. ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[taskId];
  1764. ScheduleCSVData.TrainingType trainingType = training.trainingType;
  1765. if (trainingType != ScheduleCSVData.TrainingType.Trainer)
  1766. {
  1767. if (trainingType != ScheduleCSVData.TrainingType.Trainee)
  1768. {
  1769. if (trainingType == ScheduleCSVData.TrainingType.Travel)
  1770. {
  1771. if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
  1772. {
  1773. flag = true;
  1774. }
  1775. if (!flag && ScheduleCSVData.YotogiData[maid.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Travel)
  1776. {
  1777. flag = true;
  1778. }
  1779. if (!flag)
  1780. {
  1781. int num = 0;
  1782. while (num < 40 && !flag)
  1783. {
  1784. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num);
  1785. if (!(scheduleSlot == maid))
  1786. {
  1787. 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)
  1788. {
  1789. flag = true;
  1790. }
  1791. }
  1792. num++;
  1793. }
  1794. }
  1795. if (flag)
  1796. {
  1797. ScheduleAPI.EmptyToRandomWork(maid);
  1798. }
  1799. }
  1800. }
  1801. else
  1802. {
  1803. if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
  1804. {
  1805. flag = true;
  1806. }
  1807. if (!flag && maid.status.noonWorkId != maid.status.nightWorkId)
  1808. {
  1809. flag = true;
  1810. }
  1811. if (flag)
  1812. {
  1813. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1814. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
  1815. for (int i = 0; i < 40; i++)
  1816. {
  1817. Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1818. if (scheduleSlot2 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot2.status.noonWorkId) && ScheduleCSVData.TrainingData[scheduleSlot2.status.noonWorkId].trainingType == ScheduleCSVData.TrainingType.Trainer)
  1819. {
  1820. ScheduleAPI.WorkIdReset(scheduleSlot2.status, ScheduleMgr.ScheduleTime.DayTime);
  1821. ScheduleAPI.WorkIdReset(scheduleSlot2.status, ScheduleMgr.ScheduleTime.Night);
  1822. if (care)
  1823. {
  1824. ScheduleAPI.EmptyToRandomWork(scheduleSlot2);
  1825. }
  1826. break;
  1827. }
  1828. }
  1829. }
  1830. }
  1831. }
  1832. else
  1833. {
  1834. if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
  1835. {
  1836. flag = true;
  1837. }
  1838. if (!flag && maid.status.noonWorkId != maid.status.nightWorkId)
  1839. {
  1840. flag = true;
  1841. }
  1842. bool flag2 = false;
  1843. for (int j = 0; j < 40; j++)
  1844. {
  1845. Maid scheduleSlot3 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
  1846. if (scheduleSlot3 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot3.status.noonWorkId))
  1847. {
  1848. ScheduleCSVData.Training training2 = ScheduleCSVData.TrainingData[scheduleSlot3.status.noonWorkId];
  1849. if (training2.trainingType == ScheduleCSVData.TrainingType.Trainee && scheduleSlot3.status.noonWorkId == scheduleSlot3.status.nightWorkId)
  1850. {
  1851. flag2 = true;
  1852. break;
  1853. }
  1854. }
  1855. }
  1856. if (!flag2)
  1857. {
  1858. flag = true;
  1859. }
  1860. if (flag)
  1861. {
  1862. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1863. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
  1864. if (care)
  1865. {
  1866. ScheduleAPI.EmptyToRandomWork(maid);
  1867. }
  1868. for (int k = 0; k < 40; k++)
  1869. {
  1870. Maid scheduleSlot4 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k);
  1871. if (scheduleSlot4 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot4.status.noonWorkId) && ScheduleCSVData.TrainingData[scheduleSlot4.status.noonWorkId].trainingType == ScheduleCSVData.TrainingType.Trainee)
  1872. {
  1873. ScheduleAPI.WorkIdReset(scheduleSlot4.status, ScheduleMgr.ScheduleTime.DayTime);
  1874. ScheduleAPI.WorkIdReset(scheduleSlot4.status, ScheduleMgr.ScheduleTime.Night);
  1875. if (care)
  1876. {
  1877. ScheduleAPI.EmptyToRandomWork(scheduleSlot4);
  1878. }
  1879. break;
  1880. }
  1881. }
  1882. }
  1883. }
  1884. }
  1885. else
  1886. {
  1887. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1888. }
  1889. }
  1890. private static void CheckYotogi(Maid maid, int taskId, ScheduleMgr.ScheduleTime time)
  1891. {
  1892. if (ScheduleCSVData.YotogiData.ContainsKey(taskId))
  1893. {
  1894. bool flag = false;
  1895. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[taskId];
  1896. if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall))
  1897. {
  1898. if (maid != null)
  1899. {
  1900. if (!ScheduleAPI.VisibleNightWork(taskId, maid, true))
  1901. {
  1902. flag = true;
  1903. }
  1904. }
  1905. else if (!ScheduleAPI.VisibleNightWork(taskId, null, true))
  1906. {
  1907. flag = true;
  1908. }
  1909. }
  1910. if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall))
  1911. {
  1912. for (int i = 0; i < 40; i++)
  1913. {
  1914. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1915. if (scheduleSlot != null && scheduleSlot != maid && (taskId == scheduleSlot.status.noonWorkId || taskId == scheduleSlot.status.nightWorkId))
  1916. {
  1917. flag = true;
  1918. break;
  1919. }
  1920. }
  1921. }
  1922. 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))
  1923. {
  1924. flag = true;
  1925. }
  1926. if (flag)
  1927. {
  1928. ScheduleAPI.WorkIdReset(maid.status, time);
  1929. }
  1930. }
  1931. else
  1932. {
  1933. ScheduleAPI.WorkIdReset(maid.status, time);
  1934. }
  1935. }
  1936. private static void WorkIdReset(MaidStatus.Status maidStatus, ScheduleMgr.ScheduleTime time)
  1937. {
  1938. if (time == ScheduleMgr.ScheduleTime.DayTime)
  1939. {
  1940. maidStatus.noonWorkId = 0;
  1941. }
  1942. else if (time == ScheduleMgr.ScheduleTime.Night)
  1943. {
  1944. maidStatus.nightWorkId = 0;
  1945. }
  1946. }
  1947. public static void ScheduleErrorAllCheck()
  1948. {
  1949. ScheduleAPI.SlotEmptyCheck();
  1950. ScheduleAPI.NightWorksStateErrorCheck(false);
  1951. ScheduleAPI.MaidWorkIdErrorCheck(false);
  1952. for (int i = 0; i < 40; i++)
  1953. {
  1954. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1955. if (scheduleSlot != null)
  1956. {
  1957. ScheduleAPI.EmptyToRandomWork(scheduleSlot);
  1958. }
  1959. }
  1960. }
  1961. public static void DayStartManage()
  1962. {
  1963. bool flag = false;
  1964. int travelWorkId = ScheduleAPI.GetTravelWorkId();
  1965. int num = 0;
  1966. while (num < 40 && !flag)
  1967. {
  1968. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num);
  1969. if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId)
  1970. {
  1971. flag = true;
  1972. }
  1973. num++;
  1974. }
  1975. if (flag)
  1976. {
  1977. ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[travelWorkId];
  1978. foreach (int key in training.needEventItemIdList)
  1979. {
  1980. if (Shop.item_data_dic.ContainsKey(key) && Shop.item_data_dic[key].type == Shop.ItemDataBase.Type.Event)
  1981. {
  1982. Shop.ItemDataEvent itemDataEvent = Shop.item_data_dic[key] as Shop.ItemDataEvent;
  1983. itemDataEvent.Reset();
  1984. }
  1985. }
  1986. }
  1987. if (DailyMgr.IsLegacy)
  1988. {
  1989. GameMain.Instance.CharacterMgr.status.ApplyScheduleSlotBackup(ScheduleSlotBackup.Type.CM3D2);
  1990. }
  1991. else
  1992. {
  1993. GameMain.Instance.CharacterMgr.status.ApplyScheduleSlotBackup(ScheduleSlotBackup.Type.COM3D);
  1994. }
  1995. ScheduleAPI.ErrorCheck();
  1996. GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Noon_Resulted", 0);
  1997. GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Night_Resulted", 0);
  1998. ScheduleAPI.BackupParam(SCENE_ID.Start);
  1999. }
  2000. public static void ErrorCheck()
  2001. {
  2002. ScheduleAPI.SlotEmptyCheck();
  2003. ScheduleAPI.NightWorksStateErrorCheck(false);
  2004. ScheduleAPI.OccurNightWork();
  2005. ScheduleAPI.MaidWorkIdErrorCheck(false);
  2006. int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount();
  2007. for (int i = 0; i < stockMaidCount; i++)
  2008. {
  2009. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
  2010. ScheduleAPI.EmptyToRandomWork(stockMaid);
  2011. }
  2012. }
  2013. public static void ThroughNoonResult()
  2014. {
  2015. if (GameMain.Instance.CharacterMgr.status.GetFlag("_Schedule_Noon_Resulted") > 0)
  2016. {
  2017. return;
  2018. }
  2019. GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Noon_Resulted", 1);
  2020. for (int i = 0; i < 40; i++)
  2021. {
  2022. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  2023. if (scheduleSlot != null)
  2024. {
  2025. GameMain.Instance.CharacterMgr.status.scheduleSlot[i].noon_success_level = ScheduleData.WorkSuccessLv.Miss;
  2026. BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.Morning);
  2027. BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.Noon);
  2028. BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.NoonBonus);
  2029. }
  2030. }
  2031. }
  2032. public static int NoonWorkPlayCount(Maid maid, int workId)
  2033. {
  2034. if (maid.status.workDatas.ContainsKey(workId))
  2035. {
  2036. return (int)maid.status.workDatas.Get(workId).playCount;
  2037. }
  2038. return 0;
  2039. }
  2040. public static int NoonWorkPlayToLv(int noonWorkPlayCount)
  2041. {
  2042. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp)
  2043. {
  2044. return 1;
  2045. }
  2046. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp)
  2047. {
  2048. return 2;
  2049. }
  2050. return 3;
  2051. }
  2052. public static float NoonWorkPlayExpRatio(int noonWorkPlayCount)
  2053. {
  2054. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp)
  2055. {
  2056. return (float)noonWorkPlayCount / (float)ScheduleCSVData.noonWorkLv2Exp;
  2057. }
  2058. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp)
  2059. {
  2060. return (float)(noonWorkPlayCount - ScheduleCSVData.noonWorkLv2Exp) / (float)ScheduleCSVData.noonWorkLv3Exp;
  2061. }
  2062. return 0f;
  2063. }
  2064. public static int NoonWorkLvToRevision(int lv)
  2065. {
  2066. return (lv - 1) * 10;
  2067. }
  2068. public static bool EmptyToRandomWork(Maid maid)
  2069. {
  2070. bool result = false;
  2071. if (maid.status.noonWorkId == 0)
  2072. {
  2073. int num = ScheduleAPI.NoonWorkRandom(maid);
  2074. maid.status.noonWorkId = num;
  2075. result = true;
  2076. ScheduleAPI.AddTrainingFacility(maid, num, ScheduleMgr.ScheduleTime.DayTime);
  2077. if (maid.status.heroineType == HeroineType.Sub)
  2078. {
  2079. ScheduleAPI.SubMaidDefaultFacility(maid, num, ScheduleMgr.ScheduleTime.DayTime);
  2080. }
  2081. }
  2082. if (maid.status.nightWorkId == 0)
  2083. {
  2084. int num = ScheduleAPI.NightWorkRandom(maid);
  2085. maid.status.nightWorkId = num;
  2086. result = true;
  2087. ScheduleAPI.AddTrainingFacility(maid, num, ScheduleMgr.ScheduleTime.Night);
  2088. if (maid.status.heroineType == HeroineType.Sub)
  2089. {
  2090. ScheduleAPI.SubMaidDefaultFacility(maid, num, ScheduleMgr.ScheduleTime.Night);
  2091. }
  2092. }
  2093. return result;
  2094. }
  2095. public static int NoonWorkRandom(Maid maid)
  2096. {
  2097. if (maid.status.heroineType == HeroineType.Sub)
  2098. {
  2099. return ScheduleCSVData.subMaidInitTaskId;
  2100. }
  2101. Dictionary<int, int> db;
  2102. if (DailyMgr.IsLegacy)
  2103. {
  2104. db = ScheduleCSVData.NoonWorkInitDataLegacy[maid.status.personal.id];
  2105. }
  2106. else
  2107. {
  2108. db = ScheduleCSVData.NoonWorkInitData[maid.status.personal.id];
  2109. }
  2110. return ScheduleAPI.WorkRandom(db);
  2111. }
  2112. public static int NightWorkRandom(Maid maid)
  2113. {
  2114. if (maid.status.heroineType == HeroineType.Sub)
  2115. {
  2116. return ScheduleCSVData.subMaidInitTaskId;
  2117. }
  2118. Dictionary<int, int> db = ScheduleCSVData.NightWorkInitData[maid.status.personal.id];
  2119. return ScheduleAPI.WorkRandom(db);
  2120. }
  2121. public static void FacilitySlotReset(string maidGuid, ScheduleMgr.ScheduleTime time)
  2122. {
  2123. Maid maid = ScheduleAPI.IsSlotInMaid(maidGuid);
  2124. if (maid == null)
  2125. {
  2126. return;
  2127. }
  2128. if (time == ScheduleMgr.ScheduleTime.DayTime)
  2129. {
  2130. maid.status.noonWorkId = 0;
  2131. }
  2132. else if (time == ScheduleMgr.ScheduleTime.Night)
  2133. {
  2134. maid.status.nightWorkId = 0;
  2135. }
  2136. }
  2137. public static void AddTrainingFacility(Maid maid, int workId, ScheduleMgr.ScheduleTime time)
  2138. {
  2139. if (DailyMgr.IsLegacy)
  2140. {
  2141. return;
  2142. }
  2143. if (!ScheduleCSVData.TrainingData.ContainsKey(workId))
  2144. {
  2145. return;
  2146. }
  2147. ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[workId];
  2148. if (training.trainingType != ScheduleCSVData.TrainingType.Basic)
  2149. {
  2150. return;
  2151. }
  2152. Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
  2153. foreach (Facility facility in facilityArray)
  2154. {
  2155. if (!(facility == null))
  2156. {
  2157. if (facility.defaultData.ID == training.facilityId)
  2158. {
  2159. facility.AllocationMaid(maid, time);
  2160. return;
  2161. }
  2162. }
  2163. }
  2164. }
  2165. public static void SubMaidDefaultFacility(Maid maid, int workId, ScheduleMgr.ScheduleTime time)
  2166. {
  2167. if (DailyMgr.IsLegacy || maid.status.heroineType != HeroineType.Sub || !ScheduleCSVData.WorkData.ContainsKey(workId))
  2168. {
  2169. return;
  2170. }
  2171. ScheduleCSVData.Work work = ScheduleCSVData.WorkData[workId];
  2172. Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
  2173. foreach (Facility facility in facilityArray)
  2174. {
  2175. if (facility.defaultData.ID == work.facility.ID)
  2176. {
  2177. facility.AllocationMaid(maid, time);
  2178. return;
  2179. }
  2180. }
  2181. }
  2182. public static bool FacilitySlotActive(string maidGuid, Facility facility, ScheduleMgr.ScheduleTime time)
  2183. {
  2184. Maid maid = ScheduleAPI.IsSlotInMaid(maidGuid);
  2185. if (maid == null)
  2186. {
  2187. return false;
  2188. }
  2189. int key = 0;
  2190. if (time == ScheduleMgr.ScheduleTime.DayTime)
  2191. {
  2192. key = maid.status.noonWorkId;
  2193. }
  2194. if (time == ScheduleMgr.ScheduleTime.Night)
  2195. {
  2196. key = maid.status.nightWorkId;
  2197. }
  2198. if (ScheduleCSVData.AllData.ContainsKey(key))
  2199. {
  2200. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key];
  2201. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work)
  2202. {
  2203. ScheduleCSVData.Work work = (ScheduleCSVData.Work)scheduleBase;
  2204. if (work.facility == facility.defaultData && work.facilityId != ScheduleCSVData.faclilityPowerUpWorkId)
  2205. {
  2206. return true;
  2207. }
  2208. }
  2209. else if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Training)
  2210. {
  2211. ScheduleCSVData.Training training = (ScheduleCSVData.Training)scheduleBase;
  2212. if (training.facilityId == facility.defaultData.ID)
  2213. {
  2214. return true;
  2215. }
  2216. }
  2217. }
  2218. return false;
  2219. }
  2220. private static Maid IsSlotInMaid(string maidGuid)
  2221. {
  2222. for (int i = 0; i < 40; i++)
  2223. {
  2224. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  2225. if (scheduleSlot != null && scheduleSlot.status.guid == maidGuid)
  2226. {
  2227. return scheduleSlot;
  2228. }
  2229. }
  2230. return null;
  2231. }
  2232. public static bool CanTrainee(Maid maid)
  2233. {
  2234. if (maid == null)
  2235. {
  2236. return false;
  2237. }
  2238. int num = 0;
  2239. for (int i = 0; i < 40; i++)
  2240. {
  2241. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  2242. if (scheduleSlot != null)
  2243. {
  2244. num++;
  2245. }
  2246. }
  2247. return num >= 3 && maid.status.studyRate >= 50;
  2248. }
  2249. private static int WorkRandom(Dictionary<int, int> db)
  2250. {
  2251. if (db.Count == 0)
  2252. {
  2253. Debug.LogWarning("ScheduleAPI.WorkRandom:傾向情報がありませんでした。0を返します。");
  2254. return 0;
  2255. }
  2256. int num = 0;
  2257. foreach (KeyValuePair<int, int> keyValuePair in db)
  2258. {
  2259. num += keyValuePair.Value;
  2260. }
  2261. int num2 = UnityEngine.Random.Range(0, num);
  2262. foreach (KeyValuePair<int, int> keyValuePair2 in db)
  2263. {
  2264. num2 -= keyValuePair2.Value;
  2265. if (num2 < 0)
  2266. {
  2267. return keyValuePair2.Key;
  2268. }
  2269. }
  2270. Debug.LogWarning("ScheduleAPI.WorkRandom:本来通過するはずの無い箇所です。");
  2271. return 0;
  2272. }
  2273. public static string InfoReplace(int nightWorkId, string info)
  2274. {
  2275. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(nightWorkId);
  2276. if (nightWorksState != null)
  2277. {
  2278. string calledMaidGUID = nightWorksState.calledMaidGUID;
  2279. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(calledMaidGUID);
  2280. if (stockMaid != null)
  2281. {
  2282. info = info.Replace("[HF]", stockMaid.status.firstName);
  2283. }
  2284. }
  2285. return info;
  2286. }
  2287. private static List<Maid> GetNightWorkMeetMaidList(int workId, bool calledTargetCheck = false)
  2288. {
  2289. List<Maid> list = new List<Maid>();
  2290. int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount();
  2291. for (int i = 0; i < stockMaidCount; i++)
  2292. {
  2293. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
  2294. if (ScheduleAPI.EnableNightWork(workId, stockMaid, calledTargetCheck, true))
  2295. {
  2296. list.Add(stockMaid);
  2297. }
  2298. }
  2299. return list;
  2300. }
  2301. public static void OccurNightWork()
  2302. {
  2303. foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
  2304. {
  2305. ScheduleCSVData.Yotogi value = keyValuePair.Value;
  2306. ScheduleCSVData.YotogiType yotogiType = value.yotogiType;
  2307. if (yotogiType != ScheduleCSVData.YotogiType.Vip)
  2308. {
  2309. if (yotogiType == ScheduleCSVData.YotogiType.VipCall)
  2310. {
  2311. if (GameMain.Instance.CharacterMgr.status.GetNightWorksState(value.id) == null && ScheduleAPI.EnableNightWork(value.id, null, true, true))
  2312. {
  2313. List<Maid> nightWorkMeetMaidList = ScheduleAPI.GetNightWorkMeetMaidList(value.id, false);
  2314. if (nightWorkMeetMaidList.Count > 0)
  2315. {
  2316. NightWorkState nightWorkState = new NightWorkState();
  2317. nightWorkState.finish = false;
  2318. nightWorkState.workId = keyValuePair.Key;
  2319. int index = UnityEngine.Random.Range(0, nightWorkMeetMaidList.Count - 1);
  2320. nightWorkState.calledMaidGUID = nightWorkMeetMaidList[index].status.guid;
  2321. GameMain.Instance.CharacterMgr.status.AddNightWorksState(nightWorkState);
  2322. }
  2323. }
  2324. }
  2325. }
  2326. else if (GameMain.Instance.CharacterMgr.status.GetNightWorksState(value.id) == null && ScheduleAPI.EnableNightWork(value.id, null, true, true))
  2327. {
  2328. NightWorkState nightWorkState2 = new NightWorkState();
  2329. nightWorkState2.finish = false;
  2330. nightWorkState2.workId = keyValuePair.Key;
  2331. nightWorkState2.calledMaidGUID = null;
  2332. GameMain.Instance.CharacterMgr.status.AddNightWorksState(nightWorkState2);
  2333. }
  2334. }
  2335. }
  2336. public static List<string> logs = new List<string>();
  2337. public static bool logOutput = false;
  2338. public const string NOON_RESULTED_GENERAL_FLAG = "_Schedule_Noon_Resulted";
  2339. public const string NIGHT_RESULTED_GENERAL_FLAG = "_Schedule_Night_Resulted";
  2340. public class TrainingResultSimulateParam
  2341. {
  2342. public int study_rate;
  2343. public int reception;
  2344. public int care;
  2345. public int lovely;
  2346. public int elegance;
  2347. public int charm;
  2348. public int teach_rate;
  2349. public int exp;
  2350. public int cooking;
  2351. public int vocal;
  2352. public int dance;
  2353. public int appealPoint;
  2354. public int inyoku;
  2355. public int mvalue;
  2356. public int hentai;
  2357. public int housi;
  2358. public int income;
  2359. public int commandExp;
  2360. }
  2361. public class YotogiResultSimulateParam
  2362. {
  2363. public int income;
  2364. public int evaluation;
  2365. public int playNumber;
  2366. public int otherPlayNumber;
  2367. public int study_rate;
  2368. public int reception;
  2369. public int care;
  2370. public int teach_rate;
  2371. public int inyoku;
  2372. public int mvalue;
  2373. public int hentai;
  2374. public int housi;
  2375. }
  2376. }
  2377. }