mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
feat: parse SMSG_SET_FLAT/PCT_SPELL_MODIFIER and apply talent modifiers to spell tooltips
Implements SMSG_SET_FLAT_SPELL_MODIFIER and SMSG_SET_PCT_SPELL_MODIFIER (previously consumed silently). Parses per-group (uint8 groupIndex, uint8 SpellModOp, int32 value) tuples sent by the server after login and talent changes, and stores them in spellFlatMods_/spellPctMods_ maps keyed by (SpellModOp, groupIndex). Exposes getSpellFlatMod(op)/getSpellPctMod(op) accessors and a static applySpellMod() helper. Clears both maps on character login alongside spellCooldowns. Surfaces talent-modified mana cost and cast time in the spellbook tooltip via SpellModOp::Cost and SpellModOp::CastingTime lookups.
This commit is contained in:
parent
74d5984ee2
commit
e4fd4b4e6d
3 changed files with 120 additions and 8 deletions
|
|
@ -3756,12 +3756,29 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
}
|
||||
|
||||
case Opcode::SMSG_FEATURE_SYSTEM_STATUS:
|
||||
case Opcode::SMSG_SET_FLAT_SPELL_MODIFIER:
|
||||
case Opcode::SMSG_SET_PCT_SPELL_MODIFIER:
|
||||
// Different formats than SMSG_SPELL_DELAYED — consume and ignore
|
||||
packet.setReadPos(packet.getSize());
|
||||
break;
|
||||
|
||||
case Opcode::SMSG_SET_FLAT_SPELL_MODIFIER:
|
||||
case Opcode::SMSG_SET_PCT_SPELL_MODIFIER: {
|
||||
// WotLK format: one or more (uint8 groupIndex, uint8 modOp, int32 value) tuples
|
||||
// Each tuple is 6 bytes; iterate until packet is consumed.
|
||||
const bool isFlat = (*logicalOp == Opcode::SMSG_SET_FLAT_SPELL_MODIFIER);
|
||||
auto& modMap = isFlat ? spellFlatMods_ : spellPctMods_;
|
||||
while (packet.getSize() - packet.getReadPos() >= 6) {
|
||||
uint8_t groupIndex = packet.readUInt8();
|
||||
uint8_t modOpRaw = packet.readUInt8();
|
||||
int32_t value = static_cast<int32_t>(packet.readUInt32());
|
||||
if (groupIndex > 5 || modOpRaw >= SPELL_MOD_OP_COUNT) continue;
|
||||
SpellModKey key{ static_cast<SpellModOp>(modOpRaw), groupIndex };
|
||||
modMap[key] = value;
|
||||
LOG_DEBUG(isFlat ? "SMSG_SET_FLAT_SPELL_MODIFIER" : "SMSG_SET_PCT_SPELL_MODIFIER",
|
||||
": group=", (int)groupIndex, " op=", (int)modOpRaw, " value=", value);
|
||||
}
|
||||
packet.setReadPos(packet.getSize());
|
||||
break;
|
||||
}
|
||||
|
||||
case Opcode::SMSG_SPELL_DELAYED: {
|
||||
// WotLK: packed_guid (caster) + uint32 delayMs
|
||||
// TBC/Classic: uint64 (caster) + uint32 delayMs
|
||||
|
|
@ -7930,6 +7947,8 @@ void GameHandler::selectCharacter(uint64_t characterGuid) {
|
|||
std::fill(std::begin(playerStats_), std::end(playerStats_), -1);
|
||||
knownSpells.clear();
|
||||
spellCooldowns.clear();
|
||||
spellFlatMods_.clear();
|
||||
spellPctMods_.clear();
|
||||
actionBar = {};
|
||||
playerAuras.clear();
|
||||
targetAuras.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue