Module: RuneRb::Network::RS317::MouseEventMessage

Defined in:
app/network/protocol/rs317/incoming/mouse.rb

Overview

Since:

  • 0.9.3

Defined Under Namespace

Classes: Movement

Instance Method Summary collapse

Instance Method Details

#parse(_) ⇒ Object

Parses the MouseEventMessage

Since:

  • 0.9.3


15
16
17
18
19
20
21
22
23
24
25
# File 'app/network/protocol/rs317/incoming/mouse.rb', line 15

def parse(_)
  if @header[:length] == 2
    data = read_short
    return Movement.new(data >> 12, data >> 6 & 0x3f, data & 0x3f, true)
  elsif @header[:length] == 3
    data = read_medium & ~0x800000
  else
    data = read_int & ~0xc0000000
  end
  Movement.new(data >> 19, (data & 0x7f) % 765, (data & 0x7f) / 765).inspect
end