mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 02:10:44 -05:00
Made commando first check if there's a preset for an item, otherwise if goes through normal logic (!333)
Co-authored-by: clodan <clodan@clodan.com> Reviewed-on: SPT-AKI/Server#333 Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com> Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
adab18e3fb
commit
7dc17acb97
@ -30,7 +30,8 @@ export class GiveSptCommand implements ISptCommand
|
||||
*/
|
||||
private static commandRegex = /^spt give (((([a-z]{2,5}) )?"(.+)"|\w+) )?([0-9]+)$/;
|
||||
private static acceptableConfidence = 0.9;
|
||||
|
||||
// exception for flares
|
||||
private static excludedPresetItems = new Set<string>(["62178c4d4ecf221597654e3d", "6217726288ed9f0845317459", "624c0b3340357b5f566e8766"]);
|
||||
protected savedCommand: Map<string, SavedCommand> = new Map<string, SavedCommand>();
|
||||
|
||||
public constructor(
|
||||
@ -201,25 +202,9 @@ export class GiveSptCommand implements ISptCommand
|
||||
}
|
||||
|
||||
const itemsToSend: Item[] = [];
|
||||
if (
|
||||
(this.itemHelper.isOfBaseclass(checkedItem[1]._id, BaseClasses.WEAPON)
|
||||
|| this.itemHelper.isOfBaseclass(checkedItem[1]._id, BaseClasses.ARMOR)
|
||||
|| this.itemHelper.isOfBaseclass(checkedItem[1]._id, BaseClasses.VEST))
|
||||
&& !["62178c4d4ecf221597654e3d", "6217726288ed9f0845317459", "624c0b3340357b5f566e8766"].includes(
|
||||
checkedItem[1]._id,
|
||||
) // edge case for handheld flares
|
||||
)
|
||||
const preset = this.presetHelper.getDefaultPreset(checkedItem[1]._id);
|
||||
if (preset && !GiveSptCommand.excludedPresetItems.has(checkedItem[1]._id))
|
||||
{
|
||||
const preset = this.presetHelper.getDefaultPreset(checkedItem[1]._id);
|
||||
if (!preset)
|
||||
{
|
||||
this.mailSendService.sendUserMessageToPlayer(
|
||||
sessionId,
|
||||
commandHandler,
|
||||
"That weapon template ID could not be found. Please refine your request and try again.",
|
||||
);
|
||||
return request.dialogId;
|
||||
}
|
||||
for (let i = 0; i < quantity; i++)
|
||||
{
|
||||
let items = this.cloner.clone(preset._items);
|
||||
|
Loading…
x
Reference in New Issue
Block a user