Update trader refresh times to use a min and max value
This commit is contained in:
parent
be64e897b9
commit
95f5a49c5c
@ -3,51 +3,81 @@
|
|||||||
{
|
{
|
||||||
"_name": "prapor",
|
"_name": "prapor",
|
||||||
"traderId": "54cb50c76803fa8b248b4571",
|
"traderId": "54cb50c76803fa8b248b4571",
|
||||||
"seconds": 11100
|
"seconds": {
|
||||||
|
"min": 7000,
|
||||||
|
"max": 13500
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_name": "therapist",
|
"_name": "therapist",
|
||||||
"traderId": "54cb57776803fa99248b456e",
|
"traderId": "54cb57776803fa99248b456e",
|
||||||
"seconds": 8040
|
"seconds": {
|
||||||
|
"min": 3000,
|
||||||
|
"max": 9500
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_name": "fence",
|
"_name": "fence",
|
||||||
"traderId": "579dc571d53a0658a154fbec",
|
"traderId": "579dc571d53a0658a154fbec",
|
||||||
"seconds": 5220
|
"seconds": {
|
||||||
|
"min": 3000,
|
||||||
|
"max": 9000
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_name": "skier",
|
"_name": "skier",
|
||||||
"traderId": "58330581ace78e27b8b10cee",
|
"traderId": "58330581ace78e27b8b10cee",
|
||||||
"seconds": 6240
|
"seconds": {
|
||||||
|
"min": 5000,
|
||||||
|
"max": 8500
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_name": "peacekeeper",
|
"_name": "peacekeeper",
|
||||||
"traderId": "5935c25fb3acc3127c3d8cd9",
|
"traderId": "5935c25fb3acc3127c3d8cd9",
|
||||||
"seconds": 8580
|
"seconds": {
|
||||||
|
"min": 2000,
|
||||||
|
"max": 14000
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_name": "mechanic",
|
"_name": "mechanic",
|
||||||
"traderId": "5a7c2eca46aef81a7ca2145d",
|
"traderId": "5a7c2eca46aef81a7ca2145d",
|
||||||
"seconds": 8160
|
"seconds": {
|
||||||
|
"min": 7000,
|
||||||
|
"max": 13500
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_name": "ragman",
|
"_name": "ragman",
|
||||||
"traderId": "5ac3b934156ae10c4430e83c",
|
"traderId": "5ac3b934156ae10c4430e83c",
|
||||||
"seconds": 8220
|
"seconds": {
|
||||||
|
"min": 6500,
|
||||||
|
"max": 15000
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_name": "jaeger",
|
"_name": "jaeger",
|
||||||
"traderId": "5c0647fdd443bc2504c2d371",
|
"traderId": "5c0647fdd443bc2504c2d371",
|
||||||
"seconds": 5100
|
"seconds": {
|
||||||
|
"min": 2000,
|
||||||
|
"max": 5500
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_name": "btr",
|
"_name": "btr",
|
||||||
"traderId": "656f0f98d80a697f855d34b1",
|
"traderId": "656f0f98d80a697f855d34b1",
|
||||||
"seconds": 3600
|
"seconds": {
|
||||||
|
"min": 3000,
|
||||||
|
"max": 7500
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"traderId": "ragfair",
|
"traderId": "ragfair",
|
||||||
"seconds": 3600
|
"seconds": {
|
||||||
|
"min": 3600,
|
||||||
|
"max": 3600
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"updateTimeDefault": 3600,
|
"updateTimeDefault": 3600,
|
||||||
|
@ -275,12 +275,15 @@ export class TraderHelper
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.traderConfig.updateTime.push( // create temporary entry to prevent logger spam
|
this.traderConfig.updateTime.push( // create temporary entry to prevent logger spam
|
||||||
{ traderId: traderId, seconds: this.traderConfig.updateTimeDefault },
|
{
|
||||||
|
traderId: traderId,
|
||||||
|
seconds: { min: this.traderConfig.updateTimeDefault, max: this.traderConfig.updateTimeDefault },
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return traderDetails.seconds;
|
return this.randomUtil.getInt(traderDetails.seconds.min, traderDetails.seconds.max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ export interface UpdateTime
|
|||||||
{
|
{
|
||||||
traderId: string;
|
traderId: string;
|
||||||
/** Seconds between trader resets */
|
/** Seconds between trader resets */
|
||||||
seconds: number;
|
seconds: MinMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FenceConfig
|
export interface FenceConfig
|
||||||
|
@ -1262,7 +1262,9 @@ export class FenceService
|
|||||||
*/
|
*/
|
||||||
protected getFenceRefreshTime(): number
|
protected getFenceRefreshTime(): number
|
||||||
{
|
{
|
||||||
return this.traderConfig.updateTime.find((x) => x.traderId === Traders.FENCE).seconds;
|
const fence = this.traderConfig.updateTime.find((x) => x.traderId === Traders.FENCE).seconds;
|
||||||
|
|
||||||
|
return this.randomUtil.getInt(fence.min, fence.max);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,6 +7,7 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
|
|||||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
||||||
import { LocalisationService } from "@spt-aki/services/LocalisationService";
|
import { LocalisationService } from "@spt-aki/services/LocalisationService";
|
||||||
|
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
|
||||||
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
|
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,6 +21,7 @@ export class TraderPurchasePersisterService
|
|||||||
constructor(
|
constructor(
|
||||||
@inject("WinstonLogger") protected logger: ILogger,
|
@inject("WinstonLogger") protected logger: ILogger,
|
||||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||||
|
@inject("RandomUtil") protected randomUtil: RandomUtil,
|
||||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||||
@ -134,7 +136,8 @@ export class TraderPurchasePersisterService
|
|||||||
}
|
}
|
||||||
|
|
||||||
const purchaseDetails = profile.traderPurchases[traderId][purchaseKey];
|
const purchaseDetails = profile.traderPurchases[traderId][purchaseKey];
|
||||||
const resetTimeForItem = purchaseDetails.purchaseTimestamp + traderUpdateDetails.seconds;
|
const resetTimeForItem = purchaseDetails.purchaseTimestamp
|
||||||
|
+ this.randomUtil.getInt(traderUpdateDetails.seconds.min, traderUpdateDetails.seconds.max);
|
||||||
if (resetTimeForItem < this.timeUtil.getTimestamp())
|
if (resetTimeForItem < this.timeUtil.getTimestamp())
|
||||||
{
|
{
|
||||||
// Item was purchased far enough in past a trader refresh would have occured, remove purchase record from profile
|
// Item was purchased far enough in past a trader refresh would have occured, remove purchase record from profile
|
||||||
|
Loading…
Reference in New Issue
Block a user