Commit 21774ba5b42decc10bfbc006f1006f8d9d5adaa7
1 parent
8641a577
feat: 金币购买铭文碎片
Showing
2 changed files
with
16 additions
and
0 deletions
Show diff stats
src/ProtocolCode.lua
src/actions/RoleAction.lua
| ... | ... | @@ -1568,4 +1568,19 @@ function _M.getTimeGiftRpc(agent, data) |
| 1568 | 1568 | return true |
| 1569 | 1569 | end |
| 1570 | 1570 | |
| 1571 | +function _M.runeBuyRpc(agent, data) | |
| 1572 | + local role = agent.role | |
| 1573 | + local msg = MsgPack.unpack(data) | |
| 1574 | + local count = msg.count | |
| 1575 | + | |
| 1576 | + local glodCount = globalCsv.rune_exchange * count | |
| 1577 | + if not role:checkItemEnough({[ItemId.Gold] = glodCount}) then return end | |
| 1578 | + role:costItems({[ItemId.Gold] = glodCount}, {log = {desc = "glodConvertRune", int1 = count, int2 = glodCount}}) | |
| 1579 | + local reward, change = {} | |
| 1580 | + reward[ItemId.RuneFragment] = count | |
| 1581 | + reward, change = role:award(reward, {log = {desc = "glodConvertRune"}}) | |
| 1582 | + SendPacket(actionCodes.Role_runeBuyRpc, MsgPack.pack(role:packReward(reward, change))) | |
| 1583 | + return true | |
| 1584 | +end | |
| 1585 | + | |
| 1571 | 1586 | return _M |
| 1572 | 1587 | \ No newline at end of file | ... | ... |