Feature: Chance chance to send message to per victim instead of per-raid (!65)
Co-authored-by: Dev <dev@noreply.dev.sp-tarkov.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/65
This commit is contained in:
parent
08b760cf4c
commit
8b23039e7a
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"victim": {
|
"victim": {
|
||||||
"responseChancePercent": 15,
|
"responseChancePercent": 7,
|
||||||
"responseTypeWeights": {
|
"responseTypeWeights": {
|
||||||
"positive": 8,
|
"positive": 7,
|
||||||
"negative": 2,
|
"negative": 2,
|
||||||
"plead": 2
|
"plead": 2
|
||||||
},
|
},
|
||||||
|
@ -219,7 +219,7 @@
|
|||||||
"websocket-started": "Started websocket at %s",
|
"websocket-started": "Started websocket at %s",
|
||||||
"pmcresponse-victim_positive_1": "Nice shot",
|
"pmcresponse-victim_positive_1": "Nice shot",
|
||||||
"pmcresponse-victim_positive_2": "Great shot",
|
"pmcresponse-victim_positive_2": "Great shot",
|
||||||
"pmcresponse-victim_positive_3": "Good kill man",
|
"pmcresponse-victim_positive_3": "Good kill",
|
||||||
"pmcresponse-victim_positive_4": "Deserved kill, good one",
|
"pmcresponse-victim_positive_4": "Deserved kill, good one",
|
||||||
"pmcresponse-victim_positive_5": "Lucky kill",
|
"pmcresponse-victim_positive_5": "Lucky kill",
|
||||||
"pmcresponse-victim_positive_6": "Good fight",
|
"pmcresponse-victim_positive_6": "Good fight",
|
||||||
@ -316,7 +316,7 @@
|
|||||||
"pmcresponse-victim_plead_10": "I was afk for 2 minutes and you killed me",
|
"pmcresponse-victim_plead_10": "I was afk for 2 minutes and you killed me",
|
||||||
"pmcresponse-victim_plead_11": "I just went to the toilet and you shot me",
|
"pmcresponse-victim_plead_11": "I just went to the toilet and you shot me",
|
||||||
"pmcresponse-victim_plead_12": "I just went to the kitchen to pick up my dino nuggets and you killed me",
|
"pmcresponse-victim_plead_12": "I just went to the kitchen to pick up my dino nuggets and you killed me",
|
||||||
"pmcresponse-victim_plead_13": "BRO PLEASE",
|
"pmcresponse-victim_plead_13": "bro please",
|
||||||
"pmcresponse-victim_plead_14": "Just you wait until I download some more mods off the hub, then I'll get you",
|
"pmcresponse-victim_plead_14": "Just you wait until I download some more mods off the hub, then I'll get you",
|
||||||
"pmcresponse-victim_plead_15": "Does the wiggle mean nothing smh smh fr",
|
"pmcresponse-victim_plead_15": "Does the wiggle mean nothing smh smh fr",
|
||||||
"pmcresponse-victim_plead_16": "I cant stand this game, I'm going back to roblox",
|
"pmcresponse-victim_plead_16": "I cant stand this game, I'm going back to roblox",
|
||||||
@ -336,5 +336,9 @@
|
|||||||
"pmcresponse-suffix_11": "my guy",
|
"pmcresponse-suffix_11": "my guy",
|
||||||
"pmcresponse-suffix_12": "smh",
|
"pmcresponse-suffix_12": "smh",
|
||||||
"pmcresponse-suffix_13": "man",
|
"pmcresponse-suffix_13": "man",
|
||||||
"pmcresponse-suffix_14": "king"
|
"pmcresponse-suffix_14": "king",
|
||||||
|
"pmcresponse-suffix_15": "champ",
|
||||||
|
"pmcresponse-suffix_16": "amigo",
|
||||||
|
"pmcresponse-suffix_17": "bud",
|
||||||
|
"pmcresponse-suffix_18": "guy"
|
||||||
}
|
}
|
@ -30,17 +30,23 @@ export class PmcChatResponseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chooses a random victim from those provided and sends a message to the player, can be positive or negative
|
* For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative
|
||||||
* @param sessionId Session id
|
* @param sessionId Session id
|
||||||
* @param pmcVictims Array of bots killed by player
|
* @param pmcVictims Array of bots killed by player
|
||||||
*/
|
*/
|
||||||
public sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void
|
public sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void
|
||||||
{
|
{
|
||||||
const victim = this.chooseRandomVictim(pmcVictims);
|
for (const victim of pmcVictims)
|
||||||
|
{
|
||||||
|
if (!this.randomUtil.getChance100(this.pmcResponsesConfig.victim.responseChancePercent))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const message = this.chooseMessage(true);
|
const victimDetails = this.getVictimDetails(victim);
|
||||||
|
const message = this.chooseMessage(true);
|
||||||
this.notificationSendHelper.sendMessageToPlayer(sessionId, victim, message, MessageType.USER_MESSAGE);
|
this.notificationSendHelper.sendMessageToPlayer(sessionId, victimDetails, message, MessageType.USER_MESSAGE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -187,6 +193,17 @@ export class PmcChatResponseService
|
|||||||
{
|
{
|
||||||
const randomVictim = this.randomUtil.getArrayValue(pmcVictims);
|
const randomVictim = this.randomUtil.getArrayValue(pmcVictims);
|
||||||
|
|
||||||
return {_id: randomVictim.Name, info:{Nickname: randomVictim.Name, Level: randomVictim.Level, Side: randomVictim.Side, MemberCategory: MemberCategory.UNIQUE_ID}};
|
return this.getVictimDetails(randomVictim);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a victim object into a IUserDialogInfo object
|
||||||
|
* @param pmcVictim victim to convert
|
||||||
|
* @returns IUserDialogInfo
|
||||||
|
*/
|
||||||
|
protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo
|
||||||
|
{
|
||||||
|
const categories = [MemberCategory.UNIQUE_ID, MemberCategory.DEFAULT, MemberCategory.DEFAULT, MemberCategory.DEFAULT, MemberCategory.DEFAULT, MemberCategory.DEFAULT, MemberCategory.DEFAULT, MemberCategory.SHERPA, MemberCategory.DEVELOPER];
|
||||||
|
return {_id: pmcVictim.Name, info:{Nickname: pmcVictim.Name, Level: pmcVictim.Level, Side: pmcVictim.Side, MemberCategory: this.randomUtil.getArrayValue(categories)}};
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user