Class: Purtea::FFLogs::Fight
- Inherits:
-
Object
- Object
- Purtea::FFLogs::Fight
- Defined in:
- lib/purtea/fflogs/fight.rb
Overview
Describes a fight entry in FF Logs.
Constant Summary collapse
- ISO_FORMAT =
'%Y-%m-%dT%H:%M:%S%:z'
Instance Attribute Summary collapse
-
#boss_percentage ⇒ Object
readonly
Returns the value of attribute boss_percentage.
-
#difficulty ⇒ Object
readonly
Returns the value of attribute difficulty.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#encounter_id ⇒ Object
readonly
Returns the value of attribute encounter_id.
-
#end_at ⇒ Object
readonly
Returns the value of attribute end_at.
-
#fight_percentage ⇒ Object
readonly
Returns the value of attribute fight_percentage.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#start_at ⇒ Object
readonly
Returns the value of attribute start_at.
-
#zone_id ⇒ Object
readonly
Returns the value of attribute zone_id.
-
#zone_name ⇒ Object
readonly
Returns the value of attribute zone_name.
Instance Method Summary collapse
-
#initialize(data, report_start_ms) ⇒ Fight
constructor
rubocop:disable Metrics/AbcSize.
-
#kill? ⇒ Boolean
rubocop:enable Metrics/AbcSize.
- #to_s ⇒ Object
Constructor Details
#initialize(data, report_start_ms) ⇒ Fight
rubocop:disable Metrics/AbcSize
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/purtea/fflogs/fight.rb', line 14 def initialize(data, report_start_ms) @id = data.id @encounter_id = data.encounter_id @zone_id = data.game_zone.id @name = data.name @zone_name = data.game_zone.name @difficulty = data.difficulty @boss_percentage = data.boss_percentage @fight_percentage = data.fight_percentage @start_at = report_start_ms, data.start_time @end_at = report_start_ms, data.end_time @kill = data.kill @duration = parse_duration @start_at, @end_at end |
Instance Attribute Details
#boss_percentage ⇒ Object (readonly)
Returns the value of attribute boss_percentage.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def boss_percentage @boss_percentage end |
#difficulty ⇒ Object (readonly)
Returns the value of attribute difficulty.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def difficulty @difficulty end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def duration @duration end |
#encounter_id ⇒ Object (readonly)
Returns the value of attribute encounter_id.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def encounter_id @encounter_id end |
#end_at ⇒ Object (readonly)
Returns the value of attribute end_at.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def end_at @end_at end |
#fight_percentage ⇒ Object (readonly)
Returns the value of attribute fight_percentage.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def fight_percentage @fight_percentage end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def name @name end |
#start_at ⇒ Object (readonly)
Returns the value of attribute start_at.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def start_at @start_at end |
#zone_id ⇒ Object (readonly)
Returns the value of attribute zone_id.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def zone_id @zone_id end |
#zone_name ⇒ Object (readonly)
Returns the value of attribute zone_name.
9 10 11 |
# File 'lib/purtea/fflogs/fight.rb', line 9 def zone_name @zone_name end |
Instance Method Details
#kill? ⇒ Boolean
rubocop:enable Metrics/AbcSize
30 31 32 |
# File 'lib/purtea/fflogs/fight.rb', line 30 def kill? @kill end |
#to_s ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/purtea/fflogs/fight.rb', line 34 def to_s start_f = start_at.strftime(ISO_FORMAT) end_f = end_at.strftime(ISO_FORMAT) duration = Time.at(end_at - start_at).utc.strftime('%H:%M:%S') kw = kill? ? 'CLEAR' : 'WIPE' "[#{@id}] #{start_f} -> #{end_f} [#{duration}] " \ "#{boss_percentage}% (#{fight_percentage}%) - #{kw}" end |