ScheduleAPI.cs 74 KB

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