Class: L4DWeapon

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

Overview

This class represents the statistics of a single weapon for a user in Left4Dead

Author:

  • Sebastian Staudt

Instance Attribute Summary

Attributes included from AbstractL4DWeapon

#accuracy, #headshots_percentage, #id, #kill_percentage, #shots

Attributes included from GameWeapon

#id, #kills, #shots

Instance Method Summary collapse

Methods included from GameWeapon

#avg_shots_per_kill

Constructor Details

#initialize(weapon_name, weapon_data) ⇒ L4DWeapon

Creates a new instance of a weapon based on the given XML data

Parameters:

  • weapon_name (String)

    The name of this weapon

  • weapon_data (Hash<String, Object>)

    The XML data of this weapon



20
21
22
23
24
# File 'lib/steam/community/l4d/l4d_weapon.rb', line 20

def initialize(weapon_name, weapon_data)
  super

  @kill_percentage = weapon_data['killpct'].to_f * 0.01
end