Gamenator

mod to update

Dec 30th, 2022
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.18 KB | None | 0 0
  1. "use strict";
  2. /*
  3. * author: Lukewarmpudding, ShadowXtrex
  4. * Based on code of: Nootropix/Echo55
  5. * akiVersion: 3.3.0,
  6. * modVersion: 2.0.3,
  7. * editor: ShadowXtrex,
  8. * Date: 07/12/2022
  9. */
  10. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  11. if (k2 === undefined) k2 = k;
  12. var desc = Object.getOwnPropertyDescriptor(m, k);
  13. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  14. desc = { enumerable: true, get: function() { return m[k]; } };
  15. }
  16. Object.defineProperty(o, k2, desc);
  17. }) : (function(o, m, k, k2) {
  18. if (k2 === undefined) k2 = k;
  19. o[k2] = m[k];
  20. }));
  21. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  22. Object.defineProperty(o, "default", { enumerable: true, value: v });
  23. }) : function(o, v) {
  24. o["default"] = v;
  25. });
  26. var __importStar = (this && this.__importStar) || function (mod) {
  27. if (mod && mod.__esModule) return mod;
  28. var result = {};
  29. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  30. __setModuleDefault(result, mod);
  31. return result;
  32. };
  33. Object.defineProperty(exports, "__esModule", { value: true });
  34. const tsyringe_1 = require("C:/snapshot/project/node_modules/tsyringe");
  35. const newItems = __importStar(require("../db/itemsToAdd.json"));
  36. class BlackGear {
  37. constructor() {
  38. this.modinfo = require("../package.json");
  39. this.modcfg = require("../config.json");
  40. }
  41. postDBLoad(container) {
  42. this.logger = container.resolve("WinstonLogger");
  43. this.logger.log(`${this.modinfo.author}-${this.modinfo.name} v${this.modinfo.version} ${this.modcfg.Enabled ? "" : " [Disabled]"} ${this.modcfg.Debug ? "| Debug mode: Enabled" : ""}`, "yellow");
  44. if (!this.modcfg.Enabled) {
  45. return;
  46. }
  47. // Get items from preset into Game Database and put in memory
  48. const dbServer = container.resolve("DatabaseServer");
  49. const db = dbServer.getTables();
  50. const items = db.templates.items;
  51. const handbook = db.templates.handbook.Items;
  52. const traders = db.traders;
  53. const global = db.locales.global;
  54. for (const bgear in newItems) {
  55. if (newItems[bgear].id === undefined) {
  56. break;
  57. }
  58. this.createItem(newItems[bgear].id, newItems[bgear].cloneID, newItems[bgear].bundle, newItems[bgear].fullName, newItems[bgear].shortName, newItems[bgear].description, items, global);
  59. this.createItemHandbookEntry(newItems[bgear].id, newItems[bgear].handbookID, newItems[bgear].handbookPrice, handbook);
  60. this.createItemOffer(newItems[bgear].id, newItems[bgear].traderID, newItems[bgear].traderPrice, newItems[bgear].currencyID, newItems[bgear].traderLL, traders);
  61. }
  62. // Incompatible items FIX
  63. const defaultInventoryID = db.templates.items["55d7217a4bdc2d86028b456d"];
  64. // Make compatible some accesory items with core fast helmets
  65. const fasthelmetblack = db.templates.items["5a154d5cfcdbcb001a3b00da"];
  66. const fasttan = db.templates.items["5ac8d6885acfc400180ae7b0"];
  67. const galvion = db.templates.items["5f60b34a41e30a4ab12a6947"];
  68. const wendyblack = db.templates.items["5e00c1ad86f774747333222c"];
  69. const wendytan = db.templates.items["5e01ef6886f77445f643baa4"];
  70. const hjelm = db.templates.items["61bca7cda0eae612383adf57"];
  71. const ratnik = db.templates.items["5a7c4850e899ef00150be885"];
  72. const ratnikcover = db.templates.items["5aa7cfc0e5b5b00015693143"];
  73. const mich2001 = db.templates.items["5d5e7d28a4b936645d161203"];
  74. const mich2002 = db.templates.items["5d5e9c74a4b9364855191c40"];
  75. const gallet = db.templates.items["5e4bfc1586f774264f7582d3"];
  76. const bastion = db.templates.items["5ea17ca01412a1425304d1c0"];
  77. const airframe = db.templates.items["5c17a7ed2e2216152142459c"];
  78. const replica = db.templates.items["5ea05cf85ad9772e6624305d"];
  79. const lshz = db.templates.items["5b432d215acfc4771e1c6624"];
  80. const fastears = db.templates.items["5a16badafcdbcb001865f72d"];
  81. const maska = db.templates.items["5c091a4e0db834001d5addc8"];
  82. const altyn = db.templates.items["5aa7e276e5b5b000171d0647"];
  83. const bnti = db.templates.items["5d6d3716a4b9361bc8618872"];
  84. const mando = db.templates.items["5ea058e01dbce517f324b3e2"];
  85. const maskaK = db.templates.items["5c0e874186f7745dc7616606"];
  86. const bastionplate = db.templates.items["5ea18c84ecf1982c7712d9a2"];
  87. mando._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
  88. lshz._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  89. bnti._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  90. fasttan._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  91. galvion._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  92. wendyblack._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  93. wendytan._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  94. hjelm._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  95. ratnik._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
  96. ratnikcover._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
  97. mich2001._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
  98. mich2002._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
  99. gallet._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  100. bastion._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
  101. airframe._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  102. replica._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  103. lshz._props.Slots[1]._props.filters[0].Filter.push("TROOPERBlack");
  104. fasttan._props.Slots[1]._props.filters[0].Filter.push("TROOPERBlack");
  105. replica._props.Slots[1]._props.filters[0].Filter.push("TROOPERBlack");
  106. fasthelmetblack._props.Slots[4]._props.filters[0].Filter.push("SLAAPBlack");
  107. fasttan._props.Slots[4]._props.filters[0].Filter.push("SLAAPBlack");
  108. mich2001._props.Slots[2]._props.filters[0].Filter.push("SLAAPBlack");
  109. mich2002._props.Slots[2]._props.filters[0].Filter.push("SLAAPBlack");
  110. replica._props.Slots[4]._props.filters[0].Filter.push("SLAAPBlack");
  111. fasthelmetblack._props.Slots[1]._props.filters[0].Filter.push("GPNVGBlack");
  112. fasthelmetblack._props.Slots[1]._props.filters[0].Filter.push("TROOPERBlack");
  113. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("6B47COVEREDBLACK");
  114. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("AIRFRAMEBLACK");
  115. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("MASKABLACK");
  116. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("ALTYNBLACK");
  117. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("BOSSBLACK");
  118. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("FLEECEBLACK");
  119. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("CAPBLACK");
  120. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("BANDANABLACK");
  121. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("UNTARBLACK");
  122. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("PANAMABLACK");
  123. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("DOORKICKERBLACK");
  124. defaultInventoryID._props.Slots[5]._props.filters[0].Filter.push("UXPROBLACK");
  125. defaultInventoryID._props.Slots[4]._props.filters[0].Filter.push("SHEMAGHBLACK1");
  126. defaultInventoryID._props.Slots[4]._props.filters[0].Filter.push("SHEMAGHBLACK2");
  127. defaultInventoryID._props.Slots[4]._props.filters[0].Filter.push("WELDINGMASKBLACK");
  128. fastears._props.Slots[0]._props.filters[0].Filter.push("MANDIBLEBlack");
  129. maska._props.Slots[0]._props.filters[0].Filter.push("MASKAFSBLACK");
  130. maskaK._props.Slots[0]._props.filters[0].Filter.push("MASKAFSBLACK");
  131. altyn._props.Slots[0]._props.filters[0].Filter.push("ALTYNSHIELDBLACK");
  132. airframe._props.Slots[3]._props.filters[0].Filter.push("AFCHOPSBLACK");
  133. airframe._props.Slots[3]._props.filters[0].Filter.push("AFEARSBLACK");
  134. bastionplate._props.Slots[0]._props.filters[0].Filter.push("GPNVGBlack");
  135. //this.logger.warning(`==> Helmet Warning: "Internal" Ricochet can kill you.`);
  136. }
  137. createItem(i_id, i_clone, i_path, i_lname, i_sname, i_desc, i_items, i_global) {
  138. const jsonUtil = tsyringe_1.container.resolve("JsonUtil");
  139. const item = jsonUtil.clone(i_items[i_clone]);
  140. // Make changes to original items
  141. item._id = i_id;
  142. item._props.Prefab.path = i_path;
  143. if (newItems[i_id]._proto) {
  144. item._proto = newItems[i_id]._proto;
  145. }
  146. if (newItems[i_id].itemParent) {
  147. item._parent = newItems[i_id].itemParent;
  148. }
  149. for (const property in newItems[i_id].propOverrides) {
  150. item._props[property] = newItems[i_id].propOverrides[property];
  151. }
  152. for (const localeID in i_global) {
  153. i_global[localeID].templates[i_id] =
  154. {
  155. "Name": i_lname,
  156. "ShortName": i_sname,
  157. "Description": i_desc
  158. };
  159. }
  160. // Get back items to Database
  161. i_items[i_id] = item;
  162. // DEBUG
  163. /*this.logger.log(
  164. `${this.modcfg.Debug ? "==> ItemAdded: " + i_id + " created.":""}`,
  165. "yellow"
  166. );*/
  167. }
  168. createItemHandbookEntry(i_id, i_category, i_fprice, i_handbook) {
  169. i_handbook.push({
  170. "Id": i_id,
  171. "ParentId": i_category,
  172. "Price": i_fprice
  173. });
  174. // DEBUG
  175. /*this.logger.log(
  176. `${this.modcfg.Debug ? "==> Handbook entry for item: " + i_id + " created." : ""}`,
  177. "green"
  178. );*/
  179. }
  180. // Add item to trader
  181. createItemOffer(i_id, i_trader, i_price, i_currencyTpl, i_loyaltyLevel, i_traders) {
  182. i_traders[i_trader].assort.items.push({
  183. "_id": i_id,
  184. "_tpl": i_id,
  185. "parentId": "hideout",
  186. "slotId": "hideout",
  187. "upd": {
  188. "UnlimitedCount": true,
  189. "StackObjectsCount": 10
  190. }
  191. });
  192. // Add cost to item
  193. i_traders[i_trader].assort.barter_scheme[i_id] = [
  194. [
  195. {
  196. "count": i_price,
  197. "_tpl": i_currencyTpl
  198. }
  199. ]
  200. ];
  201. // Add Trader Loyalty requirement
  202. i_traders[i_trader].assort.loyal_level_items[i_id] = i_loyaltyLevel;
  203. // DEBUG
  204. /*this.logger.log(
  205. `${this.modcfg.Debug ? "==> Trader assorts for item: " + i_id + " created.\n" : ""}`,
  206. "red"
  207. );*/
  208. }
  209. }
  210. module.exports = { mod: new BlackGear };
  211.  
Add Comment
Please, Sign In to add comment