Send pity gift codes to player when player dies to other PMC's (!359)
* This is to address [Issue 652](https://dev.sp-tarkov.com/SPT/Issues/issues/652). * Added messages with gift codes inside project/assets/database/locales/server/en.json * Update pmcchatresponse.json to include new pity message type. * Update logic in project/src/services/PmcChatResponseService.ts to now account for pity messages that are sent. The message's %giftcode% will now be replaced with a random gift code from assets\configs\gifts.json * Example: - ![image](/attachments/ade2686a-8dcb-4c11-9457-88e003a47416) Co-authored-by: Scuvy <Scuvy@gmail.com> Co-authored-by: chomp <chomp@noreply.dev.sp-tarkov.com> Reviewed-on: https://dev.sp-tarkov.com/SPT/Server/pulls/359 Co-authored-by: Scuvy <scuvy@noreply.dev.sp-tarkov.com> Co-committed-by: Scuvy <scuvy@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
ccb351a2dd
commit
e0717daa99
@ -15,7 +15,8 @@
|
|||||||
"responseTypeWeights": {
|
"responseTypeWeights": {
|
||||||
"positive": 5,
|
"positive": 5,
|
||||||
"negative": 2,
|
"negative": 2,
|
||||||
"plead": 2
|
"plead": 2,
|
||||||
|
"pity": 1
|
||||||
},
|
},
|
||||||
"stripCapitalisationChancePercent": 20,
|
"stripCapitalisationChancePercent": 20,
|
||||||
"allCapsChancePercent": 15,
|
"allCapsChancePercent": 15,
|
||||||
|
@ -310,6 +310,22 @@
|
|||||||
"pmcresponse-killer_negative_7": "No wonder you play SPT with your aim",
|
"pmcresponse-killer_negative_7": "No wonder you play SPT with your aim",
|
||||||
"pmcresponse-killer_negative_8": "It is what it is",
|
"pmcresponse-killer_negative_8": "It is what it is",
|
||||||
"pmcresponse-killer_negative_9": "Thanks for looting for me",
|
"pmcresponse-killer_negative_9": "Thanks for looting for me",
|
||||||
|
"pmcresponse-killer_pity_1": "Wow, those Scavs must have a personal vendetta against you. Here's a gift code: '%giftcode%'. Maybe they'll mistake you for a friend next time.",
|
||||||
|
"pmcresponse-killer_pity_2": "You died faster than I could say 'Friendly PMC!' Take this gift code: '%giftcode%' and maybe you'll last a little longer next time.",
|
||||||
|
"pmcresponse-killer_pity_3": "You're starting to make Scavs look like elite soldiers. Use this gift code: '%giftcode%' and show them who's boss.",
|
||||||
|
"pmcresponse-killer_pity_4": "If dying was an art, you'd be Picasso. Here's a gift code: '%giftcode%' to keep your masterpiece alive a bit longer.",
|
||||||
|
"pmcresponse-killer_pity_5": "Looks like those Scavs got the better of you again. Here, take this gift code: '%giftcode%'. Maybe it will help you survive next time.",
|
||||||
|
"pmcresponse-killer_pity_6": "That raid was brutal. I feel bad watching you struggle. Use this gift code: '%giftcode%' and maybe you'll have better luck.",
|
||||||
|
"pmcresponse-killer_pity_7": "Ouch, another failed extraction. Don't worry, take this gift code: '%giftcode%' and gear up for your next try.",
|
||||||
|
"pmcresponse-killer_pity_8": "It hurts to watch you get ambushed like that. Maybe this gift code: '%giftcode%' will turn things around for you.",
|
||||||
|
"pmcresponse-killer_pity_9": "Those PMC runs aren't going well, huh? Take this gift code: '%giftcode%' and give it another shot.",
|
||||||
|
"pmcresponse-killer_pity_10": "Another wipe and you're still struggling. This gift code: '%giftcode%' might give you the edge you need.",
|
||||||
|
"pmcresponse-killer_pity_11": "You keep getting Tarkov'd hard. Hopefully, this gift code: '%giftcode%' can help you catch a break.",
|
||||||
|
"pmcresponse-killer_pity_12": "Damn, looks like you need this gift code more than I do: '%giftcode%'. I've heard you can message SPT that code, and they will help you out. They're pretty friendly; they might even be on your friends list already.",
|
||||||
|
"pmcresponse-killer_pity_13": "You should probably turn your headphones back on. I feel bad I killed you like that, so here, have this gift code: '%giftcode%'.",
|
||||||
|
"pmcresponse-killer_pity_14": "I'll keep it real with you... You're trash, but don't despair. I did find this gift code I can give to you: '%giftcode%'.",
|
||||||
|
"pmcresponse-killer_pity_15": "Did your gun jam? I can't imagine any other reason you would have died back there. Oh well, I found this scribbled on a dead scav's notebook: '%giftcode%'. Not sure what it means, but maybe it will be useful to you.",
|
||||||
|
"pmcresponse-killer_pity_16": "You seem to be having a hard day. Maybe this gift code: '%giftcode%' will make it better.",
|
||||||
"pmcresponse-killer_plead_1": "I was trying to extract a quest item and you were in my path",
|
"pmcresponse-killer_plead_1": "I was trying to extract a quest item and you were in my path",
|
||||||
"pmcresponse-killer_plead_10": "Typical {{playerSide}} behaviour",
|
"pmcresponse-killer_plead_10": "Typical {{playerSide}} behaviour",
|
||||||
"pmcresponse-killer_plead_11": "I need to kill {{playerSide}}, i hope you understand",
|
"pmcresponse-killer_plead_11": "I need to kill {{playerSide}}, i hope you understand",
|
||||||
|
@ -7,6 +7,7 @@ import { IUserDialogInfo } from "@spt/models/eft/profile/ISptProfile";
|
|||||||
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||||
import { MemberCategory } from "@spt/models/enums/MemberCategory";
|
import { MemberCategory } from "@spt/models/enums/MemberCategory";
|
||||||
import { MessageType } from "@spt/models/enums/MessageType";
|
import { MessageType } from "@spt/models/enums/MessageType";
|
||||||
|
import { IGiftsConfig } from "@spt/models/spt/config/IGiftsConfig";
|
||||||
import { IPmcChatResponse } from "@spt/models/spt/config/IPmChatResponse";
|
import { IPmcChatResponse } from "@spt/models/spt/config/IPmChatResponse";
|
||||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
@ -19,6 +20,7 @@ import { RandomUtil } from "@spt/utils/RandomUtil";
|
|||||||
export class PmcChatResponseService
|
export class PmcChatResponseService
|
||||||
{
|
{
|
||||||
protected pmcResponsesConfig: IPmcChatResponse;
|
protected pmcResponsesConfig: IPmcChatResponse;
|
||||||
|
protected giftConfig: IGiftsConfig;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject("PrimaryLogger") protected logger: ILogger,
|
@inject("PrimaryLogger") protected logger: ILogger,
|
||||||
@ -32,6 +34,7 @@ export class PmcChatResponseService
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.pmcResponsesConfig = this.configServer.getConfig(ConfigTypes.PMC_CHAT_RESPONSE);
|
this.pmcResponsesConfig = this.configServer.getConfig(ConfigTypes.PMC_CHAT_RESPONSE);
|
||||||
|
this.giftConfig = this.configServer.getConfig(ConfigTypes.GIFTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,10 +85,7 @@ export class PmcChatResponseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find bot by name in cache
|
// find bot by name in cache
|
||||||
const killerDetailsInCache = this.matchBotDetailsCacheService.getBotByNameAndSide(
|
const killerDetailsInCache = this.matchBotDetailsCacheService.getBotByNameAndSide(killer.Name, killer.Side);
|
||||||
killer.Name,
|
|
||||||
killer.Side,
|
|
||||||
);
|
|
||||||
if (!killerDetailsInCache)
|
if (!killerDetailsInCache)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -108,12 +108,22 @@ export class PmcChatResponseService
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const message = this.chooseMessage(false, pmcData);
|
let message = this.chooseMessage(false, pmcData);
|
||||||
if (!message)
|
if (!message)
|
||||||
{
|
{
|
||||||
return;
|
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);
|
this.notificationSendHelper.sendMessageToPlayer(sessionId, killerDetails, message, MessageType.USER_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user