|
9 | 9 | class LearnSpellsOnLevelUp : public PlayerScript |
10 | 10 | { |
11 | 11 | public: |
12 | | - LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp") { } |
| 12 | + LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp", { |
| 13 | + PLAYERHOOK_ON_FIRST_LOGIN, |
| 14 | + PLAYERHOOK_ON_LEVEL_CHANGED |
| 15 | + }) { } |
13 | 16 |
|
14 | 17 | void OnPlayerFirstLogin(Player* player) override |
15 | 18 | { |
16 | 19 | if (sConfigMgr->GetOption<bool>("LearnSpells.OnFirstLogin", 0)) |
17 | | - { |
18 | 20 | LearnSpellsForNewLevel(player, 1); |
| 21 | + |
| 22 | + if (player->getClass() == CLASS_SHAMAN) |
| 23 | + { |
| 24 | + player->AddItem(5175, 1); // Earth Totem |
| 25 | + player->AddItem(5176, 1); // Fire Totem |
| 26 | + player->AddItem(5177, 1); // Water Totem |
| 27 | + player->AddItem(5178, 1); // Air Totem |
19 | 28 | } |
20 | | - if (player->getClass() == CLASS_SHAMAN) |
21 | | - { |
22 | | - player->AddItem(5175, 1); // Earth Totem |
23 | | - player->AddItem(5176, 1); // Fire Totem |
24 | | - player->AddItem(5177, 1); // Water Totem |
25 | | - player->AddItem(5178, 1); // Air Totem |
26 | | - } |
27 | 29 | } |
28 | 30 |
|
29 | 31 | void OnPlayerLevelChanged(Player* player, uint8 oldLevel) override |
@@ -480,9 +482,7 @@ class LearnSpellsOnLevelUp : public PlayerScript |
480 | 482 | for (auto const& spell : additionalSpellsToTeach) |
481 | 483 | { |
482 | 484 | if (!(player->HasSpell(spell.spellId)) && (spell.faction == TeamId::TEAM_NEUTRAL || spell.faction == player->GetTeamId())) |
483 | | - { |
484 | 485 | player->learnSpell(spell.spellId); |
485 | | - } |
486 | 486 | } |
487 | 487 | } |
488 | 488 | } |
|
0 commit comments