diff --git a/src/ProtocolCode.lua b/src/ProtocolCode.lua index 2479ac4..836d293 100644 --- a/src/ProtocolCode.lua +++ b/src/ProtocolCode.lua @@ -1,6 +1,7 @@ -- 协议号 actionCodes = { Sys_heartBeat = 1, + Sys_endlessSeason = 2, Sys_errorMsg = 3, Sys_innerErrorMsg = 4, Sys_commonNotice = 5, diff --git a/src/actions/HttpAction.lua b/src/actions/HttpAction.lua index 5f6ce30..5bb9bcf 100644 --- a/src/actions/HttpAction.lua +++ b/src/actions/HttpAction.lua @@ -197,6 +197,11 @@ function _M.broadcast(query) return "广播成功" end +function _M.endless_season_check() + mcast_util.pub_world(actionCodes.Sys_endlessSeason, "") + return "success" +end + function _M.online(query) local count = datacenter.get("onlineCount") or 0 return count diff --git a/src/adv/AdvPlayer.lua b/src/adv/AdvPlayer.lua index dcd90d5..ab6280f 100644 --- a/src/adv/AdvPlayer.lua +++ b/src/adv/AdvPlayer.lua @@ -414,7 +414,9 @@ function BaseObject:recover(value, releaser, params) params = params or {} value = math.max(0, math.ceil(value)) self.hp = math.min(self.hpMax, self.hp + value) - self.battle.adv:pushBackEvent(AdvBackEventType.HpChange, {change = value}) + if self:is("Player") then + self.battle.adv:pushBackEvent(AdvBackEventType.HpChange, {change = value}) + end end function BaseObject:addSpecialSkill(skillId, skillLevel, target) diff --git a/src/agent.lua b/src/agent.lua index 367e928..40aed0c 100644 --- a/src/agent.lua +++ b/src/agent.lua @@ -51,6 +51,15 @@ end local _pipelinings = {} --可同时多个序列 栈的形式保证嵌套不出错 function SendPacket(actionCode, bin, client_fd) + -- 内部消息不扩散出去 + if actionCode == actionCodes.Sys_endlessSeason then + if agentInfo.role then + agentInfo.role:advEndlessSeasonCheck() + end + return + end + + client_fd = client_fd or agentInfo.client_fd local handlerName = actionHandlers[actionCode] -- libgit2 0.21.2