promotional bannermobile promotional banner

Honor Bar

Adjustable XP like honor progress bar with battleground stats for Classic Era and TBC Anniversary.

File Details

Honor Bar 1.4.zip

  • R
  • Dec 9, 2025
  • 25.79 KB
  • 280
  • 1.15.8
  • Classic

File Name

Honor Bar 1.4.zip

Supported Versions

  • 1.15.8

1) Dedicated in-game Help Window (replaces simple chat dump)

  - HonorHelp.lua now defines a full help popup UI with:
    - A titled frame
    - ScrollFrame
    - FontString content
    - Close button and ESC handling
  - A new function `HP_ShowHelpPopup()` shows the window.
  - A new function `HP_ToggleHelpDialog()` toggles the window on/off.
  - Help text is much more detailed, including:
    - General commands (`/honor`, `/honordebug`, `/honorcap`, `/honor config`, `/honorpull`, `/hbpull`, `/cpull`, etc.)
    - Descriptions for:
      - Config checkboxes (Hide Bar Text, Only Numbers, Bar labels bottom, Hide Bar, Hide Ticks, Enable !honor, Auto (Honor Cap), Detach Stats)
      - Config sliders (Width, Height, Stats Refresh (s), Tick Width, Tick Amount, Honor Cap)
      - Color swatches (Bar Fill Color, Tick Color, Milestone Color)
  - The old “printHelp() to chat only” logic is gone; instead, the help frame content is built via `BuildHelpText()`.


2) Detached Session Stats Frame (“Detach Stats”)

- New SavedVariables:
  - `HonorProgressDB.detachStats` (boolean, default false)
- New functions:
  - `EnsureStatsFrame()`
  - `UpdateStatsFrame()`
- New UI:
  - A transparent floating frame named `"HonorBarSessionStatsFrame"`.
  - Movable with Alt + Left-click drag.
  - Text auto-resizes the frame width/height to fit content.

- New checkbox in config:
  - Label in code: `"Detach Stats"`
  - Stored as `HonorProgressDB.detachStats`.
  - When enabled:
    - Stats are shown in the floating frame instead of only in the bar tooltip.
  - When disabled:
    - The detached stats frame is hidden (and stats remain only on tooltip hover).

- Data shown in the detached stats frame (lines built in `UpdateStatsFrame()`):
  - Session stats:
    - Time in session (Time: HH:MM)
    - Honor gained this session (Honor: X)
    - Honor per hour (Honor / hour: Y)
  - Remaining to cap:
    - `Remaining: <honor>` based on `HonorProgressDB.honorCap` and current weekly honor.
  - Milestones:
    - A "Milestones line" that summarizes upcoming rank milestones (mirrors tooltip logic but in plain text).
  - Weekly bar summary:
    - Either:
      - `Weekly Honor: current / cap (X%)` (full text), or
      - `current / cap (X%)` (if Only Numbers is enabled).
  - ETA:
    - `ETA to <cap>: HH:MM` (time to reach honorCap at current honor/hour rate).
  - Marks of Honor:
    - `Marks: <AV icon> count AV   <AB icon> count AB   <WSG icon> count WSG`
  - Per-battleground stats:
    - `Current Game: Honor N HKs H KBs K`
    - `Last Game: Honor N HKs H KBs K`


3) Per-Battleground “Current Game” and “Last Game” Stats

- New SavedVariables:
  - `HonorProgressDB.currentGameHonor`
  - `HonorProgressDB.currentGameHK`
  - `HonorProgressDB.currentGameKB`
  - `HonorProgressDB.lastGameHonor`
  - `HonorProgressDB.lastGameHK`
  - `HonorProgressDB.lastGameKB`
- New helper locals and functions:
  - `matchHonorBaseline`, `matchHKBaseline`, `matchInstanceID`, `matchActive` (locals).
  - `HB_IsInBattleground()`
  - `HB_UpdateCurrentGameFromAPIs(deltaHonor)`
  - `HB_StartNewMatch()`
  - `HB_CheckBG()`
  - `HB_OnCombatLogEvent()`

- Behavior:
  - `HB_IsInBattleground()`:
    - Uses `IsInInstance()` and `instanceType == "pvp"` to determine if you are inside a battleground.
  - `HB_StartNewMatch()`:
    - Guarded by `HB_IsInBattleground()`; does nothing if not actually in a BG.
    - Promotes current → last:
      - `lastGameHonor = currentGameHonor`
      - `lastGameHK = currentGameHK`
      - `lastGameKB = currentGameKB`
    - Resets current game stats:
      - `matchActive = true`
      - `currentGameHonor = 0`
      - `currentGameHK = 0`
      - `currentGameKB = 0`
    - Resets baselines:
      - `matchHonorBaseline = nil`
      - `matchHKBaseline` from `GetPVPSessionStats()` at match start.
  - `HB_UpdateCurrentGameFromAPIs(deltaHonor)`:
    - Extra safety guard:
      - Returns early if:
        - `not HonorProgressDB`, or
        - `not HB_IsInBattleground()`, or
        - `not matchActive`.
    - Honor:
      - On first update of a match, captures `matchHonorBaseline = weeklyHonor`.
      - On subsequent updates:
        - `currentGameHonor = max(0, weeklyHonor - matchHonorBaseline)`.
    - HKs:
      - Uses `GetPVPSessionStats()` minus `matchHKBaseline` for per-match HK count.
  - `HB_CheckBG()`:
    - Tracks `matchInstanceID` using `GetInstanceInfo()`:
      - When a new BG instance ID is detected, calls `HB_StartNewMatch()`.
      - When leaving any instance/world:
        - Clears `matchInstanceID` and sets `matchActive = false`.
  - `HB_OnCombatLogEvent()`:
    - Listens for `COMBAT_LOG_EVENT_UNFILTERED`.
    - On `PARTY_KILL` events where the player is the source and the victim is a player:
      - Increments `HonorProgressDB.currentGameKB` by 1.

- UI presentation:
  - These “Current Game” and “Last Game” lines:
    - Are appended to the detached stats frame (if enabled).
    - Persist in SavedVariables across reloads/logouts until overwritten by a new battleground.


4) Marks of Honor Summary Line

- New constants and helpers:
  - `MARK_AV`, `MARK_AB`, `MARK_WSG` item IDs.
  - `HB_GetMarkCounts()`:
    - Uses `GetItemCount(MARK_AV / MARK_AB / MARK_WSG)` to get the number of marks you have.
  - `HB_GetMarkLine()`:
    - Builds a string with embedded icons and counts:
      - `|T<AV icon>:16:16|t <count> AV   |T<AB icon>:16:16|t <count> AB   |T<WSG icon>:16:16|t <count> WSG`
- Usage:
  - `UpdateStatsFrame()` calls `HB_GetMarkLine()` and appends:
    - `Marks: <line>` as the last line of the detached stats block.


5) “Bar labels bottom” Option for Rank/Milestone Labels

- New SavedVariable:
  - `HonorProgressDB.milestoneLabelsBottom` (boolean, default false).
- New checkbox in config:
  - Internal name: `HP_Adjust_LabelsBottom`.
  - Label text: `"Bar Labels Bottom"`.
  - When clicked:
    - `HonorProgressDB.milestoneLabelsBottom = true/false`
    - Calls `CreateOrUpdateMilestoneTicks()` to re-anchor labels.

- Milestone label anchoring change:
  - 1.3.1:
    - Milestone labels always anchored *above* the tick:
      - `lbl:SetPoint("BOTTOM", t, "TOP", 0, 2)`
  - 1.4:
    - Conditional anchor:
      - If `milestoneLabelsBottom == true`:
        - `lbl:SetPoint("TOP", t, "BOTTOM", 0, -2)`  (labels UNDER the bar)
      - Else:
        - `lbl:SetPoint("BOTTOM", t, "TOP", 0, 2)`  (labels ABOVE the bar, original behavior)


6) Stats Refresh Slider (replaces Tick Opacity slider)

- New SavedVariable:
  - `HonorProgressDB.statsRefresh` (default `1.0` seconds).
- Config slider:
  - Name: `"HP_Adjust_TOp"`
  - Label: `"Stats Refresh (s)"`
  - Range: `0.2` to `2.0` seconds with `0.2` increments.
- Used by:
  - The internal refresh logic for:
    - Detached stats updates
    - Honor / ETA / honor-per-hour / current & last game updates
- Tick opacity:
  - `HonorProgressDB.tickOpacity` still exists as a DB field and is used as a fallback default for `milestoneOpacity`, but the **UI-facing “Tick Opacity” slider** has been replaced by **“Stats Refresh (s)”** in 1.4.
- Help text change:
  - 1.3.1: Help mentions a “Tick Opacity” slider.
  - 1.4: Help now describes “Stats Refresh (s) – seconds between honor/stats updates” and no longer lists “Tick Opacity” as a separate slider.


==================================================
CONFIG / OPTIONS UI CHANGES
==================================================

- Checkboxes:
  - Existing:
    - Hide Bar Text
    - Only Numbers
    - Hide Bar
    - Hide Ticks
    - Enable !honor
    - Auto (Honor Cap)
  - New:
    - Bar labels bottom
      - Toggles `HonorProgressDB.milestoneLabelsBottom`.
    - Detach Stats
      - Toggles `HonorProgressDB.detachStats`.

- Sliders:
  - Existing sliders remain:
    - Width
    - Height
    - Tick Width
    - Tick Amount
    - Honor Cap
  - New / repurposed:
    - Stats Refresh (s)
      - Replaces the UI slot previously used for Tick Opacity.
      - Controls the frequency of honor/stats updates.

- Help / docs:
  - HonorHelp.lua expanded to a full descriptive guide:
    - Lists all checkboxes including Bar labels bottom and Detach Stats.
    - Lists Stats Refresh (s) slider instead of Tick Opacity.
    - Documents the pull timer commands (`/honorpull`, `/hbpull`, `/cpull`).


==================================================
INTERNAL / TECHNICAL CHANGES
==================================================

- New local state:
  - `inBG`, `matchHonorBaseline`, `matchHKBaseline`, `matchInstanceID`, `matchActive`.
- New BG-tracking functions:
  - `HB_IsInBattleground()`:
    - Wraps `IsInInstance()` and checks for `instanceType == "pvp"`.
  - `HB_CheckBG()`:
    - Tracks transitions into new battleground instances via `GetInstanceInfo()` and `instID`.
    - Starts new matches only when:
      - In a BG AND
      - `instanceID` is different from `matchInstanceID` (or `matchInstanceID` is nil).
    - On leaving any instance:
      - Clears `matchInstanceID` and sets `matchActive = false`.
  - `HB_OnCombatLogEvent()`:
    - Uses `COMBAT_LOG_EVENT_UNFILTERED` to track killing blows (`PARTY_KILL` with the player as the source).

- New detached stats frame builder:
  - `EnsureStatsFrame()`:
    - Creates and configures a Frame, ScrollChild, and FontString for the session stats UI.
  - `UpdateStatsFrame()`:
    - Computes session stats, honor per hour, remaining to cap, ETA, milestones, marks of honor, and current/last game stats, then displays them.

- SavedVariables extension:
  - Now includes:
    - `detachStats`
    - `statsRefresh`
    - `milestoneLabelsBottom`
    - `currentGameHonor`, `currentGameHK`, `currentGameKB`
    - `lastGameHonor`, `lastGameHK`, `lastGameKB`
  - Still maintains existing fields:
    - `honorCap`, `autoOn`, `showTicks`, `tickOpacity`, `tickWidth`, `hideTicks`, `hiddenBar`, `barColor`, `hideBarText`, `onlyNumbers`, `tickRGB`, `milestoneRGB`, `tickCount`, `showText`, `visible`, `autoCapFromRank`, `autoCapSteps`, `finalCongratsByChar`, `width`, `height`.


==================================================
SUMMARY
==================================================

- Adds a robust in-game help window instead of just printing help to chat.
- Introduces a detachable floating session stats frame with:
  - Session time / honor / honor per hour.
  - Remaining to cap + ETA.
  - Milestone summary.
  - Weekly progress line.
  - Marks of Honor summary.
  - Per-battleground “Current Game” and “Last Game” stats (Honor / HKs / KBs).
- Implements proper battleground-aware tracking for current and last game stats, with baselines and instance ID tracking to prevent random resets.
- Adds a “Bar labels bottom” config option to move milestone labels below the bar.
- Replaces the Tick Opacity slider in the UI with a “Stats Refresh (s)” slider that controls how often honor/stats are updated.
- Extends SavedVariables to persist detached stats and per-game stats across reloads/logouts.