mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 17:19:07 +00:00
refactor(Core/Misc): headers cleanup (#9259)
This commit is contained in:
@@ -15,9 +15,11 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "SpellInfo.h"
|
||||
#include "PlayerCommand.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
bool Acore::PlayerCommand::HandleLearnSpellCommand(ChatHandler* handler, Player* targetPlayer, SpellInfo const* spell, Optional<EXACT_SEQUENCE("all")> allRanks)
|
||||
{
|
||||
@@ -31,23 +33,34 @@ bool Acore::PlayerCommand::HandleLearnSpellCommand(ChatHandler* handler, Player*
|
||||
if (!allRanks && targetPlayer->HasSpell(spell->Id))
|
||||
{
|
||||
if (targetPlayer == handler->GetPlayer())
|
||||
{
|
||||
handler->SendSysMessage(LANG_YOU_KNOWN_SPELL);
|
||||
}
|
||||
else
|
||||
{
|
||||
handler->PSendSysMessage(LANG_TARGET_KNOWN_SPELL, handler->GetNameLink(targetPlayer).c_str());
|
||||
}
|
||||
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
targetPlayer->learnSpell(spell->Id, false);
|
||||
|
||||
if (allRanks)
|
||||
{
|
||||
uint32 spellId = spell->Id;
|
||||
|
||||
while ((spellId = sSpellMgr->GetNextSpellInChain(spellId)))
|
||||
{
|
||||
targetPlayer->learnSpell(spellId, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetTalentSpellCost(spell->GetFirstRankSpell()->Id))
|
||||
{
|
||||
targetPlayer->SendTalentsInfoData(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -55,16 +68,25 @@ bool Acore::PlayerCommand::HandleLearnSpellCommand(ChatHandler* handler, Player*
|
||||
bool Acore::PlayerCommand::HandleUnlearnSpellCommand(ChatHandler* handler, Player* target, SpellInfo const* spell, Optional<EXACT_SEQUENCE("all")> allRanks)
|
||||
{
|
||||
uint32 spellId = spell->Id;
|
||||
|
||||
if (allRanks)
|
||||
spellId = sSpellMgr->GetFirstSpellInChain (spellId);
|
||||
{
|
||||
spellId = sSpellMgr->GetFirstSpellInChain(spellId);
|
||||
}
|
||||
|
||||
if (target->HasSpell(spellId))
|
||||
{
|
||||
target->removeSpell(spellId, SPEC_MASK_ALL, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
handler->SendSysMessage(LANG_FORGET_SPELL);
|
||||
}
|
||||
|
||||
if (GetTalentSpellCost(spellId))
|
||||
{
|
||||
target->SendTalentsInfoData(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user