Module: Fishbans::BlockEngine
- Included in:
- Fishbans
- Defined in:
- lib/block_engine.rb
Instance Method Summary collapse
-
#get_block(id, metadata = nil, size = 42) ⇒ ChunkyPNG::Image
Gets a block image by its ID and Metadata.
-
#get_monster(id, three = false, size = 42) ⇒ ChunkyPNG::Image
Gets the monster image by its ID.
Instance Method Details
#get_block(id, metadata = nil, size = 42) ⇒ ChunkyPNG::Image
Gets a block image by its ID and Metadata. Unfortunately it uses the old
block IDs rather than the new ones, so you have to memorize those
pesky integers.
14 15 16 17 18 19 20 |
# File 'lib/block_engine.rb', line 14 def get_block(id, = nil, size = 42) url = "http://blocks.fishbans.com/#{id}" url += "-#{}" unless .nil? url += "/#{size}" if size != 42 response = get(url, false) ChunkyPNG::Image.from_blob(response.body) end |
#get_monster(id, three = false, size = 42) ⇒ ChunkyPNG::Image
Gets the monster image by its ID.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/block_engine.rb', line 33 def get_monster(id, three = false, size = 42) id = id.to_s url = 'http://blocks.fishbans.com' url += "/#{id}" if id =~ /^m/ url += "/m#{id}" if id !~ /^m/ url += '-3d' if three url += "/#{size}" if size != 42 response = get(url, false) ChunkyPNG::Image.from_blob(response.body) end |