Revert "improve scene command (#42)"

This reverts commit 118df5656d.
This commit is contained in:
GanyusLeftHorn 2022-08-05 06:54:25 +02:00 committed by GitHub
parent 2fe4f6a2ea
commit 7b6d3c70cc
2 changed files with 9 additions and 37 deletions

View File

@ -11,50 +11,26 @@ export default async function handle(command: Command) {
return; return;
} }
if(command.args.length == 0){ const planeID = MazePlaneExcel.fromPlaneId(parseInt(command.args[0]))
c.log("Usage: /scene <planeID|floorID>"); const uid = Interface.target.player.db._id;
return;
}
const plane = MazePlaneExcel.fromFloorId(parseInt(command.args[0])) || MazePlaneExcel.fromPlaneId(parseInt(command.args[0])) //Get plane data
let floorId = 10001001 // Default floor data
if(plane!){
if(command.args[0].length === 5){//PLANE ID LOGIC
floorId = plane.StartFloorID;
}else if(command.args[0].length === 8){//FLOOR ID LOGIC
if(plane! && plane.FloorIDList.includes(parseInt(command.args[0]))){
floorId = parseInt(command.args[0]);
}else{
c.error("cannot find Scene data!");
return;
}
}else{
c.error("Invalid FloorID / PlaneID length!");
return;
}
}else{
c.error("cannot find Scene data!");
return;
}
const posData = Interface.target.player.db.posData; const posData = Interface.target.player.db.posData;
const lineup = await Interface.target.player.getLineup(); const lineup2 = await Interface.target.player.getLineup();
const curAvatarEntity = new ActorEntity(Interface.target.player.scene, lineup.leaderSlot, posData.pos); const curAvatarEntity = new ActorEntity(Interface.target.player.scene, lineup2.avatarList[0].id, posData.pos);
const planeId = parseInt(floorId.toString().slice(0,5)); if (!planeID) return c.log("Usage: /scene <planeID>");
// Update scene information on player. // Update scene information on player.
Interface.target.player.db.posData.planeID = planeID!.PlaneID; Interface.target.player.db.posData.planeID = planeID!.PlaneID;
Interface.target.player.db.posData.floorID = planeID!.StartFloorID; Interface.target.player.db.posData.floorID = planeID!.StartFloorID;
await Interface.target.player.save() await Interface.target.player.save()
//ty for tamilpp25 scene
Interface.target.send(GetCurSceneInfoScRsp, { Interface.target.send(GetCurSceneInfoScRsp, {
retcode: 0, retcode: 0,
scene: { scene: {
planeId: planeId, planeId: planeID.PlaneID,
floorId: floorId, floorId: planeID.StartFloorID,
entityList: [ entityList: [
curAvatarEntity curAvatarEntity
], ],
@ -69,5 +45,5 @@ export default async function handle(command: Command) {
Interface.target.sync(); Interface.target.sync();
c.log(`Scene set to floorId: ${floorId}`); c.log(`Scene set to PlaneID: ${planeID.PlaneID}`);
} }

View File

@ -55,10 +55,6 @@ export default class MazePlaneExcel {
public static fromPlaneId(planeId: number): MazePlaneExcelTableEntry { public static fromPlaneId(planeId: number): MazePlaneExcelTableEntry {
return MazePlaneExcelTable[planeId.toString()]; return MazePlaneExcelTable[planeId.toString()];
} }
public static fromFloorId(floorId: number): MazePlaneExcelTableEntry {
return MazePlaneExcelTable[floorId.toString().slice(0,5)];
}
public static getEntry(entryId: number): MapEntryExcelTableEntry { public static getEntry(entryId: number): MapEntryExcelTableEntry {
return MapEntryExcelTable[entryId.toString()]; return MapEntryExcelTable[entryId.toString()];