From 71f716c4924afe0dde7f04d1d40fa9b5857f8175 Mon Sep 17 00:00:00 2001 From: chenyueqi <1056825054@qq.com> Date: Mon, 24 Feb 2020 17:21:46 +0800 Subject: [PATCH] 引导用到的字段 --- src/ProtocolCode.lua | 1 + src/actions/RoleAction.lua | 32 ++++++++++++++++++++++++++++++++ src/models/Role.lua | 7 +++++++ 3 files changed, 40 insertions(+), 0 deletions(-) diff --git a/src/ProtocolCode.lua b/src/ProtocolCode.lua index 4386ba0..9c56494 100644 --- a/src/ProtocolCode.lua +++ b/src/ProtocolCode.lua @@ -41,6 +41,7 @@ actionCodes = { Role_drawCodeRpc = 126, Role_changeHeadRpc = 127, Role_openSpeedUpBoxRpc = 128, + Role_guideRpc = 129, Adv_startAdvRpc = 151, Adv_startHangRpc = 152, diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index dac2418..b9a2efb 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -921,5 +921,37 @@ function _M.changeHeadRpc(agent, data) return true end +function _M.guideRpc(agent, data) + local role = agent.role + local msg = MsgPack.unpack(data) + + local cmdType = msg.cmdType + + local funcGuide = role:getProperty("funcGuide") + local newerGuide = role:getProperty("newerGuide") + if cmd == 1 then + -- 新手引导 + role:updateProperty({field = "newerGuide", value = newerGuide}) + elseif cmdType == 2 then + -- 系统引导 + if not msg.skip then return end + local new = math.min(funcGuide:getv(0, 0), msg.skip) + if new < 0 then + funcGuide = funcGuide:setv(0, new) + else + funcGuide = funcGuide:setv(0, funcGuide:getv(0, 0) + msg.skip) + end + + if msg.funcType then + funcGuide = funcGuide:setv(msg.funcType, 1) + end + role:updateProperty({field = "funcGuide", value = funcGuide}) + else + return + end + + SendPacket(actionCodes.Role_guideRpc, "") + return true +end return _M \ No newline at end of file diff --git a/src/models/Role.lua b/src/models/Role.lua index b9dbdff..8ff7168 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -85,6 +85,10 @@ Role.schema = { hangBagLimit = {"number", globalCsv.idle_field_origin}, --背包上限 bTeam = {"table", {}}, -- 奖励副本队伍 + --引导相关 + newerGuide = {"string","1=1"}, -- 新手引导 master=slave + funcGuide = {"string",""}, -- 功能引导 0=0跳过次数(999永久跳过) 1=1功能1触发情况 + pvpTC = {"table", {}}, -- pvp 编队普通 pvpTSC = {"table", {}}, -- pvp 他人可读的队伍信息 pvpTBC = {"table", {}}, -- pvp 他人可用的战斗信息 @@ -263,6 +267,9 @@ function Role:data() hangBagLimit = self:getProperty("hangBagLimit"), bTeam = self:getProperty("bTeam"), + newerGuide = self:getProperty("newerGuide"), + funcGuide = self:getProperty("funcGuide"), + pvpTC = self:getProperty("pvpTC"), pvpTH = self:getProperty("pvpTH"), -- libgit2 0.21.2