0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

Added spt profile examine to commando bot

This commit is contained in:
Chomp 2025-01-12 10:37:39 +00:00
parent 162a0b8dcb
commit 13be82ea20

View File

@ -24,6 +24,7 @@ export class ProfileSptCommand implements ISptCommand {
*/
private static commandRegex =
/^spt profile (?<command>level|skill)((?<=.*skill) (?<skill>[\w]+)){0,1} (?<quantity>(?!0+)[0-9]+)$/;
private static examineRegex = /^spt profile (?<command>examine)/;
protected savedCommand: SavedCommand;
@ -43,11 +44,11 @@ export class ProfileSptCommand implements ISptCommand {
}
public getCommandHelp(): string {
return "spt profile\n========\nSets the profile level or skill to the desired level through the message system.\n\n\tspt profile level [desired level]\n\t\tEx: spt profile level 20\n\n\tspt profile skill [skill name] [quantity]\n\t\tEx: spt profile skill metabolism 51";
return "spt profile\n========\nSets the profile level or skill to the desired level or examine all items in EFT through the message system.\n\n\tspt profile level [desired level]\n\t\tEx: spt profile level 20\n\n\tspt profile skill [skill name] [quantity]\n\t\tEx: spt profile skill metabolism 51\n\n\tspt profile examine\n\t\tEx: spt profile examine";
}
public performAction(commandHandler: IUserDialogInfo, sessionId: string, request: ISendMessageRequest): string {
if (!ProfileSptCommand.commandRegex.test(request.text)) {
if (!ProfileSptCommand.commandRegex.test(request.text) && !ProfileSptCommand.examineRegex.test(request.text)) {
this.mailSendService.sendUserMessageToPlayer(
sessionId,
commandHandler,
@ -56,7 +57,8 @@ export class ProfileSptCommand implements ISptCommand {
return request.dialogId;
}
const result = ProfileSptCommand.commandRegex.exec(request.text);
const result =
ProfileSptCommand.commandRegex.exec(request.text) ?? ProfileSptCommand.examineRegex.exec(request.text);
const command: string = result.groups.command;
const skill: string = result.groups.skill;
@ -100,6 +102,10 @@ export class ProfileSptCommand implements ISptCommand {
event = this.handleSkillCommand(enumSkill, quantity);
break;
}
case "examine": {
event = this.handleExamineCommand();
break;
}
default:
this.mailSendService.sendUserMessageToPlayer(
sessionId,
@ -147,4 +153,14 @@ export class ProfileSptCommand implements ISptCommand {
};
return event;
}
protected handleExamineCommand(): IProfileChangeEvent {
const event: IProfileChangeEvent = {
_id: this.hashUtil.generate(),
Type: ProfileChangeEventType.EXAMINE_ALL_ITEMS,
value: undefined,
entity: undefined,
};
return event;
}
}