Updated Profiles Again & Added Server-Side Dynamic Maps

This commit is contained in:
Kyle 2025-05-16 01:43:49 -04:00
parent 3a4d6de70c
commit 31d7301bfb
8 changed files with 393 additions and 15 deletions

View File

@ -0,0 +1,28 @@
[General]
gameName=spt
modid=0
version=d2025.5.14.0
newestVersion=
category="-1,"
nexusFileStatus=1
installationFile=DynamicMaps-0.5.7-ba475092.zip
repository=
ignoredVersion=
comments=
notes=
nexusDescription=
url=
hasCustomURL=false
lastNexusQuery=
lastNexusUpdate=
nexusLastModified=2025-05-16T05:41:38Z
nexusCategory=0
converted=false
validated=false
color=@Variant(\0\0\0\x43\0\xff\xff\0\0\0\0\0\0\0\0)
tracked=0
[installedFiles]
1\modid=0
1\fileid=0
size=1

View File

@ -0,0 +1,20 @@
/.buildignore
/.DS_Store
/.editorconfig
/.eslintignore
/.eslintrc.json
/.git
/.github
/.gitignore
/.gitlab
/.nvmrc
/.prettierrc
/.vscode
/build.mjs
/dist
/images
/mod.code-workspace
/node_modules
/package-lock.json
/tsconfig.json
/types

View File

@ -0,0 +1,37 @@
{
"name": "SPT-DynamicMaps",
"version": "0.5.7",
"sptVersion": "~3.11",
"loadBefore": [],
"loadAfter": [],
"incompatibilities": [],
"isBundleMod": false,
"main": "src/mod.js",
"scripts": {
"setup": "npm i",
"build": "node ./packageBuild.ts",
"buildinfo": "node ./packageBuild.ts --verbose"
},
"devDependencies": {
"@types/node": "20.11",
"@typescript-eslint/eslint-plugin": "7.2",
"@typescript-eslint/parser": "7.2",
"archiver": "^6.0",
"eslint": "8.57",
"fs-extra": "11.2",
"ignore": "^5.2",
"tsyringe": "4.8.0",
"typescript": "5.4",
"winston": "3.12",
"bestzip": "^2.2.1"
},
"author": "mpstark",
"contributors": [
"dirtbikercj",
"AcidPhantasm"
],
"license": "MIT",
"dependencies": {
}
}

View File

@ -0,0 +1,82 @@
import type { ILogger } from "@spt/models/spt/utils/ILogger";
import type { DatabaseServer } from "@spt/servers/DatabaseServer";
import type { IDatabaseTables } from "@spt/models/spt/server/IDatabaseTables";
import type { StaticRouterModService } from "@spt/services/mod/staticRouter/StaticRouterModService";
import type { DependencyContainer } from "tsyringe";
import type { CustomItemService } from "@spt/services/mod/CustomItemService";
import type { ImageRouter } from "@spt/routers/ImageRouter";
import type { PreSptModLoader } from "@spt/loaders/PreSptModLoader";
import type { ConfigServer } from "@spt/servers/ConfigServer";
import type { JsonUtil } from "@spt/utils/JsonUtil";
import type { ProfileHelper } from "@spt/helpers/ProfileHelper";
import type { RagfairPriceService } from "@spt/services/RagfairPriceService";
import type { ImporterUtil } from "@spt/utils/ImporterUtil";
import type { SaveServer } from "@spt/servers/SaveServer";
import type { ItemHelper } from "@spt/helpers/ItemHelper";
import type { MailSendService } from "@spt/services/MailSendService";
import type { HashUtil } from "@spt/utils/HashUtil";
import type { TraderHelper } from "@spt/helpers/TraderHelper";
import type { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
import type { FileSystemSync } from "@spt/utils/FileSystemSync";
export class InstanceManager
{
//#region Accessible in or after preAkiLoad
private alpha = false;
private version = "";
// Instances
public container: DependencyContainer;
public preSptModLoader: PreSptModLoader;
public configServer: ConfigServer;
public saveServer: SaveServer;
public itemHelper: ItemHelper;
public logger: ILogger;
public staticRouter: StaticRouterModService;
public fs: FileSystemSync;
public hashUtil: HashUtil;
public httpResponseUtil: HttpResponseUtil;
//#endregion
//#region Acceessible in or after postDBLoad
public database: IDatabaseTables;
public customItem: CustomItemService;
public imageRouter: ImageRouter;
public jsonUtil: JsonUtil;
public profileHelper: ProfileHelper;
public ragfairPriceService: RagfairPriceService;
public importerUtil: ImporterUtil;
public customItemService: CustomItemService;
public mailSendService: MailSendService;
public traderHelper: TraderHelper;
//#endregion
// Call at the start of the mods postDBLoad method
public preSptLoad(container: DependencyContainer): void
{
this.container = container;
this.preSptModLoader = container.resolve<PreSptModLoader>("PreSptModLoader");
this.imageRouter = container.resolve<ImageRouter>("ImageRouter");
this.configServer = container.resolve<ConfigServer>("ConfigServer");
this.saveServer = container.resolve<SaveServer>("SaveServer");
this.itemHelper = container.resolve<ItemHelper>("ItemHelper");
this.logger = container.resolve<ILogger>("WinstonLogger");
this.staticRouter = container.resolve<StaticRouterModService>("StaticRouterModService");
this.fs = container.resolve<FileSystemSync>("FileSystemSync");
this.hashUtil = container.resolve<HashUtil>("HashUtil");
this.httpResponseUtil = container.resolve<HttpResponseUtil>("HttpResponseUtil");
}
public postDBLoad(container: DependencyContainer): void
{
this.database = container.resolve<DatabaseServer>("DatabaseServer").getTables();
this.customItem = container.resolve<CustomItemService>("CustomItemService");
this.jsonUtil = container.resolve<JsonUtil>("JsonUtil");
this.profileHelper = container.resolve<ProfileHelper>("ProfileHelper");
this.ragfairPriceService = container.resolve<RagfairPriceService>("RagfairPriceService");
this.importerUtil = container.resolve<ImporterUtil>("ImporterUtil");
this.customItemService = container.resolve<CustomItemService>("CustomItemService");
this.mailSendService = container.resolve<MailSendService>("MailSendService");
this.traderHelper = container.resolve<TraderHelper>("TraderHelper");
}
}

View File

@ -0,0 +1,208 @@
import type { DependencyContainer } from "tsyringe";
import type { IPostDBLoadMod } from "@spt/models/external/IPostDBLoadMod";
import type { IPreSptLoadMod } from "@spt/models/external/IPreSptLoadMod";
import type { Item } from "@spt/models/eft/common/tables/IItem";
import type { IBarterScheme } from "@spt/models/eft/common/tables/ITrader";
import type { NewItemFromCloneDetails } from "@spt/models/spt/mod/NewItemDetails";
import { Traders } from "@spt/models/enums/Traders";
import { InstanceManager } from "./InstanceManager";
class DynamicMaps implements IPreSptLoadMod, IPostDBLoadMod
{
// eslint-disable-next-line @typescript-eslint/naming-convention
protected InstanceManager: InstanceManager = new InstanceManager();
public preSptLoad(container: DependencyContainer): void
{
this.InstanceManager.preSptLoad(container);
}
public postDBLoad(container: DependencyContainer): void
{
this.InstanceManager.postDBLoad(container);
this.createNewMaps();
}
private createNewMaps(): void
{
this.createGroundZeroMap();
this.createStreetsMap();
this.createReserveMap();
this.createLabsMap();
this.createLighthouseMap();
}
private createGroundZeroMap(): void
{
const gzMap: NewItemFromCloneDetails =
{
itemTplToClone: "5900b89686f7744e704a8747",
parentId: "567849dd4bdc2d150f8b456e",
newId: "6738033eb7305d3bdafe9518",
fleaPriceRoubles: 25000,
handbookPriceRoubles: 32500,
handbookParentId: "5b47574386f77428ca22b343",
overrideProperties: {
},
locales: {
en: {
name: "Ground Zero plan map",
shortName: "Ground Zero",
description: ""
}
}
}
const assortId = "6738076415fd9232e8dae982";
this.InstanceManager.customItemService.createItemFromClone(gzMap);
this.pushToTraderAssort(Traders.THERAPIST, gzMap.newId, gzMap.handbookPriceRoubles, assortId);
}
private createStreetsMap(): void
{
const streetsMap: NewItemFromCloneDetails =
{
itemTplToClone: "5900b89686f7744e704a8747",
parentId: "567849dd4bdc2d150f8b456e",
newId: "673803448cb3819668d77b1b",
fleaPriceRoubles: 25000,
handbookPriceRoubles: 32500,
handbookParentId: "5b47574386f77428ca22b343",
overrideProperties: {
},
locales: {
en: {
name: "Streets of Tarkov plan",
shortName: "Streets",
description: ""
}
}
}
const assortId = "67380769ebda082cf01c3fd7";
this.InstanceManager.customItemService.createItemFromClone(streetsMap);
this.pushToTraderAssort(Traders.THERAPIST, streetsMap.newId, streetsMap.handbookPriceRoubles, assortId);
}
private createReserveMap(): void
{
const reserveMap: NewItemFromCloneDetails =
{
itemTplToClone: "5900b89686f7744e704a8747",
parentId: "567849dd4bdc2d150f8b456e",
newId: "6738034a9713b5f42b4a8b78",
fleaPriceRoubles: 25000,
handbookPriceRoubles: 32500,
handbookParentId: "5b47574386f77428ca22b343",
overrideProperties: {
},
locales: {
en: {
name: "Reserve plan",
shortName: "Reserve",
description: ""
}
}
}
const assortId = "6738076e704fef20a1a580e6";
this.InstanceManager.customItemService.createItemFromClone(reserveMap);
this.pushToTraderAssort(Traders.THERAPIST, reserveMap.newId, reserveMap.handbookPriceRoubles, assortId);
}
private createLabsMap(): void
{
const labsMap: NewItemFromCloneDetails =
{
itemTplToClone: "5900b89686f7744e704a8747",
parentId: "567849dd4bdc2d150f8b456e",
newId: "6738034e9d22459ad7cd1b81",
fleaPriceRoubles: 25000,
handbookPriceRoubles: 32500,
handbookParentId: "5b47574386f77428ca22b343",
overrideProperties: {
},
locales: {
en: {
name: "Labs plan",
shortName: "Labs",
description: ""
}
}
}
const assortId = "673807742ef49729b9dd1b0a";
this.InstanceManager.customItemService.createItemFromClone(labsMap);
this.pushToTraderAssort(Traders.THERAPIST, labsMap.newId, labsMap.handbookPriceRoubles, assortId);
}
private createLighthouseMap(): void
{
const lighthouseMap: NewItemFromCloneDetails =
{
itemTplToClone: "5900b89686f7744e704a8747",
parentId: "567849dd4bdc2d150f8b456e",
newId: "6738035350b24a4ae4a57997",
fleaPriceRoubles: 25000,
handbookPriceRoubles: 32500,
handbookParentId: "5b47574386f77428ca22b343",
overrideProperties: {
},
locales: {
en: {
name: "Lighthouse plan",
shortName: "Lighthouse",
description: ""
}
}
}
const assortId = "6738077be5a03fda63c9917d";
this.InstanceManager.customItemService.createItemFromClone(lighthouseMap);
this.pushToTraderAssort(Traders.THERAPIST, lighthouseMap.newId, lighthouseMap.handbookPriceRoubles, assortId);
}
private pushToTraderAssort(traderId: Traders, itemId: string, price: number, assortId: string): void
{
const assort = this.InstanceManager.database.traders[traderId].assort;
const item: Item = {
_id: assortId,
_tpl: itemId,
parentId: "hideout",
slotId: "hideout",
upd: {
UnlimitedCount: false,
StackObjectsCount: 4,
BuyRestrictionMax: 10,
BuyRestrictionCurrent: 0
}
}
const scheme: IBarterScheme[][] = [
[
{
count: price,
_tpl: "5449016a4bdc2d6f028b456f"
}
]
];
assort.items.push(item);
assort.barter_scheme[assortId] = scheme;
assort.loyal_level_items[assortId] = 1;
}
}
export const mod = new DynamicMaps();

View File

@ -1,6 +1,6 @@
# This file was automatically generated by Mod Organizer.
+Unsorted_separator
+Version 2.0.0_separator
+Version 2.0.4_separator
+Backburner_separator
+Config Files
+Modlist Addons_separator
@ -58,6 +58,7 @@
+Player Encumbrance Bar
+Quick Move To Container
+Quest Tracker
-Dynamic Maps - Server
+Dynamic Maps
+Custom Interactions
+Item Context Menu Extended

View File

@ -1,14 +1,15 @@
# This file was automatically generated by Mod Organizer.
+Unsorted_separator
+Version 2.0.0_separator
+Version 2.0.4_separator
+Backburner_separator
-Config Files
+Modlist Addons_separator
+Tools & Debugging_separator
+Headshot Darkness
+Smoke Rework
-Headshot Darkness
-Smoke Rework
+Bright Lasers
+Borkels Realistic NVGs
+HollywoodFX
-HollywoodFX
+VFX & Atmosphere_separator
+Vocal Player
+Agony SFX
@ -48,18 +49,19 @@
+Skeleton Key
+New Items & Keys_separator
+SFX & Music_separator
+Trader Scrolling
+Auto Deposit
+Use Loose Loot
+Quicksell
+Equip From Weapon Rack
-Trader Scrolling
-Auto Deposit
-Use Loose Loot
-Quicksell
-Equip From Weapon Rack
+Better Trader Modding
+Player Encumbrance Bar
+Quick Move To Container
+Quest Tracker
-Player Encumbrance Bar
-Quick Move To Container
-Quest Tracker
-Dynamic Maps - Server
+Dynamic Maps
+Custom Interactions
+Item Context Menu Extended
-Custom Interactions
-Item Context Menu Extended
-Menu Overhaul
+UI Fixes
+Interface & HUD_separator