NGAL_UserHelpers

Neverwinter Gateway Advanced Library - Helpers added by users

当前为 2015-05-04 提交的版本,查看 最新版本

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

  1. /** Start, Helpers added by users.
  2. * Adds fetures, options to base script and can be easily removed if needed
  3. * Add description so anyone can see if they can use Function somewhere
  4. * Use "brackets" around function start and end //yourname
  5. */
  6. //RottenMind, returns inventory space, use Inventory_bagspace(); gives current free bags slots, from MAC-NW function
  7. function Inventory_bagspace() {
  8. var _pbags = client.dataModel.model.ent.main.inventory.playerbags;
  9. var _bagUnused = 0;
  10. $.each(_pbags, function (bi, bag) {
  11. bag.slots.forEach(function (slot) {
  12. if (slot === null || !slot || slot === undefined) {
  13. _bagUnused++;
  14. }
  15. });
  16. });
  17. return _bagUnused;
  18. }
  19.  
  20. /** Count resouce in bags
  21. * edited by WloBeb
  22. * @param {string} name The name of resource
  23. */
  24. function countResource(name) {
  25. var count = 0;
  26. var _bags = unsafeWindow.client.dataModel.model.ent.main.inventory.bags;
  27. console.log("Checking bags for " + name);
  28. $.each(_bags, function (bi, bag) {
  29. bag.slots.forEach(function (slot) {
  30. if (slot && slot.name === name) {
  31. count = count + slot.count;
  32. }
  33. });
  34. });
  35. return count;
  36. }
  37. /** Report error in GM for later use
  38. * edited by RM
  39. *
  40. */
  41. function Epic_button_error() {
  42. var counter = GM_getValue('Epic_error', 0);
  43. // console.log('This script has been run ' + counter + ' times.');
  44. GM_setValue('Epic_error', ++counter);
  45. return counter;
  46. }
  47. function Array_undefine_error() {
  48. var counter = GM_getValue('Undefine_error', 0);
  49. // console.log('This script has been run ' + counter + ' times.');
  50. GM_setValue('Undefine_error', ++counter);
  51. return counter;
  52. }
  53. // This just set Banker to character 1 if its not him all-ready
  54. function get_banker(){
  55. var me = GM_getValue("nw_charname0",0);
  56. var banker = GM_getValue("bankchar",0);
  57. //console.log(me, banker);
  58. if (me !== banker) {
  59. GM_setValue('bankchar', me);
  60. unsafeWindow.location.href = current_Gateway;
  61. return;
  62. }
  63. }
  64. /**
  65. * Created by RM on 29.4.2015.
  66. * Runs daily SCA -rolls in GAteway Bot
  67. */
  68. function dailySCA() {
  69. if (settings["dailySCA"]) {
  70. var char, today, thisday, thishour, dailyroll, dateforlastroll;
  71. char = settings["charcount"];
  72. today = new Date();
  73. thisday = today.getDate();
  74. thishour = today.getHours();
  75. dailyroll = GM_getValue("dailyswordcoast", 0);
  76. dateforlastroll = GM_getValue("dateforlastrolls", 0);
  77. //console.log(thisday, dateforlastroll, dailyroll, chardelay, thishour);
  78. if (thisday > dateforlastroll) {
  79. GM_setValue("dateforlastrolls", thisday);
  80. GM_setValue("dailyswordcoast", 0)
  81. dailyroll = 0;
  82. }
  83. if (dailyroll < (4 || undefined) && chardelay > 10000 * char && (thishour >= 14 || thishour >= 23)) {
  84. unsafeWindow.location.hash = unsafeWindow.location.hash.replace(/\)\/.+/, ')' + "/adventures");
  85. processSwordCoastDailies();
  86. dailyroll++;
  87. GM_setValue("dailyswordcoast", dailyroll);
  88. GM_getValue("dailyswordcoast", 0);
  89. }
  90. }
  91. }
  92.  
  93. /** End, Helpers added by users.*/

QingJ © 2025

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