[10944] Lock action buttons before unlearning talents on spec switch.

This prevents client from automatically requesting removal of buttons that use unlearned spells.
This commit is contained in:
Lynx3d 2010-12-31 00:46:56 +01:00
parent cb1e82d663
commit d4018322b9
3 changed files with 17 additions and 3 deletions

View file

@ -5939,6 +5939,16 @@ void Player::SendInitialActionButtons() const
DETAIL_LOG( "Action Buttons for '%u' spec '%u' Initialized", GetGUIDLow(), m_activeSpec );
}
void Player::SendLockActionButtons() const
{
DETAIL_LOG( "Locking Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec);
WorldPacket data(SMSG_ACTION_BUTTONS, 1);
// sending 2 locks actions bars, neither user can remove buttons, nor client removes buttons at spell unlearn
// they remain locked until server sends new action buttons
data << uint8(2);
GetSession()->SendPacket( &data );
}
bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type, Player* player, bool msg)
{
if(button >= MAX_ACTION_BUTTONS)
@ -12808,7 +12818,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
}
case GOSSIP_OPTION_TRAINER:
// pet trainers not have spells in fact now
/* FIXME: gossip menu with single unlearn pet talents option not show by some reason
/* FIXME: gossip menu with single unlearn pet talents option not show by some reason
if (pCreature->GetCreatureInfo()->trainer_type == TRAINER_TYPE_PETS)
hasMenuItem = false;
else */
@ -12820,7 +12830,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
hasMenuItem = false;
break;
case GOSSIP_OPTION_UNLEARNPETSKILLS:
if (pCreature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || pCreature->GetCreatureInfo()->trainer_class != CLASS_HUNTER)
if (pCreature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || pCreature->GetCreatureInfo()->trainer_class != CLASS_HUNTER)
hasMenuItem = false;
else if (Pet * pet = GetPet())
{
@ -22221,6 +22231,9 @@ void Player::ActivateSpec(uint8 specNum)
UnsummonPetTemporaryIfAny();
// prevent deletion of action buttons by client at spell unlearn or by player while spec change in progress
SendLockActionButtons();
ApplyGlyphs(false);
// copy of new talent spec (we will use it as model for converting current tlanet state to new)