HWM_Resources

Библиотека всякой мелочевки, для совместной работы других скриптов

当前为 2023-12-16 提交的版本,查看 最新版本

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

  1. // ==UserScript==
  2. // @name HWM_Resources
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.5
  5. // @description Библиотека всякой мелочевки, для совместной работы других скриптов
  6. // @author Tags
  7. // @include /^https{0,1}:\/\/(www\.heroeswm\.ru|178\.248\.235\.15|my\.lordswm\.com)\/(pl_info.php*)/
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=heroeswm.ru
  9. // @grant none
  10. // @license CC BY-NC-SA 4.0
  11. // ==/UserScript==
  12.  
  13. this.MercenaryElements = {
  14. "абразив":{
  15. id: "EL_42",
  16. art_type: "abrasive"
  17. }, "змеиный яд":{
  18. id: "EL_43",
  19. art_type: "snake_poison"
  20. }, "клык тигра":{
  21. id: "EL_46",
  22. art_type: "tiger_tusk"
  23. }, "ледяной кристалл":{
  24. id: "EL_44",
  25. art_type: "ice_crystal"
  26. }, "лунный камень":{
  27. id: "EL_45",
  28. art_type: "moon_stone"
  29. }, "огненный кристалл":{
  30. id: "EL_40",
  31. art_type: "fire_crystal"
  32. }, "осколок метеорита":{
  33. id: "EL_37",
  34. art_type: "meteorit"
  35. }, "цветок ведьм":{
  36. id: "EL_41",
  37. art_type: "witch_flower"
  38. }, "цветок ветров":{
  39. id: "EL_39",
  40. art_type: "wind_flower"
  41. }, "цветок папоротника":{
  42. id: "EL_78",
  43. art_type: "fern_flower"
  44. }, "ядовитый гриб":{
  45. id: "EL_38",
  46. art_type: "badgrib"
  47. },};
  48.  
  49.  
  50. this.ItemCollection ={
  51. "item_template": {
  52. stats: { //параметры
  53. attr_attack: 2, //значение атаки
  54. attr_defense: 2, //значение защиты
  55. attr_magicpower: 1, //значение силы магии
  56. attr_knowledge: 1, //значение знаний
  57. attr_initiative: 1, //значение инициативы
  58. attr_fortune: 0, //значение удачи
  59. attr_morale: 0, //значение морали
  60. attr_oa: 7, //значение очков аммуниции
  61. additional_stats:["параметр_1","параметр_2"] //дополнительные эффекты
  62. },
  63. required_level: 15, //требуемый уррвень
  64. base_durability: 0, //базовая прочность
  65. repair_price: 20000, //цена ремонта
  66. is_hunting_item: false, //добывается ли предмет на охоте
  67. is_event_item: true, //ивентовый предмет
  68. is_set_part: true, //часть сета
  69. is_shop_item: false, //предмет из магазина
  70. is_shop_status:false, //предмет со статусом "из магазина"
  71. shop_price: 0, //цена в магазине
  72. },
  73. "ocean_eye1": {
  74. repair_price: 20000,
  75. stats: {
  76. attr_attack: 2,
  77. attr_defense: 2,
  78. attr_magicpower: 1,
  79. attr_knowledge: 1,
  80. attr_initiative: 1,
  81. attr_fortune: 0,
  82. attr_morale: 0,
  83. attr_oa: 7
  84. },
  85. required_level: 15,
  86. base_durability: 0,
  87. is_hunting_item: false,
  88. is_event_item: true,
  89. is_set_part: true,
  90. is_shop_item: false,
  91. is_shop_status:false,
  92. shop_price: 0,
  93. },
  94. };
  95.  
  96.  
  97.  
  98.  
  99. (function() {
  100. 'use strict';
  101.  
  102. if(!window.location.href.includes('pl_info'))
  103. return;
  104. const tables = Array.from(document.getElementsByClassName('wb'));
  105. const resourceTable = tables[tables.indexOf(tables.filter(e=>e.innerText=="Ресурсы")[0])+3]
  106. if(resourceTable.hasAttribute("done")){
  107. console.log("already processed");
  108. return;}
  109. //Вытаскиваем все доступные элементы и превращаем в объекты.
  110. const items = resourceTable.innerHTML.split(/&nbsp;/).filter(e => e !== "").map(s => s.replaceAll("<b>", "").replaceAll("<br>", "").replaceAll("</b>", "")).map(e => ({
  111. name: e.split(':')[0],
  112. value: e.split(':')[1],
  113. isMercenary: window.MercenaryElements[e.split(':')[0]]!==undefined,
  114. }));
  115.  
  116. const parts = items.filter(e=>!e.isMercenary);
  117. const mercenary = items.filter(e=>e.isMercenary);
  118. //Чистим табличку
  119. resourceTable.innerHTML = "";
  120.  
  121. //Записываем новую разметку
  122. for (let item of parts) {
  123. const div = Object.assign(
  124. document.createElement('div'), {
  125. innerHTML: `<div>&nbsp;&nbsp;&nbsp;&nbsp;<b>${item.name}</b>:&nbsp;${item.value}</div>`,
  126.  
  127. });;
  128. div.setAttribute('ismercenary', item.isMercenary);
  129. div.setAttribute('name', item.name);
  130. resourceTable.appendChild(div);
  131. }
  132. const splitter = Object.assign(
  133. document.createElement('div'), {
  134. innerHTML: `<div name="splitter"><br></div>`,
  135.  
  136. });;
  137. if(parts.length>0){
  138. resourceTable.appendChild(splitter);
  139. }
  140. for (let item of mercenary) {
  141. const div = Object.assign(
  142. document.createElement('div'), {
  143. innerHTML: `<div">&nbsp;&nbsp;&nbsp;&nbsp;<b>${item.name}</b>:&nbsp;${item.value}</div>`,
  144.  
  145. });;
  146. div.setAttribute('ismercenary', item.isMercenary);
  147. div.setAttribute('name', item.name);
  148. resourceTable.appendChild(div);
  149. }
  150. resourceTable.setAttribute("done","true")
  151. })();
  152.  

QingJ © 2025

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