Commit cb85faacf4828217e09a5693935bf1de73fec9b2
1 parent
3c89adfb
增加gm命令
Showing
1 changed file
with
55 additions
and
0 deletions
Show diff stats
src/actions/GmAction.lua
| @@ -39,6 +39,55 @@ function _M.rune(role, pms) | @@ -39,6 +39,55 @@ function _M.rune(role, pms) | ||
| 39 | return result | 39 | return result |
| 40 | end | 40 | end |
| 41 | 41 | ||
| 42 | +function _M.fb(role, pms) -- 直接通关 | ||
| 43 | + local carbonId = tonum(pms.pm1) | ||
| 44 | + if not csvdb["idle_battleCsv"][carbonId] then return "不存在的carbon" end | ||
| 45 | + local passCarbon = role:getProperty("hangPass") | ||
| 46 | + local addPre | ||
| 47 | + addPre = function(carbonId) | ||
| 48 | + local carbonData = csvdb["idle_battleCsv"][carbonId] | ||
| 49 | + for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do | ||
| 50 | + passCarbon[pre] = 1 | ||
| 51 | + role:checkTaskEnter(role.TaskType.HangPass, {id = pre}) | ||
| 52 | + addPre(pre) | ||
| 53 | + end | ||
| 54 | + end | ||
| 55 | + passCarbon[carbonId] = 1 | ||
| 56 | + addPre(carbonId) | ||
| 57 | + role:updateProperty({field = "hangPass", value = passCarbon}) | ||
| 58 | + role:checkTaskEnter(role.TaskType.HangPass, {id = carbonId}) | ||
| 59 | + return "成功" | ||
| 60 | +end | ||
| 61 | + | ||
| 62 | +function _M.love(role, pms) | ||
| 63 | + local heroType = tonum(pms.pm1) | ||
| 64 | + local level = tonum(pms.pm2) | ||
| 65 | + local exp = tonum(pms.pm3) | ||
| 66 | + local curPlus = csvdb["unit_love_plusCsv"][heroType] | ||
| 67 | + if not curPlus then return "参数错误" end | ||
| 68 | + level = math.max(math.min(curPlus.limit, level), 0) | ||
| 69 | + local curEffect = csvdb["unit_love_effectCsv"][level] | ||
| 70 | + exp = math.max(math.min(curEffect.loveValue, exp) , 0) | ||
| 71 | + for _, hero in pairs(role.heros) do | ||
| 72 | + if hero:getProperty("type") == heroType then | ||
| 73 | + hero:updateProperty({field = "loveL", value = level}) | ||
| 74 | + hero:updateProperty({field = "loveExp", value = exp}) | ||
| 75 | + if role:getProperty("loveStatus"):getv(heroType, 0) < level then | ||
| 76 | + role:changeUpdates({{type = "loveStatus", field = heroType, value = level}}) -- 总的 | ||
| 77 | + end | ||
| 78 | + role:checkTaskEnter(role.TaskType.LoveBreak, {heroType = heroType, loveL = level}) | ||
| 79 | + end | ||
| 80 | + end | ||
| 81 | + return "成功" | ||
| 82 | +end | ||
| 83 | + | ||
| 84 | +function _M.exp(role, pms) | ||
| 85 | + local exp = tonum(pms.pm1) | ||
| 86 | + exp = math.floor(math.max(exp, 0)) | ||
| 87 | + role:addPlayExp(exp) | ||
| 88 | + return "成功" | ||
| 89 | +end | ||
| 90 | + | ||
| 42 | function _M.get(role, pms) | 91 | function _M.get(role, pms) |
| 43 | if pms.pm1 == "ALL" then | 92 | if pms.pm1 == "ALL" then |
| 44 | for itemId = 1, 100 do | 93 | for itemId = 1, 100 do |
| @@ -70,6 +119,12 @@ function _M.get(role, pms) | @@ -70,6 +119,12 @@ function _M.get(role, pms) | ||
| 70 | role:award({[itemId] = 100}) | 119 | role:award({[itemId] = 100}) |
| 71 | end | 120 | end |
| 72 | end | 121 | end |
| 122 | + elseif pms.pm1 == "HERO" then | ||
| 123 | + for itemId = 400 , 700 do | ||
| 124 | + if csvdb["itemCsv"][itemId] then | ||
| 125 | + role:award({[itemId] = 1}) | ||
| 126 | + end | ||
| 127 | + end | ||
| 73 | else | 128 | else |
| 74 | local itemId = tonum(pms.pm1) | 129 | local itemId = tonum(pms.pm1) |
| 75 | if not csvdb["itemCsv"][itemId] then | 130 | if not csvdb["itemCsv"][itemId] then |