mirror of
https://github.com/tiennm99/WPlace-AutoBOT.git
synced 2026-10-17 18:13:39 +00:00
Update Auto-Farm.js
This commit is contained in:
1 parent
05d433324b
commit
12c6037170
1 file changed
+19
-7
+19
-7
@@ -173,17 +173,29 @@
|
||||
await sleep(500);
|
||||
const canvas = await waitForSelector('canvas');
|
||||
if (canvas) {
|
||||
canvas.setAttribute('tabindex', '0');
|
||||
canvas.focus();
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const centerX = Math.round(rect.left + rect.width / 2);
|
||||
const centerY = Math.round(rect.top + rect.height / 2);
|
||||
['mouseover', 'mousemove', 'mousedown', 'mouseup', 'click'].forEach(type => {
|
||||
const evt = new MouseEvent(type, {
|
||||
clientX: centerX,
|
||||
clientY: centerY,
|
||||
bubbles: true
|
||||
});
|
||||
canvas.dispatchEvent(evt);
|
||||
const moveEvt = new MouseEvent('mousemove', {
|
||||
clientX: centerX,
|
||||
clientY: centerY,
|
||||
bubbles: true
|
||||
});
|
||||
canvas.dispatchEvent(moveEvt);
|
||||
const keyDown = new KeyboardEvent('keydown', {
|
||||
key: ' ',
|
||||
code: 'Space',
|
||||
bubbles: true
|
||||
});
|
||||
const keyUp = new KeyboardEvent('keyup', {
|
||||
key: ' ',
|
||||
code: 'Space',
|
||||
bubbles: true
|
||||
});
|
||||
canvas.dispatchEvent(keyDown);
|
||||
canvas.dispatchEvent(keyUp);
|
||||
}
|
||||
await sleep(500);
|
||||
updateUI(
|
||||
|
||||
Reference in new issue
Block a user