A TlkSet wraps a set of File objects, each pointing to the respective tlk file, making retrieval easier.
Attributes
Public class methods
new
(tlk, tlkf = nil, custom = nil, customf = nil)
[show source]
# File lib/nwn/tlk.rb, line 151 151: def initialize tlk, tlkf = nil, custom = nil, customf = nil 152: @dm = Tlk.new(tlk) 153: @df = tlkf ? Tlk.new(tlkf) : @dm 154: @cm = custom ? Tlk.new(custom) : nil 155: @cf = customf ? Tlk.new(customf) : @cm 156: end
Public instance methods
[]
(id, gender = :male)
[show source]
# File lib/nwn/tlk.rb, line 158 158: def [](id, gender = :male) 159: raise ArgumentError, "Invalid Tlk ID: #{id.inspect}" if id > 0xffffffff 160: (if id < 0x01000000 161: gender == :female && @df ? @df : @dm 162: else 163: raise ArgumentError, "Wanted a custom ID, but no custom talk table has been specified." unless @cm 164: id -= 0x01000000 165: gender == :female && @cf ? @cf : @cm 166: end)[id] 167: end