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