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.



219
220
221
# File 'lib/wolfrpg/database.rb', line 219

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

Instance Attribute Details

#argsObject

Returns the value of attribute args.



215
216
217
# File 'lib/wolfrpg/database.rb', line 215

def args
  @args
end

#default_valueObject

Returns the value of attribute default_value.



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

def default_value
  @default_value
end

#indexinfoObject

Returns the value of attribute indexinfo.



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

def indexinfo
  @indexinfo
end

#nameObject

Returns the value of attribute name.



211
212
213
# File 'lib/wolfrpg/database.rb', line 211

def name
  @name
end

#string_argsObject

Returns the value of attribute string_args.



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

def string_args
  @string_args
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

#unknown1Object

Returns the value of attribute unknown1.



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

def unknown1
  @unknown1
end

Instance Method Details

#dump_dat(coder) ⇒ Object



231
232
233
# File 'lib/wolfrpg/database.rb', line 231

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

#dump_project(coder) ⇒ Object



223
224
225
# File 'lib/wolfrpg/database.rb', line 223

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

#indexObject



243
244
245
246
247
248
249
# File 'lib/wolfrpg/database.rb', line 243

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

#int?Boolean

Returns:

  • (Boolean)


239
240
241
# File 'lib/wolfrpg/database.rb', line 239

def int?
  !string?
end

#read_dat(coder) ⇒ Object



227
228
229
# File 'lib/wolfrpg/database.rb', line 227

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

#string?Boolean

Returns:

  • (Boolean)


235
236
237
# File 'lib/wolfrpg/database.rb', line 235

def string?
  @indexinfo >= STRING_START
end