From 41ec6bbea52fbea93890c81b3ef44c7bbc47a846 Mon Sep 17 00:00:00 2001 From: sebbesiren <35768829+sebbesiren@users.noreply.github.com> Date: Fri, 15 Sep 2023 20:03:54 +0200 Subject: [PATCH] fix: add premium and daily reward (#1600) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • negative timeLeft on premium is no longer casted to an unsigned integer • it is now possible to collect daily reward (if statement reversed) --- data/modules/scripts/daily_reward/daily_reward.lua | 2 +- src/account/account.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/modules/scripts/daily_reward/daily_reward.lua b/data/modules/scripts/daily_reward/daily_reward.lua index c319a37923c..1c6feba310c 100644 --- a/data/modules/scripts/daily_reward/daily_reward.lua +++ b/data/modules/scripts/daily_reward/daily_reward.lua @@ -463,7 +463,7 @@ function Player.selectDailyReward(self, msg) -- Adding items to store inbox local inbox = self:getSlotItem(CONST_SLOT_STORE_INBOX) - if inbox then + if not inbox then self:sendError("You do not have enough space in your store inbox.") return false end diff --git a/src/account/account.cpp b/src/account/account.cpp index 30b92b5c694..5c093f917bd 100644 --- a/src/account/account.cpp +++ b/src/account/account.cpp @@ -170,7 +170,7 @@ namespace account { } void Account::addPremiumDays(const int32_t &days) { - uint32_t timeLeft = static_cast((m_account.premiumLastDay - getTimeNow()) % 86400); + auto timeLeft = static_cast((m_account.premiumLastDay - getTimeNow()) % 86400); setPremiumDays(m_account.premiumRemainingDays + days); if (timeLeft > 0) { @@ -199,8 +199,8 @@ namespace account { time_t currentTime = getTimeNow(); - uint32_t daysLeft = static_cast((lastDay - currentTime) / 86400); - uint32_t timeLeft = static_cast((lastDay - currentTime) % 86400); + auto daysLeft = static_cast((lastDay - currentTime) / 86400); + auto timeLeft = static_cast((lastDay - currentTime) % 86400); m_account.premiumRemainingDays = daysLeft > 0 ? daysLeft : 0;