GlobalAttr.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. Object.defineProperty(i, "__esModule", { value: !0 });
  5. const s = t("App"),
  6. o = t("ControllerConst"),
  7. a = t("CostumeConst"),
  8. n = t("BuffMgr"),
  9. r = t("IBuff"),
  10. l = t("GameConst"),
  11. h = t("AbilityInfoService"),
  12. c = t("MachineService"),
  13. d = t("MapService"),
  14. u = t("RoleService"),
  15. p = t("StageUpgradeService");
  16. let f = null,
  17. g = null;
  18. class m {
  19. constructor() {
  20. (this.tipChance = 0),
  21. (this.generousTipRate = 0),
  22. (this.chefProductionSpeed = 1),
  23. (this.waiterProductionSpeed = 1),
  24. (this.moneyRate = 1),
  25. (this.customerMoveSpeed = 1),
  26. (this.chefspeed = 0),
  27. (this.waiterspeed = 0),
  28. (this.perfectDishRate = 0),
  29. (this.instaCompletedDishRate = 0),
  30. (this.menuItemUpgradeDiscount = 1),
  31. (this.cookMoneyRate = 0),
  32. (this.tipRate = 0),
  33. (this.upgradeDiscount = 1),
  34. (this.ad_booster_effect = 1),
  35. (this.gemsChanceAtAd = 0),
  36. (this.offlineRevenue = 1),
  37. (this.offlineRewardMaxTime = 1),
  38. (this.offlineRewardMinTime = 1),
  39. (this.adBoosterDuration = 1),
  40. (this.adRewardRevenue = 1),
  41. (this.define = null),
  42. (this.costumeAttr = null),
  43. (this.buffAttr = null);
  44. }
  45. static init() {
  46. (g = u.default.ins), (m.ins = new m()), (f = h.default.ins.dataMap), m.ins.init();
  47. }
  48. init() {
  49. (this.buffAttr = n.default.ins.getRegionBuffAttrList(d.default.ins.curId)),
  50. (this.define = s.default.ConfigManager.getConfig("Define")),
  51. (this.offlineRewardMinTime = this.define.offline_reward_min_time),
  52. (this.costumeAttr = s.default.ControllerManager.getControllerModel(o.ControllerConst.Costume).attr),
  53. s.default.NotificationCenter.addListener(l.GameNotificationConst.UPDATE_BUFF, this.onUpdateBuff, this),
  54. s.default.NotificationCenter.addListener(
  55. l.GameNotificationConst.UPDATE_EQUIP_COSTUME_ATTR,
  56. this.onUpdateEquipCostume,
  57. this
  58. );
  59. }
  60. onUpdateEquipCostume(t) {
  61. for (const e of t)
  62. switch (e) {
  63. case a.CostumeAbilityType.base:
  64. this.calCookMoneyRate();
  65. break;
  66. case a.CostumeAbilityType.all_employees_production_speed:
  67. this.calChefProductionSpeed(), this.calWaiterProductionSpeed();
  68. break;
  69. case a.CostumeAbilityType.all_employees_move_speed:
  70. this.calChefSpeed(), this.calWaiterSpeed();
  71. break;
  72. case a.CostumeAbilityType.all_employees_perfect_dish_rate:
  73. this.calPerfectDishRate();
  74. break;
  75. case a.CostumeAbilityType.extremely_generous_tip_rate:
  76. this.calGenerousTipRate();
  77. break;
  78. case a.CostumeAbilityType.additional_cashier_charge:
  79. this.calMoneyRate();
  80. break;
  81. case a.CostumeAbilityType.menu_item_upgrade_discount:
  82. this.calMenuItemUpgradeDiscount();
  83. break;
  84. case a.CostumeAbilityType.waiter_production_speed:
  85. this.calWaiterProductionSpeed();
  86. break;
  87. case a.CostumeAbilityType.chef_production_speed:
  88. this.calChefProductionSpeed();
  89. break;
  90. case a.CostumeAbilityType.waiter_move_speed:
  91. this.calWaiterSpeed();
  92. break;
  93. case a.CostumeAbilityType.chef_move_speed:
  94. this.calChefSpeed();
  95. break;
  96. case a.CostumeAbilityType.instaCompleted_dish_rate:
  97. break;
  98. case a.CostumeAbilityType.upgrade_discount:
  99. this.calUpgradeDiscount();
  100. break;
  101. case a.CostumeAbilityType.doublebase:
  102. }
  103. }
  104. destroy() {
  105. s.default.NotificationCenter.removeAll(this);
  106. }
  107. onUpdateBuff(t, e, i) {
  108. switch (r.BUFF_TYPE[i]) {
  109. case r.BUFF_TYPE.CHEF_SPEED:
  110. this.calChefSpeed();
  111. break;
  112. case r.BUFF_TYPE.WAITER_SPEED:
  113. this.calWaiterSpeed();
  114. break;
  115. case r.BUFF_TYPE.CUSTOMER_MOVE_SPEED:
  116. this.calCustomerMoveSpeed();
  117. break;
  118. case r.BUFF_TYPE.COOK_SPEED:
  119. this.calChefProductionSpeed(), this.calWaiterProductionSpeed();
  120. break;
  121. case r.BUFF_TYPE.FOOD_SELL_RATE:
  122. this.calMoneyRate();
  123. break;
  124. case r.BUFF_TYPE.ALL_EMPLOYEES_MOVE_SPEED:
  125. this.calWaiterSpeed(), this.calChefSpeed();
  126. }
  127. }
  128. calAll() {
  129. this.calTipChance(),
  130. this.calTipRate(),
  131. this.calMoneyRate(),
  132. this.calGemsChanceAtAd(),
  133. this.calAdBoosterEffect(),
  134. this.calOfflineRevenue(),
  135. this.calOfflineRewardTime(),
  136. this.calAdBoosterDuration(),
  137. this.calCustomerMoveSpeed(),
  138. this.calAdRewardRevenue(),
  139. this.calChefSpeed(),
  140. this.calWaiterSpeed(),
  141. this.calCookMoneyRate(),
  142. this.calGenerousTipRate(),
  143. this.calInstaCompletedDishRate(),
  144. this.calPerfectDishRate(),
  145. this.calMenuItemUpgradeDiscount(),
  146. this.calUpgradeDiscount(),
  147. this.calChefProductionSpeed(),
  148. this.calWaiterProductionSpeed();
  149. }
  150. calUpgradeDiscount() {
  151. (this.upgradeDiscount = 1 - this.costumeAttr.getAttrValue(a.CostumeAbilityType.upgrade_discount, 0) / 100),
  152. p.default.ins.updateUpgradeDiscount();
  153. }
  154. calMenuItemUpgradeDiscount() {
  155. (this.menuItemUpgradeDiscount =
  156. 1 - this.costumeAttr.getAttrValue(a.CostumeAbilityType.menu_item_upgrade_discount, 0) / 100),
  157. c.default.ins.reCalAllFoodCost();
  158. }
  159. calInstaCompletedDishRate() { }
  160. calPerfectDishRate() {
  161. this.perfectDishRate =
  162. this.costumeAttr.getAttrValue(a.CostumeAbilityType.all_employees_perfect_dish_rate, 0) / 100;
  163. }
  164. calCookMoneyRate() {
  165. this.cookMoneyRate = 1 + this.costumeAttr.getAttrValue(a.CostumeAbilityType.base, 0) / 100;
  166. }
  167. calGenerousTipRate() {
  168. this.generousTipRate = this.costumeAttr.getAttrValue(a.CostumeAbilityType.extremely_generous_tip_rate, 0) / 100;
  169. }
  170. calMoneyRate() {
  171. this.moneyRate =
  172. this.buffAttr.attr.FOOD_SELL_RATE *
  173. (1 + this.costumeAttr.getAttrValue(a.CostumeAbilityType.additional_cashier_charge, 0) / 100);
  174. }
  175. calTipChance() {
  176. this.tipChance = f[h.PayAbilityType.get_tips_chance].getValue(0);
  177. }
  178. calChefProductionSpeed() {
  179. this.chefProductionSpeed =
  180. 1 +
  181. (this.costumeAttr.getAttrValue(a.CostumeAbilityType.chef_production_speed, 0) +
  182. this.costumeAttr.getAttrValue(a.CostumeAbilityType.all_employees_production_speed, 0) +
  183. this.buffAttr.attr.COOK_SPEED) /
  184. 100;
  185. }
  186. calWaiterProductionSpeed() {
  187. this.waiterProductionSpeed =
  188. 1 +
  189. (this.costumeAttr.getAttrValue(a.CostumeAbilityType.waiter_production_speed, 0) +
  190. this.costumeAttr.getAttrValue(a.CostumeAbilityType.all_employees_production_speed, 0) +
  191. this.buffAttr.attr.COOK_SPEED) /
  192. 100;
  193. }
  194. calChefSpeed() {
  195. (this.chefspeed = Math.floor(
  196. (this.define.crew_move_speed *
  197. (g.chefspeed +
  198. this.buffAttr.attr.ALL_EMPLOYEES_MOVE_SPEED +
  199. this.buffAttr.attr.CHEF_SPEED +
  200. this.costumeAttr.getAttrValue(a.CostumeAbilityType.chef_move_speed, 0) +
  201. this.costumeAttr.getAttrValue(a.CostumeAbilityType.all_employees_move_speed, 0))) /
  202. 100
  203. )),
  204. g.updateChefSpeed();
  205. }
  206. calWaiterSpeed() {
  207. (this.waiterspeed = Math.floor(
  208. (this.define.crew_move_speed *
  209. (g.waiterspeed +
  210. this.buffAttr.attr.WAITER_SPEED +
  211. this.buffAttr.attr.ALL_EMPLOYEES_MOVE_SPEED +
  212. this.costumeAttr.getAttrValue(a.CostumeAbilityType.waiter_move_speed, 0) +
  213. this.costumeAttr.getAttrValue(a.CostumeAbilityType.all_employees_move_speed, 0))) /
  214. 100
  215. )),
  216. g.updateWaiterSpeed();
  217. }
  218. calTipRate() {
  219. this.tipRate = f[h.PayAbilityType.tips_rate].getValue(1) * this.define.tip_value;
  220. }
  221. calGemsChanceAtAd() {
  222. console.error('取消掉 这个咯 ');
  223. return
  224. this.gemsChanceAtAd = f[h.PayAbilityType.gems_chance_at_ad].getValue(0);
  225. }
  226. calOfflineRevenue() {
  227. this.offlineRevenue = f[h.PayAbilityType.offline_revenue].getValue(1);
  228. }
  229. calOfflineRewardTime() {
  230. this.offlineRewardMaxTime = Math.floor(
  231. this.define.offline_reward_max_time * f[h.PayAbilityType.offline_reward_time].getValue(1)
  232. );
  233. }
  234. calAdBoosterDuration() {
  235. console.error('取消掉 这个咯 ');
  236. return
  237. this.adBoosterDuration = Math.floor(
  238. f[h.PayAbilityType.ad_booster_duration].getValue(1) * this.define.booster_ad_time
  239. );
  240. }
  241. calAdBoosterEffect() {
  242. console.error('取消掉 这个咯 ');
  243. return
  244. this.ad_booster_effect = this.define.booster_ad_value / 100 + f[h.PayAbilityType.ad_booster_effect].getValue(0);
  245. }
  246. calCustomerMoveSpeed() {
  247. this.customerMoveSpeed =
  248. this.define.customer_move_speed *
  249. (f[h.PayAbilityType.customer_move_speed].getValue(1) + this.buffAttr.attr.CUSTOMER_MOVE_SPEED / 100);
  250. }
  251. calAdRewardRevenue() {
  252. console.error('取消掉 这个咯 ');
  253. return
  254. this.adRewardRevenue = this.define.booster_ad_value / 100 + f[h.PayAbilityType.ad_reward_revenue].getValue(0);
  255. }
  256. }
  257. (i.default = m), (m.ins = null);