Class: L4D2Weapon

Inherits:
Object
  • Object
show all
Includes:
AbstractL4DWeapon
Defined in:
lib/steam/community/l4d/l4d2_weapon.rb

Instance Attribute Summary collapse

Attributes included from AbstractL4DWeapon

#accuracy, #headshots_percentage, #kill_percentage

Attributes included from GameWeapon

#id, #kills, #shots

Instance Method Summary collapse

Methods included from GameWeapon

#avg_shots_per_kill

Constructor Details

#initialize(weapon_data) ⇒ L4D2Weapon

Creates a new instance of L4D2Weapon based on the assigned XML data



15
16
17
18
19
20
21
# File 'lib/steam/community/l4d/l4d2_weapon.rb', line 15

def initialize(weapon_data)
  super weapon_data

  @damage          = weapon_data.elements['damage'].text.to_i
  @kill_percentage = weapon_data.elements['pctkills'].text
  @weapon_group    = weapon_data.attribute('group')
end

Instance Attribute Details

#damageObject (readonly)

Returns the value of attribute damage.



12
13
14
# File 'lib/steam/community/l4d/l4d2_weapon.rb', line 12

def damage
  @damage
end

#weapon_groupObject (readonly)

Returns the value of attribute weapon_group.



12
13
14
# File 'lib/steam/community/l4d/l4d2_weapon.rb', line 12

def weapon_group
  @weapon_group
end