BackupParamAccessor.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. using System;
  2. using PlayerStatus;
  3. namespace BackupParamAccessor
  4. {
  5. public static class BackupParamAccessor
  6. {
  7. public static void BackupParam(int? slotId, SCENE_ID sceneId_f)
  8. {
  9. if (slotId == null)
  10. {
  11. for (int i = 0; i < 40; i++)
  12. {
  13. BackupParamAccessor.BackupParam(new int?(i), sceneId_f);
  14. }
  15. }
  16. int num = (slotId == null) ? 0 : slotId.Value;
  17. string str = sceneId_f.ToString();
  18. Params @params = new Params();
  19. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num);
  20. if (scheduleSlot != null)
  21. {
  22. @params.salon_cleanliness = 0;
  23. @params.salon_gorgeous = 0;
  24. @params.salon_evaluation = GameMain.Instance.CharacterMgr.status.clubEvaluation;
  25. @params.money = GameMain.Instance.CharacterMgr.status.money;
  26. @params.clubEvaluation = GameMain.Instance.CharacterMgr.status.clubEvaluation;
  27. @params.clubMoney = GameMain.Instance.CharacterMgr.status.money;
  28. @params.evaluation = scheduleSlot.status.evaluation;
  29. @params.sales = scheduleSlot.status.sales;
  30. @params.study_rate = scheduleSlot.status.studyRate;
  31. @params.reception = scheduleSlot.status.reception;
  32. @params.care = scheduleSlot.status.care;
  33. @params.lovely = scheduleSlot.status.lovely;
  34. @params.elegance = scheduleSlot.status.elegance;
  35. @params.charm = scheduleSlot.status.charm;
  36. @params.teach_rate = scheduleSlot.status.teachRate;
  37. @params.cooking = scheduleSlot.status.cooking;
  38. @params.vocal = scheduleSlot.status.vocal;
  39. @params.dance = scheduleSlot.status.dance;
  40. @params.appealPoint = scheduleSlot.status.appealPoint;
  41. @params.inyoku = scheduleSlot.status.inyoku;
  42. @params.m_value = scheduleSlot.status.mvalue;
  43. @params.hentai = scheduleSlot.status.hentai;
  44. @params.housi = scheduleSlot.status.housi;
  45. if (scheduleSlot.status.selectedJobClass != null)
  46. {
  47. @params.maidClassLv = scheduleSlot.status.selectedJobClass.level;
  48. @params.maidClassExp = scheduleSlot.status.selectedJobClass.expSystem.GetTotalExp();
  49. }
  50. if (scheduleSlot.status.selectedYotogiClass != null)
  51. {
  52. @params.yotogiClassLv = scheduleSlot.status.selectedYotogiClass.level;
  53. @params.yotogiClassExp = scheduleSlot.status.selectedYotogiClass.expSystem.GetTotalExp();
  54. }
  55. @params.yotogi_play_count = scheduleSlot.status.playCountYotogi;
  56. @params.others_play_count = scheduleSlot.status.playCountNightWork;
  57. @params.likability = scheduleSlot.status.likability;
  58. }
  59. BackupParamAccessor.slots = GameMain.Instance.CharacterMgr.status.scheduleSlot;
  60. byte[] bytes = BitConverter.GetBytes(@params.clubMoney);
  61. int value = BitConverter.ToInt32(new byte[]
  62. {
  63. bytes[0],
  64. bytes[1],
  65. bytes[2],
  66. bytes[3]
  67. }, 0);
  68. int value2 = BitConverter.ToInt32(new byte[]
  69. {
  70. bytes[4],
  71. bytes[5],
  72. bytes[6],
  73. bytes[7]
  74. }, 0);
  75. BackupParamAccessor.slots[num].backup_status_dic[str + "_clubMoney_byte1"] = value;
  76. BackupParamAccessor.slots[num].backup_status_dic[str + "_clubMoney_byte2"] = value2;
  77. BackupParamAccessor.slots[num].backup_status_dic[str + "_clubMoney"] = (int)@params.clubMoney;
  78. BackupParamAccessor.slots[num].backup_status_dic[str + "_clubEvaluation"] = @params.clubEvaluation;
  79. BackupParamAccessor.slots[num].backup_status_dic[str + "_salon_cleanliness"] = @params.salon_cleanliness;
  80. BackupParamAccessor.slots[num].backup_status_dic[str + "_salon_gorgeous"] = @params.salon_gorgeous;
  81. BackupParamAccessor.slots[num].backup_status_dic[str + "_salon_evaluation"] = @params.salon_evaluation;
  82. BackupParamAccessor.slots[num].backup_status_dic[str + "_money_top0"] = @params.money_top0;
  83. BackupParamAccessor.slots[num].backup_status_dic[str + "_money_top10"] = @params.money_top10;
  84. BackupParamAccessor.slots[num].backup_status_dic[str + "_evaluation"] = @params.evaluation;
  85. BackupParamAccessor.slots[num].backup_status_dic[str + "_sales_top0"] = @params.sales_top0;
  86. BackupParamAccessor.slots[num].backup_status_dic[str + "_sales_top10"] = @params.sales_top10;
  87. BackupParamAccessor.slots[num].backup_status_dic[str + "_study_rate"] = @params.study_rate;
  88. BackupParamAccessor.slots[num].backup_status_dic[str + "_reception"] = @params.reception;
  89. BackupParamAccessor.slots[num].backup_status_dic[str + "_care"] = @params.care;
  90. BackupParamAccessor.slots[num].backup_status_dic[str + "_lovely"] = @params.lovely;
  91. BackupParamAccessor.slots[num].backup_status_dic[str + "_elegance"] = @params.elegance;
  92. BackupParamAccessor.slots[num].backup_status_dic[str + "_charm"] = @params.charm;
  93. BackupParamAccessor.slots[num].backup_status_dic[str + "_teach_rate"] = @params.teach_rate;
  94. BackupParamAccessor.slots[num].backup_status_dic[str + "_cooking"] = @params.cooking;
  95. BackupParamAccessor.slots[num].backup_status_dic[str + "_vocal"] = @params.vocal;
  96. BackupParamAccessor.slots[num].backup_status_dic[str + "_dance"] = @params.dance;
  97. BackupParamAccessor.slots[num].backup_status_dic[str + "_appealPoint"] = @params.appealPoint;
  98. BackupParamAccessor.slots[num].backup_status_dic[str + "_inyoku"] = @params.inyoku;
  99. BackupParamAccessor.slots[num].backup_status_dic[str + "_m_value"] = @params.m_value;
  100. BackupParamAccessor.slots[num].backup_status_dic[str + "_hentai"] = @params.hentai;
  101. BackupParamAccessor.slots[num].backup_status_dic[str + "_housi"] = @params.housi;
  102. BackupParamAccessor.slots[num].backup_status_dic[str + "_maidClassLv"] = @params.maidClassLv;
  103. BackupParamAccessor.slots[num].backup_status_dic[str + "_maidClassExp"] = @params.maidClassExp;
  104. BackupParamAccessor.slots[num].backup_status_dic[str + "_yotogiClassLv"] = @params.yotogiClassLv;
  105. BackupParamAccessor.slots[num].backup_status_dic[str + "_yotogiClassExp"] = @params.yotogiClassExp;
  106. BackupParamAccessor.slots[num].backup_status_dic[str + "_yotogi_play_count"] = @params.yotogi_play_count;
  107. BackupParamAccessor.slots[num].backup_status_dic[str + "_others_play_count"] = @params.others_play_count;
  108. BackupParamAccessor.slots[num].backup_status_dic[str + "_likability"] = @params.likability;
  109. }
  110. public static void Clear(int? slotId = null)
  111. {
  112. if (slotId == null)
  113. {
  114. for (int i = 0; i < 40; i++)
  115. {
  116. BackupParamAccessor.Clear(new int?(i));
  117. }
  118. }
  119. int num = (slotId == null) ? 0 : slotId.Value;
  120. BackupParamAccessor.slots[num].backup_status_dic.Clear();
  121. }
  122. public static Params GetBackupParams(int slotId, SCENE_ID sceneId)
  123. {
  124. Params @params = new Params();
  125. @params.clubMoney = (long)BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "clubMoney");
  126. @params.clubEvaluation = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "clubEvaluation");
  127. @params.salon_cleanliness = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "salon_cleanliness");
  128. @params.salon_gorgeous = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "salon_gorgeous");
  129. @params.salon_evaluation = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "salon_evaluation");
  130. @params.money_top0 = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "money_top0");
  131. @params.money_top10 = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "money_top10");
  132. @params.evaluation = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "evaluation");
  133. @params.sales_top0 = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "sales_top0");
  134. @params.sales_top10 = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "sales_top10");
  135. @params.study_rate = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "study_rate");
  136. if (BackupParamAccessor.BackupParamsPartsContainsKey(slotId, sceneId, "clubMoney_byte1") && BackupParamAccessor.BackupParamsPartsContainsKey(slotId, sceneId, "clubMoney_byte2"))
  137. {
  138. byte[] bytes = BitConverter.GetBytes(BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "clubMoney_byte1"));
  139. byte[] bytes2 = BitConverter.GetBytes(BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "clubMoney_byte2"));
  140. @params.clubMoney = BitConverter.ToInt64(new byte[]
  141. {
  142. bytes[0],
  143. bytes[1],
  144. bytes[2],
  145. bytes[3],
  146. bytes2[0],
  147. bytes2[1],
  148. bytes2[2],
  149. bytes2[3]
  150. }, 0);
  151. }
  152. @params.teach_rate = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "teach_rate");
  153. @params.reception = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "reception");
  154. @params.care = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "care");
  155. @params.lovely = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "lovely");
  156. @params.elegance = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "elegance");
  157. @params.charm = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "charm");
  158. @params.cooking = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "cooking");
  159. @params.vocal = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "vocal");
  160. @params.dance = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "dance");
  161. @params.appealPoint = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "appealPoint");
  162. @params.inyoku = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "inyoku");
  163. @params.m_value = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "m_value");
  164. @params.hentai = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "hentai");
  165. @params.housi = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "housi");
  166. @params.maidClassLv = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "maidClassLv");
  167. @params.maidClassExp = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "maidClassExp");
  168. @params.yotogiClassLv = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "yotogiClassLv");
  169. @params.yotogiClassExp = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "yotogiClassExp");
  170. @params.yotogi_play_count = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "yotogi_play_count");
  171. @params.others_play_count = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "others_play_count");
  172. @params.likability = BackupParamAccessor.GetBackupParamsParts(slotId, sceneId, "likability");
  173. return @params;
  174. }
  175. public static bool BackupParamsPartsContainsKey(int slotId, SCENE_ID sceneId_f, string name)
  176. {
  177. BackupParamAccessor.slots = GameMain.Instance.CharacterMgr.status.scheduleSlot;
  178. string str = sceneId_f.ToString();
  179. return BackupParamAccessor.slots[slotId].backup_status_dic.ContainsKey(str + "_" + name);
  180. }
  181. public static int GetBackupParamsParts(int slotId, SCENE_ID sceneId_f, string name)
  182. {
  183. BackupParamAccessor.slots = GameMain.Instance.CharacterMgr.status.scheduleSlot;
  184. string str = sceneId_f.ToString();
  185. if (BackupParamAccessor.slots[slotId].backup_status_dic.ContainsKey(str + "_" + name))
  186. {
  187. return BackupParamAccessor.slots[slotId].backup_status_dic[str + "_" + name];
  188. }
  189. return 0;
  190. }
  191. public static bool YotogiPlayed(int slotId, SCENE_ID baseId)
  192. {
  193. return (BackupParamAccessor.GetBackupParams(slotId, baseId + 1) - BackupParamAccessor.GetBackupParams(slotId, baseId - 1)).yotogi_play_count > 0;
  194. }
  195. public static ScheduleData[] slots = GameMain.Instance.CharacterMgr.status.scheduleSlot;
  196. }
  197. }