ScheduleAPI.cs 70 KB

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