mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:30:45 -05:00
Merge branch '310-dev' of https://dev.sp-tarkov.com/SPT/Server into 310-dev
This commit is contained in:
commit
264a8a06bd
@ -106,7 +106,7 @@
|
||||
}
|
||||
},
|
||||
"BTRServerSettings": {
|
||||
"ChanceSpawn": 70,
|
||||
"ChanceSpawn": 100,
|
||||
"SpawnPeriod": {
|
||||
"x": 300,
|
||||
"y": 600,
|
||||
@ -131,7 +131,7 @@
|
||||
"ServerMapBTRSettings": {
|
||||
"Develop": {
|
||||
"MapID": "develop",
|
||||
"ChanceSpawn": 70,
|
||||
"ChanceSpawn": 100,
|
||||
"SpawnPeriod": {
|
||||
"x": 300,
|
||||
"y": 600,
|
||||
@ -156,10 +156,10 @@
|
||||
},
|
||||
"TarkovStreets": {
|
||||
"MapID": "TarkovStreets",
|
||||
"ChanceSpawn": 70,
|
||||
"ChanceSpawn": 100,
|
||||
"SpawnPeriod": {
|
||||
"x": 300,
|
||||
"y": 600,
|
||||
"x": 0,
|
||||
"y": 10,
|
||||
"z": 0
|
||||
},
|
||||
"MoveSpeed": 8,
|
||||
@ -181,10 +181,10 @@
|
||||
},
|
||||
"Woods": {
|
||||
"MapID": "Woods",
|
||||
"ChanceSpawn": 70,
|
||||
"ChanceSpawn": 100,
|
||||
"SpawnPeriod": {
|
||||
"x": 180,
|
||||
"y": 360,
|
||||
"x": 0,
|
||||
"y": 10,
|
||||
"z": 0
|
||||
},
|
||||
"MoveSpeed": 8,
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,6 @@ import { inject, injectable } from "tsyringe";
|
||||
import { InraidController } from "@spt/controllers/InraidController";
|
||||
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
||||
import { IItemDeliveryRequestData } from "@spt/models/eft/inRaid/IItemDeliveryRequestData";
|
||||
import { IRegisterPlayerRequestData } from "@spt/models/eft/inRaid/IRegisterPlayerRequestData";
|
||||
import { ISaveProgressRequestData } from "@spt/models/eft/inRaid/ISaveProgressRequestData";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
@ -93,15 +92,6 @@ export class InraidCallbacks
|
||||
return this.httpResponse.noBody(this.inraidController.getTraderServices(sessionId, traderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle singleplayer/traderServices/itemDelivery
|
||||
*/
|
||||
public itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData
|
||||
{
|
||||
this.inraidController.itemDelivery(sessionId, request.traderId, request.items);
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
public getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string
|
||||
{
|
||||
return this.httpResponse.noBody(this.inraidController.getTraitorScavHostileChance(url, sessionId));
|
||||
@ -111,4 +101,9 @@ export class InraidCallbacks
|
||||
{
|
||||
return this.httpResponse.noBody(this.inraidController.getSandboxMaxPatrolValue(url, sessionId));
|
||||
}
|
||||
|
||||
public getBossConvertSettings(url: string, info: IEmptyRequestData, sessionId: string): string
|
||||
{
|
||||
return this.httpResponse.noBody(this.inraidController.getBossConvertSettings(url, sessionId));
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,11 @@ export class MatchCallbacks
|
||||
}
|
||||
|
||||
/** Handle client/match/offline/end */
|
||||
public endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData
|
||||
public endOfflineRaid(
|
||||
url: string,
|
||||
info: IEndOfflineRaidRequestData,
|
||||
sessionID: string,
|
||||
): INullResponseData
|
||||
{
|
||||
this.matchController.endOfflineRaid(info, sessionID);
|
||||
return this.httpResponse.nullResponse();
|
||||
|
@ -11,17 +11,16 @@ import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||
import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
|
||||
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||
import { BodyPartHealth } from "@spt/models/eft/common/tables/IBotBase";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
import { IRegisterPlayerRequestData } from "@spt/models/eft/inRaid/IRegisterPlayerRequestData";
|
||||
import { ISaveProgressRequestData } from "@spt/models/eft/inRaid/ISaveProgressRequestData";
|
||||
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||
import { ItemTpl } from "@spt/models/enums/ItemTpl";
|
||||
import { MessageType } from "@spt/models/enums/MessageType";
|
||||
import { PlayerRaidEndState } from "@spt/models/enums/PlayerRaidEndState";
|
||||
import { QuestStatus } from "@spt/models/enums/QuestStatus";
|
||||
import { SkillTypes } from "@spt/models/enums/SkillTypes";
|
||||
import { Traders } from "@spt/models/enums/Traders";
|
||||
import { IAirdropConfig } from "@spt/models/spt/config/IAirdropConfig";
|
||||
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||
import { IBTRConfig } from "@spt/models/spt/config/IBTRConfig";
|
||||
import { IHideoutConfig } from "@spt/models/spt/config/IHideoutConfig";
|
||||
import { IInRaidConfig } from "@spt/models/spt/config/IInRaidConfig";
|
||||
@ -55,6 +54,7 @@ export class InraidController
|
||||
protected locationConfig: ILocationConfig;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected hideoutConfig: IHideoutConfig;
|
||||
protected botConfig: IBotConfig;
|
||||
|
||||
constructor(
|
||||
@inject("PrimaryLogger") protected logger: ILogger,
|
||||
@ -86,6 +86,7 @@ export class InraidController
|
||||
this.locationConfig = this.configServer.getConfig(ConfigTypes.LOCATION);
|
||||
this.ragfairConfig = this.configServer.getConfig(ConfigTypes.RAGFAIR);
|
||||
this.hideoutConfig = this.configServer.getConfig(ConfigTypes.HIDEOUT);
|
||||
this.botConfig = this.configServer.getConfig(ConfigTypes.BOT);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -659,40 +660,6 @@ export class InraidController
|
||||
return this.traderServicesService.getTraderServices(sessionId, traderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle singleplayer/traderServices/itemDelivery
|
||||
*/
|
||||
public itemDelivery(sessionId: string, traderId: string, items: Item[]): void
|
||||
{
|
||||
const serverProfile = this.saveServer.getProfile(sessionId);
|
||||
const pmcData = serverProfile.characters.pmc;
|
||||
|
||||
const dialogueTemplates = this.databaseService.getTrader(traderId).dialogue;
|
||||
if (!dialogueTemplates)
|
||||
{
|
||||
this.logger.error(this.localisationService.getText("inraid-unable_to_deliver_item_no_trader_found", traderId));
|
||||
|
||||
return;
|
||||
}
|
||||
const messageId = this.randomUtil.getArrayValue(dialogueTemplates.itemsDelivered);
|
||||
const messageStoreTime = this.timeUtil.getHoursAsSeconds(this.traderConfig.fence.btrDeliveryExpireHours);
|
||||
|
||||
// Remove any items that were returned by the item delivery, but also insured, from the player's insurance list
|
||||
// This is to stop items being duplicated by being returned from both the item delivery, and insurance
|
||||
const deliveredItemIds = items.map((x) => x._id);
|
||||
pmcData.InsuredItems = pmcData.InsuredItems.filter((x) => !deliveredItemIds.includes(x.itemId));
|
||||
|
||||
// Send the items to the player
|
||||
this.mailSendService.sendLocalisedNpcMessageToPlayer(
|
||||
sessionId,
|
||||
this.traderHelper.getTraderById(traderId),
|
||||
MessageType.BTR_ITEMS_DELIVERY,
|
||||
messageId,
|
||||
items,
|
||||
messageStoreTime,
|
||||
);
|
||||
}
|
||||
|
||||
public getTraitorScavHostileChance(url: string, sessionID: string): number
|
||||
{
|
||||
return this.inRaidConfig.playerScavHostileChancePercent;
|
||||
@ -702,4 +669,9 @@ export class InraidController
|
||||
{
|
||||
return this.locationConfig.sandboxMaxPatrolvalue;
|
||||
}
|
||||
|
||||
public getBossConvertSettings(url: string, sessionId: string): string[]
|
||||
{
|
||||
return Object.keys(this.botConfig.assaultToBossConversion.bossesToConvertToWeights);
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { BotGenerationCacheService } from "@spt/services/BotGenerationCacheService";
|
||||
import { BotLootCacheService } from "@spt/services/BotLootCacheService";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MailSendService } from "@spt/services/MailSendService";
|
||||
import { MatchBotDetailsCacheService } from "@spt/services/MatchBotDetailsCacheService";
|
||||
import { MatchLocationService } from "@spt/services/MatchLocationService";
|
||||
@ -71,6 +72,7 @@ export class MatchController
|
||||
@inject("PmcChatResponseService") protected pmcChatResponseService: PmcChatResponseService,
|
||||
@inject("TraderHelper") protected traderHelper: TraderHelper,
|
||||
@inject("BotLootCacheService") protected botLootCacheService: BotLootCacheService,
|
||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
@inject("ProfileSnapshotService") protected profileSnapshotService: ProfileSnapshotService,
|
||||
@inject("BotGenerationCacheService") protected botGenerationCacheService: BotGenerationCacheService,
|
||||
@ -472,6 +474,50 @@ export class MatchController
|
||||
// Player killed PMCs, send some responses to them
|
||||
this.pmcChatResponseService.sendVictimResponse(sessionId, victims, pmcProfile);
|
||||
}
|
||||
|
||||
// Handle items transferred via BTR to player
|
||||
const btrKey = "BTRTransferStash";
|
||||
const btrContainerAndItems = request.transferItems[btrKey] ?? [];
|
||||
if (btrContainerAndItems.length > 0)
|
||||
{
|
||||
const itemsToSend = btrContainerAndItems.filter((item) => item._id !== btrKey);
|
||||
this.btrItemDelivery(sessionId, Traders.BTR, itemsToSend);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle singleplayer/traderServices/itemDelivery
|
||||
*/
|
||||
protected btrItemDelivery(sessionId: string, traderId: string, items: Item[]): void
|
||||
{
|
||||
const serverProfile = this.saveServer.getProfile(sessionId);
|
||||
const pmcData = serverProfile.characters.pmc;
|
||||
|
||||
const dialogueTemplates = this.databaseService.getTrader(traderId).dialogue;
|
||||
if (!dialogueTemplates)
|
||||
{
|
||||
this.logger.error(this.localisationService.getText("inraid-unable_to_deliver_item_no_trader_found", traderId));
|
||||
|
||||
return;
|
||||
}
|
||||
const messageId = this.randomUtil.getArrayValue(dialogueTemplates.itemsDelivered);
|
||||
const messageStoreTime = this.timeUtil.getHoursAsSeconds(this.traderConfig.fence.btrDeliveryExpireHours);
|
||||
|
||||
// Remove any items that were returned by the item delivery, but also insured, from the player's insurance list
|
||||
// This is to stop items being duplicated by being returned from both item delivery and insurance
|
||||
const deliveredItemIds = items.map((item) => item._id);
|
||||
pmcData.InsuredItems = pmcData.InsuredItems
|
||||
.filter((insuredItem) => !deliveredItemIds.includes(insuredItem.itemId));
|
||||
|
||||
// Send the items to the player
|
||||
this.mailSendService.sendLocalisedNpcMessageToPlayer(
|
||||
sessionId,
|
||||
this.traderHelper.getTraderById(traderId),
|
||||
MessageType.BTR_ITEMS_DELIVERY,
|
||||
messageId,
|
||||
items,
|
||||
messageStoreTime,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,9 +4,12 @@ import { Item } from "../common/tables/IItem";
|
||||
|
||||
export interface IEndLocalRaidRequestData
|
||||
{
|
||||
/** ID of server player just left */
|
||||
serverId: string
|
||||
results: IEndRaidResult
|
||||
/** Insured items left in raid by player */
|
||||
lostInsuredItems: Item[]
|
||||
/** Items sent via traders to player, keyed to service e.g. BTRTransferStash */
|
||||
transferItems: Record<string, Item[]>
|
||||
}
|
||||
|
||||
|
@ -44,13 +44,6 @@ export class InraidStaticRouter extends StaticRouter
|
||||
return this.inraidCallbacks.getBTRConfig();
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/traderServices/itemDelivery",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
||||
{
|
||||
return this.inraidCallbacks.itemDelivery(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/scav/traitorscavhostile",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
@ -65,6 +58,13 @@ export class InraidStaticRouter extends StaticRouter
|
||||
return this.inraidCallbacks.getSandboxMaxPatrolValue(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
new RouteAction(
|
||||
"/singleplayer/BossConvert",
|
||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
||||
{
|
||||
return this.inraidCallbacks.getBossConvertSettings(url, info, sessionID);
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -111,13 +111,13 @@ export class DatabaseService
|
||||
|
||||
/**
|
||||
* Get specific location by its Id
|
||||
* @param locationId Desired trader id
|
||||
* @param locationId Desired location id
|
||||
* @returns assets/database/locations/
|
||||
*/
|
||||
public getLocation(locationId: string): ILocation
|
||||
{
|
||||
const locations = this.getLocations();
|
||||
const desiredLocation = locations[locationId];
|
||||
const desiredLocation = locations[locationId.toLowerCase()];
|
||||
if (!desiredLocation)
|
||||
{
|
||||
throw new Error(this.localisationService.getText("database-no_location_found_with_id", locationId));
|
||||
|
Loading…
x
Reference in New Issue
Block a user