Commit 300ee7a14590ccee7d9a32428ec551680868a0fe

Authored by zhouhaihai
1 parent b58b5b49

一键升级

Showing 1 changed file with 83 additions and 8 deletions   Show diff stats
src/actions/GmAction.lua
... ... @@ -19,6 +19,65 @@ function _M.testhotfix(role, pms)
19 19 return csvdb["itemCsv"][1]["name"] .. " -=- " .. csvdb["itemCsv"][2]["name"] .. " -=- " .. role:getItemCount(123) .. " -=- " .. table.pack(next(role.heros))[2]:getBattleValue()
20 20 end
21 21  
  22 +function _M.ignoreout(role, params)
  23 + params = params or {}
  24 + local status = tonum(params.pm1, 1)
  25 + if status == 1 then -- 忽视
  26 + role:updateProperty({field = "ignoreMt", value = 1})
  27 + else -- 解除
  28 + role:updateProperty({field = "ignoreMt", value = 0})
  29 + end
  30 + return "指令生效"
  31 +end
  32 +
  33 +function _M.ban(role, pms)
  34 + local now = skynet.timex()
  35 + local time = tonum(pms.pm1, 1)
  36 + local ctype = tonum(pms.pm2, 0)
  37 +
  38 + local isBan = role:getProperty("banTime") <= now
  39 + role:setBan(time, ctype)
  40 + if time > 0 then
  41 + role:sendGmMsg("server_accountBanned_1")
  42 + local agent = datacenter.get("agent", role:getProperty("id"))
  43 + if agent then
  44 + skynet.timeout(50, function ()
  45 + skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd)
  46 + end)
  47 + end
  48 + end
  49 + return isBan and "解封杀成功" or "封杀成功"
  50 +end
  51 +
  52 +function _M.unban(role, pms)
  53 + role:setBan(0, 0)
  54 + return "解封杀成功"
  55 +end
  56 +
  57 +function _M.gmmsg(role, pms)
  58 + role:sendGmMsg(pms.pm1, true)
  59 +
  60 + local agent = datacenter.get("agent", role:getProperty("id"))
  61 + if agent then
  62 + skynet.timeout(50, function ()
  63 + skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd)
  64 + end)
  65 + end
  66 +
  67 + return "指令成功"
  68 +end
  69 +
  70 +function _M.silent(role, pms)
  71 + local pm1 = tonum(pms.pm1)
  72 + if pm1 < 1 then
  73 + role:updateProperty({field = "silent", value = 0})
  74 + return "解禁言成功"
  75 + end
  76 + role:updateProperty({field = "silent", value = specTime({hour = 0}, skynet.timex()) + pm1 * 86400})
  77 + return "禁言成功"
  78 +end
  79 +
  80 +
22 81 local helpDes = {{"描述", "指令", "参数1", "参数2" ,"参数3"}}
23 82  
24 83 table.insert(helpDes, {"获得角色" , "hero", "角色类型"})
... ... @@ -34,11 +93,17 @@ table.insert(helpDes, {&quot;角色升级&quot; , &quot;herol&quot;, &quot;角色类型&quot;, &quot;增加等级&quot;}
34 93 function _M.herol(role, pms)
35 94 local heroType = tonum(pms.pm1)
36 95 local addLevel = tonum(pms.pm2)
37   - local hero = role.heros[heroType]
38   - if not hero or (hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] and hero:getProperty("level") >= hero:getMaxLevel()) then
39   - return "失败"
  96 + local hero = role:isHaveHero(heroType)
  97 +
  98 + local MaxLv = 200
  99 +
  100 + if not hero then
  101 + return "不存在的英雄类型"
  102 + end
  103 + if hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] and hero:getProperty("level") >= MaxLv then
  104 + return "等级已满"
40 105 end
41   - local nextLevel = math.min(addLevel + hero:getProperty("level"), 200)
  106 + local nextLevel = math.min(addLevel + hero:getProperty("level"), MaxLv)
42 107 for i = 0, 10 do
43 108 local upLimit = csvdb["unit_breakCsv"][i].levelLimit
44 109 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)
55 120 return "成功"
56 121 end
57 122  
  123 +
  124 +table.insert(helpDes, {"全部角色升级" , "herola", "增加等级"})
  125 +function _M.herola(role, pms)
  126 + local addLevel = tonum(pms.pm1)
  127 + for _, hero in pairs(role.heros) do
  128 + _M.herol(role, {pm1 = hero:getProperty("type"), pm2 = addLevel})
  129 + end
  130 + return "成功"
  131 +end
  132 +
  133 +
58 134 table.insert(helpDes, {"获得装备" , "equip", "装备类型" , "装备等级", "装备个数"})
59 135 function _M.equip(role, pms)
60 136 local typ = tonum(pms.pm1)
... ... @@ -282,11 +358,10 @@ function _M.advt(role, pms)
282 358 return "成功"
283 359 end
284 360  
285   -table.insert(helpDes, {"冒险队等级增加", "advl", "通关次数"})
  361 +table.insert(helpDes, {"冒险队等级增加", "advl", "经验"})
286 362 function _M.advl(role, pms)
287   - local winCount = tonum(pms.pm1)
288   - winCount = math.max(0, winCount)
289   - role:checkAdvLvByAddWin(winCount)
  363 + local exp = tonum(pms.pm1)
  364 + role:addAdvLvExp(math.max(0, exp))
290 365 return "成功"
291 366 end
292 367  
... ...