Commit ba6d85edc65900830c7e168102d70671881b5808
1 parent
fa38c9d4
Squashed commit of the following:
commit bb5d94bd92685465a465cdcf89279b49a1ba1a28 Merge: 460afa6 072db12 Author: liuzujun <307836273@qq.com> Date: Mon Oct 12 16:26:07 2020 +0800 Merge branch 'develop' of 120.26.43.151:wasteland/server into develop commit 460afa6ed62568461352cf56a3926b73669aed66 Author: liuzujun <307836273@qq.com> Date: Mon Oct 12 16:26:00 2020 +0800 付费签到改为主动领取,战斗关卡不一定是当前挂机关卡 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
17 changed files
with
359 additions
and
102 deletions
Show diff stats
src/GlobalVar.lua
| 1 | 1 | XXTEA_KEY = "699D448D6D24f7F941E9F6E99F823E18" |
| 2 | -RESET_TIME = 0 | |
| 2 | +RESET_TIME = 4 | |
| 3 | 3 | |
| 4 | -START_RESET_TIME_BASE = 1584316800 -- 0时区 | |
| 4 | +START_RESET_TIME_BASE = 1584316800 + RESET_TIME * 3600 -- 0时区 | |
| 5 | 5 | DAY_SEC = 86400 |
| 6 | 6 | TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t", START_RESET_TIME_BASE))) / 3600) -- 本地时区 |
| 7 | 7 | |
| ... | ... | @@ -256,7 +256,7 @@ SettingStatus = { |
| 256 | 256 | }, |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | -EMAIL_LIMIT = 20 --邮件最大数量 | |
| 259 | +EMAIL_LIMIT = 50 --邮件最大数量 | |
| 260 | 260 | |
| 261 | 261 | RedPointTags = { |
| 262 | 262 | PvpCR = 1, | ... | ... |
src/ProtocolCode.lua
src/actions/ActivityAction.lua
| ... | ... | @@ -183,19 +183,21 @@ end |
| 183 | 183 | function _M.actPaySignRpc(agent, data) |
| 184 | 184 | local role = agent.role |
| 185 | 185 | local msg = MsgPack.unpack(data) |
| 186 | + local dayIndex = msg.day | |
| 186 | 187 | local actGoodsFlag = role.storeData:getProperty("actGoodsFlag") |
| 187 | 188 | local index = GetActGoodsIndex("paySignIn") |
| 188 | - local flag = actGoodsFlag[index] or 0 | |
| 189 | - if flag == 0 then return 1 end | |
| 189 | + local ts = actGoodsFlag[index] or 0 | |
| 190 | + if ts == 0 then return 1 end | |
| 190 | 191 | |
| 191 | - if not role.activity:isOpen("PaySignIn") then return 2 end | |
| 192 | + local open, actId = role.activity:isOpen("PaySignIn") | |
| 193 | + if not open then return 2 end | |
| 192 | 194 | |
| 193 | - local diffDay = diffFromOpen() + 1 | |
| 195 | + local diffDay = diffFromTs(ts) + 1 | |
| 194 | 196 | |
| 195 | 197 | local curData = role.activity:getActData("PaySignIn") |
| 196 | 198 | local reward, change = {} |
| 197 | 199 | for day, csvData in ipairs(csvdb["pay_signInCsv"]) do |
| 198 | - if day <= diffDay then | |
| 200 | + if day <= diffDay and day == dayIndex then | |
| 199 | 201 | if not curData[day] then |
| 200 | 202 | curData[day] = 1 |
| 201 | 203 | -- 奖励 |
| ... | ... | @@ -203,8 +205,8 @@ function _M.actPaySignRpc(agent, data) |
| 203 | 205 | reward[itemId] = (reward[itemId] or 0) + count |
| 204 | 206 | end |
| 205 | 207 | end |
| 206 | - else | |
| 207 | - break | |
| 208 | + --else | |
| 209 | + -- break | |
| 208 | 210 | end |
| 209 | 211 | end |
| 210 | 212 | if next(reward) then |
| ... | ... | @@ -213,7 +215,7 @@ function _M.actPaySignRpc(agent, data) |
| 213 | 215 | end |
| 214 | 216 | |
| 215 | 217 | role:log("activity", { |
| 216 | - activity_id = curData[0], -- 活动ID(或活动指定任务的ID) | |
| 218 | + activity_id = actId, -- 活动ID(或活动指定任务的ID) | |
| 217 | 219 | activity_type = role.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 |
| 218 | 220 | activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} |
| 219 | 221 | }) |
| ... | ... | @@ -222,4 +224,42 @@ function _M.actPaySignRpc(agent, data) |
| 222 | 224 | return true |
| 223 | 225 | end |
| 224 | 226 | |
| 227 | +function _M.actCalendaTaskRpc(agent, data) | |
| 228 | + local role = agent.role | |
| 229 | + local msg = MsgPack.unpack(data) | |
| 230 | + local taskId = msg.id | |
| 231 | + local calTask = role:getProperty("calTask") or {} | |
| 232 | + local record = calTask["r"] or {} | |
| 233 | + local flag = record[taskId] or 0 | |
| 234 | + if flag == 1 then return 1 end | |
| 235 | + local open, actId = role.activity:isOpen("CalendaTask") | |
| 236 | + local actData = csvdb["activity_ctrlCsv"][actId] | |
| 237 | + if not open then return 2 end | |
| 238 | + if not actData then return 3 end | |
| 239 | + | |
| 240 | + local taskList = csvdb["activity_taskCsv"][actData.condition] | |
| 241 | + if not taskList then return 4 end | |
| 242 | + local taskCfg = taskList[taskId] | |
| 243 | + if not taskCfg then return 5 end | |
| 244 | + if taskCfg.key ~= actData.condition then return 6 end | |
| 245 | + | |
| 246 | + if (calTask[taskId] or 0) < taskCfg.condition1 then return 7 end | |
| 247 | + | |
| 248 | + record[taskId] = 1 | |
| 249 | + calTask["r"] = record | |
| 250 | + | |
| 251 | + role:updateProperty({field = "calTask", value = calTask}) | |
| 252 | + | |
| 253 | + local reward, change = role:award(taskCfg.reward, {log = {desc = "calendaTask"}}) | |
| 254 | + | |
| 255 | + role:log("activity", { | |
| 256 | + activity_id = taskId, -- 活动ID(或活动指定任务的ID) | |
| 257 | + activity_type = role.activity.ActivityType.CalendaTask, -- 活动类型,见活动类型枚举表 | |
| 258 | + activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 259 | + }) | |
| 260 | + | |
| 261 | + SendPacket(actionCodes.Activity_actCalendaTaskRpc, MsgPack.pack(role:packReward(reward, change))) | |
| 262 | + return true | |
| 263 | +end | |
| 264 | + | |
| 225 | 265 | return _M |
| 226 | 266 | \ 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 |
| ... | ... | @@ -58,7 +59,8 @@ local function checkReward(role) |
| 58 | 59 | |
| 59 | 60 | -- 特权卡挂机额外栏位 |
| 60 | 61 | local privExtraCnt = role.storeData:getHangSlotExtraCount() |
| 61 | - local selfFC = role:getProperty("hangBagLimit") + privExtraCnt | |
| 62 | + --local selfFC = role:getProperty("hangBagLimit") + privExtraCnt | |
| 63 | + local selfFC = 50 | |
| 62 | 64 | local selfIC = selfFC * globalCsv.idle_field_limit |
| 63 | 65 | |
| 64 | 66 | local function randomItem() |
| ... | ... | @@ -139,6 +141,7 @@ function _M.startRpc( agent, data ) |
| 139 | 141 | local hangInfo = role:getProperty("hangInfo") |
| 140 | 142 | local isNew = not hangInfo.carbonId |
| 141 | 143 | hangInfo.carbonId = carbonId |
| 144 | + hangInfo.expCarbonId = isNew and carbonId or hangInfo.expCarbonId | |
| 142 | 145 | local nowTime = skynet.timex() |
| 143 | 146 | if isNew then |
| 144 | 147 | hangInfo.coinTime = nowTime |
| ... | ... | @@ -149,11 +152,14 @@ function _M.startRpc( agent, data ) |
| 149 | 152 | hangInfo.coinTime = math.min(nowTime, hangInfo.endCoinTime) |
| 150 | 153 | hangInfo.itemTime = math.min(nowTime, hangInfo.endItemTime) |
| 151 | 154 | end |
| 155 | + | |
| 156 | + role:pushMsg({type = "hang", time = math.min(hangInfo.endCoinTime - nowTime, hangInfo.endItemTime - nowTime)}) | |
| 152 | 157 | if not role:checkHangPass(carbonId) then |
| 153 | 158 | hangInfo.bossTime = nowTime + carbonData.idle_time |
| 154 | 159 | else |
| 155 | 160 | hangInfo.bossTime = nil |
| 156 | 161 | end |
| 162 | + | |
| 157 | 163 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
| 158 | 164 | |
| 159 | 165 | -- 指定当前引导的步骤 |
| ... | ... | @@ -193,12 +199,12 @@ function _M.startBattleRpc(agent, data) |
| 193 | 199 | return 1 |
| 194 | 200 | end |
| 195 | 201 | |
| 196 | - local hangInfo = role:getProperty("hangInfo") | |
| 197 | - if curData.main ~= 1 then | |
| 198 | - if carbonId ~= hangInfo.carbonId then | |
| 199 | - return 2 | |
| 200 | - end | |
| 201 | - end | |
| 202 | + --local hangInfo = role:getProperty("hangInfo") or {} | |
| 203 | + --if curData.main ~= 1 then | |
| 204 | + -- if carbonId ~= hangInfo.carbonId then | |
| 205 | + -- return 2 | |
| 206 | + -- end | |
| 207 | + --end | |
| 202 | 208 | |
| 203 | 209 | if role:checkHangPass(carbonId) then |
| 204 | 210 | return 3 |
| ... | ... | @@ -214,7 +220,7 @@ end |
| 214 | 220 | function _M.endBattleRpc(agent, data) |
| 215 | 221 | local role = agent.role |
| 216 | 222 | local msg = MsgPack.unpack(data) |
| 217 | - local hangInfo = role:getProperty("hangInfo") | |
| 223 | + local hangInfo = role:getProperty("hangInfo") or {} | |
| 218 | 224 | if not msg.key or msg.key ~= _BattleKey then |
| 219 | 225 | SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({errorCode = 1})) |
| 220 | 226 | return true |
| ... | ... | @@ -225,11 +231,12 @@ function _M.endBattleRpc(agent, data) |
| 225 | 231 | if not carbonData then |
| 226 | 232 | return 2 |
| 227 | 233 | end |
| 228 | - if carbonData.main ~= 1 then | |
| 229 | - if carbonId ~= hangInfo.carbonId then | |
| 230 | - return 3 | |
| 231 | - end | |
| 232 | - end | |
| 234 | + | |
| 235 | + --if carbonData.main ~= 1 then | |
| 236 | + -- if carbonId ~= hangInfo.carbonId then | |
| 237 | + -- return 3 | |
| 238 | + -- end | |
| 239 | + --end | |
| 233 | 240 | |
| 234 | 241 | if role:checkHangPass(carbonId) then |
| 235 | 242 | return 4 |
| ... | ... | @@ -273,8 +280,8 @@ function _M.endBattleRpc(agent, data) |
| 273 | 280 | end |
| 274 | 281 | local nextCarbonId = role:getNextCarbonId(carbonId) |
| 275 | 282 | -- 设置挂机关卡 |
| 276 | - if isWin and hangInfo.carbonId < nextCarbonId then | |
| 277 | - hangInfo.carbonId = nextCarbonId | |
| 283 | + if isWin and (hangInfo.carbonId or 0) < nextCarbonId then | |
| 284 | + hangInfo.expCarbonId = nextCarbonId | |
| 278 | 285 | local cfg = csvdb["idle_battleCsv"][nextCarbonId] |
| 279 | 286 | if cfg then |
| 280 | 287 | hangInfo.bossTime = skynet.timex() + cfg.idle_time |
| ... | ... | @@ -354,7 +361,9 @@ function _M.getRewardRpc(agent , data) |
| 354 | 361 | hangInfo.itemTime = nowTime |
| 355 | 362 | role:updateProperty({field = "hangBag", value = items}) |
| 356 | 363 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
| 357 | - role:checkTaskEnter("HangGet") | |
| 364 | + role:pushMsg({type = "hang", time = globalCsv.idle_producetime_max}) | |
| 365 | + | |
| 366 | + role:checkTaskEnter("HangGet", {reward = reward}) | |
| 358 | 367 | if reward[ItemId.Gold] then |
| 359 | 368 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) |
| 360 | 369 | end |
| ... | ... | @@ -382,6 +391,7 @@ function _M.quickRpc(agent , data) |
| 382 | 391 | local hangInfo = role:getProperty("hangInfo") |
| 383 | 392 | if not hangInfo.carbonId then return end |
| 384 | 393 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
| 394 | + local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | |
| 385 | 395 | |
| 386 | 396 | local curCount = role.dailyData:getProperty("hangQC") + 1 |
| 387 | 397 | local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") |
| ... | ... | @@ -398,9 +408,9 @@ function _M.quickRpc(agent , data) |
| 398 | 408 | |
| 399 | 409 | local coinCount = math.floor(time / globalCsv.idle_money_produce_cd) |
| 400 | 410 | 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) | |
| 411 | + reward[ItemId.Gold] = math.floor((reward[ItemId.Gold] or 0) + coinCount * expCarbonData.money) | |
| 412 | + reward[ItemId.Exp] = math.floor((reward[ItemId.Exp] or 0) + coinCount * expCarbonData.exp) | |
| 413 | + reward[ItemId.PlayerExp] = math.floor((reward[ItemId.PlayerExp] or 0) + coinCount * expCarbonData.playerExp) | |
| 404 | 414 | |
| 405 | 415 | local pool = {} |
| 406 | 416 | 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 |
| ... | ... | @@ -835,7 +848,7 @@ function _M.drawHeroRpc(agent, data) |
| 835 | 848 | |
| 836 | 849 | local guideHero |
| 837 | 850 | if role:getProperty("newerGuide") == "11=1" then |
| 838 | - guideHero = 613 | |
| 851 | + guideHero = globalCsv.newdraw_hero_item_id or 613 | |
| 839 | 852 | end |
| 840 | 853 | |
| 841 | 854 | local ssrCount = 0 | ... | ... |
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 | |
| ... | ... | @@ -344,8 +345,9 @@ activityFunc[Activity.ActivityType.PaySignIn] = { |
| 344 | 345 | ["init"] = function(self, actType, isCrossDay, notify) |
| 345 | 346 | self:updateActData(actType, {}, not notify) |
| 346 | 347 | end, |
| 347 | - -- ["close"] = function(self, actType, notify) | |
| 348 | - -- end, | |
| 348 | + ["close"] = function(self, actType, notify) | |
| 349 | + self.owner.storeData:SetActGoodsFlag("paySignIn", 0) | |
| 350 | + end, | |
| 349 | 351 | } |
| 350 | 352 | |
| 351 | 353 | -- 充值反馈 |
| ... | ... | @@ -367,6 +369,37 @@ activityFunc[Activity.ActivityType.PayBack] = { |
| 367 | 369 | -- end, |
| 368 | 370 | } |
| 369 | 371 | |
| 372 | +-- 英雄帖 | |
| 373 | +activityFunc[Activity.ActivityType.CalendaTask] = { | |
| 374 | + ["init"] = function(self, actType, isCrossDay, notify) | |
| 375 | + local calTask = self.owner:getProperty("CalTask") | |
| 376 | + calTask = {} | |
| 377 | + local role = self.owner | |
| 378 | + local buildL = role.dinerData:getProperty("buildL") | |
| 379 | + local curLevel = buildL:getv(1, 1) | |
| 380 | + role:checkTaskEnter("DinerLevelUp", {level = curLevel}) | |
| 381 | + | |
| 382 | + role:checkTaskEnter("HeroLvlCollect", {}) | |
| 383 | + role:checkTaskEnter("HeroQualityCollect", {}) | |
| 384 | + | |
| 385 | + local curPopular = role.dinerData:getProperty("popular") | |
| 386 | + role:checkTaskEnter("DinerPopular", {count = curPopular}) | |
| 387 | + | |
| 388 | + local rLevel = role:getProperty("level") | |
| 389 | + role:checkTaskEnter("RoleLevelUp", {level = rLevel}) | |
| 390 | + | |
| 391 | + local towerInfo = role:getProperty("towerInfo") | |
| 392 | + role:checkTaskEnter("TowerPass", {level = towerInfo.l}) | |
| 393 | + --"PvpWin" | |
| 394 | + role:checkTaskEnter("HangPass", {}) | |
| 395 | + role:checkTaskEnter("HeroStarCollect", {}) | |
| 396 | + role:checkTaskEnter("RuneQualityCollect", {}) | |
| 397 | + | |
| 398 | + end, | |
| 399 | + -- ["close"] = function(self, actType, notify) | |
| 400 | + -- end, | |
| 401 | +} | |
| 402 | + | |
| 370 | 403 | function Activity:initActivity(actId, isCrossDay, notify) |
| 371 | 404 | local actData = csvdb["activity_ctrlCsv"][actId] |
| 372 | 405 | 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/models/Store.lua
| ... | ... | @@ -57,7 +57,7 @@ end |
| 57 | 57 | function Store:onCrossDay() |
| 58 | 58 | self:sendMonthCardEmail() |
| 59 | 59 | self:deleteExpireLimitGoods() |
| 60 | - self:checkPaySignReward() | |
| 60 | + --self:checkPaySignReward() | |
| 61 | 61 | end |
| 62 | 62 | |
| 63 | 63 | -- 删除过期商品 |
| ... | ... | @@ -356,32 +356,46 @@ function GetActGoodsIndex(goodsType) |
| 356 | 356 | return ActGoodsType[goodsType] or 0 |
| 357 | 357 | end |
| 358 | 358 | |
| 359 | --- 购买付费签到 按开服时间算奖励 | |
| 360 | -function Store:onBuyPaySignCard(dur) | |
| 361 | - local curTs = skynet.timex() | |
| 359 | +function Store:SetActGoodsFlag(goodsType, flag) | |
| 362 | 360 | local actGoodsFlag = self:getProperty("actGoodsFlag") or {} |
| 363 | - local goodsIndex = GetActGoodsIndex("paySignIn") | |
| 361 | + local goodsIndex = GetActGoodsIndex(goodsType) | |
| 364 | 362 | if goodsIndex == 0 then |
| 365 | 363 | print("get act goods index fail :paySignIn") |
| 366 | 364 | return |
| 367 | 365 | end |
| 368 | - actGoodsFlag[goodsIndex] = 1 | |
| 366 | + actGoodsFlag[goodsIndex] = flag | |
| 369 | 367 | self:updateProperty({field = "actGoodsFlag", value = actGoodsFlag}) |
| 370 | - -- 发钱 | |
| 371 | - local change | |
| 372 | - local reward, curData = self.owner.activity:getPaySignReward() | |
| 373 | - if next(reward) then | |
| 374 | - self.owner.activity:updateActData("PaySignIn", curData) | |
| 375 | - reward, change = self.owner:award(reward, {log = {desc = "actPaySign"}}) | |
| 376 | - end | |
| 368 | +end | |
| 369 | + | |
| 370 | +-- 购买付费签到 按开服时间算奖励 | |
| 371 | +function Store:onBuyPaySignCard(dur) | |
| 372 | + local curTs = skynet.timex() | |
| 377 | 373 | |
| 378 | - self.owner:log("activity", { | |
| 379 | - activity_id = 0, -- 活动ID(或活动指定任务的ID) | |
| 380 | - activity_type = self.owner.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 | |
| 381 | - activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 382 | - }) | |
| 374 | + self:SetActGoodsFlag("paySignIn", curTs) | |
| 383 | 375 | |
| 384 | - SendPacket(actionCodes.Activity_actPaySignRewardNtf, MsgPack.pack(self.owner:packReward(reward, change))) | |
| 376 | + --local actGoodsFlag = self:getProperty("actGoodsFlag") or {} | |
| 377 | + --local goodsIndex = GetActGoodsIndex("paySignIn") | |
| 378 | + --if goodsIndex == 0 then | |
| 379 | + -- print("get act goods index fail :paySignIn") | |
| 380 | + -- return | |
| 381 | + --end | |
| 382 | + --actGoodsFlag[goodsIndex] = 1 | |
| 383 | + --self:updateProperty({field = "actGoodsFlag", value = actGoodsFlag}) | |
| 384 | + -- 发钱 | |
| 385 | + --local change | |
| 386 | + --local reward, curData = self.owner.activity:getPaySignReward() | |
| 387 | + --if next(reward) then | |
| 388 | + -- self.owner.activity:updateActData("PaySignIn", curData) | |
| 389 | + -- reward, change = self.owner:award(reward, {log = {desc = "actPaySign"}}) | |
| 390 | + --end | |
| 391 | + | |
| 392 | + --self.owner:log("activity", { | |
| 393 | + -- activity_id = 0, -- 活动ID(或活动指定任务的ID) | |
| 394 | + -- activity_type = self.owner.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 | |
| 395 | + -- activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
| 396 | + --}) | |
| 397 | + | |
| 398 | + --SendPacket(actionCodes.Activity_actPaySignRewardNtf, MsgPack.pack(self.owner:packReward(reward, change))) | |
| 385 | 399 | end |
| 386 | 400 | |
| 387 | 401 | function Store:checkPaySignReward() | ... | ... |
src/utils/CommonFunc.lua
| ... | ... | @@ -161,6 +161,18 @@ function diffFromOpen() |
| 161 | 161 | return math.floor((now - openTime) / DAY_SEC) |
| 162 | 162 | end |
| 163 | 163 | |
| 164 | +function diffFromTs(ts) | |
| 165 | + local now = skynet.timex() | |
| 166 | + local tm = os.date("*t", ts) | |
| 167 | + | |
| 168 | + local time = os.time({year = tm.year, month = tm.month, day = tm.day, hour = RESET_TIME}) | |
| 169 | + if now < time then | |
| 170 | + return -1 | |
| 171 | + end | |
| 172 | + | |
| 173 | + return math.floor((now - time) / DAY_SEC) | |
| 174 | +end | |
| 175 | + | |
| 164 | 176 | function getServerOpenTs() |
| 165 | 177 | local openTime = os.time{ |
| 166 | 178 | year = tonum(SERV_OPEN:sub(1,4)), |
| ... | ... | @@ -298,7 +310,7 @@ function notifyClient(params) |
| 298 | 310 | params.key = "zhaolugame20170831" |
| 299 | 311 | |
| 300 | 312 | local status, body = httpc.get(skynet.getenv("codeurl"), |
| 301 | - "/mipush/notify_user?" .. httpGetFormatData(params), {}, {}) | |
| 313 | + "/push/notify_user?" .. httpGetFormatData(params), {}, {}) | |
| 302 | 314 | if tonumber(status) ~= 200 then |
| 303 | 315 | skynet.error(status, body) |
| 304 | 316 | return |
| ... | ... | @@ -313,7 +325,7 @@ function deleteNotify(params) |
| 313 | 325 | params.key = "zhaolugame20170831" |
| 314 | 326 | |
| 315 | 327 | local status, body = httpc.get(skynet.getenv("codeurl"), |
| 316 | - "/mipush/delete_notify?" .. httpGetFormatData(params), {}, {}) | |
| 328 | + "/push/delete_notify?" .. httpGetFormatData(params), {}, {}) | |
| 317 | 329 | if tonumber(status) ~= 200 then |
| 318 | 330 | skynet.error(status, body) |
| 319 | 331 | return | ... | ... |