class RuneRb::World::Item
Attributes
item[R]
location[R]
on_table[R]
orig_respawn[R]
picked_up[R]
respawn[RW]
Public Class Methods
new(data)
click to toggle source
# File app/world/item_spawns.rb, line 44 def initialize(data) @item = RuneRb::Item::Item.new(data['id'].to_i, (data.include?('amount') ? data['amount'].to_i : 1)) @location = RuneRb::Model::Location.new(data['x'].to_i, data['y'].to_i, data['z'].to_i) @respawn = data.include?('respawn') ? data['respawn'].to_i : 300 # Number of seconds before it will respawn @orig_respawn = @respawn @picked_up = false @on_table = data.include?('ontable') && data['ontable'] == "true" end
Public Instance Methods
available()
click to toggle source
# File app/world/item_spawns.rb, line 79 def available true end
remove()
click to toggle source
# File app/world/item_spawns.rb, line 53 def remove @picked_up = true WORLD.region_manager.get_local_players(@location).each {|player| player.io.send_grounditem_removal(self) } end
spawn(player = nil)
click to toggle source
# File app/world/item_spawns.rb, line 61 def spawn(player = nil) @picked_up = false @respawn = @orig_respawn if player != nil player.io.send_grounditem_creation(self) return end WORLD.region_manager.get_local_players(@location).each {|p| p.io.send_grounditem_creation(self) } end
within_distance?(player)
click to toggle source
# File app/world/item_spawns.rb, line 75 def within_distance?(player) player.location.within_distance? @location end