poi-plugin-item-improvement2-beta 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/workspace.xml +36 -36
- package/package.json +1 -1
- package/views/detail-row.js +1 -1
- package/views/selectors.js +3 -1
- package/views/starcraft/equip-list-view.js +3 -1
- package/views/starcraft/equip-view.js +1 -6
- package/views/starcraft/plan-modify-control.js +4 -20
- package/views/starcraft/plan-view.js +1 -14
- package/views/starcraft/utils.js +155 -16
package/.idea/workspace.xml
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
<change beforePath="$PROJECT_DIR$/views/selectors.es" beforeDir="false" afterPath="$PROJECT_DIR$/views/selectors.es" afterDir="false" />
|
|
13
13
|
<change beforePath="$PROJECT_DIR$/views/starcraft/add-new-equip-view.es" beforeDir="false" afterPath="$PROJECT_DIR$/views/starcraft/add-new-equip-view.es" afterDir="false" />
|
|
14
14
|
<change beforePath="$PROJECT_DIR$/views/starcraft/control-panel.es" beforeDir="false" afterPath="$PROJECT_DIR$/views/starcraft/control-panel.es" afterDir="false" />
|
|
15
|
+
<change beforePath="$PROJECT_DIR$/views/starcraft/equip-list-view.es" beforeDir="false" afterPath="$PROJECT_DIR$/views/starcraft/equip-list-view.es" afterDir="false" />
|
|
15
16
|
<change beforePath="$PROJECT_DIR$/views/starcraft/equip-view.es" beforeDir="false" afterPath="$PROJECT_DIR$/views/starcraft/equip-view.es" afterDir="false" />
|
|
16
17
|
<change beforePath="$PROJECT_DIR$/views/starcraft/plan-modify-control.es" beforeDir="false" afterPath="$PROJECT_DIR$/views/starcraft/plan-modify-control.es" afterDir="false" />
|
|
17
18
|
<change beforePath="$PROJECT_DIR$/views/starcraft/plan-view.es" beforeDir="false" afterPath="$PROJECT_DIR$/views/starcraft/plan-view.es" afterDir="false" />
|
|
18
|
-
<change beforePath="$PROJECT_DIR$/views/starcraft/starcraft-area.es" beforeDir="false" afterPath="$PROJECT_DIR$/views/starcraft/starcraft-area.es" afterDir="false" />
|
|
19
19
|
<change beforePath="$PROJECT_DIR$/views/starcraft/utils.es" beforeDir="false" afterPath="$PROJECT_DIR$/views/starcraft/utils.es" afterDir="false" />
|
|
20
20
|
</list>
|
|
21
21
|
<option name="SHOW_DIALOG" value="false" />
|
|
@@ -47,23 +47,23 @@
|
|
|
47
47
|
</component>
|
|
48
48
|
<component name="NextEditCompletionFeaturesState">
|
|
49
49
|
<decayedCancelled>
|
|
50
|
-
<entry key="MS100" value="1.
|
|
51
|
-
<entry key="MS500" value="
|
|
52
|
-
<entry key="S2" value="
|
|
53
|
-
<entry key="S5" value="
|
|
54
|
-
<entry key="S10" value="
|
|
55
|
-
<entry key="S30" value="
|
|
56
|
-
<entry key="S60" value="
|
|
57
|
-
<entry key="M2" value="
|
|
58
|
-
<entry key="M5" value="
|
|
59
|
-
<entry key="M10" value="
|
|
60
|
-
<entry key="M15" value="
|
|
61
|
-
<entry key="M30" value="
|
|
62
|
-
<entry key="H1" value="
|
|
63
|
-
<entry key="H2" value="
|
|
64
|
-
<entry key="H4" value="
|
|
65
|
-
<entry key="D1" value="
|
|
66
|
-
<entry key="W1" value="
|
|
50
|
+
<entry key="MS100" value="1.0" />
|
|
51
|
+
<entry key="MS500" value="1.0" />
|
|
52
|
+
<entry key="S2" value="1.0" />
|
|
53
|
+
<entry key="S5" value="1.0000000000440097" />
|
|
54
|
+
<entry key="S10" value="1.0000173658607443" />
|
|
55
|
+
<entry key="S30" value="1.1033700977851304" />
|
|
56
|
+
<entry key="S60" value="2.1353106976081797" />
|
|
57
|
+
<entry key="M2" value="6.945343005474441" />
|
|
58
|
+
<entry key="M5" value="32.57230674546156" />
|
|
59
|
+
<entry key="M10" value="74.73068787690221" />
|
|
60
|
+
<entry key="M15" value="106.46012906724152" />
|
|
61
|
+
<entry key="M30" value="165.36281189270642" />
|
|
62
|
+
<entry key="H1" value="226.92983606225295" />
|
|
63
|
+
<entry key="H2" value="284.53161724600875" />
|
|
64
|
+
<entry key="H4" value="328.2622516051157" />
|
|
65
|
+
<entry key="D1" value="377.35557695453997" />
|
|
66
|
+
<entry key="W1" value="387.29368684770884" />
|
|
67
67
|
</decayedCancelled>
|
|
68
68
|
<decayedSelected>
|
|
69
69
|
<entry key="MS100" value="0.0" />
|
|
@@ -85,23 +85,23 @@
|
|
|
85
85
|
<entry key="W1" value="0.0" />
|
|
86
86
|
</decayedSelected>
|
|
87
87
|
<decayedShown>
|
|
88
|
-
<entry key="MS100" value="
|
|
89
|
-
<entry key="MS500" value="
|
|
90
|
-
<entry key="S2" value="
|
|
91
|
-
<entry key="S5" value="
|
|
92
|
-
<entry key="S10" value="
|
|
93
|
-
<entry key="S30" value="
|
|
94
|
-
<entry key="S60" value="
|
|
95
|
-
<entry key="M2" value="
|
|
96
|
-
<entry key="M5" value="
|
|
97
|
-
<entry key="M10" value="
|
|
98
|
-
<entry key="M15" value="
|
|
99
|
-
<entry key="M30" value="
|
|
100
|
-
<entry key="H1" value="
|
|
101
|
-
<entry key="H2" value="
|
|
102
|
-
<entry key="H4" value="
|
|
103
|
-
<entry key="D1" value="
|
|
104
|
-
<entry key="W1" value="
|
|
88
|
+
<entry key="MS100" value="0.9726549474122855" />
|
|
89
|
+
<entry key="MS500" value="0.9944701686732144" />
|
|
90
|
+
<entry key="S2" value="0.9986146661010289" />
|
|
91
|
+
<entry key="S5" value="0.9994456360160858" />
|
|
92
|
+
<entry key="S10" value="0.9997401398750585" />
|
|
93
|
+
<entry key="S30" value="1.1032659330938805" />
|
|
94
|
+
<entry key="S60" value="2.135198862399266" />
|
|
95
|
+
<entry key="M2" value="6.9451608804972915" />
|
|
96
|
+
<entry key="M5" value="32.57198364510173" />
|
|
97
|
+
<entry key="M10" value="74.73031181800991" />
|
|
98
|
+
<entry key="M15" value="106.45976857925676" />
|
|
99
|
+
<entry key="M30" value="165.36252748377441" />
|
|
100
|
+
<entry key="H1" value="226.92963569108224" />
|
|
101
|
+
<entry key="H2" value="284.5314880671632" />
|
|
102
|
+
<entry key="H4" value="328.26217562979866" />
|
|
103
|
+
<entry key="D1" value="377.3555621195751" />
|
|
104
|
+
<entry key="W1" value="387.2936846650219" />
|
|
105
105
|
</decayedShown>
|
|
106
106
|
</component>
|
|
107
107
|
<component name="ProjectColorInfo">{
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
<workItem from="1782110779541" duration="10000" />
|
|
214
214
|
<workItem from="1782110798129" duration="16000" />
|
|
215
215
|
<workItem from="1782110944618" duration="30000" />
|
|
216
|
-
<workItem from="1782223012580" duration="
|
|
216
|
+
<workItem from="1782223012580" duration="11298000" />
|
|
217
217
|
</task>
|
|
218
218
|
<servers />
|
|
219
219
|
</component>
|
package/package.json
CHANGED
package/views/detail-row.js
CHANGED
|
@@ -25,7 +25,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
25
|
|
|
26
26
|
const {
|
|
27
27
|
__
|
|
28
|
-
} = window.i18n['poi-plugin-item-improvement2-beta
|
|
28
|
+
} = window.i18n['poi-plugin-item-improvement2-beta'];
|
|
29
29
|
const WEEKDAY = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
30
30
|
|
|
31
31
|
const isAvailableOnDay = (improvement, day) => day === -1 || (improvement.shipWeekList || []).some(shipWeek => (shipWeek.week || [])[day]);
|
package/views/selectors.js
CHANGED
|
@@ -109,7 +109,9 @@ const shipUniqueMapSelector = (0, _reselect.createSelector)([uniqueShipIdsSelect
|
|
|
109
109
|
exports.shipUniqueMapSelector = shipUniqueMapSelector;
|
|
110
110
|
const adjustedRemodelChainsSelector = (0, _reselect.createSelector)([remodelChainsSelector, shipUniqueMapSelector], (remodelChains, uniqueMap) => (0, _lodash.default)(uniqueMap).mapValues(uniqueId => remodelChains[uniqueId]).value());
|
|
111
111
|
exports.adjustedRemodelChainsSelector = adjustedRemodelChainsSelector;
|
|
112
|
-
const starCraftPlanSelector = (0, _reselect.createSelector)([_selectors.configSelector], config => _lodash.default.get(config, 'plugin.poi-plugin-starcraft.plans', {})
|
|
112
|
+
const starCraftPlanSelector = (0, _reselect.createSelector)([_selectors.configSelector], config => (0, _utils.normalizePlans)(_lodash.default.get(config, 'plugin.poi-plugin-starcraft.plans', {}), {
|
|
113
|
+
emptyAsDefault: true
|
|
114
|
+
}));
|
|
113
115
|
exports.starCraftPlanSelector = starCraftPlanSelector;
|
|
114
116
|
const equipAvailableSelector = (0, _reselect.createSelector)([_selectors.equipsSelector], equips => (0, _lodash.default)(equips).filter({
|
|
115
117
|
'api_level': 0
|
|
@@ -9,6 +9,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
|
|
10
10
|
var _reactBootstrap = require("react-bootstrap");
|
|
11
11
|
|
|
12
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
13
|
+
|
|
12
14
|
var _equipView = require("./equip-view");
|
|
13
15
|
|
|
14
16
|
var _addNewEquipView = require("./add-new-equip-view");
|
|
@@ -21,7 +23,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
21
23
|
|
|
22
24
|
class EquipListView extends _react.Component {
|
|
23
25
|
shouldComponentUpdate(nextProps) {
|
|
24
|
-
return this.props.viewMode !== nextProps.viewMode || !
|
|
26
|
+
return this.props.viewMode !== nextProps.viewMode || !_lodash.default.isEqual(this.props.equips, nextProps.equips) || !_lodash.default.isEqual(this.props.plans, nextProps.plans);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
render() {
|
|
@@ -47,12 +47,7 @@ const EquipView = (0, _reactRedux.connect)((state, {
|
|
|
47
47
|
enumerable: true,
|
|
48
48
|
writable: true,
|
|
49
49
|
value: mstId => () => {
|
|
50
|
-
(0, _utils.
|
|
51
|
-
const newPlans = _extends({}, plans);
|
|
52
|
-
|
|
53
|
-
delete newPlans[mstId];
|
|
54
|
-
return newPlans;
|
|
55
|
-
});
|
|
50
|
+
(0, _utils.removeEquipPlans)(mstId);
|
|
56
51
|
}
|
|
57
52
|
}), _temp;
|
|
58
53
|
}
|
|
@@ -13,16 +13,14 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
13
13
|
|
|
14
14
|
var _reactBootstrap = require("react-bootstrap");
|
|
15
15
|
|
|
16
|
-
var _utils = require("./utils");
|
|
17
|
-
|
|
18
16
|
var _reactNumericInput = _interopRequireDefault(require("react-numeric-input"));
|
|
19
17
|
|
|
18
|
+
var _utils = require("./utils");
|
|
19
|
+
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
22
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
23
23
|
|
|
24
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
-
|
|
26
24
|
const {
|
|
27
25
|
__
|
|
28
26
|
} = window.i18n['poi-plugin-item-improvement2-beta']; // props:
|
|
@@ -88,26 +86,12 @@ class PlanModifyControl extends _react.Component {
|
|
|
88
86
|
const mstId = this.props.mstId;
|
|
89
87
|
|
|
90
88
|
if (action === 'add' || action === 'modify') {
|
|
91
|
-
(0, _utils.
|
|
92
|
-
const newPlans = _extends({}, plans); // it's safe to assume that plans[mstId] must exist at this point
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
newPlans[mstId] = _extends({}, plans[mstId]);
|
|
96
|
-
newPlans[mstId][star] = isInfinity ? _utils.infinityNum : planCount;
|
|
97
|
-
return newPlans;
|
|
98
|
-
});
|
|
89
|
+
(0, _utils.setEquipPlan)(mstId, star, isInfinity ? _utils.infinityNum : planCount);
|
|
99
90
|
return;
|
|
100
91
|
}
|
|
101
92
|
|
|
102
93
|
if (action === 'remove') {
|
|
103
|
-
(0, _utils.
|
|
104
|
-
const newPlans = _extends({}, plans); // it's safe to assume that plans[mstId] must exist at this point
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
newPlans[mstId] = _extends({}, plans[mstId]);
|
|
108
|
-
delete newPlans[mstId][star];
|
|
109
|
-
return newPlans;
|
|
110
|
-
});
|
|
94
|
+
(0, _utils.removeEquipPlan)(mstId, star);
|
|
111
95
|
return;
|
|
112
96
|
}
|
|
113
97
|
|
|
@@ -15,8 +15,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
17
17
|
|
|
18
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
-
|
|
20
18
|
const {
|
|
21
19
|
__
|
|
22
20
|
} = window.i18n['poi-plugin-item-improvement2-beta'];
|
|
@@ -34,18 +32,7 @@ class PlanView extends _react.Component {
|
|
|
34
32
|
mstId,
|
|
35
33
|
star
|
|
36
34
|
} = this.props;
|
|
37
|
-
(0, _utils.
|
|
38
|
-
const newPlans = _extends({}, plans);
|
|
39
|
-
|
|
40
|
-
newPlans[mstId] = _extends({}, plans[mstId]);
|
|
41
|
-
delete newPlans[mstId][star];
|
|
42
|
-
|
|
43
|
-
if (Object.keys(newPlans[mstId]).length === 0) {
|
|
44
|
-
delete newPlans[mstId];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return newPlans;
|
|
48
|
-
});
|
|
35
|
+
(0, _utils.removeEquipPlan)(mstId, star);
|
|
49
36
|
}
|
|
50
37
|
}), _temp;
|
|
51
38
|
}
|
package/views/starcraft/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.isEquipMasterEqual = exports.starText = exports.initFirstPlan = exports.modifyPlans = exports.keyPlans = exports.PLUGIN_KEY = exports.addNewEquipPlan = exports.getStarcraftPlans = exports.infinityNum = void 0;
|
|
4
|
+
exports.isEquipMasterEqual = exports.starText = exports.initFirstPlan = exports.modifyPlans = exports.keyPlans = exports.PLUGIN_KEY = exports.addNewEquipPlan = exports.removeEquipPlans = exports.removeEquipPlan = exports.setEquipPlan = exports.getStarcraftPlans = exports.normalizePlans = exports.infinityNum = void 0;
|
|
5
5
|
|
|
6
6
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
7
7
|
|
|
@@ -22,44 +22,183 @@ const {
|
|
|
22
22
|
const infinityNum = 10000;
|
|
23
23
|
exports.infinityNum = infinityNum;
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const normalizeNumberKey = value => {
|
|
26
|
+
if (typeof value === 'number') {
|
|
27
|
+
return Number.isInteger(value) ? value : null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (typeof value !== 'string' || !/^\d+$/.test(value)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return parseInt(value, 10);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const normalizePlanId = id => {
|
|
38
|
+
const parsed = normalizeNumberKey(id);
|
|
39
|
+
return parsed > 0 ? `${parsed}` : null;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const normalizePlanStar = star => {
|
|
43
|
+
const parsed = normalizeNumberKey(star);
|
|
44
|
+
return parsed !== null && parsed >= 0 && parsed <= 10 ? `${parsed}` : null;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const normalizePlanCount = count => {
|
|
48
|
+
return Number.isInteger(count) && count > 0 ? count : null;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const normalizeSinglePlan = (plan, {
|
|
52
|
+
emptyAsDefault = false
|
|
53
|
+
} = {}) => {
|
|
54
|
+
if (!_lodash.default.isPlainObject(plan)) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const normalized = {};
|
|
59
|
+
const stars = Object.keys(plan);
|
|
60
|
+
|
|
61
|
+
if (stars.length === 0 && emptyAsDefault) {
|
|
62
|
+
normalized[0] = infinityNum;
|
|
63
|
+
return normalized;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
stars.forEach(star => {
|
|
67
|
+
const starKey = normalizePlanStar(star);
|
|
68
|
+
const count = normalizePlanCount(plan[star]);
|
|
69
|
+
|
|
70
|
+
if (starKey && count) {
|
|
71
|
+
normalized[starKey] = count;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return normalized;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const normalizePlans = (plans, options = {}) => {
|
|
78
|
+
const normalized = {};
|
|
79
|
+
|
|
80
|
+
if (!_lodash.default.isPlainObject(plans)) {
|
|
81
|
+
return normalized;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
Object.keys(plans || {}).forEach(id => {
|
|
85
|
+
const idKey = normalizePlanId(id);
|
|
86
|
+
|
|
87
|
+
if (!idKey) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const plan = normalizeSinglePlan(plans[id], options);
|
|
92
|
+
|
|
93
|
+
if (plan && Object.keys(plan).length > 0) {
|
|
94
|
+
normalized[idKey] = plan;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return normalized;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
exports.normalizePlans = normalizePlans;
|
|
101
|
+
|
|
102
|
+
const getStarcraftPlans = () => normalizePlans(config.get(keyPlans, {}), {
|
|
103
|
+
emptyAsDefault: true
|
|
104
|
+
});
|
|
26
105
|
|
|
27
106
|
exports.getStarcraftPlans = getStarcraftPlans;
|
|
28
107
|
|
|
29
108
|
const modifyPlans = modify => {
|
|
30
|
-
const oldPlans =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
109
|
+
const oldPlans = getStarcraftPlans();
|
|
110
|
+
const newPlans = normalizePlans(modify(oldPlans));
|
|
111
|
+
config.set(keyPlans, newPlans);
|
|
112
|
+
};
|
|
34
113
|
|
|
35
114
|
exports.modifyPlans = modifyPlans;
|
|
36
115
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
116
|
+
const setEquipPlan = (id, star, count) => {
|
|
117
|
+
const planId = normalizePlanId(id);
|
|
118
|
+
const planStar = normalizePlanStar(star);
|
|
119
|
+
const planCount = normalizePlanCount(count);
|
|
120
|
+
|
|
121
|
+
if (!planId || !planStar || !planCount) {
|
|
122
|
+
console.error('Invalid equipment plan:', id, star, count);
|
|
40
123
|
return;
|
|
41
124
|
}
|
|
42
125
|
|
|
43
126
|
modifyPlans(plans => {
|
|
44
|
-
const newPlans = _extends({}, plans);
|
|
127
|
+
const newPlans = _extends({}, plans);
|
|
128
|
+
|
|
129
|
+
newPlans[planId] = _extends({}, plans[planId] || {});
|
|
130
|
+
newPlans[planId][planStar] = planCount;
|
|
131
|
+
return newPlans;
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
exports.setEquipPlan = setEquipPlan;
|
|
136
|
+
|
|
137
|
+
const removeEquipPlan = (id, star) => {
|
|
138
|
+
const planId = normalizePlanId(id);
|
|
139
|
+
const planStar = normalizePlanStar(star);
|
|
140
|
+
|
|
141
|
+
if (!planId || !planStar) {
|
|
142
|
+
console.error('Invalid equipment plan:', id, star);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
modifyPlans(plans => {
|
|
147
|
+
if (!plans[planId]) {
|
|
148
|
+
return plans;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const newPlans = _extends({}, plans);
|
|
152
|
+
|
|
153
|
+
newPlans[planId] = _extends({}, plans[planId]);
|
|
154
|
+
delete newPlans[planId][planStar];
|
|
155
|
+
return newPlans;
|
|
156
|
+
});
|
|
157
|
+
};
|
|
45
158
|
|
|
159
|
+
exports.removeEquipPlan = removeEquipPlan;
|
|
46
160
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} // 初始化第一条 plan
|
|
161
|
+
const removeEquipPlans = id => {
|
|
162
|
+
const planId = normalizePlanId(id);
|
|
50
163
|
|
|
164
|
+
if (!planId) {
|
|
165
|
+
console.error('Invalid equipment id:', id);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
51
168
|
|
|
52
|
-
|
|
169
|
+
modifyPlans(plans => {
|
|
170
|
+
const newPlans = _extends({}, plans);
|
|
171
|
+
|
|
172
|
+
delete newPlans[planId];
|
|
53
173
|
return newPlans;
|
|
54
174
|
});
|
|
175
|
+
}; // 新增单个装备计划
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
exports.removeEquipPlans = removeEquipPlans;
|
|
179
|
+
|
|
180
|
+
const addNewEquipPlan = id => {
|
|
181
|
+
setEquipPlan(id, 0, infinityNum);
|
|
55
182
|
}; // 通用的初始化 plan 第一条记录
|
|
56
183
|
|
|
57
184
|
|
|
58
185
|
exports.addNewEquipPlan = addNewEquipPlan;
|
|
59
186
|
|
|
60
187
|
const initFirstPlan = (plans, id) => {
|
|
61
|
-
|
|
62
|
-
|
|
188
|
+
const planId = normalizePlanId(id);
|
|
189
|
+
|
|
190
|
+
if (!planId) {
|
|
191
|
+
return plans;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
plans[planId] = normalizeSinglePlan(plans[planId]);
|
|
195
|
+
|
|
196
|
+
if (!plans[planId]) {
|
|
197
|
+
plans[planId] = {};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (Object.keys(plans[planId]).length === 0) {
|
|
201
|
+
plans[planId][0] = infinityNum;
|
|
63
202
|
}
|
|
64
203
|
|
|
65
204
|
return plans;
|