Skip to content

Commit a315653

Browse files
kaduvertrom1504
andauthored
Allow more click modes (#3133)
* allow click modes higher than 0 * send null in item field with modes 2 / 4 * add comment --------- Co-authored-by: Romain Beaumont <romain.rom1@gmail.com>
1 parent 6b1d6ea commit a315653

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/plugins/inventory.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,7 @@ function inject (bot, { hideErrors }) {
490490
}
491491
const window = bot.currentWindow || bot.inventory
492492

493-
assert.ok(mouseButton === 0 || mouseButton === 1)
494-
assert.strictEqual(mode, 0)
493+
assert.ok(mode >= 0 && mode <= 4)
495494
const actionId = createActionNumber()
496495

497496
const click = {
@@ -528,7 +527,8 @@ function inject (bot, { hideErrors }) {
528527
mouseButton,
529528
action: actionId,
530529
mode,
531-
item: Item.toNotch(click.item)
530+
// protocol expects null even if there is an item at the slot in mode 2 and 4
531+
item: Item.toNotch((mode === 2 || mode === 4) ? null : click.item)
532532
})
533533
} else { // 1.17
534534
bot._client.write('window_click', {

0 commit comments

Comments
 (0)