From 300ee7a14590ccee7d9a32428ec551680868a0fe Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Thu, 2 Apr 2020 11:50:31 +0800 Subject: [PATCH] 一键升级 --- src/actions/GmAction.lua | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 83 insertions(+), 8 deletions(-) diff --git a/src/actions/GmAction.lua b/src/actions/GmAction.lua index 5331523..fcf3dac 100644 --- a/src/actions/GmAction.lua +++ b/src/actions/GmAction.lua @@ -19,6 +19,65 @@ function _M.testhotfix(role, pms) return csvdb["itemCsv"][1]["name"] .. " -=- " .. csvdb["itemCsv"][2]["name"] .. " -=- " .. role:getItemCount(123) .. " -=- " .. table.pack(next(role.heros))[2]:getBattleValue() end +function _M.ignoreout(role, params) + params = params or {} + local status = tonum(params.pm1, 1) + if status == 1 then -- 忽视 + role:updateProperty({field = "ignoreMt", value = 1}) + else -- 解除 + role:updateProperty({field = "ignoreMt", value = 0}) + end + return "指令生效" +end + +function _M.ban(role, pms) + local now = skynet.timex() + local time = tonum(pms.pm1, 1) + local ctype = tonum(pms.pm2, 0) + + local isBan = role:getProperty("banTime") <= now + role:setBan(time, ctype) + if time > 0 then + role:sendGmMsg("server_accountBanned_1") + local agent = datacenter.get("agent", role:getProperty("id")) + if agent then + skynet.timeout(50, function () + skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) + end) + end + end + return isBan and "解封杀成功" or "封杀成功" +end + +function _M.unban(role, pms) + role:setBan(0, 0) + return "解封杀成功" +end + +function _M.gmmsg(role, pms) + role:sendGmMsg(pms.pm1, true) + + local agent = datacenter.get("agent", role:getProperty("id")) + if agent then + skynet.timeout(50, function () + skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd) + end) + end + + return "指令成功" +end + +function _M.silent(role, pms) + local pm1 = tonum(pms.pm1) + if pm1 < 1 then + role:updateProperty({field = "silent", value = 0}) + return "解禁言成功" + end + role:updateProperty({field = "silent", value = specTime({hour = 0}, skynet.timex()) + pm1 * 86400}) + return "禁言成功" +end + + local helpDes = {{"描述", "指令", "参数1", "参数2" ,"参数3"}} table.insert(helpDes, {"获得角色" , "hero", "角色类型"}) @@ -34,11 +93,17 @@ table.insert(helpDes, {"角色升级" , "herol", "角色类型", "增加等级"} function _M.herol(role, pms) local heroType = tonum(pms.pm1) local addLevel = tonum(pms.pm2) - local hero = role.heros[heroType] - if not hero or (hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] and hero:getProperty("level") >= hero:getMaxLevel()) then - return "失败" + local hero = role:isHaveHero(heroType) + + local MaxLv = 200 + + if not hero then + return "不存在的英雄类型" + end + if hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] and hero:getProperty("level") >= MaxLv then + return "等级已满" end - local nextLevel = math.min(addLevel + hero:getProperty("level"), 200) + local nextLevel = math.min(addLevel + hero:getProperty("level"), MaxLv) for i = 0, 10 do local upLimit = csvdb["unit_breakCsv"][i].levelLimit local lowLimit = csvdb["unit_breakCsv"][i - 1] and csvdb["unit_breakCsv"][i - 1].levelLimit or 0 @@ -55,6 +120,17 @@ function _M.herol(role, pms) return "成功" end + +table.insert(helpDes, {"全部角色升级" , "herola", "增加等级"}) +function _M.herola(role, pms) + local addLevel = tonum(pms.pm1) + for _, hero in pairs(role.heros) do + _M.herol(role, {pm1 = hero:getProperty("type"), pm2 = addLevel}) + end + return "成功" +end + + table.insert(helpDes, {"获得装备" , "equip", "装备类型" , "装备等级", "装备个数"}) function _M.equip(role, pms) local typ = tonum(pms.pm1) @@ -282,11 +358,10 @@ function _M.advt(role, pms) return "成功" end -table.insert(helpDes, {"冒险队等级增加", "advl", "通关次数"}) +table.insert(helpDes, {"冒险队等级增加", "advl", "经验"}) function _M.advl(role, pms) - local winCount = tonum(pms.pm1) - winCount = math.max(0, winCount) - role:checkAdvLvByAddWin(winCount) + local exp = tonum(pms.pm1) + role:addAdvLvExp(math.max(0, exp)) return "成功" end -- libgit2 0.21.2