Compare commits

...

6 Commits

Author SHA1 Message Date
memetrollsXD
8f3cd0e0ee
Merge branch 'main' into character-screen 2022-08-05 07:31:18 +02:00
memetrollsXD
cc91edc7e5
Refactor RankUpAvatarReq to pay all items at once 2022-08-05 07:30:39 +02:00
memetrollsXD
4a7eaada01
_ 2022-08-04 12:59:44 +02:00
codefactor-io
21ad2644c6
[CodeFactor] Apply fixes
[ci skip] [skip ci]
2022-08-04 10:03:54 +00:00
memetrollsXD
212a03fb1b
implement changing weapons 2022-08-04 12:02:04 +02:00
memetrollsXD
38b5d51be2
implement eidolon levelup 2022-08-04 11:55:00 +02:00
4 changed files with 63 additions and 3 deletions

View File

@ -16,7 +16,7 @@ export default async function handle(session: Session, packet: Packet) {
if (!success) {
session.send(DoGachaScRsp, {
retcode: 1
retcode: 1301
} as DoGachaScRsp);
}

View File

@ -0,0 +1,16 @@
import { DressAvatarCsReq, DressAvatarScRsp } from "../../data/proto/StarRail";
import Avatar from "../../db/Avatar";
import Packet from "../kcp/Packet";
import Session from "../kcp/Session";
export default async function handle(session: Session, packet: Packet) {
const body = packet.body as DressAvatarCsReq;
const avatar = await Avatar.loadAvatarForPlayer(session.player, body.baseAvatarId);
avatar.db.equipmentUniqueId = body.equipmentUniqueId;
await avatar.save();
session.send(DressAvatarScRsp, { retcode: 0 });
session.sync();
}

View File

@ -0,0 +1,44 @@
import { RankUpAvatarCsReq, RankUpAvatarScRsp } from "../../data/proto/StarRail";
import Avatar from "../../db/Avatar";
import { PayItemData } from "../../db/Inventory";
import Logger from "../../util/Logger";
import Packet from "../kcp/Packet";
import Session from "../kcp/Session";
const c = new Logger("RankUpAvatarCsReq");
export default async function handle(session: Session, packet: Packet) {
const body = packet.body as RankUpAvatarCsReq;
const dataObj: RankUpAvatarScRsp = {
retcode: 0
};
try {
const inv = await session.player.getInventory();
if (!body.costData) return;
const list = body.costData.itemList;
const arr: Array<PayItemData> = [];
for (let i = 0; i < list.length; i++) {
const item = list[i];
if (!item.pileItem) continue;
arr.push({
count: item.pileItem.itemNum,
id: item.pileItem.itemId
});
}
if (await inv.payItems(arr)) {
const avatar = await Avatar.loadAvatarForPlayer(session.player, body.baseAvatarId);
avatar.db.rank = body.rank // gidra moment: ez hack
await avatar.save();
} else {
dataObj.retcode = 1301;
}
} catch (e) {
c.error(e as Error);
dataObj.retcode = 2;
} finally {
session.send(RankUpAvatarScRsp, dataObj);
session.sync();
}
}

View File

@ -17,14 +17,14 @@ export default async function handle(session: Session, packet: Packet) {
rounds: 1,
status: ChallengeStatus.CHALLENGE_DOING,
killMonsterList: [{
monsterId: 1001010,
monsterId: 8013010,
killNum: 1,
}]
},
maze: {
// ? Data from MappingInfoExcelTable
id: 30101,
mapEntryId: 1000,
mapEntryId: 10001,
floor: {
floorId: 20121001,
scene: {