ScheduleAPI.cs 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449
  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.pairCondPersonal, scheduleSlot).Count > 0)
  546. {
  547. list.Add(scheduleSlot);
  548. }
  549. }
  550. }
  551. }
  552. }
  553. return list;
  554. }
  555. public static List<Maid> GetNewYotogiHaremPairCandidateList(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 (stockMaid.status.seikeiken == Seikeiken.Yes_Yes && stockMaid.status.relation >= Relation.Lover && condPersonalIds.Contains(stockMaid.status.personal.id))
  570. {
  571. list.Add(stockMaid);
  572. }
  573. }
  574. }
  575. }
  576. return list;
  577. }
  578. public static void DecideSuccess(WorkResultSceneMode sceneMode, int index, bool commu)
  579. {
  580. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(index);
  581. ScheduleData scheduleData = GameMain.Instance.CharacterMgr.status.scheduleSlot[index];
  582. if (scheduleSlot != null)
  583. {
  584. ScheduleData.WorkSuccessLv workSuccessLv;
  585. if (commu)
  586. {
  587. workSuccessLv = ScheduleData.WorkSuccessLv.Success;
  588. }
  589. else if (scheduleSlot.status.features.ContainsKey(Feature.GetData("疲労").id))
  590. {
  591. workSuccessLv = ScheduleData.WorkSuccessLv.Miss;
  592. }
  593. else
  594. {
  595. int num = UnityEngine.Random.Range(1, 100);
  596. if (num <= ScheduleCSVData.workSuccessLvMissIncidence)
  597. {
  598. workSuccessLv = ScheduleData.WorkSuccessLv.Miss;
  599. }
  600. else if (num > 100 - ScheduleCSVData.workSuccessLvPerfectIncidence)
  601. {
  602. workSuccessLv = ScheduleData.WorkSuccessLv.Perfect;
  603. }
  604. else
  605. {
  606. workSuccessLv = ScheduleData.WorkSuccessLv.Success;
  607. }
  608. }
  609. int num2 = 0;
  610. if (sceneMode == WorkResultSceneMode.Noon)
  611. {
  612. num2 = scheduleSlot.status.noonWorkId;
  613. }
  614. else if (sceneMode == WorkResultSceneMode.Night)
  615. {
  616. num2 = scheduleSlot.status.nightWorkId;
  617. }
  618. if (num2 == ScheduleCSVData.faclilityPowerUpWorkId)
  619. {
  620. Facility facility;
  621. Facility.RecipeData recipeData;
  622. if (!GameMain.Instance.FacilityMgr.TryGetCacheFacilityPowerUpResult(scheduleSlot, out facility, out recipeData))
  623. {
  624. workSuccessLv = ScheduleData.WorkSuccessLv.Unexecuted;
  625. }
  626. else
  627. {
  628. workSuccessLv = ScheduleData.WorkSuccessLv.Success;
  629. }
  630. }
  631. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num2];
  632. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work && num2 != ScheduleCSVData.faclilityPowerUpWorkId)
  633. {
  634. ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  635. if (sceneMode == WorkResultSceneMode.Noon)
  636. {
  637. scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  638. }
  639. else if (sceneMode == WorkResultSceneMode.Night)
  640. {
  641. scheduleTime = ScheduleMgr.ScheduleTime.Night;
  642. }
  643. Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(scheduleSlot, scheduleTime);
  644. if (maidAssignedFacility == null || !maidAssignedFacility.IsOperation(scheduleTime))
  645. {
  646. workSuccessLv = ScheduleData.WorkSuccessLv.Unexecuted;
  647. }
  648. }
  649. if (sceneMode == WorkResultSceneMode.Noon)
  650. {
  651. scheduleData.noon_success_level = workSuccessLv;
  652. }
  653. else if (sceneMode == WorkResultSceneMode.Night)
  654. {
  655. scheduleData.night_success_level = workSuccessLv;
  656. }
  657. }
  658. }
  659. private static ScheduleAPI.TrainingResultSimulateParam TrainingResultSimulate(Maid maid, int workId, ScheduleData.WorkSuccessLv successLv = ScheduleData.WorkSuccessLv.Success, bool communicationBonus = false)
  660. {
  661. ScheduleAPI.TrainingResultSimulateParam trainingResultSimulateParam = new ScheduleAPI.TrainingResultSimulateParam();
  662. if (maid == null)
  663. {
  664. return trainingResultSimulateParam;
  665. }
  666. ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[workId];
  667. switch (training.trainingType)
  668. {
  669. case ScheduleCSVData.TrainingType.Basic:
  670. case ScheduleCSVData.TrainingType.Dispatch:
  671. {
  672. BonusStatus bonusStatusAsFeatureAndPropensitys = maid.status.GetBonusStatusAsFeatureAndPropensitys();
  673. int workLvRevision = ScheduleAPI.NoonWorkLvToRevision(ScheduleAPI.NoonWorkPlayToLv(ScheduleAPI.NoonWorkPlayCount(maid, workId)));
  674. double successRevision = 1.0;
  675. if (successLv == ScheduleData.WorkSuccessLv.Unexecuted)
  676. {
  677. successRevision = 0.0;
  678. }
  679. else if (communicationBonus)
  680. {
  681. successRevision = 0.3;
  682. }
  683. else if (successLv != ScheduleData.WorkSuccessLv.Miss)
  684. {
  685. if (successLv != ScheduleData.WorkSuccessLv.Success)
  686. {
  687. if (successLv == ScheduleData.WorkSuccessLv.Perfect)
  688. {
  689. successRevision = 1.5;
  690. }
  691. }
  692. else
  693. {
  694. successRevision = 1.0;
  695. }
  696. }
  697. else
  698. {
  699. successRevision = 0.5;
  700. }
  701. trainingResultSimulateParam.study_rate = training.study_rate;
  702. trainingResultSimulateParam.reception = ScheduleAPI.NoonWorkResultSimulate_basic(training.reception, bonusStatusAsFeatureAndPropensitys.reception, workLvRevision, successRevision);
  703. trainingResultSimulateParam.care = ScheduleAPI.NoonWorkResultSimulate_basic(training.care, bonusStatusAsFeatureAndPropensitys.care, workLvRevision, successRevision);
  704. trainingResultSimulateParam.lovely = ScheduleAPI.NoonWorkResultSimulate_basic(training.lovely, bonusStatusAsFeatureAndPropensitys.lovely, workLvRevision, successRevision);
  705. trainingResultSimulateParam.elegance = ScheduleAPI.NoonWorkResultSimulate_basic(training.elegance, bonusStatusAsFeatureAndPropensitys.elegance, workLvRevision, successRevision);
  706. trainingResultSimulateParam.charm = ScheduleAPI.NoonWorkResultSimulate_basic(training.charm, bonusStatusAsFeatureAndPropensitys.charm, workLvRevision, successRevision);
  707. trainingResultSimulateParam.teach_rate = ScheduleAPI.NoonWorkResultSimulate_basic(training.teach_rate, bonusStatusAsFeatureAndPropensitys.teachRate, workLvRevision, successRevision);
  708. trainingResultSimulateParam.cooking = ScheduleAPI.NoonWorkResultSimulate_basic(training.cooking, bonusStatusAsFeatureAndPropensitys.cooking, workLvRevision, successRevision);
  709. trainingResultSimulateParam.vocal = ScheduleAPI.NoonWorkResultSimulate_basic(training.vocal, bonusStatusAsFeatureAndPropensitys.vocal, workLvRevision, successRevision);
  710. trainingResultSimulateParam.dance = ScheduleAPI.NoonWorkResultSimulate_basic(training.dance, bonusStatusAsFeatureAndPropensitys.dance, workLvRevision, successRevision);
  711. trainingResultSimulateParam.appealPoint = ScheduleAPI.NoonWorkResultSimulate_basic(training.appealPoint, bonusStatusAsFeatureAndPropensitys.appealPoint, workLvRevision, successRevision);
  712. trainingResultSimulateParam.income = ScheduleAPI.NoonWorkResultSimulate_basic(training.income, 0, workLvRevision, successRevision);
  713. trainingResultSimulateParam.income = (int)((double)trainingResultSimulateParam.income * (System.Math.Ceiling((double)maid.status.care / (double)ScheduleCSVData.dispatchIncomCoefficient) / 100.0 + 1.0));
  714. trainingResultSimulateParam.exp = ScheduleAPI.NoonWorkResultSimulate_basic(training.exp, 0, workLvRevision, successRevision);
  715. if (communicationBonus)
  716. {
  717. trainingResultSimulateParam.study_rate = 0;
  718. }
  719. break;
  720. }
  721. case ScheduleCSVData.TrainingType.Trainee:
  722. {
  723. Maid stockMaidLeader = ScheduleAPI.GetStockMaidLeader();
  724. if (stockMaidLeader != null)
  725. {
  726. int noonTrainerWorkId = ScheduleAPI.GetNoonTrainerWorkId();
  727. int workLvRevision2 = ScheduleAPI.NoonWorkLvToRevision(ScheduleAPI.NoonWorkPlayToLv(ScheduleAPI.NoonWorkPlayCount(stockMaidLeader, noonTrainerWorkId)));
  728. int teachRevision = stockMaidLeader.status.teachRate / 50;
  729. MaidStatus.Status status = stockMaidLeader.status;
  730. trainingResultSimulateParam.study_rate = training.study_rate;
  731. trainingResultSimulateParam.reception = ScheduleAPI.NoonWorkResultSimulate_trainee(status.reception, workLvRevision2, teachRevision);
  732. trainingResultSimulateParam.care = ScheduleAPI.NoonWorkResultSimulate_trainee(status.care, workLvRevision2, teachRevision);
  733. trainingResultSimulateParam.lovely = ScheduleAPI.NoonWorkResultSimulate_trainee(status.lovely, workLvRevision2, teachRevision);
  734. trainingResultSimulateParam.elegance = ScheduleAPI.NoonWorkResultSimulate_trainee(status.elegance, workLvRevision2, teachRevision);
  735. trainingResultSimulateParam.charm = ScheduleAPI.NoonWorkResultSimulate_trainee(status.charm, workLvRevision2, teachRevision);
  736. trainingResultSimulateParam.inyoku = ScheduleAPI.NoonWorkResultSimulate_trainee(status.inyoku, workLvRevision2, teachRevision);
  737. trainingResultSimulateParam.mvalue = ScheduleAPI.NoonWorkResultSimulate_trainee(status.mvalue, workLvRevision2, teachRevision);
  738. trainingResultSimulateParam.hentai = ScheduleAPI.NoonWorkResultSimulate_trainee(status.hentai, workLvRevision2, teachRevision);
  739. trainingResultSimulateParam.housi = ScheduleAPI.NoonWorkResultSimulate_trainee(status.housi, workLvRevision2, teachRevision);
  740. }
  741. break;
  742. }
  743. }
  744. return trainingResultSimulateParam;
  745. }
  746. private static int NoonWorkResultSimulate_basic(int workParam, int maidRevision, int workLvRevision, double successRevision)
  747. {
  748. return (int)System.Math.Ceiling((double)workParam * (double)(100 + maidRevision + workLvRevision) / 100.0 * successRevision);
  749. }
  750. private static int NoonWorkResultSimulate_trainee(int trainerParam, int workLvRevision, int teachRevision)
  751. {
  752. return (int)System.Math.Ceiling((double)trainerParam / 25.0 * (double)(100 + workLvRevision + teachRevision) / 100.0);
  753. }
  754. public static Params OneDayParamDiff(int? slotId = null)
  755. {
  756. int num = 0;
  757. if (slotId == null)
  758. {
  759. for (int i = 0; i < 40; i++)
  760. {
  761. if (GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i) != null)
  762. {
  763. num = i;
  764. break;
  765. }
  766. }
  767. }
  768. else
  769. {
  770. num = ((slotId == null) ? 0 : slotId.Value);
  771. }
  772. if (GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num) != null)
  773. {
  774. return BackupParamAccessor.GetBackupParams(num, SCENE_ID.Start);
  775. }
  776. return null;
  777. }
  778. public static ScheduleAPI.YotogiResultSimulateParam YotogiResultSimulate(Maid maid, int workId)
  779. {
  780. ScheduleAPI.YotogiResultSimulateParam yotogiResultSimulateParam = new ScheduleAPI.YotogiResultSimulateParam();
  781. if (maid == null)
  782. {
  783. return yotogiResultSimulateParam;
  784. }
  785. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
  786. switch (yotogi.yotogiType)
  787. {
  788. case ScheduleCSVData.YotogiType.Entertain:
  789. {
  790. int num = 0;
  791. int num2 = 0;
  792. int clubGrade = GameMain.Instance.CharacterMgr.status.clubGrade;
  793. int num3 = ScheduleCSVData.EntertainNumberData[clubGrade];
  794. for (int i = 0; i < num3; i++)
  795. {
  796. int count = ScheduleCSVData.EntertainGuestData[clubGrade].Count;
  797. int index = UnityEngine.Random.Range(0, count);
  798. ScheduleCSVData.EntertainGuest entertainGuest = ScheduleCSVData.EntertainGuestData[clubGrade][index];
  799. double num4 = 0.0;
  800. if (!entertainGuest.sexual)
  801. {
  802. num4 += System.Math.Ceiling((double)maid.status.lovely / 500.0);
  803. num4 += System.Math.Ceiling((double)maid.status.elegance / 500.0);
  804. num4 += System.Math.Ceiling((double)maid.status.charm / 500.0);
  805. num4 += System.Math.Ceiling((double)maid.status.reception / 500.0);
  806. num4 += System.Math.Ceiling((double)maid.status.cooking / 500.0);
  807. num4 += System.Math.Ceiling((double)maid.status.vocal / 500.0);
  808. num4 += System.Math.Ceiling((double)maid.status.dance / 500.0);
  809. num4 += System.Math.Ceiling((double)maid.status.appealPoint / 500.0);
  810. }
  811. else
  812. {
  813. num4 += System.Math.Ceiling((double)maid.status.inyoku / 500.0);
  814. num4 += System.Math.Ceiling((double)maid.status.mvalue / 500.0);
  815. num4 += System.Math.Ceiling((double)maid.status.hentai / 500.0);
  816. num4 += System.Math.Ceiling((double)maid.status.housi / 500.0);
  817. }
  818. num4 /= 2.0;
  819. num4 = num4 / 100.0 + 1.0;
  820. double num5 = 0.0;
  821. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  822. for (int j = 0; j < maid.status.propensitys.Count; j++)
  823. {
  824. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  825. }
  826. if (maid.status.inyoku >= ScheduleCSVData.entertainParameterRevisionThreshold)
  827. {
  828. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  829. }
  830. if (maid.status.mvalue >= ScheduleCSVData.entertainParameterRevisionThreshold)
  831. {
  832. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  833. }
  834. if (maid.status.hentai >= ScheduleCSVData.entertainParameterRevisionThreshold)
  835. {
  836. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  837. }
  838. if (maid.status.housi >= ScheduleCSVData.entertainParameterRevisionThreshold)
  839. {
  840. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  841. }
  842. if (maid.status.lovely >= ScheduleCSVData.entertainParameterRevisionThreshold)
  843. {
  844. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  845. }
  846. if (maid.status.elegance >= ScheduleCSVData.entertainParameterRevisionThreshold)
  847. {
  848. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  849. }
  850. if (maid.status.charm >= ScheduleCSVData.entertainParameterRevisionThreshold)
  851. {
  852. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  853. }
  854. if (maid.status.reception >= ScheduleCSVData.entertainParameterRevisionThreshold)
  855. {
  856. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  857. }
  858. if (maid.status.cooking >= ScheduleCSVData.entertainParameterRevisionThreshold)
  859. {
  860. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  861. }
  862. if (maid.status.vocal >= ScheduleCSVData.entertainParameterRevisionThreshold)
  863. {
  864. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  865. }
  866. if (maid.status.dance >= ScheduleCSVData.entertainParameterRevisionThreshold)
  867. {
  868. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  869. }
  870. if (maid.status.appealPoint >= ScheduleCSVData.entertainParameterRevisionThreshold)
  871. {
  872. num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
  873. }
  874. num5 = num5 / 100.0 + 1.0;
  875. if (num5 < (double)(ScheduleCSVData.entertainPropensityRevisionMin / 100))
  876. {
  877. num5 = (double)(ScheduleCSVData.entertainPropensityRevisionMin / 100);
  878. }
  879. else if (num5 > (double)(ScheduleCSVData.entertainPropensityRevisionMax / 100))
  880. {
  881. num5 = (double)(ScheduleCSVData.entertainPropensityRevisionMax / 100);
  882. }
  883. yotogiResultSimulateParam.otherPlayNumber++;
  884. if (entertainGuest.sexual)
  885. {
  886. Contract contract = maid.status.contract;
  887. if (contract != Contract.Trainee && contract != Contract.Free)
  888. {
  889. if (contract == Contract.Exclusive)
  890. {
  891. num5 /= 2.0;
  892. }
  893. }
  894. else
  895. {
  896. yotogiResultSimulateParam.playNumber++;
  897. }
  898. }
  899. int num6 = (int)((double)entertainGuest.baseIcome * num4 * num5);
  900. int num7 = (int)((double)entertainGuest.baseEvaluation * num4 * num5);
  901. num6 = (int)System.Math.Ceiling((double)num6 / 1000.0) * 1000;
  902. num += num6;
  903. num2 += num7;
  904. }
  905. yotogiResultSimulateParam.income = num;
  906. yotogiResultSimulateParam.evaluation = num2;
  907. break;
  908. }
  909. case ScheduleCSVData.YotogiType.HaveSex:
  910. case ScheduleCSVData.YotogiType.NewSex:
  911. if (maid.status.GetFlag("_YotogiPlayed") > 0)
  912. {
  913. }
  914. break;
  915. case ScheduleCSVData.YotogiType.Vip:
  916. case ScheduleCSVData.YotogiType.VipCall:
  917. {
  918. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId);
  919. if (nightWorksState != null && !nightWorksState.finish)
  920. {
  921. yotogiResultSimulateParam.income = yotogi.income;
  922. yotogiResultSimulateParam.evaluation = yotogi.evaluation;
  923. }
  924. if (yotogi != null)
  925. {
  926. yotogiResultSimulateParam.playNumber += yotogi.add_play_number;
  927. yotogiResultSimulateParam.otherPlayNumber += yotogi.add_other_play_number;
  928. }
  929. break;
  930. }
  931. case ScheduleCSVData.YotogiType.EasyYotogi:
  932. {
  933. ScheduleCSVData.Yotogi.EasyYotogi easyYotogi = yotogi.easyYotogi;
  934. if (easyYotogi != null)
  935. {
  936. yotogiResultSimulateParam.study_rate = easyYotogi.study_rate;
  937. yotogiResultSimulateParam.care = easyYotogi.care;
  938. yotogiResultSimulateParam.reception = easyYotogi.reception;
  939. yotogiResultSimulateParam.teach_rate = easyYotogi.teach_rate;
  940. yotogiResultSimulateParam.study_rate = easyYotogi.study_rate;
  941. yotogiResultSimulateParam.inyoku = easyYotogi.inyoku;
  942. yotogiResultSimulateParam.hentai = easyYotogi.hentai;
  943. yotogiResultSimulateParam.mvalue = easyYotogi.msei;
  944. yotogiResultSimulateParam.housi = easyYotogi.housi;
  945. }
  946. break;
  947. }
  948. }
  949. return yotogiResultSimulateParam;
  950. }
  951. public static void AddYotogiWorkResultParam(ScheduleCSVData.Yotogi scheduleData, Maid maid, ScheduleAPI.YotogiResultSimulateParam param)
  952. {
  953. maid.status.studyRate += param.study_rate;
  954. maid.status.evaluation += param.evaluation;
  955. maid.status.totalEvaluations += (long)param.evaluation;
  956. maid.status.sales += (long)param.income;
  957. maid.status.totalSales += (long)param.income;
  958. GameMain.Instance.CharacterMgr.status.baseClubEvaluation += param.evaluation;
  959. GameMain.Instance.CharacterMgr.status.money += (long)param.income;
  960. maid.status.playCountNightWork += param.otherPlayNumber;
  961. maid.status.sexPlayNumberOfPeople += param.playNumber;
  962. maid.status.baseCare += param.care;
  963. maid.status.baseReception += param.reception;
  964. maid.status.baseTeachRate += param.teach_rate;
  965. maid.status.baseInyoku += param.inyoku;
  966. maid.status.baseHentai += param.hentai;
  967. maid.status.baseMvalue += param.mvalue;
  968. maid.status.baseHousi += param.housi;
  969. }
  970. public static bool EnableNoonWork(int workId, Maid maid = null)
  971. {
  972. if (!ScheduleCSVData.TrainingData.ContainsKey(workId))
  973. {
  974. return false;
  975. }
  976. ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[workId];
  977. if (training.condPackage.Count > 0)
  978. {
  979. for (int i = 0; i < training.condPackage.Count; i++)
  980. {
  981. if (!PluginData.IsEnabled(training.condPackage[i]))
  982. {
  983. return false;
  984. }
  985. }
  986. }
  987. if (maid != null)
  988. {
  989. if (training.trainingType == ScheduleCSVData.TrainingType.Trainer)
  990. {
  991. if (maid != ScheduleAPI.GetStockMaidLeader())
  992. {
  993. return false;
  994. }
  995. if (maid.status.contract == Contract.Trainee)
  996. {
  997. return false;
  998. }
  999. }
  1000. if (training.trainingType == ScheduleCSVData.TrainingType.Trainee)
  1001. {
  1002. if (maid == ScheduleAPI.GetStockMaidLeader())
  1003. {
  1004. return false;
  1005. }
  1006. if (maid.status.studyRate < -training.study_rate)
  1007. {
  1008. return false;
  1009. }
  1010. bool flag = false;
  1011. for (int j = 0; j < 40; j++)
  1012. {
  1013. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
  1014. if (scheduleSlot != null && ScheduleAPI.EnableNoonWork(ScheduleAPI.GetNoonTrainerWorkId(), scheduleSlot))
  1015. {
  1016. flag = true;
  1017. break;
  1018. }
  1019. }
  1020. if (!flag)
  1021. {
  1022. return false;
  1023. }
  1024. }
  1025. if (training.condContract.Count > 0)
  1026. {
  1027. bool flag2 = false;
  1028. for (int k = 0; k < training.condContract.Count; k++)
  1029. {
  1030. if (training.condContract[k] == maid.status.contract)
  1031. {
  1032. flag2 = true;
  1033. break;
  1034. }
  1035. }
  1036. if (!flag2)
  1037. {
  1038. return false;
  1039. }
  1040. }
  1041. if (training.condMaidClass.Count > 0)
  1042. {
  1043. for (int l = 0; l < training.condMaidClass.Count; l++)
  1044. {
  1045. if (!maid.status.jobClass.Contains(training.condMaidClass[l]))
  1046. {
  1047. return false;
  1048. }
  1049. }
  1050. }
  1051. }
  1052. return true;
  1053. }
  1054. public static bool VisibleNightWork(int workId, Maid maid = null, bool checkFinish = true)
  1055. {
  1056. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
  1057. switch (yotogi.yotogiType)
  1058. {
  1059. case ScheduleCSVData.YotogiType.Vip:
  1060. case ScheduleCSVData.YotogiType.VipCall:
  1061. {
  1062. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId);
  1063. if (nightWorksState == null)
  1064. {
  1065. return false;
  1066. }
  1067. if (checkFinish && nightWorksState.finish)
  1068. {
  1069. if (DailyMgr.IsLegacy)
  1070. {
  1071. return false;
  1072. }
  1073. if (GameMain.Instance.CharacterMgr.status.clubGrade < 5)
  1074. {
  1075. return false;
  1076. }
  1077. if (GameMain.Instance.CharacterMgr.status.days < ScheduleCSVData.vipFullOpenDay)
  1078. {
  1079. return false;
  1080. }
  1081. }
  1082. break;
  1083. }
  1084. case ScheduleCSVData.YotogiType.Travel:
  1085. return false;
  1086. case ScheduleCSVData.YotogiType.EasyYotogi:
  1087. {
  1088. if (yotogi.easyYotogi == null)
  1089. {
  1090. return false;
  1091. }
  1092. int trophyId = yotogi.easyYotogi.trophyId;
  1093. if (!GameMain.Instance.CharacterMgr.status.IsHaveTrophy(trophyId))
  1094. {
  1095. return false;
  1096. }
  1097. break;
  1098. }
  1099. }
  1100. if (yotogi.condPackage.Count > 0)
  1101. {
  1102. for (int i = 0; i < ScheduleCSVData.YotogiData[workId].condPackage.Count; i++)
  1103. {
  1104. if (!PluginData.IsEnabled(ScheduleCSVData.YotogiData[workId].condPackage[i]))
  1105. {
  1106. return false;
  1107. }
  1108. }
  1109. }
  1110. if (yotogi.condManVisibleFlag1.Count > 0)
  1111. {
  1112. for (int j = 0; j < yotogi.condManVisibleFlag1.Count; j++)
  1113. {
  1114. if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManVisibleFlag1[j]) < 1)
  1115. {
  1116. return false;
  1117. }
  1118. }
  1119. }
  1120. if (maid != null)
  1121. {
  1122. if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara)
  1123. {
  1124. return false;
  1125. }
  1126. if (yotogi.condPersonal.Count > 0)
  1127. {
  1128. bool flag = false;
  1129. for (int k = 0; k < yotogi.condPersonal.Count; k++)
  1130. {
  1131. if (maid.status.personal.id == yotogi.condPersonal[k])
  1132. {
  1133. flag = true;
  1134. break;
  1135. }
  1136. }
  1137. if (!flag)
  1138. {
  1139. return false;
  1140. }
  1141. }
  1142. if (yotogi.subMaidUnipueName != string.Empty)
  1143. {
  1144. if (maid.status.heroineType != HeroineType.Sub)
  1145. {
  1146. return false;
  1147. }
  1148. if (yotogi.subMaidUnipueName != maid.status.subCharaData.uniqueName)
  1149. {
  1150. return false;
  1151. }
  1152. }
  1153. else if (maid.status.heroineType == HeroineType.Sub)
  1154. {
  1155. return false;
  1156. }
  1157. }
  1158. return true;
  1159. }
  1160. public static bool EnableNightWork(int workId, Maid maid = null, bool calledTargetCheck = true, bool withMaid = true)
  1161. {
  1162. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
  1163. if (yotogi.condPackage.Count > 0)
  1164. {
  1165. for (int i = 0; i < yotogi.condPackage.Count; i++)
  1166. {
  1167. if (!PluginData.IsEnabled(yotogi.condPackage[i]))
  1168. {
  1169. return false;
  1170. }
  1171. }
  1172. }
  1173. if (yotogi.condSalonGrade > GameMain.Instance.CharacterMgr.status.clubGrade)
  1174. {
  1175. return false;
  1176. }
  1177. if (yotogi.easyYotogi != null)
  1178. {
  1179. int trophyId = yotogi.easyYotogi.trophyId;
  1180. if (!GameMain.Instance.CharacterMgr.status.IsHaveTrophy(trophyId))
  1181. {
  1182. return false;
  1183. }
  1184. }
  1185. if (!DailyMgr.IsLegacy && yotogi.mode == ScheduleCSVData.ScheduleBase.Mode.CM3D2)
  1186. {
  1187. return false;
  1188. }
  1189. if (DailyMgr.IsLegacy && yotogi.mode == ScheduleCSVData.ScheduleBase.Mode.COM3D)
  1190. {
  1191. return false;
  1192. }
  1193. if (maid != null)
  1194. {
  1195. if (yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall && calledTargetCheck && !ScheduleAPI.VipCalledMaid(workId, maid))
  1196. {
  1197. return false;
  1198. }
  1199. foreach (KeyValuePair<int, int> keyValuePair in yotogi.condSkill)
  1200. {
  1201. if (!maid.status.yotogiSkill.Contains(keyValuePair.Key))
  1202. {
  1203. return false;
  1204. }
  1205. YotogiSkillData yotogiSkillData = maid.status.yotogiSkill.Get(keyValuePair.Key);
  1206. if (keyValuePair.Value > yotogiSkillData.level)
  1207. {
  1208. return false;
  1209. }
  1210. }
  1211. if (yotogi.condMaidClass.Count > 0)
  1212. {
  1213. for (int j = 0; j < yotogi.condMaidClass.Count; j++)
  1214. {
  1215. if (!maid.status.jobClass.Contains(yotogi.condMaidClass[j]))
  1216. {
  1217. return false;
  1218. }
  1219. }
  1220. }
  1221. if (yotogi.condYotogiClass.Count > 0)
  1222. {
  1223. for (int k = 0; k < yotogi.condYotogiClass.Count; k++)
  1224. {
  1225. if (!maid.status.yotogiClass.Contains(yotogi.condYotogiClass[k]))
  1226. {
  1227. return false;
  1228. }
  1229. }
  1230. }
  1231. if (yotogi.condPropensity.Count > 0)
  1232. {
  1233. bool flag = false;
  1234. for (int l = 0; l < yotogi.condPropensity.Count; l++)
  1235. {
  1236. if (maid.status.propensitys.ContainsKey(yotogi.condPropensity[l]))
  1237. {
  1238. flag = true;
  1239. break;
  1240. }
  1241. }
  1242. if (!flag)
  1243. {
  1244. return false;
  1245. }
  1246. }
  1247. if (yotogi.condSeikeiken.Count > 0)
  1248. {
  1249. bool flag2 = false;
  1250. for (int m = 0; m < yotogi.condSeikeiken.Count; m++)
  1251. {
  1252. if (yotogi.condSeikeiken[m] == maid.status.seikeiken)
  1253. {
  1254. flag2 = true;
  1255. break;
  1256. }
  1257. }
  1258. if (!flag2)
  1259. {
  1260. return false;
  1261. }
  1262. }
  1263. if (yotogi.condFlag1.Count > 0)
  1264. {
  1265. for (int n = 0; n < yotogi.condFlag1.Count; n++)
  1266. {
  1267. if (ScheduleAPI.GetMaidFlag(maid, yotogi.condFlag1[n]) < 1)
  1268. {
  1269. return false;
  1270. }
  1271. }
  1272. }
  1273. if (yotogi.condFlag0.Count > 0)
  1274. {
  1275. for (int num = 0; num < yotogi.condFlag0.Count; num++)
  1276. {
  1277. if (ScheduleAPI.GetMaidFlag(maid, yotogi.condFlag0[num]) > 0)
  1278. {
  1279. return false;
  1280. }
  1281. }
  1282. }
  1283. if (DailyMgr.IsLegacy)
  1284. {
  1285. if (yotogi.condRelationOld.Count > 0)
  1286. {
  1287. bool flag3 = false;
  1288. for (int num2 = 0; num2 < yotogi.condRelationOld.Count; num2++)
  1289. {
  1290. if (yotogi.condRelationOld[num2] == maid.status.OldStatus.relation)
  1291. {
  1292. flag3 = true;
  1293. break;
  1294. }
  1295. }
  1296. if (!flag3)
  1297. {
  1298. return false;
  1299. }
  1300. }
  1301. }
  1302. else if (yotogi.condRelation.Count > 0)
  1303. {
  1304. bool flag4 = false;
  1305. for (int num3 = 0; num3 < yotogi.condRelation.Count; num3++)
  1306. {
  1307. if (yotogi.condRelation[num3] == maid.status.relation)
  1308. {
  1309. flag4 = true;
  1310. break;
  1311. }
  1312. }
  1313. if (!flag4)
  1314. {
  1315. return false;
  1316. }
  1317. }
  1318. if (yotogi.condManFlag1.Count > 0)
  1319. {
  1320. for (int num4 = 0; num4 < yotogi.condManFlag1.Count; num4++)
  1321. {
  1322. if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag1[num4]) < 1)
  1323. {
  1324. return false;
  1325. }
  1326. }
  1327. }
  1328. if (yotogi.condManFlag0.Count > 0)
  1329. {
  1330. for (int num5 = 0; num5 < yotogi.condManFlag0.Count; num5++)
  1331. {
  1332. if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag0[num5]) > 0)
  1333. {
  1334. return false;
  1335. }
  1336. }
  1337. }
  1338. if (yotogi.condContract.Count > 0)
  1339. {
  1340. bool flag5 = false;
  1341. for (int num6 = 0; num6 < yotogi.condContract.Count; num6++)
  1342. {
  1343. if (yotogi.condContract[num6] == maid.status.contract)
  1344. {
  1345. flag5 = true;
  1346. break;
  1347. }
  1348. }
  1349. if (!flag5)
  1350. {
  1351. return false;
  1352. }
  1353. }
  1354. if (yotogi.condFacilityID.Count > 0)
  1355. {
  1356. foreach (List<int> list in yotogi.condFacilityID)
  1357. {
  1358. bool flag6 = false;
  1359. foreach (int num7 in list)
  1360. {
  1361. Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
  1362. foreach (Facility facility in facilityArray)
  1363. {
  1364. ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  1365. if (withMaid)
  1366. {
  1367. if (yotogi.id == maid.status.noonWorkId)
  1368. {
  1369. scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  1370. }
  1371. else if (yotogi.id == maid.status.nightWorkId)
  1372. {
  1373. scheduleTime = ScheduleMgr.ScheduleTime.Night;
  1374. }
  1375. }
  1376. else
  1377. {
  1378. scheduleTime = ScheduleTaskViewer.ScheduleTime;
  1379. }
  1380. if (!(facility == null) && facility.defaultData.ID == num7)
  1381. {
  1382. if (facility.IsOperation(scheduleTime))
  1383. {
  1384. flag6 = true;
  1385. Maid[] allocationMaidArray = facility.GetAllocationMaidArray(scheduleTime);
  1386. if (allocationMaidArray != null && allocationMaidArray.Length == facility.minMaidCount)
  1387. {
  1388. foreach (Maid y in allocationMaidArray)
  1389. {
  1390. if (maid == y)
  1391. {
  1392. flag6 = false;
  1393. break;
  1394. }
  1395. }
  1396. }
  1397. if (flag6)
  1398. {
  1399. break;
  1400. }
  1401. }
  1402. }
  1403. }
  1404. if (flag6)
  1405. {
  1406. break;
  1407. }
  1408. }
  1409. if (!flag6)
  1410. {
  1411. ScheduleAPI.log("対象の施設が稼動していない");
  1412. return false;
  1413. }
  1414. }
  1415. }
  1416. if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara)
  1417. {
  1418. return false;
  1419. }
  1420. if (yotogi.condPersonal.Count > 0)
  1421. {
  1422. bool flag7 = false;
  1423. for (int num10 = 0; num10 < yotogi.condPersonal.Count; num10++)
  1424. {
  1425. if (maid.status.personal.id == yotogi.condPersonal[num10])
  1426. {
  1427. flag7 = true;
  1428. break;
  1429. }
  1430. }
  1431. if (!flag7)
  1432. {
  1433. return false;
  1434. }
  1435. }
  1436. if (yotogi.pairCondPersonal.Count > 0 && ScheduleAPI.GetNewYotogiHaremPairCandidateList(yotogi.pairCondPersonal, maid).Count <= 0)
  1437. {
  1438. return false;
  1439. }
  1440. if (yotogi.subMaidUnipueName != string.Empty)
  1441. {
  1442. if (maid.status.heroineType != HeroineType.Sub)
  1443. {
  1444. return false;
  1445. }
  1446. if (yotogi.subMaidUnipueName != maid.status.subCharaData.uniqueName)
  1447. {
  1448. return false;
  1449. }
  1450. return true;
  1451. }
  1452. else
  1453. {
  1454. if (maid.status.heroineType == HeroineType.Sub)
  1455. {
  1456. return false;
  1457. }
  1458. return true;
  1459. }
  1460. bool result;
  1461. return result;
  1462. }
  1463. return true;
  1464. }
  1465. private static int GetMaidFlag(Maid maid, string flagName)
  1466. {
  1467. if (DailyMgr.IsLegacy && maid.status.OldStatus.GetFlag(flagName) != 0)
  1468. {
  1469. return maid.status.OldStatus.GetFlag(flagName);
  1470. }
  1471. return maid.status.GetFlag(flagName);
  1472. }
  1473. public static void NightWorksStateErrorCheck(bool care = true)
  1474. {
  1475. foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
  1476. {
  1477. int key = keyValuePair.Key;
  1478. ScheduleCSVData.Yotogi value = keyValuePair.Value;
  1479. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(key);
  1480. if (nightWorksState != null)
  1481. {
  1482. if (!nightWorksState.finish)
  1483. {
  1484. bool flag = false;
  1485. if (value.yotogiType == ScheduleCSVData.YotogiType.VipCall)
  1486. {
  1487. string calledMaidGUID = nightWorksState.calledMaidGUID;
  1488. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(calledMaidGUID);
  1489. if (stockMaid == null)
  1490. {
  1491. flag = true;
  1492. }
  1493. else if (!ScheduleAPI.EnableNightWork(key, stockMaid, false, true))
  1494. {
  1495. flag = true;
  1496. }
  1497. }
  1498. if (flag)
  1499. {
  1500. GameMain.Instance.CharacterMgr.status.RemoveNightWorksState(key);
  1501. }
  1502. }
  1503. }
  1504. }
  1505. if (care)
  1506. {
  1507. ScheduleAPI.MaidWorkIdErrorCheck(care);
  1508. }
  1509. }
  1510. public static void SlotEmptyCheck()
  1511. {
  1512. bool flag = false;
  1513. for (int i = 0; i < 40; i++)
  1514. {
  1515. Maid maid = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1516. if (maid != null)
  1517. {
  1518. flag = true;
  1519. break;
  1520. }
  1521. }
  1522. if (!flag)
  1523. {
  1524. if (DailyMgr.IsLegacy)
  1525. {
  1526. for (int j = 0; j < GameMain.Instance.CharacterMgr.GetStockMaidCount(); j++)
  1527. {
  1528. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(j);
  1529. if (stockMaid != null && stockMaid.status.isCompatiblePersonality)
  1530. {
  1531. GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = stockMaid.status.guid;
  1532. break;
  1533. }
  1534. }
  1535. }
  1536. else
  1537. {
  1538. Maid maid = ScheduleAPI.GetStockMaidLeader();
  1539. if (maid != null)
  1540. {
  1541. GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = maid.status.guid;
  1542. }
  1543. else
  1544. {
  1545. for (int k = 0; k < GameMain.Instance.CharacterMgr.GetStockMaidCount(); k++)
  1546. {
  1547. Maid stockMaid2 = GameMain.Instance.CharacterMgr.GetStockMaid(k);
  1548. if (stockMaid2 != null)
  1549. {
  1550. GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = stockMaid2.status.guid;
  1551. break;
  1552. }
  1553. }
  1554. }
  1555. }
  1556. }
  1557. }
  1558. public static void MaidWorkIdErrorCheck(bool care = true)
  1559. {
  1560. ScheduleAPI.SlotEmptyCheck();
  1561. Maid noonTrainerMaid = ScheduleAPI.GetNoonTrainerMaid();
  1562. Maid nightTrainerMaid = ScheduleAPI.GetNightTrainerMaid();
  1563. Maid noonTraineeMaid = ScheduleAPI.GetNoonTraineeMaid();
  1564. Maid nightTraineeMaid = ScheduleAPI.GetNightTraineeMaid();
  1565. if ((noonTrainerMaid != nightTrainerMaid || noonTraineeMaid != nightTraineeMaid || noonTrainerMaid == null || nightTrainerMaid == null || !ScheduleAPI.CanTrainee(noonTraineeMaid) || !ScheduleAPI.CanTrainee(nightTraineeMaid)) && (noonTrainerMaid != null || nightTrainerMaid != null || noonTraineeMaid != null || nightTraineeMaid != null))
  1566. {
  1567. Debug.Log("MaidWorkIdErrorCheck:メイド研修の条件一致箇所があったためメイド研修をスロットから破棄します。");
  1568. if (noonTrainerMaid != null)
  1569. {
  1570. ScheduleAPI.WorkIdReset(noonTrainerMaid.status, ScheduleMgr.ScheduleTime.DayTime);
  1571. }
  1572. if (nightTrainerMaid != null)
  1573. {
  1574. ScheduleAPI.WorkIdReset(nightTrainerMaid.status, ScheduleMgr.ScheduleTime.Night);
  1575. }
  1576. if (noonTraineeMaid != null)
  1577. {
  1578. ScheduleAPI.WorkIdReset(noonTraineeMaid.status, ScheduleMgr.ScheduleTime.DayTime);
  1579. }
  1580. if (nightTraineeMaid != null)
  1581. {
  1582. ScheduleAPI.WorkIdReset(nightTraineeMaid.status, ScheduleMgr.ScheduleTime.Night);
  1583. }
  1584. }
  1585. int travelWorkId = ScheduleAPI.GetTravelWorkId();
  1586. int nightTravelWorkId = ScheduleAPI.GetNightTravelWorkId();
  1587. Maid maid = null;
  1588. for (int i = 0; i < 40; i++)
  1589. {
  1590. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1591. if (scheduleSlot != null && (scheduleSlot.status.noonWorkId == travelWorkId || scheduleSlot.status.nightWorkId == nightTravelWorkId))
  1592. {
  1593. if (maid == null && scheduleSlot.status.noonWorkId == travelWorkId && scheduleSlot.status.nightWorkId == nightTravelWorkId)
  1594. {
  1595. maid = scheduleSlot;
  1596. }
  1597. else
  1598. {
  1599. if (scheduleSlot.status.noonWorkId == travelWorkId)
  1600. {
  1601. ScheduleAPI.WorkIdReset(scheduleSlot.status, ScheduleMgr.ScheduleTime.DayTime);
  1602. }
  1603. if (scheduleSlot.status.nightWorkId == nightTravelWorkId)
  1604. {
  1605. ScheduleAPI.WorkIdReset(scheduleSlot.status, ScheduleMgr.ScheduleTime.Night);
  1606. }
  1607. }
  1608. }
  1609. }
  1610. if (maid != null)
  1611. {
  1612. for (int j = 0; j < 40; j++)
  1613. {
  1614. Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
  1615. if (scheduleSlot2 != null && scheduleSlot2 != maid && scheduleSlot2.status.nightWorkId != 0 && !ScheduleAPI.CheckNoProblemTravel(scheduleSlot2.status.nightWorkId))
  1616. {
  1617. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1618. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
  1619. break;
  1620. }
  1621. }
  1622. }
  1623. for (int k = 0; k < 40; k++)
  1624. {
  1625. Maid scheduleSlot3 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k);
  1626. if (scheduleSlot3 != null)
  1627. {
  1628. ScheduleAPI.MaidWorkIdErrorCheck(scheduleSlot3, care);
  1629. }
  1630. }
  1631. if (maid != null && maid.status.noonWorkId == travelWorkId && maid.status.nightWorkId == nightTravelWorkId)
  1632. {
  1633. int nightEntertainWorkId = ScheduleAPI.GetNightEntertainWorkId();
  1634. int nightRestWorkId = ScheduleAPI.GetNightRestWorkId();
  1635. for (int l = 0; l < 40; l++)
  1636. {
  1637. Maid scheduleSlot4 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(l);
  1638. if (scheduleSlot4 != null && scheduleSlot4 != maid && ScheduleCSVData.YotogiData.ContainsKey(scheduleSlot4.status.nightWorkId) && !ScheduleAPI.CheckNoProblemTravel(scheduleSlot4.status.nightWorkId))
  1639. {
  1640. if (scheduleSlot4.status.contract == Contract.Free)
  1641. {
  1642. scheduleSlot4.status.nightWorkId = nightRestWorkId;
  1643. }
  1644. else
  1645. {
  1646. scheduleSlot4.status.nightWorkId = nightEntertainWorkId;
  1647. }
  1648. }
  1649. }
  1650. }
  1651. }
  1652. private static void MaidWorkIdErrorCheck(Maid maid, bool care = true)
  1653. {
  1654. ScheduleAPI.SlotEmptyCheck();
  1655. ScheduleAPI.CheckTask(maid, ScheduleMgr.ScheduleTime.DayTime, care);
  1656. ScheduleAPI.CheckTask(maid, ScheduleMgr.ScheduleTime.Night, care);
  1657. if (care)
  1658. {
  1659. ScheduleAPI.EmptyToRandomWork(maid);
  1660. }
  1661. }
  1662. private static void CheckTask(Maid maid, ScheduleMgr.ScheduleTime time, bool care)
  1663. {
  1664. int num = 0;
  1665. if (time == ScheduleMgr.ScheduleTime.DayTime)
  1666. {
  1667. num = maid.status.noonWorkId;
  1668. }
  1669. else if (time == ScheduleMgr.ScheduleTime.Night)
  1670. {
  1671. num = maid.status.nightWorkId;
  1672. }
  1673. if (!ScheduleCSVData.AllData.ContainsKey(num))
  1674. {
  1675. return;
  1676. }
  1677. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num];
  1678. if ((DailyMgr.IsLegacy && scheduleBase.mode == ScheduleCSVData.ScheduleBase.Mode.COM3D) || (!DailyMgr.IsLegacy && scheduleBase.mode == ScheduleCSVData.ScheduleBase.Mode.CM3D2))
  1679. {
  1680. ScheduleAPI.WorkIdReset(maid.status, time);
  1681. return;
  1682. }
  1683. if (DailyMgr.IsLegacy && ((time == ScheduleMgr.ScheduleTime.DayTime && scheduleBase.type != ScheduleTaskCtrl.TaskType.Training) || (time == ScheduleMgr.ScheduleTime.Night && scheduleBase.type != ScheduleTaskCtrl.TaskType.Yotogi)))
  1684. {
  1685. ScheduleAPI.WorkIdReset(maid.status, time);
  1686. }
  1687. ScheduleTaskCtrl.TaskType type = scheduleBase.type;
  1688. if (type != ScheduleTaskCtrl.TaskType.Training)
  1689. {
  1690. if (type != ScheduleTaskCtrl.TaskType.Yotogi)
  1691. {
  1692. if (type == ScheduleTaskCtrl.TaskType.Work)
  1693. {
  1694. ScheduleAPI.CheckWork(maid, num, care, time);
  1695. }
  1696. }
  1697. else
  1698. {
  1699. ScheduleAPI.CheckYotogi(maid, num, time);
  1700. }
  1701. }
  1702. else
  1703. {
  1704. ScheduleAPI.CheckTraining(maid, num, care, time);
  1705. }
  1706. }
  1707. private static void CheckWork(Maid maid, int taskId, bool care, ScheduleMgr.ScheduleTime time)
  1708. {
  1709. if (ScheduleCSVData.WorkData.ContainsKey(taskId))
  1710. {
  1711. ScheduleCSVData.Work work = ScheduleCSVData.WorkData[taskId];
  1712. if (taskId != ScheduleCSVData.faclilityPowerUpWorkId)
  1713. {
  1714. Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(maid, time);
  1715. if (maidAssignedFacility == null || maidAssignedFacility.defaultData.workData.id != taskId)
  1716. {
  1717. ScheduleAPI.WorkIdReset(maid.status, time);
  1718. }
  1719. }
  1720. }
  1721. }
  1722. private static void CheckTraining(Maid maid, int taskId, bool care, ScheduleMgr.ScheduleTime time)
  1723. {
  1724. if (ScheduleCSVData.TrainingData.ContainsKey(taskId))
  1725. {
  1726. bool flag = false;
  1727. ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[taskId];
  1728. ScheduleCSVData.TrainingType trainingType = training.trainingType;
  1729. if (trainingType != ScheduleCSVData.TrainingType.Trainer)
  1730. {
  1731. if (trainingType != ScheduleCSVData.TrainingType.Trainee)
  1732. {
  1733. if (trainingType == ScheduleCSVData.TrainingType.Travel)
  1734. {
  1735. if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
  1736. {
  1737. flag = true;
  1738. }
  1739. if (!flag && ScheduleCSVData.YotogiData[maid.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Travel)
  1740. {
  1741. flag = true;
  1742. }
  1743. if (!flag)
  1744. {
  1745. int num = 0;
  1746. while (num < 40 && !flag)
  1747. {
  1748. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num);
  1749. if (!(scheduleSlot == maid))
  1750. {
  1751. 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)
  1752. {
  1753. flag = true;
  1754. }
  1755. }
  1756. num++;
  1757. }
  1758. }
  1759. if (flag)
  1760. {
  1761. ScheduleAPI.EmptyToRandomWork(maid);
  1762. }
  1763. }
  1764. }
  1765. else
  1766. {
  1767. if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
  1768. {
  1769. flag = true;
  1770. }
  1771. if (!flag && maid.status.noonWorkId != maid.status.nightWorkId)
  1772. {
  1773. flag = true;
  1774. }
  1775. if (flag)
  1776. {
  1777. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1778. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
  1779. for (int i = 0; i < 40; i++)
  1780. {
  1781. Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1782. if (scheduleSlot2 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot2.status.noonWorkId) && ScheduleCSVData.TrainingData[scheduleSlot2.status.noonWorkId].trainingType == ScheduleCSVData.TrainingType.Trainer)
  1783. {
  1784. ScheduleAPI.WorkIdReset(scheduleSlot2.status, ScheduleMgr.ScheduleTime.DayTime);
  1785. ScheduleAPI.WorkIdReset(scheduleSlot2.status, ScheduleMgr.ScheduleTime.Night);
  1786. if (care)
  1787. {
  1788. ScheduleAPI.EmptyToRandomWork(scheduleSlot2);
  1789. }
  1790. break;
  1791. }
  1792. }
  1793. }
  1794. }
  1795. }
  1796. else
  1797. {
  1798. if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
  1799. {
  1800. flag = true;
  1801. }
  1802. if (!flag && maid.status.noonWorkId != maid.status.nightWorkId)
  1803. {
  1804. flag = true;
  1805. }
  1806. bool flag2 = false;
  1807. for (int j = 0; j < 40; j++)
  1808. {
  1809. Maid scheduleSlot3 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
  1810. if (scheduleSlot3 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot3.status.noonWorkId))
  1811. {
  1812. ScheduleCSVData.Training training2 = ScheduleCSVData.TrainingData[scheduleSlot3.status.noonWorkId];
  1813. if (training2.trainingType == ScheduleCSVData.TrainingType.Trainee && scheduleSlot3.status.noonWorkId == scheduleSlot3.status.nightWorkId)
  1814. {
  1815. flag2 = true;
  1816. break;
  1817. }
  1818. }
  1819. }
  1820. if (!flag2)
  1821. {
  1822. flag = true;
  1823. }
  1824. if (flag)
  1825. {
  1826. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1827. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
  1828. if (care)
  1829. {
  1830. ScheduleAPI.EmptyToRandomWork(maid);
  1831. }
  1832. for (int k = 0; k < 40; k++)
  1833. {
  1834. Maid scheduleSlot4 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k);
  1835. if (scheduleSlot4 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot4.status.noonWorkId) && ScheduleCSVData.TrainingData[scheduleSlot4.status.noonWorkId].trainingType == ScheduleCSVData.TrainingType.Trainee)
  1836. {
  1837. ScheduleAPI.WorkIdReset(scheduleSlot4.status, ScheduleMgr.ScheduleTime.DayTime);
  1838. ScheduleAPI.WorkIdReset(scheduleSlot4.status, ScheduleMgr.ScheduleTime.Night);
  1839. if (care)
  1840. {
  1841. ScheduleAPI.EmptyToRandomWork(scheduleSlot4);
  1842. }
  1843. break;
  1844. }
  1845. }
  1846. }
  1847. }
  1848. }
  1849. else
  1850. {
  1851. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1852. }
  1853. }
  1854. private static void CheckYotogi(Maid maid, int taskId, ScheduleMgr.ScheduleTime time)
  1855. {
  1856. if (ScheduleCSVData.YotogiData.ContainsKey(taskId))
  1857. {
  1858. bool flag = false;
  1859. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[taskId];
  1860. if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall))
  1861. {
  1862. if (maid != null)
  1863. {
  1864. if (!ScheduleAPI.VisibleNightWork(taskId, maid, true))
  1865. {
  1866. flag = true;
  1867. }
  1868. }
  1869. else if (!ScheduleAPI.VisibleNightWork(taskId, null, true))
  1870. {
  1871. flag = true;
  1872. }
  1873. }
  1874. if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall))
  1875. {
  1876. for (int i = 0; i < 40; i++)
  1877. {
  1878. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1879. if (scheduleSlot != null && scheduleSlot != maid && (taskId == scheduleSlot.status.noonWorkId || taskId == scheduleSlot.status.nightWorkId))
  1880. {
  1881. flag = true;
  1882. break;
  1883. }
  1884. }
  1885. }
  1886. 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))
  1887. {
  1888. flag = true;
  1889. }
  1890. if (flag)
  1891. {
  1892. ScheduleAPI.WorkIdReset(maid.status, time);
  1893. }
  1894. }
  1895. else
  1896. {
  1897. ScheduleAPI.WorkIdReset(maid.status, time);
  1898. }
  1899. }
  1900. private static void WorkIdReset(MaidStatus.Status maidStatus, ScheduleMgr.ScheduleTime time)
  1901. {
  1902. if (time == ScheduleMgr.ScheduleTime.DayTime)
  1903. {
  1904. maidStatus.noonWorkId = 0;
  1905. }
  1906. else if (time == ScheduleMgr.ScheduleTime.Night)
  1907. {
  1908. maidStatus.nightWorkId = 0;
  1909. }
  1910. }
  1911. public static void ScheduleErrorAllCheck()
  1912. {
  1913. ScheduleAPI.SlotEmptyCheck();
  1914. ScheduleAPI.NightWorksStateErrorCheck(false);
  1915. ScheduleAPI.MaidWorkIdErrorCheck(false);
  1916. for (int i = 0; i < 40; i++)
  1917. {
  1918. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1919. if (scheduleSlot != null)
  1920. {
  1921. ScheduleAPI.EmptyToRandomWork(scheduleSlot);
  1922. }
  1923. }
  1924. }
  1925. public static void DayStartManage()
  1926. {
  1927. bool flag = false;
  1928. int travelWorkId = ScheduleAPI.GetTravelWorkId();
  1929. int num = 0;
  1930. while (num < 40 && !flag)
  1931. {
  1932. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num);
  1933. if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId)
  1934. {
  1935. flag = true;
  1936. }
  1937. num++;
  1938. }
  1939. if (flag)
  1940. {
  1941. ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[travelWorkId];
  1942. foreach (int key in training.needEventItemIdList)
  1943. {
  1944. if (Shop.item_data_dic.ContainsKey(key) && Shop.item_data_dic[key].type == Shop.ItemDataBase.Type.Event)
  1945. {
  1946. Shop.ItemDataEvent itemDataEvent = Shop.item_data_dic[key] as Shop.ItemDataEvent;
  1947. itemDataEvent.Reset();
  1948. }
  1949. }
  1950. }
  1951. if (DailyMgr.IsLegacy)
  1952. {
  1953. GameMain.Instance.CharacterMgr.status.ApplyScheduleSlotBackup(ScheduleSlotBackup.Type.CM3D2);
  1954. }
  1955. else
  1956. {
  1957. GameMain.Instance.CharacterMgr.status.ApplyScheduleSlotBackup(ScheduleSlotBackup.Type.COM3D);
  1958. }
  1959. ScheduleAPI.ErrorCheck();
  1960. GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Noon_Resulted", 0);
  1961. GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Night_Resulted", 0);
  1962. ScheduleAPI.BackupParam(SCENE_ID.Start);
  1963. }
  1964. public static void ErrorCheck()
  1965. {
  1966. ScheduleAPI.SlotEmptyCheck();
  1967. ScheduleAPI.NightWorksStateErrorCheck(false);
  1968. ScheduleAPI.OccurNightWork();
  1969. ScheduleAPI.MaidWorkIdErrorCheck(false);
  1970. int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount();
  1971. for (int i = 0; i < stockMaidCount; i++)
  1972. {
  1973. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
  1974. ScheduleAPI.EmptyToRandomWork(stockMaid);
  1975. }
  1976. }
  1977. public static void ThroughNoonResult()
  1978. {
  1979. if (GameMain.Instance.CharacterMgr.status.GetFlag("_Schedule_Noon_Resulted") > 0)
  1980. {
  1981. return;
  1982. }
  1983. GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Noon_Resulted", 1);
  1984. for (int i = 0; i < 40; i++)
  1985. {
  1986. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1987. if (scheduleSlot != null)
  1988. {
  1989. GameMain.Instance.CharacterMgr.status.scheduleSlot[i].noon_success_level = ScheduleData.WorkSuccessLv.Miss;
  1990. BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.Morning);
  1991. BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.Noon);
  1992. BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.NoonBonus);
  1993. }
  1994. }
  1995. }
  1996. public static int NoonWorkPlayCount(Maid maid, int workId)
  1997. {
  1998. if (maid.status.workDatas.ContainsKey(workId))
  1999. {
  2000. return (int)maid.status.workDatas.Get(workId).playCount;
  2001. }
  2002. return 0;
  2003. }
  2004. public static int NoonWorkPlayToLv(int noonWorkPlayCount)
  2005. {
  2006. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp)
  2007. {
  2008. return 1;
  2009. }
  2010. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp)
  2011. {
  2012. return 2;
  2013. }
  2014. return 3;
  2015. }
  2016. public static float NoonWorkPlayExpRatio(int noonWorkPlayCount)
  2017. {
  2018. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp)
  2019. {
  2020. return (float)noonWorkPlayCount / (float)ScheduleCSVData.noonWorkLv2Exp;
  2021. }
  2022. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp)
  2023. {
  2024. return (float)(noonWorkPlayCount - ScheduleCSVData.noonWorkLv2Exp) / (float)ScheduleCSVData.noonWorkLv3Exp;
  2025. }
  2026. return 0f;
  2027. }
  2028. public static int NoonWorkLvToRevision(int lv)
  2029. {
  2030. return (lv - 1) * 10;
  2031. }
  2032. public static bool EmptyToRandomWork(Maid maid)
  2033. {
  2034. bool result = false;
  2035. if (maid.status.noonWorkId == 0)
  2036. {
  2037. int num = ScheduleAPI.NoonWorkRandom(maid);
  2038. maid.status.noonWorkId = num;
  2039. result = true;
  2040. ScheduleAPI.AddTrainingFacility(maid, num, ScheduleMgr.ScheduleTime.DayTime);
  2041. if (maid.status.heroineType == HeroineType.Sub)
  2042. {
  2043. ScheduleAPI.SubMaidDefaultFacility(maid, num, ScheduleMgr.ScheduleTime.DayTime);
  2044. }
  2045. }
  2046. if (maid.status.nightWorkId == 0)
  2047. {
  2048. int num = ScheduleAPI.NightWorkRandom(maid);
  2049. maid.status.nightWorkId = num;
  2050. result = true;
  2051. ScheduleAPI.AddTrainingFacility(maid, num, ScheduleMgr.ScheduleTime.Night);
  2052. if (maid.status.heroineType == HeroineType.Sub)
  2053. {
  2054. ScheduleAPI.SubMaidDefaultFacility(maid, num, ScheduleMgr.ScheduleTime.Night);
  2055. }
  2056. }
  2057. return result;
  2058. }
  2059. public static int NoonWorkRandom(Maid maid)
  2060. {
  2061. if (maid.status.heroineType == HeroineType.Sub)
  2062. {
  2063. return ScheduleCSVData.subMaidInitTaskId;
  2064. }
  2065. Dictionary<int, int> db;
  2066. if (DailyMgr.IsLegacy)
  2067. {
  2068. db = ScheduleCSVData.NoonWorkInitDataLegacy[maid.status.personal.id];
  2069. }
  2070. else
  2071. {
  2072. db = ScheduleCSVData.NoonWorkInitData[maid.status.personal.id];
  2073. }
  2074. return ScheduleAPI.WorkRandom(db);
  2075. }
  2076. public static int NightWorkRandom(Maid maid)
  2077. {
  2078. if (maid.status.heroineType == HeroineType.Sub)
  2079. {
  2080. return ScheduleCSVData.subMaidInitTaskId;
  2081. }
  2082. Dictionary<int, int> db = ScheduleCSVData.NightWorkInitData[maid.status.personal.id];
  2083. return ScheduleAPI.WorkRandom(db);
  2084. }
  2085. public static void FacilitySlotReset(string maidGuid, ScheduleMgr.ScheduleTime time)
  2086. {
  2087. Maid maid = ScheduleAPI.IsSlotInMaid(maidGuid);
  2088. if (maid == null)
  2089. {
  2090. return;
  2091. }
  2092. if (time == ScheduleMgr.ScheduleTime.DayTime)
  2093. {
  2094. maid.status.noonWorkId = 0;
  2095. }
  2096. else if (time == ScheduleMgr.ScheduleTime.Night)
  2097. {
  2098. maid.status.nightWorkId = 0;
  2099. }
  2100. }
  2101. public static void AddTrainingFacility(Maid maid, int workId, ScheduleMgr.ScheduleTime time)
  2102. {
  2103. if (DailyMgr.IsLegacy)
  2104. {
  2105. return;
  2106. }
  2107. if (!ScheduleCSVData.TrainingData.ContainsKey(workId))
  2108. {
  2109. return;
  2110. }
  2111. ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[workId];
  2112. if (training.trainingType != ScheduleCSVData.TrainingType.Basic)
  2113. {
  2114. return;
  2115. }
  2116. Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
  2117. foreach (Facility facility in facilityArray)
  2118. {
  2119. if (!(facility == null))
  2120. {
  2121. if (facility.defaultData.ID == training.facilityId)
  2122. {
  2123. facility.AllocationMaid(maid, time);
  2124. return;
  2125. }
  2126. }
  2127. }
  2128. }
  2129. public static void SubMaidDefaultFacility(Maid maid, int workId, ScheduleMgr.ScheduleTime time)
  2130. {
  2131. if (DailyMgr.IsLegacy || maid.status.heroineType != HeroineType.Sub || !ScheduleCSVData.WorkData.ContainsKey(workId))
  2132. {
  2133. return;
  2134. }
  2135. ScheduleCSVData.Work work = ScheduleCSVData.WorkData[workId];
  2136. Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
  2137. foreach (Facility facility in facilityArray)
  2138. {
  2139. if (facility.defaultData.ID == work.facility.ID)
  2140. {
  2141. facility.AllocationMaid(maid, time);
  2142. return;
  2143. }
  2144. }
  2145. }
  2146. public static bool FacilitySlotActive(string maidGuid, Facility facility, ScheduleMgr.ScheduleTime time)
  2147. {
  2148. Maid maid = ScheduleAPI.IsSlotInMaid(maidGuid);
  2149. if (maid == null)
  2150. {
  2151. return false;
  2152. }
  2153. int key = 0;
  2154. if (time == ScheduleMgr.ScheduleTime.DayTime)
  2155. {
  2156. key = maid.status.noonWorkId;
  2157. }
  2158. if (time == ScheduleMgr.ScheduleTime.Night)
  2159. {
  2160. key = maid.status.nightWorkId;
  2161. }
  2162. if (ScheduleCSVData.AllData.ContainsKey(key))
  2163. {
  2164. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key];
  2165. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work)
  2166. {
  2167. ScheduleCSVData.Work work = (ScheduleCSVData.Work)scheduleBase;
  2168. if (work.facility == facility.defaultData && work.facilityId != ScheduleCSVData.faclilityPowerUpWorkId)
  2169. {
  2170. return true;
  2171. }
  2172. }
  2173. else if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Training)
  2174. {
  2175. ScheduleCSVData.Training training = (ScheduleCSVData.Training)scheduleBase;
  2176. if (training.facilityId == facility.defaultData.ID)
  2177. {
  2178. return true;
  2179. }
  2180. }
  2181. }
  2182. return false;
  2183. }
  2184. private static Maid IsSlotInMaid(string maidGuid)
  2185. {
  2186. for (int i = 0; i < 40; i++)
  2187. {
  2188. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  2189. if (scheduleSlot != null && scheduleSlot.status.guid == maidGuid)
  2190. {
  2191. return scheduleSlot;
  2192. }
  2193. }
  2194. return null;
  2195. }
  2196. public static bool CanTrainee(Maid maid)
  2197. {
  2198. if (maid == null)
  2199. {
  2200. return false;
  2201. }
  2202. int num = 0;
  2203. for (int i = 0; i < 40; i++)
  2204. {
  2205. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  2206. if (scheduleSlot != null)
  2207. {
  2208. num++;
  2209. }
  2210. }
  2211. return num >= 3 && maid.status.studyRate >= 50;
  2212. }
  2213. private static int WorkRandom(Dictionary<int, int> db)
  2214. {
  2215. if (db.Count == 0)
  2216. {
  2217. Debug.LogWarning("ScheduleAPI.WorkRandom:傾向情報がありませんでした。0を返します。");
  2218. return 0;
  2219. }
  2220. int num = 0;
  2221. foreach (KeyValuePair<int, int> keyValuePair in db)
  2222. {
  2223. num += keyValuePair.Value;
  2224. }
  2225. int num2 = UnityEngine.Random.Range(0, num);
  2226. foreach (KeyValuePair<int, int> keyValuePair2 in db)
  2227. {
  2228. num2 -= keyValuePair2.Value;
  2229. if (num2 < 0)
  2230. {
  2231. return keyValuePair2.Key;
  2232. }
  2233. }
  2234. Debug.LogWarning("ScheduleAPI.WorkRandom:本来通過するはずの無い箇所です。");
  2235. return 0;
  2236. }
  2237. public static string InfoReplace(int nightWorkId, string info)
  2238. {
  2239. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(nightWorkId);
  2240. if (nightWorksState != null)
  2241. {
  2242. string calledMaidGUID = nightWorksState.calledMaidGUID;
  2243. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(calledMaidGUID);
  2244. if (stockMaid != null)
  2245. {
  2246. info = info.Replace("[HF]", stockMaid.status.firstName);
  2247. }
  2248. }
  2249. return info;
  2250. }
  2251. private static List<Maid> GetNightWorkMeetMaidList(int workId, bool calledTargetCheck = false)
  2252. {
  2253. List<Maid> list = new List<Maid>();
  2254. int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount();
  2255. for (int i = 0; i < stockMaidCount; i++)
  2256. {
  2257. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
  2258. if (ScheduleAPI.EnableNightWork(workId, stockMaid, calledTargetCheck, true))
  2259. {
  2260. list.Add(stockMaid);
  2261. }
  2262. }
  2263. return list;
  2264. }
  2265. public static void OccurNightWork()
  2266. {
  2267. foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
  2268. {
  2269. ScheduleCSVData.Yotogi value = keyValuePair.Value;
  2270. ScheduleCSVData.YotogiType yotogiType = value.yotogiType;
  2271. if (yotogiType != ScheduleCSVData.YotogiType.Vip)
  2272. {
  2273. if (yotogiType == ScheduleCSVData.YotogiType.VipCall)
  2274. {
  2275. if (GameMain.Instance.CharacterMgr.status.GetNightWorksState(value.id) == null && ScheduleAPI.EnableNightWork(value.id, null, true, true))
  2276. {
  2277. List<Maid> nightWorkMeetMaidList = ScheduleAPI.GetNightWorkMeetMaidList(value.id, false);
  2278. if (nightWorkMeetMaidList.Count > 0)
  2279. {
  2280. NightWorkState nightWorkState = new NightWorkState();
  2281. nightWorkState.finish = false;
  2282. nightWorkState.workId = keyValuePair.Key;
  2283. int index = UnityEngine.Random.Range(0, nightWorkMeetMaidList.Count - 1);
  2284. nightWorkState.calledMaidGUID = nightWorkMeetMaidList[index].status.guid;
  2285. GameMain.Instance.CharacterMgr.status.AddNightWorksState(nightWorkState);
  2286. }
  2287. }
  2288. }
  2289. }
  2290. else if (GameMain.Instance.CharacterMgr.status.GetNightWorksState(value.id) == null && ScheduleAPI.EnableNightWork(value.id, null, true, true))
  2291. {
  2292. NightWorkState nightWorkState2 = new NightWorkState();
  2293. nightWorkState2.finish = false;
  2294. nightWorkState2.workId = keyValuePair.Key;
  2295. nightWorkState2.calledMaidGUID = null;
  2296. GameMain.Instance.CharacterMgr.status.AddNightWorksState(nightWorkState2);
  2297. }
  2298. }
  2299. }
  2300. public static List<string> logs = new List<string>();
  2301. public static bool logOutput = false;
  2302. public const string NOON_RESULTED_GENERAL_FLAG = "_Schedule_Noon_Resulted";
  2303. public const string NIGHT_RESULTED_GENERAL_FLAG = "_Schedule_Night_Resulted";
  2304. public class TrainingResultSimulateParam
  2305. {
  2306. public int study_rate;
  2307. public int reception;
  2308. public int care;
  2309. public int lovely;
  2310. public int elegance;
  2311. public int charm;
  2312. public int teach_rate;
  2313. public int exp;
  2314. public int cooking;
  2315. public int vocal;
  2316. public int dance;
  2317. public int appealPoint;
  2318. public int inyoku;
  2319. public int mvalue;
  2320. public int hentai;
  2321. public int housi;
  2322. public int income;
  2323. public int commandExp;
  2324. }
  2325. public class YotogiResultSimulateParam
  2326. {
  2327. public int income;
  2328. public int evaluation;
  2329. public int playNumber;
  2330. public int otherPlayNumber;
  2331. public int study_rate;
  2332. public int reception;
  2333. public int care;
  2334. public int teach_rate;
  2335. public int inyoku;
  2336. public int mvalue;
  2337. public int hentai;
  2338. public int housi;
  2339. }
  2340. }
  2341. }