Module: Go2
- Defined in:
- lib/Olib/go2.rb
Class Method Summary collapse
-
.cost(to) ⇒ Object
Thanks Tillmen.
- .room(target) ⇒ Object
- .run(target) ⇒ Object
-
.tags ⇒ Object
Array.
Instance Method Summary collapse
-
#tag ⇒ Object
dynamically assign all of our Go2#methods.
Class Method Details
.cost(to) ⇒ Object
Thanks Tillmen
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/Olib/go2.rb', line 50 def Go2.cost(to) cost = 0 Map.findpath(Room.current.id, to).each { |id| Room[id]..each { |tag| if tag =~ /^silver-cost:#{id-1}:(.*)$/ cost_string = $1 if cost_string =~ /^[0-9]+$/ cost += cost_string.to_i else cost = StringProc.new(cost_string).call.to_i end end } } cost end |
.room(target) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/Olib/go2.rb', line 36 def Go2.room(target) starting_room = Room.current.id unless Room.current.id == target || Room.current..include?(target) Char.unhide if hidden Go2.run(target) if block_given? yield starting_room end end Go2 end |
.run(target) ⇒ Object
32 33 34 |
# File 'lib/Olib/go2.rb', line 32 def Go2.run(target) Script.run "go2", ("%s _disable_confirm_" % target) end |
.tags ⇒ Object
Returns Array.
21 22 23 |
# File 'lib/Olib/go2.rb', line 21 def Go2. Map..select { |tag| !tag.include? "=" }.uniq end |