Commit 072db1272534d7f7e03be650de0266c2f383f4f1
1 parent
84cf48b4
推送
Showing
8 changed files
with
52 additions
and
4 deletions
Show diff stats
src/actions/AdvAction.lua
@@ -250,7 +250,7 @@ function _M.startHangRpc(agent, data) | @@ -250,7 +250,7 @@ function _M.startHangRpc(agent, data) | ||
250 | if not role:getAdvData():isRunning() then | 250 | if not role:getAdvData():isRunning() then |
251 | role:updateProperty({field = "advTeam", value = {}}) | 251 | role:updateProperty({field = "advTeam", value = {}}) |
252 | end | 252 | end |
253 | - | 253 | + role:pushMsg({type = "adv", slot = chapterId, time = adv_idle_time}) |
254 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) | 254 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) |
255 | 255 | ||
256 | role:changeAdvCount(adv_idle_energy) | 256 | role:changeAdvCount(adv_idle_energy) |
@@ -295,6 +295,7 @@ function _M.quickHangRpc(agent, data) | @@ -295,6 +295,7 @@ function _M.quickHangRpc(agent, data) | ||
295 | info.time = 0 | 295 | info.time = 0 |
296 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) | 296 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) |
297 | 297 | ||
298 | + role:pushCancel({type = "adv", slot = chapterId}) | ||
298 | role:mylog("adv_action", {desc = "advQuickHang", int1 = chapterId}) | 299 | role:mylog("adv_action", {desc = "advQuickHang", int1 = chapterId}) |
299 | 300 | ||
300 | SendPacket(actionCodes.Adv_quickHangRpc, '') | 301 | SendPacket(actionCodes.Adv_quickHangRpc, '') |
@@ -371,6 +372,7 @@ function _M.endHangRpc(agent, data) | @@ -371,6 +372,7 @@ function _M.endHangRpc(agent, data) | ||
371 | -- else | 372 | -- else |
372 | -- role:updateProperty({field = "advC", delta = -chapterData.limitlevel}) | 373 | -- role:updateProperty({field = "advC", delta = -chapterData.limitlevel}) |
373 | -- end | 374 | -- end |
375 | + role:pushCancel({type = "adv", slot = chapterId}) | ||
374 | else | 376 | else |
375 | return | 377 | return |
376 | end | 378 | end |
src/actions/DinerAction.lua
@@ -75,6 +75,9 @@ function _M.addSellRpc( agent, data ) | @@ -75,6 +75,9 @@ function _M.addSellRpc( agent, data ) | ||
75 | sells[slot].count = count | 75 | sells[slot].count = count |
76 | sells[slot].time = skynet.timex() - calSell.deltaTime | 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 | local had = {} | 82 | local had = {} |
80 | for _, sell in pairs(sells) do | 83 | for _, sell in pairs(sells) do |
@@ -155,6 +158,7 @@ function _M.removeSellRpc( agent, data ) | @@ -155,6 +158,7 @@ function _M.removeSellRpc( agent, data ) | ||
155 | reward, change = role:award(reward, {log = {desc = "removeSell"}}) | 158 | reward, change = role:award(reward, {log = {desc = "removeSell"}}) |
156 | sells[slot].count = 0 | 159 | sells[slot].count = 0 |
157 | 160 | ||
161 | + role:pushCancel({type = "food", slot = slot}) | ||
158 | role:log("restaurant_sale", { | 162 | role:log("restaurant_sale", { |
159 | item_id = dish, -- 售卖物品ID | 163 | item_id = dish, -- 售卖物品ID |
160 | restaurant_sale_seat = slot, -- 售卖物品所在位置 | 164 | restaurant_sale_seat = slot, -- 售卖物品所在位置 |
src/actions/HangAction.lua
@@ -151,11 +151,14 @@ function _M.startRpc( agent, data ) | @@ -151,11 +151,14 @@ function _M.startRpc( agent, data ) | ||
151 | hangInfo.coinTime = math.min(nowTime, hangInfo.endCoinTime) | 151 | hangInfo.coinTime = math.min(nowTime, hangInfo.endCoinTime) |
152 | hangInfo.itemTime = math.min(nowTime, hangInfo.endItemTime) | 152 | hangInfo.itemTime = math.min(nowTime, hangInfo.endItemTime) |
153 | end | 153 | end |
154 | + | ||
155 | + role:pushMsg({type = "hang", time = math.min(hangInfo.endCoinTime - nowTime, hangInfo.endItemTime - nowTime)}) | ||
154 | if not role:checkHangPass(carbonId) then | 156 | if not role:checkHangPass(carbonId) then |
155 | hangInfo.bossTime = nowTime + carbonData.idle_time | 157 | hangInfo.bossTime = nowTime + carbonData.idle_time |
156 | else | 158 | else |
157 | hangInfo.bossTime = nil | 159 | hangInfo.bossTime = nil |
158 | end | 160 | end |
161 | + | ||
159 | role:updateProperty({field = "hangInfo", value = hangInfo}) | 162 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
160 | 163 | ||
161 | -- 指定当前引导的步骤 | 164 | -- 指定当前引导的步骤 |
@@ -357,6 +360,8 @@ function _M.getRewardRpc(agent , data) | @@ -357,6 +360,8 @@ function _M.getRewardRpc(agent , data) | ||
357 | hangInfo.itemTime = nowTime | 360 | hangInfo.itemTime = nowTime |
358 | role:updateProperty({field = "hangBag", value = items}) | 361 | role:updateProperty({field = "hangBag", value = items}) |
359 | role:updateProperty({field = "hangInfo", value = hangInfo}) | 362 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
363 | + role:pushMsg({type = "hang", time = globalCsv.idle_producetime_max}) | ||
364 | + | ||
360 | role:checkTaskEnter("HangGet", {reward = reward}) | 365 | role:checkTaskEnter("HangGet", {reward = reward}) |
361 | if reward[ItemId.Gold] then | 366 | if reward[ItemId.Gold] then |
362 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) | 367 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) |
src/actions/RoleAction.lua
@@ -121,6 +121,9 @@ function _M.loginRpc( agent, data ) | @@ -121,6 +121,9 @@ function _M.loginRpc( agent, data ) | ||
121 | role:setProperty("device", device) | 121 | role:setProperty("device", device) |
122 | end | 122 | end |
123 | end | 123 | end |
124 | + if msg.token then | ||
125 | + role._pushToken = msg.token | ||
126 | + end | ||
124 | 127 | ||
125 | if not msg.isGMlogin then | 128 | if not msg.isGMlogin then |
126 | local banTime = role:getProperty("banTime") | 129 | local banTime = role:getProperty("banTime") |
@@ -550,7 +553,7 @@ function _M.openTimeBoxRpc(agent, data) | @@ -550,7 +553,7 @@ function _M.openTimeBoxRpc(agent, data) | ||
550 | if boxL[slot] then return end | 553 | if boxL[slot] then return end |
551 | role:costItems({[itemId] = 1}, {log = {desc = "openTimeBox"}}) | 554 | role:costItems({[itemId] = 1}, {log = {desc = "openTimeBox"}}) |
552 | boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime} | 555 | boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime} |
553 | - | 556 | + role:pushMsg({type = "box", slot = slot, time = randomData.openTime}) |
554 | elseif oper == 2 then -- 领取 | 557 | elseif oper == 2 then -- 领取 |
555 | local quick = msg.quick | 558 | local quick = msg.quick |
556 | if not boxL[slot] then return end | 559 | if not boxL[slot] then return end |
@@ -561,6 +564,7 @@ function _M.openTimeBoxRpc(agent, data) | @@ -561,6 +564,7 @@ function _M.openTimeBoxRpc(agent, data) | ||
561 | costKey = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2] | 564 | costKey = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2] |
562 | if not role:checkItemEnough({[ItemId.BoxKey] = costKey}) then return end | 565 | if not role:checkItemEnough({[ItemId.BoxKey] = costKey}) then return end |
563 | role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}}) | 566 | role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}}) |
567 | + role:pushCancel({type = "box", slot = slot}) | ||
564 | end | 568 | end |
565 | local boxId = boxL[slot].id | 569 | local boxId = boxL[slot].id |
566 | local itemData = csvdb["itemCsv"][boxId] | 570 | local itemData = csvdb["itemCsv"][boxId] |
src/models/Diner.lua
@@ -298,6 +298,9 @@ function Diner:expediteSell(slot) | @@ -298,6 +298,9 @@ function Diner:expediteSell(slot) | ||
298 | self:checkDinerTask(DinerTask.SellDishType, expediteCount, math.ceil(sell.dish / 100)) | 298 | self:checkDinerTask(DinerTask.SellDishType, expediteCount, math.ceil(sell.dish / 100)) |
299 | self:checkDinerTask(DinerTask.SellDishRare, expediteCount, dishData.rarity) | 299 | self:checkDinerTask(DinerTask.SellDishRare, expediteCount, dishData.rarity) |
300 | self.owner:checkTaskEnter("FoodSell", {count = expediteCount}) | 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 | end | 304 | end |
302 | return { | 305 | return { |
303 | expediteCount = expediteCount, | 306 | expediteCount = expediteCount, |
src/models/Role.lua
@@ -27,6 +27,7 @@ function Role:ctor( properties ) | @@ -27,6 +27,7 @@ function Role:ctor( properties ) | ||
27 | self.runeBag = {} | 27 | self.runeBag = {} |
28 | self.advData = nil | 28 | self.advData = nil |
29 | self.activity = nil | 29 | self.activity = nil |
30 | + self._pushToken = nil | ||
30 | self.advElChapter = tonum(redisproxy:hget("adv_season", "chapter"), globalCsv.adv_endless_default_chapter) -- 无尽模式记录的赛季对应章节 | 31 | self.advElChapter = tonum(redisproxy:hget("adv_season", "chapter"), globalCsv.adv_endless_default_chapter) -- 无尽模式记录的赛季对应章节 |
31 | self.advOverTime = tonum(redisproxy:hget("adv_season", "overTime")) -- 无尽模式关闭时间戳 | 32 | self.advOverTime = tonum(redisproxy:hget("adv_season", "overTime")) -- 无尽模式关闭时间戳 |
32 | if self.advOverTime == 0 then | 33 | if self.advOverTime == 0 then |
src/models/RolePlugin.lua
@@ -1743,7 +1743,36 @@ function RolePlugin.bind(Role) | @@ -1743,7 +1743,36 @@ function RolePlugin.bind(Role) | ||
1743 | end) | 1743 | end) |
1744 | return gift, checkPoint | 1744 | return gift, checkPoint |
1745 | end | 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 | ||
1746 | 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 | ||
1747 | end | 1776 | end |
1748 | 1777 | ||
1749 | return RolePlugin | 1778 | return RolePlugin |
1750 | \ No newline at end of file | 1779 | \ No newline at end of file |
src/utils/CommonFunc.lua
@@ -298,7 +298,7 @@ function notifyClient(params) | @@ -298,7 +298,7 @@ function notifyClient(params) | ||
298 | params.key = "zhaolugame20170831" | 298 | params.key = "zhaolugame20170831" |
299 | 299 | ||
300 | local status, body = httpc.get(skynet.getenv("codeurl"), | 300 | local status, body = httpc.get(skynet.getenv("codeurl"), |
301 | - "/mipush/notify_user?" .. httpGetFormatData(params), {}, {}) | 301 | + "/push/notify_user?" .. httpGetFormatData(params), {}, {}) |
302 | if tonumber(status) ~= 200 then | 302 | if tonumber(status) ~= 200 then |
303 | skynet.error(status, body) | 303 | skynet.error(status, body) |
304 | return | 304 | return |
@@ -313,7 +313,7 @@ function deleteNotify(params) | @@ -313,7 +313,7 @@ function deleteNotify(params) | ||
313 | params.key = "zhaolugame20170831" | 313 | params.key = "zhaolugame20170831" |
314 | 314 | ||
315 | local status, body = httpc.get(skynet.getenv("codeurl"), | 315 | local status, body = httpc.get(skynet.getenv("codeurl"), |
316 | - "/mipush/delete_notify?" .. httpGetFormatData(params), {}, {}) | 316 | + "/push/delete_notify?" .. httpGetFormatData(params), {}, {}) |
317 | if tonumber(status) ~= 200 then | 317 | if tonumber(status) ~= 200 then |
318 | skynet.error(status, body) | 318 | skynet.error(status, body) |
319 | return | 319 | return |
-
mentioned in commit 52f8c5f05d0a531232a7dd7887becd2a77986aa1
-
mentioned in commit ba6d85edc65900830c7e168102d70671881b5808
-
mentioned in commit ba6d85edc65900830c7e168102d70671881b5808