HelperCatData.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. Object.defineProperty(i, "__esModule", {value: !0});
  5. const s = t("CostumeAttr"),
  6. o = t("CostumeConst"),
  7. a = t("CostumeController");
  8. i.default = class {
  9. constructor() {
  10. (this.attr = null), (this.equipItems = {}), (this.recalMap = []), (this.cfg = null);
  11. }
  12. init(t, e) {
  13. this.cfg = e;
  14. const i = a.default.ins;
  15. this.equipItems = {
  16. [o.CostumeParts.hand]: i.getTempCostume(
  17. e.costume_hand,
  18. t.costume[o.CostumeParts.hand].grade,
  19. t.costume[o.CostumeParts.hand].lv
  20. ),
  21. [o.CostumeParts.body]: i.getTempCostume(
  22. e.costume_body,
  23. t.costume[o.CostumeParts.body].grade,
  24. t.costume[o.CostumeParts.body].lv
  25. ),
  26. [o.CostumeParts.head]: i.getTempCostume(
  27. e.costume_head,
  28. t.costume[o.CostumeParts.head].grade,
  29. t.costume[o.CostumeParts.head].lv
  30. )
  31. };
  32. }
  33. record(t) {
  34. this.recalMap.includes(t) || this.recalMap.push(t);
  35. }
  36. initAttr() {
  37. this.attr = new s.default();
  38. for (let t = o.CostumeParts.head; t <= o.CostumeParts.hand; t++)
  39. this.attr.addAttrBute("costume" + t, new s.default());
  40. this.calEquipCostumeAttr();
  41. }
  42. getGlobalAttr() {
  43. var t = [
  44. o.CostumeAbilityType.upgrade_discount,
  45. o.CostumeAbilityType.chef_move_speed,
  46. o.CostumeAbilityType.waiter_move_speed,
  47. o.CostumeAbilityType.chef_production_speed,
  48. o.CostumeAbilityType.waiter_production_speed,
  49. o.CostumeAbilityType.menu_item_upgrade_discount,
  50. o.CostumeAbilityType.additional_cashier_charge,
  51. o.CostumeAbilityType.extremely_generous_tip_rate,
  52. o.CostumeAbilityType.all_employees_move_speed,
  53. o.CostumeAbilityType.all_employees_perfect_dish_rate,
  54. o.CostumeAbilityType.all_employees_production_speed
  55. ];
  56. const e = {},
  57. i = this.attr.finalAttr;
  58. for (const s of t) i[s] && (e[s] = i[s]);
  59. return e;
  60. }
  61. calEquipCostumeAttr() {
  62. const e = this.attr;
  63. for (let t = o.CostumeParts.head; t <= o.CostumeParts.hand; t++) {
  64. const i = this.equipItems[t],
  65. s = e.getAttrBute("costume" + t);
  66. if (i) {
  67. for (const e in i.attr) this.record(parseInt(e));
  68. s.addAttrDict("base", i.attr), s.claFinishAttr();
  69. } else s.reset();
  70. }
  71. e.claFinishAttr();
  72. }
  73. };