game: fix Classic 1.12 SMSG_TRAINER_LIST per-spell field layout

Classic 1.12 trainer list entries lack the profDialog and profButton
uint32 fields (8 bytes) that TBC/WotLK added before reqLevel. Instead,
reqLevel immediately follows spellCost, and a trailing unk uint32 appears
at the end of each entry. Parsing the WotLK format for Classic caused
misalignment from the third field onward, corrupting state, cost, level,
skill, and chain data for all trainer spells.

- TrainerListParser::parse() gains a isClassic bool parameter (default false)
- Classic path: cost(4) → reqLevel(1) → reqSkill... → chainNode3 → unk(4)
- WotLK/TBC path: cost(4) → profDialog(4) → profButton(4) → reqLevel(1) → reqSkill...
- handleTrainerList() passes isClassicLikeExpansion() as the flag
This commit is contained in:
Kelsi 2026-03-10 01:20:41 -07:00
parent 23878e530f
commit 8dd4bc80ec
3 changed files with 33 additions and 14 deletions

View file

@ -2231,7 +2231,9 @@ struct TrainerListData {
class TrainerListParser {
public:
static bool parse(network::Packet& packet, TrainerListData& data);
// isClassic: Classic 1.12 per-spell layout has no profDialog/profButton fields
// (reqLevel immediately follows cost), plus a trailing unk uint32 per entry.
static bool parse(network::Packet& packet, TrainerListData& data, bool isClassic = false);
};
class TrainerBuySpellPacket {