From cb85faacf4828217e09a5693935bf1de73fec9b2 Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Mon, 29 Jul 2019 15:26:21 +0800 Subject: [PATCH] 增加gm命令 --- src/actions/GmAction.lua | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+), 0 deletions(-) diff --git a/src/actions/GmAction.lua b/src/actions/GmAction.lua index 10b61a9..ed5ea78 100644 --- a/src/actions/GmAction.lua +++ b/src/actions/GmAction.lua @@ -39,6 +39,55 @@ function _M.rune(role, pms) return result end +function _M.fb(role, pms) -- 直接通关 + local carbonId = tonum(pms.pm1) + if not csvdb["idle_battleCsv"][carbonId] then return "不存在的carbon" end + local passCarbon = role:getProperty("hangPass") + local addPre + addPre = function(carbonId) + local carbonData = csvdb["idle_battleCsv"][carbonId] + for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do + passCarbon[pre] = 1 + role:checkTaskEnter(role.TaskType.HangPass, {id = pre}) + addPre(pre) + end + end + passCarbon[carbonId] = 1 + addPre(carbonId) + role:updateProperty({field = "hangPass", value = passCarbon}) + role:checkTaskEnter(role.TaskType.HangPass, {id = carbonId}) + return "成功" +end + +function _M.love(role, pms) + local heroType = tonum(pms.pm1) + local level = tonum(pms.pm2) + local exp = tonum(pms.pm3) + local curPlus = csvdb["unit_love_plusCsv"][heroType] + if not curPlus then return "参数错误" end + level = math.max(math.min(curPlus.limit, level), 0) + local curEffect = csvdb["unit_love_effectCsv"][level] + exp = math.max(math.min(curEffect.loveValue, exp) , 0) + for _, hero in pairs(role.heros) do + if hero:getProperty("type") == heroType then + hero:updateProperty({field = "loveL", value = level}) + hero:updateProperty({field = "loveExp", value = exp}) + if role:getProperty("loveStatus"):getv(heroType, 0) < level then + role:changeUpdates({{type = "loveStatus", field = heroType, value = level}}) -- 总的 + end + role:checkTaskEnter(role.TaskType.LoveBreak, {heroType = heroType, loveL = level}) + end + end + return "成功" +end + +function _M.exp(role, pms) + local exp = tonum(pms.pm1) + exp = math.floor(math.max(exp, 0)) + role:addPlayExp(exp) + return "成功" +end + function _M.get(role, pms) if pms.pm1 == "ALL" then for itemId = 1, 100 do @@ -70,6 +119,12 @@ function _M.get(role, pms) role:award({[itemId] = 100}) end end + elseif pms.pm1 == "HERO" then + for itemId = 400 , 700 do + if csvdb["itemCsv"][itemId] then + role:award({[itemId] = 1}) + end + end else local itemId = tonum(pms.pm1) if not csvdb["itemCsv"][itemId] then -- libgit2 0.21.2