Added Custom Trader Images
• Added Merks Trader Image Switcher • Changed Lotus Trader image
|
@ -0,0 +1,28 @@
|
|||
[General]
|
||||
gameName=spt
|
||||
modid=0
|
||||
version=d2025.5.16.0
|
||||
newestVersion=
|
||||
category="-1,"
|
||||
nexusFileStatus=1
|
||||
installationFile=MerksTraderImageSwicher_v3.11.zip
|
||||
repository=Nexus
|
||||
ignoredVersion=
|
||||
comments=
|
||||
notes=
|
||||
nexusDescription=
|
||||
url=
|
||||
hasCustomURL=false
|
||||
lastNexusQuery=
|
||||
lastNexusUpdate=
|
||||
nexusLastModified=2025-05-17T01:10:55Z
|
||||
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
|
|
@ -0,0 +1,40 @@
|
|||
# Merks Trader Image Switcher Mod
|
||||
|
||||
The Merks Trader Image Switcher Mod 2.0 makes it easier than ever to customize your trader images in SPT-AKI. Change any trader image just by naming your new custom image the same name as the trader's image you want to change.
|
||||
(Note: If the shortcut does not work open the config folder and click the MerksImageSwitcher.exe)
|
||||
|
||||
(Note: The MerksImageSwitcher requires .NET 4.8 to run. You can download it from [here](https://dotnet.microsoft.com/download/dotnet-framework/net48).)
|
||||
|
||||
## How to Use the Merks Trader Image Switcher Mod
|
||||
|
||||
To use the Merks Trader Image Switcher Mod, simply click on the MerksImageSwitcher shortcut,
|
||||
|
||||

|
||||
|
||||
in the MerksTraderImageSwitcher folder.
|
||||
|
||||

|
||||
|
||||
### Steps:
|
||||
|
||||
1. **Turn the Switcher ON/OFF**:
|
||||
|
||||
- Turn the switcher ON to change trader images and OFF to not change them.
|
||||
|
||||
2. **Select a Folder**:
|
||||
|
||||
- Choose the folder you want to switch the images to.
|
||||
- **Note**: You can only have one folder selected at a time, but the MerksImageSwitcher takes care of that for you.
|
||||
|
||||
3. **Using Custom Images**:
|
||||
|
||||
- If you selected Custom and are loading your own images, **MAKE SURE** the file name is exactly the same as the trader's image you want to switch.
|
||||
- **MAKE SURE** the image size is 640px x 640px.
|
||||
|
||||
4. **Select Image Format**:
|
||||
|
||||
- Select either JPG or PNG depending on your image's file type.
|
||||
- **Note**: These are the two best file types for trader images. Either one works, you just can't load JPG and PNG at the same time.
|
||||
|
||||
5. **Set Trader Images**:
|
||||
- Click the Set Trader Images button to clear the trader avatar images folder in the temp files. This makes it super easy to change the trader images before launching the game. It also helps keep load times short by only clearing the temp files needed to make the Merks Trader Image Switcher Mod work.
|
|
@ -0,0 +1,31 @@
|
|||
Merks Trader Image Switcher Mod 2.0
|
||||
The Merks Trader Image Switcher Mod makes it easier than ever to customize your trader images in SPT-AKI. Change any trader image just by naming your new custom image the same name as the trader's image you want to change.
|
||||
|
||||
(Note: The MerksImageSwitcher requires .NET 4.8 to run. You can download it from here. "https://dotnet.microsoft.com/en-us/download/dotnet-framework/thank-you/net48-web-installer" )
|
||||
|
||||
How to Use the Merks Trader Image Switcher Mod
|
||||
To use the Merks Trader Image Switcher Mod, simply click on the MerksImageSwitcher shortcut,
|
||||
(Note: If the shortcut does not work open the config folder and click the MerksImageSwitcher.exe.
|
||||
If you want a new shortcut just right click on the MerksImageSwitcher.exe and click crate shortcut.
|
||||
Then put the shortcut where ever you like.)
|
||||
|
||||
How to use the MerksImageSwitcher.
|
||||
Steps:
|
||||
1.Turn the Switcher ON/OFF:
|
||||
|
||||
Turn the switcher ON to change trader images and OFF to not change them.
|
||||
Select a Folder:
|
||||
|
||||
2.Choose the folder you want to switch the images to.
|
||||
Note: You can only have one folder selected at a time, but the MerksImageSwitcher takes care of that for you.
|
||||
Using Custom Images:
|
||||
|
||||
3.If you selected Custom and are loading your own images, MAKE SURE the file name is exactly the same as the trader's image you want to switch.
|
||||
MAKE SURE the image size is 640px x 640px.
|
||||
Select Image Format:
|
||||
|
||||
4.Select either JPG or PNG depending on your image's file type.
|
||||
Note: These are the two best file types for trader images. Either one works, you just can't load JPG and PNG at the same time.
|
||||
Set Trader Images:
|
||||
|
||||
5.Click the Set Trader Images button to clear the trader avatar images folder in the temp files. This makes it super easy to change the trader images before launching the game. It also helps keep load times short by only clearing the temp files needed to make the Merks Trader Image Switcher Mod work.
|
BIN
mods/Merks Trader Image Swicher/user/mods/MerksTraderImageSwitcher/config/MerksImageSwitcher.exe (Stored with Git LFS)
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"updateAllTraders": true,
|
||||
"main": false,
|
||||
"custom": true,
|
||||
"anime": false,
|
||||
"realistic": false,
|
||||
"extension": "jpg"
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "MerksTraderImageSwitcher",
|
||||
"version": "2.0.0",
|
||||
"main": "src/TraderPics.js",
|
||||
"license": "MIT",
|
||||
"author": "TeejayMerks",
|
||||
"sptVersion": "~3.11",
|
||||
"loadBefore": [],
|
||||
"loadAfter": [],
|
||||
"incompatibilities": [],
|
||||
"contributors": [],
|
||||
"scripts": {
|
||||
"setup": "npm i",
|
||||
"build": "node ./build.mjs",
|
||||
"buildinfo": "node ./build.mjs --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",
|
||||
"os": "^0.1",
|
||||
"tsyringe": "4.8.0",
|
||||
"typescript": "5.4",
|
||||
"winston": "3.12"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 430 KiB |
After Width: | Height: | Size: 378 KiB |
After Width: | Height: | Size: 490 KiB |
After Width: | Height: | Size: 499 KiB |
After Width: | Height: | Size: 337 KiB |
After Width: | Height: | Size: 387 KiB |
After Width: | Height: | Size: 349 KiB |
After Width: | Height: | Size: 487 KiB |
After Width: | Height: | Size: 623 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 400 KiB |
After Width: | Height: | Size: 344 KiB |
After Width: | Height: | Size: 27 KiB |
|
@ -0,0 +1,6 @@
|
|||
Merks Trader Image Switcher Mod 2.0
|
||||
--------------------------------
|
||||
Use this folde to mix and match your trader images or add your own!
|
||||
|
||||
NOTE: Make sure your custom trader images have the same name as the original traders image.
|
||||
Also make sure the images is 640px x 640px.
|
After Width: | Height: | Size: 321 KiB |
After Width: | Height: | Size: 278 KiB |
|
@ -0,0 +1,6 @@
|
|||
[.ShellClassInfo]
|
||||
IconResource=C:\Windows\System32\SHELL32.dll,318
|
||||
[ViewState]
|
||||
Mode=
|
||||
Vid=
|
||||
FolderType=Generic
|
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 400 KiB |
After Width: | Height: | Size: 344 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 321 KiB |
After Width: | Height: | Size: 278 KiB |
After Width: | Height: | Size: 229 KiB |
After Width: | Height: | Size: 376 KiB |
After Width: | Height: | Size: 353 KiB |
After Width: | Height: | Size: 427 KiB |
After Width: | Height: | Size: 264 KiB |
After Width: | Height: | Size: 357 KiB |
After Width: | Height: | Size: 352 KiB |
After Width: | Height: | Size: 356 KiB |
After Width: | Height: | Size: 485 KiB |
|
@ -0,0 +1,6 @@
|
|||
[.ShellClassInfo]
|
||||
IconResource=C:\Windows\System32\SHELL32.dll,234
|
||||
[ViewState]
|
||||
Mode=
|
||||
Vid=
|
||||
FolderType=Generic
|
|
@ -0,0 +1,3 @@
|
|||
Merks Trader Image Switcher Mod 2.0
|
||||
--------------------------------
|
||||
Use this folder to store the unused/extra trader images you have.
|
|
@ -0,0 +1,96 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.mod = void 0;
|
||||
const tsyringe_1 = require("C:/snapshot/project/node_modules/tsyringe");
|
||||
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const logger = tsyringe_1.container.resolve("WinstonLogger");
|
||||
const imageRouter = tsyringe_1.container.resolve("ImageRouter");
|
||||
const preSptModLoader = tsyringe_1.container.resolve("PreSptModLoader");
|
||||
class TraderPics {
|
||||
modName = path_1.default.basename(path_1.default.dirname(__dirname.split("/").pop() || ""));
|
||||
async preSptLoad(container) {
|
||||
// Initialize anything if needed before SPT loads
|
||||
}
|
||||
async postDBLoad(container) {
|
||||
let settings;
|
||||
let pkg;
|
||||
try {
|
||||
pkg = require("../package.json");
|
||||
settings = require("../config/config.json");
|
||||
logger.info("Settings loaded successfully.");
|
||||
logger.info(`Settings: ${JSON.stringify(settings)}`);
|
||||
}
|
||||
catch (err) {
|
||||
logger.error("Failed to load config.json or package.json", err);
|
||||
return;
|
||||
}
|
||||
const modPath = preSptModLoader.getModPath(this.modName);
|
||||
logger.info(`Mod path: ${modPath}`);
|
||||
const folderPaths = {
|
||||
anime: path_1.default.join(modPath, "res", "anime"),
|
||||
custom: path_1.default.join(modPath, "res", "custom"),
|
||||
main: path_1.default.join(modPath, "res", "main"),
|
||||
realistic: path_1.default.join(modPath, "res", "realistic"),
|
||||
};
|
||||
try {
|
||||
if (!settings.anime &&
|
||||
!settings.custom &&
|
||||
!settings.main &&
|
||||
!settings.realistic) {
|
||||
logger.info("All folder usage settings are false. No images will be changed.");
|
||||
return;
|
||||
}
|
||||
let filepath = "";
|
||||
if (settings.anime) {
|
||||
filepath = folderPaths.anime;
|
||||
}
|
||||
else if (settings.custom) {
|
||||
filepath = folderPaths.custom;
|
||||
}
|
||||
else if (settings.main) {
|
||||
filepath = folderPaths.main;
|
||||
}
|
||||
else if (settings.realistic) {
|
||||
filepath = folderPaths.realistic;
|
||||
}
|
||||
this.loadImages(filepath, settings);
|
||||
logger.log(`${pkg.name} [LOADED]: Traders Looking Fire Now!`, LogTextColor_1.LogTextColor.BLUE);
|
||||
}
|
||||
catch (err) {
|
||||
logger.error("An error occurred during postDBLoad execution", err);
|
||||
logger.error(err.stack);
|
||||
}
|
||||
}
|
||||
loadImages(filepath, settings) {
|
||||
logger.info(`Loading images from: ${filepath}`);
|
||||
fs_1.default.readdir(filepath, (err, files) => {
|
||||
if (err) {
|
||||
logger.error(`Error reading directory: ${filepath}`, err);
|
||||
return;
|
||||
}
|
||||
files.forEach((file) => {
|
||||
const traderName = path_1.default.basename(file, path_1.default.extname(file));
|
||||
try {
|
||||
if (settings.updateAllTraders) {
|
||||
this.changeTraderImage(traderName, settings, filepath);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
logger.error(`Error processing image for trader ${traderName}: ${error.message}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
changeTraderImage(traderName, settings, filepath) {
|
||||
const imageFileName = `${traderName}.${settings.extension}`;
|
||||
logger.info(`Changing image for ${traderName} to ${imageFileName}`);
|
||||
imageRouter.addRoute(`/files/trader/avatar/${traderName}`, `${filepath}${path_1.default.sep}${imageFileName}`);
|
||||
}
|
||||
}
|
||||
exports.mod = new TraderPics();
|
||||
//# sourceMappingURL=TraderPics.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"TraderPics.js","source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,CAAC;IACJ,CAAC;CACF;AAEY,QAAA,GAAG,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
|
@ -0,0 +1,130 @@
|
|||
import { container, DependencyContainer } from "tsyringe";
|
||||
|
||||
import { ImageRouter } from "@spt/routers/ImageRouter"; // Adjusted the import path
|
||||
import { PreSptModLoader } from "@spt/loaders/PreSptModLoader"; // Adjusted the import path
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger"; // Adjusted the import path
|
||||
import { LogTextColor } from "@spt/models/spt/logging/LogTextColor";
|
||||
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
const logger: ILogger = container.resolve("WinstonLogger");
|
||||
const imageRouter: ImageRouter = container.resolve("ImageRouter");
|
||||
const preSptModLoader: PreSptModLoader = container.resolve("PreSptModLoader");
|
||||
|
||||
interface Settings {
|
||||
updateAllTraders: boolean;
|
||||
extension: string;
|
||||
anime: boolean;
|
||||
custom: boolean;
|
||||
main: boolean;
|
||||
realistic: boolean;
|
||||
}
|
||||
|
||||
class TraderPics implements IPreSptLoadMod, IPostDBLoadMod {
|
||||
private modName: string = path.basename(
|
||||
path.dirname(__dirname.split("/").pop() || "")
|
||||
);
|
||||
|
||||
public async preSptLoad(container: DependencyContainer): Promise<void> {
|
||||
// Initialize anything if needed before SPT loads
|
||||
}
|
||||
|
||||
public async postDBLoad(container: DependencyContainer): Promise<void> {
|
||||
let settings: Settings;
|
||||
let pkg: any;
|
||||
|
||||
try {
|
||||
pkg = require("../package.json");
|
||||
settings = require("../config/config.json");
|
||||
logger.info("Settings loaded successfully.");
|
||||
logger.info(`Settings: ${JSON.stringify(settings)}`);
|
||||
} catch (err) {
|
||||
logger.error("Failed to load config.json or package.json", err);
|
||||
return;
|
||||
}
|
||||
|
||||
const modPath = preSptModLoader.getModPath(this.modName);
|
||||
logger.info(`Mod path: ${modPath}`);
|
||||
|
||||
const folderPaths = {
|
||||
anime: path.join(modPath, "res", "anime"),
|
||||
custom: path.join(modPath, "res", "custom"),
|
||||
main: path.join(modPath, "res", "main"),
|
||||
realistic: path.join(modPath, "res", "realistic"),
|
||||
};
|
||||
|
||||
try {
|
||||
if (
|
||||
!settings.anime &&
|
||||
!settings.custom &&
|
||||
!settings.main &&
|
||||
!settings.realistic
|
||||
) {
|
||||
logger.info(
|
||||
"All folder usage settings are false. No images will be changed."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
let filepath = "";
|
||||
if (settings.anime) {
|
||||
filepath = folderPaths.anime;
|
||||
} else if (settings.custom) {
|
||||
filepath = folderPaths.custom;
|
||||
} else if (settings.main) {
|
||||
filepath = folderPaths.main;
|
||||
} else if (settings.realistic) {
|
||||
filepath = folderPaths.realistic;
|
||||
}
|
||||
|
||||
this.loadImages(filepath, settings);
|
||||
logger.log(
|
||||
`${pkg.name} [LOADED]: Traders Looking Fire Now!`,
|
||||
LogTextColor.BLUE
|
||||
);
|
||||
} catch (err) {
|
||||
logger.error("An error occurred during postDBLoad execution", err);
|
||||
logger.error(err.stack);
|
||||
}
|
||||
}
|
||||
|
||||
private loadImages(filepath: string, settings: Settings): void {
|
||||
logger.info(`Loading images from: ${filepath}`);
|
||||
|
||||
fs.readdir(filepath, (err, files) => {
|
||||
if (err) {
|
||||
logger.error(`Error reading directory: ${filepath}`, err);
|
||||
return;
|
||||
}
|
||||
|
||||
files.forEach((file) => {
|
||||
const traderName = path.basename(file, path.extname(file));
|
||||
try {
|
||||
if (settings.updateAllTraders) {
|
||||
this.changeTraderImage(traderName, settings, filepath);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
`Error processing image for trader ${traderName}: ${error.message}`
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private changeTraderImage(
|
||||
traderName: string,
|
||||
settings: Settings,
|
||||
filepath: string
|
||||
): void {
|
||||
const imageFileName = `${traderName}.${settings.extension}`;
|
||||
logger.info(`Changing image for ${traderName} to ${imageFileName}`);
|
||||
imageRouter.addRoute(
|
||||
`/files/trader/avatar/${traderName}`,
|
||||
`${filepath}${path.sep}${imageFileName}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const mod = new TraderPics();
|
|
@ -4,6 +4,7 @@
|
|||
+Backburner_separator
|
||||
+Config Files
|
||||
+Modlist Addons_separator
|
||||
+Merks Trader Image Swicher
|
||||
+Tools & Debugging_separator
|
||||
+Headshot Darkness
|
||||
+Smoke Rework
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
+Backburner_separator
|
||||
+Config Files
|
||||
+Modlist Addons_separator
|
||||
-Merks Trader Image Swicher
|
||||
+Tools & Debugging_separator
|
||||
-Headshot Darkness
|
||||
-Smoke Rework
|
||||
|
@ -35,7 +36,7 @@
|
|||
+Hideout Changes_separator
|
||||
+Plant Time Modifier
|
||||
+Quest Tweaks_separator
|
||||
-Lotus
|
||||
+Lotus
|
||||
+Ref SPT Friendly Quests
|
||||
+New Traders & Tweaks_separator
|
||||
+Smart Action
|
||||
|
|