Commit faabdf3cdd6e8da0cdec95655ca1365f46296eb7
1 parent
4cab94e4
Gm加hero add level
Showing
1 changed file
with
14 additions
and
0 deletions
Show diff stats
src/actions/GmAction.lua
@@ -30,6 +30,20 @@ function _M.hero(role, pms) | @@ -30,6 +30,20 @@ function _M.hero(role, pms) | ||
30 | return "成功" | 30 | return "成功" |
31 | end | 31 | end |
32 | 32 | ||
33 | +table.insert(helpDes, {"角色升级" , "herol", "角色类型", "增加等级"}) | ||
34 | +function _M.herol(role, pms) | ||
35 | + local heroType = tonum(pms.pm1) | ||
36 | + local addLevel = tonum(pms.pm2) | ||
37 | + local hero = role.heros[heroType] | ||
38 | + if not hero or hero:getProperty("level") >= hero:getMaxLevel() then | ||
39 | + return "失败" | ||
40 | + end | ||
41 | + addLevel = math.min(hero:getMaxLevel() - hero:getProperty("level"), addLevel) | ||
42 | + hero:updateProperty({field = "level", delta = addLevel}) | ||
43 | + role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")}) | ||
44 | + return "成功" | ||
45 | +end | ||
46 | + | ||
33 | table.insert(helpDes, {"获得装备" , "equip", "装备类型" , "装备等级", "装备个数"}) | 47 | table.insert(helpDes, {"获得装备" , "equip", "装备类型" , "装备等级", "装备个数"}) |
34 | function _M.equip(role, pms) | 48 | function _M.equip(role, pms) |
35 | local typ = tonum(pms.pm1) | 49 | local typ = tonum(pms.pm1) |