Send gift to player after taking coop extract
This commit is contained in:
parent
42f3e52ded
commit
3c3fd56e65
@ -19,6 +19,12 @@
|
||||
"South V-Ex",
|
||||
"E7_car"
|
||||
],
|
||||
"coopExtracts": [
|
||||
"Interchange Cooperation",
|
||||
"tunnel_shared",
|
||||
"EXFIL_ScavCooperation",
|
||||
"Factory Gate"
|
||||
],
|
||||
"carExtractBaseStandingGain": 0.4,
|
||||
"scavExtractGain": 0.01,
|
||||
"keepFiRSecureContainerOnDeath": false
|
||||
|
@ -160,7 +160,83 @@
|
||||
"62f10b79e7ee985f386b2f47",
|
||||
"633ffb5d419dbf4bea7004c6",
|
||||
"543be5dd4bdc2deb348b4569"
|
||||
]
|
||||
],
|
||||
"coopExtractGift": {
|
||||
"sendGift": true,
|
||||
"messageLocaleIds": ["5da89b1886f77439d7741002 0", "5da89b3a86f7742f9026cb83 0"],
|
||||
"giftExpiryHours": 168,
|
||||
"presetCount": {
|
||||
"min": 0,
|
||||
"max": 0
|
||||
},
|
||||
"itemCount": {
|
||||
"min": 2,
|
||||
"max": 5
|
||||
},
|
||||
"weaponCrateCount": {
|
||||
"min": 0,
|
||||
"max": 0
|
||||
},
|
||||
"itemBlacklist": [
|
||||
"5e997f0b86f7741ac73993e2",
|
||||
"5b44abe986f774283e2e3512",
|
||||
"5e99711486f7744bfc4af328",
|
||||
"5e99735686f7744bfc4af32c",
|
||||
"6087e570b998180e9f76dc24",
|
||||
"5d52d479a4b936793d58c76b",
|
||||
"5e85aac65505fa48730d8af2",
|
||||
"63495c500c297e20065a08b1",
|
||||
"5cde8864d7f00c0010373be1",
|
||||
"5b3b713c5acfc4330140bd8d",
|
||||
"60c080eb991ac167ad1c3ad4",
|
||||
"6389c7f115805221fb410466"
|
||||
],
|
||||
"itemTypeWhitelist": [
|
||||
"5d650c3e815116009f6201d2",
|
||||
"57864ee62459775490116fc1",
|
||||
"57864ada245977548638de91",
|
||||
"57864bb7245977548b3b66c2",
|
||||
"57864e4c24597754843f8723",
|
||||
"57864c322459775490116fbf",
|
||||
"57864a66245977548f04a81f"
|
||||
],
|
||||
"itemLimits": {
|
||||
"5d650c3e815116009f6201d2": 1,
|
||||
"57864ee62459775490116fc1": 1,
|
||||
"57864ada245977548638de91": 2,
|
||||
"57864bb7245977548b3b66c2": 1,
|
||||
"57864e4c24597754843f8723": 1,
|
||||
"57864a66245977548f04a81f": 1,
|
||||
|
||||
"5448e8d04bdc2ddf718b4569": 1,
|
||||
"5448e8d64bdc2dce718b4568": 1,
|
||||
"5448bc234bdc2d3c308b4569": 1,
|
||||
|
||||
"5448e5724bdc2ddf718b4568": 1,
|
||||
"55818add4bdc2d5b648b456f": 1,
|
||||
"543be6564bdc2df4348b4568": 1,
|
||||
"550aa4cd4bdc2dd8348b456c": 1,
|
||||
"5448f39d4bdc2d0a728b4568": 1,
|
||||
"5448f3a14bdc2d27728b4569": 1,
|
||||
"5447e1d04bdc2dff2f8b4567": 1,
|
||||
"55818ad54bdc2ddc698b4569": 1
|
||||
},
|
||||
"itemStackLimits": {
|
||||
"5449016a4bdc2d6f028b456f": {
|
||||
"min": 5000,
|
||||
"max": 20000
|
||||
},
|
||||
"569668774bdc2da2298b4568": {
|
||||
"min": 75,
|
||||
"max": 150
|
||||
},
|
||||
"5696686a4bdc2da3298b456a": {
|
||||
"min": 75,
|
||||
"max": 150
|
||||
}
|
||||
},
|
||||
"allowBossItems": false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,11 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { ApplicationContext } from "../context/ApplicationContext";
|
||||
import { ContextVariableType } from "../context/ContextVariableType";
|
||||
import { LootGenerator } from "../generators/LootGenerator";
|
||||
import { ProfileHelper } from "../helpers/ProfileHelper";
|
||||
import { TraderHelper } from "../helpers/TraderHelper";
|
||||
import { IPmcData } from "../models/eft/common/IPmcData";
|
||||
import { Item } from "../models/eft/common/tables/IItem";
|
||||
import { ICreateGroupRequestData } from "../models/eft/match/ICreateGroupRequestData";
|
||||
import { IEndOfflineRaidRequestData } from "../models/eft/match/IEndOfflineRaidRequestData";
|
||||
import { IGetGroupStatusRequestData } from "../models/eft/match/IGetGroupStatusRequestData";
|
||||
@ -15,28 +17,38 @@ import {
|
||||
import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData";
|
||||
import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult";
|
||||
import { ConfigTypes } from "../models/enums/ConfigTypes";
|
||||
import { MessageType } from "../models/enums/MessageType";
|
||||
import { Traders } from "../models/enums/Traders";
|
||||
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
|
||||
import { IMatchConfig } from "../models/spt/config/IMatchConfig";
|
||||
import { IPmcConfig } from "../models/spt/config/IPmcConfig";
|
||||
import { ITraderConfig } from "../models/spt/config/ITraderConfig";
|
||||
import { ILogger } from "../models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "../servers/ConfigServer";
|
||||
import { SaveServer } from "../servers/SaveServer";
|
||||
import { BotGenerationCacheService } from "../services/BotGenerationCacheService";
|
||||
import { BotLootCacheService } from "../services/BotLootCacheService";
|
||||
import { MailSendService } from "../services/MailSendService";
|
||||
import { MatchLocationService } from "../services/MatchLocationService";
|
||||
import { ProfileSnapshotService } from "../services/ProfileSnapshotService";
|
||||
import { HashUtil } from "../utils/HashUtil";
|
||||
import { RandomUtil } from "../utils/RandomUtil";
|
||||
import { TimeUtil } from "../utils/TimeUtil";
|
||||
|
||||
@injectable()
|
||||
export class MatchController
|
||||
{
|
||||
protected matchConfig: IMatchConfig;
|
||||
protected inraidConfig: IInRaidConfig;
|
||||
protected traderConfig: ITraderConfig;
|
||||
protected pmcConfig: IPmcConfig;
|
||||
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("RandomUtil") protected randomUtil: RandomUtil,
|
||||
@inject("HashUtil") protected hashUtil: HashUtil,
|
||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||
@inject("MatchLocationService") protected matchLocationService: MatchLocationService,
|
||||
@inject("TraderHelper") protected traderHelper: TraderHelper,
|
||||
@ -44,11 +56,14 @@ export class MatchController
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
@inject("ProfileSnapshotService") protected profileSnapshotService: ProfileSnapshotService,
|
||||
@inject("BotGenerationCacheService") protected botGenerationCacheService: BotGenerationCacheService,
|
||||
@inject("MailSendService") protected mailSendService: MailSendService,
|
||||
@inject("LootGenerator") protected lootGenerator: LootGenerator,
|
||||
@inject("ApplicationContext") protected applicationContext: ApplicationContext
|
||||
)
|
||||
{
|
||||
this.matchConfig = this.configServer.getConfig(ConfigTypes.MATCH);
|
||||
this.inraidConfig = this.configServer.getConfig(ConfigTypes.IN_RAID);
|
||||
this.traderConfig = this.configServer.getConfig(ConfigTypes.TRADER);
|
||||
this.pmcConfig = this.configServer.getConfig(ConfigTypes.PMC);
|
||||
}
|
||||
|
||||
@ -182,6 +197,54 @@ export class MatchController
|
||||
{
|
||||
this.handleCarExtract(extractName, pmcData, sessionId);
|
||||
}
|
||||
|
||||
if (this.extractWasViaCoop(extractName) && this.traderConfig.fence.coopExtractGift.sendGift)
|
||||
{
|
||||
this.sendCoopTakenFenceMessage(sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Did player take a COOP extract
|
||||
* @param extractName Name of extract player took
|
||||
* @returns True if coop extract
|
||||
*/
|
||||
protected extractWasViaCoop(extractName: string): boolean
|
||||
{
|
||||
return (this.inraidConfig.coopExtracts.includes(extractName.trim()));
|
||||
}
|
||||
|
||||
protected sendCoopTakenFenceMessage(sessionId: string): void
|
||||
{
|
||||
// Generate reward for taking coop extract
|
||||
const loot = this.lootGenerator.createRandomLoot(this.traderConfig.fence.coopExtractGift);
|
||||
const mailableLoot: Item[] = [];
|
||||
|
||||
const parentId = this.hashUtil.generate();
|
||||
for (const item of loot)
|
||||
{
|
||||
mailableLoot.push(
|
||||
{
|
||||
_id: item.id,
|
||||
_tpl: item.tpl,
|
||||
slotId: "main",
|
||||
parentId: parentId,
|
||||
upd: {
|
||||
StackObjectsCount: item.stackCount
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Send message from fence giving player reward generated above
|
||||
this.mailSendService.sendLocalisedNpcMessageToPlayer(
|
||||
sessionId,
|
||||
this.traderHelper.getTraderById(Traders.FENCE),
|
||||
MessageType.MESSAGE_WITH_ITEMS,
|
||||
this.randomUtil.getArrayValue(this.traderConfig.fence.coopExtractGift.messageLocaleIds),
|
||||
mailableLoot,
|
||||
this.timeUtil.getHoursAsSeconds(this.traderConfig.fence.coopExtractGift.giftExpiryHours)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,6 +10,8 @@ export interface IInRaidConfig extends IBaseConfig
|
||||
save: Save
|
||||
/** Names of car extracts */
|
||||
carExtracts: string[]
|
||||
/** Names of coop extracts */
|
||||
coopExtracts: string[]
|
||||
/** Fene rep gain from a single car extract */
|
||||
carExtractBaseStandingGain: number
|
||||
/** Fence rep gain when successfully extracting as pscav */
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { MinMax } from "../../../models/common/MinMax";
|
||||
import { LootRequest } from "../services/LootRequest";
|
||||
import { IBaseConfig } from "./IBaseConfig";
|
||||
|
||||
export interface ITraderConfig extends IBaseConfig
|
||||
@ -40,7 +41,15 @@ export interface FenceConfig
|
||||
presetSlotsToRemoveChancePercent: Record<string, number>
|
||||
/** Block seasonal items from appearing when season is inactive */
|
||||
blacklistSeasonalItems: boolean;
|
||||
blacklist: string[]
|
||||
blacklist: string[],
|
||||
coopExtractGift: CoopExtractReward
|
||||
}
|
||||
|
||||
export interface CoopExtractReward extends LootRequest
|
||||
{
|
||||
sendGift: boolean
|
||||
messageLocaleIds: string[]
|
||||
giftExpiryHours: number
|
||||
}
|
||||
|
||||
export interface DiscountOptions
|
||||
|
Loading…
x
Reference in New Issue
Block a user