ScheduleAPI.cs 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537
  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 (PersonalEventBlocker.IsEnabledScheduleTask(stockMaid.status.personal, workData.id))
  570. {
  571. if (excludeMaid.IsCrcBody == stockMaid.IsCrcBody)
  572. {
  573. int count = list.Count;
  574. if (workData.id == 10072 && workData.isCheckGP002Personal)
  575. {
  576. 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))
  577. {
  578. list.Add(stockMaid);
  579. }
  580. }
  581. else if (stockMaid.status.seikeiken == Seikeiken.Yes_Yes && stockMaid.status.relation >= Relation.Lover && condPersonalIds.Contains(stockMaid.status.personal.id))
  582. {
  583. if (workData.isCheckGP002Personal)
  584. {
  585. if (PluginData.IsEnabledForGP002Personal(stockMaid.status.personal.uniqueName))
  586. {
  587. list.Add(stockMaid);
  588. }
  589. }
  590. else
  591. {
  592. list.Add(stockMaid);
  593. }
  594. }
  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. if ((training.isNewBodyBlock && maid.IsCrcBody) || !training.CheckMainHeroineBodyTypeMatch(maid))
  1076. {
  1077. return false;
  1078. }
  1079. }
  1080. return true;
  1081. }
  1082. public static bool VisibleNightWork(int workId, Maid maid = null, bool checkFinish = true)
  1083. {
  1084. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
  1085. switch (yotogi.yotogiType)
  1086. {
  1087. case ScheduleCSVData.YotogiType.Vip:
  1088. case ScheduleCSVData.YotogiType.VipCall:
  1089. {
  1090. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId);
  1091. if (nightWorksState == null)
  1092. {
  1093. return false;
  1094. }
  1095. if (checkFinish && nightWorksState.finish)
  1096. {
  1097. if (DailyMgr.IsLegacy)
  1098. {
  1099. return false;
  1100. }
  1101. if (GameMain.Instance.CharacterMgr.status.clubGrade < 5)
  1102. {
  1103. return false;
  1104. }
  1105. if (GameMain.Instance.CharacterMgr.status.days < ScheduleCSVData.vipFullOpenDay)
  1106. {
  1107. return false;
  1108. }
  1109. }
  1110. break;
  1111. }
  1112. case ScheduleCSVData.YotogiType.Travel:
  1113. return false;
  1114. case ScheduleCSVData.YotogiType.EasyYotogi:
  1115. {
  1116. if (yotogi.easyYotogi == null)
  1117. {
  1118. return false;
  1119. }
  1120. int trophyId = yotogi.easyYotogi.trophyId;
  1121. if (!GameMain.Instance.CharacterMgr.status.IsHaveTrophy(trophyId))
  1122. {
  1123. return false;
  1124. }
  1125. break;
  1126. }
  1127. }
  1128. if (yotogi.condPackage.Count > 0)
  1129. {
  1130. for (int i = 0; i < ScheduleCSVData.YotogiData[workId].condPackage.Count; i++)
  1131. {
  1132. if (!PluginData.IsEnabled(ScheduleCSVData.YotogiData[workId].condPackage[i]))
  1133. {
  1134. return false;
  1135. }
  1136. }
  1137. }
  1138. if (yotogi.condManVisibleFlag1.Count > 0)
  1139. {
  1140. for (int j = 0; j < yotogi.condManVisibleFlag1.Count; j++)
  1141. {
  1142. if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManVisibleFlag1[j]) < 1)
  1143. {
  1144. return false;
  1145. }
  1146. }
  1147. }
  1148. if (maid != null)
  1149. {
  1150. if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara)
  1151. {
  1152. return false;
  1153. }
  1154. if (yotogi.condPersonal.Count > 0)
  1155. {
  1156. bool flag = false;
  1157. for (int k = 0; k < yotogi.condPersonal.Count; k++)
  1158. {
  1159. if (maid.status.personal.id == yotogi.condPersonal[k])
  1160. {
  1161. flag = true;
  1162. break;
  1163. }
  1164. }
  1165. if (!flag)
  1166. {
  1167. return false;
  1168. }
  1169. }
  1170. if (yotogi.subMaidUnipueName != string.Empty)
  1171. {
  1172. if (maid.status.heroineType != HeroineType.Sub)
  1173. {
  1174. return false;
  1175. }
  1176. if (yotogi.subMaidUnipueName != maid.status.subCharaData.uniqueName)
  1177. {
  1178. return false;
  1179. }
  1180. }
  1181. else if (maid.status.heroineType == HeroineType.Sub)
  1182. {
  1183. return false;
  1184. }
  1185. if ((yotogi.isNewBodyBlock && maid.IsCrcBody) || !yotogi.CheckMainHeroineBodyTypeMatch(maid))
  1186. {
  1187. return false;
  1188. }
  1189. }
  1190. return true;
  1191. }
  1192. public static bool EnableNightWork(int workId, Maid maid = null, bool calledTargetCheck = true, bool withMaid = true)
  1193. {
  1194. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
  1195. if (yotogi.condPackage.Count > 0)
  1196. {
  1197. for (int i = 0; i < yotogi.condPackage.Count; i++)
  1198. {
  1199. if (!PluginData.IsEnabled(yotogi.condPackage[i]))
  1200. {
  1201. return false;
  1202. }
  1203. }
  1204. }
  1205. if (yotogi.condSalonGrade > GameMain.Instance.CharacterMgr.status.clubGrade)
  1206. {
  1207. return false;
  1208. }
  1209. if (yotogi.easyYotogi != null)
  1210. {
  1211. int trophyId = yotogi.easyYotogi.trophyId;
  1212. if (!GameMain.Instance.CharacterMgr.status.IsHaveTrophy(trophyId))
  1213. {
  1214. return false;
  1215. }
  1216. }
  1217. if (!DailyMgr.IsLegacy && yotogi.mode == ScheduleCSVData.ScheduleBase.Mode.CM3D2)
  1218. {
  1219. return false;
  1220. }
  1221. if (DailyMgr.IsLegacy && yotogi.mode == ScheduleCSVData.ScheduleBase.Mode.COM3D)
  1222. {
  1223. return false;
  1224. }
  1225. if (maid != null)
  1226. {
  1227. if (yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall && calledTargetCheck && !ScheduleAPI.VipCalledMaid(workId, maid))
  1228. {
  1229. return false;
  1230. }
  1231. foreach (KeyValuePair<int, int> keyValuePair in yotogi.condSkill)
  1232. {
  1233. if (!maid.status.yotogiSkill.Contains(keyValuePair.Key))
  1234. {
  1235. return false;
  1236. }
  1237. YotogiSkillData yotogiSkillData = maid.status.yotogiSkill.Get(keyValuePair.Key);
  1238. if (keyValuePair.Value > yotogiSkillData.level)
  1239. {
  1240. return false;
  1241. }
  1242. }
  1243. if (yotogi.condMaidClass.Count > 0)
  1244. {
  1245. for (int j = 0; j < yotogi.condMaidClass.Count; j++)
  1246. {
  1247. if (!maid.status.jobClass.Contains(yotogi.condMaidClass[j]))
  1248. {
  1249. return false;
  1250. }
  1251. }
  1252. }
  1253. if (yotogi.condYotogiClass.Count > 0)
  1254. {
  1255. for (int k = 0; k < yotogi.condYotogiClass.Count; k++)
  1256. {
  1257. if (!maid.status.yotogiClass.Contains(yotogi.condYotogiClass[k]))
  1258. {
  1259. return false;
  1260. }
  1261. }
  1262. }
  1263. if (yotogi.condPropensity.Count > 0)
  1264. {
  1265. bool flag = false;
  1266. for (int l = 0; l < yotogi.condPropensity.Count; l++)
  1267. {
  1268. if (maid.status.propensitys.ContainsKey(yotogi.condPropensity[l]))
  1269. {
  1270. flag = true;
  1271. break;
  1272. }
  1273. }
  1274. if (!flag)
  1275. {
  1276. return false;
  1277. }
  1278. }
  1279. if (yotogi.condSeikeiken.Count > 0)
  1280. {
  1281. bool flag2 = false;
  1282. for (int m = 0; m < yotogi.condSeikeiken.Count; m++)
  1283. {
  1284. if (yotogi.condSeikeiken[m] == maid.status.seikeiken)
  1285. {
  1286. flag2 = true;
  1287. break;
  1288. }
  1289. }
  1290. if (!flag2)
  1291. {
  1292. return false;
  1293. }
  1294. }
  1295. if (yotogi.condFlag1.Count > 0)
  1296. {
  1297. for (int n = 0; n < yotogi.condFlag1.Count; n++)
  1298. {
  1299. if (ScheduleAPI.GetMaidFlag(maid, yotogi.condFlag1[n]) < 1)
  1300. {
  1301. return false;
  1302. }
  1303. }
  1304. }
  1305. if (yotogi.condFlag0.Count > 0)
  1306. {
  1307. for (int num = 0; num < yotogi.condFlag0.Count; num++)
  1308. {
  1309. if (ScheduleAPI.GetMaidFlag(maid, yotogi.condFlag0[num]) > 0)
  1310. {
  1311. return false;
  1312. }
  1313. }
  1314. }
  1315. if (DailyMgr.IsLegacy)
  1316. {
  1317. if (yotogi.condRelationOld.Count > 0)
  1318. {
  1319. bool flag3 = false;
  1320. for (int num2 = 0; num2 < yotogi.condRelationOld.Count; num2++)
  1321. {
  1322. if (yotogi.condRelationOld[num2] == maid.status.OldStatus.relation)
  1323. {
  1324. flag3 = true;
  1325. break;
  1326. }
  1327. }
  1328. if (!flag3)
  1329. {
  1330. return false;
  1331. }
  1332. }
  1333. }
  1334. else
  1335. {
  1336. if (yotogi.condRelation.Count > 0)
  1337. {
  1338. bool flag4 = false;
  1339. for (int num3 = 0; num3 < yotogi.condRelation.Count; num3++)
  1340. {
  1341. if (yotogi.condRelation[num3] == maid.status.relation)
  1342. {
  1343. flag4 = true;
  1344. break;
  1345. }
  1346. }
  1347. if (!flag4)
  1348. {
  1349. return false;
  1350. }
  1351. }
  1352. if (yotogi.condAdditionalRelation.Count > 0)
  1353. {
  1354. bool flag5 = false;
  1355. for (int num4 = 0; num4 < yotogi.condAdditionalRelation.Count; num4++)
  1356. {
  1357. if (yotogi.condAdditionalRelation[num4] == maid.status.additionalRelation)
  1358. {
  1359. flag5 = true;
  1360. break;
  1361. }
  1362. }
  1363. if (!flag5)
  1364. {
  1365. return false;
  1366. }
  1367. }
  1368. if (yotogi.condSpecialRelation.Count > 0)
  1369. {
  1370. bool flag6 = false;
  1371. for (int num5 = 0; num5 < yotogi.condSpecialRelation.Count; num5++)
  1372. {
  1373. if (yotogi.condSpecialRelation[num5] == maid.status.specialRelation)
  1374. {
  1375. flag6 = true;
  1376. break;
  1377. }
  1378. }
  1379. if (!flag6)
  1380. {
  1381. return false;
  1382. }
  1383. }
  1384. }
  1385. if (yotogi.condManFlag1.Count > 0)
  1386. {
  1387. for (int num6 = 0; num6 < yotogi.condManFlag1.Count; num6++)
  1388. {
  1389. if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag1[num6]) < 1)
  1390. {
  1391. return false;
  1392. }
  1393. }
  1394. }
  1395. if (yotogi.condManFlag0.Count > 0)
  1396. {
  1397. for (int num7 = 0; num7 < yotogi.condManFlag0.Count; num7++)
  1398. {
  1399. if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag0[num7]) > 0)
  1400. {
  1401. return false;
  1402. }
  1403. }
  1404. }
  1405. if (yotogi.condContract.Count > 0)
  1406. {
  1407. bool flag7 = false;
  1408. for (int num8 = 0; num8 < yotogi.condContract.Count; num8++)
  1409. {
  1410. if (yotogi.condContract[num8] == maid.status.contract)
  1411. {
  1412. flag7 = true;
  1413. break;
  1414. }
  1415. }
  1416. if (!flag7)
  1417. {
  1418. return false;
  1419. }
  1420. }
  1421. if (yotogi.condFacilityID.Count > 0)
  1422. {
  1423. foreach (List<int> list in yotogi.condFacilityID)
  1424. {
  1425. bool flag8 = false;
  1426. foreach (int num9 in list)
  1427. {
  1428. Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
  1429. foreach (Facility facility in facilityArray)
  1430. {
  1431. ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  1432. if (withMaid)
  1433. {
  1434. if (yotogi.id == maid.status.noonWorkId)
  1435. {
  1436. scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
  1437. }
  1438. else if (yotogi.id == maid.status.nightWorkId)
  1439. {
  1440. scheduleTime = ScheduleMgr.ScheduleTime.Night;
  1441. }
  1442. }
  1443. else
  1444. {
  1445. scheduleTime = ScheduleTaskViewer.ScheduleTime;
  1446. }
  1447. if (!(facility == null) && facility.defaultData.ID == num9)
  1448. {
  1449. if (facility.IsOperation(scheduleTime))
  1450. {
  1451. flag8 = true;
  1452. Maid[] allocationMaidArray = facility.GetAllocationMaidArray(scheduleTime);
  1453. if (allocationMaidArray != null && allocationMaidArray.Length == facility.minMaidCount)
  1454. {
  1455. foreach (Maid y in allocationMaidArray)
  1456. {
  1457. if (maid == y)
  1458. {
  1459. flag8 = false;
  1460. break;
  1461. }
  1462. }
  1463. }
  1464. if (flag8)
  1465. {
  1466. break;
  1467. }
  1468. }
  1469. }
  1470. }
  1471. if (flag8)
  1472. {
  1473. break;
  1474. }
  1475. }
  1476. if (!flag8)
  1477. {
  1478. ScheduleAPI.log("対象の施設が稼動していない");
  1479. return false;
  1480. }
  1481. }
  1482. }
  1483. if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara)
  1484. {
  1485. return false;
  1486. }
  1487. if (yotogi.condPersonal.Count > 0)
  1488. {
  1489. bool flag9 = false;
  1490. for (int num12 = 0; num12 < yotogi.condPersonal.Count; num12++)
  1491. {
  1492. if (maid.status.personal.id == yotogi.condPersonal[num12])
  1493. {
  1494. flag9 = (!yotogi.isCheckGP002Personal || PluginData.IsEnabledForGP002Personal(maid.status.personal.uniqueName));
  1495. break;
  1496. }
  1497. }
  1498. if (!flag9)
  1499. {
  1500. return false;
  1501. }
  1502. }
  1503. if (yotogi.pairCondPersonal.Count > 0)
  1504. {
  1505. if (ScheduleAPI.GetNewYotogiHaremPairCandidateList(yotogi, yotogi.pairCondPersonal, maid).Count <= 0)
  1506. {
  1507. return false;
  1508. }
  1509. }
  1510. else if (yotogi.isCheckBodyType && maid.IsCrcBody)
  1511. {
  1512. return false;
  1513. }
  1514. if ((yotogi.isNewBodyBlock && maid.IsCrcBody) || !yotogi.CheckMainHeroineBodyTypeMatch(maid))
  1515. {
  1516. return false;
  1517. }
  1518. if (yotogi.subMaidUnipueName != string.Empty)
  1519. {
  1520. if (maid.status.heroineType != HeroineType.Sub)
  1521. {
  1522. return false;
  1523. }
  1524. if (yotogi.subMaidUnipueName != maid.status.subCharaData.uniqueName)
  1525. {
  1526. return false;
  1527. }
  1528. return true;
  1529. }
  1530. else
  1531. {
  1532. if (maid.status.heroineType == HeroineType.Sub)
  1533. {
  1534. return false;
  1535. }
  1536. return true;
  1537. }
  1538. bool result;
  1539. return result;
  1540. }
  1541. return true;
  1542. }
  1543. private static int GetMaidFlag(Maid maid, string flagName)
  1544. {
  1545. if (DailyMgr.IsLegacy && maid.status.OldStatus.GetFlag(flagName) != 0)
  1546. {
  1547. return maid.status.OldStatus.GetFlag(flagName);
  1548. }
  1549. return maid.status.GetFlag(flagName);
  1550. }
  1551. public static void NightWorksStateErrorCheck(bool care = true)
  1552. {
  1553. foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
  1554. {
  1555. int key = keyValuePair.Key;
  1556. ScheduleCSVData.Yotogi value = keyValuePair.Value;
  1557. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(key);
  1558. if (nightWorksState != null)
  1559. {
  1560. if (!nightWorksState.finish)
  1561. {
  1562. bool flag = false;
  1563. if (value.yotogiType == ScheduleCSVData.YotogiType.VipCall)
  1564. {
  1565. string calledMaidGUID = nightWorksState.calledMaidGUID;
  1566. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(calledMaidGUID);
  1567. if (stockMaid == null)
  1568. {
  1569. flag = true;
  1570. }
  1571. else if (!ScheduleAPI.EnableNightWork(key, stockMaid, false, true))
  1572. {
  1573. flag = true;
  1574. }
  1575. }
  1576. if (flag)
  1577. {
  1578. GameMain.Instance.CharacterMgr.status.RemoveNightWorksState(key);
  1579. }
  1580. }
  1581. }
  1582. }
  1583. if (care)
  1584. {
  1585. ScheduleAPI.MaidWorkIdErrorCheck(care);
  1586. }
  1587. }
  1588. public static void SlotEmptyCheck()
  1589. {
  1590. bool flag = false;
  1591. for (int i = 0; i < 40; i++)
  1592. {
  1593. Maid maid = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1594. if (maid != null)
  1595. {
  1596. flag = true;
  1597. break;
  1598. }
  1599. }
  1600. if (!flag)
  1601. {
  1602. if (DailyMgr.IsLegacy)
  1603. {
  1604. for (int j = 0; j < GameMain.Instance.CharacterMgr.GetStockMaidCount(); j++)
  1605. {
  1606. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(j);
  1607. if (stockMaid != null && stockMaid.status.isCompatiblePersonality)
  1608. {
  1609. GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = stockMaid.status.guid;
  1610. break;
  1611. }
  1612. }
  1613. }
  1614. else
  1615. {
  1616. Maid maid = ScheduleAPI.GetStockMaidLeader();
  1617. if (maid != null)
  1618. {
  1619. GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = maid.status.guid;
  1620. }
  1621. else
  1622. {
  1623. for (int k = 0; k < GameMain.Instance.CharacterMgr.GetStockMaidCount(); k++)
  1624. {
  1625. Maid stockMaid2 = GameMain.Instance.CharacterMgr.GetStockMaid(k);
  1626. if (stockMaid2 != null)
  1627. {
  1628. GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = stockMaid2.status.guid;
  1629. break;
  1630. }
  1631. }
  1632. }
  1633. }
  1634. }
  1635. }
  1636. public static void MaidWorkIdErrorCheck(bool care = true)
  1637. {
  1638. ScheduleAPI.SlotEmptyCheck();
  1639. Maid noonTrainerMaid = ScheduleAPI.GetNoonTrainerMaid();
  1640. Maid nightTrainerMaid = ScheduleAPI.GetNightTrainerMaid();
  1641. Maid noonTraineeMaid = ScheduleAPI.GetNoonTraineeMaid();
  1642. Maid nightTraineeMaid = ScheduleAPI.GetNightTraineeMaid();
  1643. if ((noonTrainerMaid != nightTrainerMaid || noonTraineeMaid != nightTraineeMaid || noonTrainerMaid == null || nightTrainerMaid == null || !ScheduleAPI.CanTrainee(noonTraineeMaid) || !ScheduleAPI.CanTrainee(nightTraineeMaid)) && (noonTrainerMaid != null || nightTrainerMaid != null || noonTraineeMaid != null || nightTraineeMaid != null))
  1644. {
  1645. Debug.Log("MaidWorkIdErrorCheck:メイド研修の条件一致箇所があったためメイド研修をスロットから破棄します。");
  1646. if (noonTrainerMaid != null)
  1647. {
  1648. ScheduleAPI.WorkIdReset(noonTrainerMaid.status, ScheduleMgr.ScheduleTime.DayTime);
  1649. }
  1650. if (nightTrainerMaid != null)
  1651. {
  1652. ScheduleAPI.WorkIdReset(nightTrainerMaid.status, ScheduleMgr.ScheduleTime.Night);
  1653. }
  1654. if (noonTraineeMaid != null)
  1655. {
  1656. ScheduleAPI.WorkIdReset(noonTraineeMaid.status, ScheduleMgr.ScheduleTime.DayTime);
  1657. }
  1658. if (nightTraineeMaid != null)
  1659. {
  1660. ScheduleAPI.WorkIdReset(nightTraineeMaid.status, ScheduleMgr.ScheduleTime.Night);
  1661. }
  1662. }
  1663. int travelWorkId = ScheduleAPI.GetTravelWorkId();
  1664. int nightTravelWorkId = ScheduleAPI.GetNightTravelWorkId();
  1665. Maid maid = null;
  1666. for (int i = 0; i < 40; i++)
  1667. {
  1668. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1669. if (scheduleSlot != null && (scheduleSlot.status.noonWorkId == travelWorkId || scheduleSlot.status.nightWorkId == nightTravelWorkId))
  1670. {
  1671. if (maid == null && scheduleSlot.status.noonWorkId == travelWorkId && scheduleSlot.status.nightWorkId == nightTravelWorkId)
  1672. {
  1673. maid = scheduleSlot;
  1674. }
  1675. else
  1676. {
  1677. if (scheduleSlot.status.noonWorkId == travelWorkId)
  1678. {
  1679. ScheduleAPI.WorkIdReset(scheduleSlot.status, ScheduleMgr.ScheduleTime.DayTime);
  1680. }
  1681. if (scheduleSlot.status.nightWorkId == nightTravelWorkId)
  1682. {
  1683. ScheduleAPI.WorkIdReset(scheduleSlot.status, ScheduleMgr.ScheduleTime.Night);
  1684. }
  1685. }
  1686. }
  1687. }
  1688. if (maid != null)
  1689. {
  1690. for (int j = 0; j < 40; j++)
  1691. {
  1692. Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
  1693. if (scheduleSlot2 != null && scheduleSlot2 != maid && scheduleSlot2.status.nightWorkId != 0 && !ScheduleAPI.CheckNoProblemTravel(scheduleSlot2.status.nightWorkId))
  1694. {
  1695. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1696. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
  1697. break;
  1698. }
  1699. }
  1700. }
  1701. for (int k = 0; k < 40; k++)
  1702. {
  1703. Maid scheduleSlot3 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k);
  1704. if (scheduleSlot3 != null)
  1705. {
  1706. ScheduleAPI.MaidWorkIdErrorCheck(scheduleSlot3, care);
  1707. }
  1708. }
  1709. if (maid != null && maid.status.noonWorkId == travelWorkId && maid.status.nightWorkId == nightTravelWorkId)
  1710. {
  1711. int nightEntertainWorkId = ScheduleAPI.GetNightEntertainWorkId();
  1712. int nightRestWorkId = ScheduleAPI.GetNightRestWorkId();
  1713. for (int l = 0; l < 40; l++)
  1714. {
  1715. Maid scheduleSlot4 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(l);
  1716. if (scheduleSlot4 != null && scheduleSlot4 != maid && ScheduleCSVData.YotogiData.ContainsKey(scheduleSlot4.status.nightWorkId) && !ScheduleAPI.CheckNoProblemTravel(scheduleSlot4.status.nightWorkId))
  1717. {
  1718. if (scheduleSlot4.status.contract == Contract.Free)
  1719. {
  1720. scheduleSlot4.status.nightWorkId = nightRestWorkId;
  1721. }
  1722. else
  1723. {
  1724. scheduleSlot4.status.nightWorkId = nightEntertainWorkId;
  1725. }
  1726. }
  1727. }
  1728. }
  1729. }
  1730. private static void MaidWorkIdErrorCheck(Maid maid, bool care = true)
  1731. {
  1732. ScheduleAPI.SlotEmptyCheck();
  1733. ScheduleAPI.CheckTask(maid, ScheduleMgr.ScheduleTime.DayTime, care);
  1734. ScheduleAPI.CheckTask(maid, ScheduleMgr.ScheduleTime.Night, care);
  1735. if (care)
  1736. {
  1737. ScheduleAPI.EmptyToRandomWork(maid);
  1738. }
  1739. }
  1740. private static void CheckTask(Maid maid, ScheduleMgr.ScheduleTime time, bool care)
  1741. {
  1742. int num = 0;
  1743. if (time == ScheduleMgr.ScheduleTime.DayTime)
  1744. {
  1745. num = maid.status.noonWorkId;
  1746. }
  1747. else if (time == ScheduleMgr.ScheduleTime.Night)
  1748. {
  1749. num = maid.status.nightWorkId;
  1750. }
  1751. if (!ScheduleCSVData.AllData.ContainsKey(num))
  1752. {
  1753. return;
  1754. }
  1755. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num];
  1756. if ((DailyMgr.IsLegacy && scheduleBase.mode == ScheduleCSVData.ScheduleBase.Mode.COM3D) || (!DailyMgr.IsLegacy && scheduleBase.mode == ScheduleCSVData.ScheduleBase.Mode.CM3D2))
  1757. {
  1758. ScheduleAPI.WorkIdReset(maid.status, time);
  1759. return;
  1760. }
  1761. if (DailyMgr.IsLegacy && ((time == ScheduleMgr.ScheduleTime.DayTime && scheduleBase.type != ScheduleTaskCtrl.TaskType.Training) || (time == ScheduleMgr.ScheduleTime.Night && scheduleBase.type != ScheduleTaskCtrl.TaskType.Yotogi)))
  1762. {
  1763. ScheduleAPI.WorkIdReset(maid.status, time);
  1764. }
  1765. ScheduleTaskCtrl.TaskType type = scheduleBase.type;
  1766. if (type != ScheduleTaskCtrl.TaskType.Training)
  1767. {
  1768. if (type != ScheduleTaskCtrl.TaskType.Yotogi)
  1769. {
  1770. if (type == ScheduleTaskCtrl.TaskType.Work)
  1771. {
  1772. ScheduleAPI.CheckWork(maid, num, care, time);
  1773. }
  1774. }
  1775. else
  1776. {
  1777. ScheduleAPI.CheckYotogi(maid, num, time);
  1778. }
  1779. }
  1780. else
  1781. {
  1782. ScheduleAPI.CheckTraining(maid, num, care, time);
  1783. }
  1784. }
  1785. private static void CheckWork(Maid maid, int taskId, bool care, ScheduleMgr.ScheduleTime time)
  1786. {
  1787. if (ScheduleCSVData.WorkData.ContainsKey(taskId))
  1788. {
  1789. ScheduleCSVData.Work work = ScheduleCSVData.WorkData[taskId];
  1790. if (taskId != ScheduleCSVData.faclilityPowerUpWorkId)
  1791. {
  1792. Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(maid, time);
  1793. if (maidAssignedFacility == null || maidAssignedFacility.defaultData.workData.id != taskId)
  1794. {
  1795. ScheduleAPI.WorkIdReset(maid.status, time);
  1796. }
  1797. }
  1798. if (maid != null && ((work.isNewBodyBlock && maid.IsCrcBody) || !work.CheckMainHeroineBodyTypeMatch(maid)))
  1799. {
  1800. ScheduleAPI.WorkIdReset(maid.status, time);
  1801. GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
  1802. }
  1803. }
  1804. }
  1805. private static void CheckTraining(Maid maid, int taskId, bool care, ScheduleMgr.ScheduleTime time)
  1806. {
  1807. if (ScheduleCSVData.TrainingData.ContainsKey(taskId))
  1808. {
  1809. bool flag = false;
  1810. ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[taskId];
  1811. switch (training.trainingType)
  1812. {
  1813. case ScheduleCSVData.TrainingType.Basic:
  1814. if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
  1815. {
  1816. flag = true;
  1817. }
  1818. if (flag)
  1819. {
  1820. ScheduleAPI.EmptyToRandomWork(maid);
  1821. }
  1822. break;
  1823. case ScheduleCSVData.TrainingType.Trainer:
  1824. {
  1825. if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
  1826. {
  1827. flag = true;
  1828. }
  1829. if (!flag && maid.status.noonWorkId != maid.status.nightWorkId)
  1830. {
  1831. flag = true;
  1832. }
  1833. bool flag2 = false;
  1834. for (int i = 0; i < 40; i++)
  1835. {
  1836. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1837. if (scheduleSlot != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot.status.noonWorkId))
  1838. {
  1839. ScheduleCSVData.Training training2 = ScheduleCSVData.TrainingData[scheduleSlot.status.noonWorkId];
  1840. if (training2.trainingType == ScheduleCSVData.TrainingType.Trainee && scheduleSlot.status.noonWorkId == scheduleSlot.status.nightWorkId)
  1841. {
  1842. flag2 = true;
  1843. break;
  1844. }
  1845. }
  1846. }
  1847. if (!flag2)
  1848. {
  1849. flag = true;
  1850. }
  1851. if (flag)
  1852. {
  1853. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1854. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
  1855. if (care)
  1856. {
  1857. ScheduleAPI.EmptyToRandomWork(maid);
  1858. }
  1859. for (int j = 0; j < 40; j++)
  1860. {
  1861. Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
  1862. if (scheduleSlot2 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot2.status.noonWorkId) && ScheduleCSVData.TrainingData[scheduleSlot2.status.noonWorkId].trainingType == ScheduleCSVData.TrainingType.Trainee)
  1863. {
  1864. ScheduleAPI.WorkIdReset(scheduleSlot2.status, ScheduleMgr.ScheduleTime.DayTime);
  1865. ScheduleAPI.WorkIdReset(scheduleSlot2.status, ScheduleMgr.ScheduleTime.Night);
  1866. if (care)
  1867. {
  1868. ScheduleAPI.EmptyToRandomWork(scheduleSlot2);
  1869. }
  1870. break;
  1871. }
  1872. }
  1873. }
  1874. break;
  1875. }
  1876. case ScheduleCSVData.TrainingType.Trainee:
  1877. if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
  1878. {
  1879. flag = true;
  1880. }
  1881. if (!flag && maid.status.noonWorkId != maid.status.nightWorkId)
  1882. {
  1883. flag = true;
  1884. }
  1885. if (flag)
  1886. {
  1887. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1888. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
  1889. for (int k = 0; k < 40; k++)
  1890. {
  1891. Maid scheduleSlot3 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k);
  1892. if (scheduleSlot3 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot3.status.noonWorkId) && ScheduleCSVData.TrainingData[scheduleSlot3.status.noonWorkId].trainingType == ScheduleCSVData.TrainingType.Trainer)
  1893. {
  1894. ScheduleAPI.WorkIdReset(scheduleSlot3.status, ScheduleMgr.ScheduleTime.DayTime);
  1895. ScheduleAPI.WorkIdReset(scheduleSlot3.status, ScheduleMgr.ScheduleTime.Night);
  1896. if (care)
  1897. {
  1898. ScheduleAPI.EmptyToRandomWork(scheduleSlot3);
  1899. }
  1900. break;
  1901. }
  1902. }
  1903. }
  1904. break;
  1905. case ScheduleCSVData.TrainingType.Travel:
  1906. if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
  1907. {
  1908. flag = true;
  1909. }
  1910. if (!flag && ScheduleCSVData.YotogiData[maid.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Travel)
  1911. {
  1912. flag = true;
  1913. }
  1914. if (!flag)
  1915. {
  1916. int num = 0;
  1917. while (num < 40 && !flag)
  1918. {
  1919. Maid scheduleSlot4 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num);
  1920. if (!(scheduleSlot4 == maid))
  1921. {
  1922. if (scheduleSlot4 != null && ScheduleCSVData.YotogiData.ContainsKey(scheduleSlot4.status.nightWorkId) && ScheduleCSVData.YotogiData[scheduleSlot4.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Entertain && ScheduleCSVData.YotogiData[scheduleSlot4.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Rest)
  1923. {
  1924. flag = true;
  1925. }
  1926. }
  1927. num++;
  1928. }
  1929. }
  1930. if (flag)
  1931. {
  1932. ScheduleAPI.EmptyToRandomWork(maid);
  1933. }
  1934. break;
  1935. }
  1936. }
  1937. else
  1938. {
  1939. ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
  1940. }
  1941. }
  1942. private static void CheckYotogi(Maid maid, int taskId, ScheduleMgr.ScheduleTime time)
  1943. {
  1944. if (ScheduleCSVData.YotogiData.ContainsKey(taskId))
  1945. {
  1946. bool flag = false;
  1947. ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[taskId];
  1948. if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall))
  1949. {
  1950. if (maid != null)
  1951. {
  1952. if (!ScheduleAPI.VisibleNightWork(taskId, maid, true))
  1953. {
  1954. flag = true;
  1955. }
  1956. }
  1957. else if (!ScheduleAPI.VisibleNightWork(taskId, null, true))
  1958. {
  1959. flag = true;
  1960. }
  1961. }
  1962. if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall))
  1963. {
  1964. for (int i = 0; i < 40; i++)
  1965. {
  1966. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  1967. if (scheduleSlot != null && scheduleSlot != maid && (taskId == scheduleSlot.status.noonWorkId || taskId == scheduleSlot.status.nightWorkId))
  1968. {
  1969. flag = true;
  1970. break;
  1971. }
  1972. }
  1973. }
  1974. 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))
  1975. {
  1976. flag = true;
  1977. }
  1978. if (flag)
  1979. {
  1980. ScheduleAPI.WorkIdReset(maid.status, time);
  1981. }
  1982. }
  1983. else
  1984. {
  1985. ScheduleAPI.WorkIdReset(maid.status, time);
  1986. }
  1987. }
  1988. private static void WorkIdReset(MaidStatus.Status maidStatus, ScheduleMgr.ScheduleTime time)
  1989. {
  1990. if (time == ScheduleMgr.ScheduleTime.DayTime)
  1991. {
  1992. maidStatus.noonWorkId = 0;
  1993. }
  1994. else if (time == ScheduleMgr.ScheduleTime.Night)
  1995. {
  1996. maidStatus.nightWorkId = 0;
  1997. }
  1998. }
  1999. public static void ScheduleErrorAllCheck()
  2000. {
  2001. ScheduleAPI.SlotEmptyCheck();
  2002. ScheduleAPI.NightWorksStateErrorCheck(false);
  2003. ScheduleAPI.MaidWorkIdErrorCheck(false);
  2004. for (int i = 0; i < 40; i++)
  2005. {
  2006. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  2007. if (scheduleSlot != null)
  2008. {
  2009. ScheduleAPI.EmptyToRandomWork(scheduleSlot);
  2010. }
  2011. }
  2012. }
  2013. public static void DayStartManage()
  2014. {
  2015. bool flag = false;
  2016. int travelWorkId = ScheduleAPI.GetTravelWorkId();
  2017. int num = 0;
  2018. while (num < 40 && !flag)
  2019. {
  2020. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num);
  2021. if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId)
  2022. {
  2023. flag = true;
  2024. }
  2025. num++;
  2026. }
  2027. if (flag)
  2028. {
  2029. ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[travelWorkId];
  2030. foreach (int key in training.needEventItemIdList)
  2031. {
  2032. if (Shop.item_data_dic.ContainsKey(key) && Shop.item_data_dic[key].type == Shop.ItemDataBase.Type.Event)
  2033. {
  2034. Shop.ItemDataEvent itemDataEvent = Shop.item_data_dic[key] as Shop.ItemDataEvent;
  2035. itemDataEvent.Reset();
  2036. }
  2037. }
  2038. }
  2039. if (DailyMgr.IsLegacy)
  2040. {
  2041. GameMain.Instance.CharacterMgr.status.ApplyScheduleSlotBackup(ScheduleSlotBackup.Type.CM3D2);
  2042. }
  2043. else
  2044. {
  2045. GameMain.Instance.CharacterMgr.status.ApplyScheduleSlotBackup(ScheduleSlotBackup.Type.COM3D);
  2046. }
  2047. ScheduleAPI.ErrorCheck();
  2048. GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Noon_Resulted", 0);
  2049. GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Night_Resulted", 0);
  2050. ScheduleAPI.BackupParam(SCENE_ID.Start);
  2051. }
  2052. public static void ErrorCheck()
  2053. {
  2054. ScheduleAPI.SlotEmptyCheck();
  2055. ScheduleAPI.NightWorksStateErrorCheck(false);
  2056. ScheduleAPI.OccurNightWork();
  2057. ScheduleAPI.MaidWorkIdErrorCheck(false);
  2058. int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount();
  2059. for (int i = 0; i < stockMaidCount; i++)
  2060. {
  2061. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
  2062. ScheduleAPI.EmptyToRandomWork(stockMaid);
  2063. }
  2064. }
  2065. public static void ThroughNoonResult()
  2066. {
  2067. if (GameMain.Instance.CharacterMgr.status.GetFlag("_Schedule_Noon_Resulted") > 0)
  2068. {
  2069. return;
  2070. }
  2071. GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Noon_Resulted", 1);
  2072. for (int i = 0; i < 40; i++)
  2073. {
  2074. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  2075. if (scheduleSlot != null)
  2076. {
  2077. GameMain.Instance.CharacterMgr.status.scheduleSlot[i].noon_success_level = ScheduleData.WorkSuccessLv.Miss;
  2078. BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.Morning);
  2079. BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.Noon);
  2080. BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.NoonBonus);
  2081. }
  2082. }
  2083. }
  2084. public static int NoonWorkPlayCount(Maid maid, int workId)
  2085. {
  2086. if (maid.status.workDatas.ContainsKey(workId))
  2087. {
  2088. return (int)maid.status.workDatas.Get(workId).playCount;
  2089. }
  2090. return 0;
  2091. }
  2092. public static int NoonWorkPlayToLv(int noonWorkPlayCount)
  2093. {
  2094. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp)
  2095. {
  2096. return 1;
  2097. }
  2098. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp)
  2099. {
  2100. return 2;
  2101. }
  2102. return 3;
  2103. }
  2104. public static float NoonWorkPlayExpRatio(int noonWorkPlayCount)
  2105. {
  2106. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp)
  2107. {
  2108. return (float)noonWorkPlayCount / (float)ScheduleCSVData.noonWorkLv2Exp;
  2109. }
  2110. if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp)
  2111. {
  2112. return (float)(noonWorkPlayCount - ScheduleCSVData.noonWorkLv2Exp) / (float)ScheduleCSVData.noonWorkLv3Exp;
  2113. }
  2114. return 0f;
  2115. }
  2116. public static int NoonWorkLvToRevision(int lv)
  2117. {
  2118. return (lv - 1) * 10;
  2119. }
  2120. public static bool EmptyToRandomWork(Maid maid)
  2121. {
  2122. bool result = false;
  2123. if (maid.status.noonWorkId == 0)
  2124. {
  2125. int num = ScheduleAPI.NoonWorkRandom(maid);
  2126. maid.status.noonWorkId = num;
  2127. result = true;
  2128. ScheduleAPI.AddTrainingFacility(maid, num, ScheduleMgr.ScheduleTime.DayTime);
  2129. if (maid.status.heroineType == HeroineType.Sub)
  2130. {
  2131. ScheduleAPI.SubMaidDefaultFacility(maid, num, ScheduleMgr.ScheduleTime.DayTime);
  2132. }
  2133. }
  2134. if (maid.status.nightWorkId == 0)
  2135. {
  2136. int num = ScheduleAPI.NightWorkRandom(maid);
  2137. maid.status.nightWorkId = num;
  2138. result = true;
  2139. ScheduleAPI.AddTrainingFacility(maid, num, ScheduleMgr.ScheduleTime.Night);
  2140. if (maid.status.heroineType == HeroineType.Sub)
  2141. {
  2142. ScheduleAPI.SubMaidDefaultFacility(maid, num, ScheduleMgr.ScheduleTime.Night);
  2143. }
  2144. }
  2145. return result;
  2146. }
  2147. public static int NoonWorkRandom(Maid maid)
  2148. {
  2149. if (maid.status.heroineType == HeroineType.Sub)
  2150. {
  2151. return ScheduleCSVData.subMaidInitTaskId;
  2152. }
  2153. Dictionary<int, int> db;
  2154. if (DailyMgr.IsLegacy)
  2155. {
  2156. db = ScheduleCSVData.NoonWorkInitDataLegacy[maid.status.personal.id];
  2157. }
  2158. else
  2159. {
  2160. db = ScheduleCSVData.NoonWorkInitData[maid.status.personal.id];
  2161. }
  2162. return ScheduleAPI.WorkRandom(db);
  2163. }
  2164. public static int NightWorkRandom(Maid maid)
  2165. {
  2166. if (maid.status.heroineType == HeroineType.Sub)
  2167. {
  2168. return ScheduleCSVData.subMaidInitTaskId;
  2169. }
  2170. Dictionary<int, int> db = ScheduleCSVData.NightWorkInitData[maid.status.personal.id];
  2171. return ScheduleAPI.WorkRandom(db);
  2172. }
  2173. public static void FacilitySlotReset(string maidGuid, ScheduleMgr.ScheduleTime time)
  2174. {
  2175. Maid maid = ScheduleAPI.IsSlotInMaid(maidGuid);
  2176. if (maid == null)
  2177. {
  2178. return;
  2179. }
  2180. if (time == ScheduleMgr.ScheduleTime.DayTime)
  2181. {
  2182. maid.status.noonWorkId = 0;
  2183. }
  2184. else if (time == ScheduleMgr.ScheduleTime.Night)
  2185. {
  2186. maid.status.nightWorkId = 0;
  2187. }
  2188. }
  2189. public static void AddTrainingFacility(Maid maid, int workId, ScheduleMgr.ScheduleTime time)
  2190. {
  2191. if (DailyMgr.IsLegacy)
  2192. {
  2193. return;
  2194. }
  2195. if (!ScheduleCSVData.TrainingData.ContainsKey(workId))
  2196. {
  2197. return;
  2198. }
  2199. ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[workId];
  2200. if (training.trainingType != ScheduleCSVData.TrainingType.Basic)
  2201. {
  2202. return;
  2203. }
  2204. Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
  2205. foreach (Facility facility in facilityArray)
  2206. {
  2207. if (!(facility == null))
  2208. {
  2209. if (facility.defaultData.ID == training.facilityId)
  2210. {
  2211. facility.AllocationMaid(maid, time);
  2212. return;
  2213. }
  2214. }
  2215. }
  2216. }
  2217. public static void SubMaidDefaultFacility(Maid maid, int workId, ScheduleMgr.ScheduleTime time)
  2218. {
  2219. if (DailyMgr.IsLegacy || maid.status.heroineType != HeroineType.Sub || !ScheduleCSVData.WorkData.ContainsKey(workId))
  2220. {
  2221. return;
  2222. }
  2223. ScheduleCSVData.Work work = ScheduleCSVData.WorkData[workId];
  2224. Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
  2225. foreach (Facility facility in facilityArray)
  2226. {
  2227. if (facility.defaultData.ID == work.facility.ID)
  2228. {
  2229. facility.AllocationMaid(maid, time);
  2230. return;
  2231. }
  2232. }
  2233. }
  2234. public static bool FacilitySlotActive(string maidGuid, Facility facility, ScheduleMgr.ScheduleTime time)
  2235. {
  2236. Maid maid = ScheduleAPI.IsSlotInMaid(maidGuid);
  2237. if (maid == null)
  2238. {
  2239. return false;
  2240. }
  2241. int key = 0;
  2242. if (time == ScheduleMgr.ScheduleTime.DayTime)
  2243. {
  2244. key = maid.status.noonWorkId;
  2245. }
  2246. if (time == ScheduleMgr.ScheduleTime.Night)
  2247. {
  2248. key = maid.status.nightWorkId;
  2249. }
  2250. if (ScheduleCSVData.AllData.ContainsKey(key))
  2251. {
  2252. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key];
  2253. if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work)
  2254. {
  2255. ScheduleCSVData.Work work = (ScheduleCSVData.Work)scheduleBase;
  2256. if (work.facility == facility.defaultData && work.facilityId != ScheduleCSVData.faclilityPowerUpWorkId)
  2257. {
  2258. return true;
  2259. }
  2260. }
  2261. else if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Training)
  2262. {
  2263. ScheduleCSVData.Training training = (ScheduleCSVData.Training)scheduleBase;
  2264. if (training.facilityId == facility.defaultData.ID)
  2265. {
  2266. return true;
  2267. }
  2268. }
  2269. }
  2270. return false;
  2271. }
  2272. private static Maid IsSlotInMaid(string maidGuid)
  2273. {
  2274. for (int i = 0; i < 40; i++)
  2275. {
  2276. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  2277. if (scheduleSlot != null && scheduleSlot.status.guid == maidGuid)
  2278. {
  2279. return scheduleSlot;
  2280. }
  2281. }
  2282. return null;
  2283. }
  2284. public static bool CanTrainee(Maid maid)
  2285. {
  2286. if (maid == null)
  2287. {
  2288. return false;
  2289. }
  2290. int num = 0;
  2291. for (int i = 0; i < 40; i++)
  2292. {
  2293. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  2294. if (scheduleSlot != null)
  2295. {
  2296. num++;
  2297. }
  2298. }
  2299. return num >= 3 && maid.status.studyRate >= 50;
  2300. }
  2301. private static int WorkRandom(Dictionary<int, int> db)
  2302. {
  2303. if (db.Count == 0)
  2304. {
  2305. Debug.LogWarning("ScheduleAPI.WorkRandom:傾向情報がありませんでした。0を返します。");
  2306. return 0;
  2307. }
  2308. int num = 0;
  2309. foreach (KeyValuePair<int, int> keyValuePair in db)
  2310. {
  2311. num += keyValuePair.Value;
  2312. }
  2313. int num2 = UnityEngine.Random.Range(0, num);
  2314. foreach (KeyValuePair<int, int> keyValuePair2 in db)
  2315. {
  2316. num2 -= keyValuePair2.Value;
  2317. if (num2 < 0)
  2318. {
  2319. return keyValuePair2.Key;
  2320. }
  2321. }
  2322. Debug.LogWarning("ScheduleAPI.WorkRandom:本来通過するはずの無い箇所です。");
  2323. return 0;
  2324. }
  2325. public static string InfoReplace(int nightWorkId, string info)
  2326. {
  2327. NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(nightWorkId);
  2328. if (nightWorksState != null)
  2329. {
  2330. string calledMaidGUID = nightWorksState.calledMaidGUID;
  2331. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(calledMaidGUID);
  2332. if (stockMaid != null)
  2333. {
  2334. info = info.Replace("[HF]", stockMaid.status.firstName);
  2335. }
  2336. }
  2337. return info;
  2338. }
  2339. private static List<Maid> GetNightWorkMeetMaidList(int workId, bool calledTargetCheck = false)
  2340. {
  2341. List<Maid> list = new List<Maid>();
  2342. int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount();
  2343. for (int i = 0; i < stockMaidCount; i++)
  2344. {
  2345. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
  2346. if (ScheduleAPI.EnableNightWork(workId, stockMaid, calledTargetCheck, true))
  2347. {
  2348. list.Add(stockMaid);
  2349. }
  2350. }
  2351. return list;
  2352. }
  2353. public static void OccurNightWork()
  2354. {
  2355. foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
  2356. {
  2357. ScheduleCSVData.Yotogi value = keyValuePair.Value;
  2358. ScheduleCSVData.YotogiType yotogiType = value.yotogiType;
  2359. if (yotogiType != ScheduleCSVData.YotogiType.Vip)
  2360. {
  2361. if (yotogiType == ScheduleCSVData.YotogiType.VipCall)
  2362. {
  2363. if (GameMain.Instance.CharacterMgr.status.GetNightWorksState(value.id) == null && ScheduleAPI.EnableNightWork(value.id, null, true, true))
  2364. {
  2365. List<Maid> nightWorkMeetMaidList = ScheduleAPI.GetNightWorkMeetMaidList(value.id, false);
  2366. if (nightWorkMeetMaidList.Count > 0)
  2367. {
  2368. NightWorkState nightWorkState = new NightWorkState();
  2369. nightWorkState.finish = false;
  2370. nightWorkState.workId = keyValuePair.Key;
  2371. int index = UnityEngine.Random.Range(0, nightWorkMeetMaidList.Count - 1);
  2372. nightWorkState.calledMaidGUID = nightWorkMeetMaidList[index].status.guid;
  2373. GameMain.Instance.CharacterMgr.status.AddNightWorksState(nightWorkState);
  2374. }
  2375. }
  2376. }
  2377. }
  2378. else if (GameMain.Instance.CharacterMgr.status.GetNightWorksState(value.id) == null && ScheduleAPI.EnableNightWork(value.id, null, true, true))
  2379. {
  2380. NightWorkState nightWorkState2 = new NightWorkState();
  2381. nightWorkState2.finish = false;
  2382. nightWorkState2.workId = keyValuePair.Key;
  2383. nightWorkState2.calledMaidGUID = null;
  2384. GameMain.Instance.CharacterMgr.status.AddNightWorksState(nightWorkState2);
  2385. }
  2386. }
  2387. }
  2388. public static List<string> logs = new List<string>();
  2389. public static bool logOutput = false;
  2390. public const string NOON_RESULTED_GENERAL_FLAG = "_Schedule_Noon_Resulted";
  2391. public const string NIGHT_RESULTED_GENERAL_FLAG = "_Schedule_Night_Resulted";
  2392. public class TrainingResultSimulateParam
  2393. {
  2394. public int study_rate;
  2395. public int reception;
  2396. public int care;
  2397. public int lovely;
  2398. public int elegance;
  2399. public int charm;
  2400. public int teach_rate;
  2401. public int exp;
  2402. public int cooking;
  2403. public int vocal;
  2404. public int dance;
  2405. public int appealPoint;
  2406. public int inyoku;
  2407. public int mvalue;
  2408. public int hentai;
  2409. public int housi;
  2410. public int income;
  2411. public int commandExp;
  2412. }
  2413. public class YotogiResultSimulateParam
  2414. {
  2415. public int income;
  2416. public int evaluation;
  2417. public int playNumber;
  2418. public int otherPlayNumber;
  2419. public int study_rate;
  2420. public int reception;
  2421. public int care;
  2422. public int teach_rate;
  2423. public int inyoku;
  2424. public int mvalue;
  2425. public int hentai;
  2426. public int housi;
  2427. }
  2428. }
  2429. }