Merge pull request #1 from talamortis/master

update script also fix indentations
This commit is contained in:
ConanHUN
2018-02-03 16:26:41 +01:00
committed by GitHub
2 changed files with 146 additions and 133 deletions

View File

@@ -11,3 +11,8 @@ LearnSpells.Enable = 1
# Announce the module when the player logs in? # Announce the module when the player logs in?
LearnSpells.Announce = 1 LearnSpells.Announce = 1
# Max level Limit the player will learn spells
# Default: = 80
MaxLevel = 80

View File

@@ -1,6 +1,9 @@
#include "ScriptPCH.h" #include "ScriptPCH.h"
#include "DisableMgr.h" #include "DisableMgr.h"
#include "Config.h" #include "Config.h"
#include "Player.h"
uint32 MaxLevel;
class LearnSpellsOnLevelUp : public PlayerScript class LearnSpellsOnLevelUp : public PlayerScript
{ {
@@ -59,11 +62,14 @@ class LearnSpellsOnLevelUp : public PlayerScript
void OnLevelChanged(Player* player, uint8 oldLevel) void OnLevelChanged(Player* player, uint8 oldLevel)
{ {
if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true)) if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true))
{
if (player->getLevel() < MaxLevel)
{ {
if (oldLevel < player->getLevel()) if (oldLevel < player->getLevel())
LearnSpellsForNewLevel(player, oldLevel); LearnSpellsForNewLevel(player, oldLevel);
} }
} }
}
bool IsIgnoredSpell(uint32 spellID) bool IsIgnoredSpell(uint32 spellID)
{ {
@@ -174,6 +180,8 @@ public:
sConfigMgr->LoadMore(cfg_def_file.c_str()); sConfigMgr->LoadMore(cfg_def_file.c_str());
sConfigMgr->LoadMore(cfg_file.c_str()); sConfigMgr->LoadMore(cfg_file.c_str());
MaxLevel = sConfigMgr->GetIntDefault("MaxLevel", 80);
} }
} }
}; };