mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Moved pity gift code into chooseMessage()
to group similar functionality together
This commit is contained in:
parent
e0717daa99
commit
75b2661f72
@ -108,22 +108,12 @@ export class PmcChatResponseService
|
||||
},
|
||||
};
|
||||
|
||||
let message = this.chooseMessage(false, pmcData);
|
||||
const message = this.chooseMessage(false, pmcData);
|
||||
if (!message)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Give the player a gift code if they were killed.
|
||||
const regex: RegExp = /(%giftcode%)/gi;
|
||||
if (regex.test(message))
|
||||
{
|
||||
const giftKeys = Object.keys(this.giftConfig.gifts);
|
||||
const randomGiftKey = this.randomUtil.getStringArrayValue(giftKeys);
|
||||
|
||||
message = message.replace(regex, randomGiftKey);
|
||||
}
|
||||
|
||||
this.notificationSendHelper.sendMessageToPlayer(sessionId, killerDetails, message, MessageType.USER_MESSAGE);
|
||||
}
|
||||
|
||||
@ -154,6 +144,16 @@ export class PmcChatResponseService
|
||||
playerSide: pmcData.Info.Side,
|
||||
});
|
||||
|
||||
// Give the player a gift code if they were killed adn response is 'pity'.
|
||||
if (responseType === "pity")
|
||||
{
|
||||
const giftKeys = Object.keys(this.giftConfig.gifts);
|
||||
const randomGiftKey = this.randomUtil.getStringArrayValue(giftKeys);
|
||||
|
||||
const regex: RegExp = /(%giftcode%)/gi;
|
||||
responseText = responseText.replace(regex, randomGiftKey);
|
||||
}
|
||||
|
||||
if (this.appendSuffixToMessageEnd(isVictim))
|
||||
{
|
||||
const suffixText = this.localisationService.getText(
|
||||
|
Loading…
x
Reference in New Issue
Block a user