CardHandler.lua 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. -------------------------------------------------
  2. -- 本文件由代码生成器自动生成,
  3. -- 千万不要修改本文件的任何代码,
  4. -- 修改的的任何代码都会被覆盖掉!
  5. ----------------------------------------------------
  6. local Socket = require "Xmds.Pomelo.LuaGameSocket"
  7. require "base64"
  8. require "cardHandler_pb"
  9. --------------------------------Pomelo-------------------------------
  10. Pomelo = Pomelo or {}
  11. --------------------------------CardHandler-------------------------------
  12. Pomelo.CardHandler = {}
  13. local function cardRegisterRequestEncoder(msg)
  14. local input = cardHandler_pb.CardRegisterRequest()
  15. protobuf.FromMessage(input,msg)
  16. return (input:SerializeToString())
  17. end
  18. local function cardRegisterRequestDecoder(stream)
  19. local res = cardHandler_pb.CardRegisterResponse()
  20. res:ParseFromString(stream)
  21. return res
  22. end
  23. function Pomelo.CardHandler.cardRegisterRequest(c2s_cardId,cb,option)
  24. local msg = {}
  25. msg.c2s_cardId = c2s_cardId
  26. Socket.OnRequestStart("area.cardHandler.cardRegisterRequest", option)
  27. Socket.Request("area.cardHandler.cardRegisterRequest", msg, function(res)
  28. if(res.s2c_code == 200) then
  29. Pomelo.CardHandler.lastCardRegisterResponse = res
  30. Socket.OnRequestEnd("area.cardHandler.cardRegisterRequest", true)
  31. cb(nil,res)
  32. else
  33. local ex = {}
  34. if(res.s2c_code) then
  35. ex.Code = res.s2c_code
  36. ex.Message = res.s2c_msg
  37. else
  38. ex.Code = 501
  39. ex.Message = "[LuaXmdsNetClient] area.cardHandler.cardRegisterRequest decode error!!"
  40. end
  41. Socket.OnRequestEnd("area.cardHandler.cardRegisterRequest", false,ex.Code,ex.Message)
  42. cb(ex,nil)
  43. end
  44. end, cardRegisterRequestEncoder, cardRegisterRequestDecoder)
  45. end
  46. local function cardLevelUpRequestEncoder(msg)
  47. local input = cardHandler_pb.CardLevelUpRequest()
  48. protobuf.FromMessage(input,msg)
  49. return (input:SerializeToString())
  50. end
  51. local function cardLevelUpRequestDecoder(stream)
  52. local res = cardHandler_pb.CardLevelUpResponse()
  53. res:ParseFromString(stream)
  54. return res
  55. end
  56. function Pomelo.CardHandler.cardLevelUpRequest(c2s_cardTemplateId,cb,option)
  57. local msg = {}
  58. msg.c2s_cardTemplateId = c2s_cardTemplateId
  59. Socket.OnRequestStart("area.cardHandler.cardLevelUpRequest", option)
  60. Socket.Request("area.cardHandler.cardLevelUpRequest", msg, function(res)
  61. if(res.s2c_code == 200) then
  62. Pomelo.CardHandler.lastCardLevelUpResponse = res
  63. Socket.OnRequestEnd("area.cardHandler.cardLevelUpRequest", true)
  64. cb(nil,res)
  65. else
  66. local ex = {}
  67. if(res.s2c_code) then
  68. ex.Code = res.s2c_code
  69. ex.Message = res.s2c_msg
  70. else
  71. ex.Code = 501
  72. ex.Message = "[LuaXmdsNetClient] area.cardHandler.cardLevelUpRequest decode error!!"
  73. end
  74. Socket.OnRequestEnd("area.cardHandler.cardLevelUpRequest", false,ex.Code,ex.Message)
  75. cb(ex,nil)
  76. end
  77. end, cardLevelUpRequestEncoder, cardLevelUpRequestDecoder)
  78. end
  79. local function cardPreLevelUpRequestEncoder(msg)
  80. local input = cardHandler_pb.CardPreLevelUpRequest()
  81. protobuf.FromMessage(input,msg)
  82. return (input:SerializeToString())
  83. end
  84. local function cardPreLevelUpRequestDecoder(stream)
  85. local res = cardHandler_pb.CardPreLevelUpResponse()
  86. res:ParseFromString(stream)
  87. return res
  88. end
  89. function Pomelo.CardHandler.cardPreLevelUpRequest(c2s_cardTemplateId,cb,option)
  90. local msg = {}
  91. msg.c2s_cardTemplateId = c2s_cardTemplateId
  92. Socket.OnRequestStart("area.cardHandler.cardPreLevelUpRequest", option)
  93. Socket.Request("area.cardHandler.cardPreLevelUpRequest", msg, function(res)
  94. if(res.s2c_code == 200) then
  95. Pomelo.CardHandler.lastCardPreLevelUpResponse = res
  96. Socket.OnRequestEnd("area.cardHandler.cardPreLevelUpRequest", true)
  97. cb(nil,res)
  98. else
  99. local ex = {}
  100. if(res.s2c_code) then
  101. ex.Code = res.s2c_code
  102. ex.Message = res.s2c_msg
  103. else
  104. ex.Code = 501
  105. ex.Message = "[LuaXmdsNetClient] area.cardHandler.cardPreLevelUpRequest decode error!!"
  106. end
  107. Socket.OnRequestEnd("area.cardHandler.cardPreLevelUpRequest", false,ex.Code,ex.Message)
  108. cb(ex,nil)
  109. end
  110. end, cardPreLevelUpRequestEncoder, cardPreLevelUpRequestDecoder)
  111. end
  112. local function cardGetAwardRequestEncoder(msg)
  113. local input = cardHandler_pb.CardGetAwardRequest()
  114. protobuf.FromMessage(input,msg)
  115. return (input:SerializeToString())
  116. end
  117. local function cardGetAwardRequestDecoder(stream)
  118. local res = cardHandler_pb.CardGetAwardResponse()
  119. res:ParseFromString(stream)
  120. return res
  121. end
  122. function Pomelo.CardHandler.cardGetAwardRequest(c2s_awardId,cb,option)
  123. local msg = {}
  124. msg.c2s_awardId = c2s_awardId
  125. Socket.OnRequestStart("area.cardHandler.cardGetAwardRequest", option)
  126. Socket.Request("area.cardHandler.cardGetAwardRequest", msg, function(res)
  127. if(res.s2c_code == 200) then
  128. Pomelo.CardHandler.lastCardGetAwardResponse = res
  129. Socket.OnRequestEnd("area.cardHandler.cardGetAwardRequest", true)
  130. cb(nil,res)
  131. else
  132. local ex = {}
  133. if(res.s2c_code) then
  134. ex.Code = res.s2c_code
  135. ex.Message = res.s2c_msg
  136. else
  137. ex.Code = 501
  138. ex.Message = "[LuaXmdsNetClient] area.cardHandler.cardGetAwardRequest decode error!!"
  139. end
  140. Socket.OnRequestEnd("area.cardHandler.cardGetAwardRequest", false,ex.Code,ex.Message)
  141. cb(ex,nil)
  142. end
  143. end, cardGetAwardRequestEncoder, cardGetAwardRequestDecoder)
  144. end
  145. local function cardEquipRequestEncoder(msg)
  146. local input = cardHandler_pb.CardEquipRequest()
  147. protobuf.FromMessage(input,msg)
  148. return (input:SerializeToString())
  149. end
  150. local function cardEquipRequestDecoder(stream)
  151. local res = cardHandler_pb.CardEquipResponse()
  152. res:ParseFromString(stream)
  153. return res
  154. end
  155. function Pomelo.CardHandler.cardEquipRequest(c2s_cardId,c2s_holePos,cb,option)
  156. local msg = {}
  157. msg.c2s_cardId = c2s_cardId
  158. msg.c2s_holePos = c2s_holePos
  159. Socket.OnRequestStart("area.cardHandler.cardEquipRequest", option)
  160. Socket.Request("area.cardHandler.cardEquipRequest", msg, function(res)
  161. if(res.s2c_code == 200) then
  162. Pomelo.CardHandler.lastCardEquipResponse = res
  163. Socket.OnRequestEnd("area.cardHandler.cardEquipRequest", true)
  164. cb(nil,res)
  165. else
  166. local ex = {}
  167. if(res.s2c_code) then
  168. ex.Code = res.s2c_code
  169. ex.Message = res.s2c_msg
  170. else
  171. ex.Code = 501
  172. ex.Message = "[LuaXmdsNetClient] area.cardHandler.cardEquipRequest decode error!!"
  173. end
  174. Socket.OnRequestEnd("area.cardHandler.cardEquipRequest", false,ex.Code,ex.Message)
  175. cb(ex,nil)
  176. end
  177. end, cardEquipRequestEncoder, cardEquipRequestDecoder)
  178. end
  179. local function cardQueryAllDataRequestEncoder(msg)
  180. local input = cardHandler_pb.CardQueryAllDataRequest()
  181. protobuf.FromMessage(input,msg)
  182. return (input:SerializeToString())
  183. end
  184. local function cardQueryAllDataRequestDecoder(stream)
  185. local res = cardHandler_pb.CardQueryAllDataResponse()
  186. res:ParseFromString(stream)
  187. return res
  188. end
  189. function Pomelo.CardHandler.cardQueryAllDataRequest(cb,option)
  190. local input = nil
  191. Socket.OnRequestStart("area.cardHandler.cardQueryAllDataRequest", option)
  192. Socket.Request("area.cardHandler.cardQueryAllDataRequest", input, function(res)
  193. if(res.s2c_code == 200) then
  194. Pomelo.CardHandler.lastCardQueryAllDataResponse = res
  195. Socket.OnRequestEnd("area.cardHandler.cardQueryAllDataRequest", true)
  196. cb(nil,res)
  197. else
  198. local ex = {}
  199. if(res.s2c_code) then
  200. ex.Code = res.s2c_code
  201. ex.Message = res.s2c_msg
  202. else
  203. ex.Code = 501
  204. ex.Message = "[LuaXmdsNetClient] area.cardHandler.cardQueryAllDataRequest decode error!!"
  205. end
  206. Socket.OnRequestEnd("area.cardHandler.cardQueryAllDataRequest", false,ex.Code,ex.Message)
  207. cb(ex,nil)
  208. end
  209. end, cardQueryAllDataRequestEncoder, cardQueryAllDataRequestDecoder)
  210. end
  211. --------------------------------Pomelo-------------------------------
  212. return Pomelo