refactor(Core/Misc): headers cleanup (#9259)

This commit is contained in:
Kargatum
2021-11-22 17:24:39 +07:00
committed by GitHub
parent 699d4835df
commit f62664c987
775 changed files with 1294 additions and 1165 deletions

View File

@@ -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;
}