Advertisement
EmperorRubidium

blackgear

Aug 1st, 2022 (edited)
1,264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { container, DependencyContainer } from "tsyringe";
  2. import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod";
  3. import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
  4. import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
  5. import { JsonUtil } from "@spt-aki/utils/JsonUtil";
  6.  
  7. class BlackThor implements IPostDBLoadMod {
  8.     public postDBLoad(container: DependencyContainer): void {    
  9.         const modName = "LukewarmPudding-BlackTHOR";
  10.         const modVersion = "v1.0.0"
  11.         const logger = container.resolve<ILogger>("WinstonLogger");
  12.         const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
  13.        
  14.         //get in mem /assets/database
  15.         const database = databaseServer.getTables();
  16.         const items = database.templates.items;
  17.         const handbook = database.templates.handbook.Items;
  18.         const global = database.locales.global;
  19.         const traders = database.traders;
  20.        
  21.  
  22.    
  23.         logger.log("Loading: " + modName + " - " + modVersion, "red");
  24.        
  25.         // This is a key: value dictionary. if you log/print ItemInfo[THORBlack][1] it will print "60a283193cb70855c43a381d" as that is what is in slot 1 as you can see here. Remember, the indexes start counting from 0, so ItemInfo[THORBlack][0] contains "THORblack"
  26.         var ItemInfo = {
  27.             THORBlack: ["THORblack", "60a283193cb70855c43a381d", "thor_carrier_full.bundle",
  28.             "NFM THOR Integrated Carrier body armor - Black", "THOR ICB",
  29.             "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.", "5448e54d4bdc2dcc718b4568", 10000, "5ac3b934156ae10c4430e83c", 120, "5449016a4bdc2d6f028b456f", 1],
  30.            
  31.             SLAAPBlack: ["SLAAPblack", "5c0e66e2d174af02a96252f4", "slaap_black.bundle",
  32.             "Ops-Core SLAAP armor helmet plate (Black)", "SLAAP-B",
  33.             "Additional armor for the Ops-Core FAST helmet, made of a special polyethylene plate (5th protection class).", "57bef4c42459772e8d35a53b", 10000, "5ac3b934156ae10c4430e83c", 120, "5449016a4bdc2d6f028b456f", 1],
  34.  
  35.             TROOPERBlack: ["TROOPERblack", "5ea058e01dbce517f324b3e2", "tk_heavy_trooper_black.bundle",
  36.             "Tac-Kek Heavy Trooper mask for Ops-Core-type helmets - Black", "TK Heavy Trooper - B",
  37.             "Tac-Kek Heavy Trooper, an additional helmet ballistic mask module based on the Ops Core type, based on the famous movie universe. This is the Way. Looks good in Black.", "57bef4c42459772e8d35a53b", 10000, "5ac3b934156ae10c4430e83c", 120, "5449016a4bdc2d6f028b456f", 1],
  38.  
  39.             OPSCOREARMORBlack: ["EARSBlack", "5a16badafcdbcb001865f72d", "ops_core_armor_textures_black.bundle",
  40.             "Ops-Core FAST Side Armor - Black", "FAST Ears - B",
  41.             "Additional armor for Ops-Core FAST helmet, which protects the ears from shrapnel and small caliber ricochets. In a 'Blacker' Black", "57bef4c42459772e8d35a53b", 10000, "5ac3b934156ae10c4430e83c", 120, "5449016a4bdc2d6f028b456f", 1],
  42.  
  43.             MANDIBLEBlack: ["MANDIBblack", "5a16ba61fcdbcb098008728a", "ops_core_mandible_mesh_black.bundle",
  44.             "Ops-Core FAST Gunsight Mandible", "Mandible - B",
  45.             "Special additional ballistic protection for the Ops-Core FAST helmet, mounted on the Side Armor component. Now without that god-awful camo", "57bef4c42459772e8d35a53b", 10000, "5ac3b934156ae10c4430e83c", 120, "5449016a4bdc2d6f028b456f", 1],
  46.  
  47.             GPNVGBlack: ["GPNVGblack", "5c0558060db834001b735271", "gpnvg18_black.bundle",
  48.             "GPNVG-18 Night Vision goggles - Black", "GPNVG-18B",
  49.             "Panoramic night vision goggles GPNVG-18 (Ground Panoramic Night Vision Goggle). The cardinal difference of this NVG from the others is the presence of four separate EOP, two for each eye. Two Central EOPs are directed forward, while two more are directed outward from the center. This innovative solution allowed to expand the scope of the review to 97 degrees. Also featuring a Fancy Black Coating", "5a2c3a9486f774688b05e574", 10000, "5ac3b934156ae10c4430e83c", 120, "5449016a4bdc2d6f028b456f", 1],
  50.  
  51.             HAZARDBlack: ["HAZARDblack", "60a272cc93ef783291411d8e", "hazard4_drawbridge.bundle",
  52.             "Hazard 4 Drawbridge backpack (Black)", "Drawbridge - B",
  53.             "Drawbridge is an ergonomical medium-size 25L backpack with an impressive amount of modular pouches and straps. Now in Black Manufactured by Hazard 4.", "5448e53e4bdc2d60728b4567", 10000, "5ac3b934156ae10c4430e83c", 120, "5449016a4bdc2d6f028b456f", 1],
  54.  
  55.             // To add more, add a comma after that last ] and follow the pattern here:
  56.             /*
  57.            
  58.             ITEMNAME: ["_ITEM ID_", "_ID TO CLONE_", "_BUNDLE NAME_", "_FULL NAME_", "_SHORT NAME_", "_DESCRIPTION_", "_ID FOR HANDBOOK CATEGORY_", _HANDBOOK PRICE_, "_TRADER ID_", _PRICE_, "_CURRENCY ID_", _LOYALTY LEVEL_]
  59.            
  60.             */
  61.            
  62.         };
  63.  
  64.         for (const Item in ItemInfo) {
  65.             //Unfortunately with how sloppy i made this, you have to kinda keep track of what's in each index.... not clean but it works lol
  66.            
  67.             this.createItemHandbookEntry(ItemInfo[Item][0], ItemInfo[Item][6], ItemInfo[Item][7], handbook);
  68.             this.createItem(ItemInfo[Item][0], ItemInfo[Item][1], ItemInfo[Item][2], ItemInfo[Item][3], ItemInfo[Item][4], ItemInfo[Item][5], items, global);
  69.             this.createItemOffer(ItemInfo[Item][0], ItemInfo[Item][8], ItemInfo[Item][9], ItemInfo[Item][10], ItemInfo[Item][11], traders);
  70.         };
  71.     }
  72.  
  73.     createItemHandbookEntry(i_id, i_category, i_fprice, i_handbook)    {
  74.         //add item to handbook
  75.         i_handbook.push(
  76.             {
  77.                 "Id": i_id,
  78.                 "ParentId": i_category,
  79.                 "Price": i_fprice
  80.             }
  81.         );
  82.     }
  83.  
  84.     createItem(i_id, i_clone, i_path, i_lname, i_sname, i_desc, i_items, i_global)    {
  85.         const JsonUtil = container.resolve<JsonUtil>("JsonUtil");
  86.         let item = JsonUtil.clone(i_items[i_clone]);
  87.         const databaseServer = container.resovle<DatabaseServer>("DatabaseServer").getTables()
  88.         let ItemInfo = databaseServer.templates.items[item]
  89.         //new item props (not include not changed props)
  90.         if (ItemInfo[item][0] === "SLAAPblack") {
  91.           //change properties
  92.           item._props.Durability = 900000;
  93.           item._props.MaxDurability = 900000;
  94.           item._props.armorClass = 10;
  95.           item._props.BackgroundColor = "red";
  96.           item._props.RepairCost = 2;
  97.           item._props.RepairSpeed = 0;
  98.           item._props.Indestructibility = 0.09;        
  99.         };
  100.         if (ItemInfo[item][0] === "THORblack") {
  101.           item._props.Durability = 900000;
  102.           item._props.MaxDurability = 900000;
  103.           item._props.armorClass = 10;
  104.           item._props.BackgroundColor = "red";
  105.           item._props.RepairCost = 2;
  106.           item._props.RepairSpeed = 0;
  107.           item._props.Indestructibility = 0.09;
  108.         };
  109.         if (ItemInfo[item][0] === "TROOPERblack") {
  110.           //change properties
  111.           item._props.Durability = 900000;
  112.           item._props.MaxDurability = 900000;
  113.           item._props.armorClass = 10;
  114.           item._props.BackgroundColor = "red";
  115.           item._props.RepairCost = 2;
  116.           item._props.RepairSpeed = 0;
  117.           item._props.Indestructibility = 0.09;        
  118.         };
  119.         if (ItemInfo[item][0] === "EARSblack") {
  120.           //change properties
  121.           item._props.Durability = 900000;
  122.           item._props.MaxDurability = 900000;
  123.           item._props.armorClass = 10;
  124.           item._props.BackgroundColor = "red";
  125.           item._props.RepairCost = 2;
  126.           item._props.RepairSpeed = 0;
  127.           item._props.Indestructibility = 0.09;        
  128.         };
  129.         if (ItemInfo[item][0] === "MANDIBblack") {
  130.           //change properties
  131.           item._props.Durability = 900000;
  132.           item._props.MaxDurability = 900000;
  133.           item._props.armorClass = 10;
  134.           item._props.BackgroundColor = "red";
  135.           item._props.RepairCost = 2;
  136.           item._props.RepairSpeed = 0;
  137.           item._props.Indestructibility = 0.09;        
  138.         };
  139.         if (ItemInfo[item][0] === "HAZARDblack") {
  140.           //change properties
  141.           item._props.BackgroundColor = "red";
  142.           item._props.Grids.cellsH = 6
  143.           item._props.Grids.cellsV = 10
  144.         }
  145.         //add item back to database
  146.         i_items[i_id] = item;
  147.         //add custom item names to all languages/locales
  148.         for (const localeID in i_global)
  149.         {
  150.             i_global[localeID].templates[i_id] =
  151.             {
  152.                 "Name": i_lname,
  153.                 "ShortName": i_sname,
  154.                 "Description": i_desc
  155.             };
  156.         }
  157.     }
  158.  
  159.     createItemOffer(i_id, i_trader, i_price, i_currency, i_loyalty, i_traders)    {
  160.         i_traders[i_trader].assort.items.push(
  161.             {
  162.                 "_id": i_id,
  163.                 "_tpl": i_id,
  164.                 "parentId": "hideout",
  165.                 "slotId": "hideout",
  166.                 "upd":
  167.                 {
  168.                     "UnlimitedCount": true,
  169.                     "StackObjectsCount": 50
  170.                 }
  171.             }
  172.         );
  173.         //add trader cost to item
  174.         i_traders[i_trader].assort.barter_scheme[i_id] = [
  175.             [
  176.                 {
  177.                     "count": i_price,
  178.                     "_tpl": i_currency
  179.                 }
  180.             ]
  181.         ];
  182.         //add trader loyalty level to item
  183.         i_traders[i_trader].assort.loyal_level_items[i_id] = i_loyalty;
  184.  
  185.     }
  186. }
  187.  
  188. module.exports = { mod: new BlackThor() }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement