Compare commits
6 Commits
main
...
character-
Author | SHA1 | Date | |
---|---|---|---|
|
8f3cd0e0ee | ||
|
cc91edc7e5 | ||
|
4a7eaada01 | ||
|
21ad2644c6 | ||
|
212a03fb1b | ||
|
38b5d51be2 |
@ -16,7 +16,7 @@ export default async function handle(session: Session, packet: Packet) {
|
||||
|
||||
if (!success) {
|
||||
session.send(DoGachaScRsp, {
|
||||
retcode: 1
|
||||
retcode: 1301
|
||||
} as DoGachaScRsp);
|
||||
}
|
||||
|
||||
|
16
src/server/packets/DressAvatarCsReq.ts
Normal file
16
src/server/packets/DressAvatarCsReq.ts
Normal 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();
|
||||
}
|
44
src/server/packets/RankUpAvatarCsReq.ts
Normal file
44
src/server/packets/RankUpAvatarCsReq.ts
Normal 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();
|
||||
}
|
||||
}
|
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user