Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add premium and daily reward #1600

Merged
merged 4 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/modules/scripts/daily_reward/daily_reward.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/account/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ namespace account {
}

void Account::addPremiumDays(const int32_t &days) {
uint32_t timeLeft = static_cast<int>((m_account.premiumLastDay - getTimeNow()) % 86400);
auto timeLeft = static_cast<int32_t>((m_account.premiumLastDay - getTimeNow()) % 86400);
setPremiumDays(m_account.premiumRemainingDays + days);

if (timeLeft > 0) {
Expand Down Expand Up @@ -199,8 +199,8 @@ namespace account {

time_t currentTime = getTimeNow();

uint32_t daysLeft = static_cast<int>((lastDay - currentTime) / 86400);
uint32_t timeLeft = static_cast<int>((lastDay - currentTime) % 86400);
auto daysLeft = static_cast<int32_t>((lastDay - currentTime) / 86400);
auto timeLeft = static_cast<int32_t>((lastDay - currentTime) % 86400);

m_account.premiumRemainingDays = daysLeft > 0 ? daysLeft : 0;

Expand Down