mirror of
https://github.com/djhackersdev/minime.git
synced 2026-07-06 20:13:57 -05:00
wip crack encoder
This commit is contained in:
parent
ba35781460
commit
91ab2e9b41
|
|
@ -1,229 +0,0 @@
|
|||
import iconv = require("iconv-lite");
|
||||
import { Transform } from "stream";
|
||||
|
||||
import { MSG } from "./defs";
|
||||
import { Response } from "./response";
|
||||
|
||||
const sjis = "shift_jis";
|
||||
|
||||
export class Encoder extends Transform {
|
||||
constructor() {
|
||||
super({
|
||||
readableObjectMode: true,
|
||||
writableObjectMode: true,
|
||||
});
|
||||
}
|
||||
|
||||
_transform(obj: Response, encoding, callback) {
|
||||
console.log("Idz: Res: Object:", obj);
|
||||
|
||||
let buf: Buffer;
|
||||
|
||||
switch (obj.type) {
|
||||
case "account_lock_res":
|
||||
buf = Buffer.alloc(0x0020);
|
||||
buf.writeInt16LE(MSG.ACCOUNT_LOCK_RES, 0x0000);
|
||||
buf.writeInt8(obj.field_0018, 0x0018);
|
||||
buf.writeInt16LE(obj.field_001A, 0x001a);
|
||||
buf.writeInt32LE(obj.field_001C.getTime() / 1000, 0x001c);
|
||||
|
||||
break;
|
||||
|
||||
case "account_unlock_res":
|
||||
buf = Buffer.alloc(0x0010);
|
||||
buf.writeInt16LE(MSG.ACCOUNT_UNLOCK_RES, 0x0000);
|
||||
buf.writeInt8(obj.status, 0x0004);
|
||||
|
||||
break;
|
||||
|
||||
case "create_team_res":
|
||||
case "load_team_res":
|
||||
buf = Buffer.alloc(0x0ca0);
|
||||
iconv.encode(obj.name, sjis).copy(buf, 0x0024);
|
||||
|
||||
for (let i = 0; i < 6; i++) {
|
||||
const base = 0x011c + i * 0x004c;
|
||||
const member = obj.members[i];
|
||||
|
||||
if (member === undefined) {
|
||||
break;
|
||||
}
|
||||
|
||||
buf.writeInt32LE(1, base + 0x0000); // Presence
|
||||
iconv.encode(member.name + "\0", sjis).copy(buf, base + 0x0004);
|
||||
buf.writeInt32LE(member.lv, base + 0x0018);
|
||||
buf.writeInt32LE(member.monthPoints, base + 0x0024);
|
||||
}
|
||||
|
||||
// xM
|
||||
|
||||
/*
|
||||
buf.writeInt16LE(0x00001, 0x0344 + 0x0000);
|
||||
buf.writeInt8(0x02, 0x0344 + 0x0003);
|
||||
buf.writeInt32LE(0x00000003, 0x0344 + 0x0004);
|
||||
iconv.encode("str\0", sjis).copy(buf, 0x0344 + 0x0008);
|
||||
buf.writeInt32LE(0x00000004, 0x0344 + 0x001c);
|
||||
*/
|
||||
|
||||
if (obj.type === "create_team_res") {
|
||||
buf.writeInt16LE(MSG.CREATE_TEAM_RES, 0x0000);
|
||||
} else {
|
||||
buf.writeInt16LE(MSG.LOAD_TEAM_RES, 0x0000);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "generic_res":
|
||||
buf = Buffer.alloc(0x0020);
|
||||
buf.writeInt16LE(MSG.GENERIC_RES, 0x0000);
|
||||
buf.writeInt32LE(obj.status, 0x0004);
|
||||
|
||||
break;
|
||||
|
||||
case "load_2on2_res":
|
||||
buf = Buffer.alloc(0x04c0);
|
||||
buf.writeInt16LE(MSG.LOAD_2ON2_RES, 0x0000);
|
||||
|
||||
break;
|
||||
|
||||
case "load_config_res":
|
||||
buf = Buffer.alloc(0x01a0);
|
||||
buf.writeInt16LE(MSG.LOAD_CONFIG_RES, 0x0000);
|
||||
buf.writeInt8(obj.status, 0x0002);
|
||||
|
||||
break;
|
||||
|
||||
case "load_config_v2_res":
|
||||
buf = Buffer.alloc(0x230);
|
||||
buf.writeInt16LE(MSG.LOAD_CONFIG_V2_RES, 0x0000);
|
||||
buf.writeInt8(obj.status, 0x0002);
|
||||
|
||||
break;
|
||||
|
||||
case "discover_profile_res":
|
||||
buf = Buffer.alloc(0x0010);
|
||||
buf.writeInt16LE(MSG.DISCOVER_PROFILE_RES, 0x0000);
|
||||
buf.writeInt8(obj.result ? 1 : 0, 0x0004);
|
||||
|
||||
break;
|
||||
|
||||
case "load_general_reward_res":
|
||||
// A generic response is acceptable too so why even bother with this..
|
||||
buf = Buffer.alloc(0x0330);
|
||||
buf.writeInt16LE(MSG.LOAD_GENERAL_REWARD_RES, 0x0000);
|
||||
|
||||
break;
|
||||
|
||||
case "load_record_v1_res":
|
||||
// Sending this causes an error
|
||||
buf = Buffer.alloc(0x0c60);
|
||||
buf.writeInt16LE(MSG.LOAD_PROFILE_V1_RES, 0x0000);
|
||||
|
||||
break;
|
||||
|
||||
case "load_record_v2_res":
|
||||
buf = Buffer.alloc(0x0d30);
|
||||
|
||||
buf.writeInt16LE(MSG.LOAD_PROFILE_V2_RES, 0x0000);
|
||||
buf.writeInt32LE(obj.profileId, 4 + 0x3b4);
|
||||
buf.writeInt16LE(obj.lv, 4 + 0x03c8);
|
||||
buf.writeInt32LE(obj.dpoint, 4 + 0x03e4);
|
||||
buf.writeInt32LE(obj.fame, 4 + 0x0400);
|
||||
iconv.encode(obj.name + "\0", sjis).copy(buf, 4 + 0x03ea);
|
||||
buf.writeInt32LE(obj.teamId, 0x07e0);
|
||||
|
||||
break;
|
||||
|
||||
case "load_reward_table_res":
|
||||
buf = Buffer.alloc(0x01c0);
|
||||
buf.writeInt16LE(MSG.LOAD_REWARD_TABLE_RES, 0x0000);
|
||||
|
||||
break;
|
||||
|
||||
case "load_server_list_res":
|
||||
buf = Buffer.alloc(0x04b0);
|
||||
buf.writeInt16LE(MSG.LOAD_SERVER_LIST_RES, 0x0000);
|
||||
buf.writeInt16LE(obj.status, 0x0002);
|
||||
buf.write(obj.userDb.addr, 0x0004);
|
||||
buf.writeInt16LE(obj.userDb.tcp, 0x0084);
|
||||
buf.writeInt16LE(obj.userDb.http, 0x0086);
|
||||
buf.write(obj.matchAddr, 0x0088);
|
||||
buf.writeInt16LE(obj.matchPort.tcp, 0x0108);
|
||||
buf.writeInt16LE(obj.matchPort.udpSend, 0x010a);
|
||||
buf.writeInt16LE(obj.matchPort.udpRecv, 0x010c);
|
||||
buf.writeInt16LE(obj.tagMatchPort.tcp, 0x010e);
|
||||
buf.writeInt16LE(obj.tagMatchPort.udpSend, 0x0110);
|
||||
buf.writeInt16LE(obj.tagMatchPort.udpRecv, 0x0112);
|
||||
buf.write(obj.event.addr, 0x0114);
|
||||
buf.writeInt16LE(obj.event.tcp, 0x0194);
|
||||
buf.write(obj.screenshot.addr, 0x0198);
|
||||
buf.writeInt16LE(obj.screenshot.tcp, 0x0218);
|
||||
buf.write(obj.pingReturn, 0x021c);
|
||||
buf.write(obj.echo1.addr, 0x029c);
|
||||
buf.write(obj.echo2.addr, 0x031c);
|
||||
buf.writeInt16LE(obj.echo1.udp, 0x39c);
|
||||
buf.writeInt16LE(obj.echo2.udp, 0x39e);
|
||||
buf.write(obj.newsUrl, 0x03a0);
|
||||
buf.write(obj.reportErrorUrl, 0x0424);
|
||||
|
||||
break;
|
||||
|
||||
case "load_stocker_res":
|
||||
buf = Buffer.alloc(0x00a0);
|
||||
buf.writeInt16LE(MSG.LOAD_STOCKER_RES, 0x0000);
|
||||
buf.writeInt8(obj.status, 0x0002);
|
||||
|
||||
break;
|
||||
|
||||
case "save_expedition_res":
|
||||
buf = Buffer.alloc(0x17c0);
|
||||
buf.writeInt16LE(MSG.SAVE_EXPEDITION_RES, 0x0000);
|
||||
// in awe of the size of this lad
|
||||
|
||||
break;
|
||||
|
||||
case "update_provisional_store_rank_res":
|
||||
buf = Buffer.alloc(0x02b0);
|
||||
buf.writeInt16LE(MSG.UPDATE_PROVISIONAL_STORE_RANK_RES, 0x0000);
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const offset = 0x44 + i;
|
||||
const row = obj.rows[i];
|
||||
|
||||
if (row !== undefined) {
|
||||
buf.writeInt16LE(row.field_0000, offset + 0x0000);
|
||||
buf.writeInt32LE(row.field_0004, offset + 0x0004);
|
||||
iconv.encode(row.field_0010, sjis).copy(buf, offset + 0x0010);
|
||||
iconv.encode(row.field_003B, sjis).copy(buf, offset + 0x003b);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "update_story_clear_num_res":
|
||||
buf = Buffer.alloc(0x0220);
|
||||
buf.writeInt16LE(MSG.UPDATE_STORY_CLEAR_NUM_RES, 0x0000);
|
||||
|
||||
break;
|
||||
|
||||
case "save_topic_res":
|
||||
buf = Buffer.alloc(0x05d0);
|
||||
buf.writeInt16LE(MSG.SAVE_TOPIC_RES, 0x0000);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
const exhaustCheck: never = obj;
|
||||
|
||||
return callback(new Error(`No writer fn for ${obj["type"]}`));
|
||||
}
|
||||
|
||||
console.log("Idz: Res: Encoded:", buf.toString("hex"));
|
||||
|
||||
if (buf.readInt16LE(0) === 0) {
|
||||
throw new Error("MESSAGE TYPE CODE YOU FUCKING IDIOT");
|
||||
}
|
||||
|
||||
return callback(null, buf);
|
||||
}
|
||||
}
|
||||
41
src/idz/encoder/_team.ts
Normal file
41
src/idz/encoder/_team.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import iconv = require("iconv-lite");
|
||||
import { CreateTeamResponse } from "../response/createTeam";
|
||||
import { LoadTeamResponse } from "../response/loadTeam";
|
||||
|
||||
export function _team(res: CreateTeamResponse | LoadTeamResponse) {
|
||||
const buf = Buffer.alloc(0x0ca0);
|
||||
|
||||
iconv.encode(res.name, "shift_jis").copy(buf, 0x0024);
|
||||
|
||||
for (let i = 0; i < 6; i++) {
|
||||
const base = 0x011c + i * 0x004c;
|
||||
const member = res.members[i];
|
||||
|
||||
if (member === undefined) {
|
||||
break;
|
||||
}
|
||||
|
||||
buf.writeInt32LE(1, base + 0x0000); // Presence
|
||||
iconv.encode(member.name + "\0", "shift_jis").copy(buf, base + 0x0004);
|
||||
buf.writeInt32LE(member.lv, base + 0x0018);
|
||||
buf.writeInt32LE(member.monthPoints, base + 0x0024);
|
||||
}
|
||||
|
||||
// xM
|
||||
|
||||
/*
|
||||
buf.writeInt16LE(0x00001, 0x0344 + 0x0000);
|
||||
buf.writeInt8(0x02, 0x0344 + 0x0003);
|
||||
buf.writeInt32LE(0x00000003, 0x0344 + 0x0004);
|
||||
iconv.encode("str\0", sjis).copy(buf, 0x0344 + 0x0008);
|
||||
buf.writeInt32LE(0x00000004, 0x0344 + 0x001c);
|
||||
*/
|
||||
|
||||
if (res.type === "create_team_res") {
|
||||
buf.writeInt16LE(0x007c, 0x0000);
|
||||
} else {
|
||||
buf.writeInt16LE(0x0078, 0x0000);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
12
src/idz/encoder/accountLock.ts
Normal file
12
src/idz/encoder/accountLock.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { AccountLockResponse } from "../response/accountLock";
|
||||
|
||||
export function accountLock(res: AccountLockResponse) {
|
||||
const buf = Buffer.alloc(0x0020);
|
||||
|
||||
buf.writeInt16LE(0x006a, 0x0000);
|
||||
buf.writeInt8(res.field_0018, 0x0018);
|
||||
buf.writeInt16LE(res.field_001A, 0x001a);
|
||||
buf.writeInt32LE(res.field_001C.getTime() / 1000, 0x001c);
|
||||
|
||||
return buf;
|
||||
}
|
||||
10
src/idz/encoder/accountUnlock.ts
Normal file
10
src/idz/encoder/accountUnlock.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { AccountUnlockResponse } from "../response/accountUnlock";
|
||||
|
||||
export function accountUnlock(res: AccountUnlockResponse) {
|
||||
const buf = Buffer.alloc(0x0010);
|
||||
|
||||
buf.writeInt16LE(0x0070, 0x0000);
|
||||
buf.writeInt8(res.status, 0x0004);
|
||||
|
||||
return buf;
|
||||
}
|
||||
10
src/idz/encoder/discoverProfile.ts
Normal file
10
src/idz/encoder/discoverProfile.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { DiscoverProfileResponse } from "../response/discoverProfile";
|
||||
|
||||
export function discoverProfile(res: DiscoverProfileResponse) {
|
||||
const buf = Buffer.alloc(0x0010);
|
||||
|
||||
buf.writeInt16LE(0x006c, 0x0000);
|
||||
buf.writeInt8(res.result ? 1 : 0, 0x0004);
|
||||
|
||||
return buf;
|
||||
}
|
||||
10
src/idz/encoder/generic.ts
Normal file
10
src/idz/encoder/generic.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { GenericResponse } from "../response/generic";
|
||||
|
||||
export function generic(res: GenericResponse) {
|
||||
const buf = Buffer.alloc(0x0020);
|
||||
|
||||
buf.writeInt16LE(0x0001, 0x0000);
|
||||
buf.writeInt32LE(res.status, 0x0004);
|
||||
|
||||
return buf;
|
||||
}
|
||||
110
src/idz/encoder/index.ts
Normal file
110
src/idz/encoder/index.ts
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
import { Transform } from "stream";
|
||||
|
||||
import { _team } from "./_team";
|
||||
import { accountLock } from "./accountLock";
|
||||
import { accountUnlock } from "./accountUnlock";
|
||||
import { discoverProfile } from "./discoverProfile";
|
||||
import { generic } from "./generic";
|
||||
import { load2on2 } from "./load2on2";
|
||||
import { loadConfig } from "./loadConfig";
|
||||
import { loadConfig2 } from "./loadConfig2";
|
||||
import { loadGeneralReward } from "./loadGeneralReward";
|
||||
import { loadProfile } from "./loadProfile";
|
||||
import { loadProfile2 } from "./loadProfile2";
|
||||
import { loadRewardTable } from "./loadRewardTable";
|
||||
import { loadServerList } from "./loadServerList";
|
||||
import { loadStocker } from "./loadStocker";
|
||||
import { saveExpedition } from "./saveExpedition";
|
||||
import { saveTopic } from "./saveTopic";
|
||||
import { updateProvisionalStoreRank } from "./updateProvisionalStoreRank";
|
||||
import { updateStoryClearNum } from "./updateStoryClearNum";
|
||||
import { Response } from "../response";
|
||||
|
||||
function encode(res: Response): Buffer {
|
||||
switch (res.type) {
|
||||
case "account_lock_res":
|
||||
return accountLock(res);
|
||||
|
||||
case "account_unlock_res":
|
||||
return accountUnlock(res);
|
||||
|
||||
case "create_team_res":
|
||||
return _team(res);
|
||||
|
||||
case "discover_profile_res":
|
||||
return discoverProfile(res);
|
||||
|
||||
case "generic_res":
|
||||
return generic(res);
|
||||
|
||||
case "load_2on2_res":
|
||||
return load2on2(res);
|
||||
|
||||
case "load_config_res":
|
||||
return loadConfig(res);
|
||||
|
||||
case "load_config_v2_res":
|
||||
return loadConfig2(res);
|
||||
|
||||
case "load_general_reward_res":
|
||||
return loadGeneralReward(res);
|
||||
|
||||
case "load_profile_v1_res":
|
||||
return loadProfile(res);
|
||||
|
||||
case "load_profile_v2_res":
|
||||
return loadProfile2(res);
|
||||
|
||||
case "load_reward_table_res":
|
||||
return loadRewardTable(res);
|
||||
|
||||
case "load_server_list_res":
|
||||
return loadServerList(res);
|
||||
|
||||
case "load_stocker_res":
|
||||
return loadStocker(res);
|
||||
|
||||
case "load_team_res":
|
||||
return _team(res);
|
||||
|
||||
case "save_expedition_res":
|
||||
return saveExpedition(res);
|
||||
|
||||
case "update_provisional_store_rank_res":
|
||||
return updateProvisionalStoreRank(res);
|
||||
|
||||
case "update_story_clear_num_res":
|
||||
return updateStoryClearNum(res);
|
||||
|
||||
case "save_topic_res":
|
||||
return saveTopic(res);
|
||||
|
||||
default:
|
||||
const exhaustCheck: never = res;
|
||||
|
||||
throw new Error(`No writer fn for ${res["type"]}`);
|
||||
}
|
||||
}
|
||||
|
||||
export class Encoder extends Transform {
|
||||
constructor() {
|
||||
super({
|
||||
readableObjectMode: true,
|
||||
writableObjectMode: true,
|
||||
});
|
||||
}
|
||||
|
||||
_transform(res: Response, encoding, callback) {
|
||||
console.log("Idz: Res: Object:", res);
|
||||
|
||||
const buf = encode(res);
|
||||
|
||||
console.log("Idz: Res: Encoded:", buf.toString("hex"));
|
||||
|
||||
if (buf.readInt16LE(0) === 0) {
|
||||
throw new Error("MESSAGE TYPE CODE YOU FUCKING IDIOT");
|
||||
}
|
||||
|
||||
return callback(null, buf);
|
||||
}
|
||||
}
|
||||
9
src/idz/encoder/load2on2.ts
Normal file
9
src/idz/encoder/load2on2.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { Load2on2Response } from "../response/load2on2";
|
||||
|
||||
export function load2on2(res: Load2on2Response) {
|
||||
const buf = Buffer.alloc(0x04c0);
|
||||
|
||||
buf.writeInt16LE(0x00b1, 0x0000);
|
||||
|
||||
return buf;
|
||||
}
|
||||
10
src/idz/encoder/loadConfig.ts
Normal file
10
src/idz/encoder/loadConfig.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { LoadConfigResponse } from "../response/loadConfig";
|
||||
|
||||
export function loadConfig(res: LoadConfigResponse) {
|
||||
const buf = Buffer.alloc(0x01a0);
|
||||
|
||||
buf.writeInt16LE(0x0005, 0x0000);
|
||||
buf.writeInt8(res.status, 0x0002);
|
||||
|
||||
return buf;
|
||||
}
|
||||
10
src/idz/encoder/loadConfig2.ts
Normal file
10
src/idz/encoder/loadConfig2.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { LoadConfigResponse2 } from "../response/loadConfig2";
|
||||
|
||||
export function loadConfig2(res: LoadConfigResponse2) {
|
||||
const buf = Buffer.alloc(0x230);
|
||||
|
||||
buf.writeInt16LE(0x0065, 0x0000);
|
||||
buf.writeInt8(res.status, 0x0002);
|
||||
|
||||
return buf;
|
||||
}
|
||||
10
src/idz/encoder/loadGeneralReward.ts
Normal file
10
src/idz/encoder/loadGeneralReward.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { LoadGeneralRewardResponse } from "../response/loadGeneralReward";
|
||||
|
||||
// A generic response is acceptable too so why even bother with this..
|
||||
export function loadGeneralReward(res: LoadGeneralRewardResponse) {
|
||||
const buf = Buffer.alloc(0x0330);
|
||||
|
||||
buf.writeInt16LE(0x009d, 0x0000);
|
||||
|
||||
return buf;
|
||||
}
|
||||
10
src/idz/encoder/loadProfile.ts
Normal file
10
src/idz/encoder/loadProfile.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { LoadProfileResponse } from "../response/loadProfile";
|
||||
|
||||
// Sending this causes an error
|
||||
export function loadProfile(res: LoadProfileResponse) {
|
||||
const buf = Buffer.alloc(0x0c60);
|
||||
|
||||
buf.writeInt16LE(0x0064, 0x0000);
|
||||
|
||||
return buf;
|
||||
}
|
||||
17
src/idz/encoder/loadProfile2.ts
Normal file
17
src/idz/encoder/loadProfile2.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import iconv = require("iconv-lite");
|
||||
|
||||
import { LoadProfileResponse2 } from "../response/loadProfile2";
|
||||
|
||||
export function loadProfile2(res: LoadProfileResponse2) {
|
||||
const buf = Buffer.alloc(0x0d30);
|
||||
|
||||
buf.writeInt16LE(0x0065, 0x0000);
|
||||
buf.writeInt32LE(res.profileId, 4 + 0x3b4);
|
||||
buf.writeInt16LE(res.lv, 4 + 0x03c8);
|
||||
buf.writeInt32LE(res.dpoint, 4 + 0x03e4);
|
||||
buf.writeInt32LE(res.fame, 4 + 0x0400);
|
||||
iconv.encode(res.name + "\0", "shift_jis").copy(buf, 4 + 0x03ea);
|
||||
buf.writeInt32LE(res.teamId, 0x07e0);
|
||||
|
||||
return buf;
|
||||
}
|
||||
9
src/idz/encoder/loadRewardTable.ts
Normal file
9
src/idz/encoder/loadRewardTable.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { LoadRewardTableResponse } from "../response/loadRewardTable";
|
||||
|
||||
export function loadRewardTable(res: LoadRewardTableResponse) {
|
||||
const buf = Buffer.alloc(0x01c0);
|
||||
|
||||
buf.writeInt16LE(0x0087, 0x0000);
|
||||
|
||||
return buf;
|
||||
}
|
||||
31
src/idz/encoder/loadServerList.ts
Normal file
31
src/idz/encoder/loadServerList.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { LoadServerListResponse } from "../response/loadServerList";
|
||||
|
||||
export function loadServerList(res: LoadServerListResponse) {
|
||||
const buf = Buffer.alloc(0x04b0);
|
||||
|
||||
buf.writeInt16LE(0x0007, 0x0000);
|
||||
buf.writeInt16LE(res.status, 0x0002);
|
||||
buf.write(res.userDb.addr, 0x0004);
|
||||
buf.writeInt16LE(res.userDb.tcp, 0x0084);
|
||||
buf.writeInt16LE(res.userDb.http, 0x0086);
|
||||
buf.write(res.matchAddr, 0x0088);
|
||||
buf.writeInt16LE(res.matchPort.tcp, 0x0108);
|
||||
buf.writeInt16LE(res.matchPort.udpSend, 0x010a);
|
||||
buf.writeInt16LE(res.matchPort.udpRecv, 0x010c);
|
||||
buf.writeInt16LE(res.tagMatchPort.tcp, 0x010e);
|
||||
buf.writeInt16LE(res.tagMatchPort.udpSend, 0x0110);
|
||||
buf.writeInt16LE(res.tagMatchPort.udpRecv, 0x0112);
|
||||
buf.write(res.event.addr, 0x0114);
|
||||
buf.writeInt16LE(res.event.tcp, 0x0194);
|
||||
buf.write(res.screenshot.addr, 0x0198);
|
||||
buf.writeInt16LE(res.screenshot.tcp, 0x0218);
|
||||
buf.write(res.pingReturn, 0x021c);
|
||||
buf.write(res.echo1.addr, 0x029c);
|
||||
buf.write(res.echo2.addr, 0x031c);
|
||||
buf.writeInt16LE(res.echo1.udp, 0x39c);
|
||||
buf.writeInt16LE(res.echo2.udp, 0x39e);
|
||||
buf.write(res.newsUrl, 0x03a0);
|
||||
buf.write(res.reportErrorUrl, 0x0424);
|
||||
|
||||
return buf;
|
||||
}
|
||||
10
src/idz/encoder/loadStocker.ts
Normal file
10
src/idz/encoder/loadStocker.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { LoadStockerResponse } from "../response/loadStocker";
|
||||
|
||||
export function loadStocker(res: LoadStockerResponse) {
|
||||
const buf = Buffer.alloc(0x00a0);
|
||||
|
||||
buf.writeInt16LE(0x00a8, 0x0000);
|
||||
buf.writeInt8(res.status, 0x0002);
|
||||
|
||||
return buf;
|
||||
}
|
||||
10
src/idz/encoder/saveExpedition.ts
Normal file
10
src/idz/encoder/saveExpedition.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { SaveExpeditionResponse } from "../response/saveExpedition";
|
||||
|
||||
export function saveExpedition(res: SaveExpeditionResponse) {
|
||||
// in awe of the size of this lad
|
||||
const buf = Buffer.alloc(0x17c0);
|
||||
|
||||
buf.writeInt16LE(0x008d, 0x0000);
|
||||
|
||||
return buf;
|
||||
}
|
||||
9
src/idz/encoder/saveTopic.ts
Normal file
9
src/idz/encoder/saveTopic.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { SaveTopicResponse } from "../response/saveTopic";
|
||||
|
||||
export function saveTopic(res: SaveTopicResponse) {
|
||||
const buf = Buffer.alloc(0x05d0);
|
||||
|
||||
buf.writeInt16LE(0x009b, 0x0000);
|
||||
|
||||
return buf;
|
||||
}
|
||||
25
src/idz/encoder/updateProvisionalStoreRank.ts
Normal file
25
src/idz/encoder/updateProvisionalStoreRank.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import iconv = require("iconv-lite");
|
||||
|
||||
import { UpdateProvisionalStoreRankResponse } from "../response/updateProvisionalStoreRank";
|
||||
|
||||
export function updateProvisionalStoreRank(
|
||||
res: UpdateProvisionalStoreRankResponse
|
||||
) {
|
||||
const buf = Buffer.alloc(0x02b0);
|
||||
|
||||
buf.writeInt16LE(0x0083, 0x0000);
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const offset = 0x44 + i;
|
||||
const row = res.rows[i];
|
||||
|
||||
if (row !== undefined) {
|
||||
buf.writeInt16LE(row.field_0000, offset + 0x0000);
|
||||
buf.writeInt32LE(row.field_0004, offset + 0x0004);
|
||||
iconv.encode(row.field_0010, "shift_jis").copy(buf, offset + 0x0010);
|
||||
iconv.encode(row.field_003B, "shift_jis").copy(buf, offset + 0x003b);
|
||||
}
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
9
src/idz/encoder/updateStoryClearNum.ts
Normal file
9
src/idz/encoder/updateStoryClearNum.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { UpdateStoryClearNumResponse } from "../response/updateStoryClearNum";
|
||||
|
||||
export function updateStoryClearNum(res: UpdateStoryClearNumResponse) {
|
||||
const buf = Buffer.alloc(0x0220);
|
||||
|
||||
buf.writeInt16LE(0x0080, 0x0000);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ export default async function idz(socket: Socket) {
|
|||
|
||||
case "load_profile_req":
|
||||
res = {
|
||||
type: "load_record_v2_res",
|
||||
type: "load_profile_v2_res",
|
||||
name: "てすと",
|
||||
profileId: 0x11223344,
|
||||
lv: 69,
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ import { LoadRewardTableResponse } from "./loadRewardTable";
|
|||
import { LoadServerListResponse } from "./loadServerList";
|
||||
import { LoadStockerResponse } from "./loadStocker";
|
||||
import { LoadTeamResponse } from "./loadTeam";
|
||||
import { UpdateExpeditionResponse } from "./updateExpedition";
|
||||
import { UpdateProvisionalStoreRankResponse } from "./updateProvisionalStoreRank";
|
||||
import { UpdateStoryClearNumResponse } from "./updateStoryClearNum";
|
||||
import { SaveExpeditionResponse } from "./saveExpedition";
|
||||
import { SaveTopicResponse } from "./saveTopic";
|
||||
|
||||
export type Response =
|
||||
|
|
@ -34,7 +34,7 @@ export type Response =
|
|||
| LoadServerListResponse
|
||||
| LoadStockerResponse
|
||||
| LoadTeamResponse
|
||||
| UpdateExpeditionResponse
|
||||
| UpdateProvisionalStoreRankResponse
|
||||
| UpdateStoryClearNumResponse
|
||||
| SaveExpeditionResponse
|
||||
| SaveTopicResponse;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
export interface LoadProfileResponse {
|
||||
type: "load_record_v1_res";
|
||||
type: "load_profile_v1_res";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export interface LoadProfileResponse2 {
|
||||
type: "load_record_v2_res";
|
||||
type: "load_profile_v2_res";
|
||||
name: string;
|
||||
profileId: number;
|
||||
lv: number;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export interface UpdateExpeditionResponse {
|
||||
export interface SaveExpeditionResponse {
|
||||
type: "save_expedition_res";
|
||||
// tera TODO
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user