Skip to content

Commit

Permalink
Moved deprioritisedContainers data into config as `deprioritisedMon…
Browse files Browse the repository at this point in the history
…eyContainers`
  • Loading branch information
Chomp committed Dec 22, 2024
1 parent 572144c commit 8637380
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion project/assets/configs/inventory.json
Original file line number Diff line number Diff line change
Expand Up @@ -1595,5 +1595,6 @@
"customMoneyTpls": [],
"skillGainMultiplers": {
"Strength": 1
}
},
"deprioritisedMoneyContainers": ["590c60fc86f77412b13fddcf", "5d235bb686f77443f4331278"]
}
2 changes: 2 additions & 0 deletions project/src/models/spt/config/IInventoryConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export interface IInventoryConfig extends IBaseConfig {
customMoneyTpls: string[];
/** Multipliers for skill gain when inside menus, NOT in-game */
skillGainMultiplers: Record<string, number>;
/** Container Tpls that shoud be deprioritised when choosing where to take money from for payments */
deprioritisedMoneyContainers: string[];
}

export interface IRewardDetails {
Expand Down
12 changes: 10 additions & 2 deletions project/src/services/PaymentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRo
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
import { IProcessSellTradeRequestData } from "@spt/models/eft/trade/IProcessSellTradeRequestData";
import { BackendErrorCodes } from "@spt/models/enums/BackendErrorCodes";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IInventoryConfig } from "@spt/models/spt/config/IInventoryConfig";
import { ILogger } from "@spt/models/spt/utils/ILogger";
import { ConfigServer } from "@spt/servers/ConfigServer";
import { DatabaseService } from "@spt/services/DatabaseService";
import { LocalisationService } from "@spt/services/LocalisationService";
import { HashUtil } from "@spt/utils/HashUtil";
Expand All @@ -19,6 +22,8 @@ import { inject, injectable } from "tsyringe";

@injectable()
export class PaymentService {
protected inventoryConfig: IInventoryConfig;

constructor(
@inject("PrimaryLogger") protected logger: ILogger,
@inject("HashUtil") protected hashUtil: HashUtil,
Expand All @@ -30,7 +35,10 @@ export class PaymentService {
@inject("InventoryHelper") protected inventoryHelper: InventoryHelper,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("PaymentHelper") protected paymentHelper: PaymentHelper,
) {}
@inject("ConfigServer") protected configServer: ConfigServer,
) {
this.inventoryConfig = this.configServer.getConfig(ConfigTypes.INVENTORY);
}

/**
* Take money and insert items into return to server request
Expand Down Expand Up @@ -369,7 +377,7 @@ export class PaymentService {
// Both in stash in containers
if (aInStash && bInStash) {
// Containers where taking money from would inconvinence player
const deprioritisedContainers = ["590c60fc86f77412b13fddcf", "5d235bb686f77443f4331278"];
const deprioritisedContainers = this.inventoryConfig.deprioritisedMoneyContainers;
const aImmediateParent = inventoryItems.find((item) => item._id === a.parentId);
const bImmediateParent = inventoryItems.find((item) => item._id === b.parentId);

Expand Down

0 comments on commit 8637380

Please sign in to comment.