Class: HoN::PlayerStats

Inherits:
Stats
  • Object
show all
Defined in:
lib/hon/player.rb

Instance Method Summary collapse

Methods inherited from Stats

#[]

Constructor Details

#initialize(nickname, *options) ⇒ PlayerStats

Returns a new instance of PlayerStats.

Raises:



6
7
8
9
10
11
12
13
# File 'lib/hon/player.rb', line 6

def initialize nickname, *options
  @nickname   = nickname
  @statistics = Hash.new

  retrieve_statistics
  retrieve_heroes if options.include? :heroes
  raise PlayerError, "Player not found" if @statistics.empty?
end

Instance Method Details

#assistsObject



93
94
95
# File 'lib/hon/player.rb', line 93

def assists
  @statistics[:acc_heroassists]
end

#buybacksObject

The (total? average?) amount of hero buybacks.



49
50
51
# File 'lib/hon/player.rb', line 49

def buybacks
  @statistics[:acc_buybacks]
end

#concede_votesObject

The amount of times the player has tried to concede.



44
45
46
# File 'lib/hon/player.rb', line 44

def concede_votes
  @statistics[:acc_concedevotes]
end

#concedesObject

The total amount of games conceded.



39
40
41
# File 'lib/hon/player.rb', line 39

def concedes
  @statistics[:acc_concedes]
end

#deathsObject



97
98
99
# File 'lib/hon/player.rb', line 97

def deaths
  @statistics[:acc_deaths]
end

#disconnectsObject

The amount of times the player has disconnected from a game.



54
55
56
# File 'lib/hon/player.rb', line 54

def disconnects
  @statistics[:acc_discos]
end

#gamesObject

The total amount of games played.



24
25
26
# File 'lib/hon/player.rb', line 24

def games
  @statistics[:acc_games_played]
end

#heroesObject



117
118
119
# File 'lib/hon/player.rb', line 117

def heroes
  @heroes or {}
end

#idle_timeObject



105
106
107
# File 'lib/hon/player.rb', line 105

def idle_time
  @statistics[:acc_secs_dead]
end

#inspectObject



15
16
17
# File 'lib/hon/player.rb', line 15

def inspect
  %{<#{self.class} @nickname="#{nickname}" @games=#{games} @wins=#{wins} @losses=#{losses}>}
end

#kdrObject



113
114
115
# File 'lib/hon/player.rb', line 113

def kdr
  (kills.to_f / deaths.to_f).round 1
end

#kickedObject

The amount of times the player has been kicked from a game.



59
60
61
# File 'lib/hon/player.rb', line 59

def kicked
  @statistics[:acc_kicked]
end

#killsObject

The total amount of heroes the player has killed.



74
75
76
# File 'lib/hon/player.rb', line 74

def kills
  @statistics[:acc_herokills]
end

#lossesObject

The total amount of defeats.



34
35
36
# File 'lib/hon/player.rb', line 34

def losses
  @statistics[:acc_losses]
end

#nicknameObject



19
20
21
# File 'lib/hon/player.rb', line 19

def nickname
  @statistics[:nickname]
end

#psrObject

The players Public Skill Rating.



64
65
66
# File 'lib/hon/player.rb', line 64

def psr
  @statistics[:acc_pub_skill]
end

#public_gamesObject

The amount of public games the player has played (non-matchmaking games).



69
70
71
# File 'lib/hon/player.rb', line 69

def public_games
  @statistics[:acc_pub_count]
end

#total_damageObject

The total amount of damage the player has dealt to heroes.



79
80
81
# File 'lib/hon/player.rb', line 79

def total_damage
  @statistics[:acc_herodmg]
end

#total_expObject

The total amount of experience the player has gained.



84
85
86
# File 'lib/hon/player.rb', line 84

def total_exp
  @statistics[:acc_heroexp]
end

#total_gold_lostObject



101
102
103
# File 'lib/hon/player.rb', line 101

def total_gold_lost
  @statistics[:acc_goldlost2death]
end

#total_hero_goldObject

The total amount of gold consumed from killing enemy heroes.



89
90
91
# File 'lib/hon/player.rb', line 89

def total_hero_gold
  @statistics[:acc_herokillsgold]
end

#win_percentageObject



109
110
111
# File 'lib/hon/player.rb', line 109

def win_percentage
  (wins.to_f / games.to_f * 100).round 1
end

#winsObject

The total amount of victories.



29
30
31
# File 'lib/hon/player.rb', line 29

def wins
  @statistics[:acc_wins]
end