Commit 08af0de6402bcbf7903690be3abede56cea9504e
1 parent
c32be356
清空背包gm
Showing
1 changed file
with
20 additions
and
0 deletions
Show diff stats
src/actions/GmAction.lua
@@ -558,6 +558,26 @@ function _M.actbattle(role, pms) | @@ -558,6 +558,26 @@ function _M.actbattle(role, pms) | ||
558 | return "成功" | 558 | return "成功" |
559 | end | 559 | end |
560 | 560 | ||
561 | +table.insert(helpDes, {"清空背包", "clearbag"}) | ||
562 | +function _M.clearbag(role, pms) | ||
563 | + -- 装备 | ||
564 | + role:updateProperty({field="equips", value = {}}) | ||
565 | + -- 道具 | ||
566 | + local items = role:getProperty("items"):toNumMap() | ||
567 | + for k, v in pairs(items) do | ||
568 | + role:addItem({itemId = k, count = -v, log = {desc = "gm"}}) | ||
569 | + end | ||
570 | + | ||
571 | + -- 铭文 | ||
572 | + local uids = {} | ||
573 | + for uid, _ in pairs(role.runeBag) do | ||
574 | + table.insert(uids, uid) | ||
575 | + end | ||
576 | + role:delRunes(uids, {log = {desc = "gm"}}) | ||
577 | + | ||
578 | + return "成功" | ||
579 | +end | ||
580 | + | ||
561 | function _M.helpRpc(agent, data) | 581 | function _M.helpRpc(agent, data) |
562 | SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes})) | 582 | SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes})) |
563 | return true | 583 | return true |