Commit ff08d2c33496f7874c0bf298132930bcf355dc5a

Authored by zhouhaihai
2 parents 786de7e5 6662e7d2

Merge branch 'bugfix' into tr/ob

* bugfix:
  掉落活动配置最大掉落周期数
  拆解周活动跨轮数据异常bug
  道具开时钟箱,检查箱子够不够

# Conflicts:
#	src/csvdata
src/actions/ActivityAction.lua
@@ -375,6 +375,8 @@ function _M.hangDropRpc(agent, data) @@ -375,6 +375,8 @@ function _M.hangDropRpc(agent, data)
375 local msg = MsgPack.unpack(data) 375 local msg = MsgPack.unpack(data)
376 local actid = msg.actid 376 local actid = msg.actid
377 if not role.activity:isOpenById(actid, "HangDrop") then return 1 end 377 if not role.activity:isOpenById(actid, "HangDrop") then return 1 end
  378 + local actCtrlData = csvdb["activity_ctrlCsv"][actid]
  379 + if not actCtrlData then return end
378 380
379 local actCfg = csvdb["activity_putCsv"][actid] 381 local actCfg = csvdb["activity_putCsv"][actid]
380 if not actCfg then return 2 end 382 if not actCfg then return 2 end
@@ -407,7 +409,7 @@ function _M.hangDropRpc(agent, data) @@ -407,7 +409,7 @@ function _M.hangDropRpc(agent, data)
407 return 4 409 return 4
408 end 410 end
409 local num = math.floor((timeNow - actData)/ period) 411 local num = math.floor((timeNow - actData)/ period)
410 - num = num > 8 and 8 or num 412 + num = num > actCtrlData.condition and actCtrlData.condition or num
411 if num == 0 then 413 if num == 0 then
412 return 5 414 return 5
413 end 415 end
src/actions/RoleAction.lua
@@ -640,6 +640,7 @@ function _M.openTimeBoxRpc(agent, data) @@ -640,6 +640,7 @@ function _M.openTimeBoxRpc(agent, data)
640 end 640 end
641 641
642 if role:getItemCount(costId) < count then return 8 end 642 if role:getItemCount(costId) < count then return 8 end
  643 + if not role:checkItemEnough(costs) then return 9 end
643 644
644 role:costItems({[costId] = count}, {log = {desc = "openTimeBox"}}) 645 role:costItems({[costId] = count}, {log = {desc = "openTimeBox"}})
645 646
src/models/Activity.lua
@@ -277,38 +277,56 @@ function Activity:checkWeeklyAct(actType, notify, count, pool) @@ -277,38 +277,56 @@ function Activity:checkWeeklyAct(actType, notify, count, pool)
277 local totalCnt = 0 277 local totalCnt = 0
278 local finishCnt = 0 278 local finishCnt = 0
279 local maxCondition = 0 279 local maxCondition = 0
280 - for k, cfg in pairs(csvdb[info.table] or {}) do  
281 - totalCnt = totalCnt + 1  
282 - if maxCondition < cfg.condition1 then  
283 - maxCondition = cfg.condition1  
284 - end  
285 - if not curData[cfg.id] and curData[0] >= cfg.condition1 then  
286 - if info.mailId then 280 + local flag = true
  281 + while flag do
  282 + --print("tatal number :", curData[0])
  283 + for i = 1, #csvdb[info.table] do
  284 + local cfg = csvdb[info.table][i]
  285 + --for k, cfg in pairs(csvdb[info.table] or {}) do
  286 + totalCnt = totalCnt + 1
  287 + if maxCondition < cfg.condition1 then
  288 + maxCondition = cfg.condition1
  289 + end
  290 + --print("cur condition", cfg.condition1)
  291 + if curData[0] < cfg.condition1 then
  292 + flag = false
  293 + break
  294 + end
287 295
288 - self.owner:log("activity", {  
289 - activity_id = cfg.id, -- 活动ID(或活动指定任务的ID)  
290 - activity_type = actType, -- 活动类型,见活动类型枚举表  
291 - activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}  
292 - }) 296 + --print(curData[0], cfg.condition1)
  297 + if not curData[cfg.id] and curData[0] >= cfg.condition1 then
  298 + if info.mailId then
293 299
294 - self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1})  
295 - curData[cfg.id] = 1 300 + self.owner:log("activity", {
  301 + activity_id = cfg.id, -- 活动ID(或活动指定任务的ID)
  302 + activity_type = actType, -- 活动类型,见活动类型枚举表
  303 + activity_reward = cfg.reward:toNumMap(), -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  304 + })
  305 +
  306 + self.owner:sendMail(info.mailId, nil, cfg.reward, {cfg.condition1})
  307 + curData[cfg.id] = 1
  308 + end
  309 + end
  310 + if curData[cfg.id] then
  311 + finishCnt = finishCnt + 1
296 end 312 end
297 end 313 end
298 - if curData[cfg.id] then  
299 - finishCnt = finishCnt + 1  
300 - end  
301 - end  
302 - if totalCnt == finishCnt then  
303 - roundData[actType] = curRound + 1  
304 - for k,v in pairs(curData) do  
305 - if k == 0 then  
306 - curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0  
307 - else  
308 - curData[k] = nil 314 + if totalCnt == finishCnt then
  315 + roundData[actType] = (roundData[actType] or 0) + 1
  316 + for k,v in pairs(curData) do
  317 + if k == 0 then
  318 + curData[k] = curData[0] >= maxCondition and curData[0] - maxCondition or 0
  319 + else
  320 + curData[k] = nil
  321 + end
  322 + end
  323 + --print("cur round ".. roundData[actType], ctrlData.condition)
  324 + if roundData[actType] >= ctrlData.condition then
  325 + curData[0] = maxCondition
  326 + flag = false
309 end 327 end
  328 + self:updateProperty({field = "round", value = roundData, notNotify = not notify})
310 end 329 end
311 - self:updateProperty({field = "round", value = roundData, notNotify = not notify})  
312 end 330 end
313 self:updateActData(actType, curData, not notify) 331 self:updateActData(actType, curData, not notify)
314 end 332 end