poi-plugin-milk 1.0.0

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.
@@ -0,0 +1,226 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.switchPluginPath = exports.reactClass = undefined;
7
+
8
+ var _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; };
9
+
10
+ // Import selectors defined in poi
11
+
12
+
13
+ var _react = require('react');
14
+
15
+ var _react2 = _interopRequireDefault(_react);
16
+
17
+ var _reactRedux = require('react-redux');
18
+
19
+ var _reselect = require('reselect');
20
+
21
+ var _lodash = require('lodash');
22
+
23
+ var _lodash2 = _interopRequireDefault(_lodash);
24
+
25
+ var _path = require('path');
26
+
27
+ var _reactBootstrap = require('react-bootstrap');
28
+
29
+ var _selectors = require('views/utils/selectors');
30
+
31
+ var _functions = require('./parts/functions');
32
+
33
+ var _fleetList = require('./parts/fleet-list');
34
+
35
+ var _fleetList2 = _interopRequireDefault(_fleetList);
36
+
37
+ var _candidates = require('./parts/candidates');
38
+
39
+ var _candidates2 = _interopRequireDefault(_candidates);
40
+
41
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42
+
43
+ const { i18n, getStore } = window;
44
+ const __ = i18n['poi-plugin-anchorage-repair'].__.bind(i18n['poi-plugin-anchorage-repair']);
45
+
46
+ const AKASHI_ID = [182, 187]; // akashi and kai ID in $ships
47
+ const SRF_ID = 86; // Ship Repair Facility ID in $slotitems
48
+
49
+
50
+ // check a fleet status, returns information related to anchorage repair
51
+ const fleetAkashiConv = (fleet, $ships, ships, equips, repairId) => {
52
+ const pickKey = ['api_id', 'api_ship_id', 'api_lv', 'api_nowhp', 'api_maxhp', 'api_ndock_time'];
53
+
54
+ let canRepair = false;
55
+ let akashiFlagship = false;
56
+ let repairCount = 0;
57
+ const inExpedition = _lodash2.default.get(fleet, 'api_mission.0') && true;
58
+ const flagShipInRepair = _lodash2.default.includes(repairId, _lodash2.default.get(fleet, 'api_ship.0', -1));
59
+ const flagship = ships[_lodash2.default.get(fleet, 'api_ship.0', -1)];
60
+
61
+ if (flagship != null) {
62
+ akashiFlagship = _lodash2.default.includes(AKASHI_ID, flagship.api_ship_id);
63
+ repairCount = _lodash2.default.filter(flagship.api_slot, item => _lodash2.default.get(equips, `${item}.api_slotitem_id`, -1) === SRF_ID).length;
64
+ repairCount += akashiFlagship ? 2 : 0;
65
+ }
66
+
67
+ canRepair = akashiFlagship && !inExpedition && !flagShipInRepair;
68
+
69
+ const repairDetail = _lodash2.default.map(_lodash2.default.filter(fleet.api_ship, shipId => shipId > 0), (shipId, index) => {
70
+ if (shipId === -1) return false; // break, LODASH ONLY
71
+
72
+ const ship = _lodash2.default.pick(ships[shipId], pickKey);
73
+
74
+ const constShip = _lodash2.default.pick($ships[ship.api_ship_id], ['api_name', 'api_stype']);
75
+
76
+ return _extends({}, ship, constShip, {
77
+ estimate: (0, _functions.akashiEstimate)(ship),
78
+ timePerHP: (0, _functions.getTimePerHP)(ship.api_lv, constShip.api_stype),
79
+ inRepair: _lodash2.default.includes(repairId, ship.api_id),
80
+ availableSRF: index < repairCount
81
+ });
82
+ });
83
+
84
+ var repairStatus = 0
85
+ if(canRepair){
86
+ repairStatus = 1;
87
+ }else{
88
+ var flagshipid = _lodash2.default.get(fleet, 'api_ship.0', -1)
89
+ var secondshipid = _lodash2.default.get(fleet, 'api_ship.0', -1)
90
+ if(flagshipid==996||flagshipid==1002||secondshipid==996||secondshipid==1002){
91
+ repairStatus = 2;
92
+ }
93
+ }
94
+
95
+ return {
96
+ api_id: fleet.api_id || -1,
97
+ shipId: fleet.api_ship || [],
98
+ canRepair,
99
+ akashiFlagship,
100
+ inExpedition,
101
+ flagShipInRepair,
102
+ repairCount,
103
+ repairDetail
104
+ };
105
+ };
106
+
107
+ // selectors
108
+
109
+ const repairIdSelector = (0, _reselect.createSelector)([_selectors.repairsSelector], repair => _lodash2.default.map(repair, dock => dock.api_ship_id));
110
+
111
+ const constShipsSelector = state => state.const.$ships || {};
112
+
113
+ const fleetsAkashiSelector = (0, _reselect.createSelector)([constShipsSelector, _selectors.fleetsSelector, _selectors.shipsSelector, _selectors.equipsSelector, repairIdSelector], ($ships, fleets, ships, equips, repairId) => ({ fleets: _lodash2.default.map(fleets, fleet => fleetAkashiConv(fleet, $ships, ships, equips, repairId)) })
114
+
115
+ // React
116
+
117
+ );const reactClass = exports.reactClass = (0, _reactRedux.connect)((0, _selectors.createDeepCompareArraySelector)([fleetsAkashiSelector, _selectors.miscSelector], (data, { canNotify }) => _extends({}, data, {
118
+ canNotify
119
+ })))(class PluginAnchorageRepair extends _react.Component {
120
+
121
+ constructor(props) {
122
+ super(props);
123
+
124
+ this.handleSelectTab = key => {
125
+ this.setState({ activeTab: key });
126
+ };
127
+
128
+ this.handleSort = index => () => {
129
+ this.setState({
130
+ sortIndex: index
131
+ });
132
+ };
133
+
134
+ this.state = {
135
+ activeTab: 1,
136
+ sortIndex: 0
137
+ };
138
+ }
139
+
140
+ render() {
141
+ return _react2.default.createElement(
142
+ 'div',
143
+ { id: 'anchorage-repair' },
144
+ _react2.default.createElement('link', { rel: 'stylesheet', href: (0, _path.join)(__dirname, 'assets', 'style.css') }),
145
+ _react2.default.createElement(
146
+ _reactBootstrap.Tabs,
147
+ { activeKey: this.state.activeTab, onSelect: this.handleSelectTab, id: 'anchorage-tabs' },
148
+ _lodash2.default.map(this.props.fleets, (fleet, index) => _react2.default.createElement(
149
+ _reactBootstrap.Tab,
150
+ {
151
+ eventKey: fleet.api_id,
152
+ title: fleet.api_id,
153
+ key: `anchorage-tab-${index}`,
154
+ tabClassName: fleet.canRepair ? 'can-repair' : ''
155
+ },
156
+ _react2.default.createElement(_fleetList2.default, { fleet: fleet })
157
+ )),
158
+ _react2.default.createElement(
159
+ _reactBootstrap.Tab,
160
+ {
161
+ className: 'candidate-pane',
162
+ eventKey: -1,
163
+ title: __('Candidates')
164
+ },
165
+ _react2.default.createElement(_candidates2.default, { handleSort: this.handleSort, sortIndex: this.state.sortIndex })
166
+ )
167
+ )
168
+ );
169
+ }
170
+ }
171
+
172
+ /*
173
+
174
+ The following APIs are called in order when a fleet returns from expedition:
175
+
176
+ - api_req_mission/result
177
+ - api_port/port
178
+
179
+ As anchorage repair pops up conditionally on the latter one,
180
+ it also prevents other plugins' auto-switch mechanism on
181
+ tracking api_req_mission/result calls.
182
+
183
+ The problem is solved by applying a lock upon expedition returns
184
+ and ignoring the immediately followed api_port/port call.
185
+
186
+ */
187
+ );let expedReturnLock = null;
188
+ const clearExpedReturnLock = () => {
189
+ if (expedReturnLock !== null) {
190
+ clearTimeout(expedReturnLock);
191
+ expedReturnLock = null;
192
+ }
193
+ };
194
+
195
+ const switchPluginPath = exports.switchPluginPath = [{
196
+ path: '/kcsapi/api_port/port',
197
+ valid: () => {
198
+ if (expedReturnLock !== null) {
199
+ /*
200
+ this is the immediately followed api_port/port call
201
+ after an expedition returning event.
202
+ */
203
+ clearExpedReturnLock();
204
+ return false;
205
+ }
206
+
207
+ const { fleets = [], ships = {}, equips = {}, repairs = [] } = getStore('info') || {};
208
+ const $ships = getStore('const.$ships');
209
+ const repairId = repairs.map(dock => dock.api_ship_id);
210
+
211
+ const result = fleets.map(fleet => fleetAkashiConv(fleet, $ships, ships, equips, repairId));
212
+ return result.some(fleet => fleet.canRepair && fleet.repairDetail.some(ship => ship.estimate > 0));
213
+ }
214
+ }, {
215
+ path: '/kcsapi/api_req_mission/result',
216
+ valid: () => {
217
+ clearExpedReturnLock();
218
+ expedReturnLock = setTimeout(clearExpedReturnLock,
219
+ /*
220
+ allow a window of 5 secnds before the lock
221
+ clears itself
222
+ */
223
+ 5000);
224
+ return false;
225
+ }
226
+ }];
@@ -0,0 +1,226 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.switchPluginPath = exports.reactClass = undefined;
7
+
8
+ var _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; };
9
+
10
+ // Import selectors defined in poi
11
+
12
+
13
+ var _react = require('react');
14
+
15
+ var _react2 = _interopRequireDefault(_react);
16
+
17
+ var _reactRedux = require('react-redux');
18
+
19
+ var _reselect = require('reselect');
20
+
21
+ var _lodash = require('lodash');
22
+
23
+ var _lodash2 = _interopRequireDefault(_lodash);
24
+
25
+ var _path = require('path');
26
+
27
+ var _reactBootstrap = require('react-bootstrap');
28
+
29
+ var _selectors = require('views/utils/selectors');
30
+
31
+ var _functions = require('./parts/functions');
32
+
33
+ var _fleetList = require('./parts/fleet-list');
34
+
35
+ var _fleetList2 = _interopRequireDefault(_fleetList);
36
+
37
+ var _candidates = require('./parts/candidates');
38
+
39
+ var _candidates2 = _interopRequireDefault(_candidates);
40
+
41
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42
+
43
+ const { i18n, getStore } = window;
44
+ const __ = i18n['poi-plugin-anchorage-repair'].__.bind(i18n['poi-plugin-anchorage-repair']);
45
+
46
+ const AKASHI_ID = [182, 187]; // akashi and kai ID in $ships
47
+ const SRF_ID = 86; // Ship Repair Facility ID in $slotitems
48
+
49
+
50
+ // check a fleet status, returns information related to anchorage repair
51
+ const fleetAkashiConv = (fleet, $ships, ships, equips, repairId) => {
52
+ const pickKey = ['api_id', 'api_ship_id', 'api_lv', 'api_nowhp', 'api_maxhp', 'api_ndock_time'];
53
+
54
+ let canRepair = false;
55
+ let akashiFlagship = false;
56
+ let repairCount = 0;
57
+ const inExpedition = _lodash2.default.get(fleet, 'api_mission.0') && true;
58
+ const flagShipInRepair = _lodash2.default.includes(repairId, _lodash2.default.get(fleet, 'api_ship.0', -1));
59
+ const flagship = ships[_lodash2.default.get(fleet, 'api_ship.0', -1)];
60
+
61
+ if (flagship != null) {
62
+ akashiFlagship = _lodash2.default.includes(AKASHI_ID, flagship.api_ship_id);
63
+ repairCount = _lodash2.default.filter(flagship.api_slot, item => _lodash2.default.get(equips, `${item}.api_slotitem_id`, -1) === SRF_ID).length;
64
+ repairCount += akashiFlagship ? 2 : 0;
65
+ }
66
+
67
+ canRepair = akashiFlagship && !inExpedition && !flagShipInRepair;
68
+
69
+ const repairDetail = _lodash2.default.map(_lodash2.default.filter(fleet.api_ship, shipId => shipId > 0), (shipId, index) => {
70
+ if (shipId === -1) return false; // break, LODASH ONLY
71
+
72
+ const ship = _lodash2.default.pick(ships[shipId], pickKey);
73
+
74
+ const constShip = _lodash2.default.pick($ships[ship.api_ship_id], ['api_name', 'api_stype']);
75
+
76
+ return _extends({}, ship, constShip, {
77
+ estimate: (0, _functions.akashiEstimate)(ship),
78
+ timePerHP: (0, _functions.getTimePerHP)(ship.api_lv, constShip.api_stype),
79
+ inRepair: _lodash2.default.includes(repairId, ship.api_id),
80
+ availableSRF: index < repairCount
81
+ });
82
+ });
83
+
84
+ var repairStatus = 0
85
+ if(canRepair){
86
+ repairStatus = 1;
87
+ }else{
88
+ var flagshipid = _lodash2.default.get(fleet, 'api_ship.0', -1)
89
+ var secondshipid = _lodash2.default.get(fleet, 'api_ship.0', -1)
90
+ if(flagshipid==996||flagshipid==1002||secondshipid==996||secondshipid==1002){
91
+ repairStatus = 2;
92
+ }
93
+ }
94
+
95
+ return {
96
+ api_id: fleet.api_id || -1,
97
+ shipId: fleet.api_ship || [],
98
+ canRepair,
99
+ akashiFlagship,
100
+ inExpedition,
101
+ flagShipInRepair,
102
+ repairCount,
103
+ repairDetail
104
+ };
105
+ };
106
+
107
+ // selectors
108
+
109
+ const repairIdSelector = (0, _reselect.createSelector)([_selectors.repairsSelector], repair => _lodash2.default.map(repair, dock => dock.api_ship_id));
110
+
111
+ const constShipsSelector = state => state.const.$ships || {};
112
+
113
+ const fleetsAkashiSelector = (0, _reselect.createSelector)([constShipsSelector, _selectors.fleetsSelector, _selectors.shipsSelector, _selectors.equipsSelector, repairIdSelector], ($ships, fleets, ships, equips, repairId) => ({ fleets: _lodash2.default.map(fleets, fleet => fleetAkashiConv(fleet, $ships, ships, equips, repairId)) })
114
+
115
+ // React
116
+
117
+ );const reactClass = exports.reactClass = (0, _reactRedux.connect)((0, _selectors.createDeepCompareArraySelector)([fleetsAkashiSelector, _selectors.miscSelector], (data, { canNotify }) => _extends({}, data, {
118
+ canNotify
119
+ })))(class PluginAnchorageRepair extends _react.Component {
120
+
121
+ constructor(props) {
122
+ super(props);
123
+
124
+ this.handleSelectTab = key => {
125
+ this.setState({ activeTab: key });
126
+ };
127
+
128
+ this.handleSort = index => () => {
129
+ this.setState({
130
+ sortIndex: index
131
+ });
132
+ };
133
+
134
+ this.state = {
135
+ activeTab: 1,
136
+ sortIndex: 0
137
+ };
138
+ }
139
+
140
+ render() {
141
+ return _react2.default.createElement(
142
+ 'div',
143
+ { id: 'anchorage-repair' },
144
+ _react2.default.createElement('link', { rel: 'stylesheet', href: (0, _path.join)(__dirname, 'assets', 'style.css') }),
145
+ _react2.default.createElement(
146
+ _reactBootstrap.Tabs,
147
+ { activeKey: this.state.activeTab, onSelect: this.handleSelectTab, id: 'anchorage-tabs' },
148
+ _lodash2.default.map(this.props.fleets, (fleet, index) => _react2.default.createElement(
149
+ _reactBootstrap.Tab,
150
+ {
151
+ eventKey: fleet.api_id,
152
+ title: fleet.api_id,
153
+ key: `anchorage-tab-${index}`,
154
+ tabClassName: fleet.canRepair ? 'can-repair' : ''
155
+ },
156
+ _react2.default.createElement(_fleetList2.default, { fleet: fleet })
157
+ )),
158
+ _react2.default.createElement(
159
+ _reactBootstrap.Tab,
160
+ {
161
+ className: 'candidate-pane',
162
+ eventKey: -1,
163
+ title: __('Candidates')
164
+ },
165
+ _react2.default.createElement(_candidates2.default, { handleSort: this.handleSort, sortIndex: this.state.sortIndex })
166
+ )
167
+ )
168
+ );
169
+ }
170
+ }
171
+
172
+ /*
173
+
174
+ The following APIs are called in order when a fleet returns from expedition:
175
+
176
+ - api_req_mission/result
177
+ - api_port/port
178
+
179
+ As anchorage repair pops up conditionally on the latter one,
180
+ it also prevents other plugins' auto-switch mechanism on
181
+ tracking api_req_mission/result calls.
182
+
183
+ The problem is solved by applying a lock upon expedition returns
184
+ and ignoring the immediately followed api_port/port call.
185
+
186
+ */
187
+ );let expedReturnLock = null;
188
+ const clearExpedReturnLock = () => {
189
+ if (expedReturnLock !== null) {
190
+ clearTimeout(expedReturnLock);
191
+ expedReturnLock = null;
192
+ }
193
+ };
194
+
195
+ const switchPluginPath = exports.switchPluginPath = [{
196
+ path: '/kcsapi/api_port/port',
197
+ valid: () => {
198
+ if (expedReturnLock !== null) {
199
+ /*
200
+ this is the immediately followed api_port/port call
201
+ after an expedition returning event.
202
+ */
203
+ clearExpedReturnLock();
204
+ return false;
205
+ }
206
+
207
+ const { fleets = [], ships = {}, equips = {}, repairs = [] } = getStore('info') || {};
208
+ const $ships = getStore('const.$ships');
209
+ const repairId = repairs.map(dock => dock.api_ship_id);
210
+
211
+ const result = fleets.map(fleet => fleetAkashiConv(fleet, $ships, ships, equips, repairId));
212
+ return result.some(fleet => fleet.canRepair && fleet.repairDetail.some(ship => ship.estimate > 0));
213
+ }
214
+ }, {
215
+ path: '/kcsapi/api_req_mission/result',
216
+ valid: () => {
217
+ clearExpedReturnLock();
218
+ expedReturnLock = setTimeout(clearExpedReturnLock,
219
+ /*
220
+ allow a window of 5 secnds before the lock
221
+ clears itself
222
+ */
223
+ 5000);
224
+ return false;
225
+ }
226
+ }];
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 かがみ <moe.pascal@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README-CN.MD ADDED
@@ -0,0 +1,53 @@
1
+ # 泊地修理插件
2
+
3
+ [![npm package][npm-badge]][npm]
4
+
5
+
6
+ ## 简介
7
+ 泊地修理插件是辅助安排明石泊地修理的工具,功能有
8
+
9
+ - [x] 预计泊地修理用时
10
+ - [x] 泊地修理完成通知
11
+
12
+ ## 限制
13
+ - 在改变泊地修理舰队的编成时,由于艦これ API 不会更新舰娘耐久,可能导致修理用时的预计错误。因此必须返回到母港界面来重新计时。
14
+
15
+ ## 简要机制
16
+ ### 入渠时间
17
+ 基于损失耐久、等级与船类型的公式已经确认,这个值也在 API 的 *api_ndock_time* 中给出。
18
+
19
+ ### 泊地修理要求
20
+ - 明石(或明石改)必须为舰队旗舰,耐久为小破以上,并且不处于入渠状态。
21
+ - 明石本身可以修理她自己以及二号位舰娘,每装备一个舰队修理设施,可以多修理一个位置的舰娘。
22
+ - 舰娘必须在小破(50% 的最大耐久)以上
23
+ - 舰娘未处于入渠状态
24
+
25
+ ### 修理时间
26
+ - 需要至少 20 分钟来完成至少 1 格的耐久的回复
27
+ - 超过 20 分钟,回复量与入渠状态下的回复量一致,并向下取整
28
+ - 入渠时间公式中有 30 秒的额外时间,然而实际入渠过程会提前 1 分钟结束。修理时间则会**向上取整**到下一分钟。
29
+ - 修理计时器会被以下事件重置:
30
+ - 在 20 分钟后返回母港画面,即,泊地修理生效,舰队的耐久已经发生了更新
31
+ - 改变修理舰队的编成(但不包括手动拖动船只的移除以及全部移除)
32
+ - 使用高速修复材来进行入渠,普通入渠不会重置(目前插件不支持)
33
+ - 使舰队参加远征
34
+
35
+ ### 插件考虑范围之外的事件
36
+ 以下情况,插件并未特别进行处理。因此结果可能会与所期望的不同
37
+ - 调整明石的装备,准确地说,调整舰队修理设施的数量
38
+ - 使舰队参加远征
39
+
40
+ ### 试验性支持
41
+ 目前编成配置载入不会引发计时器重置
42
+
43
+ # 参考资料
44
+ - <http://kancolle.wikia.com/wiki/Akashi#Anchorage_Repair>
45
+ - <http://kancolle.wikia.com/wiki/Docking#Repair_time>
46
+ - <http://wikiwiki.jp/kancolle/?%CC%C0%C0%D0#h2_content_1_1>
47
+ - <https://en.kancollewiki.net/wiki/Auxiliary_Ships_Mechanics>
48
+
49
+ # 授权许可
50
+ MIT
51
+
52
+ [npm-badge]: https://img.shields.io/npm/v/poi-plugin-anchorage-repair.svg?style=flat-square
53
+ [npm]: https://www.npmjs.org/package/poi-plugin-anchorage-repair
package/README.MD ADDED
@@ -0,0 +1,66 @@
1
+ # Anchorage repair plugin for poi
2
+
3
+ [![npm package][npm-badge]][npm]
4
+
5
+ [简体中文说明](README-CN.MD)
6
+
7
+ ## Description
8
+ A plugin to help in Akashi's anchorage repair arrangement, features:
9
+
10
+ - [x] estimate anchorage repair time
11
+ - [x] notify upon ship repair completes
12
+
13
+ ## Limitations
14
+ - When you change the fleet composition, Kancolle API will not renew ships' HP, which may lead to inaccurate repair time estimation. You have to return to HQ screen to refresh ship data.
15
+
16
+ ## Basic mechanism
17
+ ### Docking repair time
18
+ The formula base on HP loss, level and ship type is already proved, while this value is also given in API's *api_ndock_time*.
19
+
20
+ ### Akashi's anchorage repair requirement
21
+ - Akashi (or Kai) must be fleet flagship, with minor damage or less, and is not in docking.
22
+ - Akashi can repair herslf and ship in 2nd lot, and plus one ship slot per Ship Repair Facility.
23
+ - Ships get repaired at minor damage (HP > 50% max HP) or less.
24
+ - ship is not in docking.
25
+
26
+ ### Repair time
27
+ - it takes at least 20 minutes to repair ships by at least 1 HP
28
+ - Above 20 minutes, the the amount will be the same as ships in docking, rounded down.
29
+ - In the docking time formula, a 30-second bias is always added; the docking is actually finished, however, 1 minute earlier. And anchorage repair time will be **rounded up** to next minute.
30
+ - The repair timer will reset by:
31
+ - returning to the HQ screen after 20 minutes from the time the composition changed, that is, ships' hp changed,
32
+ - changing fleet composition while dragging a ship out of fleet or disbanding the whole fleet won't,
33
+ - docking fleet member with Bucket, normal docking won't reset,
34
+ - sending the fleet to expedition.
35
+
36
+ ### Corner cases
37
+ Following corner cases are not taken into consideration, thus the result may not behave as it could be.
38
+ - changing Akashi's slot itmes, more precisely, changing the numbers of Ship Repair Facilities,
39
+ - sending fleet to sortie.
40
+
41
+ ### Experimental
42
+ Loading composition presets won't reset the timer, which is sometimes regarded as a bug.
43
+
44
+ # Changelog
45
+ ## v0.1
46
+ Initial version
47
+
48
+ ## v0.2
49
+ Now the timer is always displayed for those who want to make use of composition preset bug.
50
+
51
+ ## v0.3
52
+ The timer reset rules corrected
53
+ + Returning to HQ within 20 minutes won't reset the timer,
54
+ + Changing fleet composition within 20 minutes will immediately reset the timer. Otherwise a return to HQ is required
55
+
56
+ # References
57
+ - <http://kancolle.wikia.com/wiki/Akashi#Anchorage_Repair>
58
+ - <http://kancolle.wikia.com/wiki/Docking#Repair_time>
59
+ - <http://wikiwiki.jp/kancolle/?%CC%C0%C0%D0#h2_content_1_1>
60
+ - <https://en.kancollewiki.net/wiki/Auxiliary_Ships_Mechanics>
61
+
62
+ # License
63
+ MIT
64
+
65
+ [npm-badge]: https://img.shields.io/npm/v/poi-plugin-anchorage-repair.svg?style=flat-square
66
+ [npm]: https://www.npmjs.org/package/poi-plugin-anchorage-repair
@@ -0,0 +1,55 @@
1
+ #anchorage-repair {
2
+ padding: 1em;
3
+ height: 100%;
4
+ }
5
+ #anchorage-repair .info-row {
6
+ padding: 2em 0;
7
+ }
8
+ #anchorage-repair .info-col {
9
+ align-content: center;
10
+ text-align: center;
11
+ }
12
+ #anchorage-repair .label {
13
+ font-size: 90%;
14
+ font-weight: normal;
15
+ }
16
+ #anchorage-repair .lv-label {
17
+ display: block;
18
+ font-size: 70%;
19
+ }
20
+ #anchorage-repair .not-available {
21
+ font-style: italic;
22
+ }
23
+ #anchorage-repair td,
24
+ #anchorage-repair th {
25
+ text-align: center;
26
+ vertical-align: middle;
27
+ }
28
+ #anchorage-repair .panel .hidden {
29
+ display: none;
30
+ }
31
+ #anchorage-repair .nav li.can-repair {
32
+ flex: 2;
33
+ }
34
+ #anchorage-repair #anchorage-tabs {
35
+ height: 100%;
36
+ }
37
+ #anchorage-repair .tab-content {
38
+ height: 100%;
39
+ }
40
+ #anchorage-repair .candidate-pane {
41
+ height: 100%;
42
+ }
43
+ #anchorage-repair #candidate-list {
44
+ height: 100%;
45
+ }
46
+ #anchorage-repair #candidate-list ::-webkit-scrollbar {
47
+ width: 1em;
48
+ }
49
+ #anchorage-repair .candidate-ship-item {
50
+ display: flex;
51
+ align-items: center;
52
+ }
53
+ #anchorage-repair .ship-name {
54
+ font-size: 120%;
55
+ }
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,24 @@
1
+ {
2
+ "Anchorage repair": "泊地修理",
3
+ "Akashi not flagship": "明石は旗艦ではありません",
4
+ "Not ready": "準備ができていません",
5
+ "Capacity: %s": "修理可能の數: %s",
6
+ "Please return to HQ screen to make timer refreshed.": "タイマーをリセットするために、母港画面に戻ってください。",
7
+ "Ship": "艦娘",
8
+ "HP": "耐久",
9
+ "Akashi Time": "明石の修理時間",
10
+ "Per HP": "單位修理時間",
11
+ "Estimated repaired": "推定回復量",
12
+ "fleet in expedition": "艦隊遠征中",
13
+ "Elapsed:": "タイマー:",
14
+ "Repairing": "修理中",
15
+ "Akashi loves you!": "明石はあなたを愛してるよ!",
16
+ "flagship in dock": "旗艦入渠中",
17
+ "anchorage repair completed": "泊地修理完了",
18
+ "A plugin to help in Akashi's anchorage repair arrangement": "明石の泊地修理の助手ちゃん",
19
+ "Docking": "入渠中",
20
+ "Total time required": "完全回復に掛かる時間",
21
+ "Time required for 1 HP recovery": "耐久1ポイント回復に掛かる時間",
22
+ "Estimated HP recovery since last refresh": "前回のリセット以降の推定回復量",
23
+ "Candidates": "適格者"
24
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "Akashi not flagship": "Akashi not flagship",
3
+ "Please return to HQ screen to make timer refreshed.": "Please return to HQ screen to make timer refreshed.",
4
+ "fleet in expedition": "fleet in expedition",
5
+ "Not ready": "Not ready",
6
+ "Capacity: %s": "Capacity: %s",
7
+ "Ship Name": "Ship Name",
8
+ "HP": "HP",
9
+ "Akashi Time": "Akashi Time",
10
+ "Per HP": "Per HP",
11
+ "Estimated repaired": "Estimated repaired"
12
+ }