Fix hunter pet talent reset feature.
Thanks to Xanadu and nalimleinad for aiding research. --HG-- branch : trunk
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 },
|
||||
|
||||
+2
-2
@@ -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,
|
||||
|
||||
+6
-6
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
+17
-9
@@ -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()));
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user