ScheduleAPI.cs 74 KB

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