# hekili/hekili architecture

> Architecture diagram of the GitHub repository hekili/hekili, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hekili/hekili
- Repository: https://github.com/hekili/hekili

## Overview

##### Main Components

a. Core System Components:
- Core Engine (Core.lua, State.lua)
- Event Handler (Events.lua)
- Class Management (Classes.lua)
- Target System (Targets.lua)

b. Specialization Components:
- Class-specific Modules (TheWarWithin directory)
- Priority Lists (TheWarWithin/Priorities/*.simc files)

c. User Interface Layer:
- Main UI (UI.lua)
- Options Panel (Options.lua)
- Popup Components (UI/PopupSlider)

d. Game Version-Specific Modules:
- Dragonflight
- Shadowlands
- BfA
- Legion
- Wrath
- TheBurningCrusade

**[User Interface Layer]**
- ↕
**[Core Engine Layer]**
- ↕
**[Specialization Layer]**
- ↕
**[Game Systems Integration]**

##### Component Relationships

- Core Engine ←→ Event Handler (bidirectional)
- Core Engine → State Management
- Event Handler → Class Management
- Core Engine → Priority System
- UI Layer → Core Engine
- Specialization Modules → Priority Lists

##### Detailed Component Breakdown

Core Engine:
**[Core Engine]**
- State Management
- Event Processing
- Priority Calculation
- Action Recommendation

Specialization System:
**[Spec System]**
- Class Modules
- Priority Lists
- Rotation Logic

##### Integration Points

Clear integration points with:
- WoW API
- SpellFlashCore Library
- Configuration System

- The modular nature of the addon
- Clear separation between core functionality and spec-specific logic
- The event-driven architecture
- The priority calculation pipeline

Remember to:
- Keep the main flow clear and easy to follow
- Related components together
- Clear data flow directions
- Version-specific boundaries

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef ui fill:#4CAF50,stroke:#388E3B,color:white
    classDef spec fill:#FF9800,stroke:#F57C00,color:white
    classDef game fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef config fill:#FFC107,stroke:#FFA000,color:black
    classDef external fill:#607D8B,stroke:#455A64,color:white

    %% Core Layer
    subgraph CoreLayer["Core System Layer"]
        CoreEngine["Core Engine"]
        StateManagement["State Management"]
        EventHandler["Event Handler"]
        ClassManagement["Class Management"]
        TargetSystem["Target System"]
        
        CoreEngine --> StateManagement
        CoreEngine <--> EventHandler
        EventHandler --> ClassManagement
        CoreEngine --> TargetSystem
    end

    %% UI Layer
    subgraph UILayer["User Interface Layer"]
        MainUI["Main UI"]
        OptionsPanel["Options Panel"]
        PopupComponents["Popup Components"]
    end

    %% Specialization Layer
    subgraph SpecLayer["Specialization Layer"]
        ClassModules["Class Modules"]
        PriorityLists["Priority Lists"]
        RotationLogic["Rotation Logic"]
        
        ClassModules --> PriorityLists
        PriorityLists --> RotationLogic
    end

    %% Game Version Layer
    subgraph GameVersions["Game Version Modules"]
        direction TB
        Dragonflight["Dragonflight"]
        Shadowlands["Shadowlands"]
        BfA["Battle for Azeroth"]
        Legion["Legion"]
        Wrath["Wrath"]
        TBC["The Burning Crusade"]
    end

    %% Utility Components
    subgraph Utils["Utility Components"]
        Formatting["Formatting"]
        Constants["Constants"]
        Scripts["Scripts"]
    end

    %% External Integration
    SpellFlashCore["SpellFlashCore Library"]
    WoWAPI["WoW API"]

    %% Relationships
    UILayer --> CoreLayer
    CoreLayer --> SpecLayer
    SpecLayer --> GameVersions
    CoreLayer --> WoWAPI
    CoreLayer --> SpellFlashCore
    Utils --> CoreLayer

    %% Click Events
    click CoreEngine "https://github.com/Hekili/hekili/blob/thewarwithin/Core.lua"
    click StateManagement "https://github.com/Hekili/hekili/blob/thewarwithin/State.lua"
    click EventHandler "https://github.com/Hekili/hekili/blob/thewarwithin/Events.lua"
    click ClassManagement "https://github.com/Hekili/hekili/blob/thewarwithin/Classes.lua"
    click TargetSystem "https://github.com/Hekili/hekili/blob/thewarwithin/Targets.lua"
    click ClassModules "https://github.com/Hekili/hekili/tree/thewarwithin/TheWarWithin"
    click PriorityLists "https://github.com/Hekili/hekili/tree/thewarwithin/TheWarWithin/Priorities"
    click MainUI "https://github.com/Hekili/hekili/blob/thewarwithin/UI.lua"
    click OptionsPanel "https://github.com/Hekili/hekili/blob/thewarwithin/Options.lua"
    click PopupComponents "https://github.com/Hekili/hekili/blob/thewarwithin/UI/PopupSlider.lua"
    click Dragonflight "https://github.com/Hekili/hekili/tree/thewarwithin/Dragonflight"
    click Shadowlands "https://github.com/Hekili/hekili/tree/thewarwithin/Shadowlands"
    click BfA "https://github.com/Hekili/hekili/tree/thewarwithin/BfA"
    click Legion "https://github.com/Hekili/hekili/tree/thewarwithin/Legion"
    click Wrath "https://github.com/Hekili/hekili/tree/thewarwithin/Wrath"
    click TBC "https://github.com/Hekili/hekili/tree/thewarwithin/TheBurningCrusade"
    click SpellFlashCore "https://github.com/Hekili/hekili/tree/thewarwithin/Libs/SpellFlashCore"
    click Formatting "https://github.com/Hekili/hekili/blob/thewarwithin/Formatting.lua"
    click Constants "https://github.com/Hekili/hekili/blob/thewarwithin/Constants.lua"
    click Scripts "https://github.com/Hekili/hekili/blob/thewarwithin/Scripts.lua"

    %% Style Applications
    class CoreEngine,StateManagement,EventHandler,ClassManagement,TargetSystem core
    class MainUI,OptionsPanel,PopupComponents ui
    class ClassModules,PriorityLists,RotationLogic spec
    class Dragonflight,Shadowlands,BfA,Legion,Wrath,TBC game
    class Formatting,Constants,Scripts config
    class SpellFlashCore,WoWAPI external
```
