Added getOfferType() to ragfairController

(cherry picked from commit e67f000602)
This commit is contained in:
Dev 2024-07-14 19:21:11 +01:00
parent 35daf8710f
commit 0629958b92
2 changed files with 28 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferReq
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
import { MemberCategory } from "@spt/models/enums/MemberCategory";
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
import { ILogger } from "@spt/models/spt/utils/ILogger";
@ -422,6 +423,8 @@ export class RagfairController
return this.httpResponse.appendErrorToOutput(output, validationMessage);
}
const typeOfOffer = this.getOfferType(offerRequest);
// Find items to be listed on flea from player inventory
const { items: itemsInInventoryToList, errorMessage: itemsInInventoryError }
= this.getItemsToListOnFleaFromInventory(pmcData, offerRequest.items);
@ -508,6 +511,24 @@ export class RagfairController
return output;
}
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType
{
if (offerRequest.items.length == 1 && !offerRequest.sellInOnePiece)
{
return FleaOfferType.SINGLE;
}
else if (offerRequest.items.length > 1 && !offerRequest.sellInOnePiece)
{
return FleaOfferType.MULTI;
}
else if (offerRequest.sellInOnePiece)
{
return FleaOfferType.PACK;
}
return FleaOfferType.UNKNOWN;
}
/**
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
* @param sessionID Player id

View File

@ -0,0 +1,7 @@
export enum FleaOfferType
{
SINGLE,
MULTI,
PACK,
UNKNOWN,
}