Class: WolfRpg::Command::Move
- Inherits:
-
WolfRpg::Command
- Object
- WolfRpg::Command
- WolfRpg::Command::Move
- Defined in:
- lib/wolfrpg/command.rb
Instance Attribute Summary
Attributes inherited from WolfRpg::Command
#args, #cid, #indent, #string_args
Instance Method Summary collapse
- #dump_terminator(coder) ⇒ Object
-
#initialize(cid, args, string_args, indent, coder) ⇒ Move
constructor
A new instance of Move.
Methods inherited from WolfRpg::Command
Constructor Details
#initialize(cid, args, string_args, indent, coder) ⇒ Move
Returns a new instance of Move.
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# 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 |
Instance Method Details
#dump_terminator(coder) ⇒ Object
213 214 215 216 217 218 219 220 221 222 223 |
# 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 |