fix codestyle and add enabled hook list for performance improvement

This commit is contained in:
Ludwig
2025-03-02 14:14:20 +01:00
parent 166e2eb3d7
commit a232991f8e
2 changed files with 13 additions and 12 deletions

View File

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

View File

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