MxoBot Example Bot

Demo bot to illustrate LibNevin. MxoBot

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/462620/1233374/MxoBot%20Example%20Bot.js

  1. // ==UserScript==
  2. // @name MxoBot Example Bot
  3. // @namespace http://tampermonkey.net/<3nevin
  4. // @version 1.1
  5. // @description Demo bot to illustrate LibNevin. MxoBot
  6. // @author ngixl
  7. // @match https://pixelplace.io/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=pixelplace.io
  9. // @grant unsafeWindow
  10. // @require https://greasyfork.org/scripts/462620-mxobot-example-bot/code/MxoBot%20Example%20Bot.js
  11. // ==/UserScript==
  12. /* global NevinCore, NevinWaitForElm*/
  13.  
  14. const core = new MxoCore({
  15. timeout: 25
  16. });
  17.  
  18. MxoWaitForElm('#canvas').then(function(c) {
  19. c.addEventListener('click', function() {
  20. const [sx, sy] = document.getElementById('coordinates').textContent.split(',').map(Number)
  21. core.picker.requestImageFromFileDialog(core.palette).then(a => {
  22. console.log(core.mxoWS.ws.readyState)
  23. a.image.addEventListener('load', function() {
  24. core.engine.tasks = [...core.engine.tasks, ...a.convertToTasks(sx,sy, core.mxoWS)]
  25. })
  26. })
  27. })
  28. })