This commit is contained in:
GetParanoid 2025-07-18 18:11:28 -05:00
parent 7aa7ac1092
commit 081b038df5
99 changed files with 18010 additions and 1 deletions

View file

@ -0,0 +1,8 @@
{
"Names": [
"extra",
"names",
"go",
"here"
]
}

View file

@ -0,0 +1,20 @@
{
"firstNames": [
"put",
"your",
"first names",
"here",
"or",
"add",
"more"
],
"lastNames": [
"put",
"your",
"last names",
"here",
"or",
"add",
"more"
]
}

View file

@ -0,0 +1,8 @@
{
"Names": [
"extra",
"names",
"go",
"here"
]
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,67 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomAssortSchemeService = void 0;
const customAssortSchemes = __importStar(require("../db/CustomAssortSchemes/CustomAssortSchemes.json"));
const configConsts_1 = require("./references/configConsts");
class CustomAssortSchemeService {
instanceManager;
preSptLoad(instanceManager) {
this.instanceManager = instanceManager;
}
postDBLoad() {
const tables = this.instanceManager.database;
for (const traderId in customAssortSchemes) {
const traderIdFromMap = configConsts_1.traderIDs[traderId];
const finalTraderId = traderIdFromMap || traderId;
const trader = tables.traders[finalTraderId];
if (!trader) {
return;
}
const newAssort = customAssortSchemes[traderId];
for (const item of newAssort.items) {
trader.assort.items.push(item);
}
for (const [itemName, scheme] of Object.entries(newAssort.barter_scheme)) {
trader.assort.barter_scheme[itemName] = scheme;
}
for (const [itemName, count] of Object.entries(newAssort.loyal_level_items)) {
trader.assort.loyal_level_items[itemName] = count;
}
}
}
}
exports.CustomAssortSchemeService = CustomAssortSchemeService;
//# sourceMappingURL=CustomAssortSchemeService.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "CustomAssortSchemeService.js",
"sourceRoot": "",
"sources": [
"CustomAssortSchemeService.ts"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wGAA0F;AAC1F,4DAAsD;AAEtD,MAAa,yBAAyB;IAE1B,eAAe,CAAqB;IAErC,UAAU,CAAC,eAAmC;QAEjD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;IAEM,UAAU;QAEb,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC;QAC7C,KAAK,MAAM,QAAQ,IAAI,mBAAmB,EAC1C,CAAC;YACG,MAAM,eAAe,GAAG,wBAAS,CAAC,QAAQ,CAAC,CAAC;YAC5C,MAAM,aAAa,GAAG,eAAe,IAAI,QAAQ,CAAC;YAClD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YAE7C,IAAI,CAAC,MAAM,EACX,CAAC;gBACG,OAAO;YACX,CAAC;YAED,MAAM,SAAS,GAAmB,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YAEhE,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,KAAK,EAClC,CAAC;gBACG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC;YACD,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,EACxE,CAAC;gBACG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;YACnD,CAAC;YAED,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAC3E,CAAC;gBACG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;YACtD,CAAC;QAEL,CAAC;IACL,CAAC;CAGJ;AA3CD,8DA2CC"
}

View file

@ -0,0 +1,321 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomClothingService = void 0;
const configConsts_1 = require("./references/configConsts");
const node_fs_1 = __importDefault(require("node:fs"));
const node_path_1 = __importDefault(require("node:path"));
class CustomClothingService {
instanceManager;
preSptLoad(instanceManager) {
this.instanceManager = instanceManager;
}
postDBLoad() {
const clothingJsonsPath = node_path_1.default.join(__dirname, "../db/clothing");
if (this.instanceManager.debug) {
console.log(`Scanning directory for clothing JSON files: ${clothingJsonsPath}`);
}
const jsonFiles = node_fs_1.default.readdirSync(clothingJsonsPath).filter(file => file.endsWith(".json"));
if (this.instanceManager.debug) {
console.log(`Found ${jsonFiles.length} JSON file(s) in ${clothingJsonsPath}`);
}
for (const jsonFile of jsonFiles) {
const filePath = node_path_1.default.join(clothingJsonsPath, jsonFile);
if (this.instanceManager.debug) {
console.log(`Processing file: ${jsonFile} at path: ${filePath}`);
}
try {
// Read and parse the JSON file
const clothingConfigs = this.readJsonFile(filePath);
if (this.instanceManager.debug) {
console.log(`Parsed JSON content from ${jsonFile}:`, clothingConfigs);
}
// Process the parsed content
for (const clothingConfig of clothingConfigs) {
if (this.instanceManager.debug) {
console.log("Processing clothing config:", clothingConfig);
}
try {
this.processClothingConfig(clothingConfig);
if (this.instanceManager.debug) {
console.log("Successfully processed clothing config:", clothingConfig);
}
}
catch (error) {
console.error(`Error processing config in ${jsonFile}:`, error);
}
}
if (this.instanceManager.debug) {
console.log(`Successfully processed all configs in ${jsonFile}.`);
}
}
catch (error) {
console.error(`Error reading or parsing ${jsonFile}:`, error);
}
}
}
processClothingConfig(clothingConfig) {
if (this.instanceManager.debug) {
console.log(`Processing config of type: ${clothingConfig.type}`);
}
if (clothingConfig.type === "top") {
this.addTop(clothingConfig);
}
else if (clothingConfig.type === "bottom") {
this.addBottom(clothingConfig);
}
else {
console.error("Unknown config type:", clothingConfig.type);
}
}
addSuiteToTrader(traderId, outfitId, suiteId, loyaltyLevel, profileLevel, standing, currencyId, price) {
const traderIdFromEnum = configConsts_1.traderIDs[traderId] || traderId;
const currencyIdFromEnum = configConsts_1.currencyIDs[currencyId] || currencyId;
this.instanceManager.database.traders[traderIdFromEnum].base.customization_seller = true;
if (!this.instanceManager.database.traders[traderIdFromEnum].suits) {
this.instanceManager.database.traders[traderIdFromEnum].suits = [];
}
const newTraderOutfit = {
"_id": outfitId,
"tid": traderIdFromEnum,
"suiteId": suiteId,
"isActive": true,
"isHiddenInPVE": false,
"externalObtain": false,
"internalObtain": false,
"requirements": {
"loyaltyLevel": loyaltyLevel,
"profileLevel": profileLevel,
"standing": standing,
"skillRequirements": [],
"questRequirements": [],
"achievementRequirements": [],
"itemRequirements": [
{
"id": null,
"type": "ItemRequirement",
"count": price,
"_tpl": currencyIdFromEnum,
"onlyFunctional": true
}
],
"requiredTid": traderIdFromEnum
}
};
if (this.instanceManager.debug) {
console.log("Adding new trader outfit:", newTraderOutfit);
}
this.instanceManager.database.traders[traderIdFromEnum].suits.push(newTraderOutfit);
}
addTop(clothingConfig) {
const { side, suiteId, topId, handsId, outfitId, topBundlePath, handsBundlePath, traderId, loyaltyLevel, profileLevel, standing, currencyId, price, watchPrefab, watchPosition, watchRotation } = clothingConfig;
try {
if (this.instanceManager.debug) {
console.log("Adding top");
}
const DefaultWatchPrefab = {
"path": "",
"rcid": ""
};
const DefaultWatchPosition = {
"x": 0,
"y": 0,
"z": 0
};
const DefaultWatchRotation = {
"x": 0,
"y": 0,
"z": 0
};
const newTop = {
"_id": topId,
"_name": `${topId}_name`,
"_parent": "5cc0868e14c02e000c6bea68",
"_type": "Item",
"_props": {
"Description": `${topId}_desc`,
"Name": `${topId}_name`,
"ShortName": `${topId}_shortName`,
"Side": [
"Usec"
],
"BodyPart": "Body",
"IntegratedArmorVest": false,
"Prefab": {
"path": topBundlePath,
"rcid": ""
},
"WatchPosition": watchPosition ?? DefaultWatchPosition,
"WatchPrefab": watchPrefab ?? DefaultWatchPrefab,
"WatchRotation": watchRotation ?? DefaultWatchRotation
},
"_proto": "5cde95d97d6c8b647a3769b0"
};
if (this.instanceManager.debug) {
console.log(`Added top for ${topId}:`, newTop);
}
this.instanceManager.database.templates.customization[topId] = newTop;
// add hands
if (this.instanceManager.debug) {
console.log(`Adding hands for topId: ${topId}`);
}
const newHands = {
"_id": handsId,
"_name": `${handsId}_name`,
"_parent": "5cc086a314c02e000c6bea69",
"_type": "Item",
"_props": {
"Description": `${handsId}_desc`,
"Name": `${handsId}_name`,
"ShortName": `${handsId}_shortName`,
"Side": [
"Usec"
],
"BodyPart": "Hands",
"IntegratedArmorVest": false,
"Prefab": {
"path": handsBundlePath,
"rcid": ""
},
"WatchPosition": watchPosition ?? DefaultWatchPosition,
"WatchPrefab": watchPrefab ?? DefaultWatchPrefab,
"WatchRotation": watchRotation ?? DefaultWatchRotation
},
"_proto": "5cde95fa7d6c8b04737c2d13"
};
this.instanceManager.database.templates.customization[handsId] = newHands;
if (this.instanceManager.debug) {
console.log(`Added hands for ${handsId}:`, newHands);
}
const newSuite = {
"_id": suiteId,
"_name": `${suiteId}_name`,
"_parent": "5cd944ca1388ce03a44dc2a4",
"_type": "Item",
"_props": {
"Description": "DefaultUsecUpperSuite",
"Name": "DefaultUsecUpperSuite",
"ShortName": "DefaultUsecUpperSuite",
"Side": side ?? ["Usec", "Bear", "Savage"],
"AvailableAsDefault": false,
"Game": [
"eft",
"arena"
],
"Body": topId,
"Hands": handsId
},
"_proto": "5cde9ec17d6c8b04723cf479"
};
this.instanceManager.database.templates.customization[suiteId] = newSuite;
if (this.instanceManager.debug) {
console.log(`Added suite for ${suiteId}`, newSuite);
}
this.handleLocale(clothingConfig, suiteId);
this.addSuiteToTrader(traderId, outfitId, suiteId, loyaltyLevel, profileLevel, standing, currencyId, price);
}
catch (error) {
console.error(`Error adding top for outfitId: ${outfitId}:`, error);
}
}
addBottom(clothingConfig) {
const { side, bottomId, suiteId, outfitId, bottomBundlePath, traderId, loyaltyLevel, profileLevel, standing, currencyId, price } = clothingConfig;
// add Bottom
const newBottom = {
"_id": bottomId,
"_name": `${bottomId}_name`,
"_parent": "5cc0869814c02e000a4cad94",
"_type": "Item",
"_props": {
"Description": `${bottomId}_desc`,
"Name": `${bottomId}_name`,
"ShortName": `${bottomId}_shortName`,
"Side": side ?? ["Usec", "Bear", "Savage"],
"BodyPart": "Feet",
"IntegratedArmorVest": false,
"Prefab": {
"path": bottomBundlePath,
"rcid": ""
},
"WatchPosition": {
"x": 0,
"y": 0,
"z": 0
},
"WatchPrefab": {
"path": "",
"rcid": ""
},
"WatchRotation": {
"x": 0,
"y": 0,
"z": 0
}
},
"_proto": "5cdea3c47d6c8b0475341734"
};
this.instanceManager.database.templates.customization[bottomId] = newBottom;
const newSuite = {
"_id": suiteId,
"_name": `${suiteId}_name`,
"_parent": "5cd944d01388ce000a659df9",
"_type": "Item",
"_props": {
"Description": `${suiteId}_desc`,
"Name": `${suiteId}_name`,
"ShortName": `${suiteId}_shortName`,
"Side": side ?? ["Usec", "Bear", "Savage"],
"AvailableAsDefault": false,
"Game": [
"eft",
"arena"
],
"Feet": bottomId
},
"_proto": "5cd946231388ce000d572fe3"
};
// add suite
this.instanceManager.database.templates.customization[suiteId] = newSuite;
if (this.instanceManager.debug) {
console.log(`Added suite for ${suiteId}`, newSuite);
}
this.handleLocale(clothingConfig, suiteId);
this.addSuiteToTrader(traderId, outfitId, suiteId, loyaltyLevel, profileLevel, standing, currencyId, price);
}
handleLocale(clothingConfig, clothingId) {
for (const localeID in this.instanceManager.database.locales.global) {
if (this.instanceManager.debug) {
console.log("Processing localeID:", localeID);
}
try {
const itemName = `${clothingId} Name`;
// Check if the locale exists, else fallback to 'en'
const localeValue = clothingConfig.locales[localeID] || clothingConfig.locales["en"];
if (localeValue && this.instanceManager.database.locales.global[localeID]) {
this.instanceManager.database.locales.global[localeID][itemName] = localeValue;
}
}
catch (error) {
console.error(`Error handling locale for ${localeID}: ${error}`);
}
}
}
readJsonFile(filePath) {
const content = node_fs_1.default.readFileSync(filePath, "utf-8");
try {
const parsedContent = JSON.parse(content);
if (this.instanceManager.debug) {
console.log("Custom Clothing Service: Parsed JSON Content:", parsedContent); // Logging the parsed JSON content
}
return parsedContent;
}
catch (error) {
console.error("Error parsing JSON content:", error);
return null;
}
}
}
exports.CustomClothingService = CustomClothingService;
//# sourceMappingURL=CustomClothingService.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,706 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomItemService = void 0;
const configConsts_1 = require("./references/configConsts");
const configConsts_2 = require("./references/configConsts");
const configConsts_3 = require("./references/configConsts");
const items_1 = require("./references/items");
const itemBaseClasses_1 = require("./references/itemBaseClasses");
const itemHandbookCategories_1 = require("./references/itemHandbookCategories");
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
const fs = __importStar(require("node:fs"));
const path = __importStar(require("node:path"));
class CustomItemService {
instanceManager;
preSptLoad(instanceManager) {
this.instanceManager = instanceManager;
}
postDBLoad() {
const configPath = path.join(__dirname, "../db/items");
const configFiles = fs
.readdirSync(configPath)
.filter((file) => !file.includes("BaseItemReplacement"));
let numItemsAdded = 0;
for (const file of configFiles) {
const filePath = path.join(configPath, file);
try {
const fileContents = fs.readFileSync(filePath, "utf-8");
const config = JSON.parse(fileContents);
for (const itemId in config) {
const itemConfig = config[itemId];
try {
const { exampleCloneItem, finalItemTplToClone } = this.createExampleCloneItem(itemConfig, itemId);
if (this.instanceManager.debug) {
console.log(`Processing file: ${file}, Item ID: ${itemId}`);
console.log(`Prefab Path: ${exampleCloneItem.overrideProperties?.Prefab.path}`);
}
this.instanceManager.customItem.createItemFromClone(exampleCloneItem);
this.processStaticLootContainers(itemConfig, itemId);
this.processModSlots(itemConfig, [finalItemTplToClone], itemId);
this.processInventorySlots(itemConfig, itemId);
this.processMasterySections(itemConfig, itemId);
this.processWeaponPresets(itemConfig, itemId);
this.processTraders(itemConfig, itemId);
this.addtoHallofFame(itemConfig, itemId);
this.addtoSpecialSlots(itemConfig, itemId);
numItemsAdded++;
}
catch (itemError) {
console.error(`Error processing item ID: ${itemId} in file: ${file}`);
console.error(itemError);
}
}
}
catch (fileError) {
console.error(`Error processing config file: ${file}`);
console.error(fileError);
}
}
if (this.instanceManager.debug) {
if (numItemsAdded > 0) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] Database: Loaded ${numItemsAdded} custom items.`, LogTextColor_1.LogTextColor.GREEN);
}
else {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] Database: No custom items loaded.`, LogTextColor_1.LogTextColor.GREEN);
}
}
// Post-item processing (e.g., bot inventories, quest modifications)
for (const file of configFiles) {
const filePath = path.join(configPath, file);
try {
const fileContents = fs.readFileSync(filePath, "utf-8");
const config = JSON.parse(fileContents);
for (const itemId in config) {
const itemConfig = config[itemId];
this.processBotInventories(itemConfig, itemConfig.itemTplToClone, itemId);
}
}
catch (fileError) {
console.error(`Error processing bot inventories for file: ${file}`);
console.error(fileError);
}
}
}
/**
* Creates an example clone item with the provided item configuration and item ID.
*
* @param {any} itemConfig - The configuration of the item to clone.
* @param {string} itemId - The ID of the item.
* @return {{ exampleCloneItem: NewItemFromCloneDetails, finalItemTplToClone: string }} The created example clone item and the final item template to clone.
*/
createExampleCloneItem(itemConfig, itemId) {
const itemTplToCloneFromMap = items_1.ItemMap[itemConfig.itemTplToClone] || itemConfig.itemTplToClone;
const finalItemTplToClone = itemTplToCloneFromMap;
const parentIdFromMap = itemBaseClasses_1.ItemBaseClassMap[itemConfig.parentId] || itemConfig.parentId;
const finalParentId = parentIdFromMap;
const handbookParentIdFromMap = itemHandbookCategories_1.ItemHandbookCategoryMap[itemConfig.handbookParentId] ||
itemConfig.handbookParentId;
const finalHandbookParentId = handbookParentIdFromMap;
const itemPrefabPath = `customItems/${itemId}.bundle`;
const exampleCloneItem = {
itemTplToClone: finalItemTplToClone,
overrideProperties: itemConfig.overrideProperties
? {
...itemConfig.overrideProperties,
Prefab: {
path: itemConfig.overrideProperties.Prefab?.path || itemPrefabPath,
rcid: ""
}
}
: undefined,
parentId: finalParentId,
newId: itemId,
fleaPriceRoubles: itemConfig.fleaPriceRoubles,
handbookPriceRoubles: itemConfig.handbookPriceRoubles,
handbookParentId: finalHandbookParentId,
locales: itemConfig.locales
};
if (this.instanceManager.debug) {
console.log(`Cloning item ${finalItemTplToClone} for itemID: ${itemId}`);
}
return { exampleCloneItem, finalItemTplToClone };
}
/**
* Adds an item to a static loot container with a given probability.
*
* @param {string} containerID - The ID of the loot container.
* @param {string} itemToAdd - The item to add to the loot container.
* @param {number} probability - The probability of the item being added.
* @return {void} This function does not return anything.
*/
addToStaticLoot(containerID, itemToAdd, probability) {
const locations = this.instanceManager.database.locations;
for (const locationID in locations) {
if (!Object.prototype.hasOwnProperty.call(locations, locationID)) {
continue; // Skip invalid locations
}
const location = locations[locationID];
if (!location.staticLoot) {
if (this.instanceManager.debug) {
console.warn(`Warning: No static loot found in location: ${locationID}`);
}
continue;
}
const staticLoot = location.staticLoot;
if (!Object.prototype.hasOwnProperty.call(staticLoot, containerID)) {
if (this.instanceManager.debug) {
console.log(`Error: Loot container ID ${containerID} not found in location: ${locationID}`);
}
continue;
}
const lootContainer = staticLoot[containerID];
if (!lootContainer) {
if (this.instanceManager.debug) {
console.log(`Error: Loot container ID ${containerID} is null in location: ${locationID}`);
}
continue;
}
const templateFromMap = items_1.ItemMap[itemToAdd];
const finalTemplate = templateFromMap || itemToAdd;
const newLoot = [
{
tpl: finalTemplate,
relativeProbability: probability,
},
];
lootContainer.itemDistribution.push(...newLoot);
if (this.instanceManager.debug) {
console.log(`Added ${itemToAdd} to loot container: ${containerID} in location: ${locationID}`);
}
}
}
/**
* Processes the static loot containers for a given item.
*
* @param {any} itemConfig - The configuration object for the item.
* @param {string} itemId - The ID of the item.
* @return {void} This function does not return a value.
*/
processStaticLootContainers(itemConfig, itemId) {
if (itemConfig.addtoStaticLootContainers) {
if (this.instanceManager.debug) {
console.log("Processing static loot containers for item:", itemId);
}
if (Array.isArray(itemConfig.StaticLootContainers)) {
if (this.instanceManager.debug) {
console.log("Adding item to multiple static loot containers:");
}
for (const container of itemConfig.StaticLootContainers) {
const staticLootContainer = items_1.ItemMap[container.ContainerName] || container.ContainerName;
this.addToStaticLoot(staticLootContainer, itemId, container.Probability);
if (this.instanceManager.debug) {
console.log(` - Added to container '${staticLootContainer}' with probability ${container.Probability}`);
}
}
}
else {
const staticLootContainer = items_1.ItemMap[itemConfig.StaticLootContainers] ||
itemConfig.StaticLootContainers;
this.addToStaticLoot(staticLootContainer, itemId, itemConfig.Probability);
if (this.instanceManager.debug) {
console.log(`Added to container '${staticLootContainer}' with probability ${itemConfig.Probability}`);
}
}
}
}
/**
* Processes the mod slots of an item.
*
* @param {any} itemConfig - The configuration of the item.
* @param {string[]} finalItemTplToClone - The final item template to clone.
* @param {string} itemId - The ID of the item.
* @returns {void}
*/
processModSlots(itemConfig, finalItemTplToClone, itemId) {
const tables = this.instanceManager.database;
const moddableItemWhitelistIds = Array.isArray(itemConfig.ModdableItemWhitelist)
? itemConfig.ModdableItemWhitelist.map((shortname) => items_1.ItemMap[shortname])
: itemConfig.ModdableItemWhitelist
? [items_1.ItemMap[itemConfig.ModdableItemWhitelist]]
: [];
const moddableItemBlacklistIds = Array.isArray(itemConfig.ModdableItemBlacklist)
? itemConfig.ModdableItemBlacklist.map((shortname) => items_1.ItemMap[shortname])
: itemConfig.ModdableItemBlacklist
? [items_1.ItemMap[itemConfig.ModdableItemBlacklist]]
: [];
const modSlots = Array.isArray(itemConfig.modSlot)
? itemConfig.modSlot
: itemConfig.modSlot
? [itemConfig.modSlot]
: [];
const lowercaseModSlots = modSlots.map((modSlotName) => modSlotName.toLowerCase());
if (itemConfig.addtoModSlots) {
if (this.instanceManager.debug) {
console.log("Processing mod slots for item:", itemId);
}
for (const parentItemId in tables.templates.items) {
const parentItem = tables.templates.items[parentItemId];
if (!parentItem._props.Slots) {
continue;
}
const isBlacklisted = moddableItemBlacklistIds.includes(parentItemId);
const isWhitelisted = moddableItemWhitelistIds.includes(parentItemId);
if (isBlacklisted) {
continue;
}
let addToModSlots = false;
if (isWhitelisted && itemConfig.modSlot) {
addToModSlots = true;
}
else if (!isBlacklisted && itemConfig.modSlot) {
for (const modSlot of parentItem._props.Slots) {
if (modSlot._props.filters?.[0].Filter.some((filterItem) => finalItemTplToClone.includes(filterItem))) {
if (lowercaseModSlots.includes(modSlot._name.toLowerCase())) {
addToModSlots = true;
break;
}
}
}
}
if (addToModSlots) {
for (const modSlot of parentItem._props.Slots) {
if (lowercaseModSlots.includes(modSlot._name.toLowerCase())) {
if (!modSlot._props.filters) {
modSlot._props.filters = [
{
AnimationIndex: 0,
Filter: []
}
];
}
if (!modSlot._props.filters[0].Filter.includes(itemId)) {
modSlot._props.filters[0].Filter.push(itemId);
if (this.instanceManager.debug) {
console.log(`Successfully added item ${itemId} to the filter of mod slot ${modSlot._name} for parent item ${parentItemId}`);
}
}
}
}
}
}
}
}
/**
* Processes the inventory slots for a given item.
*
* @param {any} itemConfig - The configuration object for the item.
* @param {string} itemId - The ID of the item.
* @param {any} defaultInventorySlots - The default inventory slots.
* @return {void} This function does not return a value.
*/
processInventorySlots(itemConfig, itemId) {
const tables = this.instanceManager.database;
if (itemConfig.addtoInventorySlots) {
if (this.instanceManager.debug) {
console.log("Processing inventory slots for item:", itemId);
}
const defaultInventorySlots = tables.templates.items["55d7217a4bdc2d86028b456d"]._props.Slots;
const allowedSlots = Array.isArray(itemConfig.addtoInventorySlots)
? itemConfig.addtoInventorySlots
: [itemConfig.addtoInventorySlots];
// Iterate over the slots and push the item into the filters per the config
for (const slot of defaultInventorySlots) {
const slotName = configConsts_3.inventorySlots[slot._name];
const slotId = Object.keys(configConsts_3.inventorySlots).find((key) => configConsts_3.inventorySlots[key] === slot._name);
if (allowedSlots.includes(slot._name) ||
allowedSlots.includes(slotName) ||
allowedSlots.includes(slotId)) {
if (!slot._props.filters[0].Filter.includes(itemId)) {
slot._props.filters[0].Filter.push(itemId);
if (this.instanceManager.debug) {
console.log(`Successfully added item ${itemId} to the filter of slot ${slot._name}`);
}
}
}
}
}
}
/**
* Processes the mastery sections for an item.
*
* @param {any} itemConfig - The configuration object for the item.
* @param {string} itemId - The ID of the item.
* @param {any} tables - The tables object containing global configuration.
* @return {void} This function does not return a value.
*/
processMasterySections(itemConfig, itemId) {
const tables = this.instanceManager.database;
if (itemConfig.masteries) {
if (this.instanceManager.debug) {
console.log("Processing mastery sections for item:", itemId);
}
const masterySections = Array.isArray(itemConfig.masterySections)
? itemConfig.masterySections
: [itemConfig.masterySections];
for (const mastery of masterySections) {
const existingMastery = tables.globals.config.Mastering.find((existing) => existing.Name === mastery.Name);
if (existingMastery) {
existingMastery.Templates.push(...mastery.Templates);
if (this.instanceManager.debug) {
console.log(` - Adding to existing mastery section for item: ${itemId}`);
}
}
else {
tables.globals.config.Mastering.push(mastery);
if (this.instanceManager.debug) {
console.log(` - Adding new mastery section for item: ${itemId}`);
}
}
}
}
}
/**
* Processes weapon presets based on the provided item configuration and tables.
*
* @param {any} itemConfig - The item configuration.
* @return {void} This function does not return anything.
*/
processWeaponPresets(itemConfig, itemId) {
const tables = this.instanceManager.database;
const { addweaponpreset, weaponpresets } = itemConfig;
const itemPresets = tables.globals.ItemPresets;
if (addweaponpreset) {
if (this.instanceManager.debug) {
console.log("Processing weapon presets for item:", itemId);
}
for (const presetData of weaponpresets) {
const preset = {
_changeWeaponName: presetData._changeWeaponName,
_encyclopedia: presetData._encyclopedia || undefined,
_id: presetData._id,
_items: presetData._items.map((itemData) => {
const item = {
_id: itemData._id,
_tpl: itemData._tpl
};
// Add parentId and slotId only if they are present in itemData
if (itemData.parentId) {
item.parentId = itemData.parentId;
}
if (itemData.slotId) {
item.slotId = itemData.slotId;
}
return item;
}),
_name: presetData._name,
_parent: presetData._parent,
_type: "Preset"
};
itemPresets[preset._id] = preset;
if (this.instanceManager.debug) {
console.log(` - Added weapon preset: ${preset._name}`);
console.log(` - Preset: ${JSON.stringify(preset)}`);
}
}
}
}
/**
* Processes traders based on the item configuration.
*
* @param {any} itemConfig - The configuration of the item.
* @param {string} itemId - The ID of the item.
* @return {void} This function does not return a value.
*/
processTraders(itemConfig, itemId) {
const tables = this.instanceManager.database;
if (!itemConfig.addtoTraders) {
return;
}
const { traderId, traderItems, barterScheme } = itemConfig;
const traderIdFromMap = configConsts_1.traderIDs[traderId];
const finalTraderId = traderIdFromMap || traderId;
const trader = tables.traders[finalTraderId];
if (!trader) {
return;
}
for (const item of traderItems) {
if (this.instanceManager.debug) {
console.log("Processing traders for item:", itemId);
}
const newItem = {
_id: itemId,
_tpl: itemId,
parentId: "hideout",
slotId: "hideout",
upd: {
UnlimitedCount: item.unlimitedCount,
StackObjectsCount: item.stackObjectsCount
}
};
trader.assort.items.push(newItem);
if (this.instanceManager.debug) {
console.log(`Successfully added item ${itemId} to the trader ${traderId}`);
}
}
trader.assort.barter_scheme[itemId] = [];
for (const scheme of barterScheme) {
if (this.instanceManager.debug) {
console.log("Processing trader barter scheme for item:", itemId);
}
const count = scheme.count;
const tpl = configConsts_2.currencyIDs[scheme._tpl] || items_1.ItemMap[scheme._tpl];
if (!tpl) {
throw new Error(`Invalid _tpl value in barterScheme for item: ${itemId}`);
}
trader.assort.barter_scheme[itemId].push([
{
count: count,
_tpl: tpl
}
]);
if (this.instanceManager.debug) {
console.log(`Successfully added item ${itemId} to the barter scheme of trader ${traderId}`);
}
}
trader.assort.loyal_level_items[itemId] = itemConfig.loyallevelitems;
}
addtoHallofFame(itemConfig, itemId) {
const hallofFame1 = this.instanceManager.database.templates.items["63dbd45917fff4dee40fe16e"];
const hallofFame2 = this.instanceManager.database.templates.items["65424185a57eea37ed6562e9"];
const hallofFame3 = this.instanceManager.database.templates.items["6542435ea57eea37ed6562f0"];
// Add to Hall of Fame filters
if (itemConfig.addtoHallOfFame) {
const hallOfFames = [hallofFame1, hallofFame2, hallofFame3];
for (const hall of hallOfFames) {
for (const slot of hall._props.Slots) {
for (const filter of slot._props.filters) {
if (!filter.Filter.includes(itemId)) {
filter.Filter.push(itemId);
if (this.instanceManager.debug) {
console.log(`Added item ${itemId} to filter Hall of Fame ${hall._name}`);
}
}
}
}
}
}
}
addtoSpecialSlots(itemConfig, itemId) {
const tables = this.instanceManager.database;
if (itemConfig.addtoSpecialSlots) {
const pockets = tables.templates.items["627a4e6b255f7527fb05a0f6"];
for (const slot of pockets._props.Slots) {
if (!slot._props.filters[0].Filter.includes(itemId)) {
slot._props.filters[0].Filter.push(itemId);
}
}
}
}
/**
* Processes the bot inventories based on the given item configuration.
*
* @param {ConfigItem[string]} itemConfig - The item configuration.
* @param {string} finalItemTplToClone - The final item template to clone.
* @param {string} itemId - The item ID.
* @return {void} This function does not return anything.
*/
processBotInventories(itemConfig, finalItemTplToClone, itemId) {
const tables = this.instanceManager.database;
if (!itemConfig.addtoBots)
return;
if (this.instanceManager.debug) {
console.log("Processing bot inventories for item:", itemId);
}
// Iterate through bot types
for (const botId in tables.bots.types) {
const botType = botId;
const botInventory = tables.bots.types[botId].inventory;
botInventory.Ammo = botInventory.Ammo || {};
// Process items and equipment
this.processInventoryType(botInventory.items, finalItemTplToClone, itemId, botType, "items");
this.processInventoryType(botInventory.equipment, finalItemTplToClone, itemId, botType, "equipment");
// Process mods if applicable
if (itemConfig.addtoModSlots && itemConfig.modSlot) {
this.processBotModSlots(finalItemTplToClone, itemId, botType, itemConfig.modSlot);
}
}
}
/**
* Processes inventory type (items or equipment) and gathers mods based on Slots.
*
* @param {any} inventoryType - The inventory type to process.
* @param {string} finalTplToClone - The final item template to clone.
* @param {string} itemId - The item ID.
* @param {string} botType - The bot type identifier.
* @param {string} typeLabel - Label indicating items or equipment.
* @return {void} This function does not return anything.
*/
processInventoryType(
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
inventoryType, finalTplToClone, itemId, botType, typeLabel) {
const tables = this.instanceManager.database;
if (typeLabel === "equipment" && ((inventoryType.FirstPrimaryWeapon?.[finalTplToClone]) ||
(inventoryType.SecondPrimaryWeapon?.[finalTplToClone]) ||
(inventoryType.Holster?.[finalTplToClone]))) {
if (!this.ensureValidWeaponPreset(itemId)) {
return;
}
this.processAmmoAndChambers(tables.bots.types[botType].inventory, tables.templates.items[itemId]._props, itemId, botType);
}
for (const lootSlot in inventoryType) {
const items = inventoryType[lootSlot];
if (items && items[finalTplToClone] !== undefined) {
const weight = items[finalTplToClone];
if (this.instanceManager.debug) {
console.log(` - Adding item to bot ${typeLabel} for bot type: ${botType} in loot slot: ${lootSlot} with weight: ${weight}`);
}
items[itemId] = weight;
this.addModsToItem(tables, itemId, botType);
}
}
}
/**
* Adds mods to an item based on its Slots configuration.
*
* @param {any} tables - The database tables.
* @param {string} itemId - The item ID.
* @param {string} botType - The bot type identifier.
* @return {void} This function does not return anything.
*/
addModsToItem(tables, itemId, botType) {
const itemProps = tables.templates.items[itemId]._props;
if (itemProps?.Slots) {
for (const slot of itemProps.Slots) {
const slotName = slot._name;
const filters = slot._props.filters;
if (filters && filters.length > 0) {
for (const filter of filters) {
for (const modId of filter.Filter) {
if (modId && tables.templates.items[modId]) {
tables.bots.types[botType].inventory.mods[itemId] = tables.bots.types[botType].inventory.mods[itemId] || {};
tables.bots.types[botType].inventory.mods[itemId][slotName] = tables.bots.types[botType].inventory.mods[itemId][slotName] || [];
if (!tables.bots.types[botType].inventory.mods[itemId][slotName].includes(modId)) {
tables.bots.types[botType].inventory.mods[itemId][slotName].push(modId);
if (tables.templates.items[modId]._props) {
if (tables.templates.items[modId]._props.Slots.length > 0) {
this.addModsToItem(tables, modId, botType);
}
}
}
if (this.instanceManager.debug) {
console.log(` - Added mod ${modId} to ${itemId}'s ${slotName} of bot type ${botType}`);
}
}
}
}
}
}
}
}
/**
* Processes mod slots and adds itemId to specified slots if finalItemTplToClone is present.
*
* @param {any} mods - The mods inventory.
* @param {string} finalItemTplToClone - The final item template to clone.
* @param {string} itemId - The item ID.
* @param {string} botType - The bot type identifier.
* @param {string[]} modSlots - The list of mod slots to process.
* @return {void} This function does not return anything.
*/
processBotModSlots(finalItemTplToClone, itemId, botType, modSlots) {
const mods = this.instanceManager.database.bots.types[botType].inventory.mods;
for (const item in mods) {
const itemMods = mods[item];
for (const modSlot of modSlots) {
if (itemMods[modSlot]?.includes(finalItemTplToClone)) {
itemMods[modSlot].push(itemId);
if (this.instanceManager.debug) {
console.log(` - Added item ${itemId} to mod slot ${modSlot} for bot type ${botType} in item ${item}`);
}
// Adding nested mods for the new item
this.addModsToItem(this.instanceManager.database, itemId, botType);
}
}
}
}
/**
* Processes ammo and chambers, adding calibers and chamber filters if needed.
*
* @param {any} botInventory - The bot's inventory.
* @param {any} itemProps - The properties of the item.
* @param {string} itemId - The item ID.
* @param {string} botType - The bot type identifier.
* @return {void} This function does not return anything.
*/
processAmmoAndChambers(botInventory, itemProps, itemId, botType) {
const ammoCaliber = itemProps.ammoCaliber;
if (!ammoCaliber)
return;
botInventory.Ammo[ammoCaliber] = botInventory.Ammo[ammoCaliber] || {};
if (this.instanceManager.debug) {
console.log(` - Added new caliber ${ammoCaliber} to bot inventory for bot type ${botType}`);
}
if (itemProps.Chambers) {
for (const chamber of itemProps.Chambers) {
const filters = chamber._props.filters;
if (filters && filters.length > 0) {
for (const filter of filters) {
for (const filterItem of filter.Filter) {
botInventory.Ammo[ammoCaliber][filterItem] = botInventory.Ammo[ammoCaliber][filterItem] || 0;
if (this.instanceManager.debug) {
console.log(` - Added filter item ${filterItem} to caliber ${ammoCaliber} in bot inventory for bot type ${botType}`);
}
}
}
}
}
}
}
/**
* Ensures the weapon has a valid preset in the global ItemPresets.
*
* @param {string} itemId - The item ID.
* @return {boolean} True if the weapon has a valid preset, false otherwise.
*/
ensureValidWeaponPreset(itemId) {
const db = this.instanceManager.database;
const presets = db.globals.ItemPresets;
for (const presetObj of Object.values(presets)) {
if (presetObj._items[0]._tpl === itemId) {
if (this.instanceManager.debug) {
console.log(` - Valid preset found for item ${itemId}`);
}
return true;
}
}
if (this.instanceManager.debug) {
console.warn(`No valid preset found for item ${itemId} in globals.ItemPresets`);
}
return false;
}
}
exports.CustomItemService = CustomItemService;
//# sourceMappingURL=CustomItemService.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,107 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomWeaponPresets = void 0;
const WeaponPresets_json_1 = __importDefault(require("../db/CustomWeaponPresets/WeaponPresets.json"));
const path = __importStar(require("node:path"));
const modPath = path.normalize(path.join(__dirname, ".."));
const weaponPresets = WeaponPresets_json_1.default;
class CustomWeaponPresets {
Instance;
preSptLoad(Instance) {
this.Instance = Instance;
}
postDBLoad() {
if (weaponPresets.ItemPresets) {
this.addWeaponPresets();
this.addWeaponPresetLocales();
}
else {
if (this.Instance.debug) {
console.log("CustomWeaponPresets: ItemPresets not found in weaponPresets.json");
}
}
}
addWeaponPresets() {
for (const preset in weaponPresets.ItemPresets) {
this.Instance.database.globals.ItemPresets[preset] = weaponPresets.ItemPresets[preset];
}
}
addWeaponPresetLocales() {
const serverLocales = ["ch", "cz", "en", "es", "es-mx", "fr", "ge", "hu", "it", "jp", "kr", "pl", "po", "ru", "sk", "tu"];
const addedLocales = {};
for (const locale of serverLocales) {
let localeFile;
try {
// Attempt to require the locale file
localeFile = require(`${modPath}/db/locales/${locale}.json`);
}
catch (error) {
// Log an error if the file cannot be found, but continue to the next iteration
if (this.Instance.debug) {
console.error(`Error loading locale file for '${locale}':`, error);
}
continue;
}
// Proceed with adding locales if the file was successfully loaded
if (Object.keys(localeFile).length < 1)
continue;
for (const currentItem in localeFile) {
this.Instance.database.locales.global[locale][currentItem] = localeFile[currentItem];
if (!addedLocales[locale])
addedLocales[locale] = {};
addedLocales[locale][currentItem] = localeFile[currentItem];
}
}
// Placeholders
for (const locale of serverLocales) {
if (locale === "en")
continue;
const englishItems = addedLocales["en"];
if (!(locale in addedLocales)) {
for (const englishItem in englishItems) {
if (this.Instance.database.locales.global[locale] && !(englishItem in this.Instance.database.locales.global[locale])) {
this.Instance.database.locales.global[locale][englishItem] = englishItems[englishItem];
}
}
}
}
}
}
exports.CustomWeaponPresets = CustomWeaponPresets;
//# sourceMappingURL=CustomWeaponPresets.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "CustomWeaponPresets.js",
"sourceRoot": "",
"sources": [
"CustomWeaponPresets.ts"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,sGAA6E;AAC7E,gDAAkC;AAElC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;AAM3D,MAAM,aAAa,GAAkB,4BAAiB,CAAC;AAEvD,MAAa,mBAAmB;IACpB,QAAQ,CAAqB;IAE9B,UAA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}

View file

@ -0,0 +1,187 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.epicItemClass = void 0;
const WTTInstanceManager_1 = require("./WTTInstanceManager");
class epicItemClass {
Instance = new WTTInstanceManager_1.WTTInstanceManager(); // Based upon EpicRangeTime's edits. Cheers, epic! --Maple
preSptLoad(Instance) {
this.Instance = Instance;
}
postDBLoad() {
this.epicEdits();
}
epicEdits() {
const db = this.Instance.database;
const dbItems = db.templates.items;
for (let file in dbItems) {
let fileData = dbItems[file];
if (fileData._id === "5d25a6538abbc306c62e630d") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5d25a4a98abbc30b917421a4") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5d25a7b88abbc3054f3e60bc") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5ce69cbad7f00c00b61c5098") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5d25a6a48abbc306c62e6310") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5d25af8f8abbc3055079fec5") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5cf12a15d7f00c05464b293f") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5bfeaa0f0db834001b734927") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5bfea7ad0db834001c38f1ee") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5df8f535bb49d91fb446d6b0") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "5df8f541c41b2312ea3335e3") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "5a3501acc4a282000d72293a") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "65293c38fc460e50a509cb25") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "65293c7a17e14363030ad308") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "6761770e48fa5c377e06fc3c") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "683997f125039545c12878e9") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to L7AWM Retextured Mags
if (fileData._id === "683998905b1e1abba12906fa") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to L7AWM Retextured Mags
if (fileData._id === "683998a2a3d4391d033bfd14") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to L7AWM Retextured Mags
if (fileData._id === "683998dc60787632112a564b") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683246a74073e586d112af9f", "68325a63730b17c69ee176eb", "6833baea86387d71b68abd6f", "6833bae4baa31474639bea7d", "6833ba38a1c9ff155c04e56f", "6833b8cb54aa764b2deefdfe", "6834e6f28f5570aec23ca0c2");
} //Pushing 6.5x48mm to L7AWM Retextured Mags
if (fileData._id === "5d25a6538abbc306c62e630d") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5d25a4a98abbc30b917421a4") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5d25a7b88abbc3054f3e60bc") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5ce69cbad7f00c00b61c5098") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5d25a6a48abbc306c62e6310") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5d25af8f8abbc3055079fec5") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5cf12a15d7f00c05464b293f") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5bfeaa0f0db834001b734927") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5bfea7ad0db834001c38f1ee") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to M700 Mags
if (fileData._id === "5df8f535bb49d91fb446d6b0") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "5df8f541c41b2312ea3335e3") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "5a3501acc4a282000d72293a") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "65293c38fc460e50a509cb25") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "65293c7a17e14363030ad308") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "6761770e48fa5c377e06fc3c") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to SR-25 Mags
if (fileData._id === "683997f125039545c12878e9") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to L7AWM Retextured Mags
if (fileData._id === "683998905b1e1abba12906fa") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to L7AWM Retextured Mags
if (fileData._id === "683998a2a3d4391d033bfd14") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to L7AWM Retextured Mags
if (fileData._id === "683998dc60787632112a564b") {
fileData._props.Cartridges[0]._props.filters[0].Filter.push("683d1ec4f7164f4f77ea7a85", "683d1e142cee4317689e75e4", "683d1ba7b5a2063de35a8c39");
} //Pushing 6.5x48mm to L7AWM Retextured Mags
if (fileData._id === "5fbbfacda56d053a3543f799") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68343b29f48104d3a6265db3", "68343c10334d72dc0066a8f3");
} //Pushing Smoke Stack Suppressor to .300BLK
if (fileData._id === "5fbbfabed5cb881a7363194e") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68343b29f48104d3a6265db3", "68343c10334d72dc0066a8f3");
} //Pushing Smoke Stack Suppressor to .300BLK
if (fileData._id === "5fbbfacda56d053a3543f799") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68395bb9f92a92ea0555e4a1", "68395c7abb2e79c208842d7e", "56ea6fafd2720b844b8b4593");
} //Pushing Noveske KX3 to .300BLK (5/8"x24)
if (fileData._id === "5fbbfabed5cb881a7363194e") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68395bb9f92a92ea0555e4a1", "68395c7abb2e79c208842d7e", "56ea6fafd2720b844b8b4593");
} //Pushing Noveske KX3 to .300BLK (5/8"x24)
if (fileData._id === "652910565ae2ae97b80fdf35") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68395bb9f92a92ea0555e4a1", "68395c7abb2e79c208842d7e", "56ea6fafd2720b844b8b4593");
} //Pushing Noveske KX3 to 6.8 (5/8"x24)
if (fileData._id === "5dcbe9431e1f4616d354987e") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68395bb9f92a92ea0555e4a1", "68395c7abb2e79c208842d7e", "56ea6fafd2720b844b8b4593");
} //Pushing Noveske KX3 to 308 MDR (5/8"x24)
if (fileData._id === "6183b084a112697a4b3a6e6c") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68395bb9f92a92ea0555e4a1", "68395c7abb2e79c208842d7e", "56ea6fafd2720b844b8b4593");
} //Pushing Noveske KX3 to SCAR-H (5/8"x24)
if (fileData._id === "618168b350224f204c1da4d8") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68395bb9f92a92ea0555e4a1", "68395c7abb2e79c208842d7e", "56ea6fafd2720b844b8b4593");
} //Pushing Noveske KX3 to SCAR-H (5/8"x24)
if (fileData._id === "6183b0711cb55961fa0fdcad") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68395bb9f92a92ea0555e4a1", "68395c7abb2e79c208842d7e", "56ea6fafd2720b844b8b4593");
} //Pushing Noveske KX3 to SCAR-H (5/8"x24)
if (fileData._id === "5bfebc320db8340019668d79") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68395bb9f92a92ea0555e4a1", "68395c7abb2e79c208842d7e", "56ea6fafd2720b844b8b4593");
} //Pushing Noveske KX3 to M700 (5/8"x24)
if (fileData._id === "5d2703038abbc3105103d94c") {
fileData._props.Slots[0]._props.filters[0].Filter.push("68395bb9f92a92ea0555e4a1", "68395c7abb2e79c208842d7e", "56ea6fafd2720b844b8b4593");
} //Pushing Noveske KX3 to M700 (5/8"x24)
if (fileData._id === "63dbd45917fff4dee40fe16e") {
fileData._props.Slots[9]._props.filters[0].Filter.push("683b619a7d4aa2d4645e369e");
} //Pushing large barters to large trophy case
if (fileData._id === "63dbd45917fff4dee40fe16e") {
fileData._props.Slots[10]._props.filters[0].Filter.push("683b619a7d4aa2d4645e369e");
} //Pushing large barters to large trophy case
if (fileData._id === "63dbd45917fff4dee40fe16e") {
fileData._props.Slots[11]._props.filters[0].Filter.push("683b619a7d4aa2d4645e369e");
} //Pushing large barters to large trophy case
if (fileData._id === "63dbd45917fff4dee40fe16e") {
fileData._props.Slots[12]._props.filters[0].Filter.push("683b619a7d4aa2d4645e369e");
} //Pushing large barters to large trophy case
if (fileData._id === "63dbd45917fff4dee40fe16e") {
fileData._props.Slots[13]._props.filters[0].Filter.push("683b619a7d4aa2d4645e369e");
} //Pushing large barters to large trophy case
if (fileData._id === "63dbd45917fff4dee40fe16e") {
fileData._props.Slots[14]._props.filters[0].Filter.push("683b619a7d4aa2d4645e369e");
} //Pushing large barters to large trophy case
}
}
}
exports.epicItemClass = epicItemClass;
//# sourceMappingURL=EpicsEdits.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,208 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuestModifier = void 0;
class QuestModifier {
instanceManager;
preSptLoad(Instance) {
this.instanceManager = Instance;
}
postDBLoad() {
this.modifyQuests();
}
// Helper method to update items in all AvailableForFinish conditions
updateItemsInAllAvailableForFinish(questID, items, type) {
const quest = this.instanceManager.database.templates.quests[questID];
if (quest) {
try {
const availableForFinish = quest.conditions.AvailableForFinish;
let modified = false;
for (const conditionGroup of availableForFinish) {
const conditions = conditionGroup.counter.conditions[0];
if (type === 'weapon') {
const existingWeapons = this.instanceManager.jsonUtil.clone(conditions.weapon || []);
const updatedWeapons = new Set(existingWeapons);
for (const weapon of items) {
if (!updatedWeapons.has(weapon)) {
updatedWeapons.add(weapon);
modified = true;
if (this.instanceManager.debug) {
console.log(`Added new weapon ${weapon} to AvailableForFinish condition in quest ${questID}`);
}
}
else if (this.instanceManager.debug) {
console.log(`AvailableForFinish condition in quest ${questID} already has the weapon ${weapon}`);
}
}
if (modified) {
conditions.weapon = Array.from(updatedWeapons);
if (this.instanceManager.debug) {
console.log(`Modified AvailableForFinish conditions in quest ${questID}:`, conditions.weapon);
}
}
}
else if (type === 'weaponModsInclusive' || type === 'weaponModsExclusive') {
const existingWeaponModsInclusive = this.instanceManager.jsonUtil.clone(conditions.weaponModsInclusive || []);
const updatedWeaponModsInclusive = new Set(existingWeaponModsInclusive.flat());
for (const weaponModArray of items) {
for (const weaponMod of weaponModArray) {
if (!updatedWeaponModsInclusive.has(weaponMod)) {
updatedWeaponModsInclusive.add(weaponMod);
modified = true;
if (this.instanceManager.debug) {
console.log(`Added new weapon mod ${weaponMod} to AvailableForFinish condition in quest ${questID}`);
}
}
else if (this.instanceManager.debug) {
console.log(`AvailableForFinish condition in quest ${questID} already has the weapon mod ${weaponMod}`);
}
}
}
if (modified) {
conditions.weaponModsInclusive = Array.from(updatedWeaponModsInclusive).map(mod => [mod]);
if (this.instanceManager.debug) {
console.log(`Modified AvailableForFinish conditions in quest ${questID}:`, conditions.weaponModsInclusive);
}
}
}
}
}
catch (error) {
console.error(`Error modifying items in AvailableForFinish conditions for quest ${questID}:`, error);
}
}
else {
console.warn(`Quest with ID ${questID} not found.`);
}
}
// Method to update quest data based on type, optionally push to all AvailableForFinish
updateQuestData(questID, items, type, pushToAllAvailableForFinish, availableForFinishIndex = 0 // New parameter to specify the index
) {
if (pushToAllAvailableForFinish) {
this.updateItemsInAllAvailableForFinish(questID, items, type);
}
else {
const quest = this.instanceManager.database.templates.quests[questID];
if (quest) {
if (type === 'weapon') {
this.updateQuestWeapons(questID, items, availableForFinishIndex // Pass the index to the helper method
);
}
else if (type === 'weaponModsInclusive' || type === 'weaponModsExclusive') {
this.updateQuestWeaponMods(questID, items, availableForFinishIndex // Pass the index to the helper method
);
}
}
else {
console.warn(`Quest with ID ${questID} not found.`);
}
}
}
// Method to update weapons in the quest
updateQuestWeapons(questID, weapons, availableForFinishIndex = 0 // New parameter to specify the index
) {
const quest = this.instanceManager.database.templates.quests[questID];
if (quest) {
try {
// Extract existing weapons based on the specified index
const existingWeapons = quest.conditions.AvailableForFinish[availableForFinishIndex].counter.conditions[0].weapon;
// Clone the existing weapons array
const updatedWeapons = this.instanceManager.jsonUtil.clone(existingWeapons);
let modified = false;
// Add new weapons if they do not already exist
for (const weapon of weapons) {
if (!updatedWeapons.includes(weapon)) {
updatedWeapons.push(weapon);
modified = true;
if (this.instanceManager.debug) {
console.log(`Added new weapon ${weapon} to quest ${questID}`);
}
}
else if (this.instanceManager.debug) {
console.log(`Quest ${questID} already has the weapon ${weapon}`);
}
}
// Only update the quest if modifications were made
if (modified) {
quest.conditions.AvailableForFinish[availableForFinishIndex].counter.conditions[0].weapon = updatedWeapons;
if (this.instanceManager.debug) {
console.log(`Modified quest ${questID}:`, updatedWeapons);
}
}
}
catch (error) {
console.error(`Error modifying quest ${questID} weapons:`, error);
}
}
else {
console.warn(`Quest with ID ${questID} not found.`);
}
}
// Method to update weapon mods inclusive in the quest
updateQuestWeaponMods(questID, weaponModsInclusive, availableForFinishIndex = 0 // New parameter to specify the index
) {
const quest = this.instanceManager.database.templates.quests[questID];
if (quest) {
try {
// Extract existing weapon mods inclusive based on the specified index
const availableForFinish = quest.conditions.AvailableForFinish;
if (availableForFinish.length <= availableForFinishIndex) {
console.warn(`Index ${availableForFinishIndex} is out of bounds for AvailableForFinish in quest ${questID}.`);
return;
}
const existingWeaponModsInclusive = availableForFinish[availableForFinishIndex].counter.conditions[0].weaponModsInclusive;
// Clone the existing weapon mods inclusive array
const updatedWeaponModsInclusive = this.instanceManager.jsonUtil.clone(existingWeaponModsInclusive);
let modified = false;
// Add new weapon mods if they do not already exist
for (const weaponModArray of weaponModsInclusive) {
for (const weaponMod of weaponModArray) {
if (!updatedWeaponModsInclusive.flat().includes(weaponMod)) {
updatedWeaponModsInclusive.push(weaponModArray);
modified = true;
if (this.instanceManager.debug) {
console.log(`Added new weapon mod ${weaponMod} to quest ${questID}`);
}
}
else if (this.instanceManager.debug) {
console.log(`Quest ${questID} already has the weapon mod ${weaponMod}`);
}
}
}
// Only update the quest if modifications were made
if (modified) {
availableForFinish[availableForFinishIndex].counter.conditions[0].weaponModsInclusive = updatedWeaponModsInclusive;
if (this.instanceManager.debug) {
console.log(`Modified quest ${questID}:`, updatedWeaponModsInclusive);
}
}
}
catch (error) {
console.error(`Error modifying quest ${questID} weapon mods inclusive:`, error);
}
}
else {
console.warn(`Quest with ID ${questID} not found.`);
}
}
// Method to modify quests with specific items and updates
modifyQuests() {
// Define new items
const newAKs = [
"0cb4a36dd2e587b46e813dbe"
];
const newCarbinesandAssaultRifles = [
"0cb4a36dd2e587b46e813dbe"
];
// Update each quest individually with specific items
this.updateQuestData("61e6e60223374d168a4576a6", // Compensation for damage - wager
newAKs, 'weapon', false, 0);
this.updateQuestData("64e7b9bffd30422ed03dad38", // Gendarmerie district patrol
newCarbinesandAssaultRifles, 'weapon', false, 0);
// Debug output
if (this.instanceManager.debug) {
console.log('Updated quests with new items.');
}
}
}
exports.QuestModifier = QuestModifier;
//# sourceMappingURL=QuestModifier.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.References = void 0;
class References {
modName;
debug;
container;
preSptModLoader;
configServer;
saveServer;
itemHelper;
logger;
staticRouter;
onUpdateModService;
database;
customItem;
imageRouter;
jsonUtil;
profileHelper;
ragfairPriceService;
importerUtil;
tables;
botHelper;
randomUtil;
hashUtil;
probHelper;
traderHelper;
botController;
httpResponse;
preSptLoad(container) {
this.container = container;
this.preSptModLoader = container.resolve("PreSptModLoader");
this.imageRouter = container.resolve("ImageRouter");
this.configServer = container.resolve("ConfigServer");
this.saveServer = container.resolve("SaveServer");
this.itemHelper = container.resolve("ItemHelper");
this.logger = container.resolve("WinstonLogger");
this.staticRouter = container.resolve("StaticRouterModService");
this.onUpdateModService = container.resolve("OnUpdateModService");
this.randomUtil = container.resolve("RandomUtil");
this.database = container.resolve("DatabaseServer");
this.tables = container.resolve("DatabaseServer").getTables();
this.customItem = container.resolve("CustomItemService");
this.jsonUtil = container.resolve("JsonUtil");
this.profileHelper = container.resolve("ProfileHelper");
this.ragfairPriceService = container.resolve("RagfairPriceService");
this.importerUtil = container.resolve("ImporterUtil");
this.botHelper = container.resolve("BotHelper");
this.hashUtil = container.resolve("HashUtil");
this.probHelper = container.resolve("ProbabilityHelper");
this.traderHelper = container.resolve("TraderHelper");
this.botController = container.resolve("BotController");
this.httpResponse = container.resolve("HttpResponseUtil");
}
postDBLoad(container) {
this.container = container;
this.database = container.resolve("DatabaseServer");
this.imageRouter = container.resolve("ImageRouter");
this.logger = container.resolve("WinstonLogger");
this.tables = container.resolve("DatabaseServer").getTables();
this.customItem = container.resolve("CustomItemService");
this.jsonUtil = container.resolve("JsonUtil");
this.profileHelper = container.resolve("ProfileHelper");
this.ragfairPriceService = container.resolve("RagfairPriceService");
this.importerUtil = container.resolve("ImporterUtil");
this.botHelper = container.resolve("BotHelper");
this.randomUtil = container.resolve("RandomUtil");
this.itemHelper = container.resolve("ItemHelper");
this.hashUtil = container.resolve("HashUtil");
this.probHelper = container.resolve("ProbabilityHelper");
this.botController = container.resolve("BotController");
this.httpResponse = container.resolve("HttpResponseUtil");
}
}
exports.References = References;
//# sourceMappingURL=References.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "References.js",
"sourceRoot": "",
"sources": [
"References.ts"
],
"names": [],
"mappings": ";;;AAyBA,MAAa,UAAU;IACf,OAAO,CAAQ;IACf,KAAK,CAAS;IAEd,SAAS,CAAqB;IAC9B,eAAe,CAAiB;IAChC,YAAY,CAAc;IAC1B,UAAU,CAAY;IACtB,UAAU,CAAY;IACtB,MAAM,CAAS;IACf,YAAY,CAAwB;IACpC,kBAAkB,CAAoB;IAEtC,QAAQ,CAAgB;IACxB,UAAU,CAAmB;IAC7B,WAAW,CAAa;IACxB,QAAQ,CAAU;IAClB,aAAa,CAAe;IAC5B,mBAAmB,CAAqB;IACxC,YAAY,CAAc;IAC1B,MAAM,CAAiB;IACvB,SAAS,CAAW;IACpB,UAAU,CAAY;IACtB,QAAQ,CAAU;IAClB,UAAU,CAAmB;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AAsB,qBAAqB,CAAC,CAAA;QACxF,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,OAAO,CAAe,cAAc,CAAC,CAAA;QACnE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAY,WAAW,CAAC,CAAA;QAC1D,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAa,YAAY,CAAC,CAAA;QAC7D,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAa,YAAY,CAAC,CAAA;QAC7D,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAW,UAAU,CAAC,CAAA;QACvD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAoB,mBAAmB,CAAC,CAAA;QAC3E,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC,OAAO,CAAgB,eAAe,CAAC,CAAA;QACtE,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,OAAO,CAAmB,kBAAkB,CAAC,CAAA;IAC5E,CAAC;CACD;AA1ED,gCA0EC"
}

View file

@ -0,0 +1,75 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TraderUtils = void 0;
class TraderUtils {
/**
* Add profile picture to our trader
* @param baseJson json file for trader (db/base.json)
* @param preAkiModLoader mod loader class - used to get the mods file path
* @param imageRouter image router class - used to register the trader image path so we see their image on trader page
* @param traderImageName Filename of the trader icon to use
*/
registerProfileImage(baseJson, modName, preSptModLoader, imageRouter, traderImageName) {
// Reference the mod "res" folder
const imageFilepath = `./${preSptModLoader.getModPath(modName)}res`;
// Register a route to point to the profile picture - remember to remove the .jpg from it
imageRouter.addRoute(baseJson.avatar.replace(".jpg", ".png"), `${imageFilepath}/${traderImageName}`);
}
/**
* 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
*/
setTraderUpdateTime(traderConfig, baseJson, minSeconds, maxSeconds) {
const traderRefreshRecord = {
traderId: baseJson._id,
seconds: {
min: minSeconds,
max: maxSeconds,
},
};
traderConfig.updateTime.push(traderRefreshRecord);
}
/**
* Add our new trader to the database
* @param traderDetailsToAdd trader details
* @param tables database
* @param jsonUtil json utility class
*/
// rome-ignore lint/suspicious/noExplicitAny: traderDetailsToAdd comes from base.json, so no type
addTraderToDb(traderDetailsToAdd, assort, tables, jsonUtil) {
tables.traders[traderDetailsToAdd._id] = {
assort: jsonUtil.deserialize(jsonUtil.serialize(assort)),
base: jsonUtil.deserialize(jsonUtil.serialize(traderDetailsToAdd)),
questassort: {
started: {},
success: {},
fail: {},
},
};
}
/**
* Add traders name/location/description to the locale table
* @param baseJson json file for trader (db/base.json)
* @param tables database tables
* @param fullName Complete name of trader
* @param firstName First name of trader
* @param nickName Nickname of trader
* @param location Location of trader (e.g. "Here in the cat shop")
* @param description Description of trader
*/
addTraderToLocales(baseJson, tables, fullName, firstName, nickName, location, description) {
// For each language, add locale for the new trader
const locales = Object.values(tables.locales.global);
for (const locale of locales) {
locale[`${baseJson._id} FullName`] = fullName;
locale[`${baseJson._id} FirstName`] = firstName;
locale[`${baseJson._id} Nickname`] = nickName;
locale[`${baseJson._id} Location`] = location;
locale[`${baseJson._id} Description`] = description;
}
}
}
exports.TraderUtils = TraderUtils;
//# sourceMappingURL=Utils.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "Utils.js",
"sourceRoot": "",
"sources": [
"Utils.ts"
],
"names": [],
"mappings": ";;;AAOA,MAAa,WAAW;IACvB;;;;;;OAMG;IACI,oBAAoB,CAAC,QAAa,EAAE,OAAe,EAAE,eAAgC,EAAE,WAAwB,EAAE,eAAuB;QAC9I,iCAAiC;QACjC,MAAM,aAAa,GAAG,KAAK,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAA;QAEnE,yFAAyF;QACzF,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC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,GAAG,YAAY,CAAC,GAAG,SAAS,CAAA;YAC/C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAG,QAAQ,CAAA;YAC7C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAG,QAAQ,CAAA;YAC7C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,cAAc,CAAC,GAAG,WAAW,CAAA;QACpD,CAAC;IACF,CAAC;CACD;AAjFD,kCAiFC"
}

View file

@ -0,0 +1,119 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.WTTInstanceManager = void 0;
const path = __importStar(require("node:path"));
class WTTInstanceManager {
//#region Accessible in or after preSptLoad
modName;
debug;
// Useful Paths
profilePath = path.join(process.cwd(), "\\user\\profiles");
dbPath = path.join(__dirname, "../db");
// Instances
container;
PreSptModLoader;
configServer;
saveServer;
itemHelper;
logger;
staticRouter;
dynamicRouter;
profileController;
profileCallbacks;
//#endregion
//#region Acceessible in or after postDBLoad
database;
customItem;
imageRouter;
jsonUtil;
profileHelper;
eventOutputHolder;
ragfairPriceService;
importerUtil;
traderAssortService;
applicationContext;
//#endregion
// Call at the start of the mods postDBLoad method
preSptLoad(container, mod) {
this.modName = mod;
this.container = container;
this.PreSptModLoader = container.resolve("PreSptModLoader");
this.imageRouter = container.resolve("ImageRouter");
this.configServer = container.resolve("ConfigServer");
this.saveServer = container.resolve("SaveServer");
this.itemHelper = container.resolve("ItemHelper");
this.eventOutputHolder = container.resolve("EventOutputHolder");
this.profileController = container.resolve("ProfileController");
this.profileCallbacks = container.resolve("ProfileCallbacks");
this.logger = container.resolve("WinstonLogger");
this.staticRouter = container.resolve("StaticRouterModService");
this.dynamicRouter = container.resolve("DynamicRouterModService");
this.traderAssortService = container.resolve("TraderAssortService");
}
postDBLoad(container) {
this.database = container.resolve("DatabaseServer").getTables();
this.customItem = container.resolve("CustomItemService");
this.jsonUtil = container.resolve("JsonUtil");
this.profileHelper = container.resolve("ProfileHelper");
this.ragfairPriceService = container.resolve("RagfairPriceService");
this.importerUtil = container.resolve("ImporterUtil");
this.applicationContext = container.resolve("ApplicationContext");
}
colorLog(message, color) {
const colorCodes = {
red: "\x1b[31m",
green: "\x1b[32m",
yellow: "\x1b[33m",
blue: "\x1b[34m",
magenta: "\x1b[35m",
cyan: "\x1b[36m",
white: "\x1b[37m",
gray: "\x1b[90m",
brightRed: "\x1b[91m",
brightGreen: "\x1b[92m",
brightYellow: "\x1b[93m",
brightBlue: "\x1b[94m",
brightMagenta: "\x1b[95m",
brightCyan: "\x1b[96m",
brightWhite: "\x1b[97m"
};
const resetCode = "\x1b[0m";
const colorCode = colorCodes[color] || "\x1b[37m"; // Default to white if color is invalid.
//console.log(`${colorCode}${message}${resetCode}`); // Log the colored message here
}
}
exports.WTTInstanceManager = WTTInstanceManager;
//# sourceMappingURL=WTTInstanceManager.js.map

View file

@ -0,0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AAO,CAAqB,oBAAoB,CAAC,CAAC;IAE1F,CAAC;IAEM,QAAQ,CAAC,OAAe,EAAE,KAAa;QAC1C,MAAM,UAAU,GAAG;YACf,GAAG,EAAE,UAAU;YACf,KAAK,EAAE,UAAU;YACjB,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,UAAU;YACrB,WAAW,EAAE,UAAU;YACvB,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,UAAU;YACtB,aAAa,EAAE,UAAU;YACzB,UAAU,EAAE,UAAU;YACtB,WAAW,EAAE,UAAU;SAC1B,CAAC;QAEF,MAAM,SAAS,GAAG,SAAS,CAAC;QAC5B,MAAM,SAAS,GAAG,UAAU,CAAC,KAAgC,CAAC,IAAI,UAAU,CAAC,CAAC,wCAAwC;QACtH,oFAAoF;IACxF,CAAC;CACJ;AA5FD,gDA4FC"
}

View file

@ -0,0 +1,91 @@
"use strict";
/* eslint-disable @typescript-eslint/naming-convention */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
// WTT / Viper Item Imports
const WTTInstanceManager_1 = require("./WTTInstanceManager");
const EpicsEdits_1 = require("./EpicsEdits");
const CustomItemService_1 = require("./CustomItemService");
const CustomAssortSchemeService_1 = require("./CustomAssortSchemeService");
const CustomWeaponPresets_1 = require("./CustomWeaponPresets");
// Trader Imports
const References_1 = require("./Refs/References");
class EchoesOfTarkovMod {
modName = "Echoes of Tarkov - Requisitions & hoser";
version;
debug = false;
// WTT-related Services
Instance = new WTTInstanceManager_1.WTTInstanceManager();
customItemService = new CustomItemService_1.CustomItemService();
customAssortSchemeService = new CustomAssortSchemeService_1.CustomAssortSchemeService();
customWeaponPresets = new CustomWeaponPresets_1.CustomWeaponPresets();
epicItemClass = new EpicsEdits_1.epicItemClass();
// Trader-related Services
ref = new References_1.References();
preSptLoad(container) {
// WTT Initializations
this.Instance.preSptLoad(container, this.modName);
this.Instance.debug = this.debug;
this.getVersionFromJson();
this.customItemService.preSptLoad(this.Instance);
this.customAssortSchemeService.preSptLoad(this.Instance);
this.customWeaponPresets.preSptLoad(this.Instance);
this.epicItemClass.preSptLoad(this.Instance);
}
postDBLoad(container) {
// WTT Initializations
this.Instance.postDBLoad(container);
console.log(`\x1b[94m[Echoes of Tarkov] \x1b[93m Requisitions Loaded | Got something I'm supposed to deliver - your hands only.`);
this.customItemService.postDBLoad();
this.customAssortSchemeService.postDBLoad();
this.customWeaponPresets.postDBLoad();
this.epicItemClass.postDBLoad();
}
getVersionFromJson() {
const packageJsonPath = path.join(__dirname, "../package.json");
fs.readFile(packageJsonPath, "utf-8", (err, data) => {
if (err) {
console.error("Error reading file:", err);
return;
}
const jsonData = JSON.parse(data);
this.version = jsonData.version;
});
}
}
module.exports = { mod: new EchoesOfTarkovMod() };
//# sourceMappingURL=mod.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "mod.js",
"sourceRoot": "",
"sources": [
"mod.ts"
],
"names": [],
"mappings": ";AAAA,yDAAyD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzD,uCAAyB;AACzB,2CAA6B;AAS7B,2BAA2B;AAC3B,6DAA0D;AAC1D,6CAA6C;AAC7C,2DAAwD;AACxD,2EAAwE;AACxE,+DAA4D;AAE5D,iBAAiB;AACjB,kDAA+C;AAM/C,MAAM,iBAAiB;IACd,OAAO,GAAG,yCAAyC,CAAC;IACpD,OAAO,CAAS;IAChB,KAAK,GAAG,KAAK,CAAC;IAEtB,uBAAuB;IACf,QAAQ,GAAuB,IAAI,uCAAkB,EAAE,CAAC;IACxD,iBAAiB,GAAsB,IAAI,qCAAiB,EAAE,CAAC;IAC/D,yBAAyB,GAA8B,IAAI,qDAAyB,EAAE,CAAC;IACvF,mBAAmB,GAAwB,IAAI,yCAAmB,EAAE,CAAC;IACrE,aAAa,GAAkB,IAAI,0BAAa,EAAE,CAAC;IAE3D,0BAA0B;IAClB,GAAG,GAAe,IAAI,uBAAU,EAAE,CAAC;IAEpC,UAAU,CAAC,SAA8B;QAC/C,sBAAsB;QACtB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAE1B,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,yBAAyB,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzD,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAEM,UAAU,CAAC,SAA8B;QAC/C,sBAAsB;QACtB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAEpC,OAAO,CAAC,GAAG,CAAC,oHAAoH,CAAC,CAAC;QAElI,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,CAAC;QACpC,IAAI,CAAC,yBAAyB,CAAC,UAAU,EAAE,CAAC;QAC5C,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;IAIjC,CAAC;IAEO,kBAAkB;QACzB,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;QAEhE,EAAE,CAAC,QAAQ,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACnD,IAAI,GAAG,EAAE,CAAC;gBACT,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;gBAC1C,OAAO;YACR,CAAC;YACD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAClC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;QACjC,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,GAAG,EAAE,IAAI,iBAAiB,EAAE,EAAE,CAAC"
}

View file

@ -0,0 +1,92 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stashes = exports.inventorySlots = exports.allBotTypes = exports.currencyIDs = exports.traderIDs = void 0;
;
// Traders and Task related items
//#region Enums
var traderIDs;
(function (traderIDs) {
traderIDs["MECHANIC"] = "5a7c2eca46aef81a7ca2145d";
traderIDs["SKIER"] = "58330581ace78e27b8b10cee";
traderIDs["PEACEKEEPER"] = "5935c25fb3acc3127c3d8cd9";
traderIDs["THERAPIST"] = "54cb57776803fa99248b456e";
traderIDs["PRAPOR"] = "54cb50c76803fa8b248b4571";
traderIDs["JAEGAR"] = "5c0647fdd443bc2504c2d371";
traderIDs["RAGMAN"] = "5ac3b934156ae10c4430e83c";
traderIDs["FENCE"] = "579dc571d53a0658a154fbec";
traderIDs["GOBLINKING"] = "GoblinKing";
traderIDs["CONDUCTOR"] = "Conductor";
traderIDs["COURIER"] = "Courier";
traderIDs["CROW"] = "Crow";
traderIDs["WOLF"] = "Wolf";
traderIDs["JUNKDEALER"] = "JunkDealer";
traderIDs["WTTDATABASE"] = "WTTDatabase";
})(traderIDs || (exports.traderIDs = traderIDs = {}));
var currencyIDs;
(function (currencyIDs) {
currencyIDs["ROUBLES"] = "5449016a4bdc2d6f028b456f";
currencyIDs["EUROS"] = "569668774bdc2da2298b4568";
currencyIDs["DOLLARS"] = "5696686a4bdc2da3298b456a";
})(currencyIDs || (exports.currencyIDs = currencyIDs = {}));
var allBotTypes;
(function (allBotTypes) {
allBotTypes["ARENAFIGHTER"] = "arenafighter";
allBotTypes["ARENAFIGHTEREVENT"] = "arenafighterevent";
allBotTypes["ASSAULT"] = "assault";
allBotTypes["BEAR"] = "bear";
allBotTypes["RESHALA"] = "bossbully";
allBotTypes["GLUHAR"] = "bossgluhar";
allBotTypes["KILLA"] = "bosskilla";
allBotTypes["KNIGHT"] = "bossknight";
allBotTypes["SHTURMAN"] = "bosskojaniy";
allBotTypes["SANITAR"] = "bosssanitar";
allBotTypes["TAGILLA"] = "bosstagilla";
allBotTypes["ZRYACHIY"] = "bosszryachiy";
allBotTypes["CRAZYASSAULTEVENT"] = "crazyassaultevent";
allBotTypes["CURSEDASSAULT"] = "cursedassault";
allBotTypes["EXUSEC"] = "exusec";
allBotTypes["FOLLOWERBIGPIPE"] = "followerbigpipe";
allBotTypes["FOLLOWERBIRDEYE"] = "followerbirdeye";
allBotTypes["FOLLOWERRESHALA"] = "followerbully";
allBotTypes["FOLLOWERGLUHARASSAULT"] = "followergluharassault";
allBotTypes["FOLLOWERGLUHARSCOUT"] = "followergluharscout";
allBotTypes["FOLLOWERGLUHARSECURITY"] = "followergluharsecurity";
allBotTypes["FOLLOWERGLUHARSNIPER"] = "followergluharsnipe";
allBotTypes["FOLLOWERSHTURMAN"] = "followerkojaniy";
allBotTypes["FOLLOWERSANITAR"] = "followersanitar";
allBotTypes["FOLLOWERTAGILLA"] = "followertagilla";
allBotTypes["FOLLOWERZRYACHIY"] = "followerzryachiy";
allBotTypes["GIFTER"] = "gifter";
allBotTypes["MARKSMAN"] = "marksman";
allBotTypes["PMC"] = "pmcbot";
allBotTypes["CULTISTPRIEST"] = "sectantpriest";
allBotTypes["CULTISTWARRIOR"] = "sectantwarrior";
allBotTypes["USEC"] = "usec";
})(allBotTypes || (exports.allBotTypes = allBotTypes = {}));
var inventorySlots;
(function (inventorySlots) {
inventorySlots["FirstPrimaryWeapon"] = "55d729c64bdc2d89028b4570";
inventorySlots["SecondPrimaryWeapon"] = "55d729d14bdc2d86028b456e";
inventorySlots["Holster"] = "55d729d84bdc2de3098b456b";
inventorySlots["Scabbard"] = "55d729e34bdc2d1b198b456d";
inventorySlots["FaceCover"] = "55d729e84bdc2d8a028b4569";
inventorySlots["Headwear"] = "55d729ef4bdc2d3a168b456c";
inventorySlots["TacticalVest"] = "55d729f74bdc2d87028b456e";
inventorySlots["SecuredContainer"] = "55d72a054bdc2d88028b456e";
inventorySlots["Backpack"] = "55d72a104bdc2d89028b4571";
inventorySlots["ArmorVest"] = "55d72a194bdc2d86028b456f";
inventorySlots["Pockets"] = "55d72a274bdc2de3098b456c";
inventorySlots["Earpiece"] = "5665b7164bdc2d144c8b4570";
inventorySlots["Dogtag"] = "59f0be1e86f77453be490939";
inventorySlots["Eyewear"] = "5a0ad9313f1241000e072755";
inventorySlots["ArmBand"] = "5b3f583786f77411d552fb2b";
})(inventorySlots || (exports.inventorySlots = inventorySlots = {}));
var Stashes;
(function (Stashes) {
Stashes["LEVEL1"] = "566abbc34bdc2d92178b4576";
Stashes["LEVEL2"] = "5811ce572459770cba1a34ea";
Stashes["LEVEL3"] = "5811ce662459770f6f490f32";
Stashes["LEVEL4"] = "5811ce772459770e9e5f9532";
})(Stashes || (exports.Stashes = Stashes = {}));
//#endregion
//# sourceMappingURL=configConsts.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "configConsts.js",
"sourceRoot": "",
"sources": [
"configConsts.ts"
],
"names": [],
"mappings": ";;;AA0DC,CAAC;AAiCF,iCAAiC;AAEjC,eAAe;AACf,IAAY,SAgBX;AAhBD,WAAY,SAAS;IACjB,kDAAqC,CAAA;IACrC,+CAAkC,CAAA;IAClC,qDAAwC,CAAA;IACxC,mDAAsC,CAAA;IACtC,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,+CAAkC,CAAA;IAClC,sCAAyB,CAAA;IACzB,oCAAuB,CAAA;IACvB,gCAAmB,CAAA;IACnB,0BAAa,CAAA;IACb,0BAAa,CAAA;IACb,sCAAyB,CAAA;IACzB,wCAA2B,CAAA;AAC/B,CAAC,EAhBW,SAAS,yBAAT,SAAS,QAgBpB;AAED,IAAY,WAIX;AAJD,WAAY,WAAW;IACnB,mDAAoC,CAAA;IACpC,iDAAkC,CAAA;IAClC,mDAAoC,CAAA;AACxC,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAED,IAAY,WAiCX;AAjCD,WAAY,WAAW;IACnB,4CAA6B,CAAA;IAC7B,sDAAuC,CAAA;IACvC,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,oCAAqB,CAAA;IACrB,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,uCAAwB,CAAA;IACxB,sCAAuB,CAAA;IACvB,sCAAuB,CAAA;IACvB,wCAAyB,CAAA;IACzB,sDAAuC,CAAA;IACvC,8CAA+B,CAAA;IAC/B,gCAAiB,CAAA;IACjB,kDAAmC,CAAA;IACnC,kDAAmC,CAAA;IACnC,gDAAiC,CAAA;IACjC,8DAA+C,CAAA;IAC/C,0DAA2C,CAAA;IAC3C,gEAAiD,CAAA;IACjD,2DAA4C,CAAA;IAC5C,mDAAoC,CAAA;IACpC,kDAAmC,CAAA;IACnC,kDAAmC,CAAA;IACnC,oDAAqC,CAAA;IACrC,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,6BAAc,CAAA;IACd,8CAA+B,CAAA;IAC/B,gDAAiC,CAAA;IACjC,4BAAa,CAAA;AACjB,CAAC,EAjCW,WAAW,2BAAX,WAAW,QAiCtB;AAED,IAAY,cAgBX;AAhBD,WAAY,cAAc;IACtB,iEAA+C,CAAA;IAC/C,kEAAgD,CAAA;IAChD,sDAAoC,CAAA;IACpC,uDAAqC,CAAA;IACrC,wDAAsC,CAAA;IACtC,uDAAqC,CAAA;IACrC,2DAAyC,CAAA;IACzC,+DAA6C,CAAA;IAC7C,uDAAqC,CAAA;IACrC,wDAAsC,CAAA;IACtC,sDAAoC,CAAA;IACpC,uDAAqC,CAAA;IACrC,qDAAmC,CAAA;IACnC,sDAAoC,CAAA;IACpC,sDAAoC,CAAA;AACxC,CAAC,EAhBW,cAAc,8BAAd,cAAc,QAgBzB;AAED,IAAY,OAKX;AALD,WAAY,OAAO;IACf,8CAAmC,CAAA;IACnC,8CAAmC,CAAA;IACnC,8CAAmC,CAAA;IACnC,8CAAmC,CAAA;AACvC,CAAC,EALW,OAAO,uBAAP,OAAO,QAKlB;AA4BD,YAAY"
}

View file

@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ItemBaseClassMap = void 0;
exports.ItemBaseClassMap = {
"AMMO": "5485a8684bdc2da71d8b4567",
"AMMO_CONTAINER": "543be5cb4bdc2deb348b4568",
"ARMORED_EQUIPMENT": "57bef4c42459772e8d35a53b",
"ARMBAND": "5b3f15d486f77432d0509248",
"ARMOR": "5448e54d4bdc2dcc718b4568",
"ASSAULT_CARBINE": "5447b5fc4bdc2d87278b4567",
"ASSAULT_RIFLE": "5447b5f14bdc2d61278b4567",
"BACKPACK": "5448e53e4bdc2d60728b4567",
"BARREL": "555ef6e44bdc2de9068b457e",
"BATTERY": "57864ee62459775490116fc1",
"BUILDING_MATERIAL": "57864ada245977548638de91",
"CHARGING_HANDLE": "55818a6f4bdc2db9688b456b",
"CHEST_RIG": "5448e5284bdc2dcb718b4567",
"COMMON_CONTAINER": "5795f317245977243854e041",
"COMPACT_REFLEX_SIGHT": "55818acf4bdc2dde698b456b",
"COMPASS": "5f4fbaaca5573a5ac31db429",
"DRINK": "5448e8d64bdc2dce718b4568",
"DRUG": "5448f3a14bdc2d27728b4569",
"ELECTRONICS": "57864a66245977548f04a81f",
"FACECOVER": "5a341c4686f77469e155819e",
"FLASHLIGHT": "55818b084bdc2d5b648b4571",
"FLASHHIDER": "550aa4bf4bdc2dd6348b456b",
"FOOD": "5448e8d04bdc2ddf718b4569",
"FOREGRIP": "55818af64bdc2d5b648b4570",
"FUEL": "5d650c3e815116009f6201d2",
"GAS_BLOCK": "56ea9461d2720b67698b456f",
"GRENADE_LAUNCHER": "5447bedf4bdc2d87278b4568",
"HANDGUN": "5447b5cf4bdc2d65278b4567",
"HANDGUARD": "55818a104bdc2db9688b4569",
"HEADPHONES": "5645bcb74bdc2ded0b8b4578",
"HEADWEAR": "5a341c4086f77401f2541505",
"INFO": "5448ecbe4bdc2d60728b4568",
"INVENTORY": "55d720f24bdc2d88028b456d",
"KEYCARD": "5c164d2286f774194c5e69fa",
"KEYMECHANICAL": "5c99f98d86f7745c314214b3",
"KEY_CARD": "5c164d2286f774194c5e69fa",
"KNIFE": "5447e1d04bdc2dff2f8b4567",
"LOCKING_CONTAINER": "5671435f4bdc2d96058b4569",
"LOOT_CONTAINER": "566965d44bdc2d814c8b4571",
"LUBRICANT": "57864e4c24597754843f8723",
"MACHINEGUN": "5447bed64bdc2d97278b4568",
"MAGAZINE": "5448bc234bdc2d3c308b4569",
"MAP": "567849dd4bdc2d150f8b456e",
"MEDICAL_ITEM": "5448f3ac4bdc2dce718b4569",
"MEDICAL_SUPPLIES": "57864c8c245977548867e7f1",
"MEDITKIT": "5448f39d4bdc2d0a728b4568",
"MONEY": "543be5dd4bdc2deb348b4569",
"NIGHTVISION": "5a2c3a9486f774688b05e574",
"OTHER": "590c745b86f7743cc433c5f2",
"PISTOLGRIP": "55818a684bdc2ddd698b456d",
"POCKETS": "557596e64bdc2dc2118b4571",
"PORTABLE_RANGEFINDER": "61605ddea09d851a0a0c1bbc",
"RANDOMLOOTCONTAINER": "62f109593b54472778797866",
"RECEIVER": "55818a304bdc2db5418b457d",
"REFLEX_SIGHT": "55818ad54bdc2ddc698b4569",
"REPAIRKITS": "616eb7aea207f41933308f46",
"SCOPE": "55818ae44bdc2dde698b456c",
"SHOTGUN": "5447b6094bdc2dc3278b4567",
"SILENCER": "550aa4cd4bdc2dd8348b456c",
"SNIPER_RIFLE": "5447b6254bdc2dc3278b4568",
"SPECIAL_ITEM": "5447e0e74bdc2d3c308b4567",
"STASH": "566abbb64bdc2d144c8b457d",
"STATIONARY_CONT.": "567583764bdc2d98058b456e",
"STIMULANT": "5448f3a64bdc2d60728b456a",
"STOCK": "55818a594bdc2db9688b456a",
"THROWABLE_WEAPON": "543be6564bdc2df4348b4568",
"THERMALVISION": "5d21f59b6dbe99052b54ef83",
"TOOL": "57864bb7245977548b3b66c2",
"UBGL": "55818b014bdc2ddc698b456b",
"VIS_OBSERV_DEVICE": "5448e5724bdc2ddf718b4568",
};
//# sourceMappingURL=itemBaseClasses.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "itemBaseClasses.js",
"sourceRoot": "",
"sources": [
"itemBaseClasses.ts"
],
"names": [],
"mappings": ";;;AAAa,QAAA,gBAAgB,GAAmC;IAC9D,MAAM,EAAE,0BAA0B;IAClC,gBAAgB,EAAE,0BAA0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B;IACnC,aAAa,EAAE,0BAA0B;IACzC,OAAO,EAAE,0BAA0B;IACnC,YAAY,EAAE,0BAA0B;IACxC,SAAS,EAAE,0BAA0B;IACrC,sBAAsB,EAAE,0BAA0B;IAClD,qBAAqB,EAAE,0BAA0B;IACjD,UAAU,EAAE,0BAA0B;IACtC,cAAc,EAAE,0BAA0B;IAC1C,YAAY,EAAE,0BAA0B;IACxC,OAAO,EAAE,0BAA0B;IACnC,SAAS,EAAE,0BAA0B;IACrC,UAAU,EAAE,0BAA0B;IACtC,cAAc,EAAE,0BAA0B;IAC1C,cAAc,EAAE,0BAA0B;IAC1C,OAAO,EAAE,0BAA0B;IACnC,kBAAkB,EAAE,0BAA0B;IAC9C,WAAW,EAAE,0BAA0B;IACvC,OAAO,EAAE,0BAA0B;IACnC,kBAAkB,EAAE,0BAA0B;IAC9C,eAAe,EAAE,0BAA0B;IAC3C,MAAM,EAAE,0BAA0B;IAClC,MAAM,EAAE,0BAA0B;IAClC,mBAAmB,EAAE,0BAA0B;CAChD,CAAC"
}

View file

@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ItemHandbookCategoryMap = void 0;
exports.ItemHandbookCategoryMap = {
"AMMO": "5b47574386f77428ca22b346",
"AMMO_BOXES": "5b47574386f77428ca22b33c",
"AMMO_ROUNDS": "5b47574386f77428ca22b33b",
"BARTER": "5b47574386f77428ca22b33e",
"BARTER_BUILDING": "5b47574386f77428ca22b2ee",
"BARTER_ELECTRONICS": "5b47574386f77428ca22b2ef",
"BARTER_ENERGY": "5b47574386f77428ca22b2ed",
"BARTER_FLAMMABLE": "5b47574386f77428ca22b2f2",
"BARTER_HOUSEHOLD": "5b47574386f77428ca22b2f0",
"BARTER_MEDICAL": "5b47574386f77428ca22b2f3",
"BARTER_OTHERS": "5b47574386f77428ca22b2f4",
"BARTER_TOOLS": "5b47574386f77428ca22b2f6",
"BARTER_VALUABLES": "5b47574386f77428ca22b2f1",
"GEAR": "5b47574386f77428ca22b33f",
"GEAR_ARMOR": "5b5f701386f774093f2ecf0f",
"GEAR_BACKPACKS": "5b5f6f6c86f774093f2ecf0b",
"GEAR_CASES": "5b5f6fa186f77409407a7eb7",
"GEAR_COMPONENTS": "5b5f704686f77447ec5d76d7",
"GEAR_FACECOVERS": "5b47574386f77428ca22b32f",
"GEAR_HEADSETS": "5b5f6f3c86f774094242ef87",
"GEAR_HEADWEAR": "5b47574386f77428ca22b330",
"GEAR_RIGS": "5b5f6f8786f77447ed563642",
"GEAR_SECURED": "5b5f6fd286f774093f2ecf0d",
"GEAR_VISORS": "5b47574386f77428ca22b331",
"INFO": "5b47574386f77428ca22b341",
"KEYS": "5b47574386f77428ca22b342",
"KEYS_ELECTRONIC": "5c518ed586f774119a772aee",
"KEYS_MECHANIC": "5c518ec986f7743b68682ce2",
"MAPS": "5b47574386f77428ca22b343",
"MEDICAL": "5b47574386f77428ca22b344",
"MEDICAL_INJECTORS": "5b47574386f77428ca22b33a",
"MEDICAL_INJURY": "5b47574386f77428ca22b339",
"MEDICAL_MEDKITS": "5b47574386f77428ca22b338",
"MEDICAL_PILLS": "5b47574386f77428ca22b337",
"MODS": "5b5f71a686f77447ed5636ab",
"MODS_FUNCTIONAL": "5b5f71b386f774093f2ecf11",
"MODS_GEAR": "5b5f750686f774093e6cb503",
"MODS_VITAL": "5b5f75b986f77447ec5d7710",
"MOD_AUX": "5b5f74cc86f77447ec5d770a",
"MOD_BARREL": "5b5f75c686f774094242f19f",
"MOD_BIPOD": "5b5f71c186f77409407a7ec0",
"MOD_CHARGE": "5b5f751486f77447ec5d770c",
"MOD_GASBLOCK": "5b5f760586f774093e6cb509",
"MOD_HANDGUARD": "5b5f75e486f77447ec5d7712",
"MOD_LAUNCHER": "5b5f752e86f774093e6cb505",
"MOD_LIGHTLASER": "5b5f736886f774094242f193",
"MOD_MAGAZINE": "5b5f754a86f774094242f19b",
"MOD_MOUNT": "5b5f755f86f77447ec5d770e",
"MOD_MUZZLE": "5b5f724186f77447ed5636ad",
"MOD_PISTOLGRIP": "5b5f761f86f774094242f1a1",
"MOD_RECEIVER": "5b5f764186f77447ec5d7714",
"MOD_SIGHT": "5b5f73ec86f774093e6cb4fd",
"MOD_STOCK": "5b5f757486f774093e6cb507",
"MONEY": "5b5f78b786f77447ed5636af",
"PROVISIONS": "5b47574386f77428ca22b340",
"PROVISIONS_DRINKS": "5b47574386f77428ca22b335",
"PROVISIONS_FOOD": "5b47574386f77428ca22b336",
"QUEST": "5b619f1a86f77450a702a6f3",
"SPEC": "5b47574386f77428ca22b345",
"WEAPONS": "5b5f78dc86f77409407a7f8e",
"WEAPONS_ASSAULTRIFLES": "5b5f78fc86f77409407a7f90",
"WEAPONS_BOTACTION": "5b5f798886f77447ed5636b5",
"WEAPONS_CARBINES": "5b5f78e986f77447ed5636b1",
"WEAPONS_DMR": "5b5f791486f774093f2ed3be",
"WEAPONS_GL": "5b5f79d186f774093f2ed3c2",
"WEAPONS_MG": "5b5f79a486f77409407a7f94",
"WEAPONS_MELEE": "5b5f7a0886f77409407a7f96",
"WEAPONS_PISTOLS": "5b5f792486f77447ed5636b3",
"WEAPONS_SHOTGUNS": "5b5f794b86f77409407a7f92",
"WEAPONS_SMG": "5b5f796a86f774093f2ed3c0",
"WEAPONS_SPECIAL": "5b5f79eb86f77447ed5636b7",
"WEAPONS_THROW": "5b5f7a2386f774093f2ed3c4",
};
//# sourceMappingURL=itemHandbookCategories.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "itemHandbookCategories.js",
"sourceRoot": "",
"sources": [
"itemHandbookCategories.ts"
],
"names": [],
"mappings": ";;;AAAa,QAAA,uBAAuB,GAAmC;IACrE,MAAM,EAAE,0BAA0B;IAClC,YAAY,EAAE,0BAA0B;IACxC,aAAa,EAAE,0BAA0B;IACzC,QAAQ,EAAE,0BAA0B;IACpC,iBAAiB,EAAE,0BAA0B;IAC7C,oBAAoB,EAAE,0BAA0B;IAChD,eAAe,EAAE,0BAA0B;IAC3C,kBA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EAAE,0BAA0B;IACvC,WAAW,EAAE,0BAA0B;IACvC,OAAO,EAAE,0BAA0B;IACnC,YAAY,EAAE,0BAA0B;IACxC,mBAAmB,EAAE,0BAA0B;IAC/C,iBAAiB,EAAE,0BAA0B;IAC7C,OAAO,EAAE,0BAA0B;IACnC,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,0BAA0B;IACrC,uBAAuB,EAAE,0BAA0B;IACnD,mBAAmB,EAAE,0BAA0B;IAC/C,kBAAkB,EAAE,0BAA0B;IAC9C,aAAa,EAAE,0BAA0B;IACzC,YAAY,EAAE,0BAA0B;IACxC,YAAY,EAAE,0BAA0B;IACxC,eAAe,EAAE,0BAA0B;IAC3C,iBAAiB,EAAE,0BAA0B;IAC7C,kBAAkB,EAAE,0BAA0B;IAC9C,aAAa,EAAE,0BAA0B;IACzC,iBAAiB,EAAE,0BAA0B;IAC7C,eAAe,EAAE,0BAA0B;CAC5C,CAAC"
}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,67 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomAssortSchemeService = void 0;
const customAssortSchemes = __importStar(require("../db/CustomAssortSchemes/CustomAssortSchemes.json"));
const configConsts_1 = require("./references/configConsts");
class CustomAssortSchemeService {
Instance;
preSptLoad(Instance) {
this.Instance = Instance;
}
postDBLoad() {
const tables = this.Instance.database;
for (const traderId in customAssortSchemes) {
const traderIdFromMap = configConsts_1.traderIDs[traderId];
const finalTraderId = traderIdFromMap || traderId;
const trader = tables.traders[finalTraderId];
if (!trader) {
return;
}
const newAssort = customAssortSchemes[traderId];
for (const item of newAssort.items) {
trader.assort.items.push(item);
}
for (const [itemName, scheme] of Object.entries(newAssort.barter_scheme)) {
trader.assort.barter_scheme[itemName] = scheme;
}
for (const [itemName, count] of Object.entries(newAssort.loyal_level_items)) {
trader.assort.loyal_level_items[itemName] = count;
}
}
}
}
exports.CustomAssortSchemeService = CustomAssortSchemeService;
//# sourceMappingURL=CustomAssortSchemeService.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "CustomAssortSchemeService.js",
"sourceRoot": "",
"sources": [
"CustomAssortSchemeService.ts"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wGAA0F;AAC1F,4DAAsD;AAEtD,MAAa,yBAAyB;IAE1B,QAAQ,CAAqB;IAE9B,UAAU,CAAC,QAA4B;QAE1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAEM,UAAU;QAEb,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACtC,KAAK,MAAM,QAAQ,IAAI,mBAAmB,EAC1C,CAAC;YACG,MAAM,eAAe,GAAG,wBAAS,CAAC,QAAQ,CAAC,CAAC;YAC5C,MAAM,aAAa,GAAG,eAAe,IAAI,QAAQ,CAAC;YAClD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YAE7C,IAAI,CAAC,MAAM,EACX,CAAC;gBACG,OAAO;YACX,CAAC;YAED,MAAM,SAAS,GAAmB,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YAEhE,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,KAAK,EAClC,CAAC;gBACG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC;YACD,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,EACxE,CAAC;gBACG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;YACnD,CAAC;YAED,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAC3E,CAAC;gBACG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;YACtD,CAAC;QAEL,CAAC;IACL,CAAC;CAGJ;AA3CD,8DA2CC"
}

View file

@ -0,0 +1,666 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomItemService = void 0;
const configConsts_1 = require("./references/configConsts");
const configConsts_2 = require("./references/configConsts");
const configConsts_3 = require("./references/configConsts");
const items_1 = require("./references/items");
const itemBaseClasses_1 = require("./references/itemBaseClasses");
const itemHandbookCategories_1 = require("./references/itemHandbookCategories");
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
const node_fs_1 = __importDefault(require("node:fs"));
const node_path_1 = __importDefault(require("node:path"));
class CustomItemService {
instanceManager;
preSptLoad(instanceManager) {
this.instanceManager = instanceManager;
}
postDBLoad() {
const configPath = node_path_1.default.join(__dirname, "../db/Items");
const configFiles = node_fs_1.default
.readdirSync(configPath)
.filter((file) => !file.includes("BaseItemReplacement"));
let numItemsAdded = 0;
for (const file of configFiles) {
const filePath = node_path_1.default.join(configPath, file);
try {
const fileContents = node_fs_1.default.readFileSync(filePath, "utf-8");
const config = JSON.parse(fileContents);
for (const itemId in config) {
const itemConfig = config[itemId];
try {
const { exampleCloneItem, finalItemTplToClone } = this.createExampleCloneItem(itemConfig, itemId);
if (this.instanceManager.debug) {
console.log(`Processing file: ${file}, Item ID: ${itemId}`);
console.log(`Prefab Path: ${exampleCloneItem.overrideProperties?.Prefab.path}`);
}
this.instanceManager.customItem.createItemFromClone(exampleCloneItem);
this.processStaticLootContainers(itemConfig, itemId);
this.processModSlots(itemConfig, finalItemTplToClone, itemId);
this.processInventorySlots(itemConfig, itemId);
this.processMasterySections(itemConfig, itemId);
this.processWeaponPresets(itemConfig, itemId);
this.processTraders(itemConfig, itemId);
this.addtoHallofFame(itemConfig, itemId);
this.addtoSpecialSlots(itemConfig, itemId);
numItemsAdded++;
}
catch (itemError) {
console.error(`Error processing item ID: ${itemId} in file: ${file}`);
console.error(itemError);
}
}
}
catch (fileError) {
console.error(`Error processing config file: ${file}`);
console.error(fileError);
}
}
if (numItemsAdded > 0) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] Database: Loaded ${numItemsAdded} custom items.`, LogTextColor_1.LogTextColor.GREEN);
}
else {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] Database: No custom items loaded.`, LogTextColor_1.LogTextColor.GREEN);
}
// Post-item processing (e.g., bot inventories, quest modifications)
for (const file of configFiles) {
const filePath = node_path_1.default.join(configPath, file);
try {
const fileContents = node_fs_1.default.readFileSync(filePath, "utf-8");
const config = JSON.parse(fileContents);
for (const itemId in config) {
const itemConfig = config[itemId];
this.processBotInventories(itemConfig, itemConfig.itemTplToClone, itemId);
}
}
catch (fileError) {
console.error(`Error processing bot inventories for file: ${file}`);
console.error(fileError);
}
}
}
/**
* Creates an example clone item with the provided item configuration and item ID.
*
* @param {any} itemConfig - The configuration of the item to clone.
* @param {string} itemId - The ID of the item.
* @return {{ exampleCloneItem: NewItemFromCloneDetails, finalItemTplToClone: string }} The created example clone item and the final item template to clone.
*/
createExampleCloneItem(itemConfig, itemId) {
const itemTplToCloneFromMap = items_1.ItemMap[itemConfig.itemTplToClone] || itemConfig.itemTplToClone;
const finalItemTplToClone = itemTplToCloneFromMap;
const parentIdFromMap = itemBaseClasses_1.ItemBaseClassMap[itemConfig.parentId] || itemConfig.parentId;
const finalParentId = parentIdFromMap;
const handbookParentIdFromMap = itemHandbookCategories_1.ItemHandbookCategoryMap[itemConfig.handbookParentId] ||
itemConfig.handbookParentId;
const finalHandbookParentId = handbookParentIdFromMap;
const itemPrefabPath = `customItems/${itemId}.bundle`;
const exampleCloneItem = {
itemTplToClone: finalItemTplToClone,
overrideProperties: itemConfig.overrideProperties
? {
...itemConfig.overrideProperties,
Prefab: {
path: itemConfig.overrideProperties.Prefab?.path || itemPrefabPath,
rcid: ""
}
}
: undefined,
parentId: finalParentId,
newId: itemId,
fleaPriceRoubles: itemConfig.fleaPriceRoubles,
handbookPriceRoubles: itemConfig.handbookPriceRoubles,
handbookParentId: finalHandbookParentId,
locales: itemConfig.locales
};
if (this.instanceManager.debug) {
console.log(`Cloning item ${finalItemTplToClone} for itemID: ${itemId}`);
}
return { exampleCloneItem, finalItemTplToClone };
}
/**
* Adds an item to a static loot container with a given probability.
*
* @param {string} containerID - The ID of the loot container.
* @param {string} itemToAdd - The item to add to the loot container.
* @param {number} probability - The probability of the item being added.
* @return {void} This function does not return anything.
*/
addToStaticLoot(containerID, itemToAdd, probability) {
const locations = this.instanceManager.database.locations;
for (const locationID in locations) {
if (!Object.prototype.hasOwnProperty.call(locations, locationID)) {
continue; // Skip invalid locations
}
const location = locations[locationID];
if (!location.staticLoot) {
if (this.instanceManager.debug) {
console.warn(`Warning: No static loot found in location: ${locationID}`);
}
continue;
}
const staticLoot = location.staticLoot;
if (!Object.prototype.hasOwnProperty.call(staticLoot, containerID)) {
if (this.instanceManager.debug) {
console.log(`Error: Loot container ID ${containerID} not found in location: ${locationID}`);
}
continue;
}
const lootContainer = staticLoot[containerID];
if (!lootContainer) {
if (this.instanceManager.debug) {
console.log(`Error: Loot container ID ${containerID} is null in location: ${locationID}`);
}
continue;
}
const templateFromMap = items_1.ItemMap[itemToAdd];
const finalTemplate = templateFromMap || itemToAdd;
const newLoot = [
{
tpl: finalTemplate,
relativeProbability: probability,
},
];
lootContainer.itemDistribution.push(...newLoot);
if (this.instanceManager.debug) {
console.log(`Added ${itemToAdd} to loot container: ${containerID} in location: ${locationID}`);
}
}
}
/**
* Processes the static loot containers for a given item.
*
* @param {any} itemConfig - The configuration object for the item.
* @param {string} itemId - The ID of the item.
* @return {void} This function does not return a value.
*/
processStaticLootContainers(itemConfig, itemId) {
if (itemConfig.addtoStaticLootContainers) {
if (this.instanceManager.debug) {
console.log("Processing static loot containers for item:", itemId);
}
if (Array.isArray(itemConfig.StaticLootContainers)) {
if (this.instanceManager.debug) {
console.log("Adding item to multiple static loot containers:");
}
for (const container of itemConfig.StaticLootContainers) {
const staticLootContainer = items_1.ItemMap[container.ContainerName] || container.ContainerName;
this.addToStaticLoot(staticLootContainer, itemId, container.Probability);
if (this.instanceManager.debug) {
console.log(` - Added to container '${staticLootContainer}' with probability ${container.Probability}`);
}
}
}
else {
const staticLootContainer = items_1.ItemMap[itemConfig.StaticLootContainers] ||
itemConfig.StaticLootContainers;
this.addToStaticLoot(staticLootContainer, itemId, itemConfig.Probability);
if (this.instanceManager.debug) {
console.log(`Added to container '${staticLootContainer}' with probability ${itemConfig.Probability}`);
}
}
}
}
/**
* Processes the mod slots of an item.
*
* @param {any} itemConfig - The configuration of the item.
* @param {string[]} finalItemTplToClone - The final item template to clone.
* @param {string} itemId - The ID of the item.
* @returns {void}
*/
processModSlots(itemConfig, finalItemTplToClone, itemId) {
const tables = this.instanceManager.database;
const moddableItemWhitelistIds = Array.isArray(itemConfig.ModdableItemWhitelist)
? itemConfig.ModdableItemWhitelist.map((shortname) => items_1.ItemMap[shortname])
: itemConfig.ModdableItemWhitelist
? [items_1.ItemMap[itemConfig.ModdableItemWhitelist]]
: [];
const moddableItemBlacklistIds = Array.isArray(itemConfig.ModdableItemBlacklist)
? itemConfig.ModdableItemBlacklist.map((shortname) => items_1.ItemMap[shortname])
: itemConfig.ModdableItemBlacklist
? [items_1.ItemMap[itemConfig.ModdableItemBlacklist]]
: [];
const modSlots = Array.isArray(itemConfig.modSlot)
? itemConfig.modSlot
: itemConfig.modSlot
? [itemConfig.modSlot]
: [];
const lowercaseModSlots = modSlots.map((modSlotName) => modSlotName.toLowerCase());
if (itemConfig.addtoModSlots) {
if (this.instanceManager.debug) {
console.log("Processing mod slots for item:", itemId);
}
for (const parentItemId in tables.templates.items) {
const parentItem = tables.templates.items[parentItemId];
if (!parentItem._props.Slots) {
continue;
}
const isBlacklisted = moddableItemBlacklistIds.includes(parentItemId);
const isWhitelisted = moddableItemWhitelistIds.includes(parentItemId);
if (isBlacklisted) {
continue;
}
let addToModSlots = false;
if (isWhitelisted && itemConfig.modSlot) {
addToModSlots = true;
}
else if (!isBlacklisted && itemConfig.modSlot) {
for (const modSlot of parentItem._props.Slots) {
if (modSlot._props.filters?.[0].Filter.some((filterItem) => finalItemTplToClone.includes(filterItem))) {
if (lowercaseModSlots.includes(modSlot._name.toLowerCase())) {
addToModSlots = true;
break;
}
}
}
}
if (addToModSlots) {
for (const modSlot of parentItem._props.Slots) {
if (lowercaseModSlots.includes(modSlot._name.toLowerCase())) {
if (!modSlot._props.filters[0].Filter.includes(itemId) && modSlot._props.filters?.[0]?.Filter?.includes(finalItemTplToClone)) {
modSlot._props.filters[0].Filter.push(itemId);
if (this.instanceManager.debug) {
console.log(`Successfully added item ${itemId} to the filter of mod slot ${modSlot._name} for parent item ${parentItemId}`);
}
}
}
}
}
}
}
}
/**
* Processes the inventory slots for a given item.
*
* @param {any} itemConfig - The configuration object for the item.
* @param {string} itemId - The ID of the item.
* @param {any} defaultInventorySlots - The default inventory slots.
* @return {void} This function does not return a value.
*/
processInventorySlots(itemConfig, itemId) {
const tables = this.instanceManager.database;
if (itemConfig.addtoInventorySlots) {
if (this.instanceManager.debug) {
console.log("Processing inventory slots for item:", itemId);
}
const defaultInventorySlots = tables.templates.items["55d7217a4bdc2d86028b456d"]._props.Slots;
const allowedSlots = Array.isArray(itemConfig.addtoInventorySlots)
? itemConfig.addtoInventorySlots
: [itemConfig.addtoInventorySlots];
// Iterate over the slots and push the item into the filters per the config
for (const slot of defaultInventorySlots) {
const slotName = configConsts_3.inventorySlots[slot._name];
const slotId = Object.keys(configConsts_3.inventorySlots).find((key) => configConsts_3.inventorySlots[key] === slot._name);
if (allowedSlots.includes(slot._name) ||
allowedSlots.includes(slotName) ||
allowedSlots.includes(slotId)) {
if (!slot._props.filters[0].Filter.includes(itemId)) {
slot._props.filters[0].Filter.push(itemId);
if (this.instanceManager.debug) {
console.log(`Successfully added item ${itemId} to the filter of slot ${slot._name}`);
}
}
}
}
}
}
/**
* Processes the mastery sections for an item.
*
* @param {any} itemConfig - The configuration object for the item.
* @param {string} itemId - The ID of the item.
* @param {any} tables - The tables object containing global configuration.
* @return {void} This function does not return a value.
*/
processMasterySections(itemConfig, itemId) {
const tables = this.instanceManager.database;
if (itemConfig.masteries) {
if (this.instanceManager.debug) {
console.log("Processing mastery sections for item:", itemId);
}
const masterySections = Array.isArray(itemConfig.masterySections)
? itemConfig.masterySections
: [itemConfig.masterySections];
for (const mastery of masterySections) {
const existingMastery = tables.globals.config.Mastering.find((existing) => existing.Name === mastery.Name);
if (existingMastery) {
existingMastery.Templates.push(...mastery.Templates);
if (this.instanceManager.debug) {
console.log(` - Adding to existing mastery section for item: ${itemId}`);
}
}
else {
tables.globals.config.Mastering.push(mastery);
if (this.instanceManager.debug) {
console.log(` - Adding new mastery section for item: ${itemId}`);
}
}
}
}
}
/**
* Processes weapon presets based on the provided item configuration and tables.
*
* @param {any} itemConfig - The item configuration.
* @return {void} This function does not return anything.
*/
processWeaponPresets(itemConfig, itemId) {
const tables = this.instanceManager.database;
const { addweaponpreset, weaponpresets } = itemConfig;
const itemPresets = tables.globals.ItemPresets;
if (addweaponpreset) {
if (this.instanceManager.debug) {
console.log("Processing weapon presets for item:", itemId);
}
for (const presetData of weaponpresets) {
const preset = {
_changeWeaponName: presetData._changeWeaponName,
_encyclopedia: presetData._encyclopedia || undefined,
_id: presetData._id,
_items: presetData._items.map((itemData) => {
const item = {
_id: itemData._id,
_tpl: itemData._tpl
};
// Add parentId and slotId only if they are present in itemData
if (itemData.parentId) {
item.parentId = itemData.parentId;
}
if (itemData.slotId) {
item.slotId = itemData.slotId;
}
return item;
}),
_name: presetData._name,
_parent: presetData._parent,
_type: "Preset"
};
itemPresets[preset._id] = preset;
if (this.instanceManager.debug) {
console.log(` - Added weapon preset: ${preset._name}`);
console.log(` - Preset: ${JSON.stringify(preset)}`);
}
}
}
}
/**
* Processes traders based on the item configuration.
*
* @param {any} itemConfig - The configuration of the item.
* @param {string} itemId - The ID of the item.
* @return {void} This function does not return a value.
*/
processTraders(itemConfig, itemId) {
const tables = this.instanceManager.database;
if (!itemConfig.addtoTraders) {
return;
}
const { traderId, traderItems, barterScheme } = itemConfig;
const traderIdFromMap = configConsts_1.traderIDs[traderId];
const finalTraderId = traderIdFromMap || traderId;
const trader = tables.traders[finalTraderId];
if (!trader) {
return;
}
for (const item of traderItems) {
if (this.instanceManager.debug) {
console.log("Processing traders for item:", itemId);
}
const newItem = {
_id: itemId,
_tpl: itemId,
parentId: "hideout",
slotId: "hideout",
upd: {
UnlimitedCount: item.unlimitedCount,
StackObjectsCount: item.stackObjectsCount
}
};
trader.assort.items.push(newItem);
if (this.instanceManager.debug) {
console.log(`Successfully added item ${itemId} to the trader ${traderId}`);
}
}
trader.assort.barter_scheme[itemId] = [];
for (const scheme of barterScheme) {
if (this.instanceManager.debug) {
console.log("Processing trader barter scheme for item:", itemId);
}
const count = scheme.count;
const tpl = configConsts_2.currencyIDs[scheme._tpl] || items_1.ItemMap[scheme._tpl];
if (!tpl) {
throw new Error(`Invalid _tpl value in barterScheme for item: ${itemId}`);
}
trader.assort.barter_scheme[itemId].push([
{
count: count,
_tpl: tpl
}
]);
if (this.instanceManager.debug) {
console.log(`Successfully added item ${itemId} to the barter scheme of trader ${traderId}`);
}
}
trader.assort.loyal_level_items[itemId] = itemConfig.loyallevelitems;
}
addtoHallofFame(itemConfig, itemId) {
const hallofFame1 = this.instanceManager.database.templates.items["63dbd45917fff4dee40fe16e"];
const hallofFame2 = this.instanceManager.database.templates.items["65424185a57eea37ed6562e9"];
const hallofFame3 = this.instanceManager.database.templates.items["6542435ea57eea37ed6562f0"];
// Add to Hall of Fame filters
if (itemConfig.addtoHallOfFame) {
const hallOfFames = [hallofFame1, hallofFame2, hallofFame3];
for (const hall of hallOfFames) {
for (const slot of hall._props.Slots) {
for (const filter of slot._props.filters) {
if (!filter.Filter.includes(itemId)) {
filter.Filter.push(itemId);
if (this.instanceManager.debug) {
console.log(`Added item ${itemId} to filter Hall of Fame ${hall._name}`);
}
}
}
}
}
}
}
addtoSpecialSlots(itemConfig, itemId) {
const tables = this.instanceManager.database;
if (itemConfig.addtoSpecialSlots) {
const pockets = tables.templates.items["627a4e6b255f7527fb05a0f6"];
for (const slot of pockets._props.Slots) {
if (!slot._props.filters[0].Filter.includes(itemId)) {
slot._props.filters[0].Filter.push(itemId);
}
}
}
}
/**
* Processes the bot inventories based on the given item configuration.
*
* @param {ConfigItem[string]} itemConfig - The item configuration.
* @param {string} finalItemTplToClone - The final item template to clone.
* @param {string} itemId - The item ID.
* @return {void} This function does not return anything.
*/
processBotInventories(itemConfig, finalItemTplToClone, itemId) {
const tables = this.instanceManager.database;
if (!itemConfig.addtoBots)
return;
if (this.instanceManager.debug) {
console.log("Processing bot inventories for item:", itemId);
}
// Iterate through bot types
for (const botId in tables.bots.types) {
const botType = botId;
const botInventory = tables.bots.types[botId].inventory;
botInventory.Ammo = botInventory.Ammo || {};
// Process items and equipment
this.processInventoryType(botInventory.items, finalItemTplToClone, itemId, botType, "items");
this.processInventoryType(botInventory.equipment, finalItemTplToClone, itemId, botType, "equipment");
// Process mods if applicable
if (itemConfig.addtoModSlots && itemConfig.modSlot) {
this.processBotModSlots(finalItemTplToClone, itemId, botType, itemConfig.modSlot);
}
}
}
/**
* Processes inventory type (items or equipment) and gathers mods based on Slots.
*
* @param {any} inventoryType - The inventory type to process.
* @param {string} finalTplToClone - The final item template to clone.
* @param {string} itemId - The item ID.
* @param {string} botType - The bot type identifier.
* @param {string} typeLabel - Label indicating items or equipment.
* @return {void} This function does not return anything.
*/
processInventoryType(
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
inventoryType, finalTplToClone, itemId, botType, typeLabel) {
const tables = this.instanceManager.database;
if (typeLabel === "equipment" && ((inventoryType.FirstPrimaryWeapon?.[finalTplToClone]) ||
(inventoryType.SecondPrimaryWeapon?.[finalTplToClone]) ||
(inventoryType.Holster?.[finalTplToClone]))) {
if (!this.ensureValidWeaponPreset(itemId)) {
return;
}
this.processAmmoAndChambers(tables.bots.types[botType].inventory, tables.templates.items[itemId]._props, itemId, botType);
}
for (const lootSlot in inventoryType) {
const items = inventoryType[lootSlot];
if (items && items[finalTplToClone] !== undefined) {
const weight = items[finalTplToClone];
if (this.instanceManager.debug) {
console.log(` - Adding item to bot ${typeLabel} for bot type: ${botType} in loot slot: ${lootSlot} with weight: ${weight}`);
}
items[itemId] = weight;
this.addModsToItem(tables, itemId, botType);
}
}
}
/**
* Adds mods to an item based on its Slots configuration.
*
* @param {any} tables - The database tables.
* @param {string} itemId - The item ID.
* @param {string} botType - The bot type identifier.
* @return {void} This function does not return anything.
*/
addModsToItem(tables, itemId, botType) {
const itemProps = tables.templates.items[itemId]._props;
if (itemProps?.Slots) {
for (const slot of itemProps.Slots) {
const slotName = slot._name;
const filters = slot._props.filters;
if (filters && filters.length > 0) {
for (const filter of filters) {
for (const modId of filter.Filter) {
if (modId && tables.templates.items[modId]) {
tables.bots.types[botType].inventory.mods[itemId] = tables.bots.types[botType].inventory.mods[itemId] || {};
tables.bots.types[botType].inventory.mods[itemId][slotName] = tables.bots.types[botType].inventory.mods[itemId][slotName] || [];
if (!tables.bots.types[botType].inventory.mods[itemId][slotName].includes(modId)) {
tables.bots.types[botType].inventory.mods[itemId][slotName].push(modId);
if (tables.templates.items[modId]._props) {
if (tables.templates.items[modId]._props.Slots.length > 0) {
this.addModsToItem(tables, modId, botType);
}
}
}
if (this.instanceManager.debug) {
console.log(` - Added mod ${modId} to ${itemId}'s ${slotName} of bot type ${botType}`);
}
}
}
}
}
}
}
}
/**
* Processes mod slots and adds itemId to specified slots if finalItemTplToClone is present.
*
* @param {any} mods - The mods inventory.
* @param {string} finalItemTplToClone - The final item template to clone.
* @param {string} itemId - The item ID.
* @param {string} botType - The bot type identifier.
* @param {string[]} modSlots - The list of mod slots to process.
* @return {void} This function does not return anything.
*/
processBotModSlots(finalItemTplToClone, itemId, botType, modSlots) {
const mods = this.instanceManager.database.bots.types[botType].inventory.mods;
for (const item in mods) {
const itemMods = mods[item];
for (const modSlot of modSlots) {
if (itemMods[modSlot]?.includes(finalItemTplToClone)) {
itemMods[modSlot].push(itemId);
if (this.instanceManager.debug) {
console.log(` - Added item ${itemId} to mod slot ${modSlot} for bot type ${botType} in item ${item}`);
}
// Adding nested mods for the new item
this.addModsToItem(this.instanceManager.database, itemId, botType);
}
}
}
}
/**
* Processes ammo and chambers, adding calibers and chamber filters if needed.
*
* @param {any} botInventory - The bot's inventory.
* @param {any} itemProps - The properties of the item.
* @param {string} itemId - The item ID.
* @param {string} botType - The bot type identifier.
* @return {void} This function does not return anything.
*/
processAmmoAndChambers(botInventory, itemProps, itemId, botType) {
const ammoCaliber = itemProps.ammoCaliber;
if (!ammoCaliber)
return;
botInventory.Ammo[ammoCaliber] = botInventory.Ammo[ammoCaliber] || {};
if (this.instanceManager.debug) {
console.log(` - Added new caliber ${ammoCaliber} to bot inventory for bot type ${botType}`);
}
if (itemProps.Chambers) {
for (const chamber of itemProps.Chambers) {
const filters = chamber._props.filters;
if (filters && filters.length > 0) {
for (const filter of filters) {
for (const filterItem of filter.Filter) {
botInventory.Ammo[ammoCaliber][filterItem] = botInventory.Ammo[ammoCaliber][filterItem] || 0;
if (this.instanceManager.debug) {
console.log(` - Added filter item ${filterItem} to caliber ${ammoCaliber} in bot inventory for bot type ${botType}`);
}
}
}
}
}
}
}
/**
* Ensures the weapon has a valid preset in the global ItemPresets.
*
* @param {string} itemId - The item ID.
* @return {boolean} True if the weapon has a valid preset, false otherwise.
*/
ensureValidWeaponPreset(itemId) {
const db = this.instanceManager.database;
const presets = db.globals.ItemPresets;
for (const presetObj of Object.values(presets)) {
if (presetObj._items[0]._tpl === itemId) {
if (this.instanceManager.debug) {
console.log(` - Valid preset found for item ${itemId}`);
}
return true;
}
}
if (this.instanceManager.debug) {
console.warn(`No valid preset found for item ${itemId} in globals.ItemPresets`);
}
return false;
}
}
exports.CustomItemService = CustomItemService;
//# sourceMappingURL=CustomItemService.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,107 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomWeaponPresets = void 0;
const WeaponPresets_json_1 = __importDefault(require("../db/CustomWeaponPresets/WeaponPresets.json"));
const path = __importStar(require("path"));
const modPath = path.normalize(path.join(__dirname, ".."));
const weaponPresets = WeaponPresets_json_1.default;
class CustomWeaponPresets {
Instance;
preSptLoad(Instance) {
this.Instance = Instance;
}
postDBLoad() {
if (weaponPresets.ItemPresets) {
this.addWeaponPresets();
this.addWeaponPresetLocales();
}
else {
if (this.Instance.debug) {
console.log("CustomWeaponPresets: ItemPresets not found in weaponPresets.json");
}
}
}
addWeaponPresets() {
for (const preset in weaponPresets.ItemPresets) {
this.Instance.database.globals.ItemPresets[preset] = weaponPresets.ItemPresets[preset];
}
}
addWeaponPresetLocales() {
const serverLocales = ["ch", "cz", "en", "es", "es-mx", "fr", "ge", "hu", "it", "jp", "kr", "pl", "po", "ru", "sk", "tu"];
const addedLocales = {};
for (const locale of serverLocales) {
let localeFile;
try {
// Attempt to require the locale file
localeFile = require(`${modPath}/db/locales/${locale}.json`);
}
catch (error) {
// Log an error if the file cannot be found, but continue to the next iteration
if (this.Instance.debug) {
console.error(`Error loading locale file for '${locale}':`, error);
}
continue;
}
// Proceed with adding locales if the file was successfully loaded
if (Object.keys(localeFile).length < 1)
continue;
for (const currentItem in localeFile) {
this.Instance.database.locales.global[locale][currentItem] = localeFile[currentItem];
if (!addedLocales[locale])
addedLocales[locale] = {};
addedLocales[locale][currentItem] = localeFile[currentItem];
}
}
// Placeholders
for (const locale of serverLocales) {
if (locale === "en")
continue;
const englishItems = addedLocales["en"];
if (!(locale in addedLocales)) {
for (const englishItem in englishItems) {
if (this.Instance.database.locales.global[locale] && !(englishItem in this.Instance.database.locales.global[locale])) {
this.Instance.database.locales.global[locale][englishItem] = englishItems[englishItem];
}
}
}
}
}
}
exports.CustomWeaponPresets = CustomWeaponPresets;
//# sourceMappingURL=CustomWeaponPresets.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "CustomWeaponPresets.js",
"sourceRoot": "",
"sources": [
"CustomWeaponPresets.ts"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,sGAA6E;AAC7E,2CAA6B;AAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;AAM3D,MAAM,aAAa,GAAkB,4BAAiB,CAAC;AAEvD,MAAa,mBAAmB;IACpB,QAAQ,CAAqB;IAE9B,UAAU,CAAC,QAA4B;QAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAEM,UAAU;QACb,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC;YAC5B,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAClC,CAAC;aAAM,CAAC;YACJ,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,kEAAkE,CAAC,CAAC;YACpF,CAAC;QACL,CAAC;IACL,CAAC;IAEM,gBAAgB;QACnB,KAAK,MAAM,MAAM,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC;YAC7C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC3F,CAAC;IACL,CAAC;IAE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I,MAAM,KAAK,IAAI;gBAAE,SAAS;YAE9B,MAAM,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;YAExC,IAAI,CAAC,CAAC,MAAM,IAAI,YAAY,CAAC,EAAE,CAAC;gBAC5B,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;oBACrC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;wBACnH,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;oBAC3F,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAnED,kDAmEC"
}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,240 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuestAPI = void 0;
/* eslint-disable @typescript-eslint/naming-convention */
const path = __importStar(require("node:path"));
const fs = __importStar(require("node:fs"));
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
const ConfigTypes_1 = require("C:/snapshot/project/obj/models/enums/ConfigTypes");
class QuestAPI {
instanceManager;
/**
* Call inside traders preSptLoad method.
*
* @param {ILogger} logger Logger
* @param {string} mod mod name
* @return {void}
*/
preSptLoad(Instance) {
this.instanceManager = Instance;
}
postDBLoad() {
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
this.instanceManager.database.globals["QuestZones"] = [];
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
this.instanceManager.database.globals["FlareZones"] = [];
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
this.instanceManager.database.globals["BotKillZones"] = [];
this.importQuestSideConfig();
}
/**
* Loads all quest files from disk.
* \user\mods\WelcomeToTarkov\db\quests\{trader}
* \user\mods\WelcomeToTarkov\db\quests\{trader}\locales
*
* @param {string} trader Trader to load quests for.
* @return {any[]} Returns an array of parsed json objects
*/
loadQuestsFromDirectory(trader) {
const jsonQuestFiles = [];
const jsonLocaleFiles = [];
const jsonImageFiles = [];
const questFiles = fs.readdirSync(path.join(this.instanceManager.dbPath, "Quests", trader));
const questLocalesFiles = fs.readdirSync(path.join(this.instanceManager.dbPath, "Quests", trader, "locales"));
const questImageFiles = fs.readdirSync(path.join(this.instanceManager.dbPath, "Quests", trader, "images"));
if (this.instanceManager.debug) {
console.log("---------------------------------------------------------");
console.log(`Trader: ${trader} quest files:`);
console.log(questFiles);
console.log(`Trader: ${trader} locale files:`);
console.log(questLocalesFiles);
console.log(`Trader: ${trader} image files:`);
console.log(questImageFiles);
console.log("---------------------------------------------------------");
}
// Load quest data from disk
for (const file of questFiles) {
const filePath = path.join(this.instanceManager.dbPath, "Quests", trader, file);
const itemStats = fs.lstatSync(filePath);
let fileContent;
if (itemStats.isFile()) {
fileContent = fs.readFileSync(filePath, "utf-8");
try {
const jsonData = JSON.parse(fileContent);
jsonQuestFiles.push(jsonData);
}
catch (error) {
console.error(`Error parsing JSON from file ${filePath}: ${error}`);
}
}
if (this.instanceManager.debug) {
console.log(`Trader: ${trader} quest file path:`);
console.log(filePath);
}
}
// Load locale data from disk
for (const locale of questLocalesFiles) {
const filePath = path.join(this.instanceManager.dbPath.concat(`\/Quests\/${trader}\/locales`), locale);
const itemStats = fs.lstatSync(filePath);
let fileContent;
if (itemStats.isFile()) {
fileContent = fs.readFileSync(filePath, "utf-8");
}
if (this.instanceManager.debug) {
console.log(`Trader: ${trader} quest locale file path:`);
console.log(filePath);
}
try {
const jsonData = JSON.parse(fileContent);
jsonLocaleFiles.push(jsonData);
}
catch (error) {
console.error(`Error parsing JSON from file ${filePath}: ${error}`);
}
}
// Load image paths from disk
for (const image of questImageFiles) {
const filePath = path.join(this.instanceManager.dbPath.concat(`\/Quests\/${trader}\/images`), image);
const itemStats = fs.lstatSync(filePath);
if (itemStats.isFile()) {
jsonImageFiles.push(filePath);
}
if (this.instanceManager.debug) {
console.log(`Trader: ${trader} quest image file path:`);
console.log(filePath);
}
}
this.importQuestData(jsonQuestFiles, trader);
this.importLocaleData(jsonLocaleFiles, trader);
this.importImageData(jsonImageFiles, trader);
}
/**
* Import quest zones.
*
* @param {QuestZone} questZones Trader to load quests zones for.
* @return {void} Returns nothing
*/
importQuestZones(questZones, trader) {
let zones = 0;
for (const zone of questZones) {
if (this.instanceManager.debug) {
console.log(zone);
}
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
this.instanceManager.database.globals["QuestZones"].push(zone);
zones++;
}
this.instanceManager.logger.log(`[${this.instanceManager.modName}] QuestAPI: ${trader} Loaded ${zones} quest zones.`, LogTextColor_1.LogTextColor.GREEN);
}
/**
* Import Quest data from json files
*/
importQuestData(jsonQuestFiles, trader) {
if (Object.keys(jsonQuestFiles).length < 1) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] QuestAPI: ${trader} No quest files.`, LogTextColor_1.LogTextColor.RED);
return;
}
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] QuestAPI: ${trader} Loading ${Object.keys(jsonQuestFiles).length} quest files.`, LogTextColor_1.LogTextColor.GREEN);
}
// Import quest data to the database
let questCount = 0;
for (const file of jsonQuestFiles) {
for (const quest in file) {
this.instanceManager.database.templates.quests[quest] = file[quest];
questCount++;
}
}
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] QuestAPI: ${trader} Loaded ${questCount} tasks.`, LogTextColor_1.LogTextColor.GREEN);
}
}
/**
* Import Quest side data into the config server
*/
importQuestSideConfig() {
const questConfig = this.instanceManager.configServer.getConfig(ConfigTypes_1.ConfigTypes.QUEST);
const questSideFile = fs.readFileSync(this.instanceManager.dbPath.concat("/Quests/QuestSideData.json"), "utf-8");
const questSideJson = JSON.parse(questSideFile);
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] QuestAPI: ${questSideJson["UsecOnly"]}`, LogTextColor_1.LogTextColor.BLUE);
}
for (const entry of questSideJson["UsecOnly"]) {
questConfig.usecOnlyQuests.push(entry);
}
for (const entry of questSideJson["BearOnly"]) {
questConfig.bearOnlyQuests.push(entry);
}
}
/**
* Import locale data into the database
*/
importLocaleData(jsonLocaleFiles, trader) {
if (Object.keys(jsonLocaleFiles).length < 1) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] QuestAPI: ${trader} No quest locale files.`, LogTextColor_1.LogTextColor.RED);
return;
}
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] QuestAPI: ${trader} Loading ${Object.keys(jsonLocaleFiles).length} locale files.`, LogTextColor_1.LogTextColor.GREEN);
}
// Import quest locales to the database
let localeCount = 0;
for (const file of jsonLocaleFiles) {
for (const locale in file) {
this.instanceManager.database.locales.global["en"][locale] = file[locale];
localeCount++;
}
}
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] QuestAPI: ${trader} Loaded ${localeCount} locales.`, LogTextColor_1.LogTextColor.GREEN);
}
}
/**
* Set up routes for image data
*/
importImageData(jsonImageFiles, trader) {
let imageCount = 0;
for (const imagePath of jsonImageFiles) {
this.instanceManager.imageRouter.addRoute(`/files/quest/icon/${path.basename(imagePath, path.extname(imagePath))}`, imagePath);
imageCount++;
}
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] QuestAPI: ${trader} Loaded ${imageCount} images.`, LogTextColor_1.LogTextColor.GREEN);
}
}
}
exports.QuestAPI = QuestAPI;
//# sourceMappingURL=QuestAPI.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,374 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuestModifier = void 0;
class QuestModifier {
// Helper method to update items in all AvailableForFinish conditions
updateItemsInAllAvailableForFinish(questID, items, type, tables, jsonUtil, debug) {
const quest = tables.templates.quests[questID];
if (quest) {
try {
const availableForFinish = quest.conditions.AvailableForFinish;
let modified = false;
for (const conditionGroup of availableForFinish) {
const conditions = conditionGroup.counter.conditions[0];
if (type === 'weapon') {
const existingWeapons = jsonUtil.clone(conditions.weapon || []);
const updatedWeapons = new Set(existingWeapons);
for (const weapon of items) {
if (!updatedWeapons.has(weapon)) {
updatedWeapons.add(weapon);
modified = true;
if (debug) {
console.log(`Added new weapon ${weapon} to AvailableForFinish condition in quest ${questID}`);
}
}
else if (debug) {
console.log(`AvailableForFinish condition in quest ${questID} already has the weapon ${weapon}`);
}
}
if (modified) {
conditions.weapon = Array.from(updatedWeapons);
if (debug) {
console.log(`Modified AvailableForFinish conditions in quest ${questID}:`, conditions.weapon);
}
}
}
else if (type === 'weaponModsInclusive' || type === 'weaponModsExclusive') {
const existingWeaponModsInclusive = jsonUtil.clone(conditions.weaponModsInclusive || []);
const updatedWeaponModsInclusive = new Set(existingWeaponModsInclusive.flat());
for (const weaponModArray of items) {
for (const weaponMod of weaponModArray) {
if (!updatedWeaponModsInclusive.has(weaponMod)) {
updatedWeaponModsInclusive.add(weaponMod);
modified = true;
if (debug) {
console.log(`Added new weapon mod ${weaponMod} to AvailableForFinish condition in quest ${questID}`);
}
}
else if (debug) {
console.log(`AvailableForFinish condition in quest ${questID} already has the weapon mod ${weaponMod}`);
}
}
}
if (modified) {
conditions.weaponModsInclusive = Array.from(updatedWeaponModsInclusive).map(mod => [mod]);
if (debug) {
console.log(`Modified AvailableForFinish conditions in quest ${questID}:`, conditions.weaponModsInclusive);
}
}
}
}
}
catch (error) {
console.error(`Error modifying items in AvailableForFinish conditions for quest ${questID}:`, error);
}
}
else {
console.warn(`Quest with ID ${questID} not found.`);
}
}
// Method to update quest data based on type, optionally push to all AvailableForFinish
updateQuestData(questID, items, type, tables, jsonUtil, pushToAllAvailableForFinish, debug, availableForFinishIndex = 0 // New parameter to specify the index
) {
if (pushToAllAvailableForFinish) {
this.updateItemsInAllAvailableForFinish(questID, items, type, tables, jsonUtil, debug);
}
else {
const quest = tables.templates.quests[questID];
if (quest) {
if (type === 'weapon') {
this.updateQuestWeapons(questID, items, tables, jsonUtil, debug, availableForFinishIndex // Pass the index to the helper method
);
}
else if (type === 'weaponModsInclusive' || type === 'weaponModsExclusive') {
this.updateQuestWeaponMods(questID, items, tables, jsonUtil, debug, availableForFinishIndex // Pass the index to the helper method
);
}
}
else {
console.warn(`Quest with ID ${questID} not found.`);
}
}
}
// Method to update weapons in the quest
updateQuestWeapons(questID, weapons, tables, jsonUtil, debug, availableForFinishIndex = 0 // New parameter to specify the index
) {
const quest = tables.templates.quests[questID];
if (quest) {
try {
// Extract existing weapons based on the specified index
const existingWeapons = quest.conditions.AvailableForFinish[availableForFinishIndex].counter.conditions[0].weapon;
// Clone the existing weapons array
const updatedWeapons = jsonUtil.clone(existingWeapons);
let modified = false;
// Add new weapons if they do not already exist
for (const weapon of weapons) {
if (!updatedWeapons.includes(weapon)) {
updatedWeapons.push(weapon);
modified = true;
if (debug) {
console.log(`Added new weapon ${weapon} to quest ${questID}`);
}
}
else if (debug) {
console.log(`Quest ${questID} already has the weapon ${weapon}`);
}
}
// Only update the quest if modifications were made
if (modified) {
quest.conditions.AvailableForFinish[availableForFinishIndex].counter.conditions[0].weapon = updatedWeapons;
if (debug) {
console.log(`Modified quest ${questID}:`, updatedWeapons);
}
}
}
catch (error) {
console.error(`Error modifying quest ${questID} weapons:`, error);
}
}
else {
console.warn(`Quest with ID ${questID} not found.`);
}
}
// Method to update weapon mods inclusive in the quest
updateQuestWeaponMods(questID, weaponModsInclusive, tables, jsonUtil, debug, availableForFinishIndex = 0 // New parameter to specify the index
) {
const quest = tables.templates.quests[questID];
if (quest) {
try {
// Extract existing weapon mods inclusive based on the specified index
const availableForFinish = quest.conditions.AvailableForFinish;
if (availableForFinish.length <= availableForFinishIndex) {
console.warn(`Index ${availableForFinishIndex} is out of bounds for AvailableForFinish in quest ${questID}.`);
return;
}
const existingWeaponModsInclusive = availableForFinish[availableForFinishIndex].counter.conditions[0].weaponModsInclusive;
// Clone the existing weapon mods inclusive array
const updatedWeaponModsInclusive = jsonUtil.clone(existingWeaponModsInclusive);
let modified = false;
// Add new weapon mods if they do not already exist
for (const weaponModArray of weaponModsInclusive) {
for (const weaponMod of weaponModArray) {
if (!updatedWeaponModsInclusive.flat().includes(weaponMod)) {
updatedWeaponModsInclusive.push(weaponModArray);
modified = true;
if (debug) {
console.log(`Added new weapon mod ${weaponMod} to quest ${questID}`);
}
}
else if (debug) {
console.log(`Quest ${questID} already has the weapon mod ${weaponMod}`);
}
}
}
// Only update the quest if modifications were made
if (modified) {
availableForFinish[availableForFinishIndex].counter.conditions[0].weaponModsInclusive = updatedWeaponModsInclusive;
if (debug) {
console.log(`Modified quest ${questID}:`, updatedWeaponModsInclusive);
}
}
}
catch (error) {
console.error(`Error modifying quest ${questID} weapon mods inclusive:`, error);
}
}
else {
console.warn(`Quest with ID ${questID} not found.`);
}
}
// Method to modify quests with specific items and updates
modifyQuests(tables, jsonUtil, debug) {
// Define new items
const newSuppressors = [
["21592d3fa4a2a0fa07fc5c2e"],
["21cc9c10a1749109db74b288"],
["ee43d2dd34047cbe88ccf551"],
["ba84e1c4ee4d504cb0bdbb0d"],
["40c62378fa93a829532ecc5e"],
["6d9f22a75064ebb92b3ece1c"],
["10a09a7adb949d7516c96c2f"],
["ea0407e322d619bdb163795c"],
["9f56d67e30b6ee14fbd99821"],
["f8e4f114d51be3084526ebdd"],
["71da7f0c9145e92bd1022c53"],
["6504516826a65f22fcb408bb"],
["bd88c49e7facfbf335cbc734"],
["46985a823edd7a01b03450ed"],
["4129c7c9c0669b718451b168"],
["5285550299ccac9d530a7ed1"],
["8a25358a28252c3b7fcb7e4a"],
["d9c2ce5c957a54390a795cb9"],
["f1d4272393162487b5896f2f"],
["aac2e5628ec0f31213f1f53b"],
["96c3f1dba8c2038398a29d47"],
["48b2b70316ee11cd78074149"],
["82144d6a0be3285243f60c50"],
["0d26a697d357f0ea3f8f9a83"],
["1d145684ac5119451eec9699"],
["d29f21dabbdb6a8577bd5a4c"],
["55d267e876b4709cc2115736"],
["b9a6137901c6b1dd27c0c0cd"],
["68ecc6afc9baacad535b09b5"],
["cc4134b4c122adad37aa342a"],
["6efbc3fc36558fb085bbc36e"],
["3cc1a01be7839321ab030074"],
["f07b843f00a254d10d80ea5a"],
["9c8b54c2f8c843fe7ce6c6ca"],
["a6a1f3e9ff8c9bddaf8ab5f3"],
["21db41fa34f997937c78b9d1"],
["0a4fce1b6ffcba383df0def7"],
["b02e5f84df2f2f062a309ef9"],
["09b44a7e34b49045e3308e58"],
["edb383eec77614c936e627ec"],
["08ce1f8189bcb4aa4a490d28"],
["dfb4f1c3e5b85305c24ed2bc"],
["bfa234cc36aac6c9e1190ab1"],
["8d28d2b0bc17dad17f09676d"],
["a1fd0589018e71233daeb331"],
["45b07217916365a3171c079e"],
["005ea36cedb4cf3ed6503746"],
["34811b81bb2bf7d6ecc8685d"],
["9911241c521cf272e28138ab"],
["79b662be6504a4c5c58b662e"],
["07e6732878542a85411811df"],
["67a198d04e36e7c17ead7f55"],
["81cae3ac1c35a1f46157c891"],
["908aacf3d6a56a7a0d1ade69"],
["bf593ba2155d31edd2b421c7"],
["d461f4916807b7599b22f284"],
["0b33e835730e05c6a996f452"],
["24a57da0bf24002c1b8b31d9"],
["e37c8df358fdec9a8780ea8c"],
["e0070ec5799a2d6228eca115"],
["5cc125555c98bf150a4fd068"],
["c55bf7b1464db07d86ea62e8"]
];
const newScopesExcluded = [
["5eb8a73e2c5eae1c5118afcb"],
["a87b4ff0e4df1af49c4d48b7"],
["bf8cf7b9d0f73ce039591c65"],
["09f8fed0abd75fbd0f81cd91"],
["c3ad313c8108f49a65187daf"],
["aad949705aece28fb98b820f"],
["08eb2cce6b620c5c8550a0b5"],
["cd1f0458b18b79f2da3ad03f"],
["f5a80c63c2845fbc7c0c00b0"],
["e9341af94ccbdf828aac2ed4"],
["1e3c5a570c1c628376877232"],
["530c92166b34a8f2c2c96732"],
["5518037d5b8964f16bd7fa0b"],
["765efc3218305b91ce279f7c"],
["86509ab9a719ec35d68335ec"],
["427426766389fca83151e49a"],
["8e91893cd97979e31dc69ff4"],
["ee7de8251099e046b66a27a8"],
["98faf3e813c71c69fdc058a6"],
["5114ba0ec07b64d2027476c3"],
["028cf9570b14453d61753a76"],
["0433f01e906bc793e94272dd"],
["f4792fb5785c3cbfcd5e8e42"],
["6d875b085e791a94448f6373"],
["ed3ce625f8d5660361ffaf30"],
["96cff8d59fab622a65e41136"],
["a9567853f9fc33f38c4180ac"],
["51054b0249f56482df575434"],
["a1552040390284f58de50a7a"],
["797e1ab4422217d7cfe3d299"],
["9936df6f6d9d13591df75e06"],
["c5042b1c75088ddfc6c196f4"],
["4af1cb09ea310f1fcf94d32a"],
["12f2d58f76f9629580851b6f"],
["3f18b9a4a43e2c071b08179a"],
["dd7caf9bd203b146528c8da4"],
["36c4b709b7b9465d6e875d35"],
["35adebfd2014a2861056138b"],
["20c6ee849ac15cb4e31472c9"],
["2589a5a2424122404cf3a94c"],
["026dfdb287f69c3025f0f728"],
["013a6d4ff28f8e4331898d68"]
];
const new74Us = [
"ed05294ed53c0400ae0e8a55"
];
const newM4s = [
"4b81488c78c8a8ac7d37f9b9"
];
const newBolties = [
"0af5f6a5aa9712e11c733fb9"
];
const newAKs = [
"d672109946fe88b803449054",
"939c742f7dad852286188029",
"627c4fe34b0a558e8a3642a1",
"ed05294ed53c0400ae0e8a55",
"ffc95b9d143f52202a311820",
"3dc691f607ffed3228bf6ca2",
"52500592c7109667abb6cbeb"
];
const newCarbinesandAssaultRifles = [
"d672109946fe88b803449054",
"939c742f7dad852286188029",
"627c4fe34b0a558e8a3642a1",
"ed05294ed53c0400ae0e8a55",
"ffc95b9d143f52202a311820",
"3dc691f607ffed3228bf6ca2",
"93bcdfda236122e67c098847",
"57f28a7ffb22e277b0234219",
"e895575bcd1fa1de36d301b6",
"4b81488c78c8a8ac7d37f9b9",
"52ce1b65b13e1035808c4fd2",
"96f5c38a676e11e13544dfba",
"52500592c7109667abb6cbeb"
];
// Update each quest individually with specific items
this.updateQuestData("59c512ad86f7741f0d09de9b", // Punisher 3
new74Us, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("61e6e60223374d168a4576a6", // Compensation for damage - wager
newAKs, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("64e7b9bffd30422ed03dad38", // Gendarmerie district patrol
newCarbinesandAssaultRifles, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5bc4856986f77454c317bea7", // The Tarkov shooter Part 7
newSuppressors, 'weaponModsInclusive', tables, jsonUtil, false, debug, 0);
this.updateQuestData("59c50c8886f7745fed3193bf", // The Punisher Part 2
newSuppressors, 'weaponModsInclusive', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5a27bb8386f7741c770d2d0a", // Wet Job Part 1
newSuppressors, 'weaponModsInclusive', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5c0d4c12d09282029f539173", // Peacekeeping mission
newM4s, 'weapon', tables, jsonUtil, true, debug, 0);
this.updateQuestData("63a9b229813bba58a50c9ee5", // Worst Job in the World
newM4s, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5a27bb8386f7741c770d2d0a", // Wet Job Part 1
newM4s, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5bc4776586f774512d07cf05", // The Tarkov shooter Part 1
newBolties, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5bc479e586f7747f376c7da3", // The Tarkov shooter Part 2
newBolties, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5bc47dbf86f7741ee74e93b9", // The Tarkov shooter Part 3
newBolties, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5bc480a686f7741af0342e29", // The Tarkov shooter Part 4
newBolties, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5bc4826c86f774106d22d88b", // The Tarkov shooter Part 5
newBolties, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5bc4836986f7740c0152911c", // The Tarkov shooter Part 6
newBolties, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5bc4856986f77454c317bea7", // The Tarkov shooter Part 7
newBolties, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5bc4893c86f774626f5ebf3e", // The Tarkov shooter Part 8
newBolties, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5c0bde0986f77479cf22c2f8", // A Shooter Born in Heaven
newBolties, 'weapon', tables, jsonUtil, true, debug);
this.updateQuestData("5c0be13186f7746f016734aa", // Psycho Sniper
newBolties, 'weapon', tables, jsonUtil, false, debug, 1);
this.updateQuestData("5d25e4ca86f77409dd5cdf2c", // Hunting trip
newBolties, 'weapon', tables, jsonUtil, false, debug, 0);
this.updateQuestData("5bc4776586f774512d07cf05", // The Tarkov shooter Part 1
newScopesExcluded, 'weaponModsExclusive', tables, jsonUtil, false, debug, 0);
// Debug output
if (debug) {
console.log('Updated quests with new items.');
}
}
}
exports.QuestModifier = QuestModifier;
//# sourceMappingURL=QuestModifier.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WTTRouterService = void 0;
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
class WTTRouterService {
// eslint-disable-next-line @typescript-eslint/naming-convention
instanceManager;
preSptLoad(instance) {
this.instanceManager = instance;
this.registerQuestZoneRoute();
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] WTTRouter: Initialized and registered routes.`, LogTextColor_1.LogTextColor.GREEN);
}
}
registerQuestZoneRoute() {
this.instanceManager.staticRouter.registerStaticRouter("GetZones", [
{
url: "/quests/zones/getZones",
action: async (url, info, sessionId, output) => {
const json = JSON.stringify(this.instanceManager.database.globals["QuestZones"]);
this.instanceManager.logger.log(`[${this.instanceManager.modName}] WTTRouter: Zones requested by client`, LogTextColor_1.LogTextColor.GREEN);
return json;
}
}
], "");
}
}
exports.WTTRouterService = WTTRouterService;
//# sourceMappingURL=RouterService.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "RouterService.js",
"sourceRoot": "",
"sources": [
"RouterService.ts"
],
"names": [],
"mappings": ";;;AAAA,0FAAuF;AAIvF,MAAa,gBAAgB;IAEzB,gEAAgE;IACxD,eAAe,CAAqB;IAErC,UAAU,CAAC,QAA4B;QAE1C,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC;QAChC,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;YACjC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,iDAAiD,EAAE,2BAAY,CAAC,KAAK,CAAC,CAAC;QACvI,CAAC;IACL,CAAC;IAEO,sBAAsB;QAE1B,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,oBAAoB,CAClD,UAAU,EACV;YACI;gBACI,GAAG,EAAE,wBAAwB;gBAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;oBAE3C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CACvB,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CACtD,CAAC;oBACF,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,wCAAwC,EAAE,2BAAY,CAAC,KAAK,CAAC,CAAC;oBAC9H,OAAO,IAAI,CAAC;gBAChB,CAAC;aACJ;SACJ,EACD,EAAE,CACL,CAAC;IACN,CAAC;CAEJ;AAnCD,4CAmCC"
}

View file

@ -0,0 +1,134 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TraderAPI = void 0;
/* eslint-disable @typescript-eslint/naming-convention */
const path_1 = __importDefault(require("path"));
const fs_1 = __importDefault(require("fs"));
const Traders_1 = require("C:/snapshot/project/obj/models/enums/Traders");
const ConfigTypes_1 = require("C:/snapshot/project/obj/models/enums/ConfigTypes");
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
class TraderAPI {
instanceManager;
dbPath;
preSptLoad(Instance) {
this.instanceManager = Instance;
this.dbPath = path_1.default.join(this.instanceManager.dbPath, "\/Traders");
}
postDBLoad() {
}
/**
* Trader to load database for
* db/Traders/@param trader/{content}
* @returns
*/
async loadTraderDbRecursive(trader) {
const mydb = await this.instanceManager.importerUtil.loadAsync(path_1.default.join(this.dbPath, `\/${trader}\/`));
return mydb;
}
/**
* Load base.json for trader
* db/Traders/@param trader/@param trader-base.json
*
* @returns
*/
loadTraderBaseJson(trader) {
const file = fs_1.default.readFileSync(path_1.default.join(this.dbPath, `\/${trader}\/${trader}_Base.json`), "utf8");
const json = JSON.parse(file);
return json;
}
/**
* Load Assort.json for trader
* db/Traders/@param trader/@param trader-Assort.json
*
* @returns
*/
loadTraderAssortJson(trader) {
const file = fs_1.default.readFileSync(path_1.default.join(this.dbPath, `\/${trader}\/${trader}_Assort.json`), "utf8");
const json = JSON.parse(file);
return json;
}
/**
* Load QuestAssort.json for trader
* db/Traders/@param trader/@param trader-Assort.json
*
* @returns
*/
loadTraderQuestAssortJson(trader) {
const file = fs_1.default.readFileSync(path_1.default.join(this.dbPath, `\/${trader}\/${trader}_QuestAssort.json`), "utf8");
const json = JSON.parse(file);
return json;
}
setupTrader(trader, baseJson) {
const traderConfig = this.instanceManager.configServer.getConfig(ConfigTypes_1.ConfigTypes.TRADER);
const refreshTimeSecondsMin = 3600;
const refreshTimeSecondsMax = 4000;
// Add refresh time in seconds to config
const traderRefreshRecord = {
traderId: baseJson._id,
seconds: {
min: refreshTimeSecondsMin,
max: refreshTimeSecondsMax
}
};
traderConfig.updateTime.push(traderRefreshRecord);
this.registerProfileImage(trader, baseJson);
Traders_1.Traders[baseJson._id] = baseJson._id;
}
/**
*
* @param mydb traders database
* @param trader traders name Ex. "GoblinKing"
* @param baseJson traders base.json
* @param assortJson traders assort.json
* @param questAssortJson Traders quest assort
*/
addTraderToDb(mydb, trader, baseJson, assortJson, questAssortJson) {
this.instanceManager.database.traders[baseJson._id] = {
assort: this.instanceManager.jsonUtil.deserialize(this.instanceManager.jsonUtil.serialize(assortJson)),
base: JSON.parse(JSON.stringify({ ...baseJson, unlockedByDefault: true })),
questassort: JSON.parse(JSON.stringify(questAssortJson))
};
const ragfairConfig = this.instanceManager.configServer.getConfig(ConfigTypes_1.ConfigTypes.RAGFAIR);
ragfairConfig.traders[baseJson._id] = true;
const locales = this.instanceManager.database.locales.global;
locales.en = {
...locales.en,
...mydb?.locales?.en
};
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] TraderAPI: ${trader} added item locales.`, LogTextColor_1.LogTextColor.GREEN);
}
this.addTraderToLocales(trader, baseJson);
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] TraderAPI: ${trader} successfully added to database.`, LogTextColor_1.LogTextColor.GREEN);
}
}
/**
* @param trader traders name "GoblinKing"
* @param baseJson traders base.json
*/
addTraderToLocales(trader, baseJson) {
const locales = this.instanceManager.database.locales.global;
let count = 0;
for (const locale in locales) {
locales[locale][`${baseJson._id} FullName`] = baseJson.name;
locales[locale][`${baseJson._id} FirstName`] = baseJson.firstname;
locales[locale][`${baseJson._id} Nickname`] = baseJson.nickname;
locales[locale][`${baseJson._id} Location`] = baseJson.location;
locales[locale][`${baseJson._id} Description`] = baseJson.description;
count++;
}
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] TraderAPI: ${trader} loaded ${count} locales`, LogTextColor_1.LogTextColor.GREEN);
}
}
registerProfileImage(trader, baseJson) {
const imageFilepath = `./${this.instanceManager.preSptModLoader.getModPath(this.instanceManager.modName)}res`;
this.instanceManager.imageRouter.addRoute(baseJson.avatar.replace(".png", ""), `${imageFilepath}/${trader}.png`);
}
}
exports.TraderAPI = TraderAPI;
//# sourceMappingURL=TraderAPI.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "TraderAPI.js",
"sourceRoot": "",
"sources": [
"TraderAPI.ts"
],
"names": [],
"mappings": ";;;;;;AAAA,yDAAyD;AACzD,gDAAwB;AACxB,4CAAoB;AAEpB,0EAAuE;AAGvE,kFAA+E;AAC/E,0FAAuF;AAIvF,MAAa,SAAS;IAEV,eAAe,CAAqB;IAEpC,MAAM,CAAU;IAEjB,UAAU,CAAC,QAA4B;QAE1C,IAA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AI,CAAC;YAC5D,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,YAAY,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC;YAClE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC;YAChE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC;YAChE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,cAAc,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC;YACtE,KAAK,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;YACjC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,gBAAgB,MAAM,WAAW,KAAK,UAAU,EAAE,2BAAY,CAAC,KAAK,CAAC,CAAC;QACtI,CAAC;IACL,CAAC;IAEO,oBAAoB,CAAC,MAAc,EAAE,QAAa;QAEtD,MAAM,aAAa,GAAG,KAAK,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC;QAC9G,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,aAAa,IAAI,MAAM,MAAM,CAAC,CAAC;IACrH,CAAC;CAEJ;AA7JD,8BA6JC"
}

View file

@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TraderBadger = void 0;
const ConfigTypes_1 = require("C:/snapshot/project/obj/models/enums/ConfigTypes");
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
class TraderBadger {
mydb;
instanceManager;
BadgerBaseJson;
BadgerAssort;
BadgerQuestAssort;
/**
* Some work needs to be done prior to SPT code being loaded, registering the profile image + setting trader update time inside the trader config json
* @param Instance WTTInstanceManager
*/
preSptLoad(Instance) {
this.instanceManager = Instance;
this.BadgerBaseJson = this.instanceManager.traderApi.loadTraderBaseJson("bd3a8b28356d9c6509966546");
this.BadgerAssort = this.instanceManager.traderApi.loadTraderAssortJson("bd3a8b28356d9c6509966546");
this.BadgerQuestAssort = this.instanceManager.traderApi.loadTraderQuestAssortJson("bd3a8b28356d9c6509966546");
this.instanceManager.traderApi.setupTrader("bd3a8b28356d9c6509966546", this.BadgerBaseJson);
if (this.instanceManager.debug) {
this.instanceManager.logger.log(`[${this.instanceManager.modName}] Trader: Badger Active`, LogTextColor_1.LogTextColor.GREEN);
}
}
/**
* Majority of trader-related work occurs after the aki database has been loaded but prior to SPT code being run
*/
postDBLoad() {
this.mydb = this.instanceManager.traderApi.loadTraderDbRecursive("bd3a8b28356d9c6509966546");
this.instanceManager.traderApi.addTraderToDb(this.mydb, "bd3a8b28356d9c6509966546", this.BadgerBaseJson, this.BadgerAssort, this.BadgerQuestAssort);
//Load quests
this.instanceManager.questApi.loadQuestsFromDirectory("bd3a8b28356d9c6509966546");
//this.instanceManager.questApi.importQuestZones(BadgerZones, "Badger");
const insuranceConfig = this.instanceManager.configServer.getConfig(ConfigTypes_1.ConfigTypes.INSURANCE);
insuranceConfig.returnChancePercent["bd3a8b28356d9c6509966546"] = 95;
}
}
exports.TraderBadger = TraderBadger;
//# sourceMappingURL=TraderBadger.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "TraderBadger.js",
"sourceRoot": "",
"sources": [
"TraderBadger.ts"
],
"names": [],
"mappings": ";;;AAGA,kFAA+E;AAE/E,0FAAuF;AAEvF,MAAa,YAAY;IAErB,IAAI,CAAM;IACF,eAAe,CAAqB;IACpC,cAAc,CAAC;IACf,YAAY,CAA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AAC;QAE7G,eAAe,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,GAAG,EAAE,CAAC;IACzE,CAAC;CACJ;AA3CD,oCA2CC"
}

View file

@ -0,0 +1,109 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.WTTInstanceManager = void 0;
const path = __importStar(require("node:path"));
const RouterService_1 = require("./RouterService");
const QuestAPI_1 = require("./QuestAPI");
const TraderAPI_1 = require("./TraderAPI");
class WTTInstanceManager {
//#region Accessible in or after preSptLoad
modName;
debug;
// Useful Paths
modPath = path.join(process.cwd(), "\/user\/mods\/EpicRangeTime-Weapons\/");
dbPath = path.join(process.cwd(), "\/user\/mods\/EpicRangeTime-Weapons\/db");
profilePath = path.join(process.cwd(), "\/user\/profiles");
// Instances
container;
preSptModLoader;
configServer;
saveServer;
itemHelper;
logger;
staticRouter;
dynamicRouter;
profileController;
profileCallbacks;
routerService = new RouterService_1.WTTRouterService();
//#endregion
//#region Acceessible in or after postDBLoad
database;
customItem;
imageRouter;
jsonUtil;
profileHelper;
eventOutputHolder;
ragfairPriceService;
importerUtil;
traderAssortService;
applicationContext;
questApi = new QuestAPI_1.QuestAPI();
traderApi = new TraderAPI_1.TraderAPI();
//#endregion
// Call at the start of the mods postDBLoad method
preSptLoad(container, mod) {
this.modName = mod;
this.container = container;
this.preSptModLoader = container.resolve("PreSptModLoader");
this.imageRouter = container.resolve("ImageRouter");
this.configServer = container.resolve("ConfigServer");
this.saveServer = container.resolve("SaveServer");
this.itemHelper = container.resolve("ItemHelper");
this.eventOutputHolder = container.resolve("EventOutputHolder");
this.profileController = container.resolve("ProfileController");
this.profileCallbacks = container.resolve("ProfileCallbacks");
this.logger = container.resolve("WinstonLogger");
this.staticRouter = container.resolve("StaticRouterModService");
this.dynamicRouter = container.resolve("DynamicRouterModService");
this.traderAssortService = container.resolve("TraderAssortService");
this.questApi.preSptLoad(this);
this.traderApi.preSptLoad(this);
this.routerService.preSptLoad(this);
}
postDBLoad(container) {
this.database = container.resolve("DatabaseServer").getTables();
this.customItem = container.resolve("CustomItemService");
this.jsonUtil = container.resolve("JsonUtil");
this.profileHelper = container.resolve("ProfileHelper");
this.ragfairPriceService = container.resolve("RagfairPriceService");
this.importerUtil = container.resolve("ImporterUtil");
this.applicationContext = container.resolve("ApplicationContext");
this.traderApi.postDBLoad();
this.questApi.postDBLoad();
}
}
exports.WTTInstanceManager = WTTInstanceManager;
//# sourceMappingURL=WTTInstanceManager.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "WTTInstanceManager.js",
"sourceRoot": "",
"sources": [
"WTTInstanceManager.ts"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAuBlC,mDAAmD;AACnD,yCAAsC;AACtC,2CAAwC;AAExC,MAAa,kBAAkB;IAE3B,2CAA2C;IACpC,OAAO,CAAS;IAChB,KAAK,C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C,CAAC;QACvE,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC,OAAO,CAAsB,qBAAqB,CAAC,CAAC;QACzF,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,OAAO,CAAe,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC,OAAO,CAAqB,oBAAoB,CAAC,CAAC;QAEtF,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAC5B,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC/B,CAAC;CAEJ;AA9ED,gDA8EC"
}

View file

@ -0,0 +1,93 @@
"use strict";
/* eslint-disable @typescript-eslint/naming-convention */
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const node_fs_1 = __importDefault(require("node:fs"));
const node_path_1 = __importDefault(require("node:path"));
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
// WTT imports
const WTTInstanceManager_1 = require("./WTTInstanceManager");
const CustomItemService_1 = require("./CustomItemService");
const EpicsEdits_1 = require("./EpicsEdits");
const TraderBadger_1 = require("./Traders/TraderBadger");
// Custom Trader Assort Items
const CustomAssortSchemeService_1 = require("./CustomAssortSchemeService");
const CustomWeaponPresets_1 = require("./CustomWeaponPresets");
class EpicRangeTimeWeapons {
Instance = new WTTInstanceManager_1.WTTInstanceManager();
version;
modName = "EpicRangeTime-Weapons";
config;
customItemService = new CustomItemService_1.CustomItemService();
epicItemClass = new EpicsEdits_1.epicItemClass();
traderBadger = new TraderBadger_1.TraderBadger();
customAssortSchemeService = new CustomAssortSchemeService_1.CustomAssortSchemeService();
customWeaponPresets = new CustomWeaponPresets_1.CustomWeaponPresets();
debug = false;
// Anything that needs done on preSptLoad, place here.
preSptLoad(container) {
// Initialize the instance manager DO NOTHING ELSE BEFORE THIS
this.Instance.preSptLoad(container, this.modName);
this.Instance.debug = this.debug;
// EVERYTHING AFTER HERE MUST USE THE INSTANCE
this.getVersionFromJson();
this.displayCreditBanner();
this.customItemService.preSptLoad(this.Instance);
this.epicItemClass.preSptLoad(this.Instance);
this.traderBadger.preSptLoad(this.Instance);
this.customAssortSchemeService.preSptLoad(this.Instance);
this.customWeaponPresets.preSptLoad(this.Instance);
}
// Anything that needs done on postDBLoad, place here.
async postDBLoadAsync(container) {
// Initialize the instance manager DO NOTHING ELSE BEFORE THIS
this.Instance.postDBLoad(container);
// EVERYTHING AFTER HERE MUST USE THE INSTANCE
this.epicItemClass.postDBLoad();
await this.traderBadger.postDBLoad();
this.customItemService.postDBLoad();
this.customAssortSchemeService.postDBLoad();
this.customWeaponPresets.postDBLoad();
this.Instance.logger.log(`[${this.modName}] Database: Loading complete.`, LogTextColor_1.LogTextColor.GREEN);
}
getVersionFromJson() {
const packageJsonPath = node_path_1.default.join(__dirname, "../package.json");
node_fs_1.default.readFile(packageJsonPath, "utf-8", (err, data) => {
if (err) {
console.error("Error reading file:", err);
return;
}
const jsonData = JSON.parse(data);
this.version = jsonData.version;
});
}
colorLog(message, color) {
const colorCodes = {
red: "\x1b[31m",
green: "\x1b[32m",
yellow: "\x1b[33m",
blue: "\x1b[34m",
magenta: "\x1b[35m",
cyan: "\x1b[36m",
white: "\x1b[37m",
gray: "\x1b[90m",
brightRed: "\x1b[91m",
brightGreen: "\x1b[92m",
brightYellow: "\x1b[93m",
brightBlue: "\x1b[94m",
brightMagenta: "\x1b[95m",
brightCyan: "\x1b[96m",
brightWhite: "\x1b[97m"
};
const resetCode = "\x1b[0m";
const colorCode = colorCodes[color] || "\x1b[37m"; // Default to white if color is invalid.
console.log(`${colorCode}${message}${resetCode}`); // Log the colored message here
}
displayCreditBanner() {
this.colorLog(`[${this.modName}] Developers: EpicRangeTime Code Framework: GroovypenguinX - Thank you guys for everything.`, "green");
}
}
module.exports = { mod: new EpicRangeTimeWeapons() };
//# sourceMappingURL=mod.js.map

View file

@ -0,0 +1,10 @@
{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;YACjB,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,UAAU;YACrB,WAAW,EAAE,UAAU;YACvB,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,UAAU;YACtB,aAAa,EAAE,UAAU;YACzB,UAAU,EAAE,UAAU;YACtB,WAAW,EAAE,UAAU;SAC1B,CAAC;QAEF,MAAM,SAAS,GAAG,SAAS,CAAC;QAC5B,MAAM,SAAS,GAAG,UAAU,CAAC,KAAgC,CAAC,IAAI,UAAU,CAAC,CAAC,wCAAwC;QACtH,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,+BAA+B;IACtF,CAAC;IAEO,mBAAmB;QAEvB,IAAI,CAAC,QAAQ,CACZ,IAAI,IAAI,CAAC,OAAO,gGAAgG,EAAE,OAAO,CAAC,CAAC;IAChI,CAAC;CACJ;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,GAAG,EAAE,IAAI,oBAAoB,EAAE,EAAE,CAAC"
}

View file

@ -0,0 +1,93 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stashes = exports.inventorySlots = exports.allBotTypes = exports.currencyIDs = exports.traderIDs = void 0;
;
// Traders and Task related items
//#region Enums
var traderIDs;
(function (traderIDs) {
traderIDs["MECHANIC"] = "5a7c2eca46aef81a7ca2145d";
traderIDs["SKIER"] = "58330581ace78e27b8b10cee";
traderIDs["PEACEKEEPER"] = "5935c25fb3acc3127c3d8cd9";
traderIDs["THERAPIST"] = "54cb57776803fa99248b456e";
traderIDs["PRAPOR"] = "54cb50c76803fa8b248b4571";
traderIDs["JAEGER"] = "5c0647fdd443bc2504c2d371";
traderIDs["RAGMAN"] = "5ac3b934156ae10c4430e83c";
traderIDs["FENCE"] = "579dc571d53a0658a154fbec";
traderIDs["GOBLINKING"] = "GoblinKing";
traderIDs["CONDUCTOR"] = "Conductor";
traderIDs["COURIER"] = "Courier";
traderIDs["CROW"] = "Crow";
traderIDs["WOLF"] = "Wolf";
traderIDs["JUNKDEALER"] = "JunkDealer";
traderIDs["WTTDATABASE"] = "WTTDatabase";
traderIDs["BADGER"] = "bd3a8b28356d9c6509966546";
})(traderIDs || (exports.traderIDs = traderIDs = {}));
var currencyIDs;
(function (currencyIDs) {
currencyIDs["ROUBLES"] = "5449016a4bdc2d6f028b456f";
currencyIDs["EUROS"] = "569668774bdc2da2298b4568";
currencyIDs["DOLLARS"] = "5696686a4bdc2da3298b456a";
})(currencyIDs || (exports.currencyIDs = currencyIDs = {}));
var allBotTypes;
(function (allBotTypes) {
allBotTypes["ARENAFIGHTER"] = "arenafighter";
allBotTypes["ARENAFIGHTEREVENT"] = "arenafighterevent";
allBotTypes["ASSAULT"] = "assault";
allBotTypes["BEAR"] = "bear";
allBotTypes["RESHALA"] = "bossbully";
allBotTypes["GLUHAR"] = "bossgluhar";
allBotTypes["KILLA"] = "bosskilla";
allBotTypes["KNIGHT"] = "bossknight";
allBotTypes["SHTURMAN"] = "bosskojaniy";
allBotTypes["SANITAR"] = "bosssanitar";
allBotTypes["TAGILLA"] = "bosstagilla";
allBotTypes["ZRYACHIY"] = "bosszryachiy";
allBotTypes["CRAZYASSAULTEVENT"] = "crazyassaultevent";
allBotTypes["CURSEDASSAULT"] = "cursedassault";
allBotTypes["EXUSEC"] = "exusec";
allBotTypes["FOLLOWERBIGPIPE"] = "followerbigpipe";
allBotTypes["FOLLOWERBIRDEYE"] = "followerbirdeye";
allBotTypes["FOLLOWERRESHALA"] = "followerbully";
allBotTypes["FOLLOWERGLUHARASSAULT"] = "followergluharassault";
allBotTypes["FOLLOWERGLUHARSCOUT"] = "followergluharscout";
allBotTypes["FOLLOWERGLUHARSECURITY"] = "followergluharsecurity";
allBotTypes["FOLLOWERGLUHARSNIPER"] = "followergluharsnipe";
allBotTypes["FOLLOWERSHTURMAN"] = "followerkojaniy";
allBotTypes["FOLLOWERSANITAR"] = "followersanitar";
allBotTypes["FOLLOWERTAGILLA"] = "followertagilla";
allBotTypes["FOLLOWERZRYACHIY"] = "followerzryachiy";
allBotTypes["GIFTER"] = "gifter";
allBotTypes["MARKSMAN"] = "marksman";
allBotTypes["PMC"] = "pmcbot";
allBotTypes["CULTISTPRIEST"] = "sectantpriest";
allBotTypes["CULTISTWARRIOR"] = "sectantwarrior";
allBotTypes["USEC"] = "usec";
})(allBotTypes || (exports.allBotTypes = allBotTypes = {}));
var inventorySlots;
(function (inventorySlots) {
inventorySlots["FirstPrimaryWeapon"] = "55d729c64bdc2d89028b4570";
inventorySlots["SecondPrimaryWeapon"] = "55d729d14bdc2d86028b456e";
inventorySlots["Holster"] = "55d729d84bdc2de3098b456b";
inventorySlots["Scabbard"] = "55d729e34bdc2d1b198b456d";
inventorySlots["FaceCover"] = "55d729e84bdc2d8a028b4569";
inventorySlots["Headwear"] = "55d729ef4bdc2d3a168b456c";
inventorySlots["TacticalVest"] = "55d729f74bdc2d87028b456e";
inventorySlots["SecuredContainer"] = "55d72a054bdc2d88028b456e";
inventorySlots["Backpack"] = "55d72a104bdc2d89028b4571";
inventorySlots["ArmorVest"] = "55d72a194bdc2d86028b456f";
inventorySlots["Pockets"] = "55d72a274bdc2de3098b456c";
inventorySlots["Earpiece"] = "5665b7164bdc2d144c8b4570";
inventorySlots["Dogtag"] = "59f0be1e86f77453be490939";
inventorySlots["Eyewear"] = "5a0ad9313f1241000e072755";
inventorySlots["ArmBand"] = "5b3f583786f77411d552fb2b";
})(inventorySlots || (exports.inventorySlots = inventorySlots = {}));
var Stashes;
(function (Stashes) {
Stashes["LEVEL1"] = "566abbc34bdc2d92178b4576";
Stashes["LEVEL2"] = "5811ce572459770cba1a34ea";
Stashes["LEVEL3"] = "5811ce662459770f6f490f32";
Stashes["LEVEL4"] = "5811ce772459770e9e5f9532";
})(Stashes || (exports.Stashes = Stashes = {}));
//#endregion
//# sourceMappingURL=configConsts.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "configConsts.js",
"sourceRoot": "",
"sources": [
"configConsts.ts"
],
"names": [],
"mappings": ";;;AA4DK,CAAC;AAmCN,iCAAiC;AAEjC,eAAe;AACf,IAAY,SAkBX;AAlBD,WAAY,SAAS;IAEjB,kDAAqC,CAAA;IACrC,+CAAkC,CAAA;IAClC,qDAAwC,CAAA;IACxC,mDAAsC,CAAA;IACtC,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,+CAAkC,CAAA;IAClC,sCAAyB,CAAA;IACzB,oCAAuB,CAAA;IACvB,gCAAmB,CAAA;IACnB,0BAAa,CAAA;IACb,0BAAa,CAAA;IACb,sCAAyB,CAAA;IACzB,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;AACvC,CAAC,EAlBW,SAAS,yBAAT,SAAS,QAkBpB;AAED,IAAY,WAKX;AALD,WAAY,WAAW;IAEnB,mDAAoC,CAAA;IACpC,iDAAkC,CAAA;IAClC,mDAAoC,CAAA;AACxC,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAED,IAAY,WAkCX;AAlCD,WAAY,WAAW;IAEnB,4CAA8B,CAAA;IAC9B,sDAAuC,CAAA;IACvC,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,oCAAqB,CAAA;IACrB,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,uCAAwB,CAAA;IACxB,sCAAuB,CAAA;IACvB,sCAAuB,CAAA;IACvB,wCAAyB,CAAA;IACzB,sDAAuC,CAAA;IACvC,8CAA+B,CAAA;IAC/B,gCAAiB,CAAA;IACjB,kDAAmC,CAAA;IACnC,kDAAmC,CAAA;IACnC,gDAAiC,CAAA;IACjC,8DAA+C,CAAA;IAC/C,0DAA2C,CAAA;IAC3C,gEAAiD,CAAA;IACjD,2DAA4C,CAAA;IAC5C,mDAAoC,CAAA;IACpC,kDAAmC,CAAA;IACnC,kDAAmC,CAAA;IACnC,oDAAqC,CAAA;IACrC,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,6BAAc,CAAA;IACd,8CAA+B,CAAA;IAC/B,gDAAiC,CAAA;IACjC,4BAAa,CAAA;AACjB,CAAC,EAlCW,WAAW,2BAAX,WAAW,QAkCtB;AAED,IAAY,cAiBX;AAjBD,WAAY,cAAc;IAEtB,iEAA+C,CAAA;IAC/C,kEAAgD,CAAA;IAChD,sDAAoC,CAAA;IACpC,uDAAqC,CAAA;IACrC,wDAAsC,CAAA;IACtC,uDAAqC,CAAA;IACrC,2DAAyC,CAAA;IACzC,+DAA6C,CAAA;IAC7C,uDAAqC,CAAA;IACrC,wDAAsC,CAAA;IACtC,sDAAoC,CAAA;IACpC,uDAAqC,CAAA;IACrC,qDAAmC,CAAA;IACnC,sDAAoC,CAAA;IACpC,sDAAoC,CAAA;AACxC,CAAC,EAjBW,cAAc,8BAAd,cAAc,QAiBzB;AAED,IAAY,OAMX;AAND,WAAY,OAAO;IAEf,8CAAmC,CAAA;IACnC,8CAAmC,CAAA;IACnC,8CAAmC,CAAA;IACnC,8CAAmC,CAAA;AACvC,CAAC,EANW,OAAO,uBAAP,OAAO,QAMlB;AA6BD,YAAY"
}

View file

@ -0,0 +1,83 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ItemBaseClassMap = void 0;
exports.ItemBaseClassMap = {
"AMMO": "5485a8684bdc2da71d8b4567",
"AMMO_CONTAINER": "543be5cb4bdc2deb348b4568",
"ARMORED_EQUIPMENT": "57bef4c42459772e8d35a53b",
"ARMBAND": "5b3f15d486f77432d0509248",
"ARMOR": "5448e54d4bdc2dcc718b4568",
"ARMORPLATE": "644120aa86ffbe10ee032b6f",
"ASSAULT_CARBINE": "5447b5fc4bdc2d87278b4567",
"ASSAULT_RIFLE": "5447b5f14bdc2d61278b4567",
"ASSAULT_SCOPE": "55818add4bdc2d5b648b456f",
"BACKPACK": "5448e53e4bdc2d60728b4567",
"BARREL": "555ef6e44bdc2de9068b457e",
"BATTERY": "57864ee62459775490116fc1",
"BIPOD": "55818afb4bdc2dde698b456d",
"BUILDING_MATERIAL": "57864ada245977548638de91",
"CHARGING_HANDLE": "55818a6f4bdc2db9688b456b",
"CHEST_RIG": "5448e5284bdc2dcb718b4567",
"COMMON_CONTAINER": "5795f317245977243854e041",
"COMPACT_REFLEX_SIGHT": "55818acf4bdc2dde698b456b",
"COMPASS": "5f4fbaaca5573a5ac31db429",
"DRINK": "5448e8d64bdc2dce718b4568",
"DRUG": "5448f3a14bdc2d27728b4569",
"ELECTRONICS": "57864a66245977548f04a81f",
"FACECOVER": "5a341c4686f77469e155819e",
"FLASHLIGHT": "55818b084bdc2d5b648b4571",
"FLASHHIDER": "550aa4bf4bdc2dd6348b456b",
"FOOD": "5448e8d04bdc2ddf718b4569",
"FOREGRIP": "55818af64bdc2d5b648b4570",
"FUEL": "5d650c3e815116009f6201d2",
"GAS_BLOCK": "56ea9461d2720b67698b456f",
"GRENADE_LAUNCHER": "5447bedf4bdc2d87278b4568",
"HANDGUN": "5447b5cf4bdc2d65278b4567",
"HANDGUARD": "55818a104bdc2db9688b4569",
"HEADPHONES": "5645bcb74bdc2ded0b8b4578",
"HEADWEAR": "5a341c4086f77401f2541505",
"INFO": "5448ecbe4bdc2d60728b4568",
"INVENTORY": "55d720f24bdc2d88028b456d",
"IRON_SIGHT": "55818ac54bdc2d5b648b456e",
"KEYCARD": "5c164d2286f774194c5e69fa",
"KEYMECHANICAL": "5c99f98d86f7745c314214b3",
"KEY_CARD": "5c164d2286f774194c5e69fa",
"KNIFE": "5447e1d04bdc2dff2f8b4567",
"LOCKING_CONTAINER": "5671435f4bdc2d96058b4569",
"LOOT_CONTAINER": "566965d44bdc2d814c8b4571",
"LUBRICANT": "57864e4c24597754843f8723",
"MACHINEGUN": "5447bed64bdc2d97278b4568",
"MAGAZINE": "5448bc234bdc2d3c308b4569",
"MAP": "567849dd4bdc2d150f8b456e",
"MARKSMAN_RIFLE": "5447b6194bdc2d67278b4567",
"MEDICAL_ITEM": "5448f3ac4bdc2dce718b4569",
"MEDICAL_SUPPLIES": "57864c8c245977548867e7f1",
"MEDITKIT": "5448f39d4bdc2d0a728b4568",
"MONEY": "543be5dd4bdc2deb348b4569",
"MUZZLECOMBO": "550aa4dd4bdc2dc9348b4569",
"MOUNT": "55818b224bdc2dde698b456f",
"NIGHTVISION": "5a2c3a9486f774688b05e574",
"OTHER": "590c745b86f7743cc433c5f2",
"PISTOLGRIP": "55818a684bdc2ddd698b456d",
"POCKETS": "557596e64bdc2dc2118b4571",
"PORTABLE_RANGEFINDER": "61605ddea09d851a0a0c1bbc",
"RANDOMLOOTCONTAINER": "62f109593b54472778797866",
"RECEIVER": "55818a304bdc2db5418b457d",
"REFLEX_SIGHT": "55818ad54bdc2ddc698b4569",
"REPAIRKITS": "616eb7aea207f41933308f46",
"SCOPE": "55818ae44bdc2dde698b456c",
"SHOTGUN": "5447b6094bdc2dc3278b4567",
"SILENCER": "550aa4cd4bdc2dd8348b456c",
"SNIPER_RIFLE": "5447b6254bdc2dc3278b4568",
"SPECIAL_ITEM": "5447e0e74bdc2d3c308b4567",
"STASH": "566abbb64bdc2d144c8b457d",
"STATIONARY_CONT.": "567583764bdc2d98058b456e",
"STIMULANT": "5448f3a64bdc2d60728b456a",
"STOCK": "55818a594bdc2db9688b456a",
"THROWABLE_WEAPON": "543be6564bdc2df4348b4568",
"THERMALVISION": "5d21f59b6dbe99052b54ef83",
"TOOL": "57864bb7245977548b3b66c2",
"UBGL": "55818b014bdc2ddc698b456b",
"VIS_OBSERV_DEVICE": "5448e5724bdc2ddf718b4568",
};
//# sourceMappingURL=itemBaseClasses.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "itemBaseClasses.js",
"sourceRoot": "",
"sources": [
"itemBaseClasses.ts"
],
"names": [],
"mappings": ";;;AAAa,QAAA,gBAAgB,GAAmC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;IACxC,UAAU,EAAE,0BAA0B;IACtC,KAAK,EAAE,0BAA0B;IACjC,gBAAgB,EAAE,0BAA0B;IAC5C,cAAc,EAAE,0BAA0B;IAC1C,kBAAkB,EAAE,0BAA0B;IAC9C,UAAU,EAAE,0BAA0B;IACtC,OAAO,EAAE,0BAA0B;IACnC,aAAa,EAAE,0BAA0B;IACzC,OAAO,EAAE,0BAA0B;IACnC,aAAa,EAAE,0BAA0B;IACzC,OAAO,EAAE,0BAA0B;IACnC,YAAY,EAAE,0BAA0B;IACxC,SAAS,EAAE,0BAA0B;IACrC,sBAAsB,EAAE,0BAA0B;IAClD,qBAAqB,EAAE,0BAA0B;IACjD,UAAU,EAAE,0BAA0B;IACtC,cAAc,EAAE,0BAA0B;IAC1C,YAAY,EAAE,0BAA0B;IACxC,OAAO,EAAE,0BAA0B;IACnC,SAAS,EAAE,0BAA0B;IACrC,UAAU,EAAE,0BAA0B;IACtC,cAAc,EAAE,0BAA0B;IAC1C,cAAc,EAAE,0BAA0B;IAC1C,OAAO,EAAE,0BAA0B;IACnC,kBAAkB,EAAE,0BAA0B;IAC9C,WAAW,EAAE,0BAA0B;IACvC,OAAO,EAAE,0BAA0B;IACnC,kBAAkB,EAAE,0BAA0B;IAC9C,eAAe,EAAE,0BAA0B;IAC3C,MAAM,EAAE,0BAA0B;IAClC,MAAM,EAAE,0BAA0B;IAClC,mBAAmB,EAAE,0BAA0B;CAChD,CAAC"
}

View file

@ -0,0 +1,85 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ItemHandbookCategoryMap = void 0;
exports.ItemHandbookCategoryMap = {
"AMMO": "5b47574386f77428ca22b346",
"AMMO_BOXES": "5b47574386f77428ca22b33c",
"AMMO_ROUNDS": "5b47574386f77428ca22b33b",
"BARTER": "5b47574386f77428ca22b33e",
"BARTER_BUILDING": "5b47574386f77428ca22b2ee",
"BARTER_ELECTRONICS": "5b47574386f77428ca22b2ef",
"BARTER_ENERGY": "5b47574386f77428ca22b2ed",
"BARTER_FLAMMABLE": "5b47574386f77428ca22b2f2",
"BARTER_HOUSEHOLD": "5b47574386f77428ca22b2f0",
"BARTER_MEDICAL": "5b47574386f77428ca22b2f3",
"BARTER_OTHERS": "5b47574386f77428ca22b2f4",
"BARTER_TOOLS": "5b47574386f77428ca22b2f6",
"BARTER_VALUABLES": "5b47574386f77428ca22b2f1",
"GEAR": "5b47574386f77428ca22b33f",
"GEAR_ARMOR": "5b5f701386f774093f2ecf0f",
"GEAR_BACKPACKS": "5b5f6f6c86f774093f2ecf0b",
"GEAR_CASES": "5b5f6fa186f77409407a7eb7",
"GEAR_COMPONENTS": "5b5f704686f77447ec5d76d7",
"GEAR_FACECOVERS": "5b47574386f77428ca22b32f",
"GEAR_HEADSETS": "5b5f6f3c86f774094242ef87",
"GEAR_HEADWEAR": "5b47574386f77428ca22b330",
"GEAR_RIGS": "5b5f6f8786f77447ed563642",
"GEAR_SECURED": "5b5f6fd286f774093f2ecf0d",
"GEAR_VISORS": "5b47574386f77428ca22b331",
"INFO": "5b47574386f77428ca22b341",
"KEYS": "5b47574386f77428ca22b342",
"KEYS_ELECTRONIC": "5c518ed586f774119a772aee",
"KEYS_MECHANIC": "5c518ec986f7743b68682ce2",
"MAPS": "5b47574386f77428ca22b343",
"MEDICAL": "5b47574386f77428ca22b344",
"MEDICAL_INJECTORS": "5b47574386f77428ca22b33a",
"MEDICAL_INJURY": "5b47574386f77428ca22b339",
"MEDICAL_MEDKITS": "5b47574386f77428ca22b338",
"MEDICAL_PILLS": "5b47574386f77428ca22b337",
"MODS": "5b5f71a686f77447ed5636ab",
"MODS_FUNCTIONAL": "5b5f71b386f774093f2ecf11",
"MODS_GEAR": "5b5f750686f774093e6cb503",
"MODS_VITAL": "5b5f75b986f77447ec5d7710",
"MOD_ASSAULT_SCOPE": "5b5f740a86f77447ec5d7706",
"MOD_AUX": "5b5f74cc86f77447ec5d770a",
"MOD_BARREL": "5b5f75c686f774094242f19f",
"MOD_BIPOD": "5b5f71c186f77409407a7ec0",
"MOD_CHARGE": "5b5f751486f77447ec5d770c",
"MOD_FLASHHIDER": "5b5f724c86f774093f2ecf15",
"MOD_FOREGRIP": "5b5f71de86f774093f2ecf13",
"MOD_GASBLOCK": "5b5f760586f774093e6cb509",
"MOD_HANDGUARD": "5b5f75e486f77447ec5d7712",
"MOD_IRON_SIGHT": "5b5f746686f77447ec5d7708",
"MOD_LAUNCHER": "5b5f752e86f774093e6cb505",
"MOD_LIGHTLASER": "5b5f736886f774094242f193",
"MOD_MAGAZINE": "5b5f754a86f774094242f19b",
"MOD_MOUNT": "5b5f755f86f77447ec5d770e",
"MOD_MICRO_DOT": "5b5f744786f774094242f197",
"MOD_MUZZLE": "5b5f724186f77447ed5636ad",
"MOD_OPTIC": "5b5f748386f774093e6cb501",
"MOD_PISTOLGRIP": "5b5f761f86f774094242f1a1",
"MOD_RECEIVER": "5b5f764186f77447ec5d7714",
"MOD_SIGHT": "5b5f73ec86f774093e6cb4fd",
"MOD_STOCK": "5b5f757486f774093e6cb507",
"MOD_SUPPRESSOR": "5b5f731a86f774093e6cb4f9",
"MONEY": "5b5f78b786f77447ed5636af",
"PROVISIONS": "5b47574386f77428ca22b340",
"PROVISIONS_DRINKS": "5b47574386f77428ca22b335",
"PROVISIONS_FOOD": "5b47574386f77428ca22b336",
"QUEST": "5b619f1a86f77450a702a6f3",
"SPEC": "5b47574386f77428ca22b345",
"WEAPONS": "5b5f78dc86f77409407a7f8e",
"WEAPONS_ASSAULTRIFLES": "5b5f78fc86f77409407a7f90",
"WEAPONS_BOLTACTION": "5b5f798886f77447ed5636b5",
"WEAPONS_CARBINES": "5b5f78e986f77447ed5636b1",
"WEAPONS_DMR": "5b5f791486f774093f2ed3be",
"WEAPONS_GL": "5b5f79d186f774093f2ed3c2",
"WEAPONS_MG": "5b5f79a486f77409407a7f94",
"WEAPONS_MELEE": "5b5f7a0886f77409407a7f96",
"WEAPONS_PISTOLS": "5b5f792486f77447ed5636b3",
"WEAPONS_SHOTGUNS": "5b5f794b86f77409407a7f92",
"WEAPONS_SMG": "5b5f796a86f774093f2ed3c0",
"WEAPONS_SPECIAL": "5b5f79eb86f77447ed5636b7",
"WEAPONS_THROW": "5b5f7a2386f774093f2ed3c4",
};
//# sourceMappingURL=itemHandbookCategories.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "itemHandbookCategories.js",
"sourceRoot": "",
"sources": [
"itemHandbookCategories.ts"
],
"names": [],
"mappings": ";;;AAAa,QAAA,uBAAuB,GAAmC;IACrE,MAAM,EAAE,0BAA0B;IAClC,YAAY,EAAE,0BAA0B;IACxC,aAAa,EAAE,0BAA0B;IACzC,QAAQ,EAAE,0BAA0B;IACpC,iBAAiB,EAAE,0BAA0B;IAC7C,oBAAoB,EAAE,0BAA0B;IAChD,eAAe,EAAE,0BAA0B;IAC3C,kBAAkB,EAAE,0BAA0B;IAC9C,kBAAkB,EAAE,0BAA0B;IAC9C,gBAAgB,EAAE,0BAA0B;IAC5C,eAAe,EAAE,0BAA0B;IAC3C,cAAc,EAAE,0BAA0B;IAC1C,kBAAkB,EAAE,0BAA0B;IAC9C,MAAM,EAAE,0BAA0B;IAClC,YAAY,EAAE,0BAA0B;IACxC,gBAAgB,EAAE,0BAA0B;IAC5C,YAAY,EAAE,0BAA0B;IACxC,iBAAiB,EAAE,0BAA0B;IAC7C,iBAAiB,EAAE,0BAA0B;IAC7C,eAAe,EAAE,0BAA0B;IAC3C,eAAe,EAAE,0BAA0B;IAC3C,WAAW,EAAE,0BAA0B;IACvC,cAAc,EAAE,0BAA0B;IAC1C,aAAa,EAAE,0BAA0B;IACzC,MAAM,EAAE,0BAA0B;IAClC,MAAM,EAAE,0BAA0B;IAClC,iBAAiB,EAAE,0BAA0B;IAC7C,eAAe,EAAE,0BAA0B;IAC3C,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,0BAA0B;IACrC,mBAAmB,EAAE,0BAA0B;IAC/C,gBAAgB,EAAE,0BAA0B;IAC5C,iBAAiB,EA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A0B;IACzC,iBAAiB,EAAE,0BAA0B;IAC7C,eAAe,EAAE,0BAA0B;CAC5C,CAAC"
}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,81 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Mod {
itemHelper;
offerService;
tradeHelper;
profileHelper;
saveServer;
logger;
preSptLoad(container) {
const logger = container.resolve("WinstonLogger");
this.logger = logger;
const staticRouterModService = container.resolve("StaticRouterModService");
//HELPERS
this.itemHelper = container.resolve("ItemHelper");
this.offerService = container.resolve("RagfairOfferService");
this.tradeHelper = container.resolve("TradeHelper");
this.profileHelper = container.resolve("ProfileHelper");
this.saveServer = container.resolve("SaveServer");
// Hook up a new static route
staticRouterModService.registerStaticRouter("LootValueRoutes", [
{
url: "/LootValue/GetItemLowestFleaPrice",
//info is the payload from client in json
//output is the response back to client
action: (url, info, sessionID, output) => {
return (JSON.stringify(this.getItemLowestFleaPrice(info.templateId)));
}
},
{
url: "/LootValue/SellItemToTrader",
//info is the payload from client in json
//output is the response back to client
action: (url, info, sessionID, output) => {
let response = this.sellItemToTrader(sessionID, info.ItemId, info.TraderId, info.Price);
return (JSON.stringify(response));
}
}
], "custom-static-LootValueRoutes");
}
getItemLowestFleaPrice(templateId) {
let offers = this.offerService.getOffersOfType(templateId);
if (offers && offers.length > 0) {
offers = offers.filter(a => a.user.memberType != 4 //exclude traders
&& a.requirements[0]._tpl == '5449016a4bdc2d6f028b456f' //consider only ruble trades
&& this.itemHelper.getItemQualityModifier(a.items[0]) == 1 //and items with full durability
);
if (offers.length > 0)
return (offers.sort((a, b) => a.summaryCost - b.summaryCost)[0]).summaryCost;
}
return null;
}
sellItemToTrader(sessionId, itemId, traderId, price) {
let pmcData = this.profileHelper.getPmcProfile(sessionId);
if (!pmcData) {
this.logger.error("pmcData was null");
return false;
}
let item = pmcData.Inventory.items.find(x => x._id === itemId);
if (!item) {
this.logger.error("item was null");
return false;
}
let sellRequest = {
Action: "sell_to_trader",
type: "sell_to_trader",
tid: traderId,
price: price,
items: [{
id: itemId,
count: item.upd ? item.upd.StackObjectsCount ? item.upd.StackObjectsCount : 1 : 1,
scheme_id: 0
}]
};
let response = this.tradeHelper.sellItem(pmcData, pmcData, sellRequest, sessionId);
this.saveServer.saveProfile(sessionId);
return true;
}
}
module.exports = { mod: new Mod() };
//# sourceMappingURL=LootValueStaticRouter.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "LootValueStaticRouter.js",
"sourceRoot": "",
"sources": [
"LootValueStaticRouter.ts"
],
"names": [],
"mappings": ";;AAcA,MAAM,GAAG;IAEA,UAAU,CAAa;IACvB,YAAY,CAAsB;IAClC,WAAW,CAAc;IACzB,aAAa,CAAgB;IAC7B,UAAU,CAAa;IAEvB,MAAM,CAAU;IAEd,UAAU,CAAC,SAA8B;QAC5C,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAU,eAAe,CAAC,CAAC;QACjE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAEf,MAAM,sBAAsB,GAAG,SAAS,CAAC,OAAO,CAAyB,wBAAwB,CAAC,CAAC;QAEzG,SAAS;QACT,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAa,YAAY,CAAC,CAAC;QAC9D,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,OAAO,CAAsB,qBAAqB,CAAC,CAAC;QAClF,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,OAAO,CAAc,aAAa,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC,OAAO,CAAgB,eAAe,CAAC,CAAC;QACvE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAa,YAAY,CAAC,CAAC;QAExD,6BAA6B;QAC7B,sBAAsB,CAAC,oBAAoB,CACvC,iBAAiB,EACjB;YACR;gBACC,GAAG,EAAE,mCAAmC;gBACxC,yCAAyC;gBACzC,uCAAuC;gBACvC,MAAM,EAAE,C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AAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,EAAC,GAAG,EAAE,IAAI,GAAG,EAAE,EAAC,CAAA"
}

View file

@ -0,0 +1,59 @@
{
"key_insurance_enabled": false,
"cases_insurance_enabled": false,
"cases_flea_banned": true,
"weightless_keys": true,
"no_key_use_limit": false,
"keys_are_discardable": true,
"all_keys_in_secure": true,
"allow_cases_in_special": false,
"allow_cases_in_secure": true,
"allow_cases_in_backpacks": true,
"cases_allowed_in": [],
"cases_disallowed_in": [],
"use_finite_keys_list": false,
"finite_keys_list":[
"5780cf7f2459777de4559322", // Dorm room 314 marked key, Uses: 10
"5937ee6486f77408994ba448", // Machinery key, Uses: 1
"593962ca86f774068014d9af", // Unknown key, Uses: 1
"5c94bbff86f7747ee735c08f", // TerraGroup Labs access keycard, Uses: 1
"5d08d21286f774736e7c94c3", // Shturman's stash key, Uses: 1
"5d80c60f86f77440373c4ece", // RB-BK marked key, Uses: 10
"5d80c62a86f7744036212b3f", // RB-VO marked key, Uses: 10
"5ede7a8229445733cb4c18e2", // RB-PKPM marked key, Uses: 10
"5efde6b4f5448336730dbd61", // Keycard with a blue marking, Uses: 1
"62987dfc402c7f69bf010923", // Shared bedroom marked key, Uses: 10
"6391fcf5744e45201147080f", // Primorsky Ave apartment key, Uses: 1
"6398fd8ad3de3849057f5128", // Backup hideout key, Uses: 1
"63a397d3af870e651d58e65b", // Car dealership closed section key, Uses: 1
"63a39e1d234195315d4020bd", // Primorsky 46-48 skybridge key, Uses: 1
"63a3a93f8a56922e82001f5d", // Abandoned factory marked key, Uses: 10
"64ccc25f95763a1ae376e447", // Mysterious room marked key, Uses: 10
"64ce572331dd890873175115", // Aspect company office key, Uses: 1
"64d4b23dc1b37504b41ac2b6", // Rusted bloody key, Uses: 1
"658199aa38c79576a2569e13", // TerraGroup science office key, Uses: 1
"6582dbf0b8d7830efc45016f", // Relaxation room key, Uses: 2
"664d3db6db5dea2bad286955", // Shatun's hideout key, Uses: 5
"664d3dd590294949fe2d81b7", // Grumpy's hideout key, Uses: 5
"664d3ddfdda2e85aca370d75", // Voron's hideout key, Uses: 5
"664d3de85f2355673b09aed5", // Leon's hideout key, Uses: 5
"664d4b0103ef2c61246afb56", // Dorm overseer key, Uses: 2
"66acd6702b17692df20144c0", // TerraGroup storage room keycard, Uses: 10
"6711039f9e648049e50b3307", // TerraGroup Labs residential unit keycard , Uses: 2
//"5e42c81886f7742a01529f57", // Object #11SR keycard, Uses: 10
//"5e42c83786f7742a021fdf3c", // Object #21WS keycard, Uses: 10
//"5c1d0c5f86f7744bb2683cf0", // TerraGroup Labs keycard (Blue), Uses: 10
//"5c1d0d6d86f7744bb2683e1f", // TerraGroup Labs keycard (Yellow), Uses: 10
//"5c1d0dc586f7744baf2e7b79", // TerraGroup Labs keycard (Green), Uses: 10
//"5c1d0efb86f7744baf2e7b7b", // TerraGroup Labs keycard (Red), Uses: 10
//"5c1d0f4986f7744bb01837fa", // TerraGroup Labs keycard (Black), Uses: 10
//"5c1e495a86f7743109743dfb", // TerraGroup Labs keycard (Violet), Uses: 10
],
"debug": {
"log_missing_keys": false,
"log_rare_keys": false,
"give_profile_all_keys": false,
"force_remove_debug_items_on_start": false
}
}

View file

@ -0,0 +1,195 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Debug = void 0;
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
const BaseClasses_1 = require("C:/snapshot/project/obj/models/enums/BaseClasses");
const cases = __importStar(require("../config/cases.json"));
const keysInConfig = [
...cases["Golden Keycard Case"].slot_ids,
...cases["Golden Keychain Mk. I"].slot_ids,
...cases["Golden Keychain Mk. II"].slot_ids,
...cases["Golden Keychain Mk. III"].slot_ids
];
class Debug {
debugConfig;
constructor(debugConfig) {
this.debugConfig = debugConfig;
}
logMissingKeys(logger, itemHelper, dbItems, dbLocales, ignoredKeyList) {
if (!this.debugConfig.log_missing_keys)
return;
logger.log("[Gilded Key Storage]: Keys missing from config: ", LogTextColor_1.LogTextColor.MAGENTA);
logger.log("-------------------------------------------", LogTextColor_1.LogTextColor.YELLOW);
for (const itemID in dbItems) {
const thisItem = dbItems[itemID];
// Skip if the item is in our ignore list
if (ignoredKeyList.includes(itemID))
continue;
// Skip items that aren't items
if (thisItem._type !== "Item")
continue;
// Skip non-keys
if (!itemHelper.isOfBaseclass(thisItem._id, BaseClasses_1.BaseClasses.KEY))
continue;
// Skip quest keys
if (thisItem._props.QuestItem)
continue;
if (this.isKeyMissing(itemID)) {
logger.log(dbLocales[`${itemID} Name`], LogTextColor_1.LogTextColor.MAGENTA);
logger.log(itemID, LogTextColor_1.LogTextColor.MAGENTA);
logger.log("-------------------------------------------", LogTextColor_1.LogTextColor.YELLOW);
}
}
}
logRareKeys(logger, itemHelper, dbItems, dbLocales) {
if (!this.debugConfig.log_rare_keys)
return;
logger.log("[Gilded Key Storage]: Rare key list: ", LogTextColor_1.LogTextColor.CYAN);
logger.log("-------------------------------------------", LogTextColor_1.LogTextColor.YELLOW);
for (const itemID in dbItems) {
const thisItem = dbItems[itemID];
// Skip items that aren't items
if (thisItem._type !== "Item")
continue;
// Skip non-keys
if (!itemHelper.isOfBaseclass(thisItem._id, BaseClasses_1.BaseClasses.KEY))
continue;
// Skip quest keys
if (thisItem._props.QuestItem)
continue;
if (thisItem._props.MaximumNumberOfUsage <= 10) {
logger.log(` "${itemID}", // ${dbLocales[`${itemID} Name`]}, Uses: ${thisItem._props.MaximumNumberOfUsage}`, LogTextColor_1.LogTextColor.CYAN);
}
}
}
isKeyMissing(keyId) {
if (keysInConfig.includes(keyId)) {
return false;
}
return true;
}
giveProfileAllKeysAndGildedCases(staticRouterModService, saveServer, logger) {
if (!this.debugConfig.give_profile_all_keys)
return;
staticRouterModService.registerStaticRouter("On_Game_Start_Gilded_Key_Storage", [{
url: "/client/game/start",
action: async (url, info, sessionId, output) => {
const profile = saveServer.getProfile(sessionId);
const profileInventory = profile.characters?.pmc?.Inventory;
if (!profileInventory) {
logger.log("New profile detected! load to stash, then close and reopen SPT to receive all keys and gilded cases", LogTextColor_1.LogTextColor.RED);
return output;
}
const itemIdsToPush = this.getArrayOfKeysAndCases();
let xVal = 0;
let yVal = 0;
for (let i = 0; i < itemIdsToPush.length; i++) {
const thisItemId = itemIdsToPush[i];
xVal++;
if (xVal > 9) {
xVal = 0;
yVal += 1;
}
profileInventory.items.push({
_id: `${thisItemId}_gilded_debug_id`,
_tpl: thisItemId,
parentId: profileInventory.stash,
slotId: "hideout",
location: {
x: xVal,
y: yVal,
r: "Horizontal",
isSearched: true
}
});
profile.characters.pmc.Encyclopedia[thisItemId] = true;
}
return output;
}
}], "spt");
}
removeAllDebugInstanceIdsFromProfile(staticRouterModService, saveServer) {
if (!this.debugConfig.give_profile_all_keys && !this.debugConfig.force_remove_debug_items_on_start)
return;
let urlHook = "/client/game/logout";
if (this.debugConfig.force_remove_debug_items_on_start) {
urlHook = "/client/game/start";
}
staticRouterModService.registerStaticRouter("On_Logout_Gilded_Key_Storage", [{
url: urlHook,
action: async (url, info, sessionId, output) => {
const profile = saveServer.getProfile(sessionId);
const profileInventory = profile.characters?.pmc?.Inventory;
const profileItems = profileInventory.items;
if (!profileInventory) {
return output;
}
for (let i = profileItems.length; i > 0; i--) {
const itemKey = i - 1;
if (profileItems[itemKey]._id.includes("_gilded_debug_id")) {
profileInventory.items.splice(itemKey, 1);
}
}
return output;
}
}], "spt");
}
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
getArrayOfKeysAndCases() {
const keysAndCases = [
...keysInConfig,
cases["Golden Key Pouch"].id,
cases["Golden Keycard Case"].id,
cases["Golden Keychain Mk. I"].id,
cases["Golden Keychain Mk. II"].id,
cases["Golden Keychain Mk. III"].id
];
for (let i = keysAndCases.length; i > 0; i--) {
const top = i - 1;
for (let x = keysAndCases.length; x > 0; x--) {
const bottom = x - 1;
if (top !== bottom) {
if (keysAndCases[top] === keysAndCases[bottom]) {
keysAndCases.splice(bottom, 1);
}
}
}
}
return keysAndCases;
}
}
exports.Debug = Debug;
//# sourceMappingURL=debug.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,561 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const BaseClasses_1 = require("C:/snapshot/project/obj/models/enums/BaseClasses");
const ItemTpl_1 = require("C:/snapshot/project/obj/models/enums/ItemTpl");
const Traders_1 = require("C:/snapshot/project/obj/models/enums/Traders");
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
const debug_1 = require("./debug");
const barters_json_1 = __importDefault(require("../config/barters.json"));
const cases_json_1 = __importDefault(require("../config/cases.json"));
const path_1 = __importDefault(require("path"));
const fs_1 = require("fs");
const json5_1 = __importDefault(require("C:/snapshot/project/node_modules/json5"));
class Mod {
HANDBOOK_GEARCASES = "5b5f6fa186f77409407a7eb7";
newIdMap = {
Golden_Key_Pouch: "661cb36922c9e10dc2d9514b",
Golden_Keycard_Case: "661cb36f5441dc730e28bcb0",
Golden_Keychain1: "661cb372e5eb56290da76c3e",
Golden_Keychain2: "661cb3743bf00d3d145518b3",
Golden_Keychain3: "661cb376b16226f648eb0cdc"
};
// These are keys that BSG added with no actual use, or drop chance. Ignore them for now
// These should be confirmed every client update to still be unused
ignoredKeyList = [
"5671446a4bdc2d97058b4569",
"57518f7724597720a31c09ab",
"57518fd424597720c85dbaaa",
"5751916f24597720a27126df",
"5751961824597720a31c09ac",
"590de4a286f77423d9312a32",
"590de52486f774226a0c24c2",
"61a6446f4b5f8b70f451b166",
"63a39ddda3a2b32b5f6e007a",
"63a39e0f64283b5e9c56b282",
"63a39e5b234195315d4020bf",
"63a39e6acd6db0635c1975fe",
"63a71f1a0aa9fb29da61c537",
"63a71f3b0aa9fb29da61c539",
"658199a0490414548c0fa83b",
"6582dc63cafcd9485374dbc5"
];
logger;
modName;
modVersion;
container;
profileHelper;
itemHelper;
fileSystemSync;
config;
constructor() {
this.modName = "Gilded Key Storage";
}
preSptLoad(container) {
this.container = container;
const staticRouterModService = container.resolve("StaticRouterModService");
const saveServer = container.resolve("SaveServer");
const logger = container.resolve("WinstonLogger");
this.profileHelper = container.resolve("ProfileHelper");
this.itemHelper = container.resolve("ItemHelper");
this.fileSystemSync = container.resolve("FileSystemSync");
// Load our config
this.loadConfig();
// On game start, see if we need to fix issues from previous versions
// Note: We do this as a method replacement so we can run _before_ SPT's gameStart
container.afterResolution("GameController", (_, result) => {
const originalGameStart = result.gameStart;
result.gameStart = (url, info, sessionID, startTimeStampMS) => {
// If there's a profile ID passed in, call our fixer method
if (sessionID) {
this.fixProfile(sessionID);
}
// Call the original
originalGameStart.apply(result, [url, info, sessionID, startTimeStampMS]);
};
});
// Setup debugging if enabled
const debugUtil = new debug_1.Debug(this.config.debug);
debugUtil.giveProfileAllKeysAndGildedCases(staticRouterModService, saveServer, logger);
debugUtil.removeAllDebugInstanceIdsFromProfile(staticRouterModService, saveServer);
}
postDBLoad(container) {
this.logger = container.resolve("WinstonLogger");
this.logger.log(`[${this.modName}] : Mod loading`, LogTextColor_1.LogTextColor.GREEN);
const debugUtil = new debug_1.Debug(this.config.debug);
const databaseServer = container.resolve("DatabaseServer");
const dbTables = databaseServer.getTables();
const restrInRaid = dbTables.globals.config.RestrictionsInRaid;
const dbTemplates = dbTables.templates;
const dbTraders = dbTables.traders;
const dbItems = dbTemplates.items;
const dbLocales = dbTables.locales.global.en;
debugUtil.logRareKeys(this.logger, this.itemHelper, dbItems, dbLocales);
this.combatibilityThings(dbItems);
for (const caseName of Object.keys(cases_json_1.default)) {
this.createCase(container, cases_json_1.default[caseName], dbTables);
}
this.pushSupportiveBarters(dbTraders);
this.adjustItemProperties(dbItems);
this.setLabsCardInRaidLimit(restrInRaid, 9);
debugUtil.logMissingKeys(this.logger, this.itemHelper, dbItems, dbLocales, this.ignoredKeyList);
}
loadConfig() {
const userConfigPath = path_1.default.resolve(__dirname, "../config/config.json5");
const defaultConfigPath = path_1.default.resolve(__dirname, "../config/config.default.json5");
// Copy the default config if the user config doesn't exist yet
if (!(0, fs_1.existsSync)(userConfigPath)) {
(0, fs_1.copyFileSync)(defaultConfigPath, userConfigPath);
}
// Create the config as a merge of the default and user configs, so we always
// have the default values available, even if missing in the user config
this.config = {
...json5_1.default.parse(this.fileSystemSync.read(defaultConfigPath)),
...json5_1.default.parse(this.fileSystemSync.read(userConfigPath))
};
}
pushSupportiveBarters(dbTraders) {
for (const barter of Object.keys(barters_json_1.default)) {
this.pushToTrader(barters_json_1.default[barter], barters_json_1.default[barter].id, dbTraders);
}
}
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
setLabsCardInRaidLimit(restrInRaid, limitAmount) {
if (restrInRaid === undefined)
return;
//restrInRaid type set to any to shut the linter up because the type doesn't include MaxIn... props
//set labs access card limit in raid to 9 so the keycard case can be filled while on pmc
for (const restr in restrInRaid) {
const thisRestriction = restrInRaid[restr];
if (thisRestriction.TemplateId === ItemTpl_1.ItemTpl.KEYCARD_TERRAGROUP_LABS_ACCESS) {
thisRestriction.MaxInLobby = limitAmount;
thisRestriction.MaxInRaid = limitAmount;
}
}
}
adjustItemProperties(dbItems) {
for (const [_, item] of Object.entries(dbItems)) {
// Skip anything that isn't specifically an Item type item
if (item._type !== "Item") {
continue;
}
const itemProps = item._props;
// Adjust key specific properties
if (this.itemHelper.isOfBaseclass(item._id, BaseClasses_1.BaseClasses.KEY)) {
if (this.config.weightless_keys) {
itemProps.Weight = 0.0;
}
itemProps.InsuranceDisabled = !this.config.key_insurance_enabled;
// If keys are to be set to no limit, and we're either not using the finite keys list, or this key doesn't exist
// in it, set the key max usage to 0 (infinite)
if (this.config.no_key_use_limit &&
(!this.config.use_finite_keys_list || !this.config.finite_keys_list.includes(item._id))) {
itemProps.MaximumNumberOfUsage = 0;
}
if (this.config.keys_are_discardable) {
// BSG uses DiscordLimit == 0 to flag as not insurable, so we need to swap to the flag
if (itemProps.DiscardLimit === 0) {
itemProps.InsuranceDisabled = true;
}
itemProps.DiscardLimit = -1;
}
}
// Remove keys from secure container exclude filter
if (this.config.all_keys_in_secure && this.itemHelper.isOfBaseclass(item._id, BaseClasses_1.BaseClasses.MOB_CONTAINER) && itemProps?.Grids) {
// Theta container has multiple grids, so we need to loop through all grids
for (const grid of itemProps.Grids) {
const filter = grid?._props?.filters[0];
if (filter) {
// Exclude items with a base class of KEY. Have to check that it's an "Item" type first because isOfBaseClass only accepts Items
filter.ExcludedFilter = filter.ExcludedFilter.filter(itemTpl => this.itemHelper.getItem(itemTpl)[1]?._type !== "Item" || !this.itemHelper.isOfBaseclass(itemTpl, BaseClasses_1.BaseClasses.KEY));
}
}
}
}
}
combatibilityThings(dbItems) {
//do a compatibility correction to make this mod work with other mods with destructive code (cough, SVM, cough)
//basically just add the filters element back to backpacks and secure containers if they've been removed by other mods
const compatFiltersElement = [{ Filter: [BaseClasses_1.BaseClasses.ITEM], ExcludedFilter: [] }];
for (const [_, item] of Object.entries(dbItems)) {
// Skip non-items
if (item._type !== "Item")
continue;
if (item._parent === BaseClasses_1.BaseClasses.BACKPACK ||
item._parent === BaseClasses_1.BaseClasses.VEST ||
(this.itemHelper.isOfBaseclass(item._id, BaseClasses_1.BaseClasses.MOB_CONTAINER) && item._id !== ItemTpl_1.ItemTpl.SECURE_CONTAINER_BOSS)) {
for (const grid of item._props.Grids) {
if (grid._props.filters[0] === undefined) {
grid._props.filters = structuredClone(compatFiltersElement);
}
}
}
}
}
createCase(container, caseConfig, tables) {
const handbook = tables.templates.handbook;
const locales = Object.values(tables.locales.global);
const itemID = caseConfig.id;
const itemPrefabPath = `CaseBundles/${itemID.toLocaleLowerCase()}.bundle`;
const templateId = this.newIdMap[itemID];
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
let item;
//clone a case
if (caseConfig.case_type === "container") {
item = structuredClone(tables.templates.items[ItemTpl_1.ItemTpl.CONTAINER_SICC]);
item._props.IsAlwaysAvailableForInsurance = true;
item._props.DiscardLimit = -1;
}
if (caseConfig.case_type === "slots") {
item = structuredClone(tables.templates.items[ItemTpl_1.ItemTpl.MOUNT_STRIKE_INDUSTRIES_KEYMOD_4_INCH_RAIL]);
item._props.IsAlwaysAvailableForInsurance = true;
item._props.DiscardLimit = -1;
item._props.ItemSound = caseConfig.sound;
}
item._name = caseConfig.item_name;
item._id = templateId;
item._props.Prefab.path = itemPrefabPath;
//call methods to set the grid or slot cells up
if (caseConfig.case_type === "container") {
item._props.Grids = this.createGrid(container, templateId, caseConfig);
}
if (caseConfig.case_type === "slots") {
item._props.Slots = this.createSlot(container, templateId, caseConfig);
}
//set external size of the container:
item._props.Width = caseConfig.ExternalSize.width;
item._props.Height = caseConfig.ExternalSize.height;
tables.templates.items[templateId] = item;
//add locales
for (const locale of locales) {
locale[`${templateId} Name`] = caseConfig.item_name;
locale[`${templateId} ShortName`] = caseConfig.item_short_name;
locale[`${templateId} Description`] = caseConfig.item_description;
}
item._props.CanSellOnRagfair = !this.config.cases_flea_banned;
item._props.InsuranceDisabled = !this.config.cases_insurance_enabled;
const price = caseConfig.flea_price;
handbook.Items.push({
Id: templateId,
ParentId: this.HANDBOOK_GEARCASES,
Price: price
});
//allow or disallow in secure containers, backpacks, other specific items per the config
this.allowIntoContainers(templateId, tables.templates.items);
this.pushToTrader(caseConfig, templateId, tables.traders);
}
pushToTrader(caseConfig, itemID, dbTraders) {
const traderIDs = {
mechanic: Traders_1.Traders.MECHANIC,
skier: Traders_1.Traders.SKIER,
peacekeeper: Traders_1.Traders.PEACEKEEPER,
therapist: Traders_1.Traders.THERAPIST,
prapor: Traders_1.Traders.PRAPOR,
jaeger: Traders_1.Traders.JAEGER,
ragman: Traders_1.Traders.RAGMAN
};
//add to config trader's inventory
let traderToPush = caseConfig.trader;
for (const [key, val] of Object.entries(traderIDs)) {
if (key === caseConfig.trader) {
traderToPush = val;
}
}
const trader = dbTraders[traderToPush];
trader.assort.items.push({
_id: itemID,
_tpl: itemID,
parentId: "hideout",
slotId: "hideout",
upd: {
UnlimitedCount: caseConfig.unlimited_stock,
StackObjectsCount: caseConfig.stock_amount
}
});
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
const barterTrade = [];
const configBarters = caseConfig.barter;
for (const barter in configBarters) {
barterTrade.push(configBarters[barter]);
}
trader.assort.barter_scheme[itemID] = [barterTrade];
trader.assort.loyal_level_items[itemID] = caseConfig.trader_loyalty_level;
}
allowIntoContainers(itemID, items) {
for (const [_, item] of Object.entries(items)) {
// Skip non-items
if (item._type !== "Item")
continue;
//disallow in backpacks
if (!this.config.allow_cases_in_backpacks) {
this.allowOrDisallowIntoCaseByParent(itemID, "exclude", item, BaseClasses_1.BaseClasses.BACKPACK);
}
//allow in secure containers
if (this.config.allow_cases_in_secure) {
this.allowOrDisallowIntoCaseByParent(itemID, "include", item, BaseClasses_1.BaseClasses.MOB_CONTAINER);
}
//disallow in additional specific items
for (const configItem in this.config.cases_disallowed_in) {
if (this.config.cases_disallowed_in[configItem] === item._id) {
this.allowOrDisallowIntoCaseByID(itemID, "exclude", item);
}
}
//allow in additional specific items
for (const configItem in this.config.cases_allowed_in) {
if (this.config.cases_allowed_in[configItem] === item._id) {
this.allowOrDisallowIntoCaseByID(itemID, "include", item);
}
}
// Allow in special slots
if (this.config.allow_cases_in_special && (item._id === ItemTpl_1.ItemTpl.POCKETS_1X4_SPECIAL || item._id === ItemTpl_1.ItemTpl.POCKETS_1X4_TUE)) {
this.allowInSpecialSlots(itemID, item);
this.allowInSpecialSlots(itemID, item);
}
}
}
allowOrDisallowIntoCaseByParent(customItemID, includeOrExclude, currentItem, caseParent) {
// Skip if the parent isn't our case parent
if (currentItem._parent !== caseParent || currentItem._id === ItemTpl_1.ItemTpl.SECURE_CONTAINER_BOSS) {
return;
}
if (includeOrExclude === "exclude") {
for (const grid of currentItem._props.Grids) {
if (grid._props.filters[0].ExcludedFilter === undefined) {
grid._props.filters[0].ExcludedFilter = [customItemID];
}
else {
grid._props.filters[0].ExcludedFilter.push(customItemID);
}
}
}
if (includeOrExclude === "include") {
for (const grid of currentItem._props.Grids) {
if (grid._props.filters[0].Filter === undefined) {
grid._props.filters[0].Filter = [customItemID];
}
else {
grid._props.filters[0].Filter.push(customItemID);
}
}
}
}
allowOrDisallowIntoCaseByID(customItemID, includeOrExclude, currentItem) {
//exclude custom case in specific item of caseToApplyTo id
if (includeOrExclude === "exclude") {
for (const grid of currentItem._props.Grids) {
if (grid._props.filters[0].ExcludedFilter === undefined) {
grid._props.filters[0].ExcludedFilter = [customItemID];
}
else {
grid._props.filters[0].ExcludedFilter.push(customItemID);
}
}
}
//include custom case in specific item of caseToApplyTo id
if (includeOrExclude === "include") {
for (const grid of currentItem._props.Grids) {
if (grid._props.filters[0].Filter === undefined) {
grid._props.filters[0].Filter = [customItemID];
}
else {
grid._props.filters[0].Filter.push(customItemID);
}
}
}
}
allowInSpecialSlots(customItemID, currentItem) {
for (const slot of currentItem._props.Slots) {
slot._props.filters[0]?.Filter.push(customItemID);
}
}
createGrid(container, itemID, config) {
const grids = [];
// Loop over all grids in the config
for (let i = 0; i < config.Grids.length; i++) {
const grid = config.Grids[i];
const inFilt = this.replaceOldIdWithNewId(grid.included_filter ?? []);
const exFilt = this.replaceOldIdWithNewId(grid.excluded_filter ?? []);
const cellWidth = grid.width;
const cellHeight = grid.height;
// If there's no include filter, add all items
if (inFilt.length === 0) {
inFilt.push(BaseClasses_1.BaseClasses.ITEM);
}
grids.push(this.generateGridColumn(container, itemID, `column${i}`, cellWidth, cellHeight, inFilt, exFilt));
}
return grids;
}
replaceOldIdWithNewId(entries) {
const newIdKeys = Object.keys(this.newIdMap);
for (let i = 0; i < entries.length; i++) {
if (newIdKeys.includes(entries[i])) {
entries[i] = this.newIdMap[entries[i]];
}
}
return entries;
}
createSlot(container, itemID, config) {
const slots = [];
const configSlots = config.slot_ids;
for (let i = 0; i < configSlots.length; i++) {
slots.push(this.generateSlotColumn(container, itemID, `mod_mount_${i}`, configSlots[i]));
}
return slots;
}
generateGridColumn(container, itemID, name, cellH, cellV, inFilt, exFilt) {
const hashUtil = container.resolve("HashUtil");
return {
_name: name,
_id: hashUtil.generate(),
_parent: itemID,
_props: {
filters: [
{
Filter: [...inFilt],
ExcludedFilter: [...exFilt]
}
],
cellsH: cellH,
cellsV: cellV,
minCount: 0,
maxCount: 0,
maxWeight: 0,
isSortingTable: false
}
};
}
generateSlotColumn(container, itemID, name, configSlot) {
const hashUtil = container.resolve("HashUtil");
return {
_name: name,
_id: hashUtil.generate(),
_parent: itemID,
_props: {
filters: [
{
Filter: [configSlot],
ExcludedFilter: []
}
],
_required: false,
_mergeSlotWithChildren: false
}
};
}
// Handle updating the user profile between versions:
// - Update the container IDs to the new MongoID format
// - Look for any key cases in the user's inventory, and properly update the child key locations if we've moved them
fixProfile(sessionId) {
const databaseServer = this.container.resolve("DatabaseServer");
const dbTables = databaseServer.getTables();
const dbItems = dbTables.templates.items;
const pmcProfile = this.profileHelper.getFullProfile(sessionId)?.characters?.pmc;
// Do nothing if the profile isn't initialized
if (!pmcProfile?.Inventory?.items)
return;
// Update the container IDs to the new MongoID format
for (const item of pmcProfile.Inventory.items) {
if (this.newIdMap[item._tpl]) {
item._tpl = this.newIdMap[item._tpl];
}
}
// Backup the PMC inventory
const pmcInventory = structuredClone(pmcProfile.Inventory.items);
// Look for any key cases in the user's inventory, and properly update the child key locations if we've moved them
for (const caseName of Object.keys(cases_json_1.default)) {
const caseConfig = cases_json_1.default[caseName];
if (caseConfig.case_type === "slots" && !this.fixSlotCase(caseConfig, dbItems, pmcProfile)) {
pmcProfile.Inventory.items = pmcInventory;
return;
}
if (caseConfig.case_type === "container" && !this.fixContainerCase(caseConfig, dbItems, pmcProfile)) {
pmcProfile.Inventory.items = pmcInventory;
return;
}
}
}
fixSlotCase(caseConfig, dbItems, pmcProfile) {
const templateId = this.newIdMap[caseConfig.id];
// Get the template for the case
const caseTemplate = dbItems[templateId];
// Try to find the case in the user's profile
const inventoryCases = pmcProfile.Inventory.items.filter(x => x._tpl === templateId);
for (const inventoryCase of inventoryCases) {
const caseChildren = pmcProfile.Inventory.items.filter(x => x.parentId === inventoryCase._id);
for (const child of caseChildren) {
// Skip if the current slot filter can hold the given item, and there aren't multiple items in it
const currentSlot = caseTemplate._props?.Slots?.find(x => x._name === child.slotId);
if (currentSlot._props?.filters[0]?.Filter[0] === child._tpl &&
// A release of GKS went out that may have stacked keycards, so check for any stacked items in one slot
caseChildren.filter(x => x.slotId === currentSlot._name).length === 1) {
continue;
}
// Find a new slot, if this is a labs access item, find the first empty compatible slot
const newSlot = caseTemplate._props?.Slots?.find(x => x._props?.filters[0]?.Filter[0] === child._tpl &&
// A release of GKS went out that may have stacked keycards, try to fix that
(child._tpl !== ItemTpl_1.ItemTpl.KEYCARD_TERRAGROUP_LABS_ACCESS ||
!caseChildren.find(y => y.slotId === x._name)));
// If we couldn't find a new slot for this key, something has gone horribly wrong, restore the inventory and exit
if (!newSlot) {
this.logger.error(`[${this.modName}] : ERROR: Unable to find new slot for ${child._tpl}. Restoring inventory and exiting`);
return false;
}
if (newSlot._name !== child.slotId) {
this.logger.debug(`[${this.modName}] : Need to move ${child.slotId} to ${newSlot._name}`);
child.slotId = newSlot._name;
}
}
}
return true;
}
fixContainerCase(caseConfig, dbItems, pmcProfile) {
const templateId = this.newIdMap[caseConfig.id];
// Get the template for the case
const caseTemplate = dbItems[templateId];
// Try to find the case in the user's profile
const inventoryCases = pmcProfile.Inventory.items.filter(x => x._tpl === templateId);
for (const inventoryCase of inventoryCases) {
const caseChildren = pmcProfile.Inventory.items.filter(x => x.parentId === inventoryCase._id);
for (const child of caseChildren) {
// Skip if the item already has a location property
if (child.location) {
continue;
}
// Find which grid the item should be in
const newGrid = caseTemplate._props?.Grids?.find(x => x._props?.filters[0]?.Filter?.includes(child._tpl));
if (!newGrid) {
this.logger.error(`[${this.modName}] : ERROR: Unable to find new grid for ${child._tpl}. Restoring inventory and exiting`);
return false;
}
// Find the first free slot in that grid, assume everything is a 1x1 item
let newX = -1;
let newY = -1;
for (let y = 0; y < newGrid._props.cellsV && newY < 0; y++) {
for (let x = 0; x < newGrid._props.cellsH && newX < 0; x++) {
if (!caseChildren.find(item => item.location?.x == x && item.location?.y == y)) {
newX = x;
newY = y;
}
}
}
if (newX == -1 || newY == -1) {
this.logger.error(`[${this.modName}] : ERROR: Unable to find new location for ${child._tpl}. Restoring inventory and exiting`);
return false;
}
this.logger.debug(`[${this.modName}] : Need to move ${child.slotId} to ${newGrid._name} X: ${newX} Y: ${newY}`);
// Update the child item to the new location
child.location = {
"x": newX,
"y": newY,
"r": "Horizontal"
};
child.slotId = newGrid._name;
}
}
return true;
}
}
module.exports = { mod: new Mod() };
//# sourceMappingURL=mod.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,483 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ItemGenerator = void 0;
const ConfigTypes_1 = require("C:/snapshot/project/obj/models/enums/ConfigTypes");
const GenEnums_1 = require("./GenEnums");
const fs = __importStar(require("node:fs"));
const path = __importStar(require("node:path"));
class ItemGenerator {
ref;
itemsToSell = [];
barterScheme = {};
loyaltyLevel = {};
itemConfig;
constructor(ref) {
this.ref = ref;
}
//#region Item Gen
createCustomItems(itemDirectory) {
this.itemConfig = this.combineItems(itemDirectory);
const tables = this.ref.tables;
for (const newId in this.itemConfig) {
const itemConfig = this.itemConfig[newId];
const tempClone = GenEnums_1.AllItemList[itemConfig["ItemToClone"]] || itemConfig["ItemToClone"];
const itemToClone = tempClone;
const newItem = {
itemTplToClone: itemToClone,
overrideProperties: itemConfig.OverrideProperties,
parentId: tables.templates.items[itemToClone]._parent,
newId: newId,
handbookParentId: this.createHandbook(itemConfig, newId).ParentId,
handbookPriceRoubles: this.createHandbook(itemConfig, newId).Price,
fleaPriceRoubles: this.createHandbook(itemConfig, newId).Price,
locales: {
en: {
name: itemConfig.LocalePush.en.name,
shortName: itemConfig.LocalePush.en.shortName,
description: itemConfig.LocalePush.en.description,
},
},
};
this.ref.customItem.createItemFromClone(newItem);
if (itemConfig.CloneToFilters) {
this.cloneToFilters(itemConfig, newId);
}
if (itemConfig.PushMastery) {
this.pushMastery(itemConfig, newId);
}
if (itemConfig.BotPush?.AddToBots) {
this.addToBots(itemConfig, newId);
}
if (itemConfig.LootPush?.LootContainersToAdd !== undefined) {
this.addToStaticLoot(itemConfig, newId);
}
if (itemConfig.CasePush?.CaseFiltersToAdd !== undefined) {
this.addToCases(itemConfig, newId);
}
if (itemConfig.PushToFleaBlacklist) {
this.pushToBlacklist(newId);
}
if (itemConfig.SlotPush?.Slot !== undefined) {
this.pushToSlot(itemConfig, newId);
}
if (itemConfig.PresetPush !== undefined) {
this.addCustomPresets(itemConfig);
}
if (itemConfig.QuestPush !== undefined) {
this.addToQuests(this.ref.tables.templates.quests, itemConfig.QuestPush.QuestConditionType, itemConfig.QuestPush.QuestTargetConditionToClone, newId);
}
this.buildCustomPresets(itemConfig, newId);
}
}
createHandbook(itemConfig, itemID) {
const tables = this.ref.tables;
const tempClone = GenEnums_1.AllItemList[itemConfig["ItemToClone"]] || itemConfig["ItemToClone"];
const itemToClone = tempClone;
if (itemConfig.Handbook !== undefined) {
const tempHBParent = GenEnums_1.HandbookIDs[itemConfig["Handbook"]["HandbookParent"]] || itemConfig["Handbook"]["HandbookParent"];
const hbParent = tempHBParent;
const handbookEntry = {
Id: itemID,
ParentId: hbParent,
Price: itemConfig["Handbook"]["HandbookPrice"],
};
return handbookEntry;
}
else {
const hbBase = tables.templates.handbook.Items.find((i) => i.Id === itemToClone);
const handbookEntry = {
Id: itemID,
ParentId: hbBase.ParentId,
Price: hbBase.Price,
};
return handbookEntry;
}
}
cloneToFilters(itemConfig, itemID) {
const tables = this.ref.tables;
const tempClone = GenEnums_1.AllItemList[itemConfig.ItemToClone] || itemConfig.ItemToClone;
const itemToClone = tempClone;
for (const item in tables.templates.items) {
const itemConflictId = tables.templates.items[item]._props.ConflictingItems;
for (const itemInConflicts in itemConflictId) {
const itemInConflictsFiltersId = itemConflictId[itemInConflicts];
if (itemInConflictsFiltersId === itemToClone) {
itemConflictId.push(itemID);
}
}
for (const slots in tables.templates.items[item]._props.Slots) {
const slotsId = tables.templates.items[item]._props.Slots[slots]._props.filters[0].Filter;
for (const itemInFilters in slotsId) {
const itemInFiltersId = slotsId[itemInFilters];
if (itemInFiltersId === itemToClone) {
slotsId.push(itemID);
}
}
}
for (const cartridge in tables.templates.items[item]._props.Cartridges) {
const cartridgeId = tables.templates.items[item]._props.Cartridges[cartridge]._props.filters[0].Filter;
for (const itemInFilters in cartridgeId) {
const itemInFiltersId = cartridgeId[itemInFilters];
if (itemInFiltersId === itemToClone) {
cartridgeId.push(itemID);
}
}
}
for (const chamber in tables.templates.items[item]._props.Chambers) {
const chamberId = tables.templates.items[item]._props.Chambers[chamber]._props.filters[0].Filter;
for (const itemInFilters in chamberId) {
const itemInFiltersId = chamberId[itemInFilters];
if (itemInFiltersId === itemToClone) {
chamberId.push(itemID);
}
}
}
}
}
pushMastery(itemConfig, itemID) {
const tables = this.ref.tables;
const new_mastery_DJCore = {
Name: itemConfig.LocalePush.en.name,
Templates: [itemID],
Level2: 450,
Level3: 900,
};
tables.globals.config.Mastering.push(new_mastery_DJCore);
}
addToBots(itemConfig, itemID) {
const tables = this.ref.tables;
const tempClone = GenEnums_1.AllItemList[itemConfig.ItemToClone] || itemConfig.ItemToClone;
const itemToClone = tempClone;
for (const botId in tables.bots.types) {
for (const lootSlot in tables.bots.types[botId].inventory.items) {
const items = tables.bots.types[botId].inventory.items;
if (items[lootSlot][itemToClone]) {
const weight = items[lootSlot][itemToClone];
items[lootSlot][itemID] = weight;
}
}
for (const equipSlot in tables.bots.types[botId].inventory.equipment) {
const equip = tables.bots.types[botId].inventory.equipment;
if (equip[equipSlot][itemToClone]) {
const weight = equip[equipSlot][itemToClone];
equip[equipSlot][itemID] = weight;
}
}
for (const modItem in tables.bots.types[botId].inventory.mods) {
for (const modSlot in tables.bots.types[botId].inventory.mods[modItem]) {
if (tables.bots.types[botId]?.inventory?.mods[modItem][modSlot][itemToClone]) {
tables.bots.types[botId].inventory.mods[modItem][modSlot].push(itemID);
}
}
if (tables.bots.types[botId]?.inventory?.mods[itemToClone]) {
tables.bots.types[botId].inventory.mods[itemID] = structuredClone(tables.bots.types[botId].inventory.mods[itemToClone]);
}
}
}
}
addToStaticLoot(itemConfig, itemID) {
const tables = this.ref.tables;
const locations = tables.locations;
if (Array.isArray(itemConfig.LootPush?.LootContainersToAdd)) {
itemConfig.LootPush?.LootContainersToAdd.forEach((lootContainer) => {
const tempLC = GenEnums_1.AllItemList[lootContainer] || lootContainer;
const staticLC = tempLC;
const lootToPush = {
tpl: itemID,
relativeProbability: itemConfig.LootPush?.StaticLootProbability,
};
for (const map in locations) {
if (locations.hasOwnProperty(map)) {
const location = locations[map];
if (location.staticLoot) {
const staticLoot = location.staticLoot;
if (staticLoot.hasOwnProperty(staticLC)) {
const staticContainer = staticLoot[staticLC];
if (staticContainer) {
staticContainer.itemDistribution.push(lootToPush);
}
}
}
}
}
});
}
}
addToCases(itemConfig, itemID) {
const tables = this.ref.tables;
const items = tables.templates.items;
if (Array.isArray(itemConfig.CasePush?.CaseFiltersToAdd)) {
itemConfig.CasePush?.CaseFiltersToAdd.forEach((caseToAdd) => {
const tempCases = GenEnums_1.AllItemList[caseToAdd] || caseToAdd;
const cases = tempCases;
for (const item in items) {
if (items[item]._id === cases) {
if (items[item]._props?.Grids[0]._props.filters[0].Filter === undefined) {
const unbreakFilters = [
{
Filter: ["54009119af1c881c07000029"],
ExcludedFilter: [""],
},
];
tables.templates.items[cases]._props.Grids[0]._props.filters = unbreakFilters;
}
else if (items[item]._props?.Grids[0]._props.filters[0].Filter !== undefined) {
items[item]._props?.Grids[0]._props.filters[0].Filter.push(itemID);
}
}
}
});
}
else {
for (const item in items) {
if (items[item]._id === itemConfig.CasePush?.CaseFiltersToAdd) {
if (items[item]._props?.Grids[0]._props.filters[0].Filter === undefined) {
const unbreakFilters = [
{
Filter: ["54009119af1c881c07000029"],
ExcludedFilter: [""],
},
];
tables.templates.items[itemConfig.CasePush?.CaseFiltersToAdd]._props.Grids[0]._props.filters =
unbreakFilters;
}
if (items[item]._props?.Grids[0]._props.filters[0].Filter !== undefined) {
items[item]._props?.Grids[0]._props.filters[0].Filter.push(itemID);
}
}
}
}
}
pushToSlot(itemConfig, itemID) {
const tables = this.ref.tables;
const DefaultInventory = tables.templates.items["55d7217a4bdc2d86028b456d"]._props.Slots;
const tempSlot = GenEnums_1.SlotsIDs[itemConfig.SlotPush?.Slot] || itemConfig.SlotPush?.Slot;
const slotToPush = tempSlot;
DefaultInventory[slotToPush]._props.filters[0].Filter.push(itemID);
}
pushToBlacklist(itemID) {
const ragfair = this.ref.configServer.getConfig(ConfigTypes_1.ConfigTypes.RAGFAIR);
ragfair.dynamic.blacklist.custom.push(...[itemID]);
}
combineItems(itemDirectory) {
const modules = fs.readdirSync(path.join(__dirname, itemDirectory));
const combinedModules = {};
modules.forEach((modFile) => {
const filesPath = path.join(__dirname, itemDirectory, modFile);
const fileContents = fs.readFileSync(filesPath, "utf-8");
const module = JSON.parse(fileContents);
Object.assign(combinedModules, module);
});
return combinedModules;
}
addCustomPresets(itemConfig) {
const tables = this.ref.tables;
const customPresets = itemConfig.PresetPush.PresetToAdd;
const presets = tables.globals.ItemPresets;
if (itemConfig.PresetPush !== undefined) {
customPresets.forEach((preset) => {
const finalPreset = {
_changeWeaponName: preset._changeWeaponName,
_encyclopedia: preset._encyclopedia || undefined,
_id: preset._id,
_items: preset._items.map((itemData) => {
const item = {
_id: itemData._id,
_tpl: itemData._tpl,
};
if (itemData.parentId) {
item.parentId = itemData.parentId;
}
if (itemData.slotId) {
item.slotId = itemData.slotId;
}
return item;
}),
_name: preset._name,
_parent: preset._parent,
_type: "Preset",
};
presets[finalPreset._id] = finalPreset;
});
}
}
buildCustomPresets(itemConfig, itemID) {
const tables = this.ref.tables;
const presets = tables.globals.ItemPresets;
const basePresetID = this.ref.hashUtil.generate();
if (tables.templates.items[itemID]._parent === "5a341c4086f77401f2541505" ||
tables.templates.items[itemID]._parent === "5448e5284bdc2dcb718b4567" ||
tables.templates.items[itemID]._parent === "5448e54d4bdc2dcc718b4568") {
const finalPreset = {
_changeWeaponName: false,
_encyclopedia: itemID,
_id: this.ref.hashUtil.generate(),
_items: [],
_name: `${itemConfig.LocalePush.en.name} Preset`,
_parent: basePresetID,
_type: "Preset",
};
finalPreset._items.push({ _id: basePresetID, _tpl: itemID });
tables.templates.items[itemID]._props.Slots.forEach((slot) => {
if (slot._name !== "mod_nvg") {
finalPreset._items.push({
_id: this.ref.hashUtil.generate(),
_tpl: this.ref.randomUtil
.drawRandomFromList(slot._props.filters[0].Filter, 1, false)
.toString(),
parentId: basePresetID,
slotId: slot._name,
});
}
});
presets[finalPreset._id] = finalPreset;
}
}
addToQuests(quests, condition, target, newTarget) {
for (const quest of Object.keys(quests)) {
const questConditions = quests[quest];
for (const nextCondition of questConditions.conditions.AvailableForFinish) {
const nextConditionData = nextCondition;
if (nextConditionData.conditionType == condition && nextConditionData.target.includes(target)) {
nextConditionData.target.push(newTarget);
}
}
}
}
//#endregion
//
//
//
//#region Clothing Gen
createClothingTop(newTopConfig) {
const tables = this.ref.tables;
const newTop = structuredClone(tables.templates.customization["5d28adcb86f77429242fc893"]);
const newHands = structuredClone(tables.templates.customization[newTopConfig.HandsToClone]);
const newSet = structuredClone(tables.templates.customization["5d1f623e86f7744bce0ef705"]);
newTop._id = newTopConfig.NewOutfitID;
newTop._name = newTopConfig.LocaleName;
newTop._props.Prefab.path = newTopConfig.BundlePath;
tables.templates.customization[newTopConfig.NewOutfitID] = newTop;
newHands._id = `${newTopConfig.NewOutfitID}Hands`;
newHands._name = `${newTopConfig.LocaleName}Hands`;
newHands._props.Prefab.path = newTopConfig.HandsBundlePath;
tables.templates.customization[`${newTopConfig.NewOutfitID}Hands`] = newHands;
newSet._id = `${newTopConfig.NewOutfitID}Set`;
newSet._name = `${newTopConfig.LocaleName}Set`;
newSet._props.Body = newTopConfig.NewOutfitID;
newSet._props.Hands = `${newTopConfig.NewOutfitID}Hands`;
newSet._props.Side = ["Usec", "Bear", "Savage"];
tables.templates.customization[`${newTopConfig.NewOutfitID}Set`] = newSet;
for (const locale in tables.locales.global) {
tables.locales.global[locale][`${newTopConfig.NewOutfitID}Set Name`] = newTopConfig.LocaleName;
}
if (newTopConfig.TraderScheme !== undefined) {
if (!tables.traders[newTopConfig.TraderScheme?.TraderToUse].base.customization_seller) {
tables.traders[newTopConfig.TraderScheme?.TraderToUse].base.customization_seller = true;
}
if (!tables.traders[newTopConfig.TraderScheme?.TraderToUse].suits) {
tables.traders[newTopConfig.TraderScheme?.TraderToUse].suits = [];
}
tables.traders[newTopConfig.TraderScheme?.TraderToUse].suits.push({
_id: newTopConfig.NewOutfitID,
tid: newTopConfig.TraderScheme?.TraderToUse,
suiteId: `${newTopConfig.NewOutfitID}Set`,
isActive: true,
requirements: {
loyaltyLevel: newTopConfig.TraderScheme?.LoyaltyLevel,
profileLevel: newTopConfig.TraderScheme?.ProfileLevelRequirement,
standing: newTopConfig.TraderScheme?.TraderStandingRequirement,
skillRequirements: [],
questRequirements: [],
itemRequirements: [
{
count: newTopConfig.TraderScheme?.Cost,
_tpl: newTopConfig.TraderScheme?.CurrencyToUse,
onlyFunctional: false,
},
],
},
});
}
}
createClothingBottom(newBottomConfig) {
const tables = this.ref.tables;
const newBottom = structuredClone(tables.templates.customization["5d5e7f4986f7746956659f8a"]);
const newSet = structuredClone(tables.templates.customization["5cd946231388ce000d572fe3"]);
newBottom._id = newBottomConfig.NewBottomsID;
newBottom._name = newBottomConfig.LocaleName;
newBottom._props.Prefab.path = newBottomConfig.BundlePath;
tables.templates.customization[newBottomConfig.NewBottomsID] = newBottom;
newSet._id = `${newBottomConfig.NewBottomsID}Set`;
newSet._name = `${newBottomConfig.NewBottomsID}Set`;
newSet._props.Feet = newBottomConfig.NewBottomsID;
newSet._props.Side = ["Usec", "Bear", "Savage"];
tables.templates.customization[`${newBottomConfig.NewBottomsID}Set`] = newSet;
for (const locale in tables.locales.global) {
tables.locales.global[locale][`${newBottomConfig.NewBottomsID}Set Name`] = newBottomConfig.LocaleName;
}
if (newBottomConfig.TraderScheme !== undefined) {
if (!tables.traders[newBottomConfig.TraderScheme?.TraderToUse].base.customization_seller) {
tables.traders[newBottomConfig.TraderScheme?.TraderToUse].base.customization_seller = true;
}
if (!tables.traders[newBottomConfig.TraderScheme?.TraderToUse].suits) {
tables.traders[newBottomConfig.TraderScheme?.TraderToUse].suits = [];
}
tables.traders[newBottomConfig.TraderScheme?.TraderToUse].suits.push({
_id: newBottomConfig.NewBottomsID,
tid: newBottomConfig.TraderScheme?.TraderToUse,
suiteId: `${newBottomConfig.NewBottomsID}Set`,
isActive: true,
requirements: {
loyaltyLevel: newBottomConfig.TraderScheme?.LoyaltyLevel,
profileLevel: newBottomConfig.TraderScheme?.ProfileLevelRequirement,
standing: newBottomConfig.TraderScheme?.TraderStandingRequirement,
skillRequirements: [],
questRequirements: [],
itemRequirements: [
{
count: newBottomConfig.TraderScheme?.Cost,
_tpl: newBottomConfig.TraderScheme?.CurrencyToUse,
onlyFunctional: false,
},
],
},
});
}
}
}
exports.ItemGenerator = ItemGenerator;
//# sourceMappingURL=ItemGenerator.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.References = void 0;
class References {
container;
preSptModLoader;
configServer;
saveServer;
itemHelper;
logger;
staticRouter;
onUpdateModService;
database;
databaseService;
customItem;
imageRouter;
jsonUtil;
profileHelper;
ragfairPriceService;
importerUtil;
tables;
botHelper;
randomUtil;
hashUtil;
probHelper;
traderHelper;
botController;
httpResponse;
preSptLoad(container) {
this.container = container;
this.preSptModLoader = container.resolve("PreSptModLoader");
this.imageRouter = container.resolve("ImageRouter");
this.configServer = container.resolve("ConfigServer");
this.saveServer = container.resolve("SaveServer");
this.itemHelper = container.resolve("ItemHelper");
this.logger = container.resolve("WinstonLogger");
this.staticRouter = container.resolve("StaticRouterModService");
this.onUpdateModService = container.resolve("OnUpdateModService");
this.randomUtil = container.resolve("RandomUtil");
this.database = container.resolve("DatabaseServer");
this.databaseService = container.resolve("DatabaseService");
this.tables = this.databaseService.getTables();
this.customItem = container.resolve("CustomItemService");
this.jsonUtil = container.resolve("JsonUtil");
this.profileHelper = container.resolve("ProfileHelper");
this.ragfairPriceService = container.resolve("RagfairPriceService");
this.importerUtil = container.resolve("ImporterUtil");
this.botHelper = container.resolve("BotHelper");
this.hashUtil = container.resolve("HashUtil");
this.probHelper = container.resolve("ProbabilityHelper");
this.traderHelper = container.resolve("TraderHelper");
this.botController = container.resolve("BotController");
this.httpResponse = container.resolve("HttpResponseUtil");
}
postDBLoad(container) {
this.container = container;
this.database = container.resolve("DatabaseServer");
this.imageRouter = container.resolve("ImageRouter");
this.logger = container.resolve("WinstonLogger");
this.tables = container.resolve("DatabaseServer").getTables();
this.customItem = container.resolve("CustomItemService");
this.jsonUtil = container.resolve("JsonUtil");
this.profileHelper = container.resolve("ProfileHelper");
this.ragfairPriceService = container.resolve("RagfairPriceService");
this.importerUtil = container.resolve("ImporterUtil");
this.botHelper = container.resolve("BotHelper");
this.randomUtil = container.resolve("RandomUtil");
this.itemHelper = container.resolve("ItemHelper");
this.hashUtil = container.resolve("HashUtil");
this.probHelper = container.resolve("ProbabilityHelper");
this.botController = container.resolve("BotController");
this.httpResponse = container.resolve("HttpResponseUtil");
}
}
exports.References = References;
//# sourceMappingURL=References.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "References.js",
"sourceRoot": "",
"sources": [
"References.ts"
],
"names": [],
"mappings": ";;;AA0BA,MAAa,UAAU;I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c,aAAa,CAAC,CAAC;QACjE,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,OAAO,CAAU,eAAe,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,OAAO,CAAiB,gBAAgB,CAAC,CAAC,SAAS,EAAE,CAAC;QAC9E,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAoB,mBAAmB,CAAC,CAAC;QAC5E,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAW,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC,OAAO,CAAgB,eAAe,CAAC,CAAC;QACvE,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC,OAAO,CAAsB,qBAAqB,CAAC,CAAC;QACzF,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,OAAO,CAAe,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAY,WAAW,CAAC,CAAC;QAC3D,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAa,YAAY,CAAC,CAAC;QAC9D,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAa,YAAY,CAAC,CAAC;QAC9D,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAW,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAoB,mBAAmB,CAAC,CAAC;QAC5E,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC,OAAO,CAAgB,eAAe,CAAC,CAAC;QACvE,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,OAAO,CAAmB,kBAAkB,CAAC,CAAC;IAChF,CAAC;CACJ;AAzED,gCAyEC"
}

View file

@ -0,0 +1,108 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TraderUtils = void 0;
class TraderUtils {
ref;
constructor(ref) {
this.ref = ref;
}
/**
* Add profile picture to our trader
* @param baseJson json file for trader (db/base.json)
* @param preAkiModLoader mod loader class - used to get the mods file path
* @param imageRouter image router class - used to register the trader image path so we see their image on trader page
* @param traderImageName Filename of the trader icon to use
*/
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
registerProfileImage(baseJson, modName, traderImageName) {
// Reference the mod "res" folder
const imageFilepath = `./${this.ref.preSptModLoader.getModPath(modName)}res`;
// Register a route to point to the profile picture - remember to remove the .jpg from it
this.ref.imageRouter.addRoute(baseJson.avatar.replace(".png", ""), `${imageFilepath}/${traderImageName}`);
}
/**
* 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
*/
setTraderUpdateTime(traderConfig,
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
baseJson, minSeconds, maxSeconds) {
// Add refresh time in seconds to config
const traderRefreshRecord = {
traderId: baseJson._id,
seconds: {
min: minSeconds,
max: maxSeconds,
},
};
traderConfig.updateTime.push(traderRefreshRecord);
}
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
addTraderToDb(traderDetailsToAdd, assort) {
this.ref.tables.traders[traderDetailsToAdd._id] = {
assort: this.ref.jsonUtil.deserialize(this.ref.jsonUtil.serialize(assort)),
base: this.ref.jsonUtil.deserialize(this.ref.jsonUtil.serialize(traderDetailsToAdd)),
questassort: {
started: {},
success: {},
fail: {},
},
};
}
// biome-ignore lint/suspicious/noExplicitAny: traderDetailsToAdd comes from base.json, so no type
addTraderToDbCustomAssort(traderDetailsToAdd) {
// Add trader to trader table, key is the traders id
this.ref.tables.traders[traderDetailsToAdd._id] = {
assort: this.createAssortTable(), // assorts are the 'offers' trader sells, can be a single item (e.g. carton of milk) or multiple items as a collection (e.g. a gun)
base: this.ref.jsonUtil.deserialize(this.ref.jsonUtil.serialize(traderDetailsToAdd)), // Deserialise/serialise creates a copy of the json and allows us to cast it as an ITraderBase
questassort: {
started: {},
success: {},
fail: {},
}, // questassort is empty as trader has no assorts unlocked by quests
};
}
/**
* Create basic data for trader + add empty assorts table for trader
* @param tables SPT db
* @param jsonUtil SPT JSON utility class
* @returns ITraderAssort
*/
createAssortTable() {
// Create a blank assort object, ready to have items added
const assortTable = {
nextResupply: 0,
items: [],
barter_scheme: {},
loyal_level_items: {},
};
return assortTable;
}
/**
* Add traders name/location/description to the locale table
* @param baseJson json file for trader (db/base.json)
* @param tables database tables
* @param fullName Complete name of trader
* @param firstName First name of trader
* @param nickName Nickname of trader
* @param location Location of trader (e.g. "Here in the cat shop")
* @param description Description of trader
*/
addTraderToLocales(
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
baseJson, fullName, firstName, nickName, location, description) {
// For each language, add locale for the new trader
const locales = Object.values(this.ref.tables.locales.global);
for (const locale of locales) {
locale[`${baseJson._id} FullName`] = fullName;
locale[`${baseJson._id} FirstName`] = firstName;
locale[`${baseJson._id} Nickname`] = nickName;
locale[`${baseJson._id} Location`] = location;
locale[`${baseJson._id} Description`] = description;
}
}
}
exports.TraderUtils = TraderUtils;
//# sourceMappingURL=Utils.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "Utils.js",
"sourceRoot": "",
"sources": [
"Utils.ts"
],
"names": [],
"mappings": ";;;AAIA,MAAa,WAAW;IACD;IAAnB,YAAmB,GAAe;QAAf,QAAG,GAAH,GAAG,CAAY;IAAG,CAAC;IACtC;;;;;;OAMG;IAEH,4DAA4D;IACrD,oBAAoB,CAAC,QAAa,EAAE,OAAe,EAAE,eAAuB;QAC/E,iCAAiC;QACjC,MAAM,aAAa,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC;QAE7E,yFAAyF;QACzF,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE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SAAS,CAAC,kBAAkB,CAAC,CAAgB,EAAE,8FAA8F;YACnM,WAAW,EAAE;gBACT,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,EAAE;gBACX,IAAI,EAAE,EAAE;aACX,EAAE,mEAAmE;SACzE,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACK,iBAAiB;QACrB,0DAA0D;QAC1D,MAAM,WAAW,GAAkB;YAC/B,YAAY,EAAE,CAAC;YACf,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,EAAE;YACjB,iBAAiB,EAAE,EAAE;SACxB,CAAC;QAEF,OAAO,WAAW,CAAC;IACvB,CAAC;IAED;;;;;;;;;OASG;IACI,kBAAkB;IACrB,4DAA4D;IAC5D,QAAa,EACb,QAAgB,EAChB,SAAiB,EACjB,QAAgB,EAChB,QAAgB,EAChB,WAAmB;QAEnB,mDAAmD;QACnD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAA6B,CAAC;QAC1F,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAG,QAAQ,CAAC;YAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,YAAY,CAAC,GAAG,SAAS,CAAC;YAChD,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAG,QAAQ,CAAC;YAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAG,QAAQ,CAAC;YAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,cAAc,CAAC,GAAG,WAAW,CAAC;QACxD,CAAC;IACL,CAAC;CACJ;AArHD,kCAqHC"
}

View file

@ -0,0 +1,72 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.TraderData = void 0;
const Utils_1 = require("../Refs/Utils");
const assortJson = __importStar(require("../../db/assort.json"));
const baseJson = __importStar(require("../../db/base.json"));
const modName = "Lunnayaluna Lotus";
class TraderData {
traderConfig;
ref;
traderHelper;
constructor(traderConfig, ref, traderHelper) {
this.traderConfig = traderConfig;
this.ref = ref;
this.traderHelper = traderHelper;
}
registerProfileImage() {
this.traderHelper.registerProfileImage(baseJson, modName, "lotus.png");
}
setupTraderUpdateTime() {
this.traderHelper.setTraderUpdateTime(this.traderConfig, baseJson, 1800, 7200);
}
pushTrader() {
this.traderHelper = new Utils_1.TraderUtils(this.ref);
this.traderHelper.addTraderToDb(baseJson, assortJson);
}
addTraderToLocales(fullName, firstName, nickName, location, description) {
const locales = Object.values(this.ref.tables.locales.global);
for (const locale of locales) {
locale[`${baseJson._id} FullName`] = fullName;
locale[`${baseJson._id} FirstName`] = firstName;
locale[`${baseJson._id} Nickname`] = nickName;
locale[`${baseJson._id} Location`] = location;
locale[`${baseJson._id} Description`] = description;
}
}
}
exports.TraderData = TraderData;
//# sourceMappingURL=Lotus.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "Lotus.js",
"sourceRoot": "",
"sources": [
"Lotus.ts"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAA4C;AAE5C,iEAAmD;AACnD,6DAA+C;AAE/C,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAEpC,MAAa,UAAU;IAEP;IACA;IACA;IAHZ,YACY,YAA2B,EAC3B,GAAe,EACf,YAAyB;QAFzB,iBAAY,GAAZ,YAAY,CAAe;QAC3B,QAAG,GAAH,GAAG,CAAY;QACf,iBAAY,GAAZ,YAAY,CAAa;IAClC,CAAC;IAEG,oBAAoB;QACvB,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAC3E,CAAC;IAEM,qBAAqB;QACxB,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACnF,CAAC;IAEM,UAAU;QACb,IAAI,CAAC,YAAY,GAAG,IAAI,mBAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAEM,kBAAkB,CACrB,QAAgB,EAChB,SAAiB,EACjB,QAAgB,EAChB,QAAgB,EAChB,WAAmB;QAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAA6B,CAAC;QAC1F,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAG,QAAQ,CAAC;YAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,YAAY,CAAC,GAAG,SAAS,CAAC;YAChD,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAG,QAAQ,CAAC;YAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAG,QAAQ,CAAC;YAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,cAAc,CAAC,GAAG,WAAW,CAAC;QACxD,CAAC;IACL,CAAC;CACJ;AApCD,gCAoCC"
}

View file

@ -0,0 +1,74 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const ConfigTypes_1 = require("C:/snapshot/project/obj/models/enums/ConfigTypes");
const Traders_1 = require("C:/snapshot/project/obj/models/enums/Traders");
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
const ItemGenerator_1 = require("./CustomItems/ItemGenerator");
const References_1 = require("./Refs/References");
const Utils_1 = require("./Refs/Utils");
const Lotus_1 = require("./Trader/Lotus");
const baseJson = __importStar(require("../db/base.json"));
const questAssort = __importStar(require("../db/questassort.json"));
class Lotus {
ref = new References_1.References();
preSptLoad(container) {
this.ref.preSptLoad(container);
const ragfair = this.ref.configServer.getConfig(ConfigTypes_1.ConfigTypes.RAGFAIR);
const traderConfig = this.ref.configServer.getConfig(ConfigTypes_1.ConfigTypes.TRADER);
const traderUtils = new Utils_1.TraderUtils(this.ref);
const traderData = new Lotus_1.TraderData(traderConfig, this.ref, traderUtils);
traderData.registerProfileImage();
traderData.setupTraderUpdateTime();
Traders_1.Traders[baseJson._id] = baseJson._id;
ragfair.traders[baseJson._id] = true;
}
postDBLoad(container) {
this.ref.postDBLoad(container);
const traderConfig = this.ref.configServer.getConfig(ConfigTypes_1.ConfigTypes.TRADER);
const locations = this.ref.tables.locations;
const itemGenerator = new ItemGenerator_1.ItemGenerator(this.ref);
const traderUtils = new Utils_1.TraderUtils(this.ref);
const traderData = new Lotus_1.TraderData(traderConfig, this.ref, traderUtils);
traderData.pushTrader();
this.ref.tables.traders[baseJson._id].questassort = questAssort;
traderData.addTraderToLocales(baseJson.name, "Lotus", baseJson.nickname, baseJson.location, "A businesswoman who travels around conflict zones around the world.");
itemGenerator.createCustomItems("../../db/ItemGen/Keys");
locations.laboratory.base.AccessKeys.push(...["6747b519aa6cb78b189e6081"]);
this.ref.logger.log("Lotus arrived in Tarkov", LogTextColor_1.LogTextColor.CYAN);
}
}
module.exports = { mod: new Lotus() };
//# sourceMappingURL=mod.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "mod.js",
"sourceRoot": "",
"sources": [
"mod.ts"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kFAA+E;AAC/E,0EAAuE;AAKvE,0FAAuF;AACvF,+DAA4D;AAC5D,kDAA+C;AAC/C,wCAA2C;AAC3C,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9C,MAAM,UAAU,GAAG,IAAI,kBAAU,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAEvE,UAAU,CAAC,UAAU,EAAE,CAAC;QACxB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,GAAG,WAAW,CAAC;QAChE,UAAU,CAAC,kBAAkB,CACzB,QAAQ,CAAC,IAAI,EACb,OAAO,EACP,QAAQ,CAAC,QAAQ,EACjB,QAAQ,CAAC,QAAQ,EACjB,qEAAqE,CACxE,CAAC;QAEF,aAAa,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,CAAC;QACzD,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,CAAC;QAE3E,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,yBAAyB,EAAE,2BAAY,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC;CACJ;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,GAAG,EAAE,IAAI,KAAK,EAAE,EAAE,CAAC"
}

View file

@ -0,0 +1,142 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ConfigTypes_1 = require("C:/snapshot/project/obj/models/enums/ConfigTypes");
const Traders_1 = require("C:/snapshot/project/obj/models/enums/Traders");
class Mod {
questConfig;
async preSptLoad(container) {
const logger = container.resolve("WinstonLogger");
const dynamicRouterModService = container.resolve("DynamicRouterModService");
const staticRouterModService = container.resolve("StaticRouterModService");
const profileHelper = container.resolve("ProfileHelper");
const questHelper = container.resolve("QuestHelper");
const configServer = container.resolve("ConfigServer");
this.questConfig = configServer.getConfig(ConfigTypes_1.ConfigTypes.QUEST);
//const questConditionHelper = container.resolve<QuestConditionHelper>("QuestConditionHelper");
const traderHelper = container.resolve("TraderHelper");
const databaseServer = container.resolve("DatabaseServer");
const fenceService = container.resolve("FenceService");
// Hook up a new static route
staticRouterModService.registerStaticRouter("MoreCheckmarksRoutes", [
{
url: "/MoreCheckmarksRoutes/quests",
action: async (url, info, sessionID, output) => {
logger.info("MoreCheckmarks making quest data request");
const quests = [];
const allQuests = questHelper.getQuestsFromDb();
//const allQuests = databaseServer.getTables().templates.quests;
const profile = profileHelper.getPmcProfile(sessionID);
if (profile && profile.Quests) {
for (const quest of allQuests) {
// Skip if not a quest we can have
if (profile.Info && this.questIsForOtherSide(profile.Info.Side, quest._id)) {
continue;
}
// Skip if already complete or can't complete
const questStatus = questHelper.getQuestStatus(profile, quest._id);
/*
Locked = 0,
AvailableForStart = 1,
Started = 2,
AvailableForFinish = 3,
Success = 4,
Fail = 5,
FailRestartable = 6,
MarkedAsFailed = 7,
Expired = 8,
AvailableAfter = 9
*/
if (questStatus >= 3 && questStatus <= 8) {
continue;
}
quests.push(quest);
}
logger.info("Got quests");
}
else {
logger.info("Unable to fetch quests for MoreCheckmarks");
}
return JSON.stringify(quests);
}
},
{
url: "/MoreCheckmarksRoutes/assorts",
action: async (url, info, sessionID, output) => {
logger.info("MoreCheckmarks making trader assort data request");
const assorts = [];
if (databaseServer && databaseServer.getTables()) {
if (Traders_1.Traders && traderHelper) {
for (const value of Object.values(Traders_1.Traders)) {
if (value == "579dc571d53a0658a154fbec" && fenceService.getRawFenceAssorts()) {
assorts.push(fenceService.getRawFenceAssorts());
}
else if (databaseServer.getTables().traders[value] && databaseServer.getTables().traders[value].assort) {
assorts.push(databaseServer.getTables().traders[value].assort);
}
}
}
else {
logger.info("Unable to fetch assorts for MoreCheckmarks");
}
}
return JSON.stringify(assorts);
}
},
{
url: "/MoreCheckmarksRoutes/items",
action: async (url, info, sessionID, output) => {
logger.info("MoreCheckmarks making item data request");
const items = {};
if (databaseServer && databaseServer.getTables() && databaseServer.getTables().templates && databaseServer.getTables().templates.items) {
return JSON.stringify(databaseServer.getTables().templates.items);
}
else {
return JSON.stringify(items);
}
}
},
{
url: "/MoreCheckmarksRoutes/locales",
action: async (url, info, sessionID, output) => {
logger.info("MoreCheckmarks making locale request");
// @ts-ignore
const locales = {};
if (databaseServer && databaseServer.getTables() && databaseServer.getTables().locales) {
return JSON.stringify(databaseServer.getTables().locales);
}
else {
return JSON.stringify(locales);
}
}
},
{
url: "/MoreCheckmarksRoutes/productions",
action: async (url, info, sessionID, output) => {
logger.info("MoreCheckmarks making productions request");
// @ts-ignore
const production = {};
if (databaseServer && databaseServer.getTables() && databaseServer.getTables().hideout && databaseServer.getTables().hideout.production) {
return JSON.stringify(databaseServer.getTables().hideout.production);
}
else {
return JSON.stringify(production);
}
}
}
], "custom-static-MoreCheckmarksRoutes");
}
questIsForOtherSide(playerSide, questId) {
const isUsec = playerSide.toLowerCase() === "usec";
if (isUsec && this.questConfig.bearOnlyQuests.includes(questId)) {
// player is usec and quest is bear only, skip
return true;
}
if (!isUsec && this.questConfig.usecOnlyQuests.includes(questId)) {
// player is bear and quest is usec only, skip
return true;
}
return false;
}
}
module.exports = { mod: new Mod() };
//# sourceMappingURL=MoreCheckmarksStaticRouter.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "MoreCheckmarksStaticRouter.js",
"sourceRoot": "",
"sources": [
"MoreCheckmarksStaticRouter.ts"
],
"names": [],
"mappings": ";;AASA,kFAA+E;AAE/E,0EAAuE;AAUvE,MAAM,GAAG;IAEK,WAAW,CAAe;IAE7B,KAAK,CAAC,UAAU,CAAC,SAA8B;QAClD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAU,eAAe,CAAC,CAAC;QAC3D,MAAM,uBAAuB,GAAG,SAAS,CAAC,OAAO,CAA0B,yBAAyB,CAAC,CAAC;QACtG,MAAM,sBAAsB,GAAG,SAAS,CAAC,OAAO,CAAyB,wBAAwB,CAAC,CAAC;QACnG,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAgB,eAAe,CAAC,CAAC;QACxE,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAc,aAA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int/brace-style */
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/*
* If you are reading this, I hope you are enjoying Scorpion
*
*
* I have worked on this mod for several months and have tried my best to make it as easy to read and clean as possible
* I may not always do things in the best way, but I do try!
* If you have any questions please reach out to me in the SPT Discord - do not DM me
*
*/
const tsyringe_1 = require("C:/snapshot/project/node_modules/tsyringe");
const ConfigTypes_1 = require("C:/snapshot/project/obj/models/enums/ConfigTypes");
const jsonc_1 = require("C:/snapshot/project/node_modules/jsonc");
const node_fs_1 = __importDefault(require("node:fs"));
const node_path_1 = __importDefault(require("node:path"));
// Custom Imports
const traderHelpers_1 = require("./traderHelpers");
const Traders_1 = require("C:/snapshot/project/obj/models/enums/Traders");
const baseJson = require("../db/base.json");
const questJson = require("../db/questassort.json");
const assortJson = require("../db/assort.json");
const productionJson = require("../db/production.json");
const weaponCompatibility = require("../config/ModdedWeaponCompatibility.json");
const scorpionQuests = require("../../Virtual's Custom Quest Loader/database/quests/Scorpion_quests.json");
let realismDetected;
const loadMessage = {
0: "Scorpion has brought his crew into Tarkov",
1: "One of us..one of us..one of us",
2: "Welcome to the team, you're one of us meow ♡",
3: "Call Kenny Loggins because you're in the danger zone",
4: "Can I offer you a nice egg in this trying time?",
5: "Good news everyone! We have over 100 quests!",
6: "Never half-ass two things. Whole-ass one thing.",
7: "Thanks for signing up for Cat Facts! You will now receive fun daily facts about CATS!",
8: "Thanks for signing up for Dog Facts! You will now receive fun daily facts about DOGS!",
9: "A big ball of wibbly wobbly, timey wimey stuff",
10: "(╯°□°)╯︵ ┻━┻ ",
11: "┬─┬ノ( º _ ºノ)",
12: "Treat others how you want to be treated",
13: "No act of kindness, no matter how small, is ever wasted",
14: "Reticulating Splines...",
15: "Unfolding Foldy Chairs...",
16: "Pressurizing Fruit Punch Barrel Hydraulics...",
17: "Fabricating Imaginary Infrastructure...",
18: "We apologize again for the fault in the subtitles. Those responsible for sacking the people who have just been sacked, have been sacked.",
19: "Are you suggesting coconuts migrate?",
20: "We are now the knights who say ekki-ekki-ekki-pitang-zoom-boing!",
21: "Knight jumps queen! Bishop jumps queen! Pawns jump queen!",
22: "Hello. My name is Inigo Montoya. You killed my father. Prepare to die.",
23: "I spent the last few years building up an immunity to iocane powder.",
24: "Rodents Of Unusual Size? I don't think they exist.",
25: "Always try to be nice, but never fail to be kind",
26: "Never be cruel, never be cowardly",
27: "Who do I need to ban? (◣_◢)",
28: "This loading message is sponsored by Raid: Shadow Legends"
};
class Scorpion {
mod;
logger;
traderHelper;
static fileSystemSync = tsyringe_1.container.resolve("FileSystemSync");
static config = jsonc_1.jsonc.parse(Scorpion.fileSystemSync.read(node_path_1.default.resolve(__dirname, "../config/config.jsonc")));
// Set the name of mod for logging purposes
constructor() {
this.mod = "acidphantasm-scorpion";
}
/*
* Some work needs to be done prior to SPT code being loaded
*
* TLDR:
* Resolve SPT Types
* Set trader refresh, config, image, flea settings
* Register Dynamic Router for Randomization Config
*
*/
preSptLoad(container) {
// Get a logger
this.logger = container.resolve("WinstonLogger");
// Get SPT code/data we need later
const dynamicRouterModService = container.resolve("DynamicRouterModService");
const preSptModLoader = container.resolve("PreSptModLoader");
const databaseService = container.resolve("DatabaseService");
const ragfairOfferGenerator = container.resolve("RagfairOfferGenerator");
const imageRouter = container.resolve("ImageRouter");
const configServer = container.resolve("ConfigServer");
const traderConfig = configServer.getConfig(ConfigTypes_1.ConfigTypes.TRADER);
const ragfairConfig = configServer.getConfig(ConfigTypes_1.ConfigTypes.RAGFAIR);
// Set config values to local variables for validation & use
let minRefresh = Scorpion.config.traderRefreshMin;
let maxRefresh = Scorpion.config.traderRefreshMax;
const addToFlea = Scorpion.config.addTraderToFlea;
if (minRefresh >= maxRefresh || maxRefresh <= 2) {
minRefresh = 1800;
maxRefresh = 3600;
this.logger.error(`[${this.mod}] [Config Issue] Refresh timers have been reset to default.`);
}
// Create helper class and use it to register our traders image/icon + set its stock refresh time
this.traderHelper = new traderHelpers_1.TraderHelper();
const currentDate = new Date();
const month = currentDate.getMonth();
const day = currentDate.getDate();
if (month == 3 && day == 1) {
baseJson.nickname = "ScorpionXYZ";
baseJson.name = "ScorpionXYZ";
baseJson.avatar = "/files/trader/avatar/6688d464bc40c867f60e7d7e_aprilfools.jpg";
this.traderHelper.registerProfileImage(baseJson, this.mod, preSptModLoader, imageRouter, "6688d464bc40c867f60e7d7e_aprilfools.jpg");
}
else
this.traderHelper.registerProfileImage(baseJson, this.mod, preSptModLoader, imageRouter, "6688d464bc40c867f60e7d7e.jpg");
this.traderHelper.setTraderUpdateTime(traderConfig, baseJson, minRefresh, maxRefresh);
// Add trader to trader enum
Traders_1.Traders[baseJson._id] = baseJson._id;
// Add trader to flea market
if (addToFlea) {
ragfairConfig.traders[baseJson._id] = true;
}
else {
ragfairConfig.traders[baseJson._id] = false;
}
dynamicRouterModService.registerDynamicRouter("ScorpionRefreshStock", [
{
url: "/client/items/prices/6688d464bc40c867f60e7d7e",
action: async (url, info, sessionId, output) => {
const trader = databaseService.getTables().traders["6688d464bc40c867f60e7d7e"];
const assortItems = trader.assort.items;
let updateFleaOffers = false;
if (!realismDetected) {
if (Scorpion.config.randomizeBuyRestriction) {
if (Scorpion.config.debugLogging) {
this.logger.info(`[${this.mod}] Refreshing Scorpion Stock with Randomized Buy Restrictions.`);
}
updateFleaOffers = true;
this.randomizeBuyRestriction(assortItems);
}
if (Scorpion.config.randomizeStockAvailable) {
if (Scorpion.config.debugLogging) {
this.logger.info(`[${this.mod}] Refreshing Scorpion Stock with Randomized Stock Availability.`);
}
updateFleaOffers = true;
this.randomizeStockAvailable(assortItems);
}
if (updateFleaOffers)
ragfairOfferGenerator.generateFleaOffersForTrader("6688d464bc40c867f60e7d7e");
}
return output;
}
}
], "spt");
}
/*
* Some work needs to be done after loading SPT code
*
* TLDR:
* Resolve SPT Types
* Add Modded Weapons to Quests
* Mod Detection to enable/disable Assort Configuration options
* Apply Assort Configurations
* Add trader to dictionary, locales, and assort
*
*/
postDBLoad(container) {
const start = performance.now();
// Resolve SPT classes we'll use
const databaseService = container.resolve("DatabaseService");
const jsonUtil = container.resolve("JsonUtil");
const logger = container.resolve("WinstonLogger");
const quests = databaseService.getTables().templates.quests;
//Set local variables for assortJson
const assortPriceTable = assortJson.barter_scheme;
const assortItemTable = assortJson.items;
const assortLoyaltyTable = assortJson.loyal_level_items;
//Run Modded Weapon Compatibility
this.moddedWeaponCompatibility();
//Enable event quests
if (Scorpion.config.eventQuestsAlwaysActive) {
this.eventQuestsAlwaysActive(quests, scorpionQuests);
}
//Check Mod Compatibility
this.modDetection();
//Push Production Schemes
this.pushProductionUnlocks();
//Update Assort
if (Scorpion.config.priceMultiplier !== 1) {
this.setPriceMultiplier(assortPriceTable);
}
if (Scorpion.config.randomizeBuyRestriction) {
this.randomizeBuyRestriction(assortItemTable);
}
if (Scorpion.config.randomizeStockAvailable) {
this.randomizeStockAvailable(assortItemTable);
}
if (Scorpion.config.unlimitedStock) {
this.setUnlimitedStock(assortItemTable);
}
if (Scorpion.config.unlimitedBuyRestriction) {
this.setUnlimitedBuyRestriction(assortItemTable);
}
if (Scorpion.config.removeLoyaltyRestriction) {
this.disableLoyaltyRestrictions(assortLoyaltyTable);
}
// Set local variable for assort to pass to traderHelper regardless of priceMultiplier config
const newAssort = assortJson;
// Get a reference to the database tables
const tables = databaseService.getTables();
// Add new trader to the trader dictionary in DatabaseServer
// Add quest assort
// Add trader to locale file, ensures trader text shows properly on screen
this.traderHelper.addTraderToDb(baseJson, tables, jsonUtil, newAssort);
tables.traders[baseJson._id].questassort = questJson;
this.traderHelper.addTraderToLocales(baseJson, tables, baseJson.name, baseJson._id, baseJson.nickname, baseJson.location, "I'm sellin', what are you buyin'?");
this.logger.debug(`[${this.mod}] loaded... `);
const timeTaken = performance.now() - start;
if (Scorpion.config.debugLogging) {
logger.log(`[${this.mod}] Trader load took ${timeTaken.toFixed(3)}ms.`, "cyan");
}
logger.log(`[${this.mod}] ${this.getRandomLoadMessage()}`, "cyan");
}
/*
*
* All functions are below this comment
*
* Most of these functions should be self explanatory
*
*/
setRealismDetection(i) {
realismDetected = i;
if (realismDetected && Scorpion.config.randomizeBuyRestriction || realismDetected && Scorpion.config.randomizeStockAvailable) {
this.logger.log(`[${this.mod}] SPT-Realism detected, disabling randomizeBuyRestriction and/or randomizeStockAvailable:`, "cyan");
}
}
setPriceMultiplier(assortPriceTable) {
let priceMultiplier = Scorpion.config.priceMultiplier;
if (priceMultiplier <= 0) {
priceMultiplier = 1;
this.logger.error(`[${this.mod}] priceMultiplier cannot be set to zero.`);
}
for (const itemID in assortPriceTable) {
for (const item of assortPriceTable[itemID]) {
if (item[0].count <= 15) {
if (Scorpion.config.debugLogging) {
this.logger.log(`[${this.mod}] itemID: [${itemID}] No price change, it's a barter trade.`, "cyan");
}
continue;
}
const count = item[0].count;
const newPrice = Math.round(count * priceMultiplier);
item[0].count = newPrice;
if (Scorpion.config.debugLogging) {
this.logger.log(`[${this.mod}] itemID: [${itemID}] Price Changed to: [${newPrice}]`, "cyan");
}
}
}
}
randomizeBuyRestriction(assortItemTable) {
const randomUtil = tsyringe_1.container.resolve("RandomUtil");
if (!realismDetected) // If realism is not detected, continue, else do nothing
{
for (const item in assortItemTable) {
if (assortItemTable[item].parentId !== "hideout" || assortItemTable[item].upd.BuyRestrictionMax <= 3) {
continue; // Skip setting count, it's a weapon attachment or armour plate
}
const itemID = assortItemTable[item]._id;
const oldRestriction = assortItemTable[item].upd.BuyRestrictionMax;
const newRestriction = randomUtil.randInt(4, oldRestriction + 40);
assortItemTable[item].upd.BuyRestrictionMax = newRestriction;
if (Scorpion.config.debugLogging) {
this.logger.log(`[${this.mod}] Item: [${itemID}] Buy Restriction Changed to: [${newRestriction}]`, "cyan");
}
}
}
}
randomizeStockAvailable(assortItemTable) {
const randomUtil = tsyringe_1.container.resolve("RandomUtil");
if (!realismDetected) // If realism is not detected, continue, else do nothing
{
for (const item in assortItemTable) {
if (assortItemTable[item].parentId !== "hideout") {
continue; // Skip setting count, it's a weapon attachment or armour plate
}
const outOfStockRoll = randomUtil.getChance100(Scorpion.config.outOfStockChance);
if (outOfStockRoll) {
const itemID = assortItemTable[item]._id;
assortItemTable[item].upd.StackObjectsCount = 0;
if (Scorpion.config.debugLogging) {
this.logger.log(`[${this.mod}] Item: [${itemID}] Marked out of stock`, "cyan");
}
}
else {
if (assortItemTable[item].upd.StackObjectsCount <= 10)
assortItemTable[item].upd.StackObjectsCount = 250;
const itemID = assortItemTable[item]._id;
const originalStock = assortItemTable[item].upd.StackObjectsCount;
const newStock = randomUtil.randInt(3, Math.round(originalStock * 0.75));
if (Scorpion.config.debugLogging) {
this.logger.log(`[${this.mod}] Item: [${itemID}] Original Count: ${originalStock} | Stock Count changed to: [${newStock}]`, "cyan");
}
assortItemTable[item].upd.StackObjectsCount = newStock;
}
}
}
}
setUnlimitedStock(assortItemTable) {
for (const item in assortItemTable) {
if (assortItemTable[item].parentId !== "hideout") {
continue; // Skip setting count, it's a weapon attachment or armour plate
}
assortItemTable[item].upd.StackObjectsCount = 9999999;
assortItemTable[item].upd.UnlimitedCount = true;
}
if (Scorpion.config.debugLogging) {
this.logger.log(`[${this.mod}] Item stock counts are now unlimited`, "cyan");
}
}
setUnlimitedBuyRestriction(assortItemTable) {
for (const item in assortItemTable) {
if (assortItemTable[item].parentId !== "hideout") {
continue; // Skip setting count, it's a weapon attachment or armour plate
}
delete assortItemTable[item].upd.BuyRestrictionMax;
delete assortItemTable[item].upd.BuyRestrictionCurrent;
}
if (Scorpion.config.debugLogging) {
this.logger.log(`[${this.mod}] Item buy restrictions are now unlimited`, "cyan");
}
}
disableLoyaltyRestrictions(assortLoyaltyTable) {
for (const item in assortLoyaltyTable) {
delete assortLoyaltyTable[item];
}
if (Scorpion.config.debugLogging) {
this.logger.log(`[${this.mod}] All Loyalty Level requirements are removed`, "cyan");
}
}
modDetection() {
const preSptModLoader = tsyringe_1.container.resolve("PreSptModLoader");
const vcqlCheck = preSptModLoader.getImportedModsNames().includes("Virtual's Custom Quest Loader");
const realismCheck = preSptModLoader.getImportedModsNames().includes("SPT-Realism");
const vcqlDllPath = node_path_1.default.resolve(__dirname, "../../../../BepInEx/plugins/VCQLQuestZones.dll");
const heliCrashSamSWAT = node_path_1.default.resolve(__dirname, "../../../../BepInEx/plugins/SamSWAT.HeliCrash/SamSWAT.HeliCrash.dll");
const heliCrashTyrian = node_path_1.default.resolve(__dirname, "../../../../BepInEx/plugins/SamSWAT.HeliCrash.TyrianReboot/SamSWAT.HeliCrash.TyrianReboot.dll");
const heliCrashArys = node_path_1.default.resolve(__dirname, "../../../../BepInEx/plugins/SamSWAT.HeliCrash.ArysReloaded/SamSWAT.HeliCrash.ArysReloaded.dll");
// VCQL Zones DLL is missing
if (!node_fs_1.default.existsSync(vcqlDllPath)) {
this.logger.error(`[${this.mod}] VCQL Zones DLL missing. Custom Trader quests may not work properly.`);
}
// Outdated HeliCrash is installed
if (node_fs_1.default.existsSync(heliCrashSamSWAT) || node_fs_1.default.existsSync(heliCrashTyrian)) {
this.logger.error(`[${this.mod}] Outdated HeliCrash Mod Detected. You will experience issues with Custom Trader quest zones.`);
}
// Arys HeliCrash is installed
if (node_fs_1.default.existsSync(heliCrashArys)) {
this.logger.warning(`[${this.mod}] HeliCrash Mod Detected. You may experience issues with Custom Trader quest zones.`);
}
// VCQL package.json is missing
if (!vcqlCheck) {
this.logger.error(`[${this.mod}] VCQL not detected. Install VCQL and re-install ${this.mod}.`);
}
// This is completely unneccessary and I'll fix it, eventually - probably
if (Scorpion.config.randomizeBuyRestriction || Scorpion.config.randomizeStockAvailable) {
this.setRealismDetection(realismCheck);
}
else {
this.setRealismDetection(realismCheck);
}
}
moddedWeaponCompatibility() {
const databaseService = tsyringe_1.container.resolve("DatabaseService");
const questTable = databaseService.getTables().templates.quests;
const quests = Object.values(questTable);
let questType;
let weaponType;
let wasAdded;
if (weaponCompatibility.AssaultRifles.length >= 1) {
weaponType = weaponCompatibility.AssaultRifles;
questType = quests.filter(x => x.QuestName.includes("Weapon Proficiency - ARs"));
wasAdded = true;
this.moddedWeaponPushToArray(questType, weaponType);
}
if (weaponCompatibility.SubmachineGuns.length >= 1) {
weaponType = weaponCompatibility.SubmachineGuns;
questType = quests.filter(x => x.QuestName.includes("Weapon Proficiency - SMGs"));
wasAdded = true;
this.moddedWeaponPushToArray(questType, weaponType);
}
if (weaponCompatibility.Snipers.length >= 1) {
weaponType = weaponCompatibility.Snipers;
questType = quests.filter(x => x.QuestName.includes("Weapon Proficiency - Snipers"));
wasAdded = true;
this.moddedWeaponPushToArray(questType, weaponType);
}
if (weaponCompatibility.Marksman.length >= 1) {
weaponType = weaponCompatibility.Marksman;
questType = quests.filter(x => x.QuestName.includes("Weapon Proficiency - Marksman"));
wasAdded = true;
this.moddedWeaponPushToArray(questType, weaponType);
}
if (weaponCompatibility.Shotguns.length >= 1) {
weaponType = weaponCompatibility.Shotguns;
questType = quests.filter(x => x.QuestName.includes("Weapon Proficiency - Shotguns"));
wasAdded = true;
this.moddedWeaponPushToArray(questType, weaponType);
}
if (weaponCompatibility.Pistols.length >= 1) {
weaponType = weaponCompatibility.Pistols;
questType = quests.filter(x => x.QuestName.includes("Weapon Proficiency - Pistols"));
wasAdded = true;
this.moddedWeaponPushToArray(questType, weaponType);
}
if (weaponCompatibility.LargeMachineGuns.length >= 1) {
weaponType = weaponCompatibility.LargeMachineGuns;
questType = quests.filter(x => x.QuestName.includes("Weapon Proficiency - LMGs"));
wasAdded = true;
this.moddedWeaponPushToArray(questType, weaponType);
}
if (weaponCompatibility.Carbines.length >= 1) {
weaponType = weaponCompatibility.Carbines;
questType = quests.filter(x => x.QuestName.includes("Weapon Proficiency - Carbines"));
wasAdded = true;
this.moddedWeaponPushToArray(questType, weaponType);
}
if (weaponCompatibility.Melee.length >= 1) {
weaponType = weaponCompatibility.Melee;
questType = quests.filter(x => x.QuestName.includes("Weapon Proficiency - Melee"));
wasAdded = true;
this.moddedWeaponPushToArray(questType, weaponType);
}
if (weaponCompatibility.Explosives.length >= 1) {
weaponType = weaponCompatibility.Explosives;
questType = quests.filter(x => x.QuestName.includes("Weapon Proficiency - Explosives"));
wasAdded = true;
this.moddedWeaponPushToArray(questType, weaponType);
}
if (wasAdded) {
this.logger.log(`[${this.mod}] Custom Weapons added to proficiency quests. Enjoy!`, "cyan");
}
}
moddedWeaponPushToArray(questTable, weaponType) {
for (const quest in questTable) {
for (const condition in questTable[quest].conditions.AvailableForFinish) {
for (const item in questTable[quest].conditions.AvailableForFinish[condition].counter.conditions) {
for (const id of weaponType) {
questTable[quest].conditions.AvailableForFinish[condition].counter.conditions[item].weapon.push(id);
}
}
}
if (Scorpion.config.debugLogging) {
this.logger.log(`[${this.mod}] ${questTable[quest].QuestName} --- Added ${weaponType}`, "cyan");
}
}
}
eventQuestsAlwaysActive(questTable, quests) {
let eventCount = 0;
for (const quest in quests) {
if (quests[quest]?.startMonth) {
const currentDate = new Date();
const questStartDate = new Date(currentDate.getFullYear(), quests[quest].startMonth - 1, quests[quest].startDay);
const questEndDate = new Date(currentDate.getFullYear(), quests[quest].endMonth - 1, quests[quest].endDay);
if (currentDate < questStartDate || currentDate > questEndDate) {
delete quests[quest].startMonth;
delete quests[quest].endMonth;
delete quests[quest].startDay;
delete quests[quest].endDay;
questTable[quest] = quests[quest];
eventCount++;
}
}
}
this.logger.log(`[${this.mod}] Reactivated ${eventCount} Event Quests from Scorpion - Enjoy!`, "cyan");
this.logger.log(`[${this.mod}] !!! Remember to fix your config.jsonc when you update this mod to keep event quest progress !!!`, "cyan");
}
pushProductionUnlocks() {
const databaseService = tsyringe_1.container.resolve("DatabaseService");
const recipesTable = databaseService.getTables().hideout.production.recipes;
for (const item of productionJson) {
recipesTable.push(item);
}
}
getRandomLoadMessage() {
const value = loadMessage[Math.floor(Math.random() * Object.keys(loadMessage).length)];
return value;
}
}
module.exports = { mod: new Scorpion() };
//# sourceMappingURL=mod.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,124 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.TraderHelper = void 0;
const questAssort = __importStar(require("../db/questassort.json"));
class TraderHelper {
/**
* Add profile picture to our trader
* @param baseJson json file for trader (db/base.json)
* @param preSptModLoader mod loader class - used to get the mods file path
* @param imageRouter image router class - used to register the trader image path so we see their image on trader page
* @param traderImageName Filename of the trader icon to use
*/
registerProfileImage(baseJson, modName, preSptModLoader, imageRouter, traderImageName) {
// Reference the mod "res" folder
const imageFilepath = `./${preSptModLoader.getModPath(modName)}res`;
// Register a route to point to the profile picture - remember to remove the .jpg from it
imageRouter.addRoute(baseJson.avatar.replace(".jpg", ""), `${imageFilepath}/${traderImageName}`);
}
/**
* 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 refreshTimeSecondsMin How many seconds between trader stock refresh min time
* @param refreshTimeSecondsMax How many seconds between trader stock refresh max time
*/
setTraderUpdateTime(traderConfig, baseJson, refreshTimeSecondsMin, refreshTimeSecondsMax) {
// Add refresh time in seconds to config
const traderRefreshRecord = {
traderId: baseJson._id,
seconds: {
min: refreshTimeSecondsMin,
max: refreshTimeSecondsMax
}
};
traderConfig.updateTime.push(traderRefreshRecord);
}
/**
* Add our new trader to the database
* @param traderDetailsToAdd trader details
* @param tables database
* @param jsonUtil json utility class
*/
// rome-ignore lint/suspicious/noExplicitAny: traderDetailsToAdd comes from base.json, so no type
addTraderToDb(traderDetailsToAdd, tables, jsonUtil, newAssort) {
// Add trader to trader table, key is the traders id
tables.traders[traderDetailsToAdd._id] = {
assort: jsonUtil.deserialize(jsonUtil.serialize(newAssort)), // assorts are the 'offers' trader sells, can be a single item (e.g. carton of milk) or multiple items as a collection (e.g. a gun)
base: jsonUtil.deserialize(jsonUtil.serialize(traderDetailsToAdd)), // Deserialise/serialise creates a copy of the json and allows us to cast it as an ITraderBase
questassort: jsonUtil.deserialize(jsonUtil.serialize(questAssort)) // questassort is empty as trader has no assorts unlocked by quests
};
}
/**
* Create basic data for trader + add empty assorts table for trader
* @param tables SPT db
* @param jsonUtil SPT JSON utility class
* @returns ITraderAssort
*/
createAssortTable() {
// Create a blank assort object, ready to have items added
const assortTable = {
nextResupply: 0,
items: [],
barter_scheme: {},
loyal_level_items: {}
};
return assortTable;
}
/**
* Add traders name/location/description to the locale table
* @param baseJson json file for trader (db/base.json)
* @param tables database tables
* @param fullName Complete name of trader
* @param firstName First name of trader
* @param nickName Nickname of trader
* @param location Location of trader (e.g. "Here in the cat shop")
* @param description Description of trader
*/
addTraderToLocales(baseJson, tables, fullName, firstName, nickName, location, description) {
// For each language, add locale for the new trader
const locales = Object.values(tables.locales.global);
for (const locale of locales) {
locale[`${baseJson._id} FullName`] = fullName;
locale[`${baseJson._id} FirstName`] = firstName;
locale[`${baseJson._id} Nickname`] = nickName;
locale[`${baseJson._id} Location`] = location;
locale[`${baseJson._id} Description`] = description;
}
}
}
exports.TraderHelper = TraderHelper;
//# sourceMappingURL=traderHelpers.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "traderHelpers.js",
"sourceRoot": "",
"sources": [
"traderHelpers.ts"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,oEAA8D;AAE9D,MAAa,YAAY;IAErB;;;;;;OAMG;IACI,oBAAoB,CAAC,QAAa,EAAE,OAAe,EAAE,eAAgC,EAAE,WAAwB,EAAE,eAAuB;QAE3I,iCAAiC;QACjC,MAAM,aAAa,GAAG,KAAK,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC;QAEpE,yFAAyF;QACzF,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,aAAa,IAAI,eAAe,EAAE,CAAC,CAAC;IACrG,CAAC;IAED;;;;;;OAMG;IACI,mBAAmB,CAAC,YAA2B,EAAE,QAAa,EAAE,qBAA6B,EAAE,qBAA6B;QAE/H,wCAAwC;QACxC,MAAM,mBAAmB,GAAe;YACpC,QAAQ,EAAE,QAAQ,CAAC,GAAG;YACtB,OAAO,EAAE;gBACL,GAAG,EAAE,qBAAqB;gBAC1B,GAAG,EAAE,qBAAqB;aAC7B;SAAE,CAAC;QAER,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACH,iGAAiG;IAC1F,aAAa,CAAC,kBAAuB,EAAE,MAAuB,EAAE,QAAkB,EAAE,SAAc;QAErG,oDAAoD;QACpD,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG;YACrC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAkB,EAAE,mIAAmI;YACjN,IAAI,EAAE,QAA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@
{
"version": 3,
"file": "IQuestInfoModel.js",
"sourceRoot": "",
"sources": [
"IQuestInfoModel.ts"
],
"names": [],
"mappings": ""
}

View file

@ -0,0 +1,91 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstanceManager = void 0;
const path = __importStar(require("node:path"));
class InstanceManager {
//#region Accessible in or after preAkiLoad
modName;
debug;
// Useful Paths
modPath = path.join(process.cwd(), "user", "mods", "TarkovTools");
dbPath = path.join(process.cwd(), "user", "mods", "TarkovTools", "database");
profilePath = path.join(process.cwd(), "user", "profiles");
cachePath = path.join(path.dirname(__filename), "..", "config", "cache.json");
// Instances
container;
preSptModLoader;
configServer;
saveServer;
itemHelper;
logger;
staticRouter;
vfs;
//#endregion
//#region Accessible in or after postDBLoad
database;
customItem;
imageRouter;
jsonUtil;
profileHelper;
ragfairPriceService;
importerUtil;
hashUtil;
//#endregion
// Call at the start of the mods postDBLoad method
preSptLoad(container, mod) {
this.modName = mod;
this.container = container;
this.preSptModLoader = container.resolve("PreSptModLoader");
this.imageRouter = container.resolve("ImageRouter");
this.configServer = container.resolve("ConfigServer");
this.saveServer = container.resolve("SaveServer");
this.itemHelper = container.resolve("ItemHelper");
this.logger = container.resolve("WinstonLogger");
this.staticRouter = container.resolve("StaticRouterModService");
this.vfs = container.resolve("FileSystem");
}
postDBLoad(container) {
this.database = container.resolve("DatabaseServer").getTables();
this.customItem = container.resolve("CustomItemService");
this.jsonUtil = container.resolve("JsonUtil");
this.profileHelper = container.resolve("ProfileHelper");
this.ragfairPriceService = container.resolve("RagfairPriceService");
this.importerUtil = container.resolve("ImporterUtil");
this.hashUtil = container.resolve("HashUtil");
}
}
exports.InstanceManager = InstanceManager;
//# sourceMappingURL=InstanceManager.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "InstanceManager.js",
"sourceRoot": "",
"sources": [
"InstanceManager.ts"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gDAAkC;AAoBlC,MAAa,eAAe;IAExB,2CAA2C;IACpC,OAAO,CAAS;IAChB,KAAK,CAAU;IACtB,eAAe;IACR,OAAO,GAAW,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1E,MAAM,GAAW,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;IACrF,WAAW,GAAW,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IACnE,SAAS,GAAW,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IAE7F,Y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,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAoB,mBAAmB,CAAC,CAAC;QAC5E,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAW,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC,OAAO,CAAgB,eAAe,CAAC,CAAC;QACvE,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC,OAAO,CAAsB,qBAAqB,CAAC,CAAC;QACzF,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,OAAO,CAAe,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAW,UAAU,CAAC,CAAC;IAC5D,CAAC;CACJ;AA3DD,0CA2DC"
}

View file

@ -0,0 +1,239 @@
"use strict";
/* eslint-disable @typescript-eslint/naming-convention */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const path = __importStar(require("node:path"));
const config = __importStar(require("../config/config.json"));
const gsEN = __importStar(require("../db/GunsmithLocaleEN.json"));
const InstanceManager_1 = require("./InstanceManager");
const LogTextColor_1 = require("C:/snapshot/project/obj/models/spt/logging/LogTextColor");
class DExpandedTaskText {
Instance = new InstanceManager_1.InstanceManager();
modName = "ExpandedTaskText";
dbPath = path.join(path.dirname(__filename), "..", "db");
tasks;
locale;
QuestInfo;
timeGateUnlocktimes = [];
preSptLoad(container) {
this.Instance.preSptLoad(container, this.modName);
}
async postDBLoad(container) {
const startTime = performance.now();
this.Instance.postDBLoad(container);
this.Instance.logger.log("Expanded Task Text is loading please wait...", LogTextColor_1.LogTextColor.GREEN);
this.QuestInfo = await this.loadJsonFile(path.join(this.dbPath, "QuestInfo.json"));
this.getAllTasks(this.Instance.database);
this.updateAllBsgTasksText();
const endTime = performance.now();
const startupTime = (endTime - startTime) / 1000;
this.Instance.logger.log(`Expanded Task Text startup took ${startupTime} seconds...`, LogTextColor_1.LogTextColor.GREEN);
}
/**
* Loads and parses a config file from disk
* @param fileName File name inside of config folder to load
*/
async loadJsonFile(filePath, readAsText = false) {
const file = path.join(filePath);
const string = await this.Instance.vfs.read(file);
return readAsText
? string
: JSON.parse(string);
}
getAllTasks(database) {
this.tasks = database.templates.quests;
this.locale = database.locales.global;
}
getAllNextQuestsInChain(currentQuestId) {
const nextQuests = [];
// biome-ignore lint/complexity/noForEach: <explanation>
Object.keys(this.tasks).forEach(key => {
if (this.tasks[key].conditions.AvailableForStart === undefined) {
return undefined;
}
const conditionsAOS = this.tasks[key].conditions.AvailableForStart;
for (const condition in conditionsAOS) {
if (conditionsAOS[condition]?.conditionType === "Quest" && conditionsAOS[condition]?.target === currentQuestId) {
const nextQuestName = this.locale.en[`${key} name`];
nextQuests.push(nextQuestName);
// Recursively find the next quests for the current quest
const recursiveResults = this.getAllNextQuestsInChain(nextQuestName);
nextQuests.push(...recursiveResults);
}
}
});
const resultString = nextQuests.join(", ");
return resultString;
}
getAllTraderLoyalLevelItems() {
const traders = this.Instance.database.traders;
const loyalLevelItems = {};
for (const trader in traders) {
for (const assortItem in traders[trader]?.assort?.loyal_level_items) {
loyalLevelItems[assortItem] = traders[trader].assort.loyal_level_items[assortItem];
}
}
return loyalLevelItems;
}
getAndBuildPartsList(taskId) {
const partIds = gsEN[taskId]?.RequiredParts;
const localizedParts = [];
const traders = this.Instance.database.traders;
const loyalLevelItems = this.getAllTraderLoyalLevelItems();
if (partIds.length === 0) {
return "";
}
for (const part of partIds) {
let partString = this.locale.en[`${part} Name`];
for (const trader in traders) {
for (let i = 0; i < traders[trader]?.assort?.items.length; i++) {
if (part === traders[trader].assort.items[i]._tpl && loyalLevelItems[traders[trader].assort.items[i]._id] !== undefined) {
partString += `\n Sold by (${this.locale.en[`${trader} Nickname`]} LL ${loyalLevelItems[traders[trader].assort.items[i]._id]})`;
}
}
}
localizedParts.push(partString);
}
return localizedParts.join("\n\n");
}
buildKeyText(objectives, localeId) {
let keyDesc = "";
for (const obj of objectives) {
if (obj.requiredKeys === undefined)
continue;
const objDesc = this.locale[localeId][`${obj.id}`];
let keys = "";
for (const keysInObj in obj.requiredKeys) {
for (const key in obj.requiredKeys[keysInObj]) {
const localeKey = `${obj.requiredKeys[keysInObj][key]["id"]} Name`;
const localEntry = this.locale[localeId][localeKey];
if (localeKey === undefined || localEntry === undefined)
continue;
keys += ` ${localEntry}\n`;
}
}
if (keys.length === 0)
continue;
keyDesc += `${objDesc}\n Requires key(s):\n${keys}`;
}
return keyDesc;
}
updateAllBsgTasksText() {
const questInfo = this.QuestInfo;
const modifiedQuestIds = [];
for (const info of questInfo) {
for (const localeID in this.locale) {
const originalDesc = this.locale[localeID][`${info.id} description`];
let keyDesc = this.buildKeyText(info.objectives, localeID);
let collector;
let lightKeeper;
let durability;
let requiredParts;
let timeUntilNext;
let leadsTo;
modifiedQuestIds.push(info.id);
if (config.ShowCollectorRequirements && info.kappaRequired) {
collector = "This quest is required for Collector \n \n";
}
if (config.ShowLightKeeperRequirements && info.lightkeeperRequired) {
lightKeeper = "This quest is required for Lightkeeper \n \n";
}
const nextQuest = this.getAllNextQuestsInChain(info.id);
if (nextQuest.length > 0 && config.ShowNextQuestInChain) {
leadsTo = `Leads to: ${nextQuest} \n \n`;
}
else if (config.ShowNextQuestInChain) {
leadsTo = "Leads to: Nothing \n \n";
}
else {
leadsTo = "";
}
if (gsEN[info.id]?.RequiredParts !== undefined && config.ShowGunsmithRequiredParts) {
durability = "Required Durability: 60 \n";
requiredParts = `${this.getAndBuildPartsList(info.id)} \n \n`;
}
if (config.ShowTimeUntilNextQuest) {
for (const req of this.timeGateUnlocktimes) {
if (req.currentQuest === info.id) {
timeUntilNext = `Hours until ${this.locale.en[`${req.nextQuest} name`]} unlocks after completion: ${req.time} \n \n`;
}
}
}
if (keyDesc === undefined) {
keyDesc = "";
}
if (collector === undefined) {
collector = "";
}
if (lightKeeper === undefined) {
lightKeeper = "";
}
if (requiredParts === undefined) {
requiredParts = "";
}
if (durability === undefined) {
durability = "";
}
if (timeUntilNext === undefined) {
timeUntilNext = "";
}
// biome-ignore lint/style/useTemplate: <>
this.locale[localeID][`${info.id} description`] = collector + lightKeeper + leadsTo + timeUntilNext + (keyDesc.length > 0 ? `${keyDesc} \n` : "") + durability + requiredParts + originalDesc;
}
}
// Handle leads to for custom traders
for (const quest in this.Instance.database.templates.quests) {
if (modifiedQuestIds.includes(quest))
continue;
for (const localeId in this.locale) {
const originalDesc = this.locale[localeId][`${quest} description`];
let leadsTo;
const nextQuest = this.getAllNextQuestsInChain(quest);
if (nextQuest.length > 0 && config.ShowNextQuestInChain) {
leadsTo = `Leads to: ${nextQuest} \n \n`;
}
else if (config.ShowNextQuestInChain) {
leadsTo = "Leads to: Nothing \n \n";
}
else {
leadsTo = "";
}
this.locale[localeId][`${quest} description`] = leadsTo + originalDesc;
}
}
}
}
module.exports = { mod: new DExpandedTaskText() };
//# sourceMappingURL=mod.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,114 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomInventoryItemEventRouter = void 0;
const tsyringe_1 = require("C:/snapshot/project/node_modules/tsyringe");
const Router_1 = require("C:/snapshot/project/obj/di/Router");
const EventOutputHolder_1 = require("C:/snapshot/project/obj/routers/EventOutputHolder");
const InventoryHelper_1 = require("C:/snapshot/project/obj/helpers/InventoryHelper");
const ILogger_1 = require("C:/snapshot/project/obj/models/spt/utils/ILogger");
let CustomInventoryItemEventRouter = class CustomInventoryItemEventRouter extends Router_1.ItemEventRouterDefinition {
logger;
eventOutputHolder;
inventoryHelper;
constructor(logger, eventOutputHolder, inventoryHelper) {
super();
this.logger = logger;
this.eventOutputHolder = eventOutputHolder;
this.inventoryHelper = inventoryHelper;
}
getHandledRoutes() {
return [
new Router_1.HandledRoute("Combine", false)
];
}
async handleItemEvent(url, pmcData, body, sessionID, output) {
switch (url) {
case "Combine":
output = this.eventOutputHolder.getOutput(sessionID);
this.HandleCombine(pmcData, body.sourceItem, body.targetItem, body.sourceAmount, body.targetAmount, body.type, sessionID, output);
return output;
}
return output;
}
HandleCombine(pmcData, sourceItem, targetItem, sourceAmount, targetAmount, type, sessionID, output) {
const sItem = pmcData.Inventory.items.find((item) => item._id === sourceItem);
const tItem = pmcData.Inventory.items.find((item) => item._id === targetItem);
if (!sItem || !tItem) {
this.logger.error(`Could not find source or target item! Source: ${sourceItem}, Target: ${targetItem}`);
return;
}
switch (type) {
case "medical":
if (sItem.upd?.MedKit && tItem.upd?.MedKit) {
sItem.upd.MedKit.HpResource = sourceAmount;
tItem.upd.MedKit.HpResource = targetAmount;
}
else if ((sItem._tpl === tItem._tpl)) {
if (!sItem.upd) {
sItem.upd = {};
}
if (!sItem.upd.MedKit) {
sItem.upd.MedKit = { HpResource: sourceAmount };
}
else {
sItem.upd.MedKit.HpResource = sourceAmount;
}
if (!tItem.upd) {
tItem.upd = {};
}
if (!tItem.upd.MedKit) {
tItem.upd.MedKit = { HpResource: targetAmount };
}
else {
tItem.upd.MedKit.HpResource = targetAmount;
}
this.logger.warning("MedKit was missing on source or target item -- attempted resolve with item _tpl");
}
else {
this.logger.error("MedKit was missing on source or target item!");
this.logger.error("tItem: " + JSON.stringify(tItem));
this.logger.error("sItem: " + JSON.stringify(sItem));
return;
}
break;
case "food":
if (sItem.upd?.FoodDrink && tItem?.upd.FoodDrink) {
sItem.upd.FoodDrink.HpPercent = sourceAmount;
tItem.upd.FoodDrink.HpPercent = targetAmount;
}
else {
this.logger.error("FoodDrink was missing on source or target item!");
return;
}
break;
default:
this.logger.warning(`Unknown type: ${type}`);
break;
}
if (sourceAmount == 0) {
this.inventoryHelper.removeItem(pmcData, sourceItem, sessionID, output);
}
}
};
exports.CustomInventoryItemEventRouter = CustomInventoryItemEventRouter;
exports.CustomInventoryItemEventRouter = CustomInventoryItemEventRouter = __decorate([
(0, tsyringe_1.injectable)(),
__param(0, (0, tsyringe_1.inject)("WinstonLogger")),
__param(1, (0, tsyringe_1.inject)("EventOutputHolder")),
__param(2, (0, tsyringe_1.inject)("InventoryHelper")),
__metadata("design:paramtypes", [typeof (_a = typeof ILogger_1.ILogger !== "undefined" && ILogger_1.ILogger) === "function" ? _a : Object, typeof (_b = typeof EventOutputHolder_1.EventOutputHolder !== "undefined" && EventOutputHolder_1.EventOutputHolder) === "function" ? _b : Object, typeof (_c = typeof InventoryHelper_1.InventoryHelper !== "undefined" && InventoryHelper_1.InventoryHelper) === "function" ? _c : Object])
], CustomInventoryItemEventRouter);
//# sourceMappingURL=CustomItemEventRouter.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "CustomItemEventRouter.js",
"sourceRoot": "",
"sources": [
"CustomItemEventRouter.ts"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;AAAA,wEAA+E;AAE/E,8DAA2F;AAG3F,yFAAsF;AACtF,qFAAkF;AAClF,8EAA2E;AAGpE,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,kCAAyB;IAElC;IACI;IACF;IAHzC,YACuC,MAAe,EACX,iBAAoC,EACtC,eAAgC;QAErE,KAAK,EAAE,CAAC;QAJ2B,WAAM,GAAN,MAAM,CAAS;QACX,sBAAiB,GAAjB,iBAAiB,CAAmB;QACtC,oBAAe,GAAf,eAAe,CAAiB;IAGzE,CAAC;IAEe,gBAAgB;QAC5B,OAAO;YACH,IAAI,qBAAY,CAAC,SAAS,EAAE,KAAK,CAAC;SACrC,CAAC;IACN,CAAC;IAEe,KAAK,CAAC,eAAe,CACjC,GAAW,EACX,OAAiB,EACjB,IAAS,EACT,SAAiB,EACjB,MAAgC;QAEhC,QAAQ,GAAG,EAAE,CAAC;YACV,KAAK,SAAS;gBACV,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;gBACrD,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;gBAClI,OAAO,MAAM,CAAC;QACtB,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,aAAa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AE,CAAC,CAAC;gBAC7C,MAAM;QACd,CAAC;QAED,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAC5E,CAAC;IACL,CAAC;CACJ,CAAA;AA5FY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,eAAe,CAAC,CAAA;IACvB,WAAA,IAAA,iBAAM,EAAC,mBAAmB,CAAC,CAAA;IAC3B,WAAA,IAAA,iBAAM,EAAC,iBAAiB,CAAC,CAAA;yDAFiB,iBAAO,oBAAP,iBAAO,oDACQ,qCAAiB,oBAAjB,qCAAiB,oDACrB,iCAAe,oBAAf,iCAAe;GAJhE,8BAA8B,CA4F1C"
}

View file

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mod = void 0;
const CustomItemEventRouter_1 = require("./CustomItemEventRouter");
class Mod {
preSptLoad(container) {
container.registerType("IERouters", "CustomInventoryItemEventRouter");
container.register("CustomInventoryItemEventRouter", {
useClass: CustomItemEventRouter_1.CustomInventoryItemEventRouter
});
}
}
exports.mod = new Mod();
//# sourceMappingURL=mod.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "mod.js",
"sourceRoot": "",
"sources": [
"mod.ts"
],
"names": [],
"mappings": ";;;AAEA,mEAAyE;AAGzE,MAAM,GAAG;IACL,UAAU,CAAC,SAA8B;QACrC,SAAS,CAAC,YAAY,CAAC,WAAW,EAAE,gCAAgC,CAAC,CAAC;QAEtE,SAAS,CAAC,QAAQ,CAAiC,gCAAgC,EAAE;YACjF,QAAQ,EAAE,sDAA8B;SAC3C,CAAC,CAAA;IACN,CAAC;CAEJ;AAEY,QAAA,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC"
}

View file

@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class ReflexSightRework {
postSptLoad(container) {
// get the logger from the server container
const logger = container.resolve("WinstonLogger");
logger.info("Loading: ReflexSightRework bundles...");
}
}
module.exports = { mod: new ReflexSightRework() };
//# sourceMappingURL=mod.js.map

View file

@ -0,0 +1,10 @@
{
"version": 3,
"file": "mod.js",
"sourceRoot": "",
"sources": [
"mod.ts"
],
"names": [],
"mappings": ";;AAIA,MAAM,iBAAiB;IAEZ,WAAW,CAAC,SAA8B;QAE7C,2CAA2C;QAC3C,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAU,eAAe,CAAC,CAAC;QAE3D,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IACzD,CAAC;CACJ;AAED,MAAM,CAAC,OAAO,GAAG,EAAC,GAAG,EAAE,IAAI,iBAAiB,EAAE,EAAC,CAAA"
}