Melvoridle Helper

Auto loot, and auto eat food. For Melvor Idle 1.0

当前为 2021-11-22 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Melvoridle Helper
  3. // @namespace https://github.com/lovedzc/
  4. // @version 1.004
  5. // @description Auto loot, and auto eat food. For Melvor Idle 1.0
  6. // @author lovedzc
  7. // @match https://www.melvoridle.com/index_noads.php
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=melvoridle.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. // 自动捡拾所有
  14. function AutoLoot()
  15. {
  16. try {
  17. var text = document.getElementById("combat-loot-text").innerText;
  18. var a = text.indexOf("(");
  19. var b = text.indexOf("/");
  20. var num = text.substr(a+1, b-a-1);
  21. if (num > 0){
  22. document.getElementById("combat-btn-loot-all").click();
  23. }
  24. } catch (Exception) {
  25. }
  26. }
  27.  
  28. // 自动吃食物
  29. function AutoEatFood()
  30. {
  31. try {
  32. var sHPCur = document.getElementById("combat-player-hitpoints-current").innerText;
  33. var sHPMax = document.getElementById("combat-player-hitpoints-max").innerText;
  34. var sFood = document.querySelector("#combat-food-container > div > button.btn.btn-outline-secondary.text-combat-smoke.font-size-sm > span:nth-child(3)").innerHTML;
  35.  
  36. var HPCur = parseInt(sHPCur.split(",").join(""));
  37. var HPMax = parseInt(sHPMax.split(",").join(""));
  38. var Food = parseInt(sFood.split(",").join(""));
  39.  
  40. if (HPCur / HPMax < 0.5) {
  41. while (HPMax - HPCur > Food) {
  42. document.getElementsByClassName("btn btn-outline-secondary text-combat-smoke font-size-sm")[0].click();
  43. HPCur = HPCur + Food;
  44. }
  45. }
  46.  
  47. } catch (Exception) {
  48. }
  49. }
  50.  
  51. function main() {
  52. AutoLoot();
  53. AutoEatFood();
  54. }
  55.  
  56. function init() {
  57. window.setInterval(main, 2000);
  58. }
  59.  
  60. init();

QingJ © 2025

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