Top Level Namespace
Defined Under Namespace
Modules: Purtea
Constant Summary collapse
- TEA_ZONE_ID =
887
Instance Method Summary collapse
-
#calc_end_phase(fight) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity.
- #float_comp(first, second) ⇒ Object
- #format_percentage(percentage) ⇒ Object
-
#parse_fight(fight) ⇒ Object
rubocop:disable Metrics/AbcSize.
Instance Method Details
#calc_end_phase(fight) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/purtea/cli.rb', line 19 def calc_end_phase(fight) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity return '???' unless fight.zone_id == TEA_ZONE_ID return 'N/A' if fight.boss_percentage.nil? || fight.fight_percentage.nil? if fight.boss_percentage.zero? && fight.fight_percentage >= 80.0 return 'Living Liquid (LL)' end if fight.boss_percentage.positive? && fight.fight_percentage > 75.0 return 'Living Liquid (LL)' end if fight.boss_percentage.zero? && float_comp(fight.fight_percentage, 75.0) return 'Limit Cut (LC)' end if fight.fight_percentage >= 50.0 && fight.fight_percentage <= 75.0 && fight.boss_percentage >= 0.0 return 'Brute Justice / Cruise Chaser (BJ/CC)' end if fight.fight_percentage <= 50.0 && fight.fight_percentage >= 30.0 return 'Alexander Prime (AP)' end 'Perfect Alexander (PA)' end |
#float_comp(first, second) ⇒ Object
15 16 17 |
# File 'lib/purtea/cli.rb', line 15 def float_comp(first, second) (first - second).abs < Float::EPSILON end |
#format_percentage(percentage) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/purtea/cli.rb', line 7 def format_percentage(percentage) if percentage.nil? 'N/A' else format('%.2f%%', percentage) end end |
#parse_fight(fight) ⇒ Object
rubocop:disable Metrics/AbcSize
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/purtea/cli.rb', line 48 def parse_fight(fight) # rubocop:disable Metrics/AbcSize [ fight.id, fight.encounter_id, fight.zone_id, fight.zone_name, fight.name, fight.difficulty, format_percentage(fight.boss_percentage), format_percentage(fight.fight_percentage), fight.start_at.strftime(Purtea::FFLogs::Fight::ISO_FORMAT), fight.end_at.strftime(Purtea::FFLogs::Fight::ISO_FORMAT), fight.duration.strftime('%H:%M:%S'), calc_end_phase(fight), fight.kill? ? 'Y' : 'N' ] end |