ScheduleAPI.cs 71 KB

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