Skip to content

Commit

Permalink
Revert "v3.2.23 battle数据格式修复"
Browse files Browse the repository at this point in the history
This reverts commit 64f84c3.
  • Loading branch information
Gizeta committed Aug 26, 2022
1 parent 64f84c3 commit 8c6030c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 24 deletions.
12 changes: 1 addition & 11 deletions common.es
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,6 @@ const hashCode = val => val.split('').reduce((h, ch) => {
return h;
}, 0);

/** @type {(ship: {api_slot?: number[]; poi_slot: undefined}) => {api_slot?: number[]; poi_slot?: number[]}} */
const appendSlotitemDetail = (ship) => {
const { _slotitems } = window;
const ret = {...ship, poi_slot: undefined};
if (ship.api_slot)
ret.poi_slot = ship.api_slot.map(x => _slotitems[x]);
return ret;
}

export {
getTyku,
getTykuV2,
Expand All @@ -395,6 +386,5 @@ export {
getSaku33,
sum,
hashCode,
HashTable,
appendSlotitemDetail,
HashTable
};
12 changes: 5 additions & 7 deletions index.es
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let combined_type = 0, preEscape = [], escapeList = [], api_cell_data = 0;
let quest_clear_id = -1, questlist = [], questDate = 0; // 任务日期与任务列表同步更新
let friendly_status = { flag: 0, type: 0 }; // 友军状态,是否邀请,是否强力
let friendly_data = {} // 友军数据暂存 为了保存出击前后的喷火数,延迟发送
let version = '3.2.23'
let version = '3.2.24'
let formation = '' // 阵型选择
let api_xal01 = '' // 是否削甲
let firenumBefore = 0 // 进入海图时的喷火数量
Expand All @@ -21,7 +21,7 @@ import {
reoprtTyku, cacheSync, reportBattle, reportBattleV2,
reportFrindly, reportAirBaseAttack, reportNextWayV2, reportQuest, reportBattleDetail
} from './report';
import { getTykuV2, getSaku25, getSaku25a, getSaku33, appendSlotitemDetail } from './common';
import { getTykuV2, getSaku25, getSaku25a, getSaku33 } from './common';
let handleBattleResult = (e) => {
if (seiku != -1) {
let { rank, map, mapCell, dropShipId, deckShipId } = e.detail;
Expand All @@ -39,12 +39,10 @@ let handleGameResponse = (e) => {
case '/kcsapi/api_req_sortie/battle':
case '/kcsapi/api_req_sortie/airbattle':
case '/kcsapi/api_req_sortie/ld_airbattle':
case '/kcsapi/api_req_sortie/ld_shooting':
case '/kcsapi/api_req_combined_battle/battle':
case '/kcsapi/api_req_combined_battle/battle_water':
case '/kcsapi/api_req_combined_battle/airbattle':
case '/kcsapi/api_req_combined_battle/ld_airbattle':
case '/kcsapi/api_req_combined_battle/ld_shooting':
case '/kcsapi/api_req_combined_battle/ec_battle':
case '/kcsapi/api_req_combined_battle/each_battle':
case '/kcsapi/api_req_combined_battle/each_battle_water':
Expand Down Expand Up @@ -94,12 +92,12 @@ let handleGameResponse = (e) => {
let deck1_index = Number(dock_id) - 1;
let deck1 = _decks[deck1_index].api_ship.map(item => {
let _item = _ships[item];
return appendSlotitemDetail(_item)
return _item
});
let hasTwo = combined_type && combined_type !== 0 && deck1_index == 0;
let deck2 = hasTwo ? _decks[1].api_ship.map(item => {
let _item = _ships[item];
return appendSlotitemDetail(_item)
return _item
}) : [];
// 过滤条件,夜战且邀请友军且活动海域且boss点 或者 (非boss点且有友军数据)
if (/night/.test(path) && Number(friendly_status.flag) === 1 && maparear_id > 40 && bosscells.indexOf(curCellId) !== -1 || (bosscells.indexOf(curCellId) === -1 && body.api_friendly_info)) {
Expand Down Expand Up @@ -154,7 +152,7 @@ let handleGameResponse = (e) => {
// 支援舰队
if(body.api_support_info) {
battle_data.fleet.support = _decks[body.api_support_info.api_support_hourai.api_deck_id - 1].api_ship.map(item => {
let _item = appendSlotitemDetail(_ships[item]);
let _item = _ships[item];
return _item
})
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "poi-plugin-kcwiki-report",
"version": "3.2.23",
"version": "3.2.24",
"description": "Report game data for kcwiki",
"main": "index.es",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions report.es
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ const reportBattleV2 = async (mapinfo_no, maparea_id, mapLevels, mapGauges, cell

const reportFrindly = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/friendly_info`, { body, json: true });
let response = await request.postAsync(`http://${HOST_V3}/api/report/friendly_info`, { form: body });

if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`friendly.action response: ${repData}`);
Expand All @@ -483,7 +483,7 @@ const reportFrindly = async (body) => {

const reportAirBaseAttack = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/air_base_attack`, { body, json: true });
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}`);
Expand All @@ -493,7 +493,7 @@ const reportAirBaseAttack = async (body) => {

const reportNextWayV2 = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/next_way_v2`, { body, json: true });
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}`);
Expand All @@ -503,7 +503,7 @@ const reportNextWayV2 = async (body) => {

const reportQuest = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/quest`, { body, json: true });
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}`);
Expand All @@ -513,7 +513,7 @@ const reportQuest = async (body) => {

const reportBattleDetail = async (body) => {
if (cache.miss(body)) {
let response = await request.postAsync(`http://${HOST_V3}/api/report/battle`, { body, json: true });
let response = await request.postAsync(`http://${HOST_V3}/api/report/battle`, { form: body });

if (typeof process.env.DEBUG !== "undefined" && process.env.DEBUG !== null)
console.log(`battle.action response: ${repData}`);
Expand Down

0 comments on commit 8c6030c

Please sign in to comment.