Class: HonStats::Classes::GameStats
- Inherits:
-
Object
- Object
- HonStats::Classes::GameStats
- Defined in:
- lib/honstats/character.rb
Overview
Consilidated game stats
Instance Attribute Summary collapse
-
#actions_made ⇒ Object
readonly
Returns the value of attribute actions_made.
-
#actions_per_minute ⇒ Object
readonly
Returns the value of attribute actions_per_minute.
-
#average_assists_per_game ⇒ Object
readonly
Returns the value of attribute average_assists_per_game.
-
#average_creep_denies_per_game ⇒ Object
readonly
Returns the value of attribute average_creep_denies_per_game.
-
#average_creep_kills_per_game ⇒ Object
readonly
Returns the value of attribute average_creep_kills_per_game.
-
#average_deaths_per_game ⇒ Object
readonly
Returns the value of attribute average_deaths_per_game.
-
#average_game_length_in_seconds ⇒ Object
readonly
Returns the value of attribute average_game_length_in_seconds.
-
#average_kills_per_game ⇒ Object
readonly
Returns the value of attribute average_kills_per_game.
-
#average_score ⇒ Object
readonly
Returns the value of attribute average_score.
-
#average_xp_earned_per_game ⇒ Object
readonly
Returns the value of attribute average_xp_earned_per_game.
-
#concede_votes ⇒ Object
readonly
Returns the value of attribute concede_votes.
-
#concedes ⇒ Object
readonly
Returns the value of attribute concedes.
-
#disconnect_percentage ⇒ Object
readonly
Returns the value of attribute disconnect_percentage.
-
#disconnects ⇒ Object
readonly
Returns the value of attribute disconnects.
-
#gold_earned ⇒ Object
readonly
Returns the value of attribute gold_earned.
-
#gold_earned_per_minute ⇒ Object
readonly
Returns the value of attribute gold_earned_per_minute.
-
#gold_spent ⇒ Object
readonly
Returns the value of attribute gold_spent.
-
#kicked ⇒ Object
readonly
Returns the value of attribute kicked.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#losses ⇒ Object
readonly
Returns the value of attribute losses.
-
#played ⇒ Object
readonly
Returns the value of attribute played.
-
#pub_skill ⇒ Object
readonly
Returns the value of attribute pub_skill.
-
#time_played ⇒ Object
readonly
Returns the value of attribute time_played.
-
#win_percentage ⇒ Object
readonly
Returns the value of attribute win_percentage.
-
#wins ⇒ Object
readonly
Returns the value of attribute wins.
-
#xp_earned ⇒ Object
readonly
Returns the value of attribute xp_earned.
-
#xp_earned_per_minute ⇒ Object
readonly
Returns the value of attribute xp_earned_per_minute.
Instance Method Summary collapse
-
#initialize(data, hero_stats, creep_stats) ⇒ GameStats
constructor
A new instance of GameStats.
Constructor Details
#initialize(data, hero_stats, creep_stats) ⇒ GameStats
Returns a new instance of GameStats.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/honstats/character.rb', line 81 def initialize(data, hero_stats, creep_stats) @wins = HonStats::API.get_data("acc_wins", data).to_i @losses = HonStats::API.get_data("acc_losses", data).to_i @disconnects = HonStats::API.get_data("acc_discos", data).to_i @played = @wins + @losses @disconnect_percentage = "%.02f" % ((@disconnects.to_f / @played) * 100) @win_percentage = "%.02f" % ((@wins.to_f / @played) * 100) @time_played = HonStats::API.get_data("acc_secs", data).to_i @level = HonStats::API.get_data("level", data).to_i @gold_earned = HonStats::API.get_data("acc_gold", data).to_i @gold_spent = HonStats::API.get_data("acc_gold_spent", data).to_i @xp_earned = HonStats::API.get_data("acc_exp", data).to_i @actions_made = HonStats::API.get_data("acc_actions", data).to_i @average_score = HonStats::API.get_data("acc_avg_score", data).to_f @concedes = HonStats::API.get_data("acc_concedes", data).to_i @concede_votes = HonStats::API.get_data("acc_concedevotes", data).to_i @kicked = HonStats::API.get_data("acc_kicked", data).to_i @pub_skill = HonStats::API.get_data("acc_pub_skill", data).to_i if @time_played > 0 minutes_played = @time_played / 60 @xp_earned_per_minute = "%.02f" % (@xp_earned.to_f / minutes_played.to_f) @gold_earned_per_minute = "%.02f" % (@gold_earned.to_f / minutes_played.to_f) @actions_per_minute = "%.02f" % (@actions_made.to_f / minutes_played.to_f) @average_game_length_in_seconds = (@time_played.to_f / @played).to_i @average_kills_per_game = "%.02f" % (hero_stats.kills.to_f / @played) @average_deaths_per_game = "%.02f" % (hero_stats.deaths.to_f / @played) @average_assists_per_game = "%.02f" % (hero_stats.assists.to_f / @played) @average_xp_earned_per_game = "%.02f" % (@xp_earned.to_f / @played) @average_creep_kills_per_game = "%.02f" % (creep_stats.kills.to_f / @played) @average_creep_denies_per_game = "%.02f" % (creep_stats.denies.to_f / @played) end end |
Instance Attribute Details
#actions_made ⇒ Object (readonly)
Returns the value of attribute actions_made.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def actions_made @actions_made end |
#actions_per_minute ⇒ Object (readonly)
Returns the value of attribute actions_per_minute.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def actions_per_minute @actions_per_minute end |
#average_assists_per_game ⇒ Object (readonly)
Returns the value of attribute average_assists_per_game.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def average_assists_per_game @average_assists_per_game end |
#average_creep_denies_per_game ⇒ Object (readonly)
Returns the value of attribute average_creep_denies_per_game.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def average_creep_denies_per_game @average_creep_denies_per_game end |
#average_creep_kills_per_game ⇒ Object (readonly)
Returns the value of attribute average_creep_kills_per_game.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def average_creep_kills_per_game @average_creep_kills_per_game end |
#average_deaths_per_game ⇒ Object (readonly)
Returns the value of attribute average_deaths_per_game.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def average_deaths_per_game @average_deaths_per_game end |
#average_game_length_in_seconds ⇒ Object (readonly)
Returns the value of attribute average_game_length_in_seconds.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def average_game_length_in_seconds @average_game_length_in_seconds end |
#average_kills_per_game ⇒ Object (readonly)
Returns the value of attribute average_kills_per_game.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def average_kills_per_game @average_kills_per_game end |
#average_score ⇒ Object (readonly)
Returns the value of attribute average_score.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def average_score @average_score end |
#average_xp_earned_per_game ⇒ Object (readonly)
Returns the value of attribute average_xp_earned_per_game.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def average_xp_earned_per_game @average_xp_earned_per_game end |
#concede_votes ⇒ Object (readonly)
Returns the value of attribute concede_votes.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def concede_votes @concede_votes end |
#concedes ⇒ Object (readonly)
Returns the value of attribute concedes.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def concedes @concedes end |
#disconnect_percentage ⇒ Object (readonly)
Returns the value of attribute disconnect_percentage.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def disconnect_percentage @disconnect_percentage end |
#disconnects ⇒ Object (readonly)
Returns the value of attribute disconnects.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def disconnects @disconnects end |
#gold_earned ⇒ Object (readonly)
Returns the value of attribute gold_earned.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def gold_earned @gold_earned end |
#gold_earned_per_minute ⇒ Object (readonly)
Returns the value of attribute gold_earned_per_minute.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def gold_earned_per_minute @gold_earned_per_minute end |
#gold_spent ⇒ Object (readonly)
Returns the value of attribute gold_spent.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def gold_spent @gold_spent end |
#kicked ⇒ Object (readonly)
Returns the value of attribute kicked.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def kicked @kicked end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def level @level end |
#losses ⇒ Object (readonly)
Returns the value of attribute losses.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def losses @losses end |
#played ⇒ Object (readonly)
Returns the value of attribute played.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def played @played end |
#pub_skill ⇒ Object (readonly)
Returns the value of attribute pub_skill.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def pub_skill @pub_skill end |
#time_played ⇒ Object (readonly)
Returns the value of attribute time_played.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def time_played @time_played end |
#win_percentage ⇒ Object (readonly)
Returns the value of attribute win_percentage.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def win_percentage @win_percentage end |
#wins ⇒ Object (readonly)
Returns the value of attribute wins.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def wins @wins end |
#xp_earned ⇒ Object (readonly)
Returns the value of attribute xp_earned.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def xp_earned @xp_earned end |
#xp_earned_per_minute ⇒ Object (readonly)
Returns the value of attribute xp_earned_per_minute.
71 72 73 |
# File 'lib/honstats/character.rb', line 71 def xp_earned_per_minute @xp_earned_per_minute end |