Skip to content

Commit

Permalink
Update for 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
seionmoya committed Nov 3, 2024
1 parent 65450e3 commit 69f8ae1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
5 changes: 3 additions & 2 deletions db/base.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"_id": "kokohekmatyar",
"_id": "6726dc8a2b56196f01000000",
"working": true,
"availableInRaid": false,
"items_buy": {
Expand Down Expand Up @@ -43,7 +43,8 @@
"excluded_category": []
},
"gridHeight": 150,
"loyaltyLevels": [{
"loyaltyLevels": [
{
"minLevel": 1,
"minSalesSum": 0,
"minStanding": 0,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "kokohekmatyar",
"version": "1.6.0",
"version": "1.7.0",
"main": "src/mod.js",
"license": "MIT",
"author": "seionmoya",
"sptVersion": "~3.9",
"sptVersion": "~3.10",
"scripts": {
"build": "node ./build.mjs",
"lint": "eslint ./src/**/* --ext .ts"
Expand Down
11 changes: 3 additions & 8 deletions src/KokoHekmatyar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class KokoHekmatyar
this.logger.debug(`[${this.modAuthor}-${this.modName}] postDb Loading...`);

this.traderGenerator.addTraderToRagfair(this.baseTrader._id, true);
this.traderGenerator.setTraderImage(this.baseTrader._id, path.join(`${this.modPath}res/kokohekmatyar.png`));
this.traderGenerator.setTraderImage(this.baseTrader, path.join(`${this.modPath}/res/kokohekmatyar.png`));

this.traderGenerator.setInsuranceConfig(this.baseTrader._id, {});
this.traderGenerator.setTraderConfig(this.baseTrader._id, 3600);
Expand All @@ -54,12 +54,7 @@ export class KokoHekmatyar
barter_scheme: {},
loyal_level_items: {}
},
base: this.baseTrader,
questassort: {
started: {},
success: {},
fail: {}
}
base: this.baseTrader
});
this.traderGenerator.setTraderLocales(this.baseTrader._id, {
FullName: "Koko Hekmatyar",
Expand All @@ -70,7 +65,7 @@ export class KokoHekmatyar
});

// generate assort
this.assortGenerator.generate("kokohekmatyar");
this.assortGenerator.generate(this.baseTrader._id);

this.logger.debug(`[${this.modAuthor}-${this.modName}] postDb Loaded`);
}
Expand Down
7 changes: 5 additions & 2 deletions src/utils/TraderGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { ImageRouter } from "@spt/routers/ImageRouter";
import { ITrader } from "@spt/models/eft/common/tables/ITrader";
import { ITraderBase } from "@spt/models/eft/common/tables/ITrader";
import { Traders } from "@spt/models/enums/Traders";

interface ILocales {
FullName: string;
Expand All @@ -32,9 +34,9 @@ export class KokoTraderGenerator {
ragfairConfig.traders[traderId] = ragfair;
}

public setTraderImage(traderId: string, imagePath: string)
public setTraderImage(base: ITraderBase, imagePath: string)
{
this.imageRouter.addRoute(`/files/trader/avatar/${traderId}`, imagePath);
this.imageRouter.addRoute(base.avatar.replace(".png", ""), imagePath);
}

public setInsuranceConfig(traderId: string, insurance: { insuranceMultiplier?: number, returnChancePercent?: number })
Expand All @@ -61,6 +63,7 @@ export class KokoTraderGenerator {
const database = this.databaseServer.getTables();

database.traders[traderId] = traderProps;
Traders[traderId] = traderId;
}

public setTraderLocales(traderId: string, newLocale: ILocales)
Expand Down

0 comments on commit 69f8ae1

Please sign in to comment.