Commit 493a8b1fe91d0dcef6a0551191948ccdf410cf90

Authored by liuzujun
1 parent edd92fd9

拾荒活动关卡开启时间检测

Showing 1 changed file with 37 additions and 3 deletions   Show diff stats
src/actions/AdvAction.lua
@@ -91,7 +91,7 @@ function _M.startAdvRpc( agent, data ) @@ -91,7 +91,7 @@ function _M.startAdvRpc( agent, data )
91 --local format = msg.format --编队 91 --local format = msg.format --编队
92 local supportIdx = msg.supportIdx --选择的支援效果 92 local supportIdx = msg.supportIdx --选择的支援效果
93 if not role:isFuncUnlock(FuncUnlock.Adv) then return end 93 if not role:isFuncUnlock(FuncUnlock.Adv) then return end
94 - 94 +
95 --上一个关卡结束才可以开始新的关卡 95 --上一个关卡结束才可以开始新的关卡
96 if role:getAdvData():isRunning() then return 8 end 96 if role:getAdvData():isRunning() then return 8 end
97 local advHang = role:getProperty("advHang") 97 local advHang = role:getProperty("advHang")
@@ -107,8 +107,10 @@ function _M.startAdvRpc( agent, data ) @@ -107,8 +107,10 @@ function _M.startAdvRpc( agent, data )
107 actCfg = actCfg[chapterId] 107 actCfg = actCfg[chapterId]
108 if not actCfg then return 22 end 108 if not actCfg then return 22 end
109 109
110 - local st = toUnixtime(actCfg["unlockTime"]..string_format("%02x", RESET_TIME))  
111 - if st > skynet.timex() then return 23 end 110 + if actCfg["unlockTime"] ~= 0 then
  111 + local st = toUnixtime(actCfg["unlockTime"]..string_format("%02x", RESET_TIME))
  112 + if st > skynet.timex() then return 23 end
  113 + end
112 114
113 if actCfg["prepose"] ~= "" then 115 if actCfg["prepose"] ~= "" then
114 local type, cid = actCfg["prepose"]:toArray(true, "=") 116 local type, cid = actCfg["prepose"]:toArray(true, "=")
@@ -213,6 +215,38 @@ function _M.startHangRpc(agent, data) @@ -213,6 +215,38 @@ function _M.startHangRpc(agent, data)
213 local campId = msg.campId or 2 --营地id 215 local campId = msg.campId or 2 --营地id
214 local format = msg.format --编队 216 local format = msg.format --编队
215 local index = msg.index or 1--时间索引id 217 local index = msg.index or 1--时间索引id
  218 + local actid = msg.actid
  219 +
  220 + -- 检查活动正确性
  221 + if actid then
  222 + if not role.activity:isOpenById(actid, "AdvLevel") then
  223 + return 20
  224 + end
  225 + local actCfg = csvdb["activity_adv_chapterCsv"][actid]
  226 + if not actCfg then return 21 end
  227 + actCfg = actCfg[chapterId]
  228 + if not actCfg then return 22 end
  229 +
  230 + local st = toUnixtime(actCfg["unlockTime"]..string_format("%02x", RESET_TIME))
  231 + if st > skynet.timex() then return 23 end
  232 +
  233 + if actCfg["prepose"] ~= "" then
  234 + local type, cid = actCfg["prepose"]:toArray(true, "=")
  235 + if type == 1 then
  236 + local actData = role.activity:getActData("ChallengeLevel")
  237 + local battleInfo = actData[cid] or {}
  238 + if (battleInfo["star"] or 0) == 0 then
  239 + return 24
  240 + end
  241 + elseif type == 2 then
  242 + local actData = role.activity:getActData("AdvLevel")
  243 + local advInfo = actData[cid] or {}
  244 + if not advInfo["pass"] then
  245 + return 25
  246 + end
  247 + end
  248 + end
  249 + end
216 250
217 local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] 251 local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId]
218 if not chapterData then return 1 end 252 if not chapterData then return 1 end