Status.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using MaidStatus;
  5. using UnityEngine;
  6. using wf;
  7. namespace PlayerStatus
  8. {
  9. public class Status
  10. {
  11. public Status()
  12. {
  13. Shop.CreateData();
  14. Trophy.CreateData();
  15. this.playerName_ = MaidRandomName.GetPlayerName();
  16. this.clubName_ = "エンパイアクラブ";
  17. if (Product.isEnglish)
  18. {
  19. this.clubName_ = "EmpireClub";
  20. }
  21. this.flags_ = new Dictionary<string, int>();
  22. this.flags = new ReadOnlyDictionary<string, int>(this.flags_);
  23. this.havePartsItems_ = new Dictionary<string, bool>();
  24. this.havePartsItems = new ReadOnlyDictionary<string, bool>(this.havePartsItems_);
  25. this.haveItems_ = new Dictionary<string, bool>();
  26. this.haveItems = new ReadOnlyDictionary<string, bool>(this.haveItems_);
  27. this.shopLineups_ = new Dictionary<int, ShopItemStatus>();
  28. this.shopLineups = new ReadOnlyDictionary<int, ShopItemStatus>(this.shopLineups_);
  29. this.scheduleSlot = new ScheduleData[40];
  30. for (int i = 0; i < 40; i++)
  31. {
  32. this.scheduleSlot[i] = new ScheduleData();
  33. }
  34. this.scheduleSlotBackup = new ScheduleSlotBackup[ScheduleSlotBackup.BackUpMax];
  35. for (int j = 0; j < ScheduleSlotBackup.BackUpMax; j++)
  36. {
  37. this.scheduleSlotBackup[j] = new ScheduleSlotBackup();
  38. }
  39. this.nightWorksStates_ = new Dictionary<int, NightWorkState>();
  40. this.night_works_state_dic = new ReadOnlyDictionary<int, NightWorkState>(this.nightWorksStates_);
  41. this.haveTrophys = new HashSet<int>();
  42. this.jobClassOpenFlags = new HashSet<int>();
  43. this.yotogiClassOpenFlags = new HashSet<int>();
  44. Status.CreateHaveItemList();
  45. foreach (string key in Status.flagLockPartsItems)
  46. {
  47. this.havePartsItems_.Add(key, false);
  48. }
  49. this.UpdateingExtraTrophysHaveData();
  50. this.clubGrade = 1;
  51. }
  52. public bool isOldPlayer
  53. {
  54. get
  55. {
  56. return this.GetFlag("__isComPlayer") != 0;
  57. }
  58. set
  59. {
  60. this.SetFlag("__isComPlayer", (!value) ? 0 : 1);
  61. }
  62. }
  63. public string playerName
  64. {
  65. get
  66. {
  67. return this.playerName_;
  68. }
  69. set
  70. {
  71. this.playerName_ = ((value != null) ? Status.ConvertString(value, 8) : string.Empty);
  72. }
  73. }
  74. public int days
  75. {
  76. get
  77. {
  78. return this.days_;
  79. }
  80. set
  81. {
  82. this.days_ = System.Math.Max(0, value);
  83. }
  84. }
  85. public long totalPurchasePrice
  86. {
  87. get
  88. {
  89. return this.totalPurchasePrice_;
  90. }
  91. set
  92. {
  93. this.totalPurchasePrice_ = System.Math.Max(0L, value);
  94. }
  95. }
  96. public long money
  97. {
  98. get
  99. {
  100. return this.money_;
  101. }
  102. set
  103. {
  104. this.money_ = wf.Math.RoundMinMax(value, 0L, 9999999999L);
  105. }
  106. }
  107. public string moneyText
  108. {
  109. get
  110. {
  111. return Utility.ConvertMoneyText(GameMain.Instance.CharacterMgr.status.money);
  112. }
  113. }
  114. public long casinoCoin
  115. {
  116. get
  117. {
  118. return this.casinoCoin_;
  119. }
  120. set
  121. {
  122. this.casinoCoin_ = wf.Math.RoundMinMax(value, 0L, 999999L);
  123. }
  124. }
  125. public string clubName
  126. {
  127. get
  128. {
  129. return this.clubName_;
  130. }
  131. set
  132. {
  133. this.clubName_ = ((value != null) ? Status.ConvertString(value, 15) : string.Empty);
  134. }
  135. }
  136. public int clubGrade
  137. {
  138. get
  139. {
  140. return this.clubGrade_;
  141. }
  142. set
  143. {
  144. this.clubGrade_ = wf.Math.RoundMinMax(value, 1, 5);
  145. }
  146. }
  147. public int clubEvaluation
  148. {
  149. get
  150. {
  151. return this.baseClubEvaluation;
  152. }
  153. }
  154. public int baseClubEvaluation
  155. {
  156. get
  157. {
  158. return this.baseClubEvaluation_;
  159. }
  160. set
  161. {
  162. this.baseClubEvaluation_ = wf.Math.Round3(value);
  163. }
  164. }
  165. public int clubGauge
  166. {
  167. get
  168. {
  169. return this.clubGauge_;
  170. }
  171. set
  172. {
  173. this.clubGauge_ = wf.Math.RoundMinMax(value, 0, 100);
  174. }
  175. }
  176. public bool isDaytime
  177. {
  178. get
  179. {
  180. return this.GetFlag("時間帯") != 3;
  181. }
  182. }
  183. public bool lockUserDraftMaid
  184. {
  185. get
  186. {
  187. return this.GetFlag("__lockUserDraftMaid") != 0;
  188. }
  189. set
  190. {
  191. this.SetFlag("__lockUserDraftMaid", (!value) ? 0 : 1);
  192. }
  193. }
  194. public bool lockNTRPlay
  195. {
  196. get
  197. {
  198. return this.GetFlag("__lockNTRPlay") != 0;
  199. }
  200. set
  201. {
  202. this.SetFlag("__lockNTRPlay", (!value) ? 0 : 1);
  203. }
  204. }
  205. public int maidPoint
  206. {
  207. get
  208. {
  209. int num = 0;
  210. foreach (int id in this.haveTrophys)
  211. {
  212. if (Trophy.Contains(id) && Trophy.IsEnabled(id))
  213. {
  214. num += Trophy.GetData(id).maidPoint;
  215. }
  216. }
  217. return num;
  218. }
  219. }
  220. public bool isAvailableShop
  221. {
  222. get
  223. {
  224. return true;
  225. }
  226. }
  227. public bool isAvailableRanking
  228. {
  229. get
  230. {
  231. return false;
  232. }
  233. }
  234. public bool isAvailableCompetitiveShow
  235. {
  236. get
  237. {
  238. return true;
  239. }
  240. }
  241. public bool isAvailableDance
  242. {
  243. get
  244. {
  245. return true;
  246. }
  247. }
  248. public bool isAvailableEmploymentAndBanishment
  249. {
  250. get
  251. {
  252. return true;
  253. }
  254. }
  255. public bool isAvailableTransfer
  256. {
  257. get
  258. {
  259. return !string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path) && PluginData.IsEnabled("Legacy") && this.GetFlag("オープニング終了") == 1;
  260. }
  261. }
  262. public bool isAvailableClassChange
  263. {
  264. get
  265. {
  266. return true;
  267. }
  268. }
  269. public ReadOnlyDictionary<string, int> flags { get; private set; }
  270. public ReadOnlyDictionary<string, bool> havePartsItems { get; private set; }
  271. public ReadOnlyDictionary<string, bool> haveItems { get; private set; }
  272. public ReadOnlyDictionary<int, ShopItemStatus> shopLineups { get; private set; }
  273. public ReadOnlyDictionary<int, NightWorkState> night_works_state_dic { get; private set; }
  274. public void SetFlag(string flagName, int value)
  275. {
  276. if (!this.flags_.ContainsKey(flagName))
  277. {
  278. this.flags_.Add(flagName, value);
  279. }
  280. else
  281. {
  282. this.flags_[flagName] = value;
  283. }
  284. }
  285. public void AddFlag(string flagName, int value)
  286. {
  287. if (!this.flags_.ContainsKey(flagName))
  288. {
  289. this.flags_.Add(flagName, value);
  290. }
  291. else
  292. {
  293. Dictionary<string, int> dictionary;
  294. (dictionary = this.flags_)[flagName] = dictionary[flagName] + value;
  295. }
  296. }
  297. public int GetFlag(string flagName)
  298. {
  299. return (!this.flags_.ContainsKey(flagName)) ? 0 : this.flags_[flagName];
  300. }
  301. public bool RemoveFlag(string flagName)
  302. {
  303. return this.flags_.ContainsKey(flagName) && this.flags_.Remove(flagName);
  304. }
  305. public void AddShopLineup(int shopItemId)
  306. {
  307. if (!this.shopLineups_.ContainsKey(shopItemId))
  308. {
  309. this.shopLineups_.Add(shopItemId, ShopItemStatus.New);
  310. }
  311. }
  312. public void RemoveShopLineup(int shopItemId)
  313. {
  314. if (this.shopLineups_.ContainsKey(shopItemId))
  315. {
  316. this.shopLineups_.Remove(shopItemId);
  317. }
  318. }
  319. public void SetShopLineupStatus(int shopItemId, ShopItemStatus status)
  320. {
  321. if (this.shopLineups_.ContainsKey(shopItemId))
  322. {
  323. this.shopLineups_[shopItemId] = status;
  324. }
  325. }
  326. public bool IsShopLineupItem(int itemId)
  327. {
  328. return this.shopLineups_.ContainsKey(itemId);
  329. }
  330. public bool AddNightWorksState(NightWorkState data)
  331. {
  332. if (this.nightWorksStates_.ContainsKey(data.workId))
  333. {
  334. return false;
  335. }
  336. this.nightWorksStates_.Add(data.workId, data);
  337. return true;
  338. }
  339. public bool RemoveNightWorksState(int workId)
  340. {
  341. if (!this.nightWorksStates_.ContainsKey(workId))
  342. {
  343. return false;
  344. }
  345. this.nightWorksStates_.Remove(workId);
  346. return true;
  347. }
  348. public NightWorkState GetNightWorksState(int workId)
  349. {
  350. if (!this.nightWorksStates_.ContainsKey(workId))
  351. {
  352. return null;
  353. }
  354. return this.nightWorksStates_[workId];
  355. }
  356. public bool IsNightWorksState(int workId)
  357. {
  358. return this.nightWorksStates_.ContainsKey(workId);
  359. }
  360. public void AddHavePartsItem(string itemName)
  361. {
  362. itemName = itemName.ToLower();
  363. NDebug.Assert(this.havePartsItems_.ContainsKey(itemName), itemName + "の取得設定を変える事はできません");
  364. this.havePartsItems_[itemName] = true;
  365. }
  366. public void RemoveHavePartsItem(string itemName)
  367. {
  368. itemName = itemName.ToLower();
  369. NDebug.Assert(this.havePartsItems_.ContainsKey(itemName), itemName + "の取得設定を変える事はできません");
  370. this.havePartsItems_[itemName] = false;
  371. }
  372. public bool IsHavePartsItem(string itemName)
  373. {
  374. itemName = itemName.ToLower();
  375. return !this.havePartsItems_.ContainsKey(itemName) || this.havePartsItems_[itemName];
  376. }
  377. public void AddHaveItem(string itemName)
  378. {
  379. itemName = itemName.ToLower();
  380. if (!this.haveItems_.ContainsKey(itemName))
  381. {
  382. this.haveItems_.Add(itemName, true);
  383. }
  384. else
  385. {
  386. this.haveItems_[itemName] = true;
  387. }
  388. }
  389. public void RemoveHaveItem(string itemName)
  390. {
  391. itemName = itemName.ToLower();
  392. if (this.haveItems_.ContainsKey(itemName))
  393. {
  394. this.haveItems_.Remove(itemName);
  395. }
  396. this.haveItems_[itemName] = false;
  397. }
  398. public bool IsHaveItem(string itemName)
  399. {
  400. itemName = itemName.ToLower();
  401. return this.haveItems_.ContainsKey(itemName) && this.haveItems_[itemName];
  402. }
  403. public void AddJobClassOpenFlag(int id)
  404. {
  405. if (!this.jobClassOpenFlags.Contains(id))
  406. {
  407. this.jobClassOpenFlags.Add(id);
  408. }
  409. }
  410. public void RemoveJobClassOpenFlag(int id)
  411. {
  412. if (this.jobClassOpenFlags.Contains(id))
  413. {
  414. this.jobClassOpenFlags.Remove(id);
  415. }
  416. }
  417. public bool IsJobClassOpenFlag(int id)
  418. {
  419. return this.jobClassOpenFlags.Contains(id);
  420. }
  421. public void AddYotogiClassOpenFlag(int id)
  422. {
  423. if (!this.yotogiClassOpenFlags.Contains(id))
  424. {
  425. this.yotogiClassOpenFlags.Add(id);
  426. }
  427. }
  428. public void RemoveYotogiClassOpenFlag(int id)
  429. {
  430. if (this.yotogiClassOpenFlags.Contains(id))
  431. {
  432. this.yotogiClassOpenFlags.Remove(id);
  433. }
  434. }
  435. public bool IsYotogiClassOpenFlag(int id)
  436. {
  437. return this.yotogiClassOpenFlags.Contains(id);
  438. }
  439. public bool AddHaveTrophy(int trophyId)
  440. {
  441. bool flag = false;
  442. if (!Trophy.Contains(trophyId) || !Trophy.IsEnabled(trophyId))
  443. {
  444. return false;
  445. }
  446. Trophy.Data data = Trophy.GetData(trophyId);
  447. if (data != null)
  448. {
  449. if (!this.haveTrophys.Contains(trophyId))
  450. {
  451. this.haveTrophys.Add(trophyId);
  452. flag = true;
  453. }
  454. if (data.lineupIdArray != null)
  455. {
  456. foreach (int shopItemId in data.lineupIdArray)
  457. {
  458. this.AddShopLineup(shopItemId);
  459. }
  460. }
  461. if (flag && data.type != Trophy.Data.Type.Extra)
  462. {
  463. GameObject gameObject = GameObject.Find("SystemUI Root/TrophyAchieveEffect");
  464. if (gameObject != null)
  465. {
  466. TrophyAchieveEffect component = gameObject.GetComponent<TrophyAchieveEffect>();
  467. if (component != null)
  468. {
  469. component.EffectStart(data);
  470. }
  471. }
  472. }
  473. }
  474. return flag;
  475. }
  476. public bool IsHaveTrophy(int id)
  477. {
  478. return this.haveTrophys.Contains(id);
  479. }
  480. public bool IsHaveTrophy(int[] ids)
  481. {
  482. bool result = true;
  483. for (int i = 0; i < ids.Length; i++)
  484. {
  485. if (!this.IsHaveTrophy(ids[i]))
  486. {
  487. result = false;
  488. break;
  489. }
  490. }
  491. return result;
  492. }
  493. public int GetScheduleMaidSetting(Maid checkMaid)
  494. {
  495. for (int i = 0; i < this.scheduleSlot.Length; i++)
  496. {
  497. if (!string.IsNullOrEmpty(this.scheduleSlot[i].maid_guid))
  498. {
  499. if (checkMaid.status.guid == this.scheduleSlot[i].maid_guid)
  500. {
  501. return i;
  502. }
  503. }
  504. }
  505. return -1;
  506. }
  507. public Maid GetScheduleSlot(int slotNo)
  508. {
  509. NDebug.Assert(0 <= slotNo && slotNo < 40, "error.");
  510. if (string.IsNullOrEmpty(this.scheduleSlot[slotNo].maid_guid))
  511. {
  512. return null;
  513. }
  514. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  515. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  516. {
  517. if (characterMgr.GetStockMaid(i).status.guid == this.scheduleSlot[slotNo].maid_guid)
  518. {
  519. return characterMgr.GetStockMaid(i);
  520. }
  521. }
  522. return null;
  523. }
  524. public void BackupScheduleSlot(ScheduleSlotBackup.Type type)
  525. {
  526. if (type == ScheduleSlotBackup.Type.Max)
  527. {
  528. return;
  529. }
  530. ScheduleSlotBackup scheduleSlotBackup = this.scheduleSlotBackup[(int)type];
  531. for (int i = 0; i < this.scheduleSlot.Length; i++)
  532. {
  533. Maid maid = this.GetScheduleSlot(i);
  534. if (maid != null)
  535. {
  536. scheduleSlotBackup.slotDataArray[i].maid_guid = maid.status.guid;
  537. scheduleSlotBackup.slotDataArray[i].noonWorkId = maid.status.noonWorkId;
  538. scheduleSlotBackup.slotDataArray[i].nightWorkId = maid.status.nightWorkId;
  539. scheduleSlotBackup.slotDataArray[i].noonCommu = maid.status.noonCommu;
  540. scheduleSlotBackup.slotDataArray[i].nightCommu = maid.status.nightCommu;
  541. }
  542. else
  543. {
  544. scheduleSlotBackup.slotDataArray[i].maid_guid = string.Empty;
  545. }
  546. }
  547. }
  548. public void ApplyScheduleSlotBackup(ScheduleSlotBackup.Type type)
  549. {
  550. if (type == ScheduleSlotBackup.Type.Max)
  551. {
  552. return;
  553. }
  554. ScheduleSlotBackup scheduleSlotBackup = this.scheduleSlotBackup[(int)type];
  555. int i = 0;
  556. while (i < this.scheduleSlot.Length)
  557. {
  558. if (!(scheduleSlotBackup.slotDataArray[i].maid_guid != string.Empty))
  559. {
  560. goto IL_E1;
  561. }
  562. ScheduleSlotBackup.Data data = scheduleSlotBackup.slotDataArray[i];
  563. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(data.maid_guid);
  564. if (!(stockMaid != null))
  565. {
  566. goto IL_E1;
  567. }
  568. this.scheduleSlot[i].maid_guid = data.maid_guid;
  569. this.scheduleSlot[i].noon_communication = data.noonCommu;
  570. this.scheduleSlot[i].night_communication = data.nightCommu;
  571. stockMaid.status.noonWorkId = data.noonWorkId;
  572. stockMaid.status.nightWorkId = data.nightWorkId;
  573. stockMaid.status.noonCommu = data.noonCommu;
  574. stockMaid.status.nightCommu = data.nightCommu;
  575. IL_F3:
  576. i++;
  577. continue;
  578. IL_E1:
  579. this.scheduleSlot[i].maid_guid = string.Empty;
  580. goto IL_F3;
  581. }
  582. }
  583. public void CheckTrophyMainMenu()
  584. {
  585. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  586. int facilityAchievement = facilityMgr.GetFacilityAchievement<int>("施設総数");
  587. if (5 <= facilityAchievement)
  588. {
  589. this.AddHaveTrophy(1160);
  590. }
  591. if (10 <= facilityAchievement)
  592. {
  593. this.AddHaveTrophy(1170);
  594. }
  595. }
  596. public void CheckTrophyDayResultAndNightResult()
  597. {
  598. FacilityManager facilityMgr = GameMain.Instance.FacilityMgr;
  599. int facilityAchievement = facilityMgr.GetFacilityAchievement<int>("施設強化回数");
  600. if (5 <= facilityAchievement)
  601. {
  602. this.AddHaveTrophy(1180);
  603. }
  604. if (10 <= facilityAchievement)
  605. {
  606. this.AddHaveTrophy(1190);
  607. }
  608. }
  609. public void CheckTrophyJobClassAndYotogiClass(Maid checkMaid)
  610. {
  611. if (checkMaid == null || checkMaid.status.heroineType == HeroineType.Sub)
  612. {
  613. return;
  614. }
  615. if (Status.jobClassTrophyCheckSet == null)
  616. {
  617. Status.jobClassTrophyCheckSet = new Dictionary<string, int>();
  618. Status.jobClassTrophyCheckSet.Add("Novice2", 2000);
  619. Status.jobClassTrophyCheckSet.Add("Concierge", 2010);
  620. Status.jobClassTrophyCheckSet.Add("Waitress", 2020);
  621. Status.jobClassTrophyCheckSet.Add("Maitre", 2030);
  622. Status.jobClassTrophyCheckSet.Add("Bartender", 2040);
  623. Status.jobClassTrophyCheckSet.Add("Therapist", 2050);
  624. Status.jobClassTrophyCheckSet.Add("Empire", 2060);
  625. Status.jobClassTrophyCheckSet.Add("Dealer", 2070);
  626. Status.jobClassTrophyCheckSet.Add("Healing", 2080);
  627. Status.jobClassTrophyCheckSet.Add("Night", 2090);
  628. Status.yotogiClassCheckSet = new Dictionary<string, int>();
  629. }
  630. foreach (KeyValuePair<string, int> keyValuePair in Status.jobClassTrophyCheckSet)
  631. {
  632. if (checkMaid.status.jobClass.Contains(JobClass.uniqueNameToId(keyValuePair.Key)))
  633. {
  634. this.AddHaveTrophy(keyValuePair.Value);
  635. }
  636. }
  637. foreach (KeyValuePair<string, int> keyValuePair2 in Status.yotogiClassCheckSet)
  638. {
  639. if (checkMaid.status.jobClass.Contains(YotogiClass.uniqueNameToId(keyValuePair2.Key)))
  640. {
  641. this.AddHaveTrophy(keyValuePair2.Value);
  642. }
  643. }
  644. }
  645. public void CheckTrophyMaidStatus(Maid checkMaid)
  646. {
  647. if (checkMaid == null || checkMaid.status.heroineType == HeroineType.Sub)
  648. {
  649. return;
  650. }
  651. Status status = checkMaid.status;
  652. if (10 <= status.playCountYotogi)
  653. {
  654. this.AddHaveTrophy(140);
  655. }
  656. if (30 <= status.playCountYotogi)
  657. {
  658. this.AddHaveTrophy(150);
  659. }
  660. if (1000 <= status.inyoku)
  661. {
  662. this.AddHaveTrophy(1000);
  663. }
  664. if (5000 <= status.inyoku)
  665. {
  666. this.AddHaveTrophy(1010);
  667. }
  668. if (9999 <= status.inyoku)
  669. {
  670. this.AddHaveTrophy(1020);
  671. }
  672. if (1000 <= status.mvalue)
  673. {
  674. this.AddHaveTrophy(1030);
  675. }
  676. if (5000 <= status.mvalue)
  677. {
  678. this.AddHaveTrophy(1040);
  679. }
  680. if (9999 <= status.mvalue)
  681. {
  682. this.AddHaveTrophy(1050);
  683. }
  684. if (1000 <= status.hentai)
  685. {
  686. this.AddHaveTrophy(1060);
  687. }
  688. if (5000 <= status.hentai)
  689. {
  690. this.AddHaveTrophy(1070);
  691. }
  692. if (9999 <= status.hentai)
  693. {
  694. this.AddHaveTrophy(1080);
  695. }
  696. if (1000 <= status.housi)
  697. {
  698. this.AddHaveTrophy(1090);
  699. }
  700. if (5000 <= status.housi)
  701. {
  702. this.AddHaveTrophy(1100);
  703. }
  704. if (9999 <= status.housi)
  705. {
  706. this.AddHaveTrophy(1110);
  707. }
  708. }
  709. public void CheckTrophyContractTypeAndrelation()
  710. {
  711. int num = 0;
  712. int num2 = 0;
  713. int num3 = 0;
  714. foreach (Maid maid in GameMain.Instance.CharacterMgr.GetStockMaidList())
  715. {
  716. if (maid.status.heroineType != HeroineType.Sub)
  717. {
  718. if (maid.status.contract == Contract.Free)
  719. {
  720. num++;
  721. }
  722. else if (maid.status.contract == Contract.Exclusive)
  723. {
  724. num2++;
  725. }
  726. if (maid.status.relation == Relation.Lover)
  727. {
  728. num3++;
  729. }
  730. }
  731. }
  732. if (1 <= num)
  733. {
  734. this.AddHaveTrophy(10);
  735. }
  736. if (3 <= num)
  737. {
  738. this.AddHaveTrophy(20);
  739. }
  740. if (5 <= num)
  741. {
  742. this.AddHaveTrophy(30);
  743. }
  744. if (1 <= num2)
  745. {
  746. this.AddHaveTrophy(40);
  747. }
  748. if (3 <= num2)
  749. {
  750. this.AddHaveTrophy(50);
  751. }
  752. if (5 <= num2)
  753. {
  754. this.AddHaveTrophy(60);
  755. }
  756. if (1 <= num3)
  757. {
  758. this.AddHaveTrophy(70);
  759. }
  760. if (3 <= num3)
  761. {
  762. this.AddHaveTrophy(80);
  763. }
  764. }
  765. public void Serialize(BinaryWriter binary)
  766. {
  767. binary.Write("CM3D2_PLAYER_STATUS");
  768. binary.Write(1550);
  769. binary.Write(this.playerName_);
  770. binary.Write(this.days_);
  771. binary.Write(this.totalPurchasePrice_);
  772. binary.Write(this.money_);
  773. binary.Write(this.casinoCoin_);
  774. binary.Write(this.clubName_);
  775. binary.Write(this.clubGrade_);
  776. binary.Write(this.baseClubEvaluation_);
  777. binary.Write(this.clubGauge_);
  778. binary.Write((short)this.flags_.Count);
  779. foreach (KeyValuePair<string, int> keyValuePair in this.flags_)
  780. {
  781. binary.Write(keyValuePair.Key);
  782. binary.Write(keyValuePair.Value);
  783. }
  784. binary.Write((short)this.havePartsItems_.Count);
  785. foreach (KeyValuePair<string, bool> keyValuePair2 in this.havePartsItems_)
  786. {
  787. binary.Write(keyValuePair2.Key);
  788. binary.Write(keyValuePair2.Value);
  789. }
  790. binary.Write((short)this.haveItems_.Count);
  791. foreach (KeyValuePair<string, bool> keyValuePair3 in this.haveItems_)
  792. {
  793. binary.Write(keyValuePair3.Key);
  794. binary.Write(keyValuePair3.Value);
  795. }
  796. binary.Write((short)this.shopLineups_.Count);
  797. foreach (KeyValuePair<int, ShopItemStatus> keyValuePair4 in this.shopLineups_)
  798. {
  799. binary.Write(keyValuePair4.Key);
  800. binary.Write((int)keyValuePair4.Value);
  801. }
  802. binary.Write((short)this.scheduleSlot.Length);
  803. foreach (ScheduleData scheduleData in this.scheduleSlot)
  804. {
  805. scheduleData.Serialize(binary);
  806. }
  807. binary.Write((short)this.scheduleSlotBackup.Length);
  808. foreach (ScheduleSlotBackup scheduleSlotBackup in this.scheduleSlotBackup)
  809. {
  810. scheduleSlotBackup.Serialize(binary);
  811. }
  812. binary.Write((short)this.nightWorksStates_.Count);
  813. foreach (KeyValuePair<int, NightWorkState> keyValuePair5 in this.nightWorksStates_)
  814. {
  815. binary.Write(keyValuePair5.Key);
  816. keyValuePair5.Value.Serialize(binary);
  817. }
  818. binary.Write((short)this.haveTrophys.Count);
  819. foreach (int value in this.haveTrophys)
  820. {
  821. binary.Write(value);
  822. }
  823. binary.Write((short)this.jobClassOpenFlags.Count);
  824. foreach (int value2 in this.jobClassOpenFlags)
  825. {
  826. binary.Write(value2);
  827. }
  828. binary.Write((short)this.yotogiClassOpenFlags.Count);
  829. foreach (int value3 in this.yotogiClassOpenFlags)
  830. {
  831. binary.Write(value3);
  832. }
  833. binary.Write(1000);
  834. binary.Write(3830248615U);
  835. }
  836. public void Deserialize(BinaryReader binary)
  837. {
  838. string a = binary.ReadString();
  839. NDebug.Assert(a == "CM3D2_PLAYER_STATUS", "プレイヤーパラメータのヘッダーが不正です。");
  840. int num = binary.ReadInt32();
  841. this.playerName_ = binary.ReadString();
  842. this.days_ = binary.ReadInt32();
  843. this.totalPurchasePrice_ = binary.ReadInt64();
  844. this.money_ = binary.ReadInt64();
  845. this.casinoCoin_ = binary.ReadInt64();
  846. this.clubName_ = binary.ReadString();
  847. this.clubGrade_ = binary.ReadInt32();
  848. this.baseClubEvaluation_ = binary.ReadInt32();
  849. this.clubGauge_ = binary.ReadInt32();
  850. int num2 = (int)binary.ReadInt16();
  851. this.flags_.Clear();
  852. for (int i = 0; i < num2; i++)
  853. {
  854. string key = binary.ReadString();
  855. int value = binary.ReadInt32();
  856. this.flags_.Add(key, value);
  857. }
  858. num2 = (int)binary.ReadInt16();
  859. this.havePartsItems_.Clear();
  860. for (int j = 0; j < num2; j++)
  861. {
  862. string key2 = binary.ReadString();
  863. bool value2 = binary.ReadBoolean();
  864. this.havePartsItems_.Add(key2, value2);
  865. }
  866. if (204 < num)
  867. {
  868. num2 = (int)binary.ReadInt16();
  869. this.haveItems_.Clear();
  870. for (int k = 0; k < num2; k++)
  871. {
  872. string key3 = binary.ReadString();
  873. bool value3 = binary.ReadBoolean();
  874. this.haveItems_.Add(key3, value3);
  875. }
  876. }
  877. num2 = (int)binary.ReadInt16();
  878. this.shopLineups_.Clear();
  879. for (int l = 0; l < num2; l++)
  880. {
  881. int key4 = binary.ReadInt32();
  882. ShopItemStatus value4 = (ShopItemStatus)binary.ReadInt32();
  883. this.shopLineups_.Add(key4, value4);
  884. }
  885. num2 = (int)binary.ReadInt16();
  886. int slotCnt = num2;
  887. this.scheduleSlot = new ScheduleData[40];
  888. for (int m = 0; m < 40; m++)
  889. {
  890. this.scheduleSlot[m] = new ScheduleData();
  891. }
  892. for (int n = 0; n < num2; n++)
  893. {
  894. this.scheduleSlot[n].Deserialize(binary, num);
  895. }
  896. if (num >= 211)
  897. {
  898. num2 = (int)binary.ReadInt16();
  899. this.scheduleSlotBackup = new ScheduleSlotBackup[num2];
  900. for (int num3 = 0; num3 < num2; num3++)
  901. {
  902. this.scheduleSlotBackup[num3] = new ScheduleSlotBackup();
  903. this.scheduleSlotBackup[num3].Deserialize(binary, num, slotCnt);
  904. }
  905. }
  906. num2 = (int)binary.ReadInt16();
  907. this.nightWorksStates_.Clear();
  908. for (int num4 = 0; num4 < num2; num4++)
  909. {
  910. int key5 = binary.ReadInt32();
  911. NightWorkState nightWorkState = new NightWorkState();
  912. nightWorkState.Deserialize(binary, num);
  913. this.nightWorksStates_.Add(key5, nightWorkState);
  914. }
  915. num2 = (int)binary.ReadInt16();
  916. this.haveTrophys.Clear();
  917. for (int num5 = 0; num5 < num2; num5++)
  918. {
  919. int item = binary.ReadInt32();
  920. this.haveTrophys.Add(item);
  921. }
  922. num2 = (int)binary.ReadInt16();
  923. this.jobClassOpenFlags.Clear();
  924. for (int num6 = 0; num6 < num2; num6++)
  925. {
  926. int item2 = binary.ReadInt32();
  927. this.jobClassOpenFlags.Add(item2);
  928. }
  929. num2 = (int)binary.ReadInt16();
  930. this.yotogiClassOpenFlags.Clear();
  931. for (int num7 = 0; num7 < num2; num7++)
  932. {
  933. int item3 = binary.ReadInt32();
  934. this.yotogiClassOpenFlags.Add(item3);
  935. }
  936. if (1540 <= num)
  937. {
  938. int num8 = binary.ReadInt32();
  939. }
  940. uint num9 = binary.ReadUInt32();
  941. NDebug.Assert(3830248615U == num9, "プレイヤーパラメータのロードに失敗しました");
  942. foreach (string key6 in Status.flagLockPartsItems)
  943. {
  944. if (!this.havePartsItems_.ContainsKey(key6))
  945. {
  946. this.havePartsItems_.Add(key6, false);
  947. }
  948. }
  949. HashSet<string> hashSet = new HashSet<string>();
  950. foreach (KeyValuePair<string, bool> keyValuePair in this.havePartsItems_)
  951. {
  952. if (!Status.flagLockPartsItems.Contains(keyValuePair.Key))
  953. {
  954. hashSet.Add(keyValuePair.Key);
  955. }
  956. }
  957. foreach (string key7 in hashSet)
  958. {
  959. this.havePartsItems_.Remove(key7);
  960. }
  961. this.UpdateingExtraTrophysHaveData();
  962. }
  963. private void UpdateingExtraTrophysHaveData()
  964. {
  965. List<Trophy.Data> allDatas = Trophy.GetAllDatas(true);
  966. foreach (Trophy.Data data in allDatas)
  967. {
  968. if (data.type == Trophy.Data.Type.Extra)
  969. {
  970. this.AddHaveTrophy(data.id);
  971. }
  972. }
  973. }
  974. private static void CreateHaveItemList()
  975. {
  976. if (Status.flagLockPartsItems == null)
  977. {
  978. Status.flagLockPartsItems = new HashSet<string>();
  979. Dictionary<int, Shop.ItemDataBase> item_data_dic = Shop.item_data_dic;
  980. Dictionary<int, Shop.ItemDataGroup> item_data_group_dic = Shop.item_data_group_dic;
  981. foreach (KeyValuePair<int, Shop.ItemDataBase> keyValuePair in item_data_dic)
  982. {
  983. Shop.ItemDataBase value = keyValuePair.Value;
  984. if (!item_data_group_dic.ContainsKey(value.id))
  985. {
  986. for (int i = 0; i < value.item_menu_array.Length; i++)
  987. {
  988. string item = value.item_menu_array[i];
  989. if (!Status.flagLockPartsItems.Contains(item))
  990. {
  991. Status.flagLockPartsItems.Add(item);
  992. }
  993. }
  994. }
  995. }
  996. foreach (KeyValuePair<string[], HashSet<int>> keyValuePair2 in Shop.set_card_list)
  997. {
  998. foreach (string item2 in keyValuePair2.Key)
  999. {
  1000. if (!Status.flagLockPartsItems.Contains(item2))
  1001. {
  1002. Status.flagLockPartsItems.Add(item2);
  1003. }
  1004. }
  1005. }
  1006. using (AFileBase afileBase = GameUty.FileSystem.FileOpen("scenario_get_item_list.nei"))
  1007. {
  1008. using (CsvParser csvParser = new CsvParser())
  1009. {
  1010. bool condition = csvParser.Open(afileBase);
  1011. NDebug.Assert(condition, "file open error[scenario_get_item_list.nei]");
  1012. for (int k = 0; k < csvParser.max_cell_y; k++)
  1013. {
  1014. if (csvParser.IsCellToExistData(0, k))
  1015. {
  1016. string text = csvParser.GetCellAsString(0, k).ToLower();
  1017. text += ".menu";
  1018. if (!Status.flagLockPartsItems.Contains(text))
  1019. {
  1020. Status.flagLockPartsItems.Add(text);
  1021. }
  1022. }
  1023. }
  1024. }
  1025. }
  1026. }
  1027. }
  1028. public const int SaveDataVersion = 1000;
  1029. public const int InitMaidPoint = 0;
  1030. public const long MoneyMax = 9999999999L;
  1031. public const long CoinMax = 999999L;
  1032. public const int MVPEventDay = 7;
  1033. public const int ScheduleSlotMax = 40;
  1034. public const int ClubGradeMax = 5;
  1035. private const uint SaveDataCheckCode = 3830248615U;
  1036. private static HashSet<string> flagLockPartsItems;
  1037. public ScheduleSlotBackup[] scheduleSlotBackup;
  1038. public ScheduleData[] scheduleSlot;
  1039. private string playerName_;
  1040. private int days_;
  1041. private long totalPurchasePrice_;
  1042. private long money_;
  1043. private long casinoCoin_;
  1044. private string clubName_;
  1045. private int clubGrade_;
  1046. private int baseClubEvaluation_;
  1047. private int clubGauge_;
  1048. private Dictionary<string, int> flags_;
  1049. private Dictionary<string, bool> havePartsItems_;
  1050. private Dictionary<string, bool> haveItems_;
  1051. private Dictionary<int, ShopItemStatus> shopLineups_;
  1052. private Dictionary<int, NightWorkState> nightWorksStates_;
  1053. private HashSet<int> haveTrophys;
  1054. private HashSet<int> jobClassOpenFlags;
  1055. private HashSet<int> yotogiClassOpenFlags;
  1056. private static Dictionary<string, int> jobClassTrophyCheckSet;
  1057. private static Dictionary<string, int> yotogiClassCheckSet;
  1058. }
  1059. }