Merge pull request #54 from azerothcore/sudlud-pach-42-5

This commit is contained in:
sudlud
2025-03-02 19:33:43 +01:00
committed by GitHub
2 changed files with 13 additions and 12 deletions

View File

@@ -5,6 +5,7 @@
void AddSC_LearnAllSpells(); void AddSC_LearnAllSpells();
void Addmod_learn_spellsScripts() { void Addmod_learn_spellsScripts()
{
AddSC_LearnAllSpells(); AddSC_LearnAllSpells();
} }

View File

@@ -9,14 +9,16 @@
class LearnSpellsOnLevelUp : public PlayerScript class LearnSpellsOnLevelUp : public PlayerScript
{ {
public: public:
LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp") { } LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp", {
PLAYERHOOK_ON_FIRST_LOGIN,
PLAYERHOOK_ON_LEVEL_CHANGED
}) { }
void OnPlayerFirstLogin(Player* player) override void OnPlayerFirstLogin(Player* player) override
{ {
if (sConfigMgr->GetOption<bool>("LearnSpells.OnFirstLogin", 0)) if (sConfigMgr->GetOption<bool>("LearnSpells.OnFirstLogin", 0))
{
LearnSpellsForNewLevel(player, 1); LearnSpellsForNewLevel(player, 1);
}
if (player->getClass() == CLASS_SHAMAN) if (player->getClass() == CLASS_SHAMAN)
{ {
player->AddItem(5175, 1); // Earth Totem player->AddItem(5175, 1); // Earth Totem
@@ -480,13 +482,11 @@ private:
for (auto const& spell : additionalSpellsToTeach) for (auto const& spell : additionalSpellsToTeach)
{ {
if (!(player->HasSpell(spell.spellId)) && (spell.faction == TeamId::TEAM_NEUTRAL || spell.faction == player->GetTeamId())) if (!(player->HasSpell(spell.spellId)) && (spell.faction == TeamId::TEAM_NEUTRAL || spell.faction == player->GetTeamId()))
{
player->learnSpell(spell.spellId); player->learnSpell(spell.spellId);
} }
} }
} }
} }
}
uint32 GetSpellFamily(const Player* p) uint32 GetSpellFamily(const Player* p)
{ {