Commit 52f8c5f05d0a531232a7dd7887becd2a77986aa1
1 parent
313069e3
Squashed commit of the following:
commit 072db1272534d7f7e03be650de0266c2f383f4f1 Author: zhouhaihai <zhhyf521@163.com> Date: Sat Oct 10 13:51:43 2020 +0800 推送 commit 84cf48b4b3bbabaf4dee84b648097eaae63341e5 Merge: 8cd3770 b7e842a Author: liuzujun <307836273@qq.com> Date: Fri Oct 9 20:28:13 2020 +0800 Merge branch 'develop' of 120.26.43.151:wasteland/server into develop commit 8cd3770f752dbb5189b45200d871e06749ccb813 Author: liuzujun <307836273@qq.com> Date: Fri Oct 9 20:28:09 2020 +0800 挂机关卡可以选择,经验金币根据最高关卡计算 commit b7e842ac0e4675625aa2f9b7718bc3c20d70824d Merge: 07c6a92 38c7e6a Author: zhouhaihai <zhhyf521@163.com> Date: Fri Oct 9 19:47:30 2020 +0800 Merge branch 'bugfix' into develop * bugfix: bug commit 07c6a92ba2cec99bbf73bde0e7f67123b914962b Author: zhouhaihai <zhhyf521@163.com> Date: Sun Sep 27 17:51:07 2020 +0800 bug commit bf857ca13989808894988bcad9900db0fa137bd0 Merge: 28f0c0c 337a016 Author: zhouhaihai <zhhyf521@163.com> Date: Sun Sep 27 17:46:13 2020 +0800 Merge branch 'bugfix' into develop * bugfix: bug commit 28f0c0ca8bf1a1ce232b15aa744fc1366fe4c543 Merge: 6288ab7 dea8913 Author: zhouhaihai <zhhyf521@163.com> Date: Sun Sep 27 16:48:37 2020 +0800 Merge branch 'bugfix' into develop * bugfix: 修复bug 记录聊天信息 缺了 newdevice 安全判定 commit 6288ab7fb49bed3a286c19493e77506f4723d418 Merge: 1988e15 3ed9569 Author: zhouhaihai <zhhyf521@163.com> Date: Wed Sep 23 14:56:57 2020 +0800 Merge branch 'bugfix' into develop * bugfix: 成就 参数错误 commit 1988e15ade745ec730e33bc67b2419f5445b27bf Merge: 550989a bcbb0c7 Author: zhouhaihai <zhhyf521@163.com> Date: Wed Sep 23 11:47:44 2020 +0800 Merge branch 'bugfix' into develop * bugfix: 3星解锁 cg commit 550989a71f4bf5cc423cd66a083fe55b8ed83d32 Merge: e621c84 f927f22 Author: zhouhaihai <zhhyf521@163.com> Date: Wed Sep 23 11:27:39 2020 +0800 Merge branch 'bugfix' into develop * bugfix: 增加神器标签 commit e621c84d9304b17d5d209a0b35af2ced6aabab3f Merge: 4a02453 c670faa Author: liuzujun <307836273@qq.com> Date: Tue Sep 22 17:55:50 2020 +0800 Merge branch 'develop' of 120.26.43.151:wasteland/server into develop commit 4a02453a9bbb5c78ea836f719aa6ea156050800f Author: liuzujun <307836273@qq.com> Date: Tue Sep 22 17:55:11 2020 +0800 挂机排除噩梦难度 commit c670faa00523d351636fd22cd1e16d6b620acd98 Merge: a5c44c4 8a57b60 Author: zhouhaihai <zhhyf521@163.com> Date: Mon Sep 21 19:23:26 2020 +0800 Merge branch 'bugfix' into develop * bugfix: 初始化冒险重置时间 被动新 commit a5c44c41a4a373aa17ce78a175bfe8d7830ee163 Merge: 4bd3095 95065b5 Author: liuzujun <307836273@qq.com> Date: Mon Sep 21 17:34:54 2020 +0800 Merge branch 'develop' of 120.26.43.151:wasteland/server into develop commit 4bd3095fd64333da15a48b603a76764a4b50848c Author: liuzujun <307836273@qq.com> Date: Mon Sep 21 17:34:49 2020 +0800 英雄帖任务bug commit 95065b5b5ff2829ef7765f540eff71594f8f2070 Author: zhouhaihai <zhhyf521@163.com> Date: Mon Sep 21 16:14:53 2020 +0800 被动技新 commit 5345bac781be3332711eb1cf40226fb676937b15 Merge: b8d4bc7 bdd3a19 Author: zhouhaihai <zhhyf521@163.com> Date: Mon Sep 21 13:51:06 2020 +0800 Merge branch 'bugfix' into develop * bugfix: 扣层数 commit b8d4bc787aa3dc676d14597025320ee36f392470 Merge: ce42bb0 871b3da Author: zhouhaihai <zhhyf521@163.com> Date: Mon Sep 21 11:12:32 2020 +0800 Merge branch 'bugfix' into develop * bugfix: 被动 取消 commit ce42bb0339857363f0b61faf5b21b9f55a610e7f Merge: 190e141 c23734e Author: liuzujun <307836273@qq.com> Date: Fri Sep 18 18:01:16 2020 +0800 Merge branch 'develop' of 120.26.43.151:wasteland/server into develop commit 190e14152f99bb754b251f25e9dc7eace017de5f Author: liuzujun <307836273@qq.com> Date: Fri Sep 18 18:01:11 2020 +0800 英雄帖活动初始化 commit ffa0e25910e80906eb7049ee1a105e3cf992e1be Author: liuzujun <307836273@qq.com> Date: Thu Sep 17 17:51:14 2020 +0800 日历活动 穿戴x个y品质铭文 commit 06d56de79951c6c3dccd665171611b9d090a3ac2 Merge: b3f13e5 2f7891b Author: liuzujun <307836273@qq.com> Date: Thu Sep 17 16:11:22 2020 +0800 Merge branch 'develop' of 120.26.43.151:wasteland/server into develop commit b3f13e563b19f87c021bf084ef1aa411d869759f Author: liuzujun <307836273@qq.com> Date: Thu Sep 17 16:11:19 2020 +0800 英雄令英雄收集相关任务 commit b07d54c24068e6e0dc22c3919296efe936d3c1fd Merge: e0ad10e 9c8e948 Author: liuzujun <307836273@qq.com> Date: Wed Sep 16 20:49:00 2020 +0800 Merge branch 'develop' of 120.26.43.151:wasteland/server into develop commit e0ad10e9c845b3f58866e184dcdcbc66b080de3e Author: liuzujun <307836273@qq.com> Date: Wed Sep 16 20:48:56 2020 +0800 英雄帖任务简单类型测试
Showing
15 changed files
with
284 additions
and
58 deletions
Show diff stats
src/ProtocolCode.lua
src/actions/ActivityAction.lua
| ... | ... | @@ -222,4 +222,42 @@ function _M.actPaySignRpc(agent, data) |
| 222 | 222 | return true |
| 223 | 223 | end |
| 224 | 224 | |
| 225 | +function _M.actCalendaTaskRpc(agent, data) | |
| 226 | + local role = agent.role | |
| 227 | + local msg = MsgPack.unpack(data) | |
| 228 | + local taskId = msg.id | |
| 229 | + local calTask = role:getProperty("calTask") or {} | |
| 230 | + local record = calTask["r"] or {} | |
| 231 | + local flag = record[taskId] or 0 | |
| 232 | + if flag == 1 then return 1 end | |
| 233 | + local open, actId = role.activity:isOpen("CalendaTask") | |
| 234 | + local actData = csvdb["activity_ctrlCsv"][actId] | |
| 235 | + if not open then return 2 end | |
| 236 | + if not actData then return 3 end | |
| 237 | + | |
| 238 | + local taskList = csvdb["activity_taskCsv"][actData.condition] | |
| 239 | + if not taskList then return 4 end | |
| 240 | + local taskCfg = taskList[taskId] | |
| 241 | + if not taskCfg then return 5 end | |
| 242 | + if taskCfg.key ~= actData.condition then return 6 end | |
| 243 | + | |
| 244 | + if (calTask[taskId] or 0) < taskCfg.condition1 then return 7 end | |
| 245 | + | |
| 246 | + record[taskId] = 1 | |
| 247 | + calTask["r"] = record | |
| 248 | + | |
| 249 | + role:updateProperty({field = "calTask", value = calTask}) | |
| 250 | + | |
| 251 | + local reward, change = role:award(taskCfg.reward, {log = {desc = "calendaTask"}}) | |
| 252 | + | |
| 253 | + role:log("activity", { | |
| 254 | + activity_id = taskId, -- 活动ID(或活动指定任务的ID) | |
| 255 | + activity_type = role.activity.ActivityType.CalendaTask, -- 活动类型,见活动类型枚举表 | |
| 256 | + activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 257 | + }) | |
| 258 | + | |
| 259 | + SendPacket(actionCodes.Activity_actCalendaTaskRpc, MsgPack.pack(role:packReward(reward, change))) | |
| 260 | + return true | |
| 261 | +end | |
| 262 | + | |
| 225 | 263 | return _M |
| 226 | 264 | \ No newline at end of file | ... | ... |
src/actions/AdvAction.lua
| ... | ... | @@ -250,7 +250,7 @@ function _M.startHangRpc(agent, data) |
| 250 | 250 | if not role:getAdvData():isRunning() then |
| 251 | 251 | role:updateProperty({field = "advTeam", value = {}}) |
| 252 | 252 | end |
| 253 | - | |
| 253 | + role:pushMsg({type = "adv", slot = chapterId, time = adv_idle_time}) | |
| 254 | 254 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) |
| 255 | 255 | |
| 256 | 256 | role:changeAdvCount(adv_idle_energy) |
| ... | ... | @@ -295,6 +295,7 @@ function _M.quickHangRpc(agent, data) |
| 295 | 295 | info.time = 0 |
| 296 | 296 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) |
| 297 | 297 | |
| 298 | + role:pushCancel({type = "adv", slot = chapterId}) | |
| 298 | 299 | role:mylog("adv_action", {desc = "advQuickHang", int1 = chapterId}) |
| 299 | 300 | |
| 300 | 301 | SendPacket(actionCodes.Adv_quickHangRpc, '') |
| ... | ... | @@ -371,6 +372,7 @@ function _M.endHangRpc(agent, data) |
| 371 | 372 | -- else |
| 372 | 373 | -- role:updateProperty({field = "advC", delta = -chapterData.limitlevel}) |
| 373 | 374 | -- end |
| 375 | + role:pushCancel({type = "adv", slot = chapterId}) | |
| 374 | 376 | else |
| 375 | 377 | return |
| 376 | 378 | end |
| ... | ... | @@ -380,6 +382,8 @@ function _M.endHangRpc(agent, data) |
| 380 | 382 | |
| 381 | 383 | role:mylog("adv_action", {desc = "endHang", int1 = chapterId, short1 = cancel and 1 or 0}) |
| 382 | 384 | |
| 385 | + role:checkTaskEnter("AdvHang", {}) | |
| 386 | + | |
| 383 | 387 | SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull})) |
| 384 | 388 | return true |
| 385 | 389 | end | ... | ... |
src/actions/DinerAction.lua
| ... | ... | @@ -75,6 +75,9 @@ function _M.addSellRpc( agent, data ) |
| 75 | 75 | sells[slot].count = count |
| 76 | 76 | sells[slot].time = skynet.timex() - calSell.deltaTime |
| 77 | 77 | |
| 78 | + local needTime = sells[slot].count * dishData.sell_time + sells[slot].time - skynet.timex() | |
| 79 | + role:pushMsg({type = "food", slot = slot, time = needTime}) | |
| 80 | + | |
| 78 | 81 | -- 检查解锁的顾客 |
| 79 | 82 | local had = {} |
| 80 | 83 | for _, sell in pairs(sells) do |
| ... | ... | @@ -155,6 +158,7 @@ function _M.removeSellRpc( agent, data ) |
| 155 | 158 | reward, change = role:award(reward, {log = {desc = "removeSell"}}) |
| 156 | 159 | sells[slot].count = 0 |
| 157 | 160 | |
| 161 | + role:pushCancel({type = "food", slot = slot}) | |
| 158 | 162 | role:log("restaurant_sale", { |
| 159 | 163 | item_id = dish, -- 售卖物品ID |
| 160 | 164 | restaurant_sale_seat = slot, -- 售卖物品所在位置 | ... | ... |
src/actions/HangAction.lua
| ... | ... | @@ -22,6 +22,7 @@ local function checkReward(role) |
| 22 | 22 | return false |
| 23 | 23 | end |
| 24 | 24 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
| 25 | + local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | |
| 25 | 26 | local nowCoinTime = math.min(skynet.timex(), hangInfo.endCoinTime or 0) |
| 26 | 27 | local nowItemTime = math.min(skynet.timex(), hangInfo.endItemTime or 0) |
| 27 | 28 | |
| ... | ... | @@ -39,9 +40,9 @@ local function checkReward(role) |
| 39 | 40 | |
| 40 | 41 | local items = role:getProperty("hangBag") |
| 41 | 42 | coinCount = coinCount + coinDoubleCount |
| 42 | - items[ItemId.Gold] = math.floor((items[ItemId.Gold] or 0) + coinCount * carbonData.money) | |
| 43 | - items[ItemId.Exp] = math.floor((items[ItemId.Exp] or 0) + coinCount * carbonData.exp) | |
| 44 | - items[ItemId.PlayerExp] = math.floor((items[ItemId.PlayerExp] or 0) + coinCount * carbonData.playerExp) | |
| 43 | + items[ItemId.Gold] = math.floor((items[ItemId.Gold] or 0) + coinCount * expCarbonData.money) | |
| 44 | + items[ItemId.Exp] = math.floor((items[ItemId.Exp] or 0) + coinCount * expCarbonData.exp) | |
| 45 | + items[ItemId.PlayerExp] = math.floor((items[ItemId.PlayerExp] or 0) + coinCount * expCarbonData.playerExp) | |
| 45 | 46 | |
| 46 | 47 | local pool = {} |
| 47 | 48 | for _, temp in pairs(carbonData.item:toArray()) do |
| ... | ... | @@ -139,6 +140,7 @@ function _M.startRpc( agent, data ) |
| 139 | 140 | local hangInfo = role:getProperty("hangInfo") |
| 140 | 141 | local isNew = not hangInfo.carbonId |
| 141 | 142 | hangInfo.carbonId = carbonId |
| 143 | + hangInfo.expCarbonId = isNew and carbonId or hangInfo.expCarbonId | |
| 142 | 144 | local nowTime = skynet.timex() |
| 143 | 145 | if isNew then |
| 144 | 146 | hangInfo.coinTime = nowTime |
| ... | ... | @@ -149,11 +151,14 @@ function _M.startRpc( agent, data ) |
| 149 | 151 | hangInfo.coinTime = math.min(nowTime, hangInfo.endCoinTime) |
| 150 | 152 | hangInfo.itemTime = math.min(nowTime, hangInfo.endItemTime) |
| 151 | 153 | end |
| 154 | + | |
| 155 | + role:pushMsg({type = "hang", time = math.min(hangInfo.endCoinTime - nowTime, hangInfo.endItemTime - nowTime)}) | |
| 152 | 156 | if not role:checkHangPass(carbonId) then |
| 153 | 157 | hangInfo.bossTime = nowTime + carbonData.idle_time |
| 154 | 158 | else |
| 155 | 159 | hangInfo.bossTime = nil |
| 156 | 160 | end |
| 161 | + | |
| 157 | 162 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
| 158 | 163 | |
| 159 | 164 | -- 指定当前引导的步骤 |
| ... | ... | @@ -193,7 +198,7 @@ function _M.startBattleRpc(agent, data) |
| 193 | 198 | return 1 |
| 194 | 199 | end |
| 195 | 200 | |
| 196 | - local hangInfo = role:getProperty("hangInfo") | |
| 201 | + local hangInfo = role:getProperty("hangInfo") or {} | |
| 197 | 202 | if curData.main ~= 1 then |
| 198 | 203 | if carbonId ~= hangInfo.carbonId then |
| 199 | 204 | return 2 |
| ... | ... | @@ -214,7 +219,7 @@ end |
| 214 | 219 | function _M.endBattleRpc(agent, data) |
| 215 | 220 | local role = agent.role |
| 216 | 221 | local msg = MsgPack.unpack(data) |
| 217 | - local hangInfo = role:getProperty("hangInfo") | |
| 222 | + local hangInfo = role:getProperty("hangInfo") or {} | |
| 218 | 223 | if not msg.key or msg.key ~= _BattleKey then |
| 219 | 224 | SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({errorCode = 1})) |
| 220 | 225 | return true |
| ... | ... | @@ -225,6 +230,7 @@ function _M.endBattleRpc(agent, data) |
| 225 | 230 | if not carbonData then |
| 226 | 231 | return 2 |
| 227 | 232 | end |
| 233 | + | |
| 228 | 234 | if carbonData.main ~= 1 then |
| 229 | 235 | if carbonId ~= hangInfo.carbonId then |
| 230 | 236 | return 3 |
| ... | ... | @@ -273,8 +279,8 @@ function _M.endBattleRpc(agent, data) |
| 273 | 279 | end |
| 274 | 280 | local nextCarbonId = role:getNextCarbonId(carbonId) |
| 275 | 281 | -- 设置挂机关卡 |
| 276 | - if isWin and hangInfo.carbonId < nextCarbonId then | |
| 277 | - hangInfo.carbonId = nextCarbonId | |
| 282 | + if isWin and (hangInfo.carbonId or 0) < nextCarbonId then | |
| 283 | + hangInfo.expCarbonId = nextCarbonId | |
| 278 | 284 | local cfg = csvdb["idle_battleCsv"][nextCarbonId] |
| 279 | 285 | if cfg then |
| 280 | 286 | hangInfo.bossTime = skynet.timex() + cfg.idle_time |
| ... | ... | @@ -354,7 +360,9 @@ function _M.getRewardRpc(agent , data) |
| 354 | 360 | hangInfo.itemTime = nowTime |
| 355 | 361 | role:updateProperty({field = "hangBag", value = items}) |
| 356 | 362 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
| 357 | - role:checkTaskEnter("HangGet") | |
| 363 | + role:pushMsg({type = "hang", time = globalCsv.idle_producetime_max}) | |
| 364 | + | |
| 365 | + role:checkTaskEnter("HangGet", {reward = reward}) | |
| 358 | 366 | if reward[ItemId.Gold] then |
| 359 | 367 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) |
| 360 | 368 | end |
| ... | ... | @@ -382,6 +390,7 @@ function _M.quickRpc(agent , data) |
| 382 | 390 | local hangInfo = role:getProperty("hangInfo") |
| 383 | 391 | if not hangInfo.carbonId then return end |
| 384 | 392 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
| 393 | + local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | |
| 385 | 394 | |
| 386 | 395 | local curCount = role.dailyData:getProperty("hangQC") + 1 |
| 387 | 396 | local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") |
| ... | ... | @@ -398,9 +407,9 @@ function _M.quickRpc(agent , data) |
| 398 | 407 | |
| 399 | 408 | local coinCount = math.floor(time / globalCsv.idle_money_produce_cd) |
| 400 | 409 | local itemCount = math.floor(time / globalCsv.idle_item_produce_cd) |
| 401 | - reward[ItemId.Gold] = math.floor((reward[ItemId.Gold] or 0) + coinCount * carbonData.money) | |
| 402 | - reward[ItemId.Exp] = math.floor((reward[ItemId.Exp] or 0) + coinCount * carbonData.exp) | |
| 403 | - reward[ItemId.PlayerExp] = math.floor((reward[ItemId.PlayerExp] or 0) + coinCount * carbonData.playerExp) | |
| 410 | + reward[ItemId.Gold] = math.floor((reward[ItemId.Gold] or 0) + coinCount * expCarbonData.money) | |
| 411 | + reward[ItemId.Exp] = math.floor((reward[ItemId.Exp] or 0) + coinCount * expCarbonData.exp) | |
| 412 | + reward[ItemId.PlayerExp] = math.floor((reward[ItemId.PlayerExp] or 0) + coinCount * expCarbonData.playerExp) | |
| 404 | 413 | |
| 405 | 414 | local pool = {} |
| 406 | 415 | for _, temp in pairs(carbonData.item:toArray()) do | ... | ... |
src/actions/HeroAction.lua
| ... | ... | @@ -60,6 +60,8 @@ function _M.levelUpRpc( agent, data ) |
| 60 | 60 | hero:mylog({desc = "levelUp", int1 = hero:getProperty("level")}) |
| 61 | 61 | |
| 62 | 62 | role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) |
| 63 | + | |
| 64 | + role:checkTaskEnter("HeroLvlCollect", {}) | |
| 63 | 65 | SendPacket(actionCodes.Hero_levelUpRpc, '') |
| 64 | 66 | return true |
| 65 | 67 | end |
| ... | ... | @@ -128,6 +130,8 @@ function _M.wakeRpc(agent, data) |
| 128 | 130 | }) |
| 129 | 131 | |
| 130 | 132 | SendPacket(actionCodes.Hero_wakeRpc, '') |
| 133 | + | |
| 134 | + role:checkTaskEnter("HeroStarCollect", {}) | |
| 131 | 135 | return true |
| 132 | 136 | end |
| 133 | 137 | |
| ... | ... | @@ -595,6 +599,8 @@ function _M.referRunesRpc(agent, data) |
| 595 | 599 | }) |
| 596 | 600 | end |
| 597 | 601 | end |
| 602 | + | |
| 603 | + role:checkTaskEnter("RuneQualityCollect", {}) | |
| 598 | 604 | |
| 599 | 605 | SendPacket(actionCodes.Hero_referRunesRpc, "") |
| 600 | 606 | return true |
| ... | ... | @@ -728,6 +734,13 @@ function _M.drawHeroRpc(agent, data) |
| 728 | 734 | if btype ~= 1 then |
| 729 | 735 | subType = 1 |
| 730 | 736 | end |
| 737 | + | |
| 738 | + if btype == 1 then | |
| 739 | + -- 判断定向卡池活动开启 | |
| 740 | + if not role.activity:isOpen("RaceDraw") then | |
| 741 | + return | |
| 742 | + end | |
| 743 | + end | |
| 731 | 744 | |
| 732 | 745 | local buildTypeData = csvdb["build_typeCsv"][btype] |
| 733 | 746 | if not buildTypeData then return 2 end | ... | ... |
src/actions/RoleAction.lua
| ... | ... | @@ -121,6 +121,9 @@ function _M.loginRpc( agent, data ) |
| 121 | 121 | role:setProperty("device", device) |
| 122 | 122 | end |
| 123 | 123 | end |
| 124 | + if msg.token then | |
| 125 | + role._pushToken = msg.token | |
| 126 | + end | |
| 124 | 127 | |
| 125 | 128 | if not msg.isGMlogin then |
| 126 | 129 | local banTime = role:getProperty("banTime") |
| ... | ... | @@ -550,7 +553,7 @@ function _M.openTimeBoxRpc(agent, data) |
| 550 | 553 | if boxL[slot] then return end |
| 551 | 554 | role:costItems({[itemId] = 1}, {log = {desc = "openTimeBox"}}) |
| 552 | 555 | boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime} |
| 553 | - | |
| 556 | + role:pushMsg({type = "box", slot = slot, time = randomData.openTime}) | |
| 554 | 557 | elseif oper == 2 then -- 领取 |
| 555 | 558 | local quick = msg.quick |
| 556 | 559 | if not boxL[slot] then return end |
| ... | ... | @@ -561,6 +564,7 @@ function _M.openTimeBoxRpc(agent, data) |
| 561 | 564 | costKey = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2] |
| 562 | 565 | if not role:checkItemEnough({[ItemId.BoxKey] = costKey}) then return end |
| 563 | 566 | role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}}) |
| 567 | + role:pushCancel({type = "box", slot = slot}) | |
| 564 | 568 | end |
| 565 | 569 | local boxId = boxL[slot].id |
| 566 | 570 | local itemData = csvdb["itemCsv"][boxId] |
| ... | ... | @@ -615,52 +619,57 @@ end |
| 615 | 619 | function _M.openSpeedUpBoxRpc(agent, data) |
| 616 | 620 | local role = agent.role |
| 617 | 621 | local msg = MsgPack.unpack(data) |
| 618 | - | |
| 619 | - local id = msg.id | |
| 620 | - local count = msg.count | |
| 621 | - local itemData = csvdb["itemCsv"][id] | |
| 622 | - if not itemData or itemData.type ~= ItemType.SpeedBox then return end | |
| 623 | - | |
| 624 | - if math.illegalNum(count, 1, role:getItemCount(id)) then return end | |
| 625 | - local useType, hour = table.unpack(itemData.use_effect:toArray(true, "=")) | |
| 626 | - local time = hour * 60 * 60 | |
| 622 | + local itemInfo = msg.itemInfo | |
| 627 | 623 | |
| 628 | 624 | local reward = {} |
| 629 | - if useType == 1 then -- 挂机齿轮 | |
| 630 | - local hangInfo = role:getProperty("hangInfo") | |
| 631 | - if not hangInfo.carbonId then | |
| 632 | - return | |
| 633 | - end | |
| 634 | - local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | |
| 635 | - reward[ItemId.Gold] = math.floor(time / globalCsv.idle_money_produce_cd) * carbonData.money * count | |
| 636 | - elseif useType == 2 then -- 挂机经验 | |
| 637 | - local hangInfo = role:getProperty("hangInfo") | |
| 638 | - if not hangInfo.carbonId then | |
| 639 | - return | |
| 640 | - end | |
| 641 | - local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | |
| 642 | - reward[ItemId.Exp] = math.floor(time / globalCsv.idle_money_produce_cd) * carbonData.exp * count | |
| 643 | - elseif useType == 3 then -- 食材商人收入 | |
| 644 | - local buildType = 6 | |
| 645 | - local level = role.dinerData:getProperty("buildL"):getv(buildType, 1) | |
| 646 | - local buildingData = csvdb["diner_buildingCsv"][buildType][level] | |
| 647 | - if not buildingData then | |
| 648 | - return 1 | |
| 649 | - end | |
| 650 | - local gfood = role.dinerData:getProperty("gfood") | |
| 651 | - if not next(gfood) then return end | |
| 652 | - for k , v in pairs(gfood) do | |
| 653 | - local itemId = v.id | |
| 654 | - local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 | |
| 655 | - reward[itemId] = math.floor(time / speed) * count | |
| 625 | + for i = 1, #itemInfo do | |
| 626 | + local pair = itemInfo[i] | |
| 627 | + local id = pair[1] | |
| 628 | + local count = pair[2] | |
| 629 | + local itemData = csvdb["itemCsv"][id] | |
| 630 | + if not itemData or itemData.type ~= ItemType.SpeedBox then return end | |
| 631 | + | |
| 632 | + if math.illegalNum(count, 1, role:getItemCount(id)) then return 1 end | |
| 633 | + local useType, hour = table.unpack(itemData.use_effect:toArray(true, "=")) | |
| 634 | + local time = hour * 60 * 60 | |
| 635 | + | |
| 636 | + if useType == 1 then -- 挂机齿轮 | |
| 637 | + local hangInfo = role:getProperty("hangInfo") | |
| 638 | + if not hangInfo.expCarbonId then | |
| 639 | + return 2 | |
| 640 | + end | |
| 641 | + local carbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | |
| 642 | + reward[ItemId.Gold] = (reward[ItemId.Gold] or 0) + math.floor(time / globalCsv.idle_money_produce_cd) * carbonData.money * count | |
| 643 | + elseif useType == 2 then -- 挂机经验 | |
| 644 | + local hangInfo = role:getProperty("hangInfo") | |
| 645 | + if not hangInfo.expCarbonId then | |
| 646 | + return 3 | |
| 647 | + end | |
| 648 | + local carbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | |
| 649 | + reward[ItemId.Exp] = (reward[ItemId.Exp] or 0) + math.floor(time / globalCsv.idle_money_produce_cd) * carbonData.exp * count | |
| 650 | + elseif useType == 3 then -- 食材商人收入 | |
| 651 | + local buildType = 6 | |
| 652 | + local level = role.dinerData:getProperty("buildL"):getv(buildType, 1) | |
| 653 | + local buildingData = csvdb["diner_buildingCsv"][buildType][level] | |
| 654 | + if not buildingData then | |
| 655 | + return 4 | |
| 656 | + end | |
| 657 | + local gfood = role.dinerData:getProperty("gfood") | |
| 658 | + if not next(gfood) then return 5 end | |
| 659 | + for k , v in pairs(gfood) do | |
| 660 | + local itemId = v.id | |
| 661 | + local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 | |
| 662 | + reward[itemId] = (reward[itemId] or 0) + math.floor(time / speed) * count | |
| 663 | + end | |
| 664 | + else | |
| 665 | + return 6 | |
| 656 | 666 | end |
| 657 | - else | |
| 658 | - return | |
| 667 | + | |
| 668 | + role:costItems({[id] = count}, {log = {desc = "speedUpBox"}}) | |
| 659 | 669 | end |
| 660 | 670 | |
| 661 | - role:costItems({[id] = count}, {log = {desc = "speedUpBox"}}) | |
| 662 | 671 | local change |
| 663 | - reward, change = role:award(reward, {log = {desc = "speedUpBox"}, int1 = id, int2 = count}) | |
| 672 | + reward, change = role:award(reward, {log = {desc = "speedUpBox"}}) | |
| 664 | 673 | |
| 665 | 674 | SendPacket(actionCodes.Role_openSpeedUpBoxRpc, MsgPack.pack(role:packReward(reward, change))) |
| 666 | 675 | return true | ... | ... |
src/models/Activity.lua
| ... | ... | @@ -18,6 +18,7 @@ Activity.ActivityType = { |
| 18 | 18 | DrawHero = 12, --抽卡周 招募 |
| 19 | 19 | AdvDraw = 13, --拾荒抽周 资助 |
| 20 | 20 | OpenBox = 14, --拆解周 时钟箱 |
| 21 | + RaceDraw = 15, -- 定向招募活动 | |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | 24 | |
| ... | ... | @@ -367,6 +368,37 @@ activityFunc[Activity.ActivityType.PayBack] = { |
| 367 | 368 | -- end, |
| 368 | 369 | } |
| 369 | 370 | |
| 371 | +-- 英雄帖 | |
| 372 | +activityFunc[Activity.ActivityType.CalendaTask] = { | |
| 373 | + ["init"] = function(self, actType, isCrossDay, notify) | |
| 374 | + local calTask = self.owner:getProperty("CalTask") | |
| 375 | + calTask = {} | |
| 376 | + local role = self.owner | |
| 377 | + local buildL = role.dinerData:getProperty("buildL") | |
| 378 | + local curLevel = buildL:getv(1, 1) | |
| 379 | + role:checkTaskEnter("DinerLevelUp", {level = curLevel}) | |
| 380 | + | |
| 381 | + role:checkTaskEnter("HeroLvlCollect", {}) | |
| 382 | + role:checkTaskEnter("HeroQualityCollect", {}) | |
| 383 | + | |
| 384 | + local curPopular = role.dinerData:getProperty("popular") | |
| 385 | + role:checkTaskEnter("DinerPopular", {count = curPopular}) | |
| 386 | + | |
| 387 | + local rLevel = role:getProperty("level") | |
| 388 | + role:checkTaskEnter("RoleLevelUp", {level = rLevel}) | |
| 389 | + | |
| 390 | + local towerInfo = role:getProperty("towerInfo") | |
| 391 | + role:checkTaskEnter("TowerPass", {level = towerInfo.l}) | |
| 392 | + --"PvpWin" | |
| 393 | + role:checkTaskEnter("HangPass", {}) | |
| 394 | + role:checkTaskEnter("HeroStarCollect", {}) | |
| 395 | + role:checkTaskEnter("RuneQualityCollect", {}) | |
| 396 | + | |
| 397 | + end, | |
| 398 | + -- ["close"] = function(self, actType, notify) | |
| 399 | + -- end, | |
| 400 | +} | |
| 401 | + | |
| 370 | 402 | function Activity:initActivity(actId, isCrossDay, notify) |
| 371 | 403 | local actData = csvdb["activity_ctrlCsv"][actId] |
| 372 | 404 | if not actData then return end | ... | ... |
src/models/Diner.lua
| ... | ... | @@ -298,6 +298,9 @@ function Diner:expediteSell(slot) |
| 298 | 298 | self:checkDinerTask(DinerTask.SellDishType, expediteCount, math.ceil(sell.dish / 100)) |
| 299 | 299 | self:checkDinerTask(DinerTask.SellDishRare, expediteCount, dishData.rarity) |
| 300 | 300 | self.owner:checkTaskEnter("FoodSell", {count = expediteCount}) |
| 301 | + | |
| 302 | + local needTime = sells[slot].count * dishData.sell_time + sells[slot].time - skynet.timex() | |
| 303 | + self.owner:pushMsg({type = "food", slot = slot, time = needTime}) | |
| 301 | 304 | end |
| 302 | 305 | return { |
| 303 | 306 | expediteCount = expediteCount, | ... | ... |
src/models/Role.lua
| ... | ... | @@ -27,6 +27,7 @@ function Role:ctor( properties ) |
| 27 | 27 | self.runeBag = {} |
| 28 | 28 | self.advData = nil |
| 29 | 29 | self.activity = nil |
| 30 | + self._pushToken = nil | |
| 30 | 31 | self.advElChapter = tonum(redisproxy:hget("adv_season", "chapter"), globalCsv.adv_endless_default_chapter) -- 无尽模式记录的赛季对应章节 |
| 31 | 32 | self.advOverTime = tonum(redisproxy:hget("adv_season", "overTime")) -- 无尽模式关闭时间戳 |
| 32 | 33 | if self.advOverTime == 0 then |
| ... | ... | @@ -174,6 +175,8 @@ Role.schema = { |
| 174 | 175 | |
| 175 | 176 | downCvR = {"number", 0}, -- 下载cv扩展包奖励 |
| 176 | 177 | feedback = {"table", {}}, -- 反馈相关信息 {flag = false, count = 0} flag是否评论过,count 提示次数 |
| 178 | + | |
| 179 | + calTask = {"table", {}}, -- 英雄令活动 日历任务活动 | |
| 177 | 180 | } |
| 178 | 181 | |
| 179 | 182 | |
| ... | ... | @@ -395,6 +398,7 @@ function Role:data() |
| 395 | 398 | downCvR = self:getProperty("downCvR"), -- 下载cv扩展包奖励 |
| 396 | 399 | feedback = self:getProperty("feedback"), |
| 397 | 400 | ctime = self:getProperty("ctime"), |
| 401 | + calTask = self:getProperty("calTask"), | |
| 398 | 402 | } |
| 399 | 403 | end |
| 400 | 404 | ... | ... |
src/models/RoleLog.lua
src/models/RolePlugin.lua
| ... | ... | @@ -453,6 +453,7 @@ function RolePlugin.bind(Role) |
| 453 | 453 | newHero:saveBattleValue() |
| 454 | 454 | self.heros[heroId] = newHero |
| 455 | 455 | self:checkTaskEnter("AddHero", {heroType = heroType, wakeL = newHero:getProperty("wakeL"), camp = unitData.camp, job = unitData.job}, params.notNotify) |
| 456 | + self:checkTaskEnter("HeroQualityCollect", {}) | |
| 456 | 457 | if not params.notNotify then |
| 457 | 458 | local heroResponse = {} |
| 458 | 459 | table.insert(heroResponse, newHero:data()) |
| ... | ... | @@ -1742,7 +1743,36 @@ function RolePlugin.bind(Role) |
| 1742 | 1743 | end) |
| 1743 | 1744 | return gift, checkPoint |
| 1744 | 1745 | end |
| 1746 | + --[[ | |
| 1747 | + "hang" : "挂机资源满", | |
| 1748 | + "box" : "箱子拆解完毕", | |
| 1749 | + "food" : "食物出售完毕", | |
| 1750 | + "adv" : "代理拾荒完毕", | |
| 1751 | + --]] | |
| 1752 | + function Role:pushMsg(params) | |
| 1753 | + if not self._pushToken or self._pushToken == "" then return end | |
| 1754 | + if params.time <= 0 then | |
| 1755 | + self:pushCancel(params) | |
| 1756 | + return | |
| 1757 | + end | |
| 1758 | + local content = string.format("push:%d:%s:%s:%s", self:getProperty("id"), params.type, params.slot or 1, self._pushToken) | |
| 1759 | + notifyClient({content = content, time = math.floor(params.time)}) | |
| 1760 | + end | |
| 1745 | 1761 | |
| 1762 | + function Role:pushCancel(params) | |
| 1763 | + if not self._pushToken or self._pushToken == "" then return end | |
| 1764 | + local content = string.format("push:%d:%s:%s:%s", self:getProperty("id"), params.type, params.slot or 1, self._pushToken) | |
| 1765 | + deleteNotify({content = content}) | |
| 1766 | + end | |
| 1767 | + | |
| 1768 | + function Role:pushCancelAll(ptype) | |
| 1769 | + if not self._pushToken or self._pushToken == "" then return end | |
| 1770 | + local pattern = string.format("push:%d:*", self:getProperty("id")) | |
| 1771 | + if ptype then | |
| 1772 | + pattern = string.format("push:%d:%s:*", self:getProperty("id"), ptype) | |
| 1773 | + end | |
| 1774 | + deleteNotify({pattern = pattern}) | |
| 1775 | + end | |
| 1746 | 1776 | end |
| 1747 | 1777 | |
| 1748 | 1778 | return RolePlugin |
| 1749 | 1779 | \ No newline at end of file | ... | ... |
src/models/RoleTask.lua
| ... | ... | @@ -255,11 +255,11 @@ local CalendaTaskListener = { |
| 255 | 255 | [TaskType.RoleLevelUp]= {{12, 2, f("level")}}, |
| 256 | 256 | [TaskType.TowerPass]= {{13, 2, f("level")}}, |
| 257 | 257 | [TaskType.HeroTalent]= {{14, 1}}, |
| 258 | - [TaskType.HangPass]= {{15, 2, f("id")}}, | |
| 258 | + [TaskType.HangPass]= {{15, 3}}, | |
| 259 | 259 | [TaskType.HeroStarCollect]= {{16, 3}}, |
| 260 | 260 | [TaskType.FoodSell]= {{17, 1, f("count")}}, |
| 261 | 261 | [TaskType.HangGet]= {{18, 3, f("reward")}}, |
| 262 | - [TaskType.RuneQualityCollect]= {{19, 3, f("id")}}, | |
| 262 | + [TaskType.RuneQualityCollect]= {{19, 3}}, | |
| 263 | 263 | [TaskType.OpenBox]= {{20, 3, f("count"), f("quality")}}, |
| 264 | 264 | } |
| 265 | 265 | } |
| ... | ... | @@ -272,6 +272,7 @@ local TaskListeners = { |
| 272 | 272 | SudokuListener, |
| 273 | 273 | ActivityListener, |
| 274 | 274 | StoreListener, |
| 275 | + CalendaTaskListener, | |
| 275 | 276 | } |
| 276 | 277 | |
| 277 | 278 | local RoleTask = {} |
| ... | ... | @@ -587,6 +588,8 @@ function RoleTask.bind(Role) |
| 587 | 588 | end |
| 588 | 589 | |
| 589 | 590 | function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2) |
| 591 | + --print("check calenda taskl", mainType, subType, param1, param2) | |
| 592 | + if not self.activity then return end | |
| 590 | 593 | local open, actId = self.activity:isOpen("CalendaTask") |
| 591 | 594 | local actData = csvdb["activity_ctrlCsv"][actId] |
| 592 | 595 | if not actData then return end |
| ... | ... | @@ -606,11 +609,86 @@ function RoleTask.bind(Role) |
| 606 | 609 | elseif subType == 2 then -- 直接赋值 |
| 607 | 610 | calTask[id] = param1 |
| 608 | 611 | elseif subType == 3 then -- 自定义类型 |
| 612 | + if cfg.type == 7 then -- 英雄品质收集进度 | |
| 613 | + local count = 0 | |
| 614 | + for _, hero in pairs(self.heros) do | |
| 615 | + local unitData = csvdb["unitCsv"][hero:getProperty("type")] | |
| 616 | + if unitData then | |
| 617 | + if cfg.condition2 <= unitData.rare then | |
| 618 | + count = count + 1 | |
| 619 | + end | |
| 620 | + end | |
| 621 | + end | |
| 622 | + if (calTask[id] or 0) < count then | |
| 623 | + calTask[id] = count | |
| 624 | + end | |
| 625 | + elseif cfg.type == 5 then -- 英雄等级收集进度 | |
| 626 | + local count = 0 | |
| 627 | + for _, hero in pairs(self.heros) do | |
| 628 | + if cfg.condition2 <= hero:getProperty("level") then | |
| 629 | + count = count + 1 | |
| 630 | + end | |
| 631 | + end | |
| 632 | + if calTask[id] < count then | |
| 633 | + calTask[id] = count | |
| 634 | + end | |
| 635 | + elseif cfg.type == 16 then -- 英雄星级收集进度 | |
| 636 | + local count = 0 | |
| 637 | + for _, hero in pairs(self.heros) do | |
| 638 | + if cfg.condition2 <= hero:getProperty("wakeL") then | |
| 639 | + count = count + 1 | |
| 640 | + end | |
| 641 | + end | |
| 642 | + if calTask[id] < count then | |
| 643 | + calTask[id] = count | |
| 644 | + end | |
| 645 | + elseif cfg.type == 18 then -- 挂机累计收获id,y个 | |
| 646 | + for rid, v in pairs(param1) do | |
| 647 | + if cfg.condition2 == rid then | |
| 648 | + calTask[id] = (calTask[id] or 0) + v | |
| 649 | + end | |
| 650 | + end | |
| 651 | + elseif cfg.type == 19 then -- x名英雄装备y品质以上符文套装 | |
| 652 | + local count = 0 | |
| 653 | + for _, hero in pairs(self.heros) do | |
| 654 | + local rcount = 0 | |
| 655 | + for _,uid in pairs(hero:getRunes()) do | |
| 656 | + if uid > 0 then | |
| 657 | + local runeData = self.runeBag[uid] | |
| 658 | + if runeData then | |
| 659 | + local csvData = csvdb["runeCsv"][runeData:getProperty("type")][runeData:getProperty("id")] | |
| 660 | + | |
| 661 | + if csvData and cfg.condition2 <= csvData.rarity then | |
| 662 | + rcount = rcount + 1 | |
| 663 | + end | |
| 664 | + end | |
| 665 | + end | |
| 666 | + end | |
| 667 | + if rcount == 6 then | |
| 668 | + count = count + 1 | |
| 669 | + end | |
| 670 | + end | |
| 671 | + calTask[id] = count | |
| 672 | + elseif cfg.type == 20 then -- 开启x品质时钟箱子 | |
| 673 | + if cfg.condition2 <= (param2 or 0) then | |
| 674 | + calTask[id] = (calTask[id] or 0) + param2 | |
| 675 | + end | |
| 676 | + elseif cfg.type == 15 then -- 通关关卡 | |
| 677 | + if (calTask[id] or 0) == 0 then | |
| 678 | + local hangPass = self:getProperty("hangPass") | |
| 679 | + local diff = math.floor(cfg.condition2 / 10000) | |
| 680 | + if (hangPass[diff] or 0) >= cfg.condition1 then | |
| 681 | + calTask[id] = 1 | |
| 682 | + end | |
| 683 | + end | |
| 684 | + end | |
| 609 | 685 | end |
| 610 | 686 | end |
| 611 | 687 | end |
| 612 | 688 | end |
| 613 | 689 | end |
| 690 | + self:updateProperty({field = "calTask", value = calTask, notNotify = notNotify}) | |
| 691 | + --dump(calTask) | |
| 614 | 692 | end |
| 615 | 693 | |
| 616 | 694 | end | ... | ... |
src/utils/CommonFunc.lua
| ... | ... | @@ -298,7 +298,7 @@ function notifyClient(params) |
| 298 | 298 | params.key = "zhaolugame20170831" |
| 299 | 299 | |
| 300 | 300 | local status, body = httpc.get(skynet.getenv("codeurl"), |
| 301 | - "/mipush/notify_user?" .. httpGetFormatData(params), {}, {}) | |
| 301 | + "/push/notify_user?" .. httpGetFormatData(params), {}, {}) | |
| 302 | 302 | if tonumber(status) ~= 200 then |
| 303 | 303 | skynet.error(status, body) |
| 304 | 304 | return |
| ... | ... | @@ -313,7 +313,7 @@ function deleteNotify(params) |
| 313 | 313 | params.key = "zhaolugame20170831" |
| 314 | 314 | |
| 315 | 315 | local status, body = httpc.get(skynet.getenv("codeurl"), |
| 316 | - "/mipush/delete_notify?" .. httpGetFormatData(params), {}, {}) | |
| 316 | + "/push/delete_notify?" .. httpGetFormatData(params), {}, {}) | |
| 317 | 317 | if tonumber(status) ~= 200 then |
| 318 | 318 | skynet.error(status, body) |
| 319 | 319 | return | ... | ... |
-
mentioned in commit fa38c9d4ae3b0564ee8abfa829d669acc46bab9e