Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { container, DependencyContainer } from "tsyringe";
- import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod";
- import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
- import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
- import { JsonUtil } from "@spt-aki/utils/JsonUtil";
- class BlackThor implements IPostDBLoadMod {
- public postDBLoad(container: DependencyContainer): void {
- const modName = "LukewarmPudding-BlackTHOR";
- const modVersion = "v1.0.0"
- const logger = container.resolve<ILogger>("WinstonLogger");
- logger.log("Loading: " + modName + " - " + modVersion, "red");
- //Get THOR from gamedb
- const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
- const itemID = "THORblack";
- const itemClone = "60a283193cb70855c43a381d";
- //get in mem /assets/database
- const database = databaseServer.getTables();
- const items = database.templates.items;
- const handbook = database.templates.handbook.Items;
- const global = database.locales.global;
- const traders = database.traders;
- //handbook
- const itemCategory = "5448e54d4bdc2dcc718b4568";
- const itemFleaPrice = 10000;
- //item
- const itemPrefabPath = "thor_carrier_full.bundle"
- const itemLongName = "NFM THOR Integrated Carrier body armor - Black"
- const itemShortName = "THOR ICB"
- const itemDescription = "The THOR full protection assault body armor equipped with soft and hard armor elements to protect against shrapnel and bullets of pistol and rifle calibers. Now in Black. Manufactured by NFM."
- //offer
- const itemTrader = "5ac3b934156ae10c4430e83c"; //Ragman
- const itemTraderPrice = 120;
- const itemTraderCurrency = "5449016a4bdc2d6f028b456f"; //Roubles
- const itemTraderLV = 1;
- //process info
- this.createItemHandbookEntry(itemID, itemCategory, itemFleaPrice, handbook);
- this.createItem(itemID, itemClone, itemPrefabPath, itemLongName, itemShortName, itemDescription, items, global);
- this.createItemOffer(itemID, itemTrader, itemTraderPrice, itemTraderCurrency, itemTraderLV, traders);
- }
- createItemHandbookEntry(i_id, i_category, i_fprice, i_handbook) {
- //add item to handbook
- i_handbook.push(
- {
- "Id": i_id,
- "ParentId": i_category,
- "Price": i_fprice
- }
- );
- }
- createItem(i_id, i_clone, i_path, i_lname, i_sname, i_desc, i_items, i_global) {
- const JsonUtil = container.resolve<JsonUtil>("JsonUtil");
- let item = JsonUtil.clone(i_items[i_clone]);
- //new item props (not include not changed props)
- item._id = i_id;
- item._props.Durability = 80000;
- item._props.MaxDurability = 80000;
- item._props.armorClass = 10;
- item._props.BackgroundColor = "red";
- item._props.RepairCost = 2;
- item._props.RepairSpeed = 0;
- item._props.Indestructibility = 0.09;
- item._props.Prefab.path = "thor_carrier_full.bundle";
- //add item back to database
- i_items[i_id] = item;
- //add custom item names to all languages/locales
- for (const localeID in i_global)
- {
- i_global[localeID].templates[i_id] =
- {
- "Name": i_lname,
- "ShortName": i_sname,
- "Description": i_desc
- };
- }
- }
- createItemOffer(i_id, i_trader, i_price, i_currency, i_loyalty, i_traders) {
- i_traders[i_trader].assort.items.push(
- {
- "_id": i_id,
- "_tpl": i_id,
- "parentId": "hideout",
- "slotId": "hideout",
- "upd":
- {
- "UnlimitedCount": true,
- "StackObjectsCount": 50
- }
- }
- );
- //add trader cost to item
- i_traders[i_trader].assort.barter_scheme[i_id] = [
- [
- {
- "count": i_price,
- "_tpl": i_currency
- }
- ]
- ];
- //add trader loyalty level to item
- i_traders[i_trader].assort.loyal_level_items[i_id] = i_loyalty;
- }
- }
- module.exports = { mod: new BlackThor }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement