Advertisement
Fear3d

PH_WarehouseMZ

Dec 10th, 2022 (edited)
759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // PH Warehouse MZ
  3. // PH_WarehouseMZ.js
  4. //=============================================================================
  5.  
  6. /*:
  7. * @target MZ
  8. * @plugindesc [Version 1.4.0] Allows the creation of warehouses where you can store items in the game.
  9. * @author Arthran (original plugin by PrimeHover)
  10. *
  11. * ---------------------------------------------------------------------------------------
  12. * This work is licensed under the Creative Commons Attribution 4.0 International License.
  13. * To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/
  14. * ---------------------------------------------------------------------------------------
  15. *
  16. * @param ---Options---
  17. * @desc Use the spaces below to customize the options of the plugin
  18. * @default
  19. *
  20. * @param All Together
  21. * @desc Defines whether or not you want to show the items in separated categories
  22. * @default false
  23. * @type boolean
  24. * @on All together
  25. * @off Separate categories
  26. *
  27. * @param Stack Item Quantity
  28. * @desc Defines whether or not you want to consider stacked items as a single space in the capacity
  29. * @default false
  30. * @type boolean
  31. * @on One stack = one space
  32. * @off One item = one space
  33. *
  34. * @param ---Vocabulary---
  35. * @desc Use the spaces below to personalize the vocabulary of the plugin
  36. * @default
  37. *
  38. * @param Withdraw Text
  39. * @desc Text shown in option "Withdraw"
  40. * @default Withdraw
  41. *
  42. * @param Deposit Text
  43. * @desc Text shown in option "Deposit"
  44. * @default Deposit
  45. *
  46. * @param All Text
  47. * @desc Text shown in option "All" if the parameter "All Together" is set as true.
  48. * @default All
  49. *
  50. * @param Available Space Text
  51. * @desc Text shown in the information window
  52. * @default Available Space:
  53. *
  54. * ---------------------------------------------------------------------------------------
  55. * Plugin Commands
  56. * ---------------------------------------------------------------------------------------
  57. *
  58. * @command create
  59. * @text Create
  60. * @desc Creates a new warehouse (if it doesn't already exist)
  61. *
  62. * @arg warehouseName
  63. * @text Warehouse Name
  64. * @desc A name used to identify the warehouse
  65. * @default My Storage
  66. * @type text
  67. *
  68. * @arg maxCapacity
  69. * @text Max Capacity
  70. * @desc The maximum capacity of the warehouse (use 0 for infinite capacity)
  71. * @default 50
  72. * @type text
  73. *
  74. * @arg ruleName
  75. * @text Rule Name
  76. * @desc (Optional) The name of the set of rules that you want the warehouse to follow
  77. * @type text
  78. *
  79. * @command show
  80. * @text Show
  81. * @desc Show the warehouse that has the specified title.
  82. *
  83. * @arg warehouseName
  84. * @text Warehouse Name
  85. * @desc The name of the warehouse that you want to show
  86. * @default My Storage
  87. * @type text
  88. *
  89. * @command remove
  90. * @text Remove
  91. * @desc Remove the warehouse that has the specified title.
  92. *
  93. * @arg warehouseName
  94. * @text Warehouse Name
  95. * @desc The name of the warehouse that you want to remove
  96. * @default My Storage
  97. * @type text
  98. *
  99. * @command lootItem
  100. * @text Loot - Item / Key Item
  101. * @desc Add an item to the warehouse as a one-time loot bonus
  102. *
  103. * @arg warehouseName
  104. * @text Warehouse Name
  105. * @desc The name of the warehouse
  106. * @default My Storage
  107. * @type text
  108. *
  109. * @arg id
  110. * @text Item ID
  111. * @desc The item that you want to add
  112. * @default 0
  113. * @type item
  114. *
  115. * @arg quantity
  116. * @text Quantity
  117. * @desc Number of items to add
  118. * @default 1
  119. * @type text
  120. *
  121. * @command lootWeapon
  122. * @text Loot - Weapon
  123. * @desc Add a weapon to the warehouse as a one-time loot bonus
  124. *
  125. * @arg warehouseName
  126. * @text Warehouse Name
  127. * @desc The name of the warehouse
  128. * @default My Storage
  129. * @type text
  130. *
  131. * @arg id
  132. * @text Weapon ID
  133. * @desc The weapon that you want to add
  134. * @default 0
  135. * @type weapon
  136. *
  137. * @arg quantity
  138. * @text Quantity
  139. * @desc Number of weapons to add
  140. * @default 1
  141. * @type text
  142. *
  143. * @command lootArmor
  144. * @text Loot - Armor
  145. * @desc Add an armor to the warehouse as a one-time loot bonus
  146. *
  147. * @arg warehouseName
  148. * @text Warehouse Name
  149. * @desc The name of the warehouse
  150. * @default My Storage
  151. * @type text
  152. *
  153. * @arg id
  154. * @text Armor ID
  155. * @desc The armor that you want to add
  156. * @default 0
  157. * @type armor
  158. *
  159. * @arg quantity
  160. * @text Quantity
  161. * @desc Number of armors to add
  162. * @default 1
  163. * @type text
  164. *
  165. * @command addItem
  166. * @text Add - Item / Key Item
  167. * @desc Add an item to the warehouse
  168. *
  169. * @arg warehouseName
  170. * @text Warehouse Name
  171. * @desc The name of the warehouse
  172. * @default My Storage
  173. * @type text
  174. *
  175. * @arg id
  176. * @text Item ID
  177. * @desc The item that you want to add
  178. * @default 0
  179. * @type item
  180. *
  181. * @arg quantity
  182. * @text Quantity
  183. * @desc Number of items to add
  184. * @default 1
  185. * @type text
  186. *
  187. * @command addWeapon
  188. * @text Add - Weapon
  189. * @desc Add a weapon to the warehouse
  190. *
  191. * @arg warehouseName
  192. * @text Warehouse Name
  193. * @desc The name of the warehouse
  194. * @default My Storage
  195. * @type text
  196. *
  197. * @arg id
  198. * @text Weapon ID
  199. * @desc The weapon that you want to add
  200. * @default 0
  201. * @type weapon
  202. *
  203. * @arg quantity
  204. * @text Quantity
  205. * @desc Number of weapons to add
  206. * @default 1
  207. * @type text
  208. *
  209. * @command addArmor
  210. * @text Add - Armor
  211. * @desc Add an armor to the warehouse
  212. *
  213. * @arg warehouseName
  214. * @text Warehouse Name
  215. * @desc The name of the warehouse
  216. * @default My Storage
  217. * @type text
  218. *
  219. * @arg id
  220. * @text Armor ID
  221. * @desc The armor that you want to add
  222. * @default 0
  223. * @type armor
  224. *
  225. * @arg quantity
  226. * @text Quantity
  227. * @desc Number of armors to add
  228. * @default 1
  229. * @type text
  230. *
  231. * @command setCapacity
  232. * @text Capacity - Set
  233. * @desc Set a new maximum capacity for an existing warehouse
  234. *
  235. * @arg warehouseName
  236. * @text Warehouse Name
  237. * @desc The name of the warehouse
  238. * @default My Storage
  239. * @type text
  240. *
  241. * @arg newCapacity
  242. * @text New Capacity
  243. * @desc New maximum capacity for the warehouse (use 0 for infinite capacity)
  244. * @default 50
  245. * @type text
  246. *
  247. * @command incCapacity
  248. * @text Capacity - Increase
  249. * @desc Increase the maximum capacity of an existing warehouse
  250. *
  251. * @arg warehouseName
  252. * @text Warehouse Name
  253. * @desc The name of the warehouse
  254. * @default My Storage
  255. * @type text
  256. *
  257. * @arg incAmount
  258. * @text Increase By
  259. * @desc The amount to increase the current capacity by
  260. * @default 10
  261. * @type text
  262. *
  263. * @command decCapacity
  264. * @text Capacity - Decrease
  265. * @desc Decrease the maximum capacity of an existing warehouse
  266. *
  267. * @arg warehouseName
  268. * @text Warehouse Name
  269. * @desc The name of the warehouse
  270. * @default My Storage
  271. * @type text
  272. *
  273. * @arg decAmount
  274. * @text Decrease By
  275. * @desc The amount to decrease the current capacity by
  276. * @default 10
  277. * @type text
  278. *
  279. * @help
  280. *
  281. * Warehouse/Storage Plugin
  282. * originally created by PrimeHover
  283. * MZ port and bugfixes by Arthran
  284. *
  285. * Original plugin can be found at: https://github.com/PrimeHover/Warehouse
  286. * Original illustrative example of using the commands and rules at: https://web.archive.org/web/20191108231819/http://primehover.gufernandes.com.br/ph-warehouse
  287. *
  288. * ----------------------------------------------------------------------------------------------------------------------------------
  289. *
  290. * MZ Plugin Commands:
  291. *
  292. * • Create                         # Creates a warehouse of specified capacity with an optional rule
  293. * • Show                           # Shows a warehouse
  294. * • Remove                         # Removes a warehouse
  295. *
  296. * • Loot - Item / Key Item         # Add an item as a one-time loot bonus inside a created warehouse (qty can be specified)
  297. * • Loot - Weapon                  # Add a weapon as a one-time loot bonus inside a created warehouse (qty can be specified)
  298. * • Loot - Armor                   # Add an armor as a one-time loot bonus inside a created warehouse (qty can be specified)
  299. *
  300. * • Add - Item / Key Item          # Add an item inside a created warehouse (qty can be specified)
  301. * • Add - Weapon                   # Add a weapon inside a created warehouse (qty can be specified)
  302. * • Add - Armor                    # Add an armor inside a created warehouse (qty can be specified)
  303. *
  304. * • Capacity - Set                 # Set a new maximum capacity for a warehouse already created
  305. * • Capacity - Increase            # Increase the maximum capacity for a warehouse already created
  306. * • Capacity - Decrease            # Decrease the maximum capacity for a warehouse already created
  307. *
  308. *
  309. * If you use \V[x], \N[x], or \P[x] in a plugin command, it will be replaced with a corresponding variable, actor name, or party member
  310. * name, assuming that x is an integer representing the correct ID or index.
  311. *
  312. * The difference between Loot and Add is that Loot will only add the items to the warehouse the first time the plugin command is run.
  313. * Whereas Add will continue adding more items to the warehouse every time the plugin command is run.
  314. *
  315. * ----------------------------------------------------------------------------------------------------------------------------------
  316. *
  317. * Old Plugin Commands:
  318. *
  319. * IMPORTANT NOTE: These are the MV-style plugin commands. If you prefer this style of command, you can still use them in MZ by
  320. *                 using the following script call: PHWarehouse.call(this, 'args');
  321. *                
  322. *                 For example, if the plugin command is supposed to be:  PHWarehouse add item <My Warehouse:22:1>
  323. *                 then this would be the script call that you use:       PHWarehouse.call(this, 'add item <My Warehouse:22:1>');
  324. *
  325. * - PHWarehouse create <Title of the Warehouse>                      # Creates a warehouse with infinite capacity
  326. * - PHWarehouse create <Title of the Warehouse:50>                   # Creates a warehouse and sets its maximum capacity to 50
  327. * - PHWarehouse create <Title of the Warehouse:50:rule>              # Creates a warehouse, sets its maximum capacity to 50 and sets a rule
  328. *
  329. * - PHWarehouse show <Title of the Warehouse>                        # Shows a warehouse
  330. * - PHWarehouse remove <Title of the Warehouse>                      # Removes a warehouse
  331. *
  332. * - PHWarehouse loot item <Title of the Warehouse:id:quantity>       # Add an item for loot bonus inside a created warehouse
  333. * - PHWarehouse loot weapon <Title of the Warehouse:id:quantity>     # Add a weapon for loot bonus inside a created warehouse
  334. * - PHWarehouse loot armor <Title of the Warehouse:id:quantity>      # Add an armor for loot bonus inside a created warehouse
  335. * - PHWarehouse loot keyItem <Title of the Warehouse:id:quantity>    # Add a key item for loot bonus inside a created warehouse
  336. *
  337. * - PHWarehouse add item <Title of the Warehouse:id:quantity>        # Add an item immediately inside a created warehouse
  338. * - PHWarehouse add weapon <Title of the Warehouse:id:quantity>      # Add a weapon immediately inside a created warehouse
  339. * - PHWarehouse add armor <Title of the Warehouse:id:quantity>       # Add an armor immediately inside a created warehouse
  340. * - PHWarehouse add keyItem <Title of the Warehouse:id:quantity>     # Add a key item immediately inside a created warehouse
  341. *
  342. * - PHWarehouse capacity set <Title of the Warehouse:quantity>       # Set a new maximum capacity for a warehouse already created
  343. * - PHWarehouse capacity increase <Title of the Warehouse:quantity>  # Increase the maximum capacity for a warehouse already created
  344. * - PHWarehouse capacity decrease <Title of the Warehouse:quantity>  # Decrease the maximum capacity for a warehouse already created
  345. *
  346. * ----------------------------------------------------------------------------------------------------------------------------------
  347. *
  348. * Script Commands:
  349. *
  350. * - PHPlugins.PHWarehouse.prototype.exist("Title of the Warehouse");                # Verifies if a warehouse exists
  351. *
  352. * - PHPlugins.PHWarehouse.prototype.getMaxCapacity("Title of the Warehouse");       # Gets the maximum capacity of a warehouse (returns 0 if unlimited capacity)
  353. * - PHPlugins.PHWarehouse.prototype.getCurrentCapacity("Title of the Warehouse");   # Gets the current capacity of a warehouse
  354. *
  355. * - PHPlugins.PHWarehouse.prototype.hasItem("Title of the Warehouse", id);          # Verifies if a warehouse has a particular item and returns the quantity of this item inside the warehouse
  356. * - PHPlugins.PHWarehouse.prototype.hasWeapon("Title of the Warehouse", id);        # Verifies if a warehouse has a particular weapon and returns the quantity of this item inside the warehouse
  357. * - PHPlugins.PHWarehouse.prototype.hasArmor("Title of the Warehouse", id);         # Verifies if a warehouse has a particular armor and returns the quantity of this item inside the warehouse
  358. * - PHPlugins.PHWarehouse.prototype.hasKeyItem("Title of the Warehouse", id);       # Verifies if a warehouse has a particular key item and returns the quantity of this item inside the warehouse
  359. *
  360. * ----------------------------------------------------------------------------------------------------------------------------------
  361. *
  362. * Rule Commands:
  363. *
  364. *    Rules are a simple way to manage which items you can store in a specific warehouse.
  365. *    In order to create a rule for your warehouse, you have to create a Common Event in the database called "PHWarehouse".
  366. *    Inside of that Common Event, you will create some comments in order to populate the rules for warehouses.
  367. *    These comments must have the following format:
  368. *
  369. *    {Title of the Rule}
  370. *    [commands]
  371. *
  372. *    The [commands] you can specify are as follow:
  373. *
  374. *    item: 1 (Just allow the storage of the item with id 1)
  375. *    item: 1, 2, 3, 4 (Allows the storage of items with id 1, 2, 3 and 4)
  376. *    item: no (Does not allow the storage of items)
  377. *    item-n: 1 (Allows the storage of any item except the one with id 1)
  378. *    (If you don't specify the command "item" in the rule, all items will be allowed to be stored)
  379. *
  380. *    weapon: 1 (Just allow the storage of the weapon with id 1)
  381. *    weapon: 1, 2, 3, 4 (Allows the storage of weapons with id 1, 2, 3 and 4)
  382. *    weapon: no (Does not allow the storage of weapons)
  383. *    weapon-n: 1 (Allows the storage of any weapon except the one with id 1)
  384. *    (If you don't specify the command "weapon" in the rule, all weapons will be allowed to be stored)
  385. *
  386. *    armor: 1 (Just allow the storage of the armor with id 1)
  387. *    armor: 1, 2, 3, 4 (Allows the storage of armors with id 1, 2, 3 and 4)
  388. *    armor: no (Does not allow the storage of armors)
  389. *    armor-n: 1 (Allows the storage of any armor except the one with id 1)
  390. *    (If you don't specify the command "armor" in the rule, all armors will be allowed to be stored)
  391. *
  392. *    keyItem: 1 (Just allow the storage of the key item with id 1)
  393. *    keyItem: 1, 2, 3, 4 (Allows the storage of key items with id 1, 2, 3 and 4)
  394. *    keyItem: no (Does not allow the storage of key items)
  395. *    keyItem-n: 1 (Allows the storage of any key item except the one with id 1)
  396. *    (If you don't specify the command "keyItem" in the rule, all key items will be allowed to be stored)
  397. *
  398. */
  399.  
  400. /* Global variable for PH Plugins */
  401. var PHPlugins = PHPlugins || {};
  402. PHPlugins.Parameters = PluginManager.parameters('PH_WarehouseMZ');
  403. PHPlugins.Params = PHPlugins.Params || {};
  404.  
  405. /* Global variable for the list of quests */
  406. PHPlugins.PHWarehouse = null;
  407.  
  408. /* Getting the parameters */
  409. PHPlugins.Params.PHWarehouseWithdrawText = String(PHPlugins.Parameters['Withdraw Text']);
  410. PHPlugins.Params.PHWarehouseDepositText = String(PHPlugins.Parameters['Deposit Text']);
  411. PHPlugins.Params.PHWarehouseAvailableSpaceText = String(PHPlugins.Parameters['Available Space Text']);
  412. PHPlugins.Params.PHWarehouseAllText = String(PHPlugins.Parameters['All Text']);
  413. PHPlugins.Params.PHWarehouseAllTogether = (PHPlugins.Parameters['All Together'] === 'true');
  414. PHPlugins.Params.PHWarehouseStackItemQuantity = (PHPlugins.Parameters['Stack Item Quantity'] === 'true');
  415.  
  416. /* Enable usage of old plugin commands */
  417. PHWarehouse = function(oldPluginCommand) {
  418.     const args = oldPluginCommand.split(' ');
  419.     const command = 'PHWarehouse';
  420.  
  421.     this.pluginCommand(command, args);
  422. };
  423.  
  424. (function() {
  425.  
  426.     /* ---------------------------------------------------------- *
  427.      *                      WAREHOUSE MANAGER                     *
  428.      * ---------------------------------------------------------- */
  429.  
  430.     function PHWarehouseManager() {
  431.         this._rules = {};
  432.         this._warehouses = {};
  433.         this._lastActive = "";
  434.         this._lastOption = 0; // 0 = Withdraw, 1 = Deposit
  435.         this._lastCategory = "item";
  436.     }
  437.  
  438.     /* ---- BASIC OPERATIONS ---- */
  439.  
  440.     /* Creates a warehouse if it does not exist */
  441.     PHWarehouseManager.prototype.createWarehouse = function(_sentence) {
  442.  
  443.         var matches = this.checkSentence(_sentence);
  444.         var results;
  445.         var title;
  446.         var rule = null;
  447.         var capacity = 0;
  448.  
  449.         if (matches != null) {
  450.             results = matches.split(":");
  451.             title = results[0];
  452.  
  453.             if (!this._warehouses.hasOwnProperty(title)) {
  454.  
  455.                 if (results.length >= 2) {
  456.                     capacity = parseInt(results[1]);
  457.                     if (isNaN(capacity) || capacity < 0) {
  458.                         capacity = 0;
  459.                     }
  460.                     if (typeof results[2] !== "undefined" && this._rules.hasOwnProperty(results[2])) {
  461.                         rule = results[2];
  462.                     }
  463.                 }
  464.  
  465.                 this._warehouses[title] = {
  466.                     title: title,
  467.                     maxCapacity: capacity,
  468.                     currentCapacity: 0,
  469.                     rule: rule,
  470.                     lootBonus: true,
  471.                     items: {
  472.                         item: [],
  473.                         weapon: [],
  474.                         armor: [],
  475.                         keyItem: []
  476.                     },
  477.                     qtty: {
  478.                         item: {},
  479.                         weapon: {},
  480.                         armor: {},
  481.                         keyItem: {}
  482.                     }
  483.                 };
  484.             }
  485.  
  486.             this._lastActive = title;
  487.         }
  488.  
  489.     };
  490.  
  491.     /* Opens a warehouse */
  492.     PHWarehouseManager.prototype.openWarehouse = function(_sentence) {
  493.         var matches = this.checkSentence(_sentence);
  494.         if (matches != null) {
  495.             this._lastActive = matches;
  496.             this._warehouses[this._lastActive].lootBonus = false;
  497.         }
  498.     };
  499.  
  500.     /* Remove a warehouse */
  501.     PHWarehouseManager.prototype.removeWarehouse = function(_sentence) {
  502.  
  503.         var matches = this.checkSentence(_sentence);
  504.  
  505.         if (matches != null) {
  506.             if (this._warehouses.hasOwnProperty(matches)) {
  507.                 delete this._warehouses[matches];
  508.             }
  509.         }
  510.  
  511.     };
  512.  
  513.     /* Add a loot bonus */
  514.     PHWarehouseManager.prototype.addLoot = function(_sentence, category) {
  515.  
  516.         var matches = this.checkSentence(_sentence);
  517.         var results;
  518.  
  519.         if (matches != null) {
  520.             results = matches.split(":");
  521.             if (this._warehouses.hasOwnProperty(results[0]) && this._warehouses[results[0]].lootBonus && typeof results[1] !== "undefined" && typeof results[2] !== "undefined") {
  522.                 results[1] = parseInt(results[1]);
  523.                 results[2] = parseInt(results[2]);
  524.  
  525.                 const maxCapacity = this._warehouses[results[0]].maxCapacity;
  526.                 if ((maxCapacity != 0) && (results[2] > maxCapacity - this._warehouses[results[0]].currentCapacity)) {
  527.                     results[2] = maxCapacity - this._warehouses[results[0]].currentCapacity;
  528.                 }
  529.  
  530.                 if (this._warehouses[results[0]].items[category].indexOf(results[1]) > -1) {
  531.                     this._warehouses[results[0]].qtty[category][results[1]] += results[2];
  532.                 } else {
  533.                     this._warehouses[results[0]].items[category].push(results[1]);
  534.                     this._warehouses[results[0]].qtty[category][results[1]] = results[2];
  535.                 }
  536.                 this._warehouses[results[0]].currentCapacity += results[2];
  537.             }
  538.         }
  539.  
  540.     };
  541.  
  542.     /* Add item to a warehouse */
  543.     PHWarehouseManager.prototype.addItems = function(_sentence, category) {
  544.  
  545.         var matches = this.checkSentence(_sentence);
  546.         var results;
  547.  
  548.         if (matches != null) {
  549.             results = matches.split(":");
  550.             if (this._warehouses.hasOwnProperty(results[0]) && typeof results[1] !== "undefined" && typeof results[2] !== "undefined") {
  551.                 results[1] = parseInt(results[1]);
  552.                 results[2] = parseInt(results[2]);
  553.  
  554.                 const maxCapacity = this._warehouses[results[0]].maxCapacity;
  555.                 if ((maxCapacity != 0) && (results[2] > maxCapacity - this._warehouses[results[0]].currentCapacity)) {
  556.                     results[2] = maxCapacity - this._warehouses[results[0]].currentCapacity;
  557.                 }
  558.  
  559.                 if (this._warehouses[results[0]].items[category].indexOf(results[1]) > -1) {
  560.                     this._warehouses[results[0]].qtty[category][results[1]] += results[2];
  561.                 } else {
  562.                     this._warehouses[results[0]].items[category].push(results[1]);
  563.                     this._warehouses[results[0]].qtty[category][results[1]] = results[2];
  564.                 }
  565.                 this._warehouses[results[0]].currentCapacity += results[2];
  566.             }
  567.         }
  568.  
  569.     };
  570.  
  571.  
  572.  
  573.     /* ---- RULE METHODS ---- */
  574.  
  575.     /* Load rules */
  576.     PHWarehouseManager.prototype.loadRules = function() {
  577.         var warehouseVar = null;
  578.  
  579.         if ($dataCommonEvents) {
  580.             for (var i = 0; i < $dataCommonEvents.length; i++) {
  581.                 if ($dataCommonEvents[i] instanceof Object && $dataCommonEvents[i].name == "PHWarehouse") {
  582.                     warehouseVar = $dataCommonEvents[i].list;
  583.                     i = $dataCommonEvents.length;
  584.                 }
  585.             }
  586.         }
  587.  
  588.         if (warehouseVar != null) {
  589.             this.populateRules(warehouseVar);
  590.         }
  591.     };
  592.  
  593.     /* Populate rules */
  594.     PHWarehouseManager.prototype.populateRules = function(warehouseVar) {
  595.         var str = '';
  596.         var index = -1;
  597.         var rule;
  598.  
  599.         for (var i = 0; i < warehouseVar.length; i++) {
  600.             if (warehouseVar[i].parameters[0]) {
  601.                 str = warehouseVar[i].parameters[0].trim();
  602.                 if (this.checkTitle(str)) {
  603.                     str = str.slice(1, str.length-1);
  604.                     this._rules[str] = {
  605.                         enabledItems: {
  606.                             item: [],
  607.                             weapon: [],
  608.                             armor: [],
  609.                             keyItem: []
  610.                         },
  611.                         disabledItems: {
  612.                             item: [],
  613.                             weapon: [],
  614.                             armor: [],
  615.                             keyItem: []
  616.                         }
  617.                     };
  618.                     index = str;
  619.                 } else if (this._rules[index]) {
  620.                     rule = str.split(":");
  621.                     rule[0] = rule[0].trim();
  622.                     rule[1] = rule[1].trim();
  623.  
  624.                     if (rule[0].indexOf('-n') > -1) {
  625.                         rule[0] = rule[0].replace("-n", "");
  626.                         if (this._rules[index].disabledItems.hasOwnProperty(rule[0])) {
  627.                             this._rules[index].disabledItems[rule[0]] = this.getItemsId(rule[1]);
  628.                         }
  629.                     } else {
  630.                         if (this._rules[index].enabledItems.hasOwnProperty(rule[0])) {
  631.                             if (rule[1].indexOf("no") > -1) {
  632.                                 this._rules[index].enabledItems[rule[0]] = false;
  633.                             } else {
  634.                                 this._rules[index].enabledItems[rule[0]] = this.getItemsId(rule[1]);
  635.                             }
  636.                         }
  637.                     }
  638.                 }
  639.             }
  640.         }
  641.     };
  642.  
  643.     /* Checks if the string is a title or a description */
  644.     PHWarehouseManager.prototype.checkTitle = function(str) {
  645.         if (str.charAt(0) == "{" && str.charAt(str.length - 1) == "}") {
  646.             return true;
  647.         }
  648.         return false;
  649.     };
  650.  
  651.     /* Separate ids and make it an array */
  652.     PHWarehouseManager.prototype.getItemsId = function(str) {
  653.         var arr = str.split(",");
  654.         for (var i = 0; i < arr.length; i++) {
  655.             arr[i] = parseInt(arr[i], 10);
  656.         }
  657.         return arr;
  658.     };
  659.  
  660.     /* Checks if items are enabled */
  661.     PHWarehouseManager.prototype.isItemEnabled = function() {
  662.         if (this._warehouses[this._lastActive].rule == null || (this._rules.hasOwnProperty(this._warehouses[this._lastActive].rule) && Array.isArray(this._rules[this._warehouses[this._lastActive].rule].enabledItems.item))) {
  663.             return true;
  664.         }
  665.         return false;
  666.     };
  667.  
  668.     /* Checks if weapons are enabled */
  669.     PHWarehouseManager.prototype.isWeaponEnabled = function() {
  670.         if (this._warehouses[this._lastActive].rule == null || (this._rules.hasOwnProperty(this._warehouses[this._lastActive].rule) && Array.isArray(this._rules[this._warehouses[this._lastActive].rule].enabledItems.weapon))) {
  671.             return true;
  672.         }
  673.         return false;
  674.     };
  675.  
  676.     /* Checks if armors are enabled */
  677.     PHWarehouseManager.prototype.isArmorEnabled = function() {
  678.         if (this._warehouses[this._lastActive].rule == null || (this._rules.hasOwnProperty(this._warehouses[this._lastActive].rule) && Array.isArray(this._rules[this._warehouses[this._lastActive].rule].enabledItems.armor))) {
  679.             return true;
  680.         }
  681.         return false;
  682.     };
  683.  
  684.     /* Checks if key items are enabled */
  685.     PHWarehouseManager.prototype.isKeyItemEnabled = function() {
  686.         if (this._warehouses[this._lastActive].rule == null || (this._rules.hasOwnProperty(this._warehouses[this._lastActive].rule) && Array.isArray(this._rules[this._warehouses[this._lastActive].rule].enabledItems.keyItem))) {
  687.             return true;
  688.         }
  689.         return false;
  690.     };
  691.  
  692.     /* Verifies if an item is allowed to be withdrawn or deposited */
  693.     PHWarehouseManager.prototype.verifyItem = function(item) {
  694.         if (item == undefined) return false;
  695.         this.verifyAllTogether(item);
  696.         if (this._warehouses[this._lastActive].rule == null ||
  697.                 (this._rules.hasOwnProperty(this._warehouses[this._lastActive].rule) &&
  698.                 Array.isArray(this._rules[this._warehouses[this._lastActive].rule].enabledItems[this._lastCategory]) &&
  699.                     (this._rules[this._warehouses[this._lastActive].rule].enabledItems[this._lastCategory].indexOf(item.id) > -1) ||
  700.                     this._rules[this._warehouses[this._lastActive].rule].enabledItems[this._lastCategory].length == 0)) {
  701.  
  702.             /* Makes a second checking to see if this item is disabled */
  703.             if (this._warehouses[this._lastActive].rule !== null &&
  704.                 Array.isArray(this._rules[this._warehouses[this._lastActive].rule].disabledItems[this._lastCategory]) &&
  705.                 this._rules[this._warehouses[this._lastActive].rule].disabledItems[this._lastCategory].indexOf(item.id) > -1) {
  706.                 return false;
  707.             }
  708.             return true;
  709.         }
  710.         return false;
  711.     };
  712.  
  713.     /* Changes the last category if "all together" are set as true */
  714.     PHWarehouseManager.prototype.verifyAllTogether = function(item) {
  715.         if (PHPlugins.Params.PHWarehouseAllTogether == true) {
  716.             if (DataManager.isItem(item) && item.itypeId === 1) {
  717.                 this._lastCategory = 'item';
  718.             } else if (DataManager.isArmor(item)) {
  719.                 this._lastCategory = 'armor';
  720.             } else if (DataManager.isWeapon(item)) {
  721.                 this._lastCategory = 'weapon';
  722.             } else if (DataManager.isItem(item) && item.itypeId === 2) {
  723.                 this._lastCategory = 'keyItem';
  724.             }
  725.         }
  726.     };
  727.  
  728.     /* Undo what the previous function has done */
  729.     PHWarehouseManager.prototype.undoAllTogetherVerification = function() {
  730.         if (PHPlugins.Params.PHWarehouseAllTogether == true) {
  731.             this._lastCategory = 'all';
  732.         }
  733.     };
  734.  
  735.     /* Changes the maximum capacity of the warehouse for the given title */
  736.     PHWarehouseManager.prototype.setMaxCapacity = function(_sentence) {
  737.         var matches = this.checkSentence(_sentence);
  738.         if (matches != null) {
  739.             var results = matches.split(":");
  740.             if (results.length == 2) {
  741.                 var title = results[0];
  742.                 var capacity = parseInt(results[1]);
  743.                 if (this._warehouses.hasOwnProperty(title) && !isNaN(capacity) && (capacity >= this.getCurrentCapacity(title) || capacity == 0)) {
  744.                     this._warehouses[title].maxCapacity = capacity;
  745.                     if (this._warehouses[title].maxCapacity < 0) {
  746.                         this._warehouses[title].maxCapacity = 0;
  747.                     }
  748.                 }
  749.             }
  750.         }
  751.     };
  752.  
  753.     /* Increases the maximum capacity of the warehouse for the given title */
  754.     PHWarehouseManager.prototype.increaseMaxCapacity = function(_sentence) {
  755.         var matches = this.checkSentence(_sentence);
  756.         if (matches != null) {
  757.             var results = matches.split(":");
  758.             if (results.length == 2) {
  759.                 var title = results[0];
  760.                 var capacity = parseInt(results[1]);
  761.                 if (this._warehouses.hasOwnProperty(title) && !isNaN(capacity) && (this._warehouses[title].maxCapacity + capacity) >= this.getCurrentCapacity(title)) {
  762.                     this._warehouses[title].maxCapacity += capacity;
  763.                     if (this._warehouses[title].maxCapacity < 0) {
  764.                         this._warehouses[title].maxCapacity = 0;
  765.                     }
  766.                 }
  767.             }
  768.         }
  769.     };
  770.  
  771.     /* Decreases the maximum capacity of the warehouse for the given title */
  772.     PHWarehouseManager.prototype.decreaseMaxCapacity = function(_sentence) {
  773.         var matches = this.checkSentence(_sentence);
  774.         if (matches != null) {
  775.             var results = matches.split(":");
  776.             if (results.length == 2) {
  777.                 var title = results[0];
  778.                 var capacity = parseInt(results[1]);
  779.                 if (this._warehouses.hasOwnProperty(title) && !isNaN(capacity) && (this._warehouses[title].maxCapacity - capacity) >= this.getCurrentCapacity(title)) {
  780.                     this._warehouses[title].maxCapacity -= capacity;
  781.                     if (this._warehouses[title].maxCapacity < 1) {
  782.                         this._warehouses[title].maxCapacity = 1;
  783.                     }
  784.                 }
  785.             }
  786.         }
  787.     };
  788.  
  789.  
  790.  
  791.     /* ---- MANAGEMENT METHODS ---- */
  792.  
  793.     /* Get all the items from the current warehouse */
  794.     PHWarehouseManager.prototype.getItems = function() {
  795.         var totalItems = this.getCommonItems();
  796.         totalItems = totalItems.concat(this.getArmors());
  797.         totalItems = totalItems.concat(this.getKeyItems());
  798.         totalItems = totalItems.concat(this.getWeapons());
  799.         return totalItems;
  800.     };
  801.  
  802.     /* Get weapon items */
  803.     PHWarehouseManager.prototype.getWeapons = function() {
  804.         var totalItems = [];
  805.         for (var i = 0; i < this._warehouses[this._lastActive].items.weapon.length; i++) {
  806.             for (var j = 0; j < $dataWeapons.length; j++) {
  807.                 if ($dataWeapons[j] != null && this._warehouses[this._lastActive].items.weapon[i] == $dataWeapons[j].id) {
  808.                     totalItems.push($dataWeapons[j]);
  809.                 }
  810.             }
  811.         }
  812.         return totalItems;
  813.     };
  814.  
  815.     /* Get common items */
  816.     PHWarehouseManager.prototype.getCommonItems = function() {
  817.         var totalItems = [];
  818.         for (var i = 0; i < this._warehouses[this._lastActive].items.item.length; i++) {
  819.             for (var j = 0; j < $dataItems.length; j++) {
  820.                 if ($dataItems[j] != null && this._warehouses[this._lastActive].items.item[i] == $dataItems[j].id) {
  821.                     totalItems.push($dataItems[j]);
  822.                 }
  823.             }
  824.         }
  825.         return totalItems;
  826.     };
  827.  
  828.     /* Get armor items */
  829.     PHWarehouseManager.prototype.getArmors = function() {
  830.         var totalItems = [];
  831.         for (var i = 0; i < this._warehouses[this._lastActive].items.armor.length; i++) {
  832.             for (var j = 0; j < $dataArmors.length; j++) {
  833.                 if ($dataArmors[j] != null && this._warehouses[this._lastActive].items.armor[i] == $dataArmors[j].id) {
  834.                     totalItems.push($dataArmors[j]);
  835.                 }
  836.             }
  837.         }
  838.         return totalItems;
  839.     };
  840.  
  841.     /* Get key items */
  842.     PHWarehouseManager.prototype.getKeyItems = function() {
  843.         var totalItems = [];
  844.         for (var i = 0; i < this._warehouses[this._lastActive].items.keyItem.length; i++) {
  845.             for (var j = 0; j < $dataItems.length; j++) {
  846.                 if ($dataItems[j] != null && this._warehouses[this._lastActive].items.keyItem[i] == $dataItems[j].id) {
  847.                     totalItems.push($dataItems[j]);
  848.                 }
  849.             }
  850.         }
  851.         return totalItems;
  852.     };
  853.  
  854.     /* Get the quantity for the corresponding item */
  855.     PHWarehouseManager.prototype.getQuantity = function(item) {
  856.         this.verifyAllTogether(item);
  857.         var qtty = this._warehouses[this._lastActive].qtty[this._lastCategory][item.id];
  858.         this.undoAllTogetherVerification();
  859.         return qtty;
  860.     };
  861.  
  862.     /* Checks whether or not the warehouse is already full */
  863.     PHWarehouseManager.prototype.checkCapacity = function() {
  864.         var capacity = this.getCurrentCapacity(this._lastActive);
  865.         const maxCapacity = this._warehouses[this._lastActive].maxCapacity;
  866.         if ((capacity < maxCapacity) || (maxCapacity == 0)) {
  867.             return true;
  868.         }
  869.         return false;
  870.     };
  871.  
  872.  
  873.  
  874.     /* ---- OPERATION METHODS ---- */
  875.  
  876.     /* Deposit on warehouse */
  877.     PHWarehouseManager.prototype.deposit = function(item) {
  878.         if (this.checkCapacity()) {
  879.  
  880.             this.verifyAllTogether(item);
  881.             if (this._lastCategory != 'all') {
  882.                 var hasItem = false;
  883.                 if (this._warehouses[this._lastActive].items[this._lastCategory].indexOf(item.id) > -1) {
  884.                     hasItem = true;
  885.                 }
  886.  
  887.                 if (hasItem) {
  888.                     this._warehouses[this._lastActive].qtty[this._lastCategory][item.id]++;
  889.                 } else {
  890.                     this._warehouses[this._lastActive].items[this._lastCategory].push(item.id);
  891.                     this._warehouses[this._lastActive].qtty[this._lastCategory][item.id] = 1;
  892.                 }
  893.                 this._warehouses[this._lastActive].currentCapacity++;
  894.             }
  895.             this.undoAllTogetherVerification();
  896.  
  897.         }
  898.  
  899.     };
  900.  
  901.     /* Withdraw from a warehouse */
  902.     PHWarehouseManager.prototype.withdraw = function(item) {
  903.  
  904.         this.verifyAllTogether(item);
  905.  
  906.         if (this._lastCategory != 'all') {
  907.             var hasItem = false;
  908.             var index = this._warehouses[this._lastActive].items[this._lastCategory].indexOf(item.id);
  909.             if (index > -1) {
  910.                 hasItem = true;
  911.             }
  912.  
  913.             if (hasItem) {
  914.                 this._warehouses[this._lastActive].qtty[this._lastCategory][item.id]--;
  915.                 if (this._warehouses[this._lastActive].qtty[this._lastCategory][item.id] == 0) {
  916.                     this._warehouses[this._lastActive].items[this._lastCategory].splice(index, 1);
  917.                     delete this._warehouses[this._lastActive].qtty[this._lastCategory][item.id];
  918.                 }
  919.                 this._warehouses[this._lastActive].currentCapacity--;
  920.             }
  921.         }
  922.  
  923.         this.undoAllTogetherVerification();
  924.  
  925.     };
  926.  
  927.  
  928.  
  929.     /* ---- INTERNAL METHODS ---- */
  930.  
  931.     /* Check sentences coming from the arguments */
  932.     PHWarehouseManager.prototype.checkSentence = function(_sentence) {
  933.         var regExp = /\<([^)]+)\>/;
  934.         var matches = regExp.exec(_sentence);
  935.         if (matches != null) {
  936.             return this.convertEscapeCharacters(matches[1]);
  937.         } else {
  938.             return null;
  939.         }
  940.     };
  941.  
  942.     PHWarehouseManager.prototype.convertEscapeCharacters = function(text) {
  943.         while (text.match(/\\V\[(\d+)\]/gi)) {
  944.             text = text.replace(/\\V\[(\d+)\]/gi, (_, p1) =>
  945.                 $gameVariables.value(parseInt(p1))
  946.             );
  947.         }
  948.         text = text.replace(/\\N\[(\d+)\]/gi, (_, p1) =>
  949.             this.actorName(parseInt(p1))
  950.         );
  951.         text = text.replace(/\\P\[(\d+)\]/gi, (_, p1) =>
  952.             this.partyMemberName(parseInt(p1))
  953.         );
  954.         return text;
  955.     };
  956.  
  957.     PHWarehouseManager.prototype.actorName = function(n) {
  958.         const actor = n >= 1 ? $gameActors.actor(n) : null;
  959.         return actor ? actor.name() : "";
  960.     };
  961.    
  962.     PHWarehouseManager.prototype.partyMemberName = function(n) {
  963.         const actor = n >= 1 ? $gameParty.members()[n - 1] : null;
  964.         return actor ? actor.name() : "";
  965.     };
  966.  
  967.     /* Main method for checking items inside warehouses */
  968.     PHWarehouseManager.prototype.hasItems = function(title, id, category) {
  969.         if (this._warehouses.hasOwnProperty(title) && this._warehouses[title].items[category].indexOf(id) > -1) {
  970.             return this._warehouses[title].qtty[category][id];
  971.         }
  972.         return 0;
  973.     };
  974.  
  975.  
  976.  
  977.     /* ---- ACCESSOR METHODS ---- */
  978.  
  979.     /* Return the value of the maximum capacity of the warehouse for the given title */
  980.     PHWarehouseManager.prototype.getMaxCapacity = function(title) {
  981.         if (this._warehouses.hasOwnProperty(title)) {
  982.             return this._warehouses[title].maxCapacity;
  983.         }
  984.         return -1;
  985.     };
  986.  
  987.     /* Return the value of the quantity of items in the warehouse for the given title */
  988.     PHWarehouseManager.prototype.getCurrentCapacity = function(title) {
  989.         if (this._warehouses.hasOwnProperty(title)) {
  990.             if (PHPlugins.Params.PHWarehouseStackItemQuantity == true) {
  991.                 return (this._warehouses[title].items.item.length + this._warehouses[title].items.weapon.length + this._warehouses[title].items.keyItem.length + this._warehouses[title].items.armor.length);
  992.             } else {
  993.                 return this._warehouses[title].currentCapacity;
  994.             }
  995.         }
  996.         return 0;
  997.     };
  998.  
  999.     /* Return whether or not the warehouse for the given title exists */
  1000.     PHWarehouseManager.prototype.exist = function(title) {
  1001.         if (this._warehouses.hasOwnProperty(title) && this._warehouses[title] !== undefined) {
  1002.             return true;
  1003.         }
  1004.         return false;
  1005.     };
  1006.  
  1007.     /* Checks if the given warehouse has an item */
  1008.     PHWarehouseManager.prototype.hasItem = function(title, id) {
  1009.         return this.hasItems(title, id, 'item');
  1010.     };
  1011.  
  1012.     /* Checks if the given warehouse has a weapon */
  1013.     PHWarehouseManager.prototype.hasWeapon = function(title, id) {
  1014.         return this.hasItems(title, id, 'weapon');
  1015.     };
  1016.  
  1017.     /* Checks if the given warehouse has an armor */
  1018.     PHWarehouseManager.prototype.hasArmor = function(title, id) {
  1019.         return this.hasItems(title, id, 'armor');
  1020.     };
  1021.  
  1022.     /* Checks if the given warehouse has a key item */
  1023.     PHWarehouseManager.prototype.hasKeyItem = function(title, id) {
  1024.         return this.hasItems(title, id, 'keyItem');
  1025.     };
  1026.  
  1027.  
  1028.  
  1029.     /* ---------------------------------------------------------- *
  1030.      *                      LOADING PROCESS                       *
  1031.      * ---------------------------------------------------------- */
  1032.  
  1033.     /* Creating PHWarehouse variable after loading the whole database */
  1034.     var _DataManager_createGameObjects_ = DataManager.createGameObjects;
  1035.     DataManager.createGameObjects = function() {
  1036.         _DataManager_createGameObjects_.call(this);
  1037.         PHPlugins.PHWarehouse = new PHWarehouseManager();
  1038.         PHPlugins.PHWarehouse.loadRules();
  1039.     };
  1040.  
  1041.     /* Saves the warehouses when the player saves the game */
  1042.     var _DataManager_makeSaveContents_ = DataManager.makeSaveContents;
  1043.     DataManager.makeSaveContents = function() {
  1044.         var contents = _DataManager_makeSaveContents_.call(this);
  1045.         contents.phwarehouse = PHPlugins.PHWarehouse._warehouses;
  1046.         return contents;
  1047.     };
  1048.  
  1049.     /* Retrieve the warehouses from the save content */
  1050.     var _DataManager_extractSaveContents_ = DataManager.extractSaveContents;
  1051.     DataManager.extractSaveContents = function(contents) {
  1052.         _DataManager_extractSaveContents_.call(this, contents);
  1053.         PHPlugins.PHWarehouse = new PHWarehouseManager();
  1054.         PHPlugins.PHWarehouse._warehouses = contents.phwarehouse;
  1055.         PHPlugins.PHWarehouse.loadRules();
  1056.     };
  1057.  
  1058.     var getAllArguments = function(args, startIndex) {
  1059.         var str = args[startIndex].toString();
  1060.         for (var i = (startIndex+1); i < args.length; i++) {
  1061.             str += ' ' + args[i].toString();
  1062.         }
  1063.         return str;
  1064.     };
  1065.  
  1066.     var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  1067.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  1068.         _Game_Interpreter_pluginCommand.call(this, command, args);
  1069.         if (command === 'PHWarehouse') {
  1070.             switch (args[0]) {
  1071.                 case 'create':
  1072.                     PHPlugins.PHWarehouse.createWarehouse(getAllArguments(args, 1));
  1073.                     break;
  1074.                 case 'show':
  1075.                     PHPlugins.PHWarehouse.openWarehouse(getAllArguments(args, 1));
  1076.                     SceneManager.push(Scene_Warehouse);
  1077.                     break;
  1078.                 case 'remove':
  1079.                     PHPlugins.PHWarehouse.removeWarehouse(getAllArguments(args, 1));
  1080.                     break;
  1081.                 case 'add':
  1082.                     switch (args[1]) {
  1083.                         case 'item':
  1084.                             PHPlugins.PHWarehouse.addItems(getAllArguments(args, 2), 'item');
  1085.                             break;
  1086.                         case 'weapon':
  1087.                             PHPlugins.PHWarehouse.addItems(getAllArguments(args, 2), 'weapon');
  1088.                             break;
  1089.                         case 'armor':
  1090.                             PHPlugins.PHWarehouse.addItems(getAllArguments(args, 2), 'armor');
  1091.                             break;
  1092.                         case 'keyItem':
  1093.                             PHPlugins.PHWarehouse.addItems(getAllArguments(args, 2), 'keyItem');
  1094.                             break;
  1095.                     }
  1096.                     break;
  1097.                 case 'capacity':
  1098.                     switch (args[1]) {
  1099.                         case 'increase':
  1100.                             PHPlugins.PHWarehouse.increaseMaxCapacity(getAllArguments(args, 2));
  1101.                             break;
  1102.                         case 'decrease':
  1103.                             PHPlugins.PHWarehouse.decreaseMaxCapacity(getAllArguments(args, 2));
  1104.                             break;
  1105.                         case 'set':
  1106.                             PHPlugins.PHWarehouse.setMaxCapacity(getAllArguments(args, 2));
  1107.                             break;
  1108.                     }
  1109.                     break;
  1110.                 case 'loot':
  1111.                     switch (args[1]) {
  1112.                         case 'item':
  1113.                             PHPlugins.PHWarehouse.addLoot(getAllArguments(args, 2), 'item');
  1114.                             break;
  1115.                         case 'weapon':
  1116.                             PHPlugins.PHWarehouse.addLoot(getAllArguments(args, 2), 'weapon');
  1117.                             break;
  1118.                         case 'armor':
  1119.                             PHPlugins.PHWarehouse.addLoot(getAllArguments(args, 2), 'armor');
  1120.                             break;
  1121.                         case 'keyItem':
  1122.                             PHPlugins.PHWarehouse.addLoot(getAllArguments(args, 2), 'keyItem');
  1123.                             break;
  1124.                     }
  1125.                     break;
  1126.             }
  1127.         }
  1128.     };
  1129.  
  1130.     const pluginName = 'PH_WarehouseMZ';
  1131.  
  1132.     PluginManager.registerCommand(pluginName, 'create', args => {
  1133.         let command = '<' + args.warehouseName.trim();
  1134.         if (args.maxCapacity)
  1135.             command += ':' + args.maxCapacity;
  1136.         if (args.ruleName)
  1137.             command += ':' + args.ruleName.trim();
  1138.         command += '>';
  1139.         PHPlugins.PHWarehouse.createWarehouse(command);
  1140.     });
  1141.  
  1142.     PluginManager.registerCommand(pluginName, 'show', args => {
  1143.         PHPlugins.PHWarehouse.openWarehouse('<' + args.warehouseName.trim() + '>');
  1144.         SceneManager.push(Scene_Warehouse);
  1145.     });
  1146.  
  1147.     PluginManager.registerCommand(pluginName, 'remove', args => {
  1148.         PHPlugins.PHWarehouse.removeWarehouse('<' + args.warehouseName.trim() + '>');
  1149.     });
  1150.  
  1151.     PluginManager.registerCommand(pluginName, 'lootItem', args => {
  1152.         const item = $dataItems[Number(args.id)];
  1153.         if (args.quantity == 0 || !DataManager.isItem(item))
  1154.             return;
  1155.         const type = (item.itypeId === 2) ? 'keyItem' : 'item';
  1156.         PHPlugins.PHWarehouse.addLoot(`<${args.warehouseName.trim()}:${args.id}:${args.quantity}>`, type);
  1157.     });
  1158.  
  1159.     PluginManager.registerCommand(pluginName, 'lootWeapon', args => {
  1160.         if (args.quantity == 0 || !DataManager.isWeapon($dataWeapons[Number(args.id)]))
  1161.             return;
  1162.         PHPlugins.PHWarehouse.addLoot(`<${args.warehouseName.trim()}:${args.id}:${args.quantity}>`, 'weapon');
  1163.     });
  1164.  
  1165.     PluginManager.registerCommand(pluginName, 'lootArmor', args => {
  1166.         if (args.quantity == 0 || !DataManager.isArmor($dataArmors[Number(args.id)]))
  1167.             return;
  1168.         PHPlugins.PHWarehouse.addLoot(`<${args.warehouseName.trim()}:${args.id}:${args.quantity}>`, 'armor');
  1169.     });
  1170.  
  1171.     PluginManager.registerCommand(pluginName, 'addItem', args => {
  1172.         const item = $dataItems[Number(args.id)];
  1173.         if (args.quantity == 0 || !DataManager.isItem(item))
  1174.             return;
  1175.         const type = (item.itypeId === 2) ? 'keyItem' : 'item';
  1176.         PHPlugins.PHWarehouse.addItems(`<${args.warehouseName.trim()}:${args.id}:${args.quantity}>`, type);
  1177.     });
  1178.  
  1179.     PluginManager.registerCommand(pluginName, 'addWeapon', args => {
  1180.         if (args.quantity == 0 || !DataManager.isWeapon($dataWeapons[Number(args.id)]))
  1181.             return;
  1182.         PHPlugins.PHWarehouse.addItems(`<${args.warehouseName.trim()}:${args.id}:${args.quantity}>`, 'weapon');
  1183.     });
  1184.  
  1185.     PluginManager.registerCommand(pluginName, 'addArmor', args => {
  1186.         if (args.quantity == 0 || !DataManager.isArmor($dataArmors[Number(args.id)]))
  1187.             return;
  1188.         PHPlugins.PHWarehouse.addItems(`<${args.warehouseName.trim()}:${args.id}:${args.quantity}>`, 'armor');
  1189.     });
  1190.  
  1191.     PluginManager.registerCommand(pluginName, 'setCapacity', args => {
  1192.         PHPlugins.PHWarehouse.setMaxCapacity(`<${args.warehouseName.trim()}:${args.newCapacity}>`);
  1193.     });
  1194.  
  1195.     PluginManager.registerCommand(pluginName, 'incCapacity', args => {
  1196.         PHPlugins.PHWarehouse.increaseMaxCapacity(`<${args.warehouseName.trim()}:${args.incAmount}>`);
  1197.     });
  1198.  
  1199.     PluginManager.registerCommand(pluginName, 'decCapacity', args => {
  1200.         PHPlugins.PHWarehouse.decreaseMaxCapacity(`<${args.warehouseName.trim()}:${args.decAmount}>`);
  1201.     });
  1202.  
  1203.  
  1204.  
  1205.     /* ---------------------------------------------------------- *
  1206.      *                       WINDOW PROCESS                       *
  1207.      * ---------------------------------------------------------- */
  1208.  
  1209.     //-----------------------------------------------------------------------------
  1210.     // Window_WarehouseTitle
  1211.     //
  1212.  
  1213.     function Window_WarehouseTitle() {
  1214.         this.initialize(...arguments);
  1215.     }
  1216.     Window_WarehouseTitle.prototype = Object.create(Window_Base.prototype);
  1217.     Window_WarehouseTitle.prototype.constructor = Window_WarehouseTitle;
  1218.  
  1219.     Window_WarehouseTitle.prototype.initialize = function(rect) {
  1220.         Window_Base.prototype.initialize.call(this, rect);
  1221.         this.refresh();
  1222.     };
  1223.  
  1224.     Window_WarehouseTitle.prototype.refresh = function() {
  1225.         this.contents.clear();
  1226.         this.changeTextColor(ColorManager.crisisColor());
  1227.         this.drawText(PHPlugins.PHWarehouse._lastActive, 0, 0, Graphics.boxWidth, "center");
  1228.     };
  1229.  
  1230.     //-----------------------------------------------------------------------------
  1231.     // Window_WarehouseOption
  1232.     //
  1233.  
  1234.     function Window_WarehouseOption() {
  1235.         this.initialize(...arguments);
  1236.     }
  1237.     Window_WarehouseOption.prototype = Object.create(Window_Selectable.prototype);
  1238.     Window_WarehouseOption.prototype.constructor = Window_WarehouseOption;
  1239.  
  1240.     Window_WarehouseOption.prototype.initialize = function(rect) {
  1241.         Window_Selectable.prototype.initialize.call(this, rect);
  1242.         this.withdrawText = PHPlugins.Params.PHWarehouseWithdrawText;
  1243.         this.depositText = PHPlugins.Params.PHWarehouseDepositText;
  1244.         this.refresh();
  1245.         this.select(0);
  1246.         this.activate();
  1247.     };
  1248.  
  1249.     Window_WarehouseOption.prototype.maxItems = function() {
  1250.         return 2;
  1251.     };
  1252.  
  1253.     Window_WarehouseOption.prototype.maxCols = function() {
  1254.         return 2;
  1255.     };
  1256.  
  1257.     Window_WarehouseOption.prototype.changeOption = function() {
  1258.         PHPlugins.PHWarehouse._lastOption = this._index;
  1259.     };
  1260.  
  1261.     Window_WarehouseOption.prototype.drawItem = function(index) {
  1262.         const rect = this.itemLineRect(index);
  1263.         const align = 'center';
  1264.         this.resetTextColor();
  1265.         this.changePaintOpacity(true);
  1266.         this.drawText(this.commandName(index), rect.x, rect.y, rect.width, align);
  1267.     };
  1268.  
  1269.     Window_WarehouseOption.prototype.commandName = function(index) {
  1270.         return (index === 0) ? this.withdrawText : this.depositText;
  1271.     };
  1272.  
  1273.     //-----------------------------------------------------------------------------
  1274.     // Window_WarehouseCategory
  1275.     //
  1276.  
  1277.     function Window_WarehouseCategory() {
  1278.         this.initialize(...arguments);
  1279.     }
  1280.     Window_WarehouseCategory.prototype = Object.create(Window_ItemCategory.prototype);
  1281.     Window_WarehouseCategory.prototype.constructor = Window_WarehouseCategory;
  1282.  
  1283.     Window_WarehouseCategory.prototype.initialize = function(rect) {
  1284.         Window_ItemCategory.prototype.initialize.call(this, rect);
  1285.         this.deselect();
  1286.         this.deactivate();
  1287.     };
  1288.  
  1289.     Window_WarehouseCategory.prototype.changeCategory = function() {
  1290.         PHPlugins.PHWarehouse._lastCategory = this.currentSymbol() || "item";
  1291.     };
  1292.  
  1293.     Window_WarehouseCategory.prototype.maxCols = function() {
  1294.         if (PHPlugins.Params.PHWarehouseAllTogether == true) {
  1295.             return 1;
  1296.         }
  1297.         var cols = 0;
  1298.         if (PHPlugins.PHWarehouse.isItemEnabled()) {
  1299.             cols++;
  1300.         }
  1301.         if (PHPlugins.PHWarehouse.isWeaponEnabled()) {
  1302.             cols++;
  1303.         }
  1304.         if (PHPlugins.PHWarehouse.isArmorEnabled()) {
  1305.             cols++;
  1306.         }
  1307.         if (PHPlugins.PHWarehouse.isKeyItemEnabled()) {
  1308.             cols++;
  1309.         }
  1310.         return cols;
  1311.     };
  1312.  
  1313.     Window_WarehouseCategory.prototype.makeCommandList = function() {
  1314.         if (PHPlugins.Params.PHWarehouseAllTogether == true) {
  1315.             this.addCommand(PHPlugins.Params.PHWarehouseAllText, 'all');
  1316.         } else {
  1317.             if (PHPlugins.PHWarehouse.isItemEnabled()) {
  1318.                 this.addCommand(TextManager.item, 'item');
  1319.             }
  1320.             if (PHPlugins.PHWarehouse.isWeaponEnabled()) {
  1321.                 this.addCommand(TextManager.weapon, 'weapon');
  1322.             }
  1323.             if (PHPlugins.PHWarehouse.isArmorEnabled()) {
  1324.                 this.addCommand(TextManager.armor, 'armor');
  1325.             }
  1326.             if (PHPlugins.PHWarehouse.isKeyItemEnabled()) {
  1327.                 this.addCommand(TextManager.keyItem, 'keyItem');
  1328.             }
  1329.         }
  1330.     };
  1331.  
  1332.     Window_WarehouseCategory.prototype.setItemWindow = function(itemWindow) {
  1333.         this._itemWindow = itemWindow;
  1334.         this.update();
  1335.     };
  1336.  
  1337.     Window_WarehouseCategory.prototype.update = function() {
  1338.         Window_HorzCommand.prototype.update.call(this);
  1339.         if (this._itemWindow) {
  1340.             this._itemWindow.setCategory(this.currentSymbol());
  1341.         }
  1342.         this.changeCategory();
  1343.         this._itemWindow.refresh();
  1344.     };
  1345.  
  1346.     Window_WarehouseCategory.prototype.processHandling = function() {
  1347.         Window_HorzCommand.prototype.processHandling.call(this);
  1348.     };
  1349.  
  1350.     Window_WarehouseCategory.prototype.drawItem = function(index) {
  1351.         Window_HorzCommand.prototype.drawItem.call(this, index);
  1352.     };
  1353.  
  1354.     Window_WarehouseCategory.prototype.callUpdateHelp = function() {
  1355.         Window_HorzCommand.prototype.callUpdateHelp.call(this);
  1356.     };
  1357.  
  1358.     Window_WarehouseCategory.prototype.createCategoryNameWindow = function(rect) {
  1359.         // dummy function to prevent some VisuStella incompatibility
  1360.     };
  1361.  
  1362.     //-----------------------------------------------------------------------------
  1363.     // Window_WarehouseItemList
  1364.     //
  1365.  
  1366.     function Window_WarehouseItemList() {
  1367.         this.initialize(...arguments);
  1368.     }
  1369.     Window_WarehouseItemList.prototype = Object.create(Window_ItemList.prototype);
  1370.     Window_WarehouseItemList.prototype.constructor = Window_WarehouseItemList;
  1371.  
  1372.     Window_WarehouseItemList.prototype.initialize = function(rect) {
  1373.         Window_ItemList.prototype.initialize.call(this, rect);
  1374.     };
  1375.  
  1376.     Window_WarehouseItemList.prototype.isCurrentItemEnabled = function() {
  1377.         if (this._data.length > 0) {
  1378.             if (PHPlugins.PHWarehouse._lastOption == 1 && PHPlugins.PHWarehouse.checkCapacity()) {
  1379.                 return true;
  1380.             } else if (PHPlugins.PHWarehouse._lastOption == 0) {
  1381.                 return true;
  1382.             } else {
  1383.                 return false;
  1384.             }
  1385.         }
  1386.         return false;
  1387.     };
  1388.  
  1389.     Window_WarehouseItemList.prototype.includes = function(item) {
  1390.         switch (this._category) {
  1391.             case "item":
  1392.                 return DataManager.isItem(item) && item.itypeId === 1;
  1393.             case "weapon":
  1394.                 return DataManager.isWeapon(item);
  1395.             case "armor":
  1396.                 return DataManager.isArmor(item);
  1397.             case "keyItem":
  1398.                 return DataManager.isItem(item) && item.itypeId === 2;
  1399.             case "all":
  1400.                 return ((DataManager.isItem(item) && item.itypeId === 1) || (DataManager.isWeapon(item)) || (DataManager.isArmor(item)) || (DataManager.isItem(item) && item.itypeId === 2));
  1401.             default:
  1402.                 return false;
  1403.         }
  1404.     };
  1405.  
  1406.     Window_WarehouseItemList.prototype.makeWarehouseItemList = function() {
  1407.         this._data = PHPlugins.PHWarehouse.getItems().filter(item => this.includes(item));
  1408.         if (this.includes(null)) {
  1409.             this._data.push(null);
  1410.         }
  1411.     };
  1412.  
  1413.     Window_WarehouseItemList.prototype.makeDepositAllItemList = function() {
  1414.         this._data = $gameParty.allItems();
  1415.     };
  1416.  
  1417.     Window_WarehouseItemList.prototype.loadItems = function() {
  1418.  
  1419.         // Deposit
  1420.         if (PHPlugins.PHWarehouse._lastOption == 1) {
  1421.             this.makeItemList();
  1422.         }
  1423.  
  1424.         // Withdraw
  1425.         else if (PHPlugins.PHWarehouse._lastOption == 0) {
  1426.             this.makeWarehouseItemList();
  1427.         }
  1428.  
  1429.     };
  1430.  
  1431.     Window_WarehouseItemList.prototype.drawItem = function(index) {
  1432.         var item = this._data[index];
  1433.         if (item) {
  1434.             var numberWidth = this.numberWidth();
  1435.             var rect = this.itemLineRect(index);
  1436.  
  1437.             this.changePaintOpacity(PHPlugins.PHWarehouse.verifyItem(item));
  1438.             this.drawItemName(item, rect.x, rect.y, rect.width - numberWidth);
  1439.  
  1440.             if (PHPlugins.PHWarehouse._lastOption == 1) {
  1441.                 this.drawItemNumber(item, rect.x, rect.y, rect.width);
  1442.             } else if (PHPlugins.PHWarehouse._lastOption == 0) {
  1443.                 this.drawWarehouseItemNumber(item, rect.x, rect.y, rect.width);
  1444.             }
  1445.  
  1446.             this.changePaintOpacity(1);
  1447.         }
  1448.     };
  1449.  
  1450.     Window_WarehouseItemList.prototype.drawWarehouseItemNumber = function(item, x, y, width) {
  1451.         var qtty = PHPlugins.PHWarehouse.getQuantity(item);
  1452.         this.drawText(':', x, y, width - this.textWidth('00'), 'right');
  1453.         this.drawText(qtty, x, y, width, 'right');
  1454.     };
  1455.  
  1456.     Window_WarehouseItemList.prototype.refresh = function() {
  1457.         this.loadItems();
  1458.         Window_Selectable.prototype.refresh.call(this);
  1459.     };
  1460.  
  1461.     Window_WarehouseItemList.prototype.moveItem = function() {
  1462.  
  1463.         var item = this.item();
  1464.  
  1465.         // Deposit
  1466.         if (PHPlugins.PHWarehouse._lastOption == 1) {
  1467.             if (PHPlugins.PHWarehouse.checkCapacity() && PHPlugins.PHWarehouse.verifyItem(item)) {
  1468.                 SoundManager.playEquip();
  1469.                 PHPlugins.PHWarehouse.deposit(item);
  1470.                 $gameParty.loseItem(item, 1);
  1471.             } else {
  1472.                 SoundManager.playBuzzer();
  1473.             }
  1474.         }
  1475.  
  1476.         // Withdraw
  1477.         else if (PHPlugins.PHWarehouse._lastOption == 0) {
  1478.             if (PHPlugins.PHWarehouse.verifyItem(item)) {
  1479.                 var numItems = $gameParty.numItems(item);
  1480.                 $gameParty.gainItem(item, 1);
  1481.                 if (numItems < $gameParty.numItems(item)) {
  1482.                     SoundManager.playEquip();
  1483.                     PHPlugins.PHWarehouse.withdraw(item);
  1484.                 } else {
  1485.                     SoundManager.playBuzzer();
  1486.                 }
  1487.             } else {
  1488.                 SoundManager.playBuzzer();
  1489.             }
  1490.         }
  1491.  
  1492.     };
  1493.  
  1494.     Window_WarehouseItemList.prototype.playOkSound = function() { };
  1495.  
  1496.     //-----------------------------------------------------------------------------
  1497.     // Window_WarehouseInfo
  1498.     //
  1499.  
  1500.     function Window_WarehouseInfo() {
  1501.         this.initialize(...arguments);
  1502.     }
  1503.     Window_WarehouseInfo.prototype = Object.create(Window_Base.prototype);
  1504.     Window_WarehouseInfo.prototype.constructor = Window_WarehouseInfo;
  1505.  
  1506.     Window_WarehouseInfo.prototype.initialize = function(rect) {
  1507.         Window_Base.prototype.initialize.call(this, rect);
  1508.         this.availableSpaceText = PHPlugins.Params.PHWarehouseAvailableSpaceText + " ";
  1509.         this.refresh();
  1510.     };
  1511.  
  1512.     Window_WarehouseInfo.prototype.refresh = function() {
  1513.         if (PHPlugins.PHWarehouse._warehouses[PHPlugins.PHWarehouse._lastActive].maxCapacity == 0)
  1514.             return;
  1515.         this.contents.clear();
  1516.         this.availableSpaceValue = (PHPlugins.PHWarehouse._warehouses[PHPlugins.PHWarehouse._lastActive].maxCapacity - PHPlugins.PHWarehouse.getCurrentCapacity(PHPlugins.PHWarehouse._lastActive)) + " / " + PHPlugins.PHWarehouse._warehouses[PHPlugins.PHWarehouse._lastActive].maxCapacity;
  1517.         this.changeTextColor(ColorManager.normalColor());
  1518.         this.drawText(this.availableSpaceText + this.availableSpaceValue, 0, 0, this.x);
  1519.     };
  1520.  
  1521.  
  1522.  
  1523.     /* ---------------------------------------------------------- *
  1524.      *                        SCENE PROCESS                       *
  1525.      * ---------------------------------------------------------- */
  1526.  
  1527.     function Scene_Warehouse() {
  1528.         this.initialize.apply(this, arguments);
  1529.     }
  1530.  
  1531.     Scene_Warehouse.prototype = Object.create(Scene_MenuBase.prototype);
  1532.     Scene_Warehouse.prototype.constructor = Scene_Warehouse;
  1533.  
  1534.     Scene_Warehouse.prototype.initialize = function() {
  1535.         Scene_MenuBase.prototype.initialize.call(this);
  1536.     };
  1537.  
  1538.     Scene_Warehouse.prototype.create = function() {
  1539.         Scene_MenuBase.prototype.create.call(this);
  1540.  
  1541.         PHPlugins.PHWarehouse._lastOption = 0;
  1542.         this.createTitle();
  1543.         this.createOptions();
  1544.         this.createCategory();
  1545.         this.createItemList();
  1546.         this.createInfoLocation();
  1547.     };
  1548.  
  1549.     Scene_Warehouse.prototype.createTitle = function() {
  1550.         const rect = this.titleWindowRect();
  1551.         this._titleWindow = new Window_WarehouseTitle(rect);
  1552.         this.addWindow(this._titleWindow);
  1553.     };
  1554.  
  1555.     Scene_Warehouse.prototype.titleWindowRect = function() {
  1556.         const wx = 0;
  1557.         const wy = this.buttonAreaBottom();
  1558.         const ww = Graphics.boxWidth;
  1559.         const wh = this.calcWindowHeight(1, false);
  1560.         return new Rectangle(wx, wy, ww, wh);
  1561.     };
  1562.  
  1563.     Scene_Warehouse.prototype.createOptions = function() {
  1564.         const rect = this.optionWindowRect();
  1565.         this._optionWindow = new Window_WarehouseOption(rect);
  1566.         this._optionWindow.setHandler('cancel', this.popScene.bind(this));
  1567.         this._optionWindow.setHandler('ok', this.onOptionOk.bind(this));
  1568.         this.addWindow(this._optionWindow);
  1569.     };
  1570.  
  1571.     Scene_Warehouse.prototype.optionWindowRect = function() {
  1572.         const wx = 0;
  1573.         const wy = this._titleWindow.y + this._titleWindow._height;
  1574.         const ww = Graphics.boxWidth;
  1575.         const wh = this.calcWindowHeight(1, true);
  1576.         return new Rectangle(wx, wy, ww, wh);
  1577.     };
  1578.  
  1579.     Scene_Warehouse.prototype.createCategory = function() {
  1580.         const rect = this.categoryWindowRect();
  1581.         this._categoryWindow = new Window_WarehouseCategory(rect);
  1582.         this._categoryWindow.setHandler('cancel', this.onCategoryCancel.bind(this));
  1583.         this._categoryWindow.setHandler('ok', this.onCategoryOk.bind(this));
  1584.         if (PHPlugins.Params.PHWarehouseAllTogether) {
  1585.             this._categoryWindow.hide();
  1586.         }
  1587.         this.addWindow(this._categoryWindow);
  1588.     };
  1589.  
  1590.     Scene_Warehouse.prototype.categoryWindowRect = function() {
  1591.         const wx = 0;
  1592.         const wy = this._optionWindow.y + this._optionWindow._height;
  1593.         const ww = Graphics.boxWidth;
  1594.         const wh = this.calcWindowHeight(1, true);
  1595.         return new Rectangle(wx, wy, ww, wh);
  1596.     };
  1597.  
  1598.     Scene_Warehouse.prototype.createItemList = function() {
  1599.         const rect = this.itemWindowRect();
  1600.         this._itemWindow = new Window_WarehouseItemList(rect);
  1601.         this._itemWindow.setHandler('ok', this.onItemOk.bind(this));
  1602.         this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
  1603.         this.addWindow(this._itemWindow);
  1604.         this._categoryWindow.setItemWindow(this._itemWindow);
  1605.     };
  1606.  
  1607.     Scene_Warehouse.prototype.itemWindowRect = function() {
  1608.         const wx = 0;
  1609.         const wy = this._categoryWindow.y + (PHPlugins.Params.PHWarehouseAllTogether ? 0 : this._categoryWindow._height);
  1610.         const ww = Graphics.boxWidth;
  1611.         const wh = Graphics.boxHeight - wy - (PHPlugins.PHWarehouse._warehouses[PHPlugins.PHWarehouse._lastActive].maxCapacity == 0 ? 0 : this.calcWindowHeight(1, false));
  1612.         return new Rectangle(wx, wy, ww, wh);
  1613.     };
  1614.  
  1615.     Scene_Warehouse.prototype.createInfoLocation = function() {
  1616.         const rect = this.infoLocationWindowRect();
  1617.         this._infoLocationWindow = new Window_WarehouseInfo(rect);
  1618.         if (PHPlugins.PHWarehouse._warehouses[PHPlugins.PHWarehouse._lastActive].maxCapacity == 0) {
  1619.             this._infoLocationWindow.hide();
  1620.         }
  1621.         this.addWindow(this._infoLocationWindow);
  1622.     };
  1623.  
  1624.     Scene_Warehouse.prototype.infoLocationWindowRect = function() {
  1625.         const wx = 0;
  1626.         const wy = this._itemWindow.y + this._itemWindow._height;
  1627.         const ww = Graphics.boxWidth;
  1628.         const wh = this.calcWindowHeight(1, false);
  1629.         return new Rectangle(wx, wy, ww, wh);
  1630.     };
  1631.  
  1632.     Scene_Warehouse.prototype.onOptionOk = function() {
  1633.         this._optionWindow.changeOption();
  1634.         this._categoryWindow.activate();
  1635.         this._categoryWindow.select(0);
  1636.         this._optionWindow.deactivate();
  1637.  
  1638.         if (PHPlugins.Params.PHWarehouseAllTogether) {
  1639.             this._categoryWindow.update();
  1640.             this.onCategoryOk();
  1641.         }
  1642.     };
  1643.  
  1644.     Scene_Warehouse.prototype.onCategoryOk = function() {
  1645.         this._itemWindow.activate();
  1646.         this._itemWindow.select(0);
  1647.         this._categoryWindow.deactivate();
  1648.     };
  1649.  
  1650.     Scene_Warehouse.prototype.onCategoryCancel = function() {
  1651.         this._categoryWindow.deselect();
  1652.         this._optionWindow.activate();
  1653.     };
  1654.  
  1655.     Scene_Warehouse.prototype.onItemCancel = function() {
  1656.         this._itemWindow.deselect();
  1657.  
  1658.         if (PHPlugins.Params.PHWarehouseAllTogether) {
  1659.             this._categoryWindow.deselect();
  1660.             this._optionWindow.activate();
  1661.         } else {
  1662.             this._categoryWindow.activate();
  1663.         }
  1664.     };
  1665.  
  1666.     Scene_Warehouse.prototype.onItemOk = function() {
  1667.         this._itemWindow.moveItem();
  1668.         this._infoLocationWindow.refresh();
  1669.         this._itemWindow.activate();
  1670.     };
  1671.  
  1672. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement