Update add trader mod

This commit is contained in:
Dev 2024-03-17 15:42:46 +00:00
parent 9ea2655ad0
commit d4fc5a2903
2 changed files with 8 additions and 4 deletions

View File

@ -54,7 +54,7 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod
this.traderHelper = new TraderHelper();
this.fluentTraderAssortHeper = new FluentAssortConstructor(hashUtil, this.logger);
this.traderHelper.registerProfileImage(baseJson, this.mod, preAkiModLoader, imageRouter, "cat.jpg");
this.traderHelper.setTraderUpdateTime(traderConfig, baseJson, 3600);
this.traderHelper.setTraderUpdateTime(traderConfig, baseJson, 3600, 4000);
// Add trader to trader enum
Traders[baseJson._id] = baseJson._id;

View File

@ -28,14 +28,18 @@ export class TraderHelper
* Add record to trader config to set the refresh time of trader in seconds (default is 60 minutes)
* @param traderConfig trader config to add our trader to
* @param baseJson json file for trader (db/base.json)
* @param refreshTimeSeconds How many sections between trader stock refresh
* @param refreshTimeSecondsMin How many seconds between trader stock refresh min time
* @param refreshTimeSecondsMax How many seconds between trader stock refresh max time
*/
public setTraderUpdateTime(traderConfig: ITraderConfig, baseJson: any, refreshTimeSeconds: number): void
public setTraderUpdateTime(traderConfig: ITraderConfig, baseJson: any, refreshTimeSecondsMin: number, refreshTimeSecondsMax: number): void
{
// Add refresh time in seconds to config
const traderRefreshRecord: UpdateTime = {
traderId: baseJson._id,
seconds: refreshTimeSeconds };
seconds: {
min: refreshTimeSecondsMin,
max: refreshTimeSecondsMax
} };
traderConfig.updateTime.push(traderRefreshRecord);
}