aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-03-19 20:20:42 +0100
committerMachiavelli <none@none>2010-03-19 20:20:42 +0100
commit0c6368bd39bb129648ef0c9c9ed902e2484a4d8b (patch)
tree08b24c9efcc4ed2dfdd3e7c9e7b2ea273dcca1a8 /src/game/Player.cpp
parent2b55eb2efeb323ce61927da38106e3d2077e178a (diff)
Fix hunter pet talent reset feature.
Thanks to Xanadu and nalimleinad for aiding research. --HG-- branch : trunk
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 00626bdbc08..7f0c9be6cf6 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -8832,15 +8832,23 @@ void Player::SendTalentWipeConfirm(uint64 guid)
GetSession()->SendPacket( &data );
}
-void Player::SendPetSkillWipeConfirm()
+void Player::ResetPetTalents()
{
+ // This needs another gossip option + NPC text as a confirmation.
+ // The confirmation gossip listid has the text: "Yes, please do."
Pet* pet = GetPet();
- if (!pet)
+
+ if (!pet || pet->getPetType() != HUNTER_PET || pet->m_usedTalentCount == 0)
return;
- WorldPacket data(SMSG_PET_UNLEARN_CONFIRM, (8+4));
- data << pet->GetGUID();
- data << uint32(pet->resetTalentsCost());
- GetSession()->SendPacket( &data );
+
+ CharmInfo *charmInfo = pet->GetCharmInfo();
+ if (!charmInfo)
+ {
+ sLog.outError("Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
+ return;
+ }
+ pet->resetTalents();
+ SendTalentsInfoData(true);
}
/*********************************************************/
@@ -13123,7 +13131,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
if (!pCreature->isCanTrainingAndResetTalentsOf(this))
bCanTalk = false;
break;
- case GOSSIP_OPTION_UNLEARNPETSKILLS:
+ case GOSSIP_OPTION_UNLEARNPETTALENTS:
if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || pCreature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || pCreature->GetCreatureInfo()->trainer_class != CLASS_HUNTER)
bCanTalk = false;
break;
@@ -13351,9 +13359,9 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
PlayerTalkClass->CloseGossip();
SendTalentWipeConfirm(guid);
break;
- case GOSSIP_OPTION_UNLEARNPETSKILLS:
+ case GOSSIP_OPTION_UNLEARNPETTALENTS:
PlayerTalkClass->CloseGossip();
- SendPetSkillWipeConfirm();
+ ResetPetTalents();
break;
case GOSSIP_OPTION_TAXIVENDOR:
GetSession()->SendTaxiMenu((pSource->ToCreature()));