Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- /*
- * author: Lukewarmpudding, ShadowXtrex
- * Based on code of: Nootropix/Echo55
- * akiVersion: 3.3.0,
- * modVersion: 2.0.3,
- * editor: ShadowXtrex,
- * Date: 07/12/2022
- */
- 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 (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
- };
- Object.defineProperty(exports, "__esModule", { value: true });
- const tsyringe_1 = require("C:/snapshot/project/node_modules/tsyringe");
- const newItems = __importStar(require("../db/itemsToAdd.json"));
- class BlackGear {
- constructor() {
- this.modinfo = require("../package.json");
- this.modcfg = require("../config.json");
- }
- postDBLoad(container) {
- this.logger = container.resolve("WinstonLogger");
- this.logger.log(`${this.modinfo.author}-${this.modinfo.name} v${this.modinfo.version} ${this.modcfg.Enabled ? "" : " [Disabled]"} ${this.modcfg.Debug ? "| Debug mode: Enabled" : ""}`, "yellow");
- if (!this.modcfg.Enabled) {
- return;
- }
- // Get items from preset into Game Database and put in memory
- const dbServer = container.resolve("DatabaseServer");
- const db = dbServer.getTables();
- const items = db.templates.items;
- const handbook = db.templates.handbook.Items;
- const traders = db.traders;
- const global = db.locales.global;
- for (const bgear in newItems) {
- if (newItems[bgear].id === undefined) {
- break;
- }
- this.createItem(newItems[bgear].id, newItems[bgear].cloneID, newItems[bgear].bundle, newItems[bgear].fullName, newItems[bgear].shortName, newItems[bgear].description, items, global);
- this.createItemHandbookEntry(newItems[bgear].id, newItems[bgear].handbookID, newItems[bgear].handbookPrice, handbook);
- this.createItemOffer(newItems[bgear].id, newItems[bgear].traderID, newItems[bgear].traderPrice, newItems[bgear].currencyID, newItems[bgear].traderLL, traders);
- }
- // Incompatible items FIX
- const defaultInventoryID = db.templates.items["55d7217a4bdc2d86028b456d"];
- // Make compatible some accesory items with core fast helmets
- const fasthelmetblack = db.templates.items["5a154d5cfcdbcb001a3b00da"];
- const fasttan = db.templates.items["5ac8d6885acfc400180ae7b0"];
- const galvion = db.templates.items["5f60b34a41e30a4ab12a6947"];
- const wendyblack = db.templates.items["5e00c1ad86f774747333222c"];
- const wendytan = db.templates.items["5e01ef6886f77445f643baa4"];
- const hjelm = db.templates.items["61bca7cda0eae612383adf57"];
- const ratnik = db.templates.items["5a7c4850e899ef00150be885"];
- const ratnikcover = db.templates.items["5aa7cfc0e5b5b00015693143"];
- const mich2001 = db.templates.items["5d5e7d28a4b936645d161203"];
- const mich2002 = db.templates.items["5d5e9c74a4b9364855191c40"];
- const gallet = db.templates.items["5e4bfc1586f774264f7582d3"];
- const bastion = db.templates.items["5ea17ca01412a1425304d1c0"];
- const airframe = db.templates.items["5c17a7ed2e2216152142459c"];
- const replica = db.templates.items["5ea05cf85ad9772e6624305d"];
- const lshz = db.templates.items["5b432d215acfc4771e1c6624"];
- const fastears = db.templates.items["5a16badafcdbcb001865f72d"];
- const maska = db.templates.items["5c091a4e0db834001d5addc8"];
- const altyn = db.templates.items["5aa7e276e5b5b000171d0647"];
- const bnti = db.templates.items["5d6d3716a4b9361bc8618872"];
- const mando = db.templates.items["5ea058e01dbce517f324b3e2"];
- const maskaK = db.templates.items["5c0e874186f7745dc7616606"];
- const bastionplate = db.templates.items["5ea18c84ecf1982c7712d9a2"];
- mando._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
- lshz._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- bnti._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- fasttan._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- galvion._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- wendyblack._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- wendytan._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- hjelm._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- ratnik._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
- ratnikcover._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
- mich2001._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
- mich2002._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
- gallet._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- bastion._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
- airframe._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- replica._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- lshz._props.Slots[1]._props.filters[0].Filter.push("TROOPERBlack");
- fasttan._props.Slots[1]._props.filters[0].Filter.push("TROOPERBlack");
- replica._props.Slots[1]._props.filters[0].Filter.push("TROOPERBlack");
- fasthelmetblack._props.Slots[4]._props.filters[0].Filter.push("SLAAPBlack");
- fasttan._props.Slots[4]._props.filters[0].Filter.push("SLAAPBlack");
- mich2001._props.Slots[2]._props.filters[0].Filter.push("SLAAPBlack");
- mich2002._props.Slots[2]._props.filters[0].Filter.push("SLAAPBlack");
- replica._props.Slots[4]._props.filters[0].Filter.push("SLAAPBlack");
- fasthelmetblack._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
- fasthelmetblack._props.Slots[1]._props.filters[0].Filter.push("TROOPERBlack");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("6B47COVEREDBLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("AIRFRAMEBLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("MASKABLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("ALTYNBLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("BOSSBLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("FLEECEBLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("CAPBLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("BANDANABLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("UNTARBLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("PANAMABLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("DOORKICKERBLACK");
- defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("UXPROBLACK");
- defaultInventoryID._props.Slots[4]._props.filters[0].Filter.push("SHEMAGHBLACK1");
- defaultInventoryID._props.Slots[4]._props.filters[0].Filter.push("SHEMAGHBLACK2");
- defaultInventoryID._props.Slots[4]._props.filters[0].Filter.push("WELDINGMASKBLACK");
- fastears._props.Slots[0]._props.filters[0].Filter.push("MANDIBLEBlack");
- maska._props.Slots[0]._props.filters[0].Filter.push("MASKAFSBLACK");
- maskaK._props.Slots[0]._props.filters[0].Filter.push("MASKAFSBLACK");
- altyn._props.Slots[0]._props.filters[0].Filter.push("ALTYNSHIELDBLACK");
- airframe._props.Slots[3]._props.filters[0].Filter.push("AFCHOPSBLACK");
- airframe._props.Slots[3]._props.filters[0].Filter.push("AFEARSBLACK");
- bastionplate._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
- //this.logger.warning(`==> Helmet Warning: "Internal" Ricochet can kill you.`);
- }
- createItem(i_id, i_clone, i_path, i_lname, i_sname, i_desc, i_items, i_global) {
- const jsonUtil = tsyringe_1.container.resolve("JsonUtil");
- const item = jsonUtil.clone(i_items[i_clone]);
- // Make changes to original items
- item._id = i_id;
- item._props.Prefab.path = i_path;
- if (newItems[i_id]._proto) {
- item._proto = newItems[i_id]._proto;
- }
- if (newItems[i_id].itemParent) {
- item._parent = newItems[i_id].itemParent;
- }
- for (const property in newItems[i_id].propOverrides) {
- item._props[property] = newItems[i_id].propOverrides[property];
- }
- for (const localeID in i_global) {
- i_global[localeID].templates[i_id] =
- {
- "Name": i_lname,
- "ShortName": i_sname,
- "Description": i_desc
- };
- }
- // Get back items to Database
- i_items[i_id] = item;
- // DEBUG
- /*this.logger.log(
- `${this.modcfg.Debug ? "==> ItemAdded: " + i_id + " created.":""}`,
- "yellow"
- );*/
- }
- createItemHandbookEntry(i_id, i_category, i_fprice, i_handbook) {
- i_handbook.push({
- "Id": i_id,
- "ParentId": i_category,
- "Price": i_fprice
- });
- // DEBUG
- /*this.logger.log(
- `${this.modcfg.Debug ? "==> Handbook entry for item: " + i_id + " created." : ""}`,
- "green"
- );*/
- }
- // Add item to trader
- createItemOffer(i_id, i_trader, i_price, i_currencyTpl, i_loyaltyLevel, i_traders) {
- i_traders[i_trader].assort.items.push({
- "_id": i_id,
- "_tpl": i_id,
- "parentId": "hideout",
- "slotId": "hideout",
- "upd": {
- "UnlimitedCount": true,
- "StackObjectsCount": 10
- }
- });
- // Add cost to item
- i_traders[i_trader].assort.barter_scheme[i_id] = [
- [
- {
- "count": i_price,
- "_tpl": i_currencyTpl
- }
- ]
- ];
- // Add Trader Loyalty requirement
- i_traders[i_trader].assort.loyal_level_items[i_id] = i_loyaltyLevel;
- // DEBUG
- /*this.logger.log(
- `${this.modcfg.Debug ? "==> Trader assorts for item: " + i_id + " created.\n" : ""}`,
- "red"
- );*/
- }
- }
- module.exports = { mod: new BlackGear };
Add Comment
Please, Sign In to add comment