nanduzenho
Member
Good morning, I'm migrating to TFS 1.5 and with that I'm aware that it changes the way the premium account is done. My database has the premium_ends_at column but when logging into the game all characters have 65000+ days of premium. In data\lib\core\player.lua I changed the script as it was in the original TFS folder:
I don't know where else I have to change, could someone help me with this problem?
Lua:
function Player.getPremiumTime(self)
return math.max(0, self:getPremiumEndsAt() - os.time())
end
function Player.setPremiumTime(self, seconds)
self:setPremiumEndsAt(os.time() + seconds)
return true
end
function Player.addPremiumTime(self, seconds)
self:setPremiumTime(self:getPremiumTime() + seconds)
return true
end
function Player.removePremiumTime(self, seconds)
local currentTime = self:getPremiumTime()
if currentTime < seconds then
return false
end
self:setPremiumTime(currentTime - seconds)
return true
end
function Player.getPremiumDays(self)
return math.floor(self:getPremiumTime() / 86400)
end
function Player.addPremiumDays(self, days)
return self:addPremiumTime(days * 86400)
end
function Player.removePremiumDays(self, days)
return self:removePremiumTime(days * 86400)
end
function Player.isPremium(self)
return self:getPremiumTime() > 0 --[[or configManager.getBoolean(configKeys.FREE_PREMIUM)]] or self:hasFlag(PlayerFlag_IsAlwaysPremium)
end
I don't know where else I have to change, could someone help me with this problem?