From c61de9433e2ca1f7933c35a93f2ff358f8a3270d Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 3 Nov 2024 11:24:05 +0000 Subject: [PATCH] Added ability for PMCs killed by player to remark on the map they died on + added some PMC responses that involve the location --- .../assets/database/locales/server/en.json | 6 ++++++ .../src/services/PmcChatResponseService.ts | 20 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/project/assets/database/locales/server/en.json b/project/assets/database/locales/server/en.json index 07809fa2..03c9e725 100644 --- a/project/assets/database/locales/server/en.json +++ b/project/assets/database/locales/server/en.json @@ -489,6 +489,9 @@ "pmcresponse-victim_negative_99": "Your computer so bad you get 20fps on streets", "pmcresponse-victim_negative_103": "Yeah you only got that kill because i had busy hands", "pmcresponse-victim_negative_104": "I would have heard you but i forgot to turn off binaural audio", + "pmcresponse-victim_negative_105": "I really really really hate {{victimDeathLocation}}", + "pmcresponse-victim_negative_106": "I should have installed a mod to remove the need to go to {{victimDeathLocation}}", + "pmcresponse-victim_negative_107": "I nearly got my quest item out of {{victimDeathLocation}} and then you showed up", "pmcresponse-victim_plead_1": "I was questing", "pmcresponse-victim_plead_10": "I was afk for no more than 2 minutes and you killed me", "pmcresponse-victim_plead_11": "I just went to the toilet and you shot me", @@ -507,6 +510,7 @@ "pmcresponse-victim_plead_23": "Cheap kill", "pmcresponse-victim_plead_24": "It is what it is", "pmcresponse-victim_plead_25": "Its so over", + "pmcresponse-victim_plead_26": "I just wanted to do a few quests on {{victimDeathLocation}} its not much to ask", "pmcresponse-victim_plead_3": "Hope ur happy i can't even afford a new kit", "pmcresponse-victim_plead_4": "Bro im new to the game why you kill me", "pmcresponse-victim_plead_5": "I am never gonna get this stupid quest done", @@ -578,6 +582,8 @@ "pmcresponse-victim_positive_65": "I cant believe you took me out like that. Great job", "pmcresponse-victim_positive_66": "We should duo some time", "pmcresponse-victim_positive_67": "You know your stuff, lets raid some time", + "pmcresponse-victim_positive_68": "I knew the risks going into {{victimDeathLocation}}, well played", + "pmcresponse-victim_positive_69": "Live by {{victimDeathLocation}}, die by {{victimDeathLocation}}", "pmcresponse-victim_positive_7": "That was fair, nice kill", "pmcresponse-victim_positive_8": "You're a good shot, that's for sure", "pmcresponse-victim_positive_9": "gg", diff --git a/project/src/services/PmcChatResponseService.ts b/project/src/services/PmcChatResponseService.ts index ea4a6e1a..32709a19 100644 --- a/project/src/services/PmcChatResponseService.ts +++ b/project/src/services/PmcChatResponseService.ts @@ -11,6 +11,7 @@ import { IPmcChatResponse } from "@spt/models/spt/config/IPmChatResponse"; import { ILogger } from "@spt/models/spt/utils/ILogger"; import { ConfigServer } from "@spt/servers/ConfigServer"; import { GiftService } from "@spt/services/GiftService"; +import { LocaleService } from "@spt/services/LocaleService"; import { LocalisationService } from "@spt/services/LocalisationService"; import { MatchBotDetailsCacheService } from "@spt/services/MatchBotDetailsCacheService"; import { HashUtil } from "@spt/utils/HashUtil"; @@ -29,6 +30,7 @@ export class PmcChatResponseService { @inject("NotificationSendHelper") protected notificationSendHelper: NotificationSendHelper, @inject("MatchBotDetailsCacheService") protected matchBotDetailsCacheService: MatchBotDetailsCacheService, @inject("LocalisationService") protected localisationService: LocalisationService, + @inject("LocaleService") protected localeService: LocaleService, @inject("GiftService") protected giftService: GiftService, @inject("WeightedRandomHelper") protected weightedRandomHelper: WeightedRandomHelper, @inject("ConfigServer") protected configServer: ConfigServer, @@ -58,7 +60,7 @@ export class PmcChatResponseService { } const victimDetails = this.getVictimDetails(victim); - const message = this.chooseMessage(true, pmcData); + const message = this.chooseMessage(true, pmcData, victim); if (message) { this.notificationSendHelper.sendMessageToPlayer( sessionId, @@ -120,9 +122,10 @@ export class PmcChatResponseService { * Choose a localised message to send the player (different if sender was killed or killed player) * @param isVictim Is the message coming from a bot killed by the player * @param pmcData Player profile + * @param victimData OPTIMAL - details of the pmc killed * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string | undefined { + protected chooseMessage(isVictim: boolean, pmcData: IPmcData, victimData?: IVictim): string | undefined { // Positive/negative etc const responseType = this.chooseResponseType(isVictim); @@ -139,9 +142,10 @@ export class PmcChatResponseService { playerName: pmcData.Info.Nickname, playerLevel: pmcData.Info.Level, playerSide: pmcData.Info.Side, + victimDeathLocation: victimData ? this.getLocationName(victimData.Location) : "", }); - // Give the player a gift code if they were killed adn response is 'pity'. + // Give the player a gift code if they were killed and response is 'pity'. if (responseType === "pity") { const giftKeys = this.giftService.getGiftIds(); const randomGiftKey = this.randomUtil.getStringArrayValue(giftKeys); @@ -168,6 +172,16 @@ export class PmcChatResponseService { return responseText; } + /** + * use map key to get a localised location name + * e.g. factory4_day becomes "Factory" + * @param locationKey location key to localise + * @returns Localised location name + */ + protected getLocationName(locationKey: string) { + return this.localeService.getLocaleDb()[locationKey] ?? locationKey; + } + /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player