update script also fix indentations

This commit is contained in:
talamortis
2018-02-03 11:05:33 +00:00
parent 20c1073a98
commit f4706b1664
2 changed files with 147 additions and 134 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,10 +1,13 @@
#include "ScriptPCH.h" #include "ScriptPCH.h"
#include "DisableMgr.h" #include "DisableMgr.h"
#include "Config.h" #include "Configuration\Config.h"
#include "Player.h"
uint32 MaxLevel;
class LearnSpellsOnLevelUp : public PlayerScript class LearnSpellsOnLevelUp : public PlayerScript
{ {
public: public:
std::vector<uint32> ignoreSpells; std::vector<uint32> ignoreSpells;
LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp") LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp")
@@ -42,7 +45,7 @@ class LearnSpellsOnLevelUp : public PlayerScript
20186, 20185, 20184, 20187, 25899, 24406, 50581, 30708 20186, 20185, 20184, 20187, 25899, 24406, 50581, 30708
}; };
ignoreSpells = std::vector<uint32> (temp, temp + sizeof(temp)/sizeof(temp[0])); ignoreSpells = std::vector<uint32>(temp, temp + sizeof(temp) / sizeof(temp[0]));
} }
void OnLogin(Player *player) void OnLogin(Player *player)
@@ -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)
{ {
@@ -78,7 +84,7 @@ class LearnSpellsOnLevelUp : public PlayerScript
if (level == player->getLevel() + 1) if (level == player->getLevel() + 1)
return; return;
uint32 family; uint32 family;
switch(player->getClass()) switch (player->getClass())
{ {
case CLASS_ROGUE: case CLASS_ROGUE:
family = SPELLFAMILY_ROGUE; family = SPELLFAMILY_ROGUE;
@@ -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);
} }
} }
}; };