ScheduleAPI.cs 73 KB

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