Class: WolfRpg::Command::Picture

Inherits:
WolfRpg::Command show all
Defined in:
lib/wolfrpg/command.rb

Instance Attribute Summary

Attributes inherited from WolfRpg::Command

#args, #cid, #indent, #string_args

Instance Method Summary collapse

Methods inherited from WolfRpg::Command

create, #dump

Instance Method Details

#filenameObject



135
136
137
138
139
140
# File 'lib/wolfrpg/command.rb', line 135

def filename
  if type != :file && type != :window_file
    raise "picture type #{type} has no filename"
  end
  string_args[0]
end

#filename=(value) ⇒ Object



141
142
143
144
145
146
# File 'lib/wolfrpg/command.rb', line 141

def filename=(value)
  if type != :file && type != :window_file
    raise "picture type #{type} has no filename"
  end
  string_args[0] = value
end

#numObject



113
114
115
# File 'lib/wolfrpg/command.rb', line 113

def num
  args[1]
end

#textObject



117
118
119
120
121
122
123
# File 'lib/wolfrpg/command.rb', line 117

def text
  if type != :text
    raise "picture type #{type} has no text"
  end
  return '' if string_args.empty?
  string_args[0]
end

#text=(value) ⇒ Object



124
125
126
127
128
129
130
131
132
133
# File 'lib/wolfrpg/command.rb', line 124

def text=(value)
  if type != :text
    raise "picture type #{type} has no text"
  end
  if string_args.empty?
    string_args << value
  else
    string_args[0] = value
  end
end

#typeObject



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/wolfrpg/command.rb', line 96

def type
  case (args[0] >> 4) & 0x07
  when 0
    :file
  when 1
    :file_string
  when 2
    :text
  when 3
    :window_file
  when 4
    :window_string
  else
    nil
  end
end