Class: AlienSwarmMission
- Inherits:
-
Object
- Object
- AlienSwarmMission
- Defined in:
- lib/steam/community/alien_swarm/alien_swarm_mission.rb
Overview
This class holds statistical information about missions played by a player in Alien Swarm
Instance Attribute Summary collapse
-
#avg_damage_taken ⇒ Float
readonly
Returns the avarage damage taken by the player while playing a round in this mission.
-
#avg_friendly_fire ⇒ Float
readonly
Returns the avarage damage dealt by the player to team mates while playing a round in this mission.
-
#avg_kills ⇒ Float
readonly
Returns the avarage number of aliens killed by the player while playing a round in this mission.
-
#best_difficulty ⇒ String
readonly
Returns the highest difficulty the player has beat this mission in.
-
#damage_taken ⇒ Fixnum
readonly
Returns the total damage taken by the player in this mission.
-
#friendly_fire ⇒ Fixnum
readonly
Returns the total damage dealt by the player to team mates in this mission.
-
#games_successful ⇒ Fixnum
readonly
Returns the number of successful rounds the player played in this mission.
-
#img ⇒ String
readonly
Returns the URL to a image displaying the mission.
-
#kills ⇒ Fixnum
readonly
Returns the total number of aliens killed by the player in this mission.
-
#map_name ⇒ String
readonly
Returns the file name of the mission’s map.
-
#name ⇒ String
readonly
Returns the name of the mission.
-
#time ⇒ Hash<Symbol, String>
readonly
Returns various statistics about the times needed to accomplish this mission.
-
#total_games ⇒ Fixnum
readonly
Returns the number of games played in this mission.
-
#total_games_percentage ⇒ Float
readonly
Returns the percentage of successful games played in this mission.
Instance Method Summary collapse
-
#initialize(map_name, mission_data) ⇒ AlienSwarmMission
constructor
Creates a new mission instance of based on the given XML data.
Constructor Details
#initialize(map_name, mission_data) ⇒ AlienSwarmMission
Creates a new mission instance of based on the given XML data
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 94 def initialize(map_name, mission_data) @avg_damage_taken = mission_data['damagetakenavg'].to_f @avg_friendly_fire = mission_data['friendlyfireavg'].to_f @avg_kills = mission_data['killsavg'].to_f @best_difficulty = mission_data['bestdifficulty'] @damage_taken = mission_data['damagetaken'].to_i @friendly_fire = mission_data['friendlyfire'].to_i @games_successful = mission_data['gamessuccess'].to_i @img = AlienSwarmStats::BASE_URL + mission_data['image'] @kills = mission_data['kills'].to_i @map_name = map_name @name = mission_data['name'] @total_games = mission_data['gamestotal'].to_i @total_games_percentage = mission_data['gamestotalpct'].to_f @time = { :average => mission_data['avgtime'], :brutal => mission_data['brutaltime'], :easy => mission_data['easytime'], :hard => mission_data['hardtime'], :insane => mission_data['insanetime'], :normal => mission_data['normaltime'], :total => mission_data['totaltime'] } end |
Instance Attribute Details
#avg_damage_taken ⇒ Float (readonly)
Returns the avarage damage taken by the player while playing a round in this mission
16 17 18 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 16 def avg_damage_taken @avg_damage_taken end |
#avg_friendly_fire ⇒ Float (readonly)
Returns the avarage damage dealt by the player to team mates while playing a round in this mission
22 23 24 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 22 def avg_friendly_fire @avg_friendly_fire end |
#avg_kills ⇒ Float (readonly)
Returns the avarage number of aliens killed by the player while playing a round in this mission
28 29 30 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 28 def avg_kills @avg_kills end |
#best_difficulty ⇒ String (readonly)
Returns the highest difficulty the player has beat this mission in
33 34 35 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 33 def best_difficulty @best_difficulty end |
#damage_taken ⇒ Fixnum (readonly)
Returns the total damage taken by the player in this mission
38 39 40 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 38 def damage_taken @damage_taken end |
#friendly_fire ⇒ Fixnum (readonly)
Returns the total damage dealt by the player to team mates in this mission
43 44 45 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 43 def friendly_fire @friendly_fire end |
#games_successful ⇒ Fixnum (readonly)
Returns the number of successful rounds the player played in this mission
48 49 50 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 48 def games_successful @games_successful end |
#img ⇒ String (readonly)
Returns the URL to a image displaying the mission
53 54 55 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 53 def img @img end |
#kills ⇒ Fixnum (readonly)
Returns the total number of aliens killed by the player in this mission
58 59 60 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 58 def kills @kills end |
#map_name ⇒ String (readonly)
Returns the file name of the mission’s map
63 64 65 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 63 def map_name @map_name end |
#name ⇒ String (readonly)
Returns the name of the mission
68 69 70 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 68 def name @name end |
#time ⇒ Hash<Symbol, String> (readonly)
Returns various statistics about the times needed to accomplish this mission
This includes the best times for each difficulty, the average time and the total time spent in this mission.
77 78 79 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 77 def time @time end |
#total_games ⇒ Fixnum (readonly)
Returns the number of games played in this mission
82 83 84 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 82 def total_games @total_games end |
#total_games_percentage ⇒ Float (readonly)
Returns the percentage of successful games played in this mission
87 88 89 |
# File 'lib/steam/community/alien_swarm/alien_swarm_mission.rb', line 87 def total_games_percentage @total_games_percentage end |