Class: Dota2Item

Inherits:
GameItem show all
Defined in:
lib/steam/community/dota2/dota2_item.rb

Overview

Represents a DotA 2 item

Author:

  • Sebastian Staudt

Instance Attribute Summary

Attributes inherited from GameItem

#attributes, #backpack_position, #count, #defindex, #id, #inventory, #item_class, #item_set, #level, #name, #origin, #original_id, #quality, #type

Instance Method Summary collapse

Methods inherited from GameItem

#craftable?, #preliminary?, #schema_data, #tradeable?

Constructor Details

#initialize(inventory, item_data) ⇒ Dota2Item

Creates a new instance of a DotA 2 item with the given data

Parameters:

  • inventory (Dota2Inventory)

    The inventory this item is contained in

  • item_data (Hash<Symbol, Object>)

    The data specifying this item

Raises:



18
19
20
21
22
# File 'lib/steam/community/dota2/dota2_item.rb', line 18

def initialize(inventory, item_data)
  super

  @equipped = !item_data[:equipped].nil?
end

Instance Method Details

#equipped?Boolean

Returns whether this item is equipped by this player at all

Returns:

  • (Boolean)

    Whether this item is equipped by this player at all



27
28
29
# File 'lib/steam/community/dota2/dota2_item.rb', line 27

def equipped?
  @equipped
end