------------------------------------------------- -- 本文件由代码生成器自动生成, -- 千万不要修改本文件的任何代码, -- 修改的的任何代码都会被覆盖掉! ---------------------------------------------------- local Socket = require "Xmds.Pomelo.LuaGameSocket" require "base64" require "petHandler_pb" --------------------------------Pomelo------------------------------- Pomelo = Pomelo or {} --------------------------------PetHandler------------------------------- Pomelo.PetHandler = {} local function getPetInfoRequestEncoder(msg) local input = petHandler_pb.GetPetInfoRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function getPetInfoRequestDecoder(stream) local res = petHandler_pb.GetPetInfoResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.getPetInfoRequest(cb,option) local input = nil Socket.OnRequestStart("pet.petHandler.getPetInfoRequest", option) Socket.Request("pet.petHandler.getPetInfoRequest", input, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastGetPetInfoResponse = res Socket.OnRequestEnd("pet.petHandler.getPetInfoRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.getPetInfoRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.getPetInfoRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, getPetInfoRequestEncoder, getPetInfoRequestDecoder) end local function getGourdInfoRequestEncoder(msg) local input = petHandler_pb.GetGourdInfoRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function getGourdInfoRequestDecoder(stream) local res = petHandler_pb.GetGourdInfoResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.getGourdInfoRequest(cb,option) local input = nil Socket.OnRequestStart("pet.petHandler.getGourdInfoRequest", option) Socket.Request("pet.petHandler.getGourdInfoRequest", input, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastGetGourdInfoResponse = res Socket.OnRequestEnd("pet.petHandler.getGourdInfoRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.getGourdInfoRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.getGourdInfoRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, getGourdInfoRequestEncoder, getGourdInfoRequestDecoder) end local function wateringRequestEncoder(msg) local input = petHandler_pb.WateringRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function wateringRequestDecoder(stream) local res = petHandler_pb.WateringResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.wateringRequest(wateringType,cb,option) local msg = {} msg.wateringType = wateringType Socket.OnRequestStart("pet.petHandler.wateringRequest", option) Socket.Request("pet.petHandler.wateringRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastWateringResponse = res Socket.OnRequestEnd("pet.petHandler.wateringRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.wateringRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.wateringRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, wateringRequestEncoder, wateringRequestDecoder) end local function pikupGourdRequestEncoder(msg) local input = petHandler_pb.PikupGourdRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function pikupGourdRequestDecoder(stream) local res = petHandler_pb.PikupGourdResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.pikupGourdRequest(pos,cb,option) local msg = {} msg.pos = pos Socket.OnRequestStart("pet.petHandler.pikupGourdRequest", option) Socket.Request("pet.petHandler.pikupGourdRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPikupGourdResponse = res Socket.OnRequestEnd("pet.petHandler.pikupGourdRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.pikupGourdRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.pikupGourdRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, pikupGourdRequestEncoder, pikupGourdRequestDecoder) end local function changeNameRequestEncoder(msg) local input = petHandler_pb.ChangeNameRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function changeNameRequestDecoder(stream) local res = petHandler_pb.ChangeNameResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.changeNameRequest(id,petName,cb,option) local msg = {} msg.id = id msg.petName = petName Socket.OnRequestStart("pet.petHandler.changeNameRequest", option) Socket.Request("pet.petHandler.changeNameRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastChangeNameResponse = res Socket.OnRequestEnd("pet.petHandler.changeNameRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.changeNameRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.changeNameRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, changeNameRequestEncoder, changeNameRequestDecoder) end local function petFightRequestEncoder(msg) local input = petHandler_pb.PetFightRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petFightRequestDecoder(stream) local res = petHandler_pb.PetFightResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petFightRequest(id,cb,option) local msg = {} msg.id = id Socket.OnRequestStart("pet.petHandler.petFightRequest", option) Socket.Request("pet.petHandler.petFightRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetFightResponse = res Socket.OnRequestEnd("pet.petHandler.petFightRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petFightRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petFightRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petFightRequestEncoder, petFightRequestDecoder) end local function petUpGradeRequestEncoder(msg) local input = petHandler_pb.PetUpGradeRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petUpGradeRequestDecoder(stream) local res = petHandler_pb.PetUpGradeResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petUpGradeRequest(id,seting,itemCode,cb,option) local msg = {} msg.id = id msg.seting = seting msg.itemCode = itemCode Socket.OnRequestStart("pet.petHandler.petUpGradeRequest", option) Socket.Request("pet.petHandler.petUpGradeRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetUpGradeResponse = res Socket.OnRequestEnd("pet.petHandler.petUpGradeRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petUpGradeRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petUpGradeRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petUpGradeRequestEncoder, petUpGradeRequestDecoder) end local function petUpOrderRequestEncoder(msg) local input = petHandler_pb.PetUpOrderRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petUpOrderRequestDecoder(stream) local res = petHandler_pb.PetUpOrderResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petUpOrderRequest(id,first,second,cb,option) local msg = {} msg.id = id msg.first = first msg.second = second Socket.OnRequestStart("pet.petHandler.petUpOrderRequest", option) Socket.Request("pet.petHandler.petUpOrderRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetUpOrderResponse = res Socket.OnRequestEnd("pet.petHandler.petUpOrderRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petUpOrderRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petUpOrderRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petUpOrderRequestEncoder, petUpOrderRequestDecoder) end local function petRestRequestEncoder(msg) local input = petHandler_pb.PetRestRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petRestRequestDecoder(stream) local res = petHandler_pb.PetRestResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petRestRequest(id,cb,option) local msg = {} msg.id = id Socket.OnRequestStart("pet.petHandler.petRestRequest", option) Socket.Request("pet.petHandler.petRestRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetRestResponse = res Socket.OnRequestEnd("pet.petHandler.petRestRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petRestRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petRestRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petRestRequestEncoder, petRestRequestDecoder) end local function petDeletRequestEncoder(msg) local input = petHandler_pb.PetDeletRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petDeletRequestDecoder(stream) local res = petHandler_pb.PetDeletResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petDeletRequest(id,cb,option) local msg = {} msg.id = id Socket.OnRequestStart("pet.petHandler.petDeletRequest", option) Socket.Request("pet.petHandler.petDeletRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetDeletResponse = res Socket.OnRequestEnd("pet.petHandler.petDeletRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petDeletRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petDeletRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petDeletRequestEncoder, petDeletRequestDecoder) end local function petRefineRequestEncoder(msg) local input = petHandler_pb.PetRefineRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petRefineRequestDecoder(stream) local res = petHandler_pb.PetRefineResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petRefineRequest(id,cb,option) local msg = {} msg.id = id Socket.OnRequestStart("pet.petHandler.petRefineRequest", option) Socket.Request("pet.petHandler.petRefineRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetRefineResponse = res Socket.OnRequestEnd("pet.petHandler.petRefineRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petRefineRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petRefineRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petRefineRequestEncoder, petRefineRequestDecoder) end local function petRefineAttrRequestEncoder(msg) local input = petHandler_pb.PetRefineAttrRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petRefineAttrRequestDecoder(stream) local res = petHandler_pb.PetRefineAttrResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petRefineAttrRequest(id,cb,option) local msg = {} msg.id = id Socket.OnRequestStart("pet.petHandler.petRefineAttrRequest", option) Socket.Request("pet.petHandler.petRefineAttrRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetRefineAttrResponse = res Socket.OnRequestEnd("pet.petHandler.petRefineAttrRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petRefineAttrRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petRefineAttrRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petRefineAttrRequestEncoder, petRefineAttrRequestDecoder) end local function petSkillLearnRequestEncoder(msg) local input = petHandler_pb.PetSkillLearnRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petSkillLearnRequestDecoder(stream) local res = petHandler_pb.PetSkillLearnResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petSkillLearnRequest(id,petSkillId,cb,option) local msg = {} msg.id = id msg.petSkillId = petSkillId Socket.OnRequestStart("pet.petHandler.petSkillLearnRequest", option) Socket.Request("pet.petHandler.petSkillLearnRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetSkillLearnResponse = res Socket.OnRequestEnd("pet.petHandler.petSkillLearnRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petSkillLearnRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petSkillLearnRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petSkillLearnRequestEncoder, petSkillLearnRequestDecoder) end local function petSkillUpGradeRequestEncoder(msg) local input = petHandler_pb.PetSkillUpGradeRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petSkillUpGradeRequestDecoder(stream) local res = petHandler_pb.PetSkillUpGradeResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petSkillUpGradeRequest(id,petSkillId,cb,option) local msg = {} msg.id = id msg.petSkillId = petSkillId Socket.OnRequestStart("pet.petHandler.petSkillUpGradeRequest", option) Socket.Request("pet.petHandler.petSkillUpGradeRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetSkillUpGradeResponse = res Socket.OnRequestEnd("pet.petHandler.petSkillUpGradeRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petSkillUpGradeRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petSkillUpGradeRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petSkillUpGradeRequestEncoder, petSkillUpGradeRequestDecoder) end local function petSetSkinRequestEncoder(msg) local input = petHandler_pb.PetSetSkinRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petSetSkinRequestDecoder(stream) local res = petHandler_pb.PetSetSkinResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petSetSkinRequest(id,petSkin,cb,option) local msg = {} msg.id = id msg.petSkin = petSkin Socket.OnRequestStart("pet.petHandler.petSetSkinRequest", option) Socket.Request("pet.petHandler.petSetSkinRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetSetSkinResponse = res Socket.OnRequestEnd("pet.petHandler.petSetSkinRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petSetSkinRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petSetSkinRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petSetSkinRequestEncoder, petSetSkinRequestDecoder) end local function petSkillLockRequestEncoder(msg) local input = petHandler_pb.PetSkillLockRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petSkillLockRequestDecoder(stream) local res = petHandler_pb.PetSkillLockResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petSkillLockRequest(id,petSkillId,cb,option) local msg = {} msg.id = id msg.petSkillId = petSkillId Socket.OnRequestStart("pet.petHandler.petSkillLockRequest", option) Socket.Request("pet.petHandler.petSkillLockRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetSkillLockResponse = res Socket.OnRequestEnd("pet.petHandler.petSkillLockRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petSkillLockRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petSkillLockRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petSkillLockRequestEncoder, petSkillLockRequestDecoder) end local function petSkillUnLockRequestEncoder(msg) local input = petHandler_pb.PetSkillUnLockRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function petSkillUnLockRequestDecoder(stream) local res = petHandler_pb.PetSkillUnLockResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.petSkillUnLockRequest(id,petSkillId,cb,option) local msg = {} msg.id = id msg.petSkillId = petSkillId Socket.OnRequestStart("pet.petHandler.petSkillUnLockRequest", option) Socket.Request("pet.petHandler.petSkillUnLockRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastPetSkillUnLockResponse = res Socket.OnRequestEnd("pet.petHandler.petSkillUnLockRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.petSkillUnLockRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.petSkillUnLockRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, petSkillUnLockRequestEncoder, petSkillUnLockRequestDecoder) end local function queryOtherPlayerPetAttrRequestEncoder(msg) local input = petHandler_pb.QueryOtherPlayerPetAttrRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function queryOtherPlayerPetAttrRequestDecoder(stream) local res = petHandler_pb.QueryOtherPlayerPetAttrResponse() res:ParseFromString(stream) return res end function Pomelo.PetHandler.queryOtherPlayerPetAttrRequest(otherPlayerId,otherPetId,cb,option) local msg = {} msg.otherPlayerId = otherPlayerId msg.otherPetId = otherPetId Socket.OnRequestStart("pet.petHandler.queryOtherPlayerPetAttrRequest", option) Socket.Request("pet.petHandler.queryOtherPlayerPetAttrRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.PetHandler.lastQueryOtherPlayerPetAttrResponse = res Socket.OnRequestEnd("pet.petHandler.queryOtherPlayerPetAttrRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] pet.petHandler.queryOtherPlayerPetAttrRequest decode error!!" end Socket.OnRequestEnd("pet.petHandler.queryOtherPlayerPetAttrRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, queryOtherPlayerPetAttrRequestEncoder, queryOtherPlayerPetAttrRequestDecoder) end local function addPetPushDecoder(stream) local res = petHandler_pb.AddPetPush() res:ParseFromString(stream) return res end function Pomelo.PetHandler.addPetPush(cb) Socket.On("pet.petPush.addPetPush", function(res) Pomelo.PetHandler.lastAddPetPush = res cb(nil,res) end, addPetPushDecoder) end local function updatePetPushDecoder(stream) local res = petHandler_pb.UpdatePetPush() res:ParseFromString(stream) return res end function Pomelo.PetHandler.updatePetPush(cb) Socket.On("pet.petPush.updatePetPush", function(res) Pomelo.PetHandler.lastUpdatePetPush = res cb(nil,res) end, updatePetPushDecoder) end local function deletePetPushDecoder(stream) local res = petHandler_pb.DeletePetPush() res:ParseFromString(stream) return res end function Pomelo.PetHandler.deletePetPush(cb) Socket.On("pet.petPush.deletePetPush", function(res) Pomelo.PetHandler.lastDeletePetPush = res cb(nil,res) end, deletePetPushDecoder) end --------------------------------Pomelo------------------------------- return Pomelo