修复部分奖励不刷新的问题

dev_chengFeng
gaoxin 2020-10-19 23:51:15 +08:00
parent a3c461aff9
commit d9434f425d
1 changed files with 27 additions and 10 deletions

View File

@ -23,8 +23,12 @@ local _TimeCheckFunc = {
[UpViewRechargeType.AdventureAlianInvasionTicket] = function()
local curCount = BagManager.GetItemCountById(UpViewRechargeType.AdventureAlianInvasionTicket)
local maxCount = PrivilegeManager.GetPrivilegeNumber(9)
local itemData = BagManager.GetItemById(UpViewRechargeType.AdventureAlianInvasionTicket)
if not itemData then
return
end
if curCount < maxCount then
local nextFreshTime = BagManager.bagDatas[UpViewRechargeType.AdventureAlianInvasionTicket].nextFlushTime
local nextFreshTime = itemData.nextFlushTime
local remationTime = nextFreshTime - PlayerManager.serverTime
if remationTime >= 0 then
return remationTime
@ -38,8 +42,12 @@ local _TimeCheckFunc = {
[UpViewRechargeType.ActPower] = function()
local curCount = EndLessMapManager.GetLeftMapEnergy()
local maxCount = PrivilegeManager.GetPrivilegeNumber(20)
local itemData = BagManager.GetItemById(UpViewRechargeType.ActPower)
if not itemData then
return
end
if curCount < maxCount then
local nextFreshTime = BagManager.bagDatas[UpViewRechargeType.ActPower].nextFlushTime
local nextFreshTime = itemData.nextFlushTime
local remationTime = nextFreshTime - PlayerManager.serverTime
if remationTime > 0 then
return remationTime
@ -71,11 +79,17 @@ local _TimeCheckFunc = {
[UpViewRechargeType.YunYouVle] = function() --逍遥游云游值倒计时
local curCount = BagManager.GetItemCountById(UpViewRechargeType.YunYouVle)
local maxCount = PrivilegeManager.GetPrivilegeNumber(39)
local itemData = BagManager.GetItemById(UpViewRechargeType.YunYouVle)
if not itemData then
return
end
if curCount < maxCount then
local nextFreshTime = BagManager.bagDatas[UpViewRechargeType.YunYouVle].nextFlushTime
local remationTime = nextFreshTime - PlayerManager.serverTime -- 下一次刷新的时间
if remationTime<=-1 then
local timeInterval= GameSetting.ItemAdd[7][3]
local nextFreshTime = itemData.nextFlushTime
Log("云游值刷新时间:"..nextFreshTime)
local remationTime = nextFreshTime - PlayerManager.serverTime -- 下一次刷新的时间
if remationTime<0 then
local timeInterval= GameSetting.ItemAdd[7][3]
BagManager.bagDatas[UpViewRechargeType.YunYouVle].num = BagManager.bagDatas[UpViewRechargeType.YunYouVle].num+1
remationTime=timeInterval-(math.abs(remationTime)%timeInterval)
end
return remationTime
@ -90,17 +104,20 @@ local _TimeCheckFunc = {
--
function this.Initialize()
local _ItemAdd = {}
for _, data in ipairs(GameSetting.ItemAdd) do
table.insert(_ItemAdd, data)
end
Timer.New(function()
for _, data in ipairs(GameSetting.ItemAdd) do
for i = 1, #_ItemAdd do
local data = _ItemAdd[i]
local itemId = data[1]
local deltaNum = data[2]
local deltaTime = data[3]
if this.IsAutoRecover(itemId) then
local leftTime = this.GetRecoverTime(itemId)
-- 已满不需要刷新
if leftTime == -1 then
return
end
--
if leftTime == -2 then
BagManager.bagDatas[itemId].num = BagManager.bagDatas[itemId].num + deltaNum