proto_bag.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. --[[
  2. Descripttion:背包
  3. version:
  4. Author: Neo,Huang
  5. Date: 2023-11-15 22:34:08
  6. LastEditors: Neo,Huang
  7. LastEditTime: 2023-11-19 20:43:33
  8. --]]
  9. local proto_struct =
  10. [[
  11. # 资源更新信息
  12. .DataItemUpdate {
  13. id 0: integer # 物品id
  14. count 1: integer # 物品当前数量
  15. deltaCount 2: integer # 物品变化量
  16. bid 3: integer # 物品在背包的id
  17. }
  18. ]]
  19. local proto_c2s =
  20. [[
  21. # 获取背包信息
  22. bag_get_info 2100 {
  23. request {
  24. }
  25. response {
  26. code 0: integer
  27. items 1: *DataItemBag # 物品列表
  28. }
  29. }
  30. # 分解
  31. bag_exchange 2101 {
  32. request {
  33. items 0: *DataItem # 分解物品列表(支持一键分解)
  34. }
  35. response {
  36. code 0: integer
  37. goldCount 1: integer # 分解后获得金币数量
  38. }
  39. }
  40. # 提取
  41. bag_draw 2102 {
  42. request {
  43. items 0: *DataItem # 提取物品列表(支持一键提取)
  44. }
  45. response {
  46. code 0: integer
  47. }
  48. }
  49. ]]
  50. local proto_s2c =
  51. [[
  52. # 玩家当前物品
  53. on_user_items 2100 {
  54. request {
  55. items 0: *DataItemUpdate # 道具变化列表
  56. reason 1: string # 资源变化的途径
  57. }
  58. }
  59. ]]
  60. local proto = {
  61. c2s = proto_struct .. proto_c2s,
  62. s2c = proto_struct .. proto_s2c
  63. }
  64. return proto