Class: BN::Entity::D3::Hero

Inherits:
Base
  • Object
show all
Defined in:
lib/bn/entity/d3/hero.rb

Overview

A hero within Diablo 3.

Constant Summary collapse

MAX_LEVEL =
70

Instance Method Summary collapse

Methods included from Helpers::HasAttributes

included, #update_attributes

Constructor Details

#initialize(attributes = {}) ⇒ Hero

Returns a new instance of Hero.



10
11
12
13
14
15
16
17
18
# File 'lib/bn/entity/d3/hero.rb', line 10

def initialize(attributes={})
  super

  @level ||= 1
  @paragon_level ||= 0
  @hardcore ||= false
  @seasonal ||= false
  @dead ||= false
end

Instance Method Details

#deadBoolean

Get whether this hero is dead.

Returns:

  • (Boolean)


# File 'lib/bn/entity/d3/hero.rb', line 140


#dead=Boolean

Set whether this hero is dead.

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


150
# File 'lib/bn/entity/d3/hero.rb', line 150

attribute(:dead) { |value| !!value }

#genderSymbol

Get the gender.

Returns:

  • (Symbol)


# File 'lib/bn/entity/d3/hero.rb', line 56


#gender=Symbol

Set the gender.

Parameters:

  • value (#to_sym)

Returns:

  • (Symbol)


66
# File 'lib/bn/entity/d3/hero.rb', line 66

attribute(:gender) { |value| value.to_sym }

#hardcoreBoolean

Get whether this hero is hardcore.

Returns:

  • (Boolean)


# File 'lib/bn/entity/d3/hero.rb', line 104


#hardcore=Boolean

Set whether this hero is hardcore.

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


114
# File 'lib/bn/entity/d3/hero.rb', line 114

attribute(:hardcore) { |value| !!value }

#hero_classSymbol

Get the hero class.

Returns:

  • (Symbol)


# File 'lib/bn/entity/d3/hero.rb', line 44


#hero_class=Symbol

Set the hero class.

Parameters:

  • value (#to_sym)

Returns:

  • (Symbol)


54
# File 'lib/bn/entity/d3/hero.rb', line 54

attribute(:hero_class) { |value| value.to_sym }

#idInteger

Get the ID.

Returns:

  • (Integer)


# File 'lib/bn/entity/d3/hero.rb', line 20


#id=Integer

Set the ID.

Parameters:

  • value (#to_i)

Returns:

  • (Integer)


30
# File 'lib/bn/entity/d3/hero.rb', line 30

attribute(:id) { |value| value.to_i }

#killsHash

Get the number of kills per enemy type.

Returns:

  • (Hash)


# File 'lib/bn/entity/d3/hero.rb', line 92


#kills=Hash

Set the number of kills per enemy type.

Parameters:

  • value (#to_h)

Returns:

  • (Hash)


102
# File 'lib/bn/entity/d3/hero.rb', line 102

attribute(:kills) { |value| value.to_h }

#last_updatedTime

Get the last updated time.

Returns:

  • (Time)


# File 'lib/bn/entity/d3/hero.rb', line 128


#last_updated=Time

Set the last updated time.

Parameters:

  • value (Time, #to_i)

Returns:

  • (Time)


138
# File 'lib/bn/entity/d3/hero.rb', line 138

attribute(:last_updated) { |value| convert_time(value) }

#levelInteger

Get the level.

Returns:

  • (Integer)


# File 'lib/bn/entity/d3/hero.rb', line 68


#level=Integer

Set the level.

Parameters:

  • value (#to_i)

Returns:

  • (Integer)


78
# File 'lib/bn/entity/d3/hero.rb', line 78

attribute(:level) { |value| validate_level(value) }

#nameString

Get the name.

Returns:

  • (String)


# File 'lib/bn/entity/d3/hero.rb', line 32


#name=String

Set the name.

Parameters:

  • value (#to_s)

Returns:

  • (String)


42
# File 'lib/bn/entity/d3/hero.rb', line 42

attribute(:name) { |value| value.to_s.strip }

#paragon_levelInteger

Get the paragon level.

Returns:

  • (Integer)


# File 'lib/bn/entity/d3/hero.rb', line 80


#paragon_level=Integer

Set the paragon level.

Parameters:

  • value (#to_i)

Returns:

  • (Integer)


90
# File 'lib/bn/entity/d3/hero.rb', line 90

attribute(:paragon_level) { |value| validate_level(value, true) }

#seasonalBoolean

Get whether this hero is seasonal.

Returns:

  • (Boolean)


# File 'lib/bn/entity/d3/hero.rb', line 116


#seasonal=Boolean

Set whether this hero is seasonal.

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


126
# File 'lib/bn/entity/d3/hero.rb', line 126

attribute(:seasonal) { |value| !!value }