Class: Dota::API::Match::Player

Inherits:
BasicPlayer show all
Defined in:
lib/dota/api/match/player.rb

Constant Summary collapse

SLOT_GAP =
128

Constants inherited from BasicPlayer

BasicPlayer::STATUS, BasicPlayer::TYPES

Instance Attribute Summary

Attributes inherited from Entity

#raw

Instance Method Summary collapse

Methods inherited from BasicPlayer

#assists, #denies, #gold, #gpm, #hero, #id, #kills, #last_hits, #level, #xpm

Methods included from Utilities::Inspectable

#inspect

Methods inherited from Entity

#initialize

Constructor Details

This class inherits a constructor from Dota::API::Entity

Instance Method Details

#ability_upgradesObject



44
45
46
47
48
# File 'lib/dota/api/match/player.rb', line 44

def ability_upgrades
  raw["ability_upgrades"] ?
    raw["ability_upgrades"].map { |ability_upgrade| AbilityUpgrade.new(ability_upgrade) } :
    []
end

#additional_unitsObject



38
39
40
41
42
# File 'lib/dota/api/match/player.rb', line 38

def additional_units
  raw["additional_units"] ?
    raw["additional_units"].map { |unit| Unit.new(unit["unitname"], extract_items_from(unit)) } :
    []
end

#deathsObject



18
19
20
# File 'lib/dota/api/match/player.rb', line 18

def deaths
  raw["deaths"]
end

#gold_spentObject



22
23
24
# File 'lib/dota/api/match/player.rb', line 22

def gold_spent
  raw["gold_spent"]
end

#hero_damageObject



26
27
28
# File 'lib/dota/api/match/player.rb', line 26

def hero_damage
  raw["hero_damage"]
end

#hero_healingObject



34
35
36
# File 'lib/dota/api/match/player.rb', line 34

def hero_healing
  raw["hero_healing"]
end

#itemsObject



50
51
52
# File 'lib/dota/api/match/player.rb', line 50

def items
  extract_items_from raw
end

#slotObject



8
9
10
11
12
# File 'lib/dota/api/match/player.rb', line 8

def slot
  slot = raw["player_slot"]
  slot -= SLOT_GAP if slot >= SLOT_GAP
  slot + 1
end

#statusObject



14
15
16
# File 'lib/dota/api/match/player.rb', line 14

def status
  STATUS[raw["leaver_status"]]
end

#tower_damageObject



30
31
32
# File 'lib/dota/api/match/player.rb', line 30

def tower_damage
  raw["tower_damage"]
end