fix all bug close #9

This commit is contained in:
ReyDonovan 2021-03-31 22:41:21 +03:00
parent 162bf8a92a
commit 754c241066

View file

@ -89,7 +89,7 @@ public:
CongratsOnLevel() : PlayerScript("CongratsOnLevel") { }
// Level Up Rewards
void OnLevelChanged(Player* player, uint8 oldLevel)
void OnLevelChanged(Player* player, uint8 oldLevel) override
{
// If enabled...
if (sConfigMgr->GetBoolDefault("Congrats.Enable", true)) {
@ -97,10 +97,7 @@ public:
std::string level;
uint32 money, item1, item2, spell;
switch (++oldLevel)
{
case 10:
if (oldLevel < 10 && player->getLevel() == 10)
{
// Level 10
const uint32 L101 = sConfigMgr->GetIntDefault("Congrats.L101", 0);
@ -113,10 +110,8 @@ public:
item2 = L102;
money = L10M;
spell = L10S;
break;
}
case 20:
else if (oldLevel < 20 && player->getLevel() == 20)
{
// Level 20
const uint32 L201 = sConfigMgr->GetIntDefault("Congrats.L201", 0);
@ -129,10 +124,8 @@ public:
item2 = L202;
money = L20M;
spell = L20S;
break;
}
case 30:
else if (oldLevel < 30 && player->getLevel() == 30)
{
// Level 30
const uint32 L301 = sConfigMgr->GetIntDefault("Congrats.L301", 0);
@ -145,10 +138,8 @@ public:
item2 = L302;
money = L30M;
spell = L30S;
break;
}
case 40:
else if (oldLevel < 40 && player->getLevel() == 40)
{
// Level 40
const uint32 L401 = sConfigMgr->GetIntDefault("Congrats.L401", 0);
@ -161,10 +152,8 @@ public:
item2 = L402;
money = L40M;
spell = L40S;
break;
}
case 50:
else if (oldLevel < 50 && player->getLevel() == 50)
{
// Level 50
const uint32 L501 = sConfigMgr->GetIntDefault("Congrats.L501", 0);
@ -177,10 +166,8 @@ public:
item2 = L502;
money = L50M;
spell = L50S;
break;
}
case 60:
else if (oldLevel < 60 && player->getLevel() == 60)
{
// Level 60
const uint32 L601 = sConfigMgr->GetIntDefault("Congrats.L601", 0);
@ -193,10 +180,8 @@ public:
item2 = L602;
money = L60M;
spell = L60S;
break;
}
case 70:
else if (oldLevel < 70 && player->getLevel() == 70)
{
// Level 70
const uint32 L701 = sConfigMgr->GetIntDefault("Congrats.L701", 0);
@ -209,10 +194,8 @@ public:
item2 = L702;
money = L70M;
spell = L70S;
break;
}
case 80:
else if (oldLevel < 80 && player->getLevel() == 80)
{
// Level 80
const uint32 L801 = sConfigMgr->GetIntDefault("Congrats.L801", 0);
@ -225,10 +208,8 @@ public:
item2 = L802;
money = L80M;
spell = L80S;
break;
}
default:
// If enabled...
if (sConfigMgr->GetBoolDefault("CongratsPerLevel.Enable", true))
{
@ -239,9 +220,6 @@ public:
break;
}
return;
}
// If level is defined, they hit a reward level.
if (!level.empty())
{