mirror of
https://github.com/azerothcore/azerothcore-wotlk.git
synced 2025-11-10 12:24:22 +08:00
Merge 3e5ecc37be795711849adfa0f7b4864428636c27 into 3ad79541f6d0e425bed473d0bd37962d6afdb5ba
This commit is contained in:
commit
55a1e66fac
@ -2844,6 +2844,49 @@ void Player::SendInitialSpells()
|
|||||||
SendDirectMessage(&data);
|
SendDirectMessage(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::SendUnlearnSpells()
|
||||||
|
{
|
||||||
|
WorldPacket data(SMSG_SEND_UNLEARN_SPELLS, 4 + 4 * m_spells.size());
|
||||||
|
|
||||||
|
uint32 spellCount = 0;
|
||||||
|
size_t countPos = data.wpos();
|
||||||
|
data << uint32(spellCount);
|
||||||
|
|
||||||
|
for (auto const& itr : m_spells)
|
||||||
|
{
|
||||||
|
if (itr.second->State == PLAYERSPELL_REMOVED || itr.second->Active)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
auto skillLineAbilities = sSpellMgr->GetSkillLineAbilityMapBounds(itr.first);
|
||||||
|
if (skillLineAbilities.first == skillLineAbilities.second)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
uint32 nextRank = sSpellMgr->GetNextSpellInChain(itr.first);
|
||||||
|
if (!nextRank || !HasSpell(nextRank))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
data << uint32(itr.first);
|
||||||
|
++spellCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.put<uint32>(countPos, spellCount);
|
||||||
|
SendDirectMessage(&data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Player::IsUnlearnNeededForSpell(uint32 spellId)
|
||||||
|
{
|
||||||
|
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(spellId);
|
||||||
|
if (spellInfo->IsRanked() && !spellInfo->IsStackableWithRanks())
|
||||||
|
{
|
||||||
|
auto skillLineAbilities = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
|
||||||
|
if (skillLineAbilities.first != skillLineAbilities.second)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Player::RemoveMail(uint32 id)
|
void Player::RemoveMail(uint32 id)
|
||||||
{
|
{
|
||||||
for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
|
for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
|
||||||
|
|||||||
@ -1638,6 +1638,9 @@ public:
|
|||||||
void UpdateNextMailTimeAndUnreads();
|
void UpdateNextMailTimeAndUnreads();
|
||||||
void AddNewMailDeliverTime(time_t deliver_time);
|
void AddNewMailDeliverTime(time_t deliver_time);
|
||||||
|
|
||||||
|
void SendUnlearnSpells();
|
||||||
|
static bool IsUnlearnNeededForSpell(uint32 spellId);
|
||||||
|
|
||||||
void RemoveMail(uint32 id);
|
void RemoveMail(uint32 id);
|
||||||
|
|
||||||
void AddMail(Mail* mail) { m_mail.push_front(mail); }// for call from WorldSession::SendMailTo
|
void AddMail(Mail* mail) { m_mail.push_front(mail); }// for call from WorldSession::SendMailTo
|
||||||
|
|||||||
@ -264,6 +264,9 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
|
|||||||
else
|
else
|
||||||
_player->learnSpell(spellId);
|
_player->learnSpell(spellId);
|
||||||
|
|
||||||
|
if (Player::IsUnlearnNeededForSpell(spellId))
|
||||||
|
_player->SendUnlearnSpells();
|
||||||
|
|
||||||
WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, 12);
|
WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, 12);
|
||||||
data << guid;
|
data << guid;
|
||||||
data << uint32(spellId); // should be same as in packet from client
|
data << uint32(spellId); // should be same as in packet from client
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user