aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/GossipDef.h2
-rw-r--r--src/game/Opcodes.cpp2
-rw-r--r--src/game/Opcodes.h4
-rw-r--r--src/game/Pet.cpp12
-rw-r--r--src/game/PetHandler.cpp27
-rw-r--r--src/game/Player.cpp26
-rw-r--r--src/game/Player.h2
7 files changed, 28 insertions, 47 deletions
diff --git a/src/game/GossipDef.h b/src/game/GossipDef.h
index 60eacdfffec..b487653b402 100644
--- a/src/game/GossipDef.h
+++ b/src/game/GossipDef.h
@@ -49,7 +49,7 @@ enum Gossip_Option
GOSSIP_OPTION_STABLEPET = 14, //UNIT_NPC_FLAG_STABLE (4194304)
GOSSIP_OPTION_ARMORER = 15, //UNIT_NPC_FLAG_ARMORER (4096)
GOSSIP_OPTION_UNLEARNTALENTS = 16, //UNIT_NPC_FLAG_TRAINER (16) (bonus option for GOSSIP_OPTION_TRAINER)
- GOSSIP_OPTION_UNLEARNPETSKILLS = 17, //UNIT_NPC_FLAG_TRAINER (16) (bonus option for GOSSIP_OPTION_TRAINER)
+ GOSSIP_OPTION_UNLEARNPETTALENTS = 17, //UNIT_NPC_FLAG_TRAINER (16) (bonus option for GOSSIP_OPTION_TRAINER)
GOSSIP_OPTION_LEARNDUALSPEC = 18, //UNIT_NPC_FLAG_TRAINER (16) (bonus option for GOSSIP_OPTION_TRAINER)
GOSSIP_OPTION_OUTDOORPVP = 19, //added by code (option for outdoor pvp creatures)
GOSSIP_OPTION_MAX
diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
index 1b33ea95878..38203b83190 100644
--- a/src/game/Opcodes.cpp
+++ b/src/game/Opcodes.cpp
@@ -780,7 +780,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x2ED*/ { "SMSG_BATTLEGROUND_PLAYER_LEFT", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2EE*/ { "CMSG_BATTLEMASTER_JOIN", STATUS_LOGGEDIN, &WorldSession::HandleBattlemasterJoinOpcode },
/*0x2EF*/ { "SMSG_ADDON_INFO", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x2F0*/ { "CMSG_PET_UNLEARN", STATUS_LOGGEDIN, &WorldSession::HandlePetUnlearnOpcode },
+ /*0x2F0*/ { "CMSG_PET_UNLEARN", STATUS_LOGGEDIN, &WorldSession::Handle_NULL },
/*0x2F1*/ { "SMSG_PET_UNLEARN_CONFIRM", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2F2*/ { "SMSG_PARTY_MEMBER_STATS_FULL", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2F3*/ { "CMSG_PET_SPELL_AUTOCAST", STATUS_LOGGEDIN, &WorldSession::HandlePetSpellAutocastOpcode },
diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h
index f46580a0027..ea2c4ba82ce 100644
--- a/src/game/Opcodes.h
+++ b/src/game/Opcodes.h
@@ -788,8 +788,8 @@ enum Opcodes
SMSG_BATTLEGROUND_PLAYER_LEFT = 0x2ED,
CMSG_BATTLEMASTER_JOIN = 0x2EE,
SMSG_ADDON_INFO = 0x2EF,
- CMSG_PET_UNLEARN = 0x2F0,
- SMSG_PET_UNLEARN_CONFIRM = 0x2F1,
+ CMSG_PET_UNLEARN = 0x2F0, // Deprecated 3.x
+ SMSG_PET_UNLEARN_CONFIRM = 0x2F1, // Deprecated 3.x
SMSG_PARTY_MEMBER_STATS_FULL = 0x2F2,
CMSG_PET_SPELL_AUTOCAST = 0x2F3,
SMSG_WEATHER = 0x2F4,
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index bd8089870a4..1f89e94754d 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -81,12 +81,12 @@ void Pet::AddToWorld()
// Prevent stuck pets when zoning. Pets default to "follow" when added to world
// so we'll reset flags and let the AI handle things
- if (this->GetCharmInfo() && this->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
+ if (GetCharmInfo() && GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
{
- this->GetCharmInfo()->SetIsCommandAttack(false);
- this->GetCharmInfo()->SetIsAtStay(false);
- this->GetCharmInfo()->SetIsFollowing(false);
- this->GetCharmInfo()->SetIsReturning(false);
+ GetCharmInfo()->SetIsCommandAttack(false);
+ GetCharmInfo()->SetIsAtStay(false);
+ GetCharmInfo()->SetIsFollowing(false);
+ GetCharmInfo()->SetIsReturning(false);
}
}
@@ -1629,7 +1629,7 @@ bool Pet::resetTalents(bool no_cost)
// unlearn if first rank is talent or learned by talent
if (itrFirstId == talentInfo->RankID[j] || spellmgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId))
{
- removeSpell(itr->first,false);
+ unlearnSpell(itr->first,false);
itr = m_spells.begin();
continue;
}
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index 85f3f87fde4..be3aeab355e 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -601,33 +601,6 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
}
}
-void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket)
-{
- sLog.outDetail("CMSG_PET_UNLEARN");
- uint64 guid;
- recvPacket >> guid; // Pet guid
-
- Pet* pet = _player->GetPet();
-
- if(!pet || pet->getPetType() != HUNTER_PET || pet->m_usedTalentCount == 0)
- return;
-
- if(guid != pet->GetGUID())
- {
- sLog.outError( "HandlePetUnlearnOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
- return;
- }
-
- CharmInfo *charmInfo = pet->GetCharmInfo();
- if(!charmInfo)
- {
- sLog.outError("WorldSession::HandlePetUnlearnOpcode: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
- return;
- }
- pet->resetTalents();
- _player->SendTalentsInfoData(true);
-}
-
void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
{
sLog.outDetail("CMSG_PET_SPELL_AUTOCAST");
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()));
diff --git a/src/game/Player.h b/src/game/Player.h
index 3f328d4503f..fda3525f2c7 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1436,7 +1436,7 @@ class Player : public Unit, public GridObject<Player>
void SetBindPoint(uint64 guid);
void SendTalentWipeConfirm(uint64 guid);
- void SendPetSkillWipeConfirm();
+ void ResetPetTalents();
void CalcRage( uint32 damage,bool attacker );
void RegenerateAll();
void Regenerate(Powers power);