diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index e6a14fc..cdd14d1 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -116,14 +116,14 @@ function _M.loginRpc( agent, data ) end if msg.deviceMode then local deviceMode = tostring(msg.deviceMode) - if self:getProperty("dmode") ~= deviceMode then - self:setProperty("dmode", deviceMode) + if role:getProperty("dmode") ~= deviceMode then + role:setProperty("dmode", deviceMode) end end if msg.device then local device = tostring(msg.device) - if self:getProperty("device") ~= device then - self:setProperty("device", device) + if role:getProperty("device") ~= device then + role:setProperty("device", device) end end @@ -299,7 +299,7 @@ function _M.createRpc(agent, data) sid = msg.subId or 0, name = roleName, uname = msg.uname or "", - device = tostring(msg.device) + device = tostring(msg.device), dmode = msg.deviceMode and tostring(msg.deviceMode) or nil }) @@ -1002,17 +1002,17 @@ function _M.guideRpc(agent, data) local cmdType = msg.cmdType local funcGuide = role:getProperty("funcGuide") - local newerGuide = role:getProperty("newerGuide") if cmdType == 1 then -- 新手引导 local master = msg.master or -1 local slave = msg.slave or -1 if master < 0 or slave < 0 then return end - newerGuide = string.format("%d=%d",master,slave) - role:updateProperty({field = "newerGuide", value = newerGuide}) - role:log("guide", {desc = "guide_new",int1 = master*1000+slave}) + + role:saveGuide(master, slave) + funcGuide = funcGuide:setv(master * 1000 + slave, 1) + role:updateProperty({field = "funcGuide", value = funcGuide}) 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 @@ -1023,15 +1023,23 @@ function _M.guideRpc(agent, data) if msg.funcType then funcGuide = funcGuide:setv(msg.funcType, 1) - role:log("guide", {desc = "guide_sys", int1 = msg.funcType}) + role:log("guide", {desc = "guide_weak", int1 = msg.funcType}) end role:updateProperty({field = "funcGuide", value = funcGuide}) elseif cmdType == 3 then - -- 弱引导 + -- 系统引导(强制进行) + if msg.funcType and csvdb["guide_unlockCsv"][msg.funcType] then + role:saveGuide(csvdb["guide_unlockCsv"][msg.funcType].guideId,1) + funcGuide = funcGuide:setv(msg.funcType, 1) + role:updateProperty({field = "funcGuide", value = funcGuide}) + role:log("guide", {desc = "guide_sys", int1 = funcIdx}) + end + elseif cmdType == 4 then + -- 弹出一个tips(进入功能界面也许要自动弹说明,value要区分1、2) if msg.funcType then local value = msg.value or 1 for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do - role:log("guide", {desc = "guide_weak", int1 = funcIdx}) + role:log("guide", {desc = "guide_tips", int1 = funcIdx}) funcGuide = funcGuide:setv(funcIdx, value) end role:updateProperty({field = "funcGuide", value = funcGuide}) diff --git a/src/models/Role.lua b/src/models/Role.lua index 2180ee9..5e05863 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -39,7 +39,7 @@ Role.schema = { sid = {"number", 0}, device = {"string", ""}, dmode = {"string", ""}, - lday = {"string", 0}, + lday = {"number", 0}, banTime = {"number", 0}, banType = {"number", 0}, heartWarning = {"number", 0}, diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index c3da8ab..8516034 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -1601,6 +1601,36 @@ function RolePlugin.bind(Role) self.sendMailFlag = true end + -- 保存引导步骤 + function Role:saveGuide(master,slave) + local newerGuide = self:getProperty("newerGuide") + local guide = newerGuide:toArray(true,"=") + local sMaster, sSlave = guide[1], guide[2] + + if master < sMaster and slave < sSlave then return end + + local guideCsv = csvdb["guide_mainCsv"] + if not guideCsv[master] or not guideCsv[master][slave] then return end + self:log("guide", {desc = "guide_new",int1 = master*1000+slave}) + + newerGuide = string.format("%d=%d",master,slave) + self:updateProperty({field = "newerGuide", value = newerGuide}) + end + + -- 引导大步骤结束 + function Role:finishGuide(master) + local newerGuide = self:getProperty("newerGuide") + local guide = newerGuide:toArray(true,"=") + if guide[1] > master then return end + + local guideCsv = csvdb["guide_mainCsv"] + local lastStep = guideCsv[master][#guideCsv[master]] + if guideCsv[master + 1] then + self:updateProperty({field = "newerGuide", value = string.format("%d=%d",master + 1,1)}) + else + self:updateProperty({field = "newerGuide", value = "9999=1"}) + end + end end return RolePlugin \ No newline at end of file -- libgit2 0.21.2