mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
feat: color-code ENERGIZE combat text by power type
Mana (0)=blue, Rage (1)=red, Focus (2)=orange, Energy (3)=yellow, Runic Power (6)=teal. Previously all energize events showed as blue regardless of resource type, making it impossible to distinguish e.g. a Warrior's Rage generation from a Mage's Mana return. Power type is now captured from SMSG_SPELLENERGIZELOG (uint8) and SMSG_PERIODICAURALOG OBS_MOD_POWER/PERIODIC_ENERGIZE (uint32 cast to uint8) and stored in CombatTextEntry::powerType.
This commit is contained in:
parent
b9c16e9be5
commit
4507a223cc
4 changed files with 17 additions and 9 deletions
|
|
@ -2314,7 +2314,7 @@ private:
|
||||||
void handleLogoutResponse(network::Packet& packet);
|
void handleLogoutResponse(network::Packet& packet);
|
||||||
void handleLogoutComplete(network::Packet& packet);
|
void handleLogoutComplete(network::Packet& packet);
|
||||||
|
|
||||||
void addCombatText(CombatTextEntry::Type type, int32_t amount, uint32_t spellId, bool isPlayerSource);
|
void addCombatText(CombatTextEntry::Type type, int32_t amount, uint32_t spellId, bool isPlayerSource, uint8_t powerType = 0);
|
||||||
void addSystemChatMessage(const std::string& message);
|
void addSystemChatMessage(const std::string& message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ struct CombatTextEntry {
|
||||||
uint32_t spellId = 0;
|
uint32_t spellId = 0;
|
||||||
float age = 0.0f; // Seconds since creation (for fadeout)
|
float age = 0.0f; // Seconds since creation (for fadeout)
|
||||||
bool isPlayerSource = false; // True if player dealt this
|
bool isPlayerSource = false; // True if player dealt this
|
||||||
|
uint8_t powerType = 0; // For ENERGIZE: 0=mana,1=rage,2=focus,3=energy,6=runicpower
|
||||||
|
|
||||||
static constexpr float LIFETIME = 2.5f;
|
static constexpr float LIFETIME = 2.5f;
|
||||||
bool isExpired() const { return age >= LIFETIME; }
|
bool isExpired() const { return age >= LIFETIME; }
|
||||||
|
|
|
||||||
|
|
@ -3879,11 +3879,11 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
||||||
// OBS_MOD_POWER / PERIODIC_ENERGIZE: miscValue(powerType) + amount
|
// OBS_MOD_POWER / PERIODIC_ENERGIZE: miscValue(powerType) + amount
|
||||||
// Common in WotLK: Replenishment, Mana Spring Totem, Divine Plea, etc.
|
// Common in WotLK: Replenishment, Mana Spring Totem, Divine Plea, etc.
|
||||||
if (packet.getSize() - packet.getReadPos() < 8) break;
|
if (packet.getSize() - packet.getReadPos() < 8) break;
|
||||||
/*uint32_t powerType =*/ packet.readUInt32();
|
uint8_t periodicPowerType = static_cast<uint8_t>(packet.readUInt32());
|
||||||
uint32_t amount = packet.readUInt32();
|
uint32_t amount = packet.readUInt32();
|
||||||
if ((isPlayerVictim || isPlayerCaster) && amount > 0)
|
if ((isPlayerVictim || isPlayerCaster) && amount > 0)
|
||||||
addCombatText(CombatTextEntry::ENERGIZE, static_cast<int32_t>(amount),
|
addCombatText(CombatTextEntry::ENERGIZE, static_cast<int32_t>(amount),
|
||||||
spellId, isPlayerCaster);
|
spellId, isPlayerCaster, periodicPowerType);
|
||||||
} else if (auraType == 98) {
|
} else if (auraType == 98) {
|
||||||
// PERIODIC_MANA_LEECH: miscValue(powerType) + amount + float multiplier
|
// PERIODIC_MANA_LEECH: miscValue(powerType) + amount + float multiplier
|
||||||
if (packet.getSize() - packet.getReadPos() < 12) break;
|
if (packet.getSize() - packet.getReadPos() < 12) break;
|
||||||
|
|
@ -3916,13 +3916,13 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
||||||
? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet);
|
? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet);
|
||||||
rem = packet.getSize() - packet.getReadPos();
|
rem = packet.getSize() - packet.getReadPos();
|
||||||
if (rem < 6) { packet.setReadPos(packet.getSize()); break; }
|
if (rem < 6) { packet.setReadPos(packet.getSize()); break; }
|
||||||
uint32_t spellId = packet.readUInt32();
|
uint32_t spellId = packet.readUInt32();
|
||||||
/*uint8_t powerType =*/ packet.readUInt8();
|
uint8_t energizePowerType = packet.readUInt8();
|
||||||
int32_t amount = static_cast<int32_t>(packet.readUInt32());
|
int32_t amount = static_cast<int32_t>(packet.readUInt32());
|
||||||
bool isPlayerVictim = (victimGuid == playerGuid);
|
bool isPlayerVictim = (victimGuid == playerGuid);
|
||||||
bool isPlayerCaster = (casterGuid == playerGuid);
|
bool isPlayerCaster = (casterGuid == playerGuid);
|
||||||
if ((isPlayerVictim || isPlayerCaster) && amount > 0)
|
if ((isPlayerVictim || isPlayerCaster) && amount > 0)
|
||||||
addCombatText(CombatTextEntry::ENERGIZE, amount, spellId, isPlayerCaster);
|
addCombatText(CombatTextEntry::ENERGIZE, amount, spellId, isPlayerCaster, energizePowerType);
|
||||||
packet.setReadPos(packet.getSize());
|
packet.setReadPos(packet.getSize());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -13629,13 +13629,14 @@ void GameHandler::stopAutoAttack() {
|
||||||
LOG_INFO("Stopping auto-attack");
|
LOG_INFO("Stopping auto-attack");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameHandler::addCombatText(CombatTextEntry::Type type, int32_t amount, uint32_t spellId, bool isPlayerSource) {
|
void GameHandler::addCombatText(CombatTextEntry::Type type, int32_t amount, uint32_t spellId, bool isPlayerSource, uint8_t powerType) {
|
||||||
CombatTextEntry entry;
|
CombatTextEntry entry;
|
||||||
entry.type = type;
|
entry.type = type;
|
||||||
entry.amount = amount;
|
entry.amount = amount;
|
||||||
entry.spellId = spellId;
|
entry.spellId = spellId;
|
||||||
entry.age = 0.0f;
|
entry.age = 0.0f;
|
||||||
entry.isPlayerSource = isPlayerSource;
|
entry.isPlayerSource = isPlayerSource;
|
||||||
|
entry.powerType = powerType;
|
||||||
combatText.push_back(entry);
|
combatText.push_back(entry);
|
||||||
|
|
||||||
// Persistent combat log
|
// Persistent combat log
|
||||||
|
|
|
||||||
|
|
@ -8287,7 +8287,13 @@ void GameScreen::renderCombatText(game::GameHandler& gameHandler) {
|
||||||
break;
|
break;
|
||||||
case game::CombatTextEntry::ENERGIZE:
|
case game::CombatTextEntry::ENERGIZE:
|
||||||
snprintf(text, sizeof(text), "+%d", entry.amount);
|
snprintf(text, sizeof(text), "+%d", entry.amount);
|
||||||
color = ImVec4(0.3f, 0.6f, 1.0f, alpha); // Blue for mana/energy
|
switch (entry.powerType) {
|
||||||
|
case 1: color = ImVec4(1.0f, 0.2f, 0.2f, alpha); break; // Rage: red
|
||||||
|
case 2: color = ImVec4(1.0f, 0.6f, 0.1f, alpha); break; // Focus: orange
|
||||||
|
case 3: color = ImVec4(1.0f, 0.9f, 0.2f, alpha); break; // Energy: yellow
|
||||||
|
case 6: color = ImVec4(0.3f, 0.9f, 0.8f, alpha); break; // Runic Power: teal
|
||||||
|
default: color = ImVec4(0.3f, 0.6f, 1.0f, alpha); break; // Mana (0): blue
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case game::CombatTextEntry::XP_GAIN:
|
case game::CombatTextEntry::XP_GAIN:
|
||||||
snprintf(text, sizeof(text), "+%d XP", entry.amount);
|
snprintf(text, sizeof(text), "+%d XP", entry.amount);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue