Merge pull request #1 from conan513/master

Merge original repo
This commit is contained in:
Barbz
2018-09-19 19:21:34 +02: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?
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 "DisableMgr.h"
#include "Config.h"
#include "Player.h"
uint32 MaxLevel;
class LearnSpellsOnLevelUp : public PlayerScript
{
public:
public:
std::vector<uint32> ignoreSpells;
LearnSpellsOnLevelUp() : PlayerScript("LearnSpellsOnLevelUp")
@@ -42,7 +45,7 @@ class LearnSpellsOnLevelUp : public PlayerScript
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)
@@ -59,11 +62,14 @@ class LearnSpellsOnLevelUp : public PlayerScript
void OnLevelChanged(Player* player, uint8 oldLevel)
{
if (sConfigMgr->GetBoolDefault("LearnSpells.Enable", true))
{
if (player->getLevel() < MaxLevel)
{
if (oldLevel < player->getLevel())
LearnSpellsForNewLevel(player, oldLevel);
}
}
}
bool IsIgnoredSpell(uint32 spellID)
{
@@ -78,7 +84,7 @@ class LearnSpellsOnLevelUp : public PlayerScript
if (level == player->getLevel() + 1)
return;
uint32 family;
switch(player->getClass())
switch (player->getClass())
{
case CLASS_ROGUE:
family = SPELLFAMILY_ROGUE;
@@ -174,6 +180,8 @@ public:
sConfigMgr->LoadMore(cfg_def_file.c_str());
sConfigMgr->LoadMore(cfg_file.c_str());
MaxLevel = sConfigMgr->GetIntDefault("MaxLevel", 80);
}
}
};