Paragon: expand IsClass hooks and addon pet talent reset
Broaden OnPlayerIsClass for CLASS_CONTEXT_ABILITY, pet/charm/equip contexts; add PARAA C RESET PET TALENTS handler. Update CLIENT-PATCHES.md for patch-enUS-5/6 and PARAA. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "Chat.h"
|
||||
#include "CommandScript.h"
|
||||
#include "Config.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "RBAC.h"
|
||||
#include "ScriptMgr.h"
|
||||
@@ -1689,6 +1690,10 @@ public:
|
||||
// "Q SNAPSHOT" -- push R SPELLS and R TALENTS for Overview
|
||||
// "C COMMIT s:... t:..." -- apply pending learns from the panel
|
||||
// "C RESET ABILITIES" / "C RESET TALENTS" / "C RESET ALL" / "C RESET EVERYTHING"
|
||||
// "C RESET PET TALENTS" -- free + instant pet talent reset (no popup,
|
||||
// no gold). Routes to Player::ResetPetTalents
|
||||
// which itself calls Pet::resetTalents and
|
||||
// refreshes the talent points.
|
||||
void OnPlayerBeforeSendChatMessage(Player* player, uint32& /*type*/, uint32& lang, std::string& msg) override
|
||||
{
|
||||
if (!player || player->getClass() != CLASS_PARAGON)
|
||||
@@ -1765,6 +1770,29 @@ public:
|
||||
SendAddonMessage(player, "R ERR " + err);
|
||||
return;
|
||||
}
|
||||
if (body == "C RESET PET TALENTS")
|
||||
{
|
||||
// Pet talent reset: deliberately bypasses the engine's
|
||||
// gold-cost confirmation flow. Player::ResetPetTalents
|
||||
// wraps Pet::resetTalents (which only refunds and unlearns;
|
||||
// does NOT charge gold or dismiss the pet) and re-sends the
|
||||
// talent UI to the client. Pre-conditions:
|
||||
// - the player must own a HUNTER_PET (the only pet kind
|
||||
// with a talent tree in 3.3.5)
|
||||
// - the pet must have spent at least 1 talent point
|
||||
// If either fails Player::ResetPetTalents returns silently;
|
||||
// we ack with R OK so the client UI can refresh either way.
|
||||
Pet* pet = player->GetPet();
|
||||
if (!pet || pet->getPetType() != HUNTER_PET)
|
||||
{
|
||||
SendAddonMessage(player,
|
||||
"R ERR No active hunter pet to reset.");
|
||||
return;
|
||||
}
|
||||
player->ResetPetTalents();
|
||||
SendAddonMessage(player, "R OK PET TALENTS RESET");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void OnPlayerLearnTalents(Player* player, uint32 talentId, uint32 /*talentRank*/, uint32 /*spellid*/) override
|
||||
|
||||
Reference in New Issue
Block a user