fix: correct talent rank indexing — store 1-indexed, fix prereq and learn checks

SMSG_TALENTS_INFO wire format sends 0-indexed ranks (0=has rank 1). Both
handlers were storing raw 0-indexed values, but handleSpellLearnedServer
correctly stored rank+1 (1-indexed). This caused:
 - getTalentRank() returning 0 for both "not learned" and "has rank 1",
   making pointsInTree always wrong and blocking tier access
 - Prereq check `prereqRank < DBC_prereqRank` always met when not learned
   (0 < 0 = false), incorrectly unlocking talents
 - Click handler sending wrong desiredRank to server

Fixes:
 - Both SMSG_TALENTS_INFO handlers: store rank+1u (1-indexed)
 - talent_screen.cpp prereq check: change < to <= (DBC is 0-indexed,
   storage is 1-indexed; must use > for "met", <= for "not met")
 - talent_screen.cpp click handler: send currentRank directly (1-indexed
   value equals what CMSG_LEARN_TALENT requestedRank expects)
 - Tooltip: display prereqRank+1 so "Requires 1 point" shows correctly
This commit is contained in:
Kelsi 2026-03-13 03:32:45 -07:00
parent 952f36b732
commit 863faf9b54
2 changed files with 11 additions and 16 deletions

View file

@ -12701,7 +12701,7 @@ void GameHandler::handleInspectResults(network::Packet& packet) {
if (packet.getSize() - packet.getReadPos() < 5) break;
uint32_t talentId = packet.readUInt32();
uint8_t rank = packet.readUInt8();
learnedTalents_[g][talentId] = rank;
learnedTalents_[g][talentId] = rank + 1u; // wire sends 0-indexed; store 1-indexed
}
if (packet.getSize() - packet.getReadPos() < 1) break;
learnedGlyphs_[g].fill(0);
@ -16545,7 +16545,7 @@ void GameHandler::handleTalentsInfo(network::Packet& packet) {
if (packet.getSize() - packet.getReadPos() < 5) break;
uint32_t talentId = packet.readUInt32();
uint8_t rank = packet.readUInt8();
learnedTalents_[g][talentId] = rank;
learnedTalents_[g][talentId] = rank + 1u; // wire sends 0-indexed; store 1-indexed
}
learnedGlyphs_[g].fill(0);
if (packet.getSize() - packet.getReadPos() < 1) break;