Merge pull request #13 from ReyDonovan/master

fix all bug close #9
This commit is contained in:
Stefano Borzì 2021-03-31 22:44:27 +02:00 committed by GitHub
commit b8c313cb5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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))
{
@ -236,10 +217,6 @@ public:
std::ostringstream ss;
ss << "|cffFFFFFF[ |cffFF0000C|cffFFA500O|cffFFFF00N|cff00FF00G|cff00FFFFR|cff6A5ACDA|cffFF00FFT|cff98FB98S|cffFF0000! |cffFFFFFF] : |cff4CFF00 " << player->GetName() << " |cffFFFFFFhas reached |cff4CFF00Level " << to_string(player->getLevel()) << "|cffFFFFFF!";
sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());
break;
}
return;
}
// If level is defined, they hit a reward level.