54 lines
1.4 KiB
Lua
54 lines
1.4 KiB
Lua
local IdleData = class("IdleData", BaseData)
|
|
|
|
function IdleData:ctor()
|
|
end
|
|
|
|
function IdleData:init(data)
|
|
data = data or GConst.EMPTY_TABLE
|
|
self.data.dropTime = (data.gold_drop_time or 0) // 1000
|
|
self.data.adCount = data.ad_count or 0
|
|
self.data.energyCount = data.energy_count or 0
|
|
end
|
|
|
|
function IdleData:getLastDropTime()
|
|
return self.data.dropTime
|
|
end
|
|
|
|
function IdleData:getIsOpen()
|
|
return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.IDLE_DROP, true)
|
|
end
|
|
|
|
function IdleData:getIdleGoldDropTime()
|
|
if self.idleGoldDropTime == nil then
|
|
self.idleGoldDropTime = ConfigManager:getConfig("const")["idle_gold_drop_time"].value
|
|
end
|
|
return self.idleGoldDropTime
|
|
end
|
|
|
|
function IdleData:getIdleExpDropTime()
|
|
if self.idleExpDropTime == nil then
|
|
self.idleExpDropTime = ConfigManager:getConfig("const")["idle_exp_drop_time"].value
|
|
end
|
|
return self.idleExpDropTime
|
|
end
|
|
|
|
function IdleData:getIdleMaxTime()
|
|
if self.idleMaxTime == nil then
|
|
self.idleMaxTime = ConfigManager:getConfig("const")["idle_maxtime"].value
|
|
end
|
|
return self.idleMaxTime
|
|
end
|
|
|
|
function IdleData:getGoldPerHour()
|
|
local goldDrop = DataManager.ChapterData:getGoldDrop()
|
|
local time = self:getIdleGoldDropTime()
|
|
return math.floor(goldDrop * 3600 / time)
|
|
end
|
|
|
|
function IdleData:getExpPerHour()
|
|
local expDrop = DataManager.ChapterData:getExpDrop()
|
|
local time = self:getIdleExpDropTime()
|
|
return math.floor(expDrop * 3600 / time)
|
|
end
|
|
|
|
return IdleData |