Class: HonStats::Classes::Hero

Inherits:
Object
  • Object
show all
Defined in:
lib/honstats/character.rb

Overview

Consilidated hero stats

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Hero



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/honstats/character.rb', line 177

def initialize(data)
  @kills =        HonStats::API.get_data("acc_herokills", data).to_i
     @damage =       HonStats::API.get_data("acc_herodmg", data).to_i
     @xp =           HonStats::API.get_data("acc_heroexp", data).to_i
     @gold =         HonStats::API.get_data("acc_herokillsgold", data).to_i
     @assists =      HonStats::API.get_data("acc_heroassists", data).to_i
     @deaths =       HonStats::API.get_data("acc_deaths", data).to_i
     @gold_lost =    HonStats::API.get_data("acc_goldlost2death", data).to_i
     @seconds_dead = HonStats::API.get_data("acc_secs_dead", data).to_i
     @buybacks =     HonStats::API.get_data("acc_buybacks", data).to_i
     @consumables =  HonStats::API.get_data("acc_consumables", data).to_i
     @wards =        HonStats::API.get_data("acc_wards", data).to_i

     seconds_played = HonStats::API.get_data("acc_secs", data).to_i
     minutes_played = seconds_played / 60
     @kills_per_minute = "%.02f" % (@kills.to_f / minutes_played.to_f)
     @assists_per_minute = "%.02f" % (@assists.to_f / minutes_played.to_f)
     @xp_per_minute = "%.02f" % (@xp.to_f / minutes_played.to_f)
     @time_dead_percentage = "%.02f" % ((@seconds_dead.to_f / seconds_played.to_f) * 100)
     @kill_death_ratio = "%.02f" % (@kills.to_f / @deaths.to_f)
end

Instance Attribute Details

#assistsObject (readonly)

Returns the value of attribute assists.



172
173
174
# File 'lib/honstats/character.rb', line 172

def assists
  @assists
end

#assists_per_minuteObject (readonly)

Returns the value of attribute assists_per_minute.



172
173
174
# File 'lib/honstats/character.rb', line 172

def assists_per_minute
  @assists_per_minute
end

#buybacksObject (readonly)

Returns the value of attribute buybacks.



172
173
174
# File 'lib/honstats/character.rb', line 172

def buybacks
  @buybacks
end

#consumablesObject (readonly)

Returns the value of attribute consumables.



172
173
174
# File 'lib/honstats/character.rb', line 172

def consumables
  @consumables
end

#damageObject (readonly)

Returns the value of attribute damage.



172
173
174
# File 'lib/honstats/character.rb', line 172

def damage
  @damage
end

#deathsObject (readonly)

Returns the value of attribute deaths.



172
173
174
# File 'lib/honstats/character.rb', line 172

def deaths
  @deaths
end

#goldObject (readonly)

Returns the value of attribute gold.



172
173
174
# File 'lib/honstats/character.rb', line 172

def gold
  @gold
end

#gold_lostObject (readonly)

Returns the value of attribute gold_lost.



172
173
174
# File 'lib/honstats/character.rb', line 172

def gold_lost
  @gold_lost
end

#kill_death_ratioObject (readonly)

Returns the value of attribute kill_death_ratio.



172
173
174
# File 'lib/honstats/character.rb', line 172

def kill_death_ratio
  @kill_death_ratio
end

#killsObject (readonly)

Returns the value of attribute kills.



172
173
174
# File 'lib/honstats/character.rb', line 172

def kills
  @kills
end

#kills_per_minuteObject (readonly)

Returns the value of attribute kills_per_minute.



172
173
174
# File 'lib/honstats/character.rb', line 172

def kills_per_minute
  @kills_per_minute
end

#seconds_deadObject (readonly)

Returns the value of attribute seconds_dead.



172
173
174
# File 'lib/honstats/character.rb', line 172

def seconds_dead
  @seconds_dead
end

#time_dead_percentageObject (readonly)

Returns the value of attribute time_dead_percentage.



172
173
174
# File 'lib/honstats/character.rb', line 172

def time_dead_percentage
  @time_dead_percentage
end

#wardsObject (readonly)

Returns the value of attribute wards.



172
173
174
# File 'lib/honstats/character.rb', line 172

def wards
  @wards
end

#xpObject (readonly)

Returns the value of attribute xp.



172
173
174
# File 'lib/honstats/character.rb', line 172

def xp
  @xp
end

#xp_per_minuteObject (readonly)

Returns the value of attribute xp_per_minute.



172
173
174
# File 'lib/honstats/character.rb', line 172

def xp_per_minute
  @xp_per_minute
end