-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreport.es
664 lines (626 loc) · 24.9 KB
/
report.es
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
let { _, SERVER_HOSTNAME, APPDATA_PATH } = window;
if (_ === "undefined") {
try {
_ = require('lodash');
} catch (err) {
_ = require('underscore');
}
}
let bluebird = require('bluebird');
let fs = bluebird.promisifyAll(require('fs-extra'));
let request = bluebird.promisifyAll(require('request'), { multiArgs: true });
import { getTyku, getTykuV2, getSaku25, getSaku25a, getSaku33, sum, hashCode, HashTable } from './common';
import { join } from 'path';
let KCWIKI_HOST = 'api.kcwiki.moe';
let CACHE_FILE = join(APPDATA_PATH, 'kcwiki-report', 'cache.json');
let HOST = KCWIKI_HOST;
let CACHE_SWITCH = 'on';
let HOST_V2 = 'www.cross-bell.com:11800'
let HOST_V3 = 'report2.kcwiki.org:17027'
let drops = [], lvs = [], _path = [], __ships = {}, __decks = [], _remodelShips = [], _map = '',
_mapId = 0, _mapAreaId = 0, combined = false, cache = new HashTable({});
fs.readFile(CACHE_FILE, (err, data) => {
if (typeof err == "undefined" || err == null) cache = new HashTable(JSON.parse(data));
if (typeof err !== "undefined" && err !== null && err.code == 'ENOENT') console.log('Kcwiki reporter cache file not exist, will touch new one soon.');
if (typeof err !== "undefined" && err !== null && err.code && err.code != 'ENOENT') console.error(err.code);
});
const reportInit = () => {
drops = [];
lvs = [];
_path = [];
__ships = {};
__decks = [];
_map = '';
_mapId = 0;
_mapAreaId = 0;
combined = false;
};
// Report map event (etc. get resource)
const reportGetLoseItem = async (body) => {
_map = '' + body.api_maparea_id + body.api_mapinfo_no;
_mapAreaId = body.api_maparea_id;
_mapId = body.api_mapinfo_no;
_path.push(body.api_no);
// Report getitem data
if (typeof body.api_itemget !== "undefined" && body.api_itemget !== null) {
// Item ID: 1 油 2 弹
let eventId = [], count = [];
for (let item of body.api_itemget) {
eventId.push(+item.api_id);
count.push(+item.api_getcount);
}
let info = {
mapAreaId: +_mapAreaId,
mapId: +_mapId,
cellId: +body.api_no,
eventId: eventId,
count: count,
eventType: 0
};
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(JSON.stringify(info));
if (cache.miss(info)) {
let response = await request.postAsync(`http://${HOST}/mapEvent`, { form: info });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`getitem.action response: ${repData}`);
cache.put(info);
}
}
//Report dropitem data
if (typeof body.api_happening !== "undefined" && body.api_happening !== null && body.api_happening.api_type == 1) {
// Bullet - Type:1 IconId:2
// Fuel - Type:1 IconId:1
let info = {
mapAreaId: +_mapAreaId,
mapId: +_mapId,
cellId: +body.api_no,
eventId: [+body.api_happening.api_icon_id],
count: [+body.api_happening.api_count],
dantan: body.api_happening.api_dentan,
eventType: 1
};
if (process.env.DEBUG) console.log(JSON.stringify(info));
if (cache.miss(info)) {
let response = await request.postAsync(`http://${HOST}/mapEvent`, { form: info });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`dropitem.action response: ${repData}`);
cache.put(info);
}
}
return;
};
// Report enemy fleet data
const reportEnemy = async (body) => {
let info = {
enemyId: body.api_ship_ke,
maxHP: body.api_e_maxhps,
slots: body.api_eSlot,
param: body.api_eParam,
mapId: _mapId,
mapAreaId: _mapAreaId,
cellId: _path.slice(-1)[0]
};
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null) console.log(JSON.stringify(info));
if (CACHE_SWITCH == 'off' || cache.miss(info)) {
try {
let response = await request.postAsync(`http://${HOST}/enemy`, { form: info });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`enemy.action response: ${repData}`);
cache.put(info);
} catch (err) {
console.error(err);
}
}
};
// Report ship attributes
const reportShipAttrByLevelUp = async (path) => {
let { _ships, _decks, _teitokuLv, _slotitems } = window;
if (path.includes('port')) drops = [];
if (lvs.length != 0) {
let decks = [];
_decks.map(v => {
decks = decks.concat(v.api_ship);
})
let lvsNew = decks.map(deck => {
if (deck == -1)
return -1
return _ships[deck].api_lv
});
let data = [];
for (let i in lvs) {
let lv = lvs[i];
if (lv == lvsNew[i] || lv == -1 || decks[i] == -1) continue;
let ship = _ships[decks[i]];
let ship_slots = ship.api_slot;
let luck = ship.api_luck[0]; // 運
let kaihi = ship.api_kaihi[0]; // 回避
let sakuteki = ship.api_sakuteki[0] - sum(ship_slots.filter(ship_slot => ship_slot != -1).map(ship_slot => _slotitems[ship_slot].api_saku));// 索敵
let taisen = ship.api_taisen[0] - sum(ship_slots.filter(ship_slot => ship_slot != -1).map(ship_slot => _slotitems[ship_slot].api_tais));// 対潜
let info = {
sortno: +ship.api_sortno,
luck: +luck,
sakuteki: +sakuteki,
taisen: +taisen,
kaihi: +kaihi,
level: +lvsNew[i]
};
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(JSON.stringify(info));
if (CACHE_SWITCH == 'off' || cache.miss(info)) {
try {
let response = await request.postAsync(`http://${HOST}/shipAttr`, { form: info });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`attr.action response: ${repData}`);
cache.put(info);
} catch (err) {
console.log(err);
}
}
}
lvs = [];
}
};
const reportShipAttr = async (ship) => {
let { _slotitems } = window;
let slots = ship.api_slot;
let luck = ship.api_lucky[0]; // 運
let kaihi = ship.api_kaihi[0]; // 回避
let sakuteki = ship.api_sakuteki[0] - sum(slots.filter(slot => slot != -1).map(slot => _slotitems[slot].api_saku));// 索敵
let taisen = ship.api_taisen[0] - sum(slots.filter(slot => slot != -1).map(slot => _slotitems[slot].api_tais));// 対潜
let info = {
sortno: +ship.api_sortno,
luck: +luck,
sakuteki: +sakuteki,
taisen: +taisen,
kaihi: +kaihi,
level: +ship.api_lv
};
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(JSON.stringify(info));
if (CACHE_SWITCH == 'off' || cache.miss(info)) {
try {
let response = await request.postAsync(`http://${HOST}/shipAttr`, { form: info });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`attr.action response: ${repData}`);
cache.put(info);
} catch (err) {
console.log(err);
}
}
};
// Report initial equip data
const reportInitEquipByDrop = async (_ships) => {
let { _slotitems } = window;
if (_.keys(__ships).length != 0) {
let _newShips = {};
let _keys = _.keys(_ships);
let __keys = _.keys(__ships);
let _newKeys = _.difference(_keys, __keys);
if (_newKeys.length > 0) {
for (let key of _newKeys) {
_newShips[_ships[key].api_sortno] = _ships[key].api_slot;
let slots = _ships[key].api_slot;
let luck = _ships[key].api_lucky[0]; // 運
let kaihi = _ships[key].api_kaihi[0]; // 回避
let sakuteki = _ships[key].api_sakuteki[0] - sum(slots.filter(slot => slot != -1).map(slot => _slotitems[slot].api_saku));// 索敵
let taisen = _ships[key].api_taisen[0] - sum(slots.filter(slot => slot != -1).map(slot => _slotitems[slot].api_tais));// 対潜
let info = {
sortno: +_ships[key].api_sortno,
luck: +luck,
sakuteki: +sakuteki,
taisen: +taisen,
kaihi: +kaihi,
level: +_ships[key].api_lv
};
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(JSON.stringify(info));
if (CACHE_SWITCH == 'off' || cache.miss(info)) {
try {
let response = await request.postAsync(`http://${HOST}/shipAttr`, { form: info });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null) {
console.log(response)
console.log(`attr.action response: ${repData}`);
}
cache.put(info);
} catch (err) {
console.log(err);
}
}
}
for (let shipno in _newShips) {
let slots = _newShips[shipno];
_newShips[shipno] = slots.filter(slot => slot != -1).map(slot => _slotitems[slot].api_sortno);
}
let info = {
ships: _newShips
};
__ships = {};
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(JSON.stringify(info));
if (CACHE_SWITCH == 'off' || cache.miss(_newShips)) {
try {
let response = await request.postAsync(`http://${HOST}/initEquip`, { form: info });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`initEquip.action response: ${repData}`);
cache.put(_newShips);
} catch (err) {
console.error(err);
}
}
}
}
return;
};
// Report initial equip data
const reportInitEquipByBuild = async (body, _ships) => {
let ship = _ships[body.api_ship.api_id];
let slots = ship.api_slot.filter(slot => slot != -1).map(slot => _slotitems[slot].api_sortno);
let data = {};
data[ship.api_sortno] = slots;
let info = {
ships: data
};
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(JSON.stringify(info));
if (CACHE_SWITCH == 'off' || cache.miss(data)) {
try {
let response = await request.postAsync(`http://${HOST}/initEquip`, { form: info });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`initEquip.action response: ${repData}`);
cache.put(data);
} catch (err) {
console.error(err);
}
}
return;
};
const reportInitEquipByRemodel = async () => {
if (_remodelShips.length == 0) return;
let data = {};
for (let apiId of _remodelShips) {
apiId = parseInt(apiId);
let ship = _ships[apiId];
data[ship] = ship.api_slot.filter(slot => slot != -1).map(slot => _slotitems[slot].api_sortno);
}
if (CACHE_SWITCH == 'off' || cache.miss(data)) {
try {
let response = await request.postAsync(`http://${HOST}/initEquip`, { form: { ships: data } });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`initEquip.action response: ${repData}`);
cache.put(data);
} catch (err) {
console.error(err);
}
}
_remodelShips = [];
};
// Report tyku data
const reoprtTyku = async (eSlot, eKouku, detail, seiku, dock_id, ship_id) => {
let { rank, map, mapCell, dropShipId, deckShipId } = detail;
let { _teitokuLv, _nickName, _nickNameId, _decks } = window;
if (deckShipId.length > 6) combined = true;
let { maxTyku, minTyku } = getTyku(_decks[dock_id - 1]);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`Tyku value: ${minTyku}, ${maxTyku}`);
let { api_no, api_maparea_id } = $maps[map];
//-1=数据缺失, 0=制空均衡, 1=制空権確保, 2=航空優勢, 3=航空劣勢, 4=制空権喪失
let info = {
mapAreaId: +api_maparea_id,
mapId: +api_no,
cellId: +mapCell,
minTyku: minTyku,
maxTyku: maxTyku,
rank: rank,
seiku: seiku,
shipId: ship_id,
version: '3.0.0-bata.0'
};
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(JSON.stringify(info));
if (CACHE_SWITCH == 'off' || cache.miss(info)) {
try {
let response = await request.postAsync(`http://${HOST}/tyku`, { form: info });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`Tyku api response: ${repData}`);
cache.put(info);
} catch (err) {
console.error(err);
}
}
return;
};
// Report fleets and mapinfos
const reportBattle = async (mapinfo_no, maparea_id, cell_ids, _decks, dock_id, _ships) => {
if (mapinfo_no == 1 && maparea_id == 1) return;
let ships = [];
for (let ship_id of _decks[dock_id].api_ship) {
if (ship_id != -1)
ships.push(_ships[ship_id].api_ship_id);
else
ships.push(-1);
}
if (!cell_ids || cell_ids.length == 0) return;
let info = {
mapAreaId: +maparea_id,
mapId: +mapinfo_no,
cellId: cell_ids,
ships: ships,
version: '3.0.8'
};
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(JSON.stringify(info));
if (CACHE_SWITCH == 'off' || cache.miss(info)) {
try {
let response = await request.postAsync(`http://${HOST}/expedition`, { form: info });
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`battle.action response: ${repData}`);
cache.put(info);
} catch (err) {
console.error(err);
}
}
};
// Report fleets and mapinfos
const reportBattleV2 = async (mapinfo_no, maparea_id, mapLevels, mapGauges, cellData, dock_id, enemyData, dropData, combinedFlag) => {
if (_.isUndefined(combinedFlag) || combinedFlag < 0) combinedFlag = 0;
if (!cellData || cellData.length == 0) return;
if (__decks.length === 0) return;
let info = {
mapAreaId: maparea_id,
mapId: mapinfo_no,
mapLevel: mapLevels[maparea_id * 10 + mapinfo_no],
mapGauge: mapGauges[maparea_id * 10 + mapinfo_no],
cellData: cellData,
decks: __decks,
deckId: dock_id,
teitokuId: _teitokuId,
teitokuLevel: _teitokuLv,
nickName: _nickName,
enemyData: enemyData,
dropData: dropData,
combinedFlag: combinedFlag,
version: '3.1.2'
};
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(JSON.stringify(info));
try {
let response = await request.postAsync(`http://${HOST_V2}/statistic/sortie`, {
body: JSON.stringify(info),
json: true,
});
if (window.POI_VERSION >= 'v8.0.0')
response = response[0];
let status = response.statusCode, repData = response.body;
if (status >= 300)
console.log(status, response.statusMessage);
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`battle.action response: ${repData}`);
} catch (err) {
console.error(err);
}
};
const reportFrindly = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/friendly_info`, { body, json: true });
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`friendly.action response: ${repData}`);
cache.put(body);
}
}
const reportAirBaseAttack = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/air_base_attack`, { form: body });
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`airbaseattack.action response: ${repData}`);
cache.put(body);
}
}
const reportNextWayV2 = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/next_way_v2`, { form: body });
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`nextway.action response: ${repData}`);
cache.put(body);
}
}
const reportQuest = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/quest`, { form: body });
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`quest.action response: ${repData}`);
cache.put(body);
}
}
const reportBattleDetail = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/battle`, { body, json: true });
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`battle.action response: ${repData}`);
cache.put(body);
}
}
const reportRemodel = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/remodel`, { body, json: true });
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`battle.action response: ${repData}`);
cache.put(body);
}
}
const cacheSync = () => {
fs.ensureDirSync(join(APPDATA_PATH, 'kcwiki-report'));
let data = JSON.stringify(cache.raw());
if (data.length > 1000000) cache.clear();
fs.writeFileAsync(CACHE_FILE, data, (err) => {
if (err) console.error(JSON.stringify(err));
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log("Cache Sync Done.");
return;
})
};
const getDeckWhenMapStart = (_decks, _ships, _slotitems) => {
let decks = [];
for (let deck of _decks) {
// get deck detail info
let ships = [];
for (let ship_id of deck.api_ship) {
// get ship detail data
if (ship_id !== -1) {
let ship = _ships[ship_id];
let slots = [];
let exslot = {};
if (!ship)
continue;
for (let slot_id of ship.api_slot) {
// get slot detail data
if (slot_id !== -1) {
let slot = _slotitems[slot_id];
if (!slot)
continue;
slots.push({
api_slotitem_id: slot.api_slotitem_id,
api_level: slot.api_level,
api_alv: slot.api_alv ? slot.api_alv : 0,
});
}
}
// exslot
if (ship.api_slot_ex > 0) {
let slot = _slotitems[ship.api_slot_ex];
exslot = {
api_slotitem_id: slot.api_slotitem_id,
api_level: slot.api_level,
api_alv: slot.api_alv ? slot.api_alv : 0,
};
} else {
exslot = {
api_slotitem_id: -1,
api_level: 0,
api_alv: 0
};
}
ships.push({
api_ship_id: ship.api_ship_id,
api_lv: ship.api_lv,
api_soku: ship.api_soku,
slots: slots,
exslot: exslot,
api_cond: ship.api_cond,
});
}
}
decks.push({
api_id: deck.api_id,
api_name: deck.api_name,
api_mission: deck.api_mission,
tyku: getTykuV2(deck),
saku25: getSaku25(deck),
saku25a: getSaku25a(deck),
saku33x1: getSaku33(deck, 1),
saku33x3: getSaku33(deck, 3),
saku33x4: getSaku33(deck, 4),
ships: ships,
});
}
return decks;
};
const whenMapStart = (_decks, _ships, _slotitems) => {
combined = false;
_path = [];
__ships = JSON.parse(JSON.stringify(_ships));
__decks = getDeckWhenMapStart(_decks, _ships, _slotitems);
};
const whenBattleResult = (_decks, _ships) => {
let decks = [];
_decks.map(v => {
decks = decks.concat(v.api_ship);
});
lvs = decks.map(deck => {
if (deck == -1)
return -1
return _ships[deck].api_lv
}) || [];
if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(JSON.stringify(lvs));
};
const whenRemodel = (body) => {
_remodelShips.push(body.api_id);
};
export {
reportInit,
reportGetLoseItem,
reportEnemy,
reportShipAttrByLevelUp,
reportShipAttr,
reoprtTyku,
reportInitEquipByBuild,
reportInitEquipByDrop,
reportInitEquipByRemodel,
reportBattle,
reportBattleV2,
reportFrindly,
reportAirBaseAttack,
reportNextWayV2,
reportQuest,
reportBattleDetail,
reportRemodel,
whenBattleResult,
whenMapStart,
whenRemodel,
cacheSync
};