Class: WolfRpg::Database::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/wolfrpg/database.rb

Constant Summary collapse

STRING_START =
0x07D0
INT_START =
0x03E8

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(coder) ⇒ Field

Returns a new instance of Field.



209
210
211
# File 'lib/wolfrpg/database.rb', line 209

def initialize(coder)
  @name = coder.read_string
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



205
206
207
# File 'lib/wolfrpg/database.rb', line 205

def args
  @args
end

#default_valueObject

Returns the value of attribute default_value.



206
207
208
# File 'lib/wolfrpg/database.rb', line 206

def default_value
  @default_value
end

#indexinfoObject

Returns the value of attribute indexinfo.



207
208
209
# File 'lib/wolfrpg/database.rb', line 207

def indexinfo
  @indexinfo
end

#nameObject

Returns the value of attribute name.



201
202
203
# File 'lib/wolfrpg/database.rb', line 201

def name
  @name
end

#string_argsObject

Returns the value of attribute string_args.



204
205
206
# File 'lib/wolfrpg/database.rb', line 204

def string_args
  @string_args
end

#typeObject

Returns the value of attribute type.



202
203
204
# File 'lib/wolfrpg/database.rb', line 202

def type
  @type
end

#unknown1Object

Returns the value of attribute unknown1.



203
204
205
# File 'lib/wolfrpg/database.rb', line 203

def unknown1
  @unknown1
end

Instance Method Details

#dump_dat(coder) ⇒ Object



221
222
223
# File 'lib/wolfrpg/database.rb', line 221

def dump_dat(coder)
  coder.write_int(@indexinfo)
end

#dump_project(coder) ⇒ Object



213
214
215
# File 'lib/wolfrpg/database.rb', line 213

def dump_project(coder)
  coder.write_string(@name)
end

#indexObject



233
234
235
236
237
238
239
# File 'lib/wolfrpg/database.rb', line 233

def index
  if string?
    @indexinfo - STRING_START
  else
    @indexinfo - INT_START
  end
end

#int?Boolean

Returns:

  • (Boolean)


229
230
231
# File 'lib/wolfrpg/database.rb', line 229

def int?
  !string?
end

#read_dat(coder) ⇒ Object



217
218
219
# File 'lib/wolfrpg/database.rb', line 217

def read_dat(coder)
  @indexinfo = coder.read_int
end

#string?Boolean

Returns:

  • (Boolean)


225
226
227
# File 'lib/wolfrpg/database.rb', line 225

def string?
  @indexinfo >= STRING_START
end