diff --git a/project/assets/configs/core.json b/project/assets/configs/core.json index dbf0a21a..f2e40d2d 100644 --- a/project/assets/configs/core.json +++ b/project/assets/configs/core.json @@ -23,6 +23,7 @@ "compressProfile": false, "chatbotFeatures": { "sptFriendEnabled": true, + "sptFriendGiftsEnabled": true, "commandoEnabled": true, "commandoFeatures": { "giveCommandEnabled": true diff --git a/project/src/helpers/Dialogue/SptDialogueChatBot.ts b/project/src/helpers/Dialogue/SptDialogueChatBot.ts index fcc4fe93..3d49055e 100644 --- a/project/src/helpers/Dialogue/SptDialogueChatBot.ts +++ b/project/src/helpers/Dialogue/SptDialogueChatBot.ts @@ -53,33 +53,34 @@ export class SptDialogueChatBot implements IDialogueChatBot { const sender = this.profileHelper.getPmcProfile(sessionId); const sptFriendUser = this.getChatBot(); - - const giftSent = this.giftService.sendGiftToPlayer(sessionId, request.text); - const requestInput = request.text.toLowerCase(); - if (giftSent === GiftSentResult.SUCCESS) { - this.mailSendService.sendUserMessageToPlayer( - sessionId, - sptFriendUser, - this.randomUtil.getArrayValue([ - "Hey! you got the right code!", - "A secret code, how exciting!", - "You found a gift code!", - ]), - ); + // only check if entered text is gift code when feature enabled + if (this.coreConfig.features.chatbotFeatures.sptFriendGiftsEnabled) { + const giftSent = this.giftService.sendGiftToPlayer(sessionId, request.text); + if (giftSent === GiftSentResult.SUCCESS) { + this.mailSendService.sendUserMessageToPlayer( + sessionId, + sptFriendUser, + this.randomUtil.getArrayValue([ + "Hey! you got the right code!", + "A secret code, how exciting!", + "You found a gift code!", + ]), + ); - return; - } + return; + } - if (giftSent === GiftSentResult.FAILED_GIFT_ALREADY_RECEIVED) { - this.mailSendService.sendUserMessageToPlayer( - sessionId, - sptFriendUser, - this.randomUtil.getArrayValue(["Looks like you already used that code", "You already have that!!"]), - ); + if (giftSent === GiftSentResult.FAILED_GIFT_ALREADY_RECEIVED) { + this.mailSendService.sendUserMessageToPlayer( + sessionId, + sptFriendUser, + this.randomUtil.getArrayValue(["Looks like you already used that code", "You already have that!!"]), + ); - return; + return; + } } if (requestInput.includes("love you")) { diff --git a/project/src/models/spt/config/ICoreConfig.ts b/project/src/models/spt/config/ICoreConfig.ts index 28863aec..562253d1 100644 --- a/project/src/models/spt/config/ICoreConfig.ts +++ b/project/src/models/spt/config/ICoreConfig.ts @@ -88,6 +88,7 @@ export interface IServerFeatures { export interface IChatbotFeatures { sptFriendEnabled: boolean; + sptFriendGiftsEnabled: boolean; commandoEnabled: boolean; commandoFeatures: ICommandoFeatures; commandUseLimits: Record;