NGAL_Item_Management

Neverwinter Gateway Advanced Library - Item Management

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/9673/50215/NGAL_Item_Management.js

  1. /********
  2. * This should be reworked into:
  3. * 1. Auto Vendor items from list function
  4. * 2. Item List
  5. * 3. Item list edit feature
  6. ********
  7. */
  8.  
  9.  
  10. // MAC-NW - Auto vendor items function
  11. ///@Karlodun: functions within loops created! Maybe other rework needed!
  12. function vendorItemsLimited(_items) {
  13. var _charGold = unsafeWindow.client.dataModel.model.ent.main.currencies.gold;
  14. var _pbags = client.dataModel.model.ent.main.inventory.playerbags;
  15. var _pbags_crafting = client.dataModel.model.ent.main.inventory.tradebag; //tradebag
  16. var _delay = 400;
  17. var _sellCount = 0;
  18. var _classType = unsafeWindow.client.dataModel.model.ent.main.classtype;
  19. var _bagCount = unsafeWindow.client.dataModel.model.ent.main.inventory.playerbags.length;
  20. var _bagUsed = 0;
  21. var _bagUnused = 0;
  22. var _tmpBag1 = [];
  23. var _tmpBag2 = [];
  24. //var _tmpBag = [];
  25. var _profitems = [];
  26.  
  27. // Pattern for items to leave out of auto vendoring (safeguard)
  28. var _excludeItems = /(Charcoal|Rocksalt|Spool_Thread|Porridge|Solvent|Brimstone|Coal|Moonseasalt|Quicksilver|Spool_Threadsilk|Clues_Bandit_Hq|Clothscraps_T4|Clothbolt_T4|Potion_Potency|Potion_Protection|Taffeta|Crafting_Asset|Craftsman|Aqua|Vitriol|Residuum|Shard|Crystal|District_Map|Local_Map|Bill_Of_Sale|Refugee|Asset_Tool|Tool|Gemfood|Gem_Upgrade_Resource|Crafting_Resource_Elemental|Elemental|Artifact|Hoard|Coffer|Fuse|Ward|Preservation|Armor_Enhancement|Weapon_Enhancement|T[5-9]_Enchantment|T[5-9]_Runestones|T10_Enchantment|T10_Runestones|4c_Personal|Item_Potion_Companion_Xp|Gateway_Rewardpack|Consumable_Id_Scroll|Dungeon_Delve_Key)/; // edited by RottenMind 08.03.2015
  29.  
  30. if (settings["autovendor_profresults"]) {
  31. /** Profession leveling result item cleanup logic for T1-4 crafted results
  32. * Created by RM on 14.1.2015.
  33. * List contains crafted_items, based "Mustex/Bunta NW robot 1.05.0.1L crafting list, can be used making list for items what are "Auto_Vendored".
  34. * Items on list must be checked and tested.
  35. */
  36. /*#1, Tier3, end list, sell allways all, "TierX" is here "TX" !!*/
  37. /*_profitems[_profitems.length] = {
  38. pattern : /^Crafted_(Jewelcrafting_Waist_Offense_3|Jewelcrafting_Neck_Defense_3|Jewelcrafting_Waist_Defense_3|Hvy_Armorsmithing_Pants_3|Med_Armorsmithing_Chain_Shirt_3|Leatherworking_Shirt_3|Hvy_Armorsmithing_Shirt_3|Leatherworking_Pants_3|Med_Armorsmithing_Chain_Pants_3|Med_Armorsmithing_T3_Chain_Armor_Set_1|Med_Armorsmithing_T3_Chain_Pants2|Med_Armorsmithing_T3_Chain_Shirt2|Med_Armorsmithing_T3_Chain_Helm_Set_1|Med_Armorsmithing_T3_Chain_Pants|Med_Armorsmithing_T3_Chain_Boots_Set_1|Hvy_Armorsmithing_T3_Plate_Armor_Set_1|Hvy_Armorsmithing_T3_Plate_Pants2|Hvy_Armorsmithing_T3_Plate_Shirt2|Hvy_Armorsmithing_T3_Plate_Helm_Set_1|Hvy_Armorsmithing_T3_Plate_Boots_Set_1|Leatherworking_T3_Leather_Armor_Set_1|Leatherworking_T3_Leather_Pants2|Leatherworking_T3_Leather_Shirt2|Leatherworking_T3_Leather_Helm_Set_1|Leatherworking_T3_Leather_Boots_Set_1|Tailoring_T3_Cloth_Armor_Set_3|Tailoring_T3_Cloth_Armor_Set_2|Tailoring_T3_Cloth_Armor_Set_1|Tailoring_T3_Cloth_Pants2_Set2|Tailoring_T3_Cloth_Shirt2|Tailoring_T3_Cloth_Helm_Set_1|Artificing_T3_Pactblade_Temptation_5|Artificing_T3_Icon_Virtuous_5|Weaponsmithing_T3_Dagger_4)$/,
  39. limit : 0,
  40. count : 0
  41. };*/ // moved to selljunk filter, RottenMind
  42. /*#2, Tier2 - tier3 mixed, upgrade, sell if inventory full, "TierX" is here "TX" */
  43. _profitems[_profitems.length] = {
  44. pattern : /^Crafted_(Jewelcrafting_Neck_Misc_2|Jewelcrafting_Waist_Misc_2|Med_Armorsmithing_T3_Chain_Pants|Hvy_Armorsmithing_Pants_3|Med_Armorsmithing_Chain_Shirt_3|Leatherworking_Shirt_3|Hvy_Armorsmithing_Shirt_3|Leatherworking_Pants_3|Med_Armorsmithing_Chain_Pants_3||Med_Armorsmithing_T3_Chain_Shirt|Hvy_Armorsmithing_T3_Plate_Pants|Hvy_Armorsmithing_T3_Plate_Shirt|Leatherworking_T3_Leather_Pants|Leatherworking_T3_Leather_Shirt|Tailoring_Shirt_3|Tailoring_T3_Cloth_Shirt|Tailoring_T3_Cloth_Shirt_Set2|Tailoring_T3_Cloth_Pants|Tailoring_Shirt_3_Set2|Tailoring_Pants_3_Set2|Tailoring_Pants_3|Artificing_T3_Pactblade_Temptation_4|Artificing_T3_Icon_Virtuous_4|Weaponsmithing_T2_Dagger_3|Weaponsmithing_T2_Dagger_3|Weaponsmithing_T3_Greataxe_4|Weaponsmithing_T3_Battleaxe_4|Weaponsmithing_T3_Greataxe_Set_2|Weaponsmithing_T3_Battleaxe_Set_2)$/,
  45. limit: 0,
  46. count: 0
  47. };
  48. /*#3, Tier2, upgrade, sell if inventory full, "TierX" is here "TX" */
  49. _profitems[_profitems.length] = {
  50. pattern: /^Crafted_(Jewelcrafting_Neck_Offense_2|Jewelcrafting_Waist_Offense_2|Tailoring_T2_Cloth_Shirt|T2_Cloth_Armor_Set_2|Med_Armorsmithing_T2_Chain_Armor_Set_1|Med_Armorsmithing_T2_Chain_Pants_2|Med_Armorsmithing_T2_Chain_Boots_Set_1|Med_Armorsmithing_T2_Chain_Shirt_2|Med_Armorsmithing_T2_Chain_Pants_1|Med_Armorsmithing_T2_Chain_Shirt|Hvy_Armorsmithing_T2_Plate_Armor_Set_1|Hvy_Armorsmithing_T2_Plate_Pants_2|Crafted_Tailoring_Pants_2|Tailoring_T2_Cloth_Armor_Set_1|Crafted_Tailoring_Shirt_2 |Hvy_Armorsmithing_T2_Plate_Boots_Set_1|Hvy_Armorsmithing_T2_Plate_Shirt_2|Med_Armorsmithing_Chain_Pants_2|Hvy_Armorsmithing_T2_Plate_Pants_1|Hvy_Armorsmithing_T2_Shield_Set_1|Hvy_Armorsmithing_T2_Plate_Shirt|Leatherworking_T2_Leather_Shirt|Leatherworking_T2_Leather_Boots_Set_1|Leatherworking_T2_Leather_Shirt_2|Leatherworking_T2_Leather_Pants_1|Leatherworking_T2_Leather_Armor_Set_1|Leatherworking_T2_Leather_Pants_2|Leatherworking_Shirt_3_Set2|Tailoring_T2_Cloth_Armor_Set_1|Tailoring_Pants_2|Tailoring_T2_Cloth_Pants|Tailoring_T2_Cloth_Pants_2|Tailoring_T2_Cloth_Boots_Set_1|Tailoring_T2_Cloth_Shirt_2|Tailoring_T2_Cloth_Pants_1|Artificing_T2_Pactblade_Temptation_3|Artificing_T1_Icon_Virtuous_2|Weaponsmithing_T2_Dagger_2|Weaponsmithing_T2_Greataxe_3|Weaponsmithing_T2_Battleaxe_3)$/,
  51. limit: 0,
  52. count: 0
  53. };
  54. /*#4, Tier1, upgrade, sell if inventory full, "TierX" is here "TX" */
  55. _profitems[_profitems.length] = {
  56. pattern: /^Crafted_(Jewelcrafting_Neck_Misc_1|Jewelcrafting_Waist_Misc_1|Tailoring_Cloth_Shirt_1_Set2|Med_Armorsmithing_T1_Chain_Armor_Set_1|Med_Armorsmithing_T1_Chain_Boots_Set_1|Hvy_Armorsmithing_Plate_Armor_1|Hvy_Armorsmithing_T1_Plate_Armor_Set_1|Hvy_Armorsmithing_T1_Plate_Boots_Set_1|Leatherworking_T1_Leather_Boots_Set_1|Leatherworking_T1_Leather_Boots_Set_1|Leatherworking_T1_Leather_Armor_Set_1|Tailoring_T1_Cloth_Armor_1|Tailoring_Cloth_Armor_1|Tailoring_T1_Cloth_Pants_1|Tailoring_T1_Cloth_Boots_Set_1|Artificing_T1_Pactblade_Convergence_2|Artificing_T1_Icon_Virtuous_2|Weaponsmithing_T1_Dagger_1|Weaponsmithing_T2_Greataxe_2|Weaponsmithing_T2_Battleaxe_2)$/,
  57. limit: 0,
  58. count: 0
  59. };
  60. /*#5, Tier0, upgrade, sell if inventory full, taskilist "Tier1" is here "empty" or "_" must replace (_T1_|_)*/
  61. _profitems[_profitems.length] = {
  62. pattern: /^Crafted_(Jewelcrafting_Waist_Offense_1|Jewelcrafting_Neck_Offense_1|Tailoring_Cloth_Pants_1|Med_Armorsmithing_Chain_Boots_1|Med_Armorsmithing_Chain_Shirt_1|Med_Armorsmithing_Chain_Armor_1|Med_Armorsmithing_Chain_Pants_1|Hvy_Armorsmithing_Plate_Boots_1|Hvy_Armorsmithing_Plate_Shirt_1|Hvy_Armorsmithing_Shield_1|Leatherworking_Tier0_Intro_1|Leatherworking_Leather_Boots_1|Leatherworking_Leather_Shirt_1|Tailoring_T1_Cloth_Shirt_Set2|Leatherworking_Leather_Armor_1|Leatherworking_Leather_Pants_1|Tailoring_Cloth_Boots_1|Tailoring_Cloth_Shirt_1|Artificing_T1_Pactblade_Convergence_1|Artificing_Icon_Virtuous_1|Artificing_Symbol_Virtuous_1|Weaponsmithing_Dagger_1|Weaponsmithing_T1_Greatsword_1|Weaponsmithing_T1_Longbow_1|Weaponsmithing_T1_Greataxe_1|Weaponsmithing_T1_Battleaxe_1)$/,
  63. limit: 0,
  64. count: 0
  65. };
  66. }
  67. $.each(_pbags, function (bi, bag) {
  68. bag.slots.forEach(function (slot) {
  69. // Match unused slots
  70. if (slot === null || !slot || slot === undefined) {
  71. _bagUnused++;
  72. }
  73. // Match items to exclude from auto vendoring, dont add to _tmpBag: Exclude pattern list - bound - Epic Quality - Blue Quality
  74. else if (_excludeItems.test(slot.name) || slot.bound || slot.rarity == "Special" || slot.rarity == "Gold") {
  75. _bagUsed++;
  76. }
  77. // Match everything else
  78. else {
  79. if (settings["autovendor_profresults"]) {
  80. for (i = 0; i < _profitems.length; i++) {
  81. if (_profitems[i].pattern.test(slot.name))
  82. _profitems[i].count++;
  83. }
  84. }
  85. _tmpBag1[_tmpBag1.length] = slot;
  86. _bagUsed++;
  87. }
  88. });
  89. });
  90. if (settings["autovendor_profresults"] && _charGold < 2) { // this "gold" threshold must be global var and adjustable by users
  91. // $.each(_pbags_crafting, function (bi, bag) {
  92. _pbags_crafting.forEach(function (slot) {
  93. // Match unused slots
  94. if (slot === null || !slot || slot === undefined) {
  95. // _bagUnused++;
  96. }
  97. // Match items to exclude from auto vendoring, dont add to _tmpBag: Exclude pattern list - bound - Epic Quality - Blue Quality - Green Quality(might cause problems)
  98. else if (_excludeItems.test(slot.name) || slot.bound || slot.rarity == "Special" || slot.rarity == "Gold" || slot.rarity == "Silver") {
  99. // _bagUsed++;
  100. }
  101. // Match everything else
  102. else {
  103. if (settings["autovendor_profresults"]) {
  104. for (i = 0; i < _profitems.length; i++) {
  105. if (_profitems[i].pattern.test(slot.name))
  106. _profitems[i].count++;
  107. }
  108. }
  109. _tmpBag2[_tmpBag2.length] = slot;
  110. // _bagUsed++;
  111. console.log(slot.name); // tradebag debug msg
  112. }
  113. });
  114. // });
  115. }
  116. var _tmpBag = _tmpBag1.concat(_tmpBag2);
  117.  
  118. if (settings["autovendor_profresults"]) {
  119. _tmpBag.forEach(function (slot) {
  120. for (i = 0; i < _profitems.length; i++) { // edited by RottenMind
  121. if (slot && _profitems[i].pattern.test(slot.name) && Inventory_bagspace() <= 9) { // !slot.bound && _profitems[i].count > 3 &&, edited by RottenMind
  122. var vendor = {
  123. vendor: "Nw_Gateway_Professions_Merchant"
  124. };
  125. vendor.id = slot.uid;
  126. vendor.count = 1;
  127. console.log('Selling', vendor.count, slot.name, 'to vendor.');
  128. window.setTimeout(function () {
  129. client.sendCommand('GatewayVendor_SellItemToVendor', vendor);
  130. }, _delay);
  131. _profitems[i].count--;
  132. break;
  133. }
  134. }
  135. });
  136. }
  137.  
  138. _tmpBag.forEach(function (slot) {
  139. for (i = 0; i < _items.length; i++) {
  140. var _Limit = (parseInt(_items[i].limit) > 99) ? 99 : _items[i].limit;
  141. if (slot && _items[i].pattern.test(slot.name) && !slot.bound) {
  142. // Node Kits vendor logic for restricted bag space
  143. if (settings["autovendor_kits_altars_limit"] && /^Item_Consumable_Skill/.test(slot.name)) {
  144. if (_bagCount < 2 || _bagUnused < 6 ||
  145. (slot.name == "Item_Consumable_Skill_Dungeoneering" && (_classType == "Player_Guardian" || _classType == "Player_Greatweapon")) ||
  146. (slot.name == "Item_Consumable_Skill_Arcana" && (_classType == "Player_Controller" || _classType == "Player_Scourge")) ||
  147. (slot.name == "Item_Consumable_Skill_Religion" && _classType == "Player_Devoted") ||
  148. (slot.name == "Item_Consumable_Skill_Thievery" && _classType == "Player_Trickster") ||
  149. (slot.name == "Item_Consumable_Skill_Nature" && _classType == "Player_Archer")
  150. ) {
  151. _Limit = 0;
  152. }
  153. }
  154. // Sell Items
  155. if (slot.count > _Limit) {
  156. _sellCount++;
  157. var vendor = {
  158. vendor: "Nw_Gateway_Professions_Merchant"
  159. };
  160. vendor.id = slot.uid;
  161. vendor.count = slot.count - _Limit;
  162. console.log('Selling', vendor.count, slot.name, 'to vendor.');
  163. window.setTimeout(function () {
  164. client.sendCommand('GatewayVendor_SellItemToVendor', vendor);
  165. }, _delay);
  166. _delay = _delay + 400;
  167. break;
  168. }
  169. }
  170. }
  171. });
  172.  
  173. return _sellCount;
  174. }
  175.  
  176. //Auto Vendor Junk function:
  177. function vendorJunk(evnt) {
  178. var _charGold = unsafeWindow.client.dataModel.model.ent.main.currencies.gold;
  179. var _vendorItems = [];
  180. var _sellCount = 0;
  181. if (settings["autovendor_kits_altars_limit"]) {
  182. _vendorItems[_vendorItems.length] = {pattern: /^Item_Consumable_Skill/, limit: 50};
  183. _vendorItems[_vendorItems.length] = {pattern: /^Item_Portable_Altar$/, limit: 80};
  184. }
  185. if (settings["autovendor_kits_altars_all"]) {
  186. _vendorItems[_vendorItems.length] = {pattern: /^Item_Portable_Altar$/, limit: 0};
  187. _vendorItems[_vendorItems.length] = {pattern: /^Item_Consumable_Skill/, limit: 0};
  188. }
  189. if (settings["autovendor_rank2"]) {
  190. _vendorItems[_vendorItems.length] = {pattern: /^T1_Enchantment/, limit: 0};
  191. _vendorItems[_vendorItems.length] = {pattern: /^T1_Runestone/, limit: 0};
  192. }
  193. if (settings["autovendor_rank2"]) {
  194. _vendorItems[_vendorItems.length] = {pattern: /^T2_Enchantment/, limit: 0};
  195. _vendorItems[_vendorItems.length] = {pattern: /^T2_Runestone/, limit: 0};
  196. }
  197. if (settings["autovendor_rank3"]) {
  198. _vendorItems[_vendorItems.length] = {pattern: /^T3_Enchantment/, limit: 0};
  199. _vendorItems[_vendorItems.length] = {pattern: /^T3_Runestone/, limit: 0};
  200. }
  201. if (settings["autovendor_pots1"]) {
  202. _vendorItems[_vendorItems.length] = {
  203. pattern: /^Potion_(Healing|Tidespan|Force|Fortification|Reflexes|Accuracy|Rejuvenation)$/, limit: 0
  204. };
  205. }
  206. if (settings["autovendor_pots2"]) {
  207. _vendorItems[_vendorItems.length] = {
  208. pattern: /^Potion_(Healing|Tidespan|Force|Fortification|Reflexes|Accuracy|Rejuvenation)_2$/,
  209. limit: 0
  210. };
  211. }
  212. if (settings["autovendor_pots3"]) {
  213. _vendorItems[_vendorItems.length] = {
  214. pattern: /^Potion_(Healing|Tidespan|Force|Fortification|Reflexes|Accuracy|Rejuvenation)_3$/,
  215. limit: 0
  216. };
  217. }
  218. if (settings["autovendor_pots4"]) {
  219. _vendorItems[_vendorItems.length] = {
  220. pattern: /^Potion_(Healing|Tidespan|Force|Fortification|Reflexes|Accuracy|Rejuvenation)_4$/,
  221. limit: 0
  222. };
  223. }
  224. if (settings["autovendor_junk"]) {
  225. _vendorItems[_vendorItems.length] = {pattern: /^Item_Snowworks_/, limit: 0}; // Winter Festival fireworks small & large
  226. _vendorItems[_vendorItems.length] = {pattern: /^Item_Skylantern/, limit: 0}; // Winter Festival skylantern
  227. _vendorItems[_vendorItems.length] = {pattern: /^Item_Partypopper/, limit: 0}; // Party Poppers
  228. _vendorItems[_vendorItems.length] = {pattern: /^Item_Fireworks/, limit: 0}; // Fireworks
  229. _vendorItems[_vendorItems.length] = {pattern: /^Object_Plate_/, limit: 0};
  230. _vendorItems[_vendorItems.length] = {pattern: /^Object_Decoration_/, limit: 0};
  231. _vendorItems[_vendorItems.length] = {pattern: /_Green_T[1-7]_Unid$/, limit: 0}; // Unidentified Green Gear
  232. }
  233. if (settings["autovendor_profresults"] && _charGold < 2) { //this "gold" threshold must be global var and adjustable by users
  234. _vendorItems[_vendorItems.length] = {
  235. pattern : /(Crafting_Resource_Pelt)_T[1-3]$/,
  236. limit : 10
  237. }; //"Crafting_Resource_Ore_T1" Pelt_T1
  238. _vendorItems[_vendorItems.length] = {
  239. pattern : /(Resource_Wood)_T[1-3]$/,
  240. limit : 10
  241. }; //"Crafting_Resource_Ore_T1" Pelt_T1
  242. _vendorItems[_vendorItems.length] = {
  243. pattern : /(Crafting_Resource_Ore)_T[1-3]$/,
  244. limit : 10
  245. }; //"Crafting_Resource_Ore_T1"> Pelt_T1
  246. console.log("copper amount is under sale threshold", _charGold);
  247. }
  248.  
  249. // edited by RottenMind
  250. if (settings["autovendor_profresults"]) {
  251. _vendorItems[_vendorItems.length] = {
  252. pattern: /^Crafted_(Jewelcrafting_Waist_Offense_3|Jewelcrafting_Neck_Defense_3|Jewelcrafting_Waist_Defense_3|Tailoring_T3_Helm_Set_1|Med_Armorsmithing_T3_Chain_Armor_Set_1|Med_Armorsmithing_T3_Chain_Pants2|Med_Armorsmithing_T3_Chain_Shirt2|Med_Armorsmithing_T3_Chain_Helm_Set_1|Med_Armorsmithing_T3_Chain_Pants|Med_Armorsmithing_T3_Chain_Boots_Set_1|Hvy_Armorsmithing_T3_Plate_Armor_Set_1|Hvy_Armorsmithing_T3_Plate_Pants2|Hvy_Armorsmithing_T3_Plate_Shirt2|Hvy_Armorsmithing_T3_Plate_Helm_Set_1|Hvy_Armorsmithing_T3_Plate_Boots_Set_1|Leatherworking_T3_Leather_Armor_Set_1|Leatherworking_T3_Leather_Pants2|Leatherworking_T3_Leather_Shirt2|Leatherworking_T3_Leather_Helm_Set_1|Leatherworking_T3_Leather_Boots_Set_1|Tailoring_T3_Cloth_Boots_Set_1|Tailoring_T3_Cloth_Armor_Set_3|Tailoring_T3_Cloth_Armor_Set_2|Tailoring_T3_Cloth_Armor_Set_1|Tailoring_T3_Cloth_Pants2_Set2|Tailoring_T3_Cloth_Shirt2|Tailoring_T3_Cloth_Helm_Set_1|Artificing_T3_Pactblade_Temptation_5|Artificing_T3_Icon_Virtuous_5|Weaponsmithing_T3_Dagger_4|Weaponsmithing_T3_Longsword_Set_3|Weaponsmithing_T3_Mace_Set_3|Weaponsmithing_T3_Greatsword_Set_3|Weaponsmithing_T3_Dagger_Set_3|Weaponsmithing_T3_Blades_Set_3|Weaponsmithing_T3_Longbow_Set_3)$/, limit: 0};
  253. _vendorItems[_vendorItems.length] = {
  254. pattern: /^Potion_(Unstable|Unstable_[1-3])$/, limit : 0}; // Alchemy experience potions
  255.  
  256. }
  257. // edited by RottenMind
  258. if (_vendorItems.length > 0) {
  259. console.log("Attempting to vendor selected items...");
  260. _sellCount = vendorItemsLimited(_vendorItems);
  261. if (_sellCount > 0 && !evnt) {
  262. var _sellWait = _sellCount * 1000;
  263. PauseSettings("pause");
  264. window.setTimeout(function () {
  265. PauseSettings("unpause");
  266. }, _sellWait);
  267. }
  268. }
  269. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址