Class: DDAPI::User
- Inherits:
-
Object
- Object
- DDAPI::User
- Defined in:
- lib/dd-api/classes.rb
Overview
Represents a DRPG user.
Instance Attribute Summary collapse
-
#deaths ⇒ Integer
(also: #frags)
How much deaths that user has.
-
#donated ⇒ true, false
(also: #donated?)
Whether the user donated to Discord Dungeons or not.
-
#gold ⇒ Integer
How much gold that user has.
-
#hp ⇒ Integer
(also: #health)
How much health that user has.
-
#id ⇒ Integer
The ID of the user.
-
#kills ⇒ Integer
How much kills that user has.
-
#level ⇒ Integer
The level at that time, of the user.
-
#max_hp ⇒ Integer
(also: #max_health)
How much maximun health that user has.
-
#name ⇒ Srting
(also: #nickname)
The name of the user.
-
#xp ⇒ Integer
(also: #experience)
How much experience that user has.
Instance Method Summary collapse
-
#guild ⇒ Guild?
The user’s guild.
-
#initialize(data, app) ⇒ User
constructor
A new instance of User.
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
Constructor Details
#initialize(data, app) ⇒ User
Returns a new instance of User.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/dd-api/classes.rb', line 61 def initialize(data, app) @data = data['data'] @id = data['id'] @name = @data['name'] @level = @data['level'] @hp = @data['hp'] @max_hp = @data['maxhp'] @gold = @data['gold'] @xp = @data['xp'] @kills = @data['kills'] @deaths = @data['deaths'] @weapon_id = @data['weapon'] @donated = @data['donate'] @guild = @data['guild'] @app = app end |
Instance Attribute Details
#deaths ⇒ Integer Also known as: frags
Returns How much deaths that user has.
34 35 36 |
# File 'lib/dd-api/classes.rb', line 34 def deaths @deaths end |
#donated ⇒ true, false Also known as: donated?
Returns whether the user donated to Discord Dungeons or not.
58 59 60 |
# File 'lib/dd-api/classes.rb', line 58 def donated @donated end |
#gold ⇒ Integer
Returns How much gold that user has.
41 42 43 |
# File 'lib/dd-api/classes.rb', line 41 def gold @gold end |
#hp ⇒ Integer Also known as: health
Returns How much health that user has.
30 31 32 |
# File 'lib/dd-api/classes.rb', line 30 def hp @hp end |
#id ⇒ Integer
Returns The ID of the user.
55 56 57 |
# File 'lib/dd-api/classes.rb', line 55 def id @id end |
#kills ⇒ Integer
Returns How much kills that user has.
38 39 40 |
# File 'lib/dd-api/classes.rb', line 38 def kills @kills end |
#level ⇒ Integer
Returns The level at that time, of the user.
48 49 50 |
# File 'lib/dd-api/classes.rb', line 48 def level @level end |
#max_hp ⇒ Integer Also known as: max_health
Returns How much maximun health that user has.
51 52 53 |
# File 'lib/dd-api/classes.rb', line 51 def max_hp @max_hp end |
#name ⇒ Srting Also known as: nickname
Returns The name of the user.
26 27 28 |
# File 'lib/dd-api/classes.rb', line 26 def name @name end |
#xp ⇒ Integer Also known as: experience
Returns How much experience that user has.
44 45 46 |
# File 'lib/dd-api/classes.rb', line 44 def xp @xp end |
Instance Method Details
#guild ⇒ Guild?
Returns the user’s guild.
79 80 81 82 83 84 85 |
# File 'lib/dd-api/classes.rb', line 79 def guild if @guild != "" @app.guild(@guild) else nil end end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
88 89 90 |
# File 'lib/dd-api/classes.rb', line 88 def inspect "#<DDAPI::User name=#{@name} id=#{@id} level=#{@level}>" end |