feat: add persistent combat log window (/combatlog or /cl)

Stores up to 500 combat events in a rolling deque alongside the existing
floating combat text. Events are populated via the existing addCombatText()
call site, resolving attacker/target names from the entity manager and
player name cache at event time.

- CombatLogEntry struct in spell_defines.hpp (type, amount, spellId,
  isPlayerSource, timestamp, sourceName, targetName)
- getCombatLog() / clearCombatLog() accessors on GameHandler
- renderCombatLog() in GameScreen: scrollable two-column table (Time +
  Event), color-coded by event category, with Damage/Healing/Misc filter
  checkboxes, auto-scroll toggle, and Clear button
- /combatlog (/cl) chat command toggles the window
This commit is contained in:
Kelsi 2026-03-12 11:00:10 -07:00
parent 36d40905e1
commit 661f7e3e8d
5 changed files with 248 additions and 1 deletions

View file

@ -12160,6 +12160,21 @@ void GameHandler::addCombatText(CombatTextEntry::Type type, int32_t amount, uint
entry.age = 0.0f;
entry.isPlayerSource = isPlayerSource;
combatText.push_back(entry);
// Persistent combat log
CombatLogEntry log;
log.type = type;
log.amount = amount;
log.spellId = spellId;
log.isPlayerSource = isPlayerSource;
log.timestamp = std::time(nullptr);
std::string pname(lookupName(playerGuid));
std::string tname((targetGuid != 0) ? lookupName(targetGuid) : std::string());
log.sourceName = isPlayerSource ? pname : tname;
log.targetName = isPlayerSource ? tname : pname;
if (combatLog_.size() >= MAX_COMBAT_LOG)
combatLog_.pop_front();
combatLog_.push_back(std::move(log));
}
void GameHandler::updateCombatText(float deltaTime) {