|
|
@@ -187,11 +187,21 @@ function getTaskStartTime(actStartTime, mainType)
|
|
|
end
|
|
|
|
|
|
-- 获取任务剩余时间
|
|
|
-function getTaskLeftTime(actFinishTime, mainType)
|
|
|
+function getTaskLeftTime(actStartDate, mainType)
|
|
|
local time = getTaskTime(mainType)
|
|
|
if not time then return end
|
|
|
- local actLeftTime = getActLeftTime(actFinishTime)
|
|
|
- return actLeftTime % time
|
|
|
+
|
|
|
+ --local actLeftTime = getActLeftTime(actStartTime)
|
|
|
+ --return actLeftTime % time
|
|
|
+ actStartDate.hour = actStartDate.hour or 0
|
|
|
+ actStartDate.min = actStartDate.min or 0
|
|
|
+ actStartDate.sec = actStartDate.sec or 0
|
|
|
+ local actStartTime = os.time(actStartDate)
|
|
|
+ local now = os.time()
|
|
|
+ if now < actStartTime then
|
|
|
+ return 0
|
|
|
+ end
|
|
|
+ return (now - actStartTime) % time
|
|
|
end
|
|
|
|
|
|
-- 是否开放
|
|
|
@@ -268,7 +278,7 @@ end
|
|
|
|
|
|
-- 根据类型获取任务id
|
|
|
function getTaskIDList(mainType)
|
|
|
- return TASKTYPE_2_MAINTYPES and MAINTYPE_2_IDLIST[mainType]
|
|
|
+ return MAINTYPE_2_IDLIST and MAINTYPE_2_IDLIST[mainType]
|
|
|
end
|
|
|
|
|
|
-- 根据任务类型获取影响的分类
|
|
|
@@ -606,16 +616,19 @@ function fontBaseNet(net, human, actStartTime, lvdefine)
|
|
|
end
|
|
|
|
|
|
-- 封装任务信息
|
|
|
-function fontTaskNet(net, id, human)
|
|
|
+local function fontTaskNet(id, human)
|
|
|
local cf = AbsActExcel.heroGrowUpTask[id]
|
|
|
- net.id = id
|
|
|
- net.taskName = getTaskName(cf)
|
|
|
- net.taskDesc = getTaskDesc(cf)
|
|
|
- net.maxValue = getMaxValue(cf)
|
|
|
- net.nowValue = math.min(getValue(human, cf), net.maxValue)
|
|
|
- Grid.makeItem(net.item, cf.items[1][1], cf.items[1][2])
|
|
|
- net.panelID = cf.panelID
|
|
|
- net.state = getTaskState(human, id, cf)
|
|
|
+ local ret = {}
|
|
|
+ ret.id = id
|
|
|
+ ret.taskName = getTaskName(cf)
|
|
|
+ ret.taskDesc = getTaskDesc(cf)
|
|
|
+ ret.maxValue = getMaxValue(cf)
|
|
|
+ ret.nowValue = math.min(getValue(human, cf), ret.maxValue)
|
|
|
+ ret.item = ret.item or {}
|
|
|
+ Grid.makeItem(ret.item, cf.items[1][1], cf.items[1][2])
|
|
|
+ ret.panelID = cf.panelID
|
|
|
+ ret.state = getTaskState(human, id, cf)
|
|
|
+ return ret
|
|
|
end
|
|
|
|
|
|
-- 积分任务界面
|
|
|
@@ -643,10 +656,11 @@ function sendTaskQuery(human, mainType)
|
|
|
msgRet.data.hasTaskRed = isTaskRed(human) and 1 or 0
|
|
|
msgRet.mainType = mainType
|
|
|
msgRet.taskLeftTime = leftTime
|
|
|
+ msgRet.taskList = msgRet.taskList or {}
|
|
|
msgRet.taskList[0] = list and #list or 0
|
|
|
for i = 1, msgRet.taskList[0] do
|
|
|
local id = list[i]
|
|
|
- fontTaskNet(msgRet.taskList[i], id, human)
|
|
|
+ msgRet.taskList[i] = fontTaskNet(id, human)
|
|
|
end
|
|
|
msgRet.taskReds[0] = MAINTYPE_CNT
|
|
|
for i = 1, msgRet.taskReds[0] do
|