Skip to content

Commit

Permalink
add phase information to fights
Browse files Browse the repository at this point in the history
custom implementation as fflogs doesn't provide phase info in its API. it's slow but it seems to work okay.

TOP & TEA in this initial batch
  • Loading branch information
halworsen committed Sep 3, 2023
1 parent dddb5aa commit 9789161
Show file tree
Hide file tree
Showing 8 changed files with 767 additions and 5 deletions.
2 changes: 2 additions & 0 deletions fflogsapi/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class EventType(Enum):
REMOVE_DEBUFF = 'removedebuff'
LB_UPDATE = 'limitbreakupdate'
ENCOUNTER_END = 'encounterend'
TARGETABILITY_UPDATE = 'targetabilityupdate'
HEAD_MARKER = 'headmarker'


# FF Logs uses millisecond precision in its timestamps
Expand Down
9 changes: 9 additions & 0 deletions fflogsapi/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
FFLogsReportComboRanking, FFLogsReportRanking, FFLogsReportTag,
FFLogsZoneEncounterRanking, FFLogsZoneRanking, FFMap,)

from .phases import PhaseType, PhaseInformation, OmegaPhaseData, AlexanderPhaseData, ALL_PHASE_DATA

__all__ = [
# dataclasses.py
'FFLogsAllStarsRanking',
Expand All @@ -36,4 +38,11 @@
'FFLogsNPCData',
'FFGameZone',
'FFLogsPartition',

# .phases
'PhaseType',
'PhaseInformation',
'OmegaPhaseData',
'AlexanderPhaseData',
'ALL_PHASE_DATA',
]
31 changes: 31 additions & 0 deletions fflogsapi/data/phases/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'''
Custom implementation of tracking phases in fights such as ultimates
'''

from .phases import PhaseType, PhaseInformation
from .omega import OmegaPhaseData
from .alexander import AlexanderPhaseData

# I'm not super happy with these being singletons
# Should look into a better way to handle this
OmegaPhaseData = OmegaPhaseData()
AlexanderPhaseData = AlexanderPhaseData()

ALL_PHASE_DATA = [
OmegaPhaseData,
AlexanderPhaseData,
]

__all__ = [
# phases.py
'PhaseType',
'PhaseInformation',

# omega.py
'OmegaPhaseData',

# alexander.py
'AlexanderPhaseData',

'ALL_PHASE_DATA',
]
129 changes: 129 additions & 0 deletions fflogsapi/data/phases/alexander.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
from ...constants import EventType
from .phases import FightPhaseData, PhaseTransition, PhaseTransitionDefinition
from dataclasses import dataclass


@dataclass
class AlexanderPhaseData(FightPhaseData):
encounter_id: int = 1062

phases: tuple[str] = (
'Living Liquid',
'Brute Justice and Cruise Chaser',
'Alexander Prime',
'Perfect Alexander',
)

intermissions: tuple[str] = (
'Limit Cut',
'Temporal Stasis',
'Inception Formation',
'Wormhole Formation',
'P4 Transition',
'Fate Calibration Alpha',
'Fate Calibration Beta',
)

phase_definitions: tuple[tuple[int, int, list[PhaseTransition]]] = (
# LC
PhaseTransitionDefinition(
description='P1 ends, limit cut starts',
game_id=2000032,
event_def={'type': EventType.CAST.value, 'abilityGameID': 18480},
transition_types=[PhaseTransition.END, PhaseTransition.INTERMISSION_START]
),

# P2
PhaseTransitionDefinition(
description='Limit cut ends, P2 starts',
game_id=11340,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END, PhaseTransition.START]
),

# Temporal stasis
PhaseTransitionDefinition(
description='P2 ends, temporal stasis starts',
game_id=11340,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.END, PhaseTransition.INTERMISSION_START]
),
PhaseTransitionDefinition(
description='Temporal stasis ends, P3 begins',
game_id=11347,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END, PhaseTransition.START]
),

# Inception
PhaseTransitionDefinition(
description='Inception formation begins',
game_id=11347,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.INTERMISSION_START]
),
PhaseTransitionDefinition(
description='Inception formation ends',
game_id=11347,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END]
),

# Wormhole
PhaseTransitionDefinition(
description='Wormhole formation begins',
game_id=11347,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.INTERMISSION_START]
),
PhaseTransitionDefinition(
description='Wormhole formation ends',
game_id=11347,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END]
),

# P4 transition
PhaseTransitionDefinition(
description='P3 ends, P4 transition begins',
game_id=11347,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.END, PhaseTransition.INTERMISSION_START]
),

# P4
PhaseTransitionDefinition(
description='Transition ends, P4 begins',
game_id=11349,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.START, PhaseTransition.INTERMISSION_END]
),

# Fate alpha
PhaseTransitionDefinition(
description='Fate calibration alpha begins',
game_id=11349,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.INTERMISSION_START]
),
PhaseTransitionDefinition(
description='Fate calibration alpha ends',
game_id=11349,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END]
),

# Fate beta
PhaseTransitionDefinition(
description='Fate calibration beta begins',
game_id=11349,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.INTERMISSION_START]
),
PhaseTransitionDefinition(
description='Fate calibration beta ends',
game_id=11349,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END]
),
)
165 changes: 165 additions & 0 deletions fflogsapi/data/phases/omega.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
from ...constants import EventType
from .phases import FightPhaseData, PhaseTransition, PhaseTransitionDefinition
from dataclasses import dataclass


@dataclass
class OmegaPhaseData(FightPhaseData):
encounter_id: int = 1068

phases: tuple[str] = (
'Omega',
'Omega M/F',
'Omega Reconfigured',
'Blue Screen',
'Run: Dynamis',
'Alpha Omega',
)

intermissions: tuple[str] = (
'Party Synergy',
'P3 Transition',
'P5 Transition',
'Run: ****mi* (Delta)',
'Run: ****mi* (Sigma)',
'Run: ****mi* (Omega)',
'P6 Transition',
)

phase_definitions: tuple[tuple[int, int, list[PhaseTransition]]] = (
# P2
PhaseTransitionDefinition(
description='P1 ends and P2 starts',
game_id=15712,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.END, PhaseTransition.START]
),
PhaseTransitionDefinition(
description='P2 - Party synergy mechanic begins',
game_id=15712,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.INTERMISSION_START]
),
PhaseTransitionDefinition(
description='P2 - Party synergy mechanic ends',
game_id=15712,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END]
),

# P3
PhaseTransitionDefinition(
description='P2 ends, P3 starts with the transition mechanic',
game_id=15712,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[
PhaseTransition.END,
PhaseTransition.START,
PhaseTransition.INTERMISSION_START,
]
),
PhaseTransitionDefinition(
description='P3 transition ends, Omega becomes targetable',
game_id=15717,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END]
),

# Could add an intermission between P3-P4 but idk if there's any point as there's no damage

# P4
PhaseTransitionDefinition(
description='P3 ends and P4 begins as Omega becomes targetable again',
game_id=15717,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.END, PhaseTransition.START]
),

# P5
PhaseTransitionDefinition(
description='P5 transition starts',
game_id=15717,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.INTERMISSION_START]
),

PhaseTransitionDefinition(
description='P4 & P5 transition ends, P5 starts',
game_id=15720,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[
PhaseTransition.END,
PhaseTransition.INTERMISSION_END,
PhaseTransition.START,
]
),

# Dynamis delta
PhaseTransitionDefinition(
description='P5 - Run: ****mi* (Delta) begins',
game_id=15720,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.INTERMISSION_START]
),
PhaseTransitionDefinition(
description='P5 - Run: ****mi* (Delta) ends',
game_id=15720,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END]
),

# Dynamis sigma
PhaseTransitionDefinition(
description='P5 - Run: ****mi* (Sigma) begins',
game_id=15720,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.INTERMISSION_START]
),
PhaseTransitionDefinition(
description='P5 - Run: ****mi* (Sigma) ends',
game_id=15720,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END]
),

# Dynamis omega
PhaseTransitionDefinition(
description='P5 - Run: ****mi* (Omega) begins',
game_id=15720,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[PhaseTransition.INTERMISSION_START]
),
PhaseTransitionDefinition(
description='P5 - Run: ****mi* (Omega) ends',
game_id=15720,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END]
),

# P6
PhaseTransitionDefinition(
description='P5 ends and P6 transition begins',
game_id=15720,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 0},
transition_types=[
PhaseTransition.END,
PhaseTransition.INTERMISSION_START,
]
),

PhaseTransitionDefinition(
description='P6 begins with Omega-F casting Blind Faith',
game_id=2000021,
event_def={'type': EventType.CAST.value, 'abilityGameID': 32626},
transition_types=[
PhaseTransition.START,
]
),

PhaseTransitionDefinition(
description='P6 transition ends',
game_id=15725,
event_def={'type': EventType.TARGETABILITY_UPDATE.value, 'targetable': 1},
transition_types=[PhaseTransition.INTERMISSION_END]
),
)
Loading

0 comments on commit 9789161

Please sign in to comment.