MapHandler.lua 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. -------------------------------------------------
  2. -- 本文件由代码生成器自动生成,
  3. -- 千万不要修改本文件的任何代码,
  4. -- 修改的的任何代码都会被覆盖掉!
  5. ----------------------------------------------------
  6. local Socket = require "Xmds.Pomelo.LuaGameSocket"
  7. require "base64"
  8. require "mapHandler_pb"
  9. --------------------------------Pomelo-------------------------------
  10. Pomelo = Pomelo or {}
  11. --------------------------------MapHandler-------------------------------
  12. Pomelo.MapHandler = {}
  13. local function genterSceneByAreaIdRequestEncoder(msg)
  14. local input = mapHandler_pb.GnterSceneByAreaIdRequest()
  15. protobuf.FromMessage(input,msg)
  16. return (input:SerializeToString())
  17. end
  18. local function genterSceneByAreaIdRequestDecoder(stream)
  19. local res = mapHandler_pb.GnterSceneByAreaIdResponse()
  20. res:ParseFromString(stream)
  21. return res
  22. end
  23. function Pomelo.MapHandler.genterSceneByAreaIdRequest(c2s_areaId,cb,option)
  24. local msg = {}
  25. msg.c2s_areaId = c2s_areaId
  26. Socket.OnRequestStart("area.mapHandler.genterSceneByAreaIdRequest", option)
  27. Socket.Request("area.mapHandler.genterSceneByAreaIdRequest", msg, function(res)
  28. if(res.s2c_code == 200) then
  29. Pomelo.MapHandler.lastGnterSceneByAreaIdResponse = res
  30. Socket.OnRequestEnd("area.mapHandler.genterSceneByAreaIdRequest", 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.mapHandler.genterSceneByAreaIdRequest decode error!!"
  40. end
  41. Socket.OnRequestEnd("area.mapHandler.genterSceneByAreaIdRequest", false,ex.Code,ex.Message)
  42. cb(ex,nil)
  43. end
  44. end, genterSceneByAreaIdRequestEncoder, genterSceneByAreaIdRequestDecoder)
  45. end
  46. local function getWorldMapListRequestEncoder(msg)
  47. local input = mapHandler_pb.GetWorldMapListRequest()
  48. protobuf.FromMessage(input,msg)
  49. return (input:SerializeToString())
  50. end
  51. local function getWorldMapListRequestDecoder(stream)
  52. local res = mapHandler_pb.GetWorldMapListResponse()
  53. res:ParseFromString(stream)
  54. return res
  55. end
  56. function Pomelo.MapHandler.getWorldMapListRequest(cb,option)
  57. local input = nil
  58. Socket.OnRequestStart("area.mapHandler.getWorldMapListRequest", option)
  59. Socket.Request("area.mapHandler.getWorldMapListRequest", input, function(res)
  60. if(res.s2c_code == 200) then
  61. Pomelo.MapHandler.lastGetWorldMapListResponse = res
  62. Socket.OnRequestEnd("area.mapHandler.getWorldMapListRequest", true)
  63. cb(nil,res)
  64. else
  65. local ex = {}
  66. if(res.s2c_code) then
  67. ex.Code = res.s2c_code
  68. ex.Message = res.s2c_msg
  69. else
  70. ex.Code = 501
  71. ex.Message = "[LuaXmdsNetClient] area.mapHandler.getWorldMapListRequest decode error!!"
  72. end
  73. Socket.OnRequestEnd("area.mapHandler.getWorldMapListRequest", false,ex.Code,ex.Message)
  74. cb(ex,nil)
  75. end
  76. end, getWorldMapListRequestEncoder, getWorldMapListRequestDecoder)
  77. end
  78. local function getPlayerListRequestEncoder(msg)
  79. local input = mapHandler_pb.GetPlayerListRequest()
  80. protobuf.FromMessage(input,msg)
  81. return (input:SerializeToString())
  82. end
  83. local function getPlayerListRequestDecoder(stream)
  84. local res = mapHandler_pb.GetPlayerListResponse()
  85. res:ParseFromString(stream)
  86. return res
  87. end
  88. function Pomelo.MapHandler.getPlayerListRequest(cb,option)
  89. local input = nil
  90. Socket.OnRequestStart("area.mapHandler.getPlayerListRequest", option)
  91. Socket.Request("area.mapHandler.getPlayerListRequest", input, function(res)
  92. if(res.s2c_code == 200) then
  93. Pomelo.MapHandler.lastGetPlayerListResponse = res
  94. Socket.OnRequestEnd("area.mapHandler.getPlayerListRequest", true)
  95. cb(nil,res)
  96. else
  97. local ex = {}
  98. if(res.s2c_code) then
  99. ex.Code = res.s2c_code
  100. ex.Message = res.s2c_msg
  101. else
  102. ex.Code = 501
  103. ex.Message = "[LuaXmdsNetClient] area.mapHandler.getPlayerListRequest decode error!!"
  104. end
  105. Socket.OnRequestEnd("area.mapHandler.getPlayerListRequest", false,ex.Code,ex.Message)
  106. cb(ex,nil)
  107. end
  108. end, getPlayerListRequestEncoder, getPlayerListRequestDecoder)
  109. end
  110. local function getMonsterListRequestEncoder(msg)
  111. local input = mapHandler_pb.GetMonsterListRequest()
  112. protobuf.FromMessage(input,msg)
  113. return (input:SerializeToString())
  114. end
  115. local function getMonsterListRequestDecoder(stream)
  116. local res = mapHandler_pb.GetMonsterListResponse()
  117. res:ParseFromString(stream)
  118. return res
  119. end
  120. function Pomelo.MapHandler.getMonsterListRequest(cb,option)
  121. local input = nil
  122. Socket.OnRequestStart("area.mapHandler.getMonsterListRequest", option)
  123. Socket.Request("area.mapHandler.getMonsterListRequest", input, function(res)
  124. if(res.s2c_code == 200) then
  125. Pomelo.MapHandler.lastGetMonsterListResponse = res
  126. Socket.OnRequestEnd("area.mapHandler.getMonsterListRequest", true)
  127. cb(nil,res)
  128. else
  129. local ex = {}
  130. if(res.s2c_code) then
  131. ex.Code = res.s2c_code
  132. ex.Message = res.s2c_msg
  133. else
  134. ex.Code = 501
  135. ex.Message = "[LuaXmdsNetClient] area.mapHandler.getMonsterListRequest decode error!!"
  136. end
  137. Socket.OnRequestEnd("area.mapHandler.getMonsterListRequest", false,ex.Code,ex.Message)
  138. cb(ex,nil)
  139. end
  140. end, getMonsterListRequestEncoder, getMonsterListRequestDecoder)
  141. end
  142. local function getNpcListRequestEncoder(msg)
  143. local input = mapHandler_pb.GetNpcListRequest()
  144. protobuf.FromMessage(input,msg)
  145. return (input:SerializeToString())
  146. end
  147. local function getNpcListRequestDecoder(stream)
  148. local res = mapHandler_pb.GetNpcListResponse()
  149. res:ParseFromString(stream)
  150. return res
  151. end
  152. function Pomelo.MapHandler.getNpcListRequest(cb,option)
  153. local input = nil
  154. Socket.OnRequestStart("area.mapHandler.getNpcListRequest", option)
  155. Socket.Request("area.mapHandler.getNpcListRequest", input, function(res)
  156. if(res.s2c_code == 200) then
  157. Pomelo.MapHandler.lastGetNpcListResponse = res
  158. Socket.OnRequestEnd("area.mapHandler.getNpcListRequest", true)
  159. cb(nil,res)
  160. else
  161. local ex = {}
  162. if(res.s2c_code) then
  163. ex.Code = res.s2c_code
  164. ex.Message = res.s2c_msg
  165. else
  166. ex.Code = 501
  167. ex.Message = "[LuaXmdsNetClient] area.mapHandler.getNpcListRequest decode error!!"
  168. end
  169. Socket.OnRequestEnd("area.mapHandler.getNpcListRequest", false,ex.Code,ex.Message)
  170. cb(ex,nil)
  171. end
  172. end, getNpcListRequestEncoder, getNpcListRequestDecoder)
  173. end
  174. local function getMapListRequestEncoder(msg)
  175. local input = mapHandler_pb.GetMapListRequest()
  176. protobuf.FromMessage(input,msg)
  177. return (input:SerializeToString())
  178. end
  179. local function getMapListRequestDecoder(stream)
  180. local res = mapHandler_pb.GetMapListResponse()
  181. res:ParseFromString(stream)
  182. return res
  183. end
  184. function Pomelo.MapHandler.getMapListRequest(c2s_mapId,cb,option)
  185. local msg = {}
  186. msg.c2s_mapId = c2s_mapId
  187. Socket.OnRequestStart("area.mapHandler.getMapListRequest", option)
  188. Socket.Request("area.mapHandler.getMapListRequest", msg, function(res)
  189. if(res.s2c_code == 200) then
  190. Pomelo.MapHandler.lastGetMapListResponse = res
  191. Socket.OnRequestEnd("area.mapHandler.getMapListRequest", true)
  192. cb(nil,res)
  193. else
  194. local ex = {}
  195. if(res.s2c_code) then
  196. ex.Code = res.s2c_code
  197. ex.Message = res.s2c_msg
  198. else
  199. ex.Code = 501
  200. ex.Message = "[LuaXmdsNetClient] area.mapHandler.getMapListRequest decode error!!"
  201. end
  202. Socket.OnRequestEnd("area.mapHandler.getMapListRequest", false,ex.Code,ex.Message)
  203. cb(ex,nil)
  204. end
  205. end, getMapListRequestEncoder, getMapListRequestDecoder)
  206. end
  207. local function getAliveMonsterLineInfoRequestEncoder(msg)
  208. local input = mapHandler_pb.GetAliveMonsterLineInfoRequest()
  209. protobuf.FromMessage(input,msg)
  210. return (input:SerializeToString())
  211. end
  212. local function getAliveMonsterLineInfoRequestDecoder(stream)
  213. local res = mapHandler_pb.GetAliveMonsterLineInfoResponse()
  214. res:ParseFromString(stream)
  215. return res
  216. end
  217. function Pomelo.MapHandler.getAliveMonsterLineInfoRequest(cb,option)
  218. local input = nil
  219. Socket.OnRequestStart("area.mapHandler.getAliveMonsterLineInfoRequest", option)
  220. Socket.Request("area.mapHandler.getAliveMonsterLineInfoRequest", input, function(res)
  221. if(res.s2c_code == 200) then
  222. Pomelo.MapHandler.lastGetAliveMonsterLineInfoResponse = res
  223. Socket.OnRequestEnd("area.mapHandler.getAliveMonsterLineInfoRequest", true)
  224. cb(nil,res)
  225. else
  226. local ex = {}
  227. if(res.s2c_code) then
  228. ex.Code = res.s2c_code
  229. ex.Message = res.s2c_msg
  230. else
  231. ex.Code = 501
  232. ex.Message = "[LuaXmdsNetClient] area.mapHandler.getAliveMonsterLineInfoRequest decode error!!"
  233. end
  234. Socket.OnRequestEnd("area.mapHandler.getAliveMonsterLineInfoRequest", false,ex.Code,ex.Message)
  235. cb(ex,nil)
  236. end
  237. end, getAliveMonsterLineInfoRequestEncoder, getAliveMonsterLineInfoRequestDecoder)
  238. end
  239. local function mapOpenInfoPushDecoder(stream)
  240. local res = mapHandler_pb.MapOpenInfoPush()
  241. res:ParseFromString(stream)
  242. return res
  243. end
  244. function Pomelo.MapHandler.mapOpenInfoPush(cb)
  245. Socket.On("area.mapPush.mapOpenInfoPush", function(res)
  246. Pomelo.MapHandler.lastMapOpenInfoPush = res
  247. cb(nil,res)
  248. end, mapOpenInfoPushDecoder)
  249. end
  250. --------------------------------Pomelo-------------------------------
  251. return Pomelo