js files
This commit is contained in:
parent
7aa7ac1092
commit
081b038df5
99 changed files with 18010 additions and 1 deletions
3
user/mods/expandedtasktext/src/IQuestInfoModel.js
Normal file
3
user/mods/expandedtasktext/src/IQuestInfoModel.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=IQuestInfoModel.js.map
|
||||
10
user/mods/expandedtasktext/src/IQuestInfoModel.js.map
Normal file
10
user/mods/expandedtasktext/src/IQuestInfoModel.js.map
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "IQuestInfoModel.js",
|
||||
"sourceRoot": "",
|
||||
"sources": [
|
||||
"IQuestInfoModel.ts"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": ""
|
||||
}
|
||||
91
user/mods/expandedtasktext/src/InstanceManager.js
Normal file
91
user/mods/expandedtasktext/src/InstanceManager.js
Normal 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
|
||||
10
user/mods/expandedtasktext/src/InstanceManager.js.map
Normal file
10
user/mods/expandedtasktext/src/InstanceManager.js.map
Normal 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,YAAY;IACL,SAAS,CAAsB;IAC/B,eAAe,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,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"
|
||||
}
|
||||
239
user/mods/expandedtasktext/src/mod.js
Normal file
239
user/mods/expandedtasktext/src/mod.js
Normal 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
|
||||
10
user/mods/expandedtasktext/src/mod.js.map
Normal file
10
user/mods/expandedtasktext/src/mod.js.map
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue