scene command again
hope its fine now
This commit is contained in:
parent
c59789180b
commit
9f1d85b5c1
@ -11,26 +11,45 @@ export default async function handle(command: Command) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const planeID = MazePlaneExcel.fromPlaneId(parseInt(command.args[0]))
|
if(command.args.length == 0){
|
||||||
const uid = Interface.target.player.db._id;
|
c.log("Usage: /scene <planeID|floorID>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const planeData = MazePlaneExcel.fromFloorId(parseInt(command.args[0])) || MazePlaneExcel.fromPlaneId(parseInt(command.args[0])) //Get plane data
|
||||||
|
let floorId = 10001001 // Default floor data
|
||||||
|
|
||||||
|
if(planeData!){
|
||||||
|
if(command.args[0].length === 5){// If input is planeId
|
||||||
|
floorId = planeData.StartFloorID;
|
||||||
|
}else if(command.args[0].length === 8){// If input is floorId
|
||||||
|
if(planeData.FloorIDList.includes(parseInt(command.args[0]))){
|
||||||
|
floorId = parseInt(command.args[0]);
|
||||||
|
}else{
|
||||||
|
c.error("cannot find Scene data!");
|
||||||
|
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);
|
|
||||||
|
|
||||||
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 = planeData.PlaneID;
|
||||||
Interface.target.player.db.posData.floorID = planeID!.StartFloorID;
|
Interface.target.player.db.posData.floorID = floorId
|
||||||
await Interface.target.player.save()
|
await Interface.target.player.save()
|
||||||
|
|
||||||
//ty for tamilpp25 scene
|
//change scene for player
|
||||||
Interface.target.send(GetCurSceneInfoScRsp, {
|
Interface.target.send(GetCurSceneInfoScRsp, {
|
||||||
retcode: 0,
|
retcode: 0,
|
||||||
scene: {
|
scene: {
|
||||||
planeId: planeID.PlaneID,
|
planeId: planeData.PlaneID,
|
||||||
floorId: planeID.StartFloorID,
|
floorId: floorId,
|
||||||
entityList: [
|
entityList: [
|
||||||
curAvatarEntity
|
curAvatarEntity
|
||||||
],
|
],
|
||||||
@ -45,5 +64,5 @@ export default async function handle(command: Command) {
|
|||||||
|
|
||||||
Interface.target.sync();
|
Interface.target.sync();
|
||||||
|
|
||||||
c.log(`Scene set to PlaneID: ${planeID.PlaneID}`);
|
c.log(`Scene set to floorId: ${floorId}`);
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,10 @@ export default class MazePlaneExcel {
|
|||||||
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()];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user