Removed some useless ifs.
This commit is contained in:
Revision
2021-12-29 05:08:14 +01:00
parent 15d12d821b
commit f2e666c37e

View File

@@ -68,23 +68,19 @@ class WeekendBonusWorld : WorldScript
{
localTime = time(NULL);
if (localtime(&localTime)->tm_wday == Day::FRIDAY && localtime(&localTime)->tm_hour == 0 && localtime(&localTime)->tm_min == 0)
{
if (!triggered)
if (localtime(&localTime)->tm_wday == Day::FRIDAY && localtime(&localTime)->tm_hour == 0 && localtime(&localTime)->tm_min == 0 && !triggered)
{
sWorld->SendServerMessage(SERVER_MSG_STRING, "The weekend bonus is now active, granting you bonuses to experience, reputation and money!");
SetWorldRates();
}
}
else if (localtime(&localTime)->tm_wday == Day::MONDAY && localtime(&localTime)->tm_hour == 0 && localtime(&localTime)->tm_min == 0)
{
if (triggered)
else if (localtime(&localTime)->tm_wday == Day::MONDAY && localtime(&localTime)->tm_hour == 0 && localtime(&localTime)->tm_min == 0 && triggered)
{
sWorld->SendServerMessage(SERVER_MSG_STRING, "The weekend bonus is no longer active.");
SetWorldRates();
}
}
}
void SetWorldRates()
{
@@ -98,6 +94,7 @@ class WeekendBonusWorld : WorldScript
sWorld->setRate(RATE_XP_PET, sWorld->getRate(RATE_XP_PET) * multiplierExperience);
sWorld->setRate(RATE_DROP_MONEY, sWorld->getRate(RATE_DROP_MONEY) * multiplierMoney);
sWorld->setRate(RATE_REPUTATION_GAIN, sWorld->getRate(RATE_REPUTATION_GAIN) * multiplierReputation);
triggered = true;
}
else
@@ -110,6 +107,7 @@ class WeekendBonusWorld : WorldScript
sWorld->setRate(RATE_XP_PET, sWorld->getRate(RATE_XP_PET) / multiplierExperience);
sWorld->setRate(RATE_DROP_MONEY, sWorld->getRate(RATE_DROP_MONEY) / multiplierMoney);
sWorld->setRate(RATE_REPUTATION_GAIN, sWorld->getRate(RATE_REPUTATION_GAIN) / multiplierReputation);
triggered = false;
}
}