class WolfRpg::Command::Move

Public Class Methods

new(cid, args, string_args, indent, coder) click to toggle source
Calls superclass method WolfRpg::Command::new
# File lib/wolfrpg/command.rb, line 195
def initialize(cid, args, string_args, indent, coder)
  super(cid, args, string_args, indent)
  # Read unknown data
  @unknown = Array.new(5)
  @unknown.each_index do |i|
    @unknown[i] = coder.read_byte
  end
  # Read known data
  #TODO further abstract this
  @flags = coder.read_byte

  # Read route
  @route = Array.new(coder.read_int)
  @route.each_index do |i|
    @route[i] = RouteCommand.create(coder)
  end
end

Public Instance Methods

dump_terminator(coder) click to toggle source
# File lib/wolfrpg/command.rb, line 213
def dump_terminator(coder)
  coder.write_byte(1)
  @unknown.each do |byte|
    coder.write_byte(byte)
  end
  coder.write_byte(@flags)
  coder.write_int(@route.size)
  @route.each do |cmd|
    cmd.dump(coder)
  end
end