Add support for flea market dogtag barter requirements (!378)

Trader offers with dogtag barter requirements are currently missing the `level` and `side` properties necessary to qualify them. This data already exists in the assorts, just needed to be sent along with the offer.

I considered updating the `side` property of `Requirement` in `IAddOfferRequestData.ts`, but that field is never used, and the client appears to pass 0 for both (even though 0 is not a valid `side`).

Not sure if this should be going to `master` or `310-dev`?

Reviewed-on: https://dev.sp-tarkov.com/SPT/Server/pulls/378
Co-authored-by: Tyfon <tyfon7@outlook.com>
Co-committed-by: Tyfon <tyfon7@outlook.com>
This commit is contained in:
Tyfon 2024-07-20 21:45:42 +00:00 committed by chomp
parent d0d10ac15c
commit ec76a8897f
4 changed files with 29 additions and 5 deletions

View File

@ -115,11 +115,23 @@ export class RagfairOfferGenerator
{ {
const isTrader = this.ragfairServerHelper.isTrader(userID); const isTrader = this.ragfairServerHelper.isTrader(userID);
const offerRequirements = barterScheme.map((barter) => ({ const offerRequirements = barterScheme.map((barter) =>
_tpl: barter._tpl, {
count: +barter.count.toFixed(2), const offerRequirement: OfferRequirement = {
onlyFunctional: barter.onlyFunctional ?? false, _tpl: barter._tpl,
} as OfferRequirement)); count: +barter.count.toFixed(2),
onlyFunctional: barter.onlyFunctional ?? false,
};
// Dogtags define level and side
if (barter.level !== undefined)
{
offerRequirement.level = barter.level;
offerRequirement.side = barter.side;
}
return offerRequirement;
});
// Clone to avoid modifying original array // Clone to avoid modifying original array
const itemsClone = this.cloner.clone(items); const itemsClone = this.cloner.clone(items);

View File

@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import { Item } from "@spt/models/eft/common/tables/IItem"; import { Item } from "@spt/models/eft/common/tables/IItem";
import { DogtagExchangeSide } from "@spt/models/enums/DogtagExchangeSide";
import { ITraderServiceModel } from "@spt/models/spt/services/ITraderServiceModel"; import { ITraderServiceModel } from "@spt/models/spt/services/ITraderServiceModel";
export interface ITrader export interface ITrader
@ -95,6 +96,8 @@ export interface IBarterScheme
_tpl: string _tpl: string
onlyFunctional?: boolean onlyFunctional?: boolean
sptQuestLocked?: boolean sptQuestLocked?: boolean
level?: number
side?: DogtagExchangeSide
} }
export interface ISuit export interface ISuit

View File

@ -1,4 +1,5 @@
import { Item } from "@spt/models/eft/common/tables/IItem"; import { Item } from "@spt/models/eft/common/tables/IItem";
import { DogtagExchangeSide } from "@spt/models/enums/DogtagExchangeSide";
import { MemberCategory } from "@spt/models/enums/MemberCategory"; import { MemberCategory } from "@spt/models/enums/MemberCategory";
export interface IRagfairOffer export interface IRagfairOffer
@ -33,6 +34,8 @@ export interface OfferRequirement
_tpl: string _tpl: string
count: number count: number
onlyFunctional: boolean onlyFunctional: boolean
level?: number
side?: DogtagExchangeSide
} }
export interface IRagfairOfferUser export interface IRagfairOfferUser

View File

@ -0,0 +1,6 @@
export enum DogtagExchangeSide
{
USEC = "Usec",
BEAR = "Bear",
ANY = "Any",
}