diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index 4eac1f3..5308b88 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -250,7 +250,7 @@ function _M.startHangRpc(agent, data) if not role:getAdvData():isRunning() then role:updateProperty({field = "advTeam", value = {}}) end - + role:pushMsg({type = "adv", slot = chapterId, time = adv_idle_time}) role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) role:changeAdvCount(adv_idle_energy) @@ -295,6 +295,7 @@ function _M.quickHangRpc(agent, data) info.time = 0 role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) + role:pushCancel({type = "adv", slot = chapterId}) role:mylog("adv_action", {desc = "advQuickHang", int1 = chapterId}) SendPacket(actionCodes.Adv_quickHangRpc, '') @@ -371,6 +372,7 @@ function _M.endHangRpc(agent, data) -- else -- role:updateProperty({field = "advC", delta = -chapterData.limitlevel}) -- end + role:pushCancel({type = "adv", slot = chapterId}) else return end diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index 646298d..f10bf53 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -75,6 +75,9 @@ function _M.addSellRpc( agent, data ) sells[slot].count = count sells[slot].time = skynet.timex() - calSell.deltaTime + local needTime = sells[slot].count * dishData.sell_time + sells[slot].time - skynet.timex() + role:pushMsg({type = "food", slot = slot, time = needTime}) + -- 检查解锁的顾客 local had = {} for _, sell in pairs(sells) do @@ -155,6 +158,7 @@ function _M.removeSellRpc( agent, data ) reward, change = role:award(reward, {log = {desc = "removeSell"}}) sells[slot].count = 0 + role:pushCancel({type = "food", slot = slot}) role:log("restaurant_sale", { item_id = dish, -- 售卖物品ID restaurant_sale_seat = slot, -- 售卖物品所在位置 diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index fd6a226..4351089 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -151,11 +151,14 @@ function _M.startRpc( agent, data ) hangInfo.coinTime = math.min(nowTime, hangInfo.endCoinTime) hangInfo.itemTime = math.min(nowTime, hangInfo.endItemTime) end + + role:pushMsg({type = "hang", time = math.min(hangInfo.endCoinTime - nowTime, hangInfo.endItemTime - nowTime)}) if not role:checkHangPass(carbonId) then hangInfo.bossTime = nowTime + carbonData.idle_time else hangInfo.bossTime = nil end + role:updateProperty({field = "hangInfo", value = hangInfo}) -- 指定当前引导的步骤 @@ -357,6 +360,8 @@ function _M.getRewardRpc(agent , data) hangInfo.itemTime = nowTime role:updateProperty({field = "hangBag", value = items}) role:updateProperty({field = "hangInfo", value = hangInfo}) + role:pushMsg({type = "hang", time = globalCsv.idle_producetime_max}) + role:checkTaskEnter("HangGet", {reward = reward}) if reward[ItemId.Gold] then role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 4ecee7e..c6d011c 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -121,6 +121,9 @@ function _M.loginRpc( agent, data ) role:setProperty("device", device) end end + if msg.token then + role._pushToken = msg.token + end if not msg.isGMlogin then local banTime = role:getProperty("banTime") @@ -550,7 +553,7 @@ function _M.openTimeBoxRpc(agent, data) if boxL[slot] then return end role:costItems({[itemId] = 1}, {log = {desc = "openTimeBox"}}) boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime} - + role:pushMsg({type = "box", slot = slot, time = randomData.openTime}) elseif oper == 2 then -- 领取 local quick = msg.quick if not boxL[slot] then return end @@ -561,6 +564,7 @@ function _M.openTimeBoxRpc(agent, data) costKey = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2] if not role:checkItemEnough({[ItemId.BoxKey] = costKey}) then return end role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}}) + role:pushCancel({type = "box", slot = slot}) end local boxId = boxL[slot].id local itemData = csvdb["itemCsv"][boxId] diff --git a/src/models/Diner.lua b/src/models/Diner.lua index 57cb7b1..9e744e5 100644 --- a/src/models/Diner.lua +++ b/src/models/Diner.lua @@ -298,6 +298,9 @@ function Diner:expediteSell(slot) self:checkDinerTask(DinerTask.SellDishType, expediteCount, math.ceil(sell.dish / 100)) self:checkDinerTask(DinerTask.SellDishRare, expediteCount, dishData.rarity) self.owner:checkTaskEnter("FoodSell", {count = expediteCount}) + + local needTime = sells[slot].count * dishData.sell_time + sells[slot].time - skynet.timex() + self.owner:pushMsg({type = "food", slot = slot, time = needTime}) end return { expediteCount = expediteCount, diff --git a/src/models/Role.lua b/src/models/Role.lua index 6aa67d7..5354052 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -27,6 +27,7 @@ function Role:ctor( properties ) self.runeBag = {} self.advData = nil self.activity = nil + self._pushToken = nil self.advElChapter = tonum(redisproxy:hget("adv_season", "chapter"), globalCsv.adv_endless_default_chapter) -- 无尽模式记录的赛季对应章节 self.advOverTime = tonum(redisproxy:hget("adv_season", "overTime")) -- 无尽模式关闭时间戳 if self.advOverTime == 0 then diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index ce89bd0..accd842 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -1743,7 +1743,36 @@ function RolePlugin.bind(Role) end) return gift, checkPoint end + --[[ + "hang" : "挂机资源满", + "box" : "箱子拆解完毕", + "food" : "食物出售完毕", + "adv" : "代理拾荒完毕", + --]] + function Role:pushMsg(params) + if not self._pushToken or self._pushToken == "" then return end + if params.time <= 0 then + self:pushCancel(params) + return + end + local content = string.format("push:%d:%s:%s:%s", self:getProperty("id"), params.type, params.slot or 1, self._pushToken) + notifyClient({content = content, time = math.floor(params.time)}) + end + function Role:pushCancel(params) + if not self._pushToken or self._pushToken == "" then return end + local content = string.format("push:%d:%s:%s:%s", self:getProperty("id"), params.type, params.slot or 1, self._pushToken) + deleteNotify({content = content}) + end + + function Role:pushCancelAll(ptype) + if not self._pushToken or self._pushToken == "" then return end + local pattern = string.format("push:%d:*", self:getProperty("id")) + if ptype then + pattern = string.format("push:%d:%s:*", self:getProperty("id"), ptype) + end + deleteNotify({pattern = pattern}) + end end return RolePlugin \ No newline at end of file diff --git a/src/utils/CommonFunc.lua b/src/utils/CommonFunc.lua index b7e2798..a769389 100644 --- a/src/utils/CommonFunc.lua +++ b/src/utils/CommonFunc.lua @@ -298,7 +298,7 @@ function notifyClient(params) params.key = "zhaolugame20170831" local status, body = httpc.get(skynet.getenv("codeurl"), - "/mipush/notify_user?" .. httpGetFormatData(params), {}, {}) + "/push/notify_user?" .. httpGetFormatData(params), {}, {}) if tonumber(status) ~= 200 then skynet.error(status, body) return @@ -313,7 +313,7 @@ function deleteNotify(params) params.key = "zhaolugame20170831" local status, body = httpc.get(skynet.getenv("codeurl"), - "/mipush/delete_notify?" .. httpGetFormatData(params), {}, {}) + "/push/delete_notify?" .. httpGetFormatData(params), {}, {}) if tonumber(status) ~= 200 then skynet.error(status, body) return -- libgit2 0.21.2