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