Commit c1849aa6e5b2f118bce57308eb51b5acba09e5e2
1 parent
284482c6
roleaction增加一个获取随机名字协议
Showing
2 changed files
with
7 additions
and
0 deletions
Show diff stats
src/ProtocolCode.lua
@@ -41,6 +41,7 @@ actionCodes = { | @@ -41,6 +41,7 @@ actionCodes = { | ||
41 | Role_changeHeadRpc = 127, | 41 | Role_changeHeadRpc = 127, |
42 | Role_openSpeedUpBoxRpc = 128, | 42 | Role_openSpeedUpBoxRpc = 128, |
43 | Role_guideRpc = 129, | 43 | Role_guideRpc = 129, |
44 | + Role_getRandomNameRpc = 130, | ||
44 | 45 | ||
45 | Adv_startAdvRpc = 151, | 46 | Adv_startAdvRpc = 151, |
46 | Adv_startHangRpc = 152, | 47 | Adv_startHangRpc = 152, |
src/actions/RoleAction.lua
@@ -352,6 +352,12 @@ function _M.changeNameRpc(agent, data) | @@ -352,6 +352,12 @@ function _M.changeNameRpc(agent, data) | ||
352 | return true | 352 | return true |
353 | end | 353 | end |
354 | 354 | ||
355 | +function _M.getRandomNameRpc() | ||
356 | + local name = randomRoleName() | ||
357 | + SendPacket(actionCodes.Role_getRandomNameRpc, MsgPack.pack({name = name})) | ||
358 | + return true | ||
359 | +end | ||
360 | + | ||
355 | function _M.changeIntroRpc(agent, data) | 361 | function _M.changeIntroRpc(agent, data) |
356 | local role = agent.role | 362 | local role = agent.role |
357 | local roleId = role:getProperty("id") | 363 | local roleId = role:getProperty("id") |