Commit dfa9ae5e737b325137ef3231056df4149df6b98c

Authored by liuzujun
1 parent b23cd820

战令任务活动

src/ProtocolCode.lua
@@ -232,7 +232,7 @@ actionCodes = { @@ -232,7 +232,7 @@ actionCodes = {
232 Activity_commonSignRpc = 666, 232 Activity_commonSignRpc = 666,
233 Activity_friendHelpRpc = 667, 233 Activity_friendHelpRpc = 667,
234 Activity_battleCommandRpc = 668, 234 Activity_battleCommandRpc = 668,
235 - Activity_actCalendaTmpTaskRpc = 669, 235 + Activity_actBattleCommandTaskRpc = 669,
236 Activity_newSignRpc = 670, 236 Activity_newSignRpc = 670,
237 Activity_advLevelRpc = 671, 237 Activity_advLevelRpc = 671,
238 Activity_buyBattleCommandLvlRpc = 672, 238 Activity_buyBattleCommandLvlRpc = 672,
src/actions/ActivityAction.lua
@@ -266,15 +266,15 @@ function _M.actCalendaTaskRpc(agent, data) @@ -266,15 +266,15 @@ function _M.actCalendaTaskRpc(agent, data)
266 return true 266 return true
267 end 267 end
268 268
269 -function _M.actCalendaTmpTaskRpc(agent, data) 269 +function _M.actBattleCommandTaskRpc(agent, data)
270 local role = agent.role 270 local role = agent.role
271 local msg = MsgPack.unpack(data) 271 local msg = MsgPack.unpack(data)
272 local taskId = msg.id 272 local taskId = msg.id
273 - local calTask = role:getProperty("calTask1") or {} 273 + local calTask = role:getProperty("bcTask") or {}
274 local record = calTask["r"] or {} 274 local record = calTask["r"] or {}
275 local flag = record[taskId] or 0 275 local flag = record[taskId] or 0
276 if flag == 1 then return 1 end 276 if flag == 1 then return 1 end
277 - local open, actId = role.activity:isOpen("CalendaTaskTmp") 277 + local open, actId = role.activity:isOpen("BattleCommandTask")
278 local actData = csvdb["activity_ctrlCsv"][actId] 278 local actData = csvdb["activity_ctrlCsv"][actId]
279 if not open then return 2 end 279 if not open then return 2 end
280 if not actData then return 3 end 280 if not actData then return 3 end
@@ -287,22 +287,28 @@ function _M.actCalendaTmpTaskRpc(agent, data) @@ -287,22 +287,28 @@ function _M.actCalendaTmpTaskRpc(agent, data)
287 287
288 if (calTask[taskId] or 0) < taskCfg.condition1 then return 7 end 288 if (calTask[taskId] or 0) < taskCfg.condition1 then return 7 end
289 289
  290 + local open, actId = role.activity:isOpen("BattleCommand")
  291 + local actData = csvdb["activity_ctrlCsv"][actId]
  292 + if not open then return 2 end
  293 + if not actData then return 3 end
  294 +
  295 +
290 record[taskId] = 1 296 record[taskId] = 1
291 calTask["r"] = record 297 calTask["r"] = record
292 298
293 - role:updateProperty({field = "calTask", value = calTask}) 299 + role:updateProperty({field = "bcTask", value = calTask})
294 300
295 - local reward, change = role:award(taskCfg.reward, {log = {desc = "calendaTask"}}) 301 + local reward, change = role:award(taskCfg.reward, {log = {desc = "battleCommandTask"}})
296 302
297 role:log("activity", { 303 role:log("activity", {
298 activity_id = taskId, -- 活动ID(或活动指定任务的ID) 304 activity_id = taskId, -- 活动ID(或活动指定任务的ID)
299 - activity_type = role.activity.ActivityType.CalendaTaskTmp, -- 活动类型,见活动类型枚举表 305 + activity_type = role.activity.ActivityType.BattleCommandTask, -- 活动类型,见活动类型枚举表
300 activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} 306 activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
301 }) 307 })
302 308
303 role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId}) 309 role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId})
304 310
305 - SendPacket(actionCodes.Activity_actCalendaTmpTaskRpc, MsgPack.pack(role:packReward(reward, change))) 311 + SendPacket(actionCodes.Activity_actBattleCommandTaskRpc, MsgPack.pack(role:packReward(reward, change)))
306 312
307 return true 313 return true
308 end 314 end
src/actions/AdvAction.lua
@@ -146,6 +146,7 @@ function _M.startAdvRpc( agent, data ) @@ -146,6 +146,7 @@ function _M.startAdvRpc( agent, data )
146 146
147 if not checkFormat(role) then return 7 end 147 if not checkFormat(role) then return 7 end
148 148
  149 + local cost = 0
149 if AdvCommon.isEndless(chapterId) then -- 无尽模式判断 150 if AdvCommon.isEndless(chapterId) then -- 无尽模式判断
150 151
151 if chapterId ~= role.advElChapter then return end -- 不是当前进行的章节 152 if chapterId ~= role.advElChapter then return end -- 不是当前进行的章节
@@ -164,6 +165,7 @@ function _M.startAdvRpc( agent, data ) @@ -164,6 +165,7 @@ function _M.startAdvRpc( agent, data )
164 end 165 end
165 166
166 role.dailyData:updateProperty({field = "advElC", delta = 1}) 167 role.dailyData:updateProperty({field = "advElC", delta = 1})
  168 + cost = 1
167 else -- 普通模式判断 169 else -- 普通模式判断
168 if layer >= chapterData.limitlevel then return 4 end 170 if layer >= chapterData.limitlevel then return 4 end
169 171
@@ -178,7 +180,9 @@ function _M.startAdvRpc( agent, data ) @@ -178,7 +180,9 @@ function _M.startAdvRpc( agent, data )
178 if not role:advChapterIsOpen(chapterId) then return 5 end 180 if not role:advChapterIsOpen(chapterId) then return 5 end
179 181
180 role:changeAdvCount(relayData.supply) 182 role:changeAdvCount(relayData.supply)
  183 + cost = relayData.supply
181 end 184 end
  185 + role:checkTaskEnter("AdvCostPower", {count = cost})
182 186
183 local support = {} -- 支援效果 187 local support = {} -- 支援效果
184 if AdvCommon.isEndless(chapterId) then 188 if AdvCommon.isEndless(chapterId) then
src/actions/HeroAction.lua
@@ -976,6 +976,9 @@ function _M.drawHeroRpc(agent, data) @@ -976,6 +976,9 @@ function _M.drawHeroRpc(agent, data)
976 end 976 end
977 977
978 role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) 978 role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]})
  979 + if btype ~= 3 then
  980 + role:checkTaskEnter("DrawHeroNotFriend", {pool = btype, count = drawCount[drawType]})
  981 + end
979 if ssrCount > 0 then 982 if ssrCount > 0 then
980 role:checkTaskEnter("DrawSSR", {count = ssrCount}) 983 role:checkTaskEnter("DrawSSR", {count = ssrCount})
981 end 984 end
src/actions/RoleAction.lua
@@ -165,6 +165,7 @@ function _M.loginRpc( agent, data ) @@ -165,6 +165,7 @@ function _M.loginRpc( agent, data )
165 role.activity:checkActivityStatus(now, false, false) 165 role.activity:checkActivityStatus(now, false, false)
166 role:log("onLogin") 166 role:log("onLogin")
167 end 167 end
  168 + role:checkTaskEnter("Login", {})
168 169
169 redisproxy:zadd(FRIEND_RECOMMEND, now, roleId) 170 redisproxy:zadd(FRIEND_RECOMMEND, now, roleId)
170 171
@@ -850,6 +851,8 @@ function _M.taskRpc(agent, data) @@ -850,6 +851,8 @@ function _M.taskRpc(agent, data)
850 -- 日常活动完成 851 -- 日常活动完成
851 if taskType == 1 then 852 if taskType == 1 then
852 role:checkTaskEnter("DailyTask", {pre = (taskStatus["a"] or 0), cur = active}) 853 role:checkTaskEnter("DailyTask", {pre = (taskStatus["a"] or 0), cur = active})
  854 + else
  855 + role:checkTaskEnter("WeekTask", {pre = (taskStatus["a"] or 0), cur = active})
853 end 856 end
854 857
855 role:changeUpdates({ 858 role:changeUpdates({
1 -Subproject commit 34a04e7f3c37fcb088e46c2c5a05fe558cb67946 1 +Subproject commit 3a1129db7ff72ddc39e74f565bcf3742af5ec87b
src/models/Activity.lua
@@ -38,7 +38,7 @@ Activity.ActivityType = { @@ -38,7 +38,7 @@ Activity.ActivityType = {
38 NewSign = 36, -- 活动签到,单独的签到界面 38 NewSign = 36, -- 活动签到,单独的签到界面
39 HeroBackFree = 37, -- 无损耗归还 39 HeroBackFree = 37, -- 无损耗归还
40 40
41 - CalendaTaskTmp = 38, -- 新春任务活动 41 + BattleCommandTask = 38, -- 战令任务活动
42 } 42 }
43 43
44 local function checkActivityType(activityType) 44 local function checkActivityType(activityType)
@@ -471,7 +471,7 @@ activityFunc[Activity.ActivityType.PayBack] = { @@ -471,7 +471,7 @@ activityFunc[Activity.ActivityType.PayBack] = {
471 -- 英雄帖 471 -- 英雄帖
472 activityFunc[Activity.ActivityType.CalendaTask] = { 472 activityFunc[Activity.ActivityType.CalendaTask] = {
473 ["init"] = function(self, actType, isCrossDay, notify) 473 ["init"] = function(self, actType, isCrossDay, notify)
474 - local calTask = self.owner:getProperty("CalTask") 474 + local calTask = self.owner:getProperty("calTask")
475 calTask = {} 475 calTask = {}
476 local role = self.owner 476 local role = self.owner
477 local buildL = role.dinerData:getProperty("buildL") 477 local buildL = role.dinerData:getProperty("buildL")
@@ -497,32 +497,49 @@ activityFunc[Activity.ActivityType.CalendaTask] = { @@ -497,32 +497,49 @@ activityFunc[Activity.ActivityType.CalendaTask] = {
497 497
498 end, 498 end,
499 ["crossDay"] = function(self, actType, notify, actId) 499 ["crossDay"] = function(self, actType, notify, actId)
500 - local actData = self.owner:getProperty("CalTask") or {} 500 + local actData = self.owner:getProperty("calTask") or {}
501 local record = actData["r"] or {} 501 local record = actData["r"] or {}
502 local actCfg = csvdb["activity_taskCsv"][actId] 502 local actCfg = csvdb["activity_taskCsv"][actId]
503 if not actCfg then return end 503 if not actCfg then return end
504 local change = false 504 local change = false
505 for taskId, cfg in pairs(actCfg) do 505 for taskId, cfg in pairs(actCfg) do
506 - if cfg["resetType"] == 1 then -- 每日充值 506 + if cfg["resetType"] == 1 then -- 每日重置
507 record[taskId] = nil 507 record[taskId] = nil
508 actData[taskId] = nil 508 actData[taskId] = nil
509 change = true 509 change = true
510 end 510 end
511 end 511 end
512 if change then 512 if change then
513 - self.owner:updateProperty({field="CalTask", value=actData}) 513 + self.owner:updateProperty({field="calTask", value=actData})
  514 + end
  515 + end,
  516 + ["crossWeek"] = function(self, actType, notify, actId)
  517 + local actData = self.owner:getProperty("calTask") or {}
  518 + local record = actData["r"] or {}
  519 + local actCfg = csvdb["activity_taskCsv"][actId]
  520 + if not actCfg then return end
  521 + local change = false
  522 + for taskId, cfg in pairs(actCfg) do
  523 + if cfg["resetType"] == 2 then -- 每周重置
  524 + record[taskId] = nil
  525 + actData[taskId] = nil
  526 + change = true
  527 + end
  528 + end
  529 + if change then
  530 + self.owner:updateProperty({field="calTask", value=actData})
514 end 531 end
515 end, 532 end,
516 ["close"] = function(self, actType, notify) 533 ["close"] = function(self, actType, notify)
517 - self.owner:updateProperty({field="CalTask", value={}}) 534 + self.owner:updateProperty({field="calTask", value={}})
518 end, 535 end,
519 } 536 }
520 537
521 -- 活动任务 仅供春节活动使用 防冲突 538 -- 活动任务 仅供春节活动使用 防冲突
522 -activityFunc[Activity.ActivityType.CalendaTaskTmp] = { 539 +activityFunc[Activity.ActivityType.BattleCommandTask] = {
523 ["init"] = function(self, actType, isCrossDay, notify) 540 ["init"] = function(self, actType, isCrossDay, notify)
524 - local calTask = self.owner:getProperty("CalTask1")  
525 - calTask = {} 541 + local bcTask = self.owner:getProperty("bcTask")
  542 + bcTask = {}
526 local role = self.owner 543 local role = self.owner
527 local buildL = role.dinerData:getProperty("buildL") 544 local buildL = role.dinerData:getProperty("buildL")
528 local curLevel = buildL:getv(1, 1) 545 local curLevel = buildL:getv(1, 1)
@@ -547,7 +564,7 @@ activityFunc[Activity.ActivityType.CalendaTaskTmp] = { @@ -547,7 +564,7 @@ activityFunc[Activity.ActivityType.CalendaTaskTmp] = {
547 564
548 end, 565 end,
549 ["crossDay"] = function(self, actType, notify, actId) 566 ["crossDay"] = function(self, actType, notify, actId)
550 - local actData = self.owner:getProperty("CalTask1") or {} 567 + local actData = self.owner:getProperty("bcTask") or {}
551 local record = actData["r"] or {} 568 local record = actData["r"] or {}
552 local actCfg = csvdb["activity_taskCsv"][actId] 569 local actCfg = csvdb["activity_taskCsv"][actId]
553 if not actCfg then return end 570 if not actCfg then return end
@@ -560,11 +577,28 @@ activityFunc[Activity.ActivityType.CalendaTaskTmp] = { @@ -560,11 +577,28 @@ activityFunc[Activity.ActivityType.CalendaTaskTmp] = {
560 end 577 end
561 end 578 end
562 if change then 579 if change then
563 - self.owner:updateProperty({field="CalTask1", value=actData}) 580 + self.owner:updateProperty({field="bcTask", value=actData})
  581 + end
  582 + end,
  583 + ["crossWeek"] = function(self, actType, notify, actId)
  584 + local actData = self.owner:getProperty("bcTask") or {}
  585 + local record = actData["r"] or {}
  586 + local actCfg = csvdb["activity_taskCsv"][actId]
  587 + if not actCfg then return end
  588 + local change = false
  589 + for taskId, cfg in pairs(actCfg) do
  590 + if cfg["resetType"] == 2 then -- 每周重置
  591 + record[taskId] = nil
  592 + actData[taskId] = nil
  593 + change = true
  594 + end
  595 + end
  596 + if change then
  597 + self.owner:updateProperty({field="bcTask", value=actData})
564 end 598 end
565 end, 599 end,
566 ["close"] = function(self, actType, notify) 600 ["close"] = function(self, actType, notify)
567 - self.owner:updateProperty({field="CalTask1", value={}}) 601 + self.owner:updateProperty({field="bcTask", value={}})
568 end, 602 end,
569 } 603 }
570 604
@@ -696,6 +730,18 @@ function Activity:refreshDailyData(notify) @@ -696,6 +730,18 @@ function Activity:refreshDailyData(notify)
696 end 730 end
697 end 731 end
698 732
  733 +function Activity:refreshWeekData(notify)
  734 + for actId, status in pairs(self._isOpen) do
  735 + local actData = csvdb["activity_ctrlCsv"][actId]
  736 + if status and actData then
  737 + local actType = actData.showType
  738 + if activityFunc[actType] and activityFunc[actType]['crossWeek'] then
  739 + activityFunc[actType]["crossWeek"](self, actType, notify, actId)
  740 + end
  741 + end
  742 + end
  743 +end
  744 +
699 function Activity:checkActivity(notNotify, activityType, ...) 745 function Activity:checkActivity(notNotify, activityType, ...)
700 if not activityType then return end 746 if not activityType then return end
701 if not self:isOpen(activityType) then return end 747 if not self:isOpen(activityType) then return end
@@ -963,7 +1009,7 @@ activityFunc[Activity.ActivityType.CommonSignIn] = { @@ -963,7 +1009,7 @@ activityFunc[Activity.ActivityType.CommonSignIn] = {
963 local actData = self:getActData(actType) or {} 1009 local actData = self:getActData(actType) or {}
964 local actCfg = csvdb["activity_ctrlCsv"][actId] 1010 local actCfg = csvdb["activity_ctrlCsv"][actId]
965 if not actCfg then return end 1011 if not actCfg then return end
966 - local conArr = actCfg.condition2:toArray("true", "=") 1012 + local conArr = actCfg.condition2:toArray(true, "=")
967 -- 0 登录即可, 1 达到指定活跃度 1013 -- 0 登录即可, 1 达到指定活跃度
968 if conArr[1] ~= 1 then 1014 if conArr[1] ~= 1 then
969 return 1015 return
@@ -978,7 +1024,7 @@ activityFunc[Activity.ActivityType.CommonSignIn] = { @@ -978,7 +1024,7 @@ activityFunc[Activity.ActivityType.CommonSignIn] = {
978 1024
979 activityFunc[Activity.ActivityType.BattleCommand] = { 1025 activityFunc[Activity.ActivityType.BattleCommand] = {
980 ["init"] = function (self, actType, isCrossDay, notify, actId) 1026 ["init"] = function (self, actType, isCrossDay, notify, actId)
981 - local data = {unlock = 0, freeR = "", payR = "", lvl = 0, sum = 0} 1027 + local data = {unlock = 0, freeR = "", payR = "", lvl = 0, sum = 0, week = 0}
982 self:updateActData(actType, data, not notify) 1028 self:updateActData(actType, data, not notify)
983 end, 1029 end,
984 ["check"] = function(self, actType, notify, id, count) -- 检查 itemid, count 1030 ["check"] = function(self, actType, notify, id, count) -- 检查 itemid, count
@@ -987,8 +1033,13 @@ activityFunc[Activity.ActivityType.BattleCommand] = { @@ -987,8 +1033,13 @@ activityFunc[Activity.ActivityType.BattleCommand] = {
987 local actCfg = csvdb["activity_ctrlCsv"][actId] 1033 local actCfg = csvdb["activity_ctrlCsv"][actId]
988 if not actCfg then return end 1034 if not actCfg then return end
989 if actCfg.condition1 == "" then return end 1035 if actCfg.condition1 == "" then return end
990 - local itemId = tonumber(actCfg.condition2) 1036 + local arr = actCfg.condition2:toArray(true, "=")
  1037 + local itemId, limit = arr[1], arr[2]
991 if itemId == id and count > 0 then 1038 if itemId == id and count > 0 then
  1039 + if actData["week"] >= limit then
  1040 + return
  1041 + end
  1042 + actData["week"] = actData["week"] + count
992 local total = actData["sum"] + count 1043 local total = actData["sum"] + count
993 local curLvl = actData["lvl"] or 0 1044 local curLvl = actData["lvl"] or 0
994 if actCfg.condition == 1 then -- 代表sum需要转换为等级 1045 if actCfg.condition == 1 then -- 代表sum需要转换为等级
@@ -1009,6 +1060,11 @@ activityFunc[Activity.ActivityType.BattleCommand] = { @@ -1009,6 +1060,11 @@ activityFunc[Activity.ActivityType.BattleCommand] = {
1009 self:updateActData(actType, actData) 1060 self:updateActData(actType, actData)
1010 end 1061 end
1011 end, 1062 end,
  1063 + ["crossWeek"] = function(self, actType, notify, actId)
  1064 + local actData = self:getActData(actType) or {}
  1065 + actData["week"] = 0
  1066 + self:updateActData(actType, actData, true)
  1067 + end,
1012 } 1068 }
1013 1069
1014 1070
src/models/Role.lua
@@ -184,7 +184,7 @@ Role.schema = { @@ -184,7 +184,7 @@ Role.schema = {
184 feedback = {"table", {}}, -- 反馈相关信息 {flag = false, count = 0} flag是否评论过,count 提示次数 184 feedback = {"table", {}}, -- 反馈相关信息 {flag = false, count = 0} flag是否评论过,count 提示次数
185 185
186 calTask = {"table", {}}, -- 英雄令活动 日历任务活动 186 calTask = {"table", {}}, -- 英雄令活动 日历任务活动
187 - calTask1 = {"table", {}}, -- 英雄令活动 日历任务活动 临时使用 187 + bcTask = {"table", {}}, -- 英雄令活动 日历任务活动 临时使用
188 radioTask = {"table", {}}, -- 电台任务 {id = {time=end_ts,heros=heros}} 表crusadeCsv 188 radioTask = {"table", {}}, -- 电台任务 {id = {time=end_ts,heros=heros}} 表crusadeCsv
189 } 189 }
190 190
@@ -412,7 +412,7 @@ function Role:data() @@ -412,7 +412,7 @@ function Role:data()
412 feedback = self:getProperty("feedback"), 412 feedback = self:getProperty("feedback"),
413 ctime = self:getProperty("ctime"), 413 ctime = self:getProperty("ctime"),
414 calTask = self:getProperty("calTask"), 414 calTask = self:getProperty("calTask"),
415 - calTask1 = self:getProperty("calTask1"), 415 + bcTask = self:getProperty("bcTask"),
416 radioTask = self:getProperty("radioTask"), 416 radioTask = self:getProperty("radioTask"),
417 } 417 }
418 end 418 end
src/models/RoleLog.lua
@@ -98,6 +98,7 @@ local ItemReason = { @@ -98,6 +98,7 @@ local ItemReason = {
98 actPaySign = 1008, -- 活动付费签到 98 actPaySign = 1008, -- 活动付费签到
99 calendaTask = 1009, -- 英雄帖 99 calendaTask = 1009, -- 英雄帖
100 actMilecrisis = 1010, -- 物资危机 100 actMilecrisis = 1010, -- 物资危机
  101 + battleCommandTask = 1011, -- 将军令任务
101 102
102 -- 餐厅 103 -- 餐厅
103 greenHourse = 1101, -- 食材获得 104 greenHourse = 1101, -- 食材获得
src/models/RolePlugin.lua
@@ -135,6 +135,15 @@ function RolePlugin.bind(Role) @@ -135,6 +135,15 @@ function RolePlugin.bind(Role)
135 self:addPotion({id = itemId, count = count, notNotify = pms.notNotify, log = pms.log}) 135 self:addPotion({id = itemId, count = count, notNotify = pms.notNotify, log = pms.log})
136 end, 136 end,
137 } 137 }
  138 +
  139 + if count > 0 then
  140 + local itemCfg = csvdb["itemCsv"][itemId]
  141 + local itemType = 0
  142 + if itemCfg then
  143 + itemType = itemCfg.type
  144 + end
  145 + self:checkTaskEnter("AddItem", {id = itemId, count = count, type = itemType})
  146 + end
138 -- 对数量筛查 147 -- 对数量筛查
139 count = checkItemCount(self, itemId, count) 148 count = checkItemCount(self, itemId, count)
140 if count ~= 0 then 149 if count ~= 0 then
@@ -362,9 +371,6 @@ function RolePlugin.bind(Role) @@ -362,9 +371,6 @@ function RolePlugin.bind(Role)
362 if not params.notNotify then 371 if not params.notNotify then
363 SendPacket(actionCodes.Role_updateItems, MsgPack.pack({[params.itemId] = nums})) 372 SendPacket(actionCodes.Role_updateItems, MsgPack.pack({[params.itemId] = nums}))
364 end 373 end
365 - if params.count > 0 then  
366 - self:checkTaskEnter("AddItem", {id = params.itemId, count = params.count})  
367 - end  
368 end 374 end
369 375
370 function Role:checkItemEnough(itemCountT) 376 function Role:checkItemEnough(itemCountT)
@@ -518,6 +524,8 @@ function RolePlugin.bind(Role) @@ -518,6 +524,8 @@ function RolePlugin.bind(Role)
518 end 524 end
519 525
520 self:notifyUpdateProperty("diamond", self:getAllDiamond()) 526 self:notifyUpdateProperty("diamond", self:getAllDiamond())
  527 +
  528 + self:checkTaskEnter("CostDiamond", {count = count})
521 return true 529 return true
522 end 530 end
523 531
src/models/RoleTask.lua
@@ -15,6 +15,7 @@ local TaskType = { @@ -15,6 +15,7 @@ local TaskType = {
15 HeroLvlCollect = 10, -- 英雄等级收集进度 15 HeroLvlCollect = 10, -- 英雄等级收集进度
16 HeroQualityCollect = 11, -- 英雄品质收集进度 16 HeroQualityCollect = 11, -- 英雄品质收集进度
17 HeroStarCollect = 12, -- 英雄星级收集进度 17 HeroStarCollect = 12, -- 英雄星级收集进度
  18 + DrawHeroNotFriend = 13, -- 非友情招募 -- count
18 19
19 --装备相关 20 --装备相关
20 AddEquip = 101, -- 获得装备 - equipId rarity 21 AddEquip = 101, -- 获得装备 - equipId rarity
@@ -53,6 +54,7 @@ local TaskType = { @@ -53,6 +54,7 @@ local TaskType = {
53 AdvMineLayer = 414, -- 宝藏洞激活 54 AdvMineLayer = 414, -- 宝藏洞激活
54 AdvKillBoss = 415, -- 拾荒击杀boss 55 AdvKillBoss = 415, -- 拾荒击杀boss
55 AdvHangHeroCnt = 416, -- 拾荒人数 56 AdvHangHeroCnt = 416, -- 拾荒人数
  57 + AdvCostPower = 417, -- 消耗体力
56 58
57 --爬塔相关 59 --爬塔相关
58 TowerPass = 501, -- 爬塔通关 - level 60 TowerPass = 501, -- 爬塔通关 - level
@@ -98,6 +100,9 @@ local TaskType = { @@ -98,6 +100,9 @@ local TaskType = {
98 RadioTaskStart = 905, -- 电台任务开始 100 RadioTaskStart = 905, -- 电台任务开始
99 FinishSpeTask = 906, -- 指定任务完成 101 FinishSpeTask = 906, -- 指定任务完成
100 AddItem = 907, -- 获得道具 102 AddItem = 907, -- 获得道具
  103 + Login = 908, -- 登入
  104 + CostDiamond = 909, -- 消耗钻石
  105 + WeekTask = 910, -- 完成每周活跃任务
101 106
102 --功能未实现 todo 107 --功能未实现 todo
103 AdvShop = 1002, -- 冒险商城 108 AdvShop = 1002, -- 冒险商城
@@ -284,42 +289,20 @@ local CalendaTaskListener = { @@ -284,42 +289,20 @@ local CalendaTaskListener = {
284 [TaskType.AdvMineKill] = {{26, 1}}, 289 [TaskType.AdvMineKill] = {{26, 1}},
285 [TaskType.PvpBattle] = {{27, 1}}, 290 [TaskType.PvpBattle] = {{27, 1}},
286 [TaskType.FinishSpeTask] = {{28, 3, f("taskId"), f("actId")}}, 291 [TaskType.FinishSpeTask] = {{28, 3, f("taskId"), f("actId")}},
287 - 292 + [TaskType.Login] = {{29, 1}},
  293 + [TaskType.DailyTask] = {{30, 2, f("cur")}},
  294 + [TaskType.WeekTask] = {{31, 2, f("cur")}},
  295 + [TaskType.MakeFood] = {{32, 1, f("count")}},
  296 + [TaskType.AddItem] = {{33, 3, f("type"), f("count")}},
  297 + [TaskType.CostDiamond] = {{34, 1, f("count")}},
  298 + [TaskType.DrawHeroNotFriend] = {{35, 1, f("count")}},
  299 + [TaskType.AdvCostPower] = {{36, 1, f("count")}},
288 } 300 }
289 } 301 }
290 302
291 -local CalendaTaskTmpListener = {  
292 - func = "checkCalendaTaskTmp",  
293 - listen = {  
294 - [TaskType.DrawHero] = {{1, 1, f("count")}},  
295 - [TaskType.BonusPass]= {{2, 1, f("count")}},  
296 - [TaskType.AdvStart]= {{3, 1}},  
297 - [TaskType.DinerLevelUp]= {{4, 2, f("level")}},  
298 - [TaskType.HeroLvlCollect]= {{5, 3}}, -- x名y级英雄  
299 - [TaskType.AdvHang]= {{6, 1}}, ----  
300 - [TaskType.HeroQualityCollect]= {{7, 3}},  
301 - [TaskType.OverOderTask]= {{8, 1}},  
302 - [TaskType.VillageApply]= {{9, 1}},  
303 - [TaskType.PvpWin]= {{10, 2, f("score")}},  
304 - [TaskType.DinerPopular]= {{11, 2, f("count")}},  
305 - [TaskType.RoleLevelUp]= {{12, 2, f("level")}},  
306 - [TaskType.TowerPass]= {{13, 2, f("level")}},  
307 - [TaskType.HeroTalent]= {{14, 1}},  
308 - [TaskType.HangPass]= {{15, 3}},  
309 - [TaskType.HeroStarCollect]= {{16, 3}},  
310 - [TaskType.FoodSell]= {{17, 1, f("count")}},  
311 - [TaskType.HangGet]= {{18, 3, f("reward")}},  
312 - [TaskType.RuneQualityCollect]= {{19, 3}},  
313 - [TaskType.OpenBox]= {{20, 3, f("count"), f("quality")}},  
314 - [TaskType.RadioTaskStart] = {{21, 1}, {22, 3, f("heroCnt")}},  
315 - [TaskType.BonusQuick] = {{23, 1, f("count")}},  
316 - [TaskType.AdvHangHeroCnt] = {{24, 3, f("HeroCnt")}},  
317 - [TaskType.AdvKillBoss] = {{25, 1}},  
318 - [TaskType.AdvMineKill] = {{26, 1}},  
319 - [TaskType.PvpBattle] = {{27, 1}},  
320 - [TaskType.FinishSpeTask] = {{28, 3, f("taskId"), f("actId")}},  
321 -  
322 - } 303 +local BattleCommandTaskListener = {
  304 + func = "checkBattleCommandTask",
  305 + listen = CalendaTaskListener["listen"]
323 } 306 }
324 307
325 local TaskListeners = { 308 local TaskListeners = {
@@ -330,7 +313,7 @@ local TaskListeners = { @@ -330,7 +313,7 @@ local TaskListeners = {
330 ActivityListener, 313 ActivityListener,
331 StoreListener, 314 StoreListener,
332 CalendaTaskListener, 315 CalendaTaskListener,
333 - CalendaTaskTmpListener, 316 + BattleCommandTaskListener,
334 } 317 }
335 318
336 local RoleTask = {} 319 local RoleTask = {}
@@ -659,15 +642,17 @@ function RoleTask.bind(Role) @@ -659,15 +642,17 @@ function RoleTask.bind(Role)
659 end 642 end
660 643
661 function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2) 644 function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2)
662 - --print("check calenda taskl", mainType, subType, param1, param2) 645 + --print("check calenda task", mainType, subType, param1, param2)
  646 + local actEnum = "CalendaTask"
  647 + local keyName = "calTask"
663 if not self.activity then return end 648 if not self.activity then return end
664 - local open, actId = self.activity:isOpen("CalendaTask") 649 + local open, actId = self.activity:isOpen(actEnum)
665 local actData = csvdb["activity_ctrlCsv"][actId] 650 local actData = csvdb["activity_ctrlCsv"][actId]
666 if not actData then return end 651 if not actData then return end
667 if not open then return end 652 if not open then return end
668 653
669 local change = false 654 local change = false
670 - local calTask = self:getProperty("calTask") or {} 655 + local calTask = self:getProperty(keyName) or {}
671 param1 = param1 or 1 656 param1 = param1 or 1
672 657
673 local cid = actData.condition 658 local cid = actData.condition
@@ -742,7 +727,7 @@ function RoleTask.bind(Role) @@ -742,7 +727,7 @@ function RoleTask.bind(Role)
742 calTask[id] = count 727 calTask[id] = count
743 elseif cfg.type == 20 then -- 开启x品质时钟箱子 728 elseif cfg.type == 20 then -- 开启x品质时钟箱子
744 if cfg.condition2 <= (param2 or 0) then 729 if cfg.condition2 <= (param2 or 0) then
745 - calTask[id] = (calTask[id] or 0) + param2 730 + calTask[id] = (calTask[id] or 0) + param1
746 end 731 end
747 elseif cfg.type == 15 then -- 通关关卡 732 elseif cfg.type == 15 then -- 通关关卡
748 if (calTask[id] or 0) == 0 then 733 if (calTask[id] or 0) == 0 then
@@ -761,26 +746,32 @@ function RoleTask.bind(Role) @@ -761,26 +746,32 @@ function RoleTask.bind(Role)
761 if actId == param2 and cfg.condition2 == param1 then 746 if actId == param2 and cfg.condition2 == param1 then
762 calTask[id] = (calTask[id] or 0) + 1 747 calTask[id] = (calTask[id] or 0) + 1
763 end 748 end
  749 + elseif cfg.type == 33 then -- 获得指定类型道具多少个
  750 + if cfg.condition2 == param1 then
  751 + calTask[id] = (calTask[id] or 0) + (param2 or 0)
  752 + end
764 end 753 end
765 end 754 end
766 end 755 end
767 end 756 end
768 end 757 end
769 end 758 end
770 - self:updateProperty({field = "calTask", value = calTask, notNotify = notNotify}) 759 + self:updateProperty({field = keyName, value = calTask, notNotify = notNotify})
771 --dump(calTask) 760 --dump(calTask)
772 end 761 end
773 762
774 - function Role:checkCalendaTaskTmp(notNotify, mainType, subType, param1, param2)  
775 - --print("check calenda taskl", mainType, subType, param1, param2) 763 + function Role:checkBattleCommandTask(notNotify, mainType, subType, param1, param2)
  764 + --print("check battle command task", mainType, subType, param1, param2)
  765 + local actEnum = "BattleCommandTask"
  766 + local keyName = "bcTask"
776 if not self.activity then return end 767 if not self.activity then return end
777 - local open, actId = self.activity:isOpen("CalendaTaskTmp") 768 + local open, actId = self.activity:isOpen(actEnum)
778 local actData = csvdb["activity_ctrlCsv"][actId] 769 local actData = csvdb["activity_ctrlCsv"][actId]
779 if not actData then return end 770 if not actData then return end
780 if not open then return end 771 if not open then return end
781 772
782 local change = false 773 local change = false
783 - local calTask = self:getProperty("calTask1") or {} 774 + local calTask = self:getProperty(keyName) or {}
784 param1 = param1 or 1 775 param1 = param1 or 1
785 776
786 local cid = actData.condition 777 local cid = actData.condition
@@ -855,7 +846,7 @@ function RoleTask.bind(Role) @@ -855,7 +846,7 @@ function RoleTask.bind(Role)
855 calTask[id] = count 846 calTask[id] = count
856 elseif cfg.type == 20 then -- 开启x品质时钟箱子 847 elseif cfg.type == 20 then -- 开启x品质时钟箱子
857 if cfg.condition2 <= (param2 or 0) then 848 if cfg.condition2 <= (param2 or 0) then
858 - calTask[id] = (calTask[id] or 0) + param2 849 + calTask[id] = (calTask[id] or 0) + param1
859 end 850 end
860 elseif cfg.type == 15 then -- 通关关卡 851 elseif cfg.type == 15 then -- 通关关卡
861 if (calTask[id] or 0) == 0 then 852 if (calTask[id] or 0) == 0 then
@@ -874,13 +865,17 @@ function RoleTask.bind(Role) @@ -874,13 +865,17 @@ function RoleTask.bind(Role)
874 if actId == param2 and cfg.condition2 == param1 then 865 if actId == param2 and cfg.condition2 == param1 then
875 calTask[id] = (calTask[id] or 0) + 1 866 calTask[id] = (calTask[id] or 0) + 1
876 end 867 end
  868 + elseif cfg.type == 33 then -- 获得指定类型道具多少个
  869 + if cfg.condition2 == param1 then
  870 + calTask[id] = (calTask[id] or 0) + (param2 or 0)
  871 + end
877 end 872 end
878 end 873 end
879 end 874 end
880 end 875 end
881 end 876 end
882 end 877 end
883 - self:updateProperty({field = "calTask1", value = calTask, notNotify = notNotify}) 878 + self:updateProperty({field = keyName, value = calTask, notNotify = notNotify})
884 --dump(calTask) 879 --dump(calTask)
885 end 880 end
886 881
src/models/RoleTimeReset.lua
@@ -41,6 +41,8 @@ ResetFunc[&quot;CrossWeek&quot;] = function(self, notify, response) @@ -41,6 +41,8 @@ ResetFunc[&quot;CrossWeek&quot;] = function(self, notify, response)
41 41
42 response.wTask = {} 42 response.wTask = {}
43 response.dinerS = {} 43 response.dinerS = {}
  44 +
  45 + self.activity:refreshWeekData(notify)
44 end 46 end
45 47
46 ResetFunc["CrossMonth"] = function(self, notify, response) 48 ResetFunc["CrossMonth"] = function(self, notify, response)