require "Message/CommonProto_pb" require "Message/ChatProto_pb" require "Message/FightInfoProto_pb" require "Message/MessageTypeProto_pb" require "Message/PlayerInfoProto_pb" require "Message/GMCommandProto_pb" require "Message/HeroInfoProto_pb" require "Message/MapInfoProto_pb" require "Message/MissionInfoProto_pb" require "Message/ArenaInfoProto_pb" require "Message/Family_pb" require "Message/Expedition_pb" NetManager = {} local this = NetManager local Network function this.Initialize() Game.GlobalEvent:AddEvent(Protocal.Connect, this.RegisterMessage) end function this.RegisterMessage(network) if network.type == SocketType.LOGIN then Network = network end end function this.IsConnect() return Network and Network.isConnected end --请求登录 function this.LoginRequest(openId, func) local data = PlayerInfoProto_pb.LoginRequest() data.device_id_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetDeviceID() or "" data.idfa_sOr_imei_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetIMEICode() or "" data.brand_type_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetDeviceBrand() or "" data.brand_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetDeviceModel() or "" data.os_version_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetSystemVersion() or "" data.dpi_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetScreenRatio() or "" data.operator_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetOperatorName() or "" data.network_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetNetworkType() or "" data.ip_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetLocalIpAddress() or "" data.distinct_id = AppConst.isSDK and openId or "" data.openId = openId data.channel_s = AppConst.isSDKLogin and AppConst.SdkChannel .. "#" .. AppConst.SdkPackageName or "" --pt_pid.."#"..pt_gid data.platform_s = AppConst.isSDK and "ADR" or "PC" local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.LOGIN_REQUEST, MessageTypeProto_pb.LOGIN_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.LoginResponse() msg:ParseFromString(data) Log("msg.resultCode : " .. msg.resultCode) Log("msg.newToken : " .. msg.newToken) if msg.resultCode == 0 then --成功登录 Log(Language[11422]) if func then func(msg) end end AppConst.Token = msg.newToken -- 打点 ThinkingAnalyticsManager.SetDistinctId(AppConst.OpenId) ThinkingAnalyticsManager.SetSuperProperties({ server_id = LoginManager.ServerId, account = AppConst.OpenId, ["Bundle-id"] = AppConst.SdkPackageName, xx_id = AppConst.SdkChannel }) TapDBManager.SetServer(LoginManager.ServerId) end) end --请求玩家数据 function this.PlayerInfoRequest(func) local data = PlayerInfoProto_pb.GetPlayerInfoRequest() data.num = 1 data.str = "shujushuju" local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_PLAYERINFO_REQUEST, MessageTypeProto_pb.GET_PLAYERINFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetPlayerInfoResponse() msg:ParseFromString(data) PlayerManager.uid = msg.player.uid PlayerManager.nickName = msg.player.nickName NameManager.SetRoleName(msg.player.nickName) PlayerManager.level = msg.player.level PlayerManager.exp = msg.player.exp PlayerManager.familyId = msg.player.familyId PlayerManager.head = msg.player.head PlayerManager.frame = msg.player.headFrame == 0 and 80000 or msg.player.headFrame PlayerManager.gold = msg.player.gold PlayerManager.gem = msg.player.gem PlayerManager.chargeGem = msg.player.chargeGem PlayerManager.curMapId = msg.player.curMapId MapManager.isInMap = PlayerManager.curMapId ~= 0 and PlayerManager.curMapId > 100 PlayerManager.maxForce = msg.player.maxForce -- RecruitManager.randCount = msg.randCount % 100 --钻石抽卡已招募次数 用不上了 协议没删 RecruitManager.isTenRecruit = msg.firstTenth --首次十连 PatFaceManager.SetisFirstLogVal(msg.isDayFirst) PlayerManager.userCreateTime = msg.userCreateTime SoulPrintManager.soulEquipPool = msg.SoulEquipPool PlayerManager.designation = msg.player.designation--称号 PlayerManager.skin = msg.player.decrotion--皮肤 PlayerManager.ride = msg.player.ride--坐骑 PlayerManager.rideLevel = msg.player.rideLevel if msg.player.sex then NameManager.SetRoleSex(msg.player.sex) else NameManager.SetRoleSex(ROLE_SEX.BOY) end -- 数据打点 ThinkingAnalyticsManager.CalibrateTime(msg.player.serverTime) ThinkingAnalyticsManager.Login(PlayerManager.uid) ThinkingAnalyticsManager.SetSuperProperties({ role_id = PlayerManager.uid, role_name = PlayerManager.nickName, vip_level = msg.player.vipLevel, }) TapDBManager.SetUser(PlayerManager.uid) TapDBManager.SetLevel(PlayerManager.level) -- PlayerManager.missingRefreshCount = msg.missingRefreshCount--迷宫寻宝妖精刷新次数 PlayerManager.SetMoveSpeedAndMapView() --Log("PlayerManager.ride "..PlayerManager.ride.." "..PlayerManager.rideLevel) -- 设置服务器保存的红点数据 RedpotManager.SetServerRedPointData(msg.redType) FirstRechargeManager.isFirstRecharge = msg.player.isFirstRecharge -- 老式Vip -- VipManager.InitCommonData(msg.vipBaseInfo) VipManager.SetVipLevel(msg.player.vipLevel) PrivilegeManager.InitPrivilegeData(msg.privilege) OperatingManager.SetBasicValues(msg.giftGoodsInfo) OperatingManager.SetHadBuyGoodsId(msg.buyGoodsId) OperatingManager.SetGoodsDurationData(msg.goodsTypeDuration) PlayerManager.InitHandBookData(msg.heroHandBook, msg.equipHandBook) PlayerManager.serverTime = msg.player.serverTime AdventureManager.serverTime = msg.player.serverTime ActivityGiftManager.serverTime = msg.player.serverTime FirstRechargeManager.SetAccumRechargeValue(msg.player.saveAmt) FirstRechargeManager.SetRechargeTime(msg.player.rechargeTime) BindPhoneNumberManager.InitBindInfo(msg.playerBindPhone) QuestionnaireManager.SetQuestionState(msg.QuestionState) PlayerManager.SetMaxEnergy() PlayerManager.InitServerTime() GuideManager.InitData(msg.newPlayerGuidePoint) --临时初始化地图探索的静态数据 MapManager.InitAllMapPgData() -- WorkShopManager.UpdateWorkShopLvAndExp(msg.player.workLevel,msg.player.workExp) RoomManager.CurRoomType = msg.player.curRoomType RoomManager.RoomAddress = msg.player.roomAddreess -- 精英怪数据 local suddBossId = msg.SuddenlyBossInfo.suddBossId local endTime = msg.SuddenlyBossInfo.endTime local findMapId = msg.SuddenlyBossInfo.findMapId EliteMonsterManager.SetEliteData(suddBossId, endTime, findMapId) -- 试炼副本层级奖励 -- MapTrialManager.InitTrialRewardData(msg.towerReceivedReward) TreasureOfSomebodyManagerV2.SetCurrentLevel(msg.treasureLevel) TreasureOfSomebodyManagerV2.SetTreasureBuyStatus(msg.hadBuyTreasure) -- 当前波次 MonsterCampManager.monsterWave = msg.monsterAttackTime OperatingManager.SetSignInData(msg.SignInInfo) -- 无尽副本地图数据 EndLessMapManager.InitMapInfoData(msg.endInfo) --月卡初始化数据 OperatingManager.InitMonthCardData(msg.monthinfos) --每日副本数据 CarbonManager.dailyChallengeInfo=msg.dailyChallengeInfo --猎妖之路阶段 ExpeditionManager.RefreshCurExpeditionLeve(msg.expeditionLeve) HeadManager.InitData() -- 充值金额 VipManager.InitInfoOnLogin(msg) MapManager.PlayedMapTypes = msg.playedMapTypes for _, type in ipairs(msg.playedMapTypes) do Log(Language[11425]..type) end LuckyTurnTableManager.SetTimes(msg.hadLuckTime,msg.hadAdvanceLuckyTime) if func then func(msg) end end) end --请求卡库数据 function this.HeroInfoRequest(_index, func) local data = HeroInfoProto_pb.GetHeroListInfoRequest() data.index = _index local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_HEROINFO_REQUEST, MessageTypeProto_pb.GET_HEROINFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.GetHeroListInfoResponse() msg:ParseFromString(data) HeroManager.InitHeroData(msg.heroList) if msg.isSendFinish then if func then func(msg) end else _index = _index + #msg.heroList this.HeroInfoRequest(_index, func) end end) end --请求刷新卡库 function this.DrawHeroRequest(func) local data = HeroInfoProto_pb.DrawHeroRequest() data.type = 1222 data.str = Language[11426] local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.DRAW_HERO_REQUEST, MessageTypeProto_pb.DRAW_HERO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.DrawHeroResponse() msg:ParseFromString(data) --Log(table.maxn(msg.heroList)) Log(#msg.heroList) --HeroManager.data = msg.player if func then func(msg) end for i = 1, #msg.heroList do local hero = msg.heroList[i] Log("hero.id : " .. hero.id) Log("hero.heroId : " .. hero.heroId) Log("hero.heroType : " .. hero.heroType) Log("hero.level : " .. hero.level) Log("hero.star : " .. hero.star) Log("hero.quality : " .. hero.quality) Log("hero.hp : " .. hero.hp) Log("hero.attack : " .. hero.attack) Log("hero.pDefence : " .. hero.pDefence) Log("hero.mDefence : " .. hero.mDefence) Log("hero.speed : " .. hero.speed) for j = 1, #hero.skillList do local skill = hero.skillList[j] Log("skill.skillId : " .. skill.skillId) Log("skill.skillType : " .. skill.skillType) Log("skill.level : " .. skill.level) Log("skill.star : " .. skill.star) Log("skill.cd : " .. skill.cd) for k = 1, #skill.effectId do local effectId = skill.effectId[k] Log("effectId : " .. effectId) end end for j = 1, #hero.equipList do local equip = hero.equipList[j] Log("equip.id : " .. equip.id) Log("equip.equipId : " .. equip.equipId) Log("equip.level : " .. equip.level) Log("equip.star : " .. equip.star) end end end) end --请求地图战斗,必须在地图中时请求 function this.MapFightInfoRequest(func) local data = FightInfoProto_pb.FightStartRequest() data.fightType = 1 data.type = 2 local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FIGHT_START_REQUEST, MessageTypeProto_pb.FIGHT_START_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.FightStartResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求地图战斗结果,必须在地图中时请求 function this.MapFightResultRequest(monsterGroupId, frames, fightId, fightType, func) local data = FightInfoProto_pb.FightEndRequest() -- 这玩意一直是个常数 data.monsterGroupId = 10000 data.frames = frames if fightId and fightType == 6 then data.fightId = fightId end data.type = fightType -- 这个字段用于退出按钮 if monsterGroupId == 1 then data.dropout = monsterGroupId end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FIGHT_END_REQUEST, MessageTypeProto_pb.FIGHT_END_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.FightEndResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求地图数据 function this.MapInfoRequest(mapId, teamId, func) Log(Language[11427] .. mapId) local data = MapInfoProto_pb.MapEnterRequest() data.mapId = mapId data.teamId = teamId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_ENTER_REQUEST, MessageTypeProto_pb.MAP_ENTER_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapEnterResponse() msg:ParseFromString(data) MapManager.curMapId = mapId MapManager.mapPointList = {} EndLessMapManager.PointNoteDataList = {} MapManager.InitData(msg) --SubmitExtraData({ type = SDKSubMitType.TYPE_ENTER_COPY }) if msg.exploreDetail then MapManager.InitAllMapProgressData(msg.exploreDetail)--更新当前地图探索度 end if func then func(msg) end -- 请求进图后 MapManager.isInMap = true end) end --请求地图离开 function this.MapOutRequest(outType, func, nextMapId) local data = MapInfoProto_pb.MapOutRequest() data.curXY = MapManager.curPos data.mapId = MapManager.curMapId data.outType = outType -- 无尽副本使用 local distMapId = 0 if not nextMapId or nextMapId == 0 then distMapId = 0 else distMapId = nextMapId end data.targetMapId = distMapId Log("data.targetMapId == " .. data.targetMapId) Log("MapOutRequest MapManager.curMapId " .. MapManager.curMapId) for i = 1, #MapManager.stepList do --将当前探索步骤传给后端同步校验 data.cells:append(MapManager.stepList[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_OUT_REQUEST, MessageTypeProto_pb.MAP_OUT_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapOutResponse() msg:ParseFromString(data) if func then func(msg) end MapManager.stepList = {} --收到回调后,清空当前探索步骤 MapManager.pointAtkPower = {} PlayerManager.curMapId = 0 MapManager.curMapId = 0 MapManager.isInMap = false -- MapTrialManager.UpdatePowerValue(0) MapTrialManager.SetBossState(0) --SubmitExtraData({ type = SDKSubMitType.TYPE_EXIT_COPY }) end) end -- 请求开始探索副本地图 function this.CarbonMissionStartRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_START_EXPLORE_REQUEST, MessageTypeProto_pb.MAP_START_EXPLORE_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapStartExploreResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求更新事件 function this.EventUpdateRequest(eventId, optionId, func) local data = MapInfoProto_pb.EventUpdateRequest() data.eventId = eventId data.optionId = optionId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EVENT_UPDATE_REQUEST, MessageTypeProto_pb.EVENT_UPDATE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.EventUpdateResponse() msg:ParseFromString(data) OptionBehaviourManager.UpdateEventPoint(msg, optionId, func) end) end --初始化获取所有地图探索度 --function this.GetMapAccomplishRequest(func) -- Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_MAP_ACCOMPLISH_REQUEST, MessageTypeProto_pb.GET_ALL_MAP_ACCOMPLISH_RESPONSE, nil, function (buffer) -- local data = buffer:DataByte() -- local msg = MapInfoProto_pb.GetMapAccomplishResponse() -- msg:ParseFromString(data) -- MapManager.InitAllMapPgData() -- for i = 1, #msg.mapAccomplishInfo do -- MapManager.InitAllMapProgressData(msg.mapAccomplishInfo[i]) -- end -- if func then -- func(msg) -- end -- end) --end --领取地图探索度箱子奖励 --function this.GetTakeMapBoxRequest(_mapId,_boxWeight, func) -- local data = MapInfoProto_pb.TakeMapBoxRequest() -- data.mapId = _mapId -- data.boxWeight = _boxWeight -- local msg = data:SerializeToString() -- Network:SendMessageWithCallBack(MessageTypeProto_pb.TAKE_MAP_MISSION_BOX_REQUEST, MessageTypeProto_pb.TAKE_MAP_MISSION_BOX_RESPONSE, msg, function(buffer) -- local data = buffer:DataByte() -- local msg = MapInfoProto_pb.TakeMapBoxResponse() -- msg:ParseFromString(data) -- if func then -- func(msg.drop) -- end -- end) --end --请求奖励领取 function this.GetActivityRewardRequest(missionId, activityId, func) local data = PlayerInfoProto_pb.TakeActivityRewardRequest() data.missionId = missionId data.activityId = activityId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.TAKE_ACTIVITY_REWARD_REQUEST, MessageTypeProto_pb.TAKE_ACTIVITY_REWARD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.TakeActivityRewardResponse() msg:ParseFromString(data) --LogGreen(string.format("在线奖励道具%s, 装备%s, 英雄%s", #msg.drop.itemlist, #msg.drop.equipId, #msg.drop.Hero)) if func then func(msg.drop) end end) end --请求领取任务奖励 function this.TakeMissionRewardRequest(type, taskId, func) local data = PlayerInfoProto_pb.TakeMissionRewardRequest() data.type = type data.missionId = taskId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.TAKE_MISSION_REWARD_REQUEST, MessageTypeProto_pb.TAKE_MISSION_REWARD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.TakeMissionRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求活动数据 function this.GetActivityAllRewardRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_ACTIVITY_REQUEST, MessageTypeProto_pb.GET_ALL_ACTIVITY_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetAllActivityResponse() msg:ParseFromString(data) ActivityGiftManager.InitActivityData() ActivityGiftManager.InitActivityServerData(msg) SevenDayCarnivalManager.InitSevenDayScore() DailyRechargeManager.InitRechargeStatus() if func then func(msg) end end) end --请求物品数据 function this.ItemInfoRequest(_index, func) local data = PlayerInfoProto_pb.GetItemInfoRequest() data.index = _index local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ITEMINFO_REQUEST, MessageTypeProto_pb.GET_ITEMINFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetItemInfoResponse() msg:ParseFromString(data) BagManager.InitBagData(msg.itemlist) if msg.isSendFinish then if func then func(msg) end -- 货币数据 ThinkingAnalyticsManager.SetSuperProperties({ coins_amount = BagManager.GetItemCountById(14), diamond_amount = BagManager.GetItemCountById(16), }) else _index = _index + #msg.itemlist this.ItemInfoRequest(_index, func) end end) end --请求所有装备数据 function this.AllEquipRequest(_index, func) if func then func() end -- local data = HeroInfoProto_pb.GetAllEquipRequest() -- data.index = _index -- data.type = 1 -- local msg = data:SerializeToString() -- Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_EQUIP_REQUEST, MessageTypeProto_pb.GET_ALL_EQUIP_RESPONSE, msg, function(buffer) -- local data = buffer:DataByte() -- local msg = HeroInfoProto_pb.GetAllEquipResponse() -- msg:ParseFromString(data) -- EquipManager.InitEquipData(msg.equip) -- if msg.isSendFinish then -- if func then -- func(msg) -- end -- else -- _index = _index + #msg.equip -- this.AllEquipRequest(_index, func) -- end -- end) end --请求所有宝物数据 function this.AllEquipTreasureRequest(_index, func) local data = HeroInfoProto_pb.GetAllEquipRequest() data.index = _index data.type = 4 local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_EQUIP_REQUEST, MessageTypeProto_pb.GET_ALL_EQUIP_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.GetAllEquipResponse() msg:ParseFromString(data) EquipTreasureManager.InitAllEquipTreasure(msg.equip) if msg.isSendFinish then if func then func(msg) end else _index = _index + #msg.equip this.AllEquipTreasureRequest(_index, func) end end) end --请求穿装备 function this.EquipWearRequest(_heroId, _equipIds,_type, func) local data = HeroInfoProto_pb.EquipWearRequest() data.heroId = _heroId data.type =_type for i = 1, #_equipIds do data.equipId:append(_equipIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EQUIP_WEAR_REQUEST, MessageTypeProto_pb.EQUIP_WEAR_RESPONSE, msg, function(buffer) local data = buffer:DataByte() --local msg = HeroInfoProto_pb.GetAllEquipResponse() --msg:ParseFromString(data) if func then func(msg) end end) end --请求脱装备 function this.EquipUnLoadOptRequest(_heroId, _equipIds, _type,func) local data = HeroInfoProto_pb.EquipUnLoadOptRequest() data.heroId = _heroId data.type = _type for i = 1, #_equipIds do data.equipIds:append(tostring(_equipIds[i])) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EQUIP_UNLOAD_OPT_REQUEST, MessageTypeProto_pb.EQUIP_UNLOAD_OPT_RESPONSE, msg, function(buffer) local data = buffer:DataByte() --local msg = HeroInfoProto_pb.GetAllEquipResponse() --msg:ParseFromString(data) if func then func(msg) end end) end --请求宝物强化/精炼 function this.EquipTreasureBuildRequest(_IdDyn, _type,_mats,func) local data = PlayerInfoProto_pb.JewelBuildRequest() data.id = _IdDyn data.type = _type if _mats then for i = 1, #_mats do data.item:append(_mats[i]) end end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.JEWEL_BUILD_REQUEST, MessageTypeProto_pb.JEWEL_BUILD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.GetAllEquipResponse() msg:ParseFromString(data) --EquipTreasureManager.ChangeTreasureLv(_IdDyn,_type) --local equip=EquipTreasureManager.GetSingleTreasureByIdDyn(_idDyn) --UIManager.OpenPanel(UIName.EquipTreasureStrongPopup,equip,_type) if func then func(msg) end end) end --请求装备上锁或者解锁 function this.EquipLockRequest(_equipIds, _type, func) local data = PlayerInfoProto_pb.LockEquip() data.type = _type--1:锁定操作 2:解锁操作 for i = 1, #_equipIds do data.id:append(_equipIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EQUIP_LOCK_REQUEST, MessageTypeProto_pb.EQUIP_LOCK_RESPONSE, msg, function(buffer) --local data = buffer:DataByte() --local msg = HeroInfoProto_pb.GetAllEquipResponse() --msg:ParseFromString(data) EquipManager.SetEquipLockState(_equipIds, 2 - _type)--1:被锁定 0:未锁定 if func then func() end end) end --请求抽卡 function this.RecruitRequest(type, func) local data = HeroInfoProto_pb.HeroRandRequest() data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.HERO_RAND_REQQUEST, MessageTypeProto_pb.HERO_RAND_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.HeroRandResponse() msg:ParseFromString(data) for i = 1, #msg.drop.Hero do local singHeroData = msg.drop.Hero[i] HeroManager.UpdateHeroDatas(singHeroData) end if func then func(msg) end end) end --请求地图单点 function this.MapUpdateEvent(triggerXY, func) local data = MapInfoProto_pb.MapUpdateRequest() data.curXY = MapManager.curPos data.triggerXY = triggerXY Log("MapManager.curPos " .. MapManager.curPos) Log("triggerXY " .. triggerXY) for i = 1, #MapManager.stepList do --将当前探索步骤传给后端同步校验 data.cells:append(MapManager.stepList[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_UDPATE_REQUEST, MessageTypeProto_pb.MAP_UDPATE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapUpdateResponse() msg:ParseFromString(data) --Log("--收到回调后,清空当前探索步骤") MapManager.stepList = {} --收到回调后,清空当前探索步骤 -- 碰到事件点同步一次时间 --Log("探索剩余时间 " .. msg.leftTime) local durationTime = MapManager.totalTime - msg.leftTime PlayerManager.startTime = PlayerManager.serverTime - durationTime if func then func(msg.eventId) end end) end -- 请求快速战斗 function this.QuickFightRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_FAST_FIGHT_REQUEST, MessageTypeProto_pb.MAP_FAST_FIGHT_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.FastFightResponse() msg:ParseFromString(data) MapTrialManager.cell=msg.cell if func then func(msg) end end) end --请求战斗回放 -- type : 1 竞技场 2 巅峰赛 3 公会boss function this.FightRePlayRequest(type, fightId, func) local data = FightInfoProto_pb.FightRePlayRequest() data.type = type data.fightId = fightId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.VIEW_FIGHTREPLAY_REQUEST, MessageTypeProto_pb.VIEW_FIGHTREPLAY_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.FightRePlayResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求 function this.GMEvent(GMstr, func) local data = CommonProto_pb.GMCommand() Log("GMstr " .. GMstr) data.command = GMstr local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GM_REQUEST, MessageTypeProto_pb.GM_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = CommonProto_pb.GmResponse() msg:ParseFromString(data) if msg.drop then if #msg.drop.itemlist > 0 or #msg.drop.equipId > 0 or #msg.drop.Hero > 0 then BagManager.GMCallBackData(msg.drop) end end if func then func(msg) end end) end --请求英雄升级 function this.HeroLvUpEvent(heroId, upLv,oldLv, func) local data = HeroInfoProto_pb.UpHeroLevelRequest() --data.cells = cell Log("heroId " .. heroId .." "..oldLv ..Language[11428] .. upLv) data.heroId = heroId data.targetLevel = upLv local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.UP_HERO_LEVEL_REQUEST, MessageTypeProto_pb.UP_HERO_LEVEL_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.UpHeroLevelResponse() msg:ParseFromString(data) Log(Language[11429]..msg.targetLevel) if oldLv < 20 and msg.targetLevel >= 20 then --远征初始化血量 ExpeditionManager.InitHeroHpValue(heroId) end if func then func(msg) end end) end --请求英雄升星 function this.HeroUpStarEvent(heroId, consumeMaterials, func) local data = HeroInfoProto_pb.UpHeroStarRequest() data.heroId = heroId data.type = 1 for i = 1, #consumeMaterials do local c = data.consumeMaterials:add() c.position = i for j = 1, #consumeMaterials[i] do c.heroIds:append(consumeMaterials[i][j]) end end --for j = 1, #data.ConsumeMaterial do -- Log("data.consumeMaterials.pos "..data.ConsumeMaterial[j].position) -- Log("data.consumeMaterials.heroIds "..#data.ConsumeMaterial[j].heroIds) --end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.UP_HERO_STAR_REQUEST, MessageTypeProto_pb.UP_HERO_STAR_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = CommonProto_pb.Drop() msg:ParseFromString(data) if func then func(msg) end end) end --请求更新新手引导记录 function this.SaveGuideDataRequest(type, id, func) local data = PlayerInfoProto_pb.SaveNewPlayerPointRequest() data.newPlayerGuidePoint.type = type data.newPlayerGuidePoint.id = id local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SAVE_NEW_PLAYER_GUIDE_POINT_REQUEST, MessageTypeProto_pb.SAVE_NEW_PLAYER_GUIDE_POINT_RESPONSE, msg, function(buffer) if func then func() end end) end --请求编队信息 function this.TeamInfoRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_TEAMPOS_INFO_REQUEST, MessageTypeProto_pb.GET_TEAMPOS_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.GetAllTeamPosResponse() msg:ParseFromString(data) FormationManager.UpdateFormation(msg) if func then func(msg) end end) end --保存编队信息 function this.TeamInfoSaveRequest(curFormation, func) local data = HeroInfoProto_pb.TeamposSaveRequest() data.TeamPosInfo.teamId = curFormation.teamId --data.TeamPosInfo.teamName = curFormation.teamName for i = 1, #curFormation.teamHeroInfos do local teamInfo = data.TeamPosInfo.teamHeroInfos:add() --LogError("curFormation.teamHeroInfos[i].heroId "..curFormation.teamHeroInfos[i].heroId) --LogError("curFormation.teamHeroInfos[i].position "..curFormation.teamHeroInfos[i].position) teamInfo.heroId = curFormation.teamHeroInfos[i].heroId teamInfo.position = curFormation.teamHeroInfos[i].position end for i = 1, #curFormation.teamPokemonInfos do local teamPokemonInfo = data.TeamPosInfo.teamPokemonInfos:add() teamPokemonInfo.pokemonId = curFormation.teamPokemonInfos[i].pokemonId teamPokemonInfo.position = curFormation.teamPokemonInfos[i].position end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.TEAM_POS_SAVE_REQUEST, MessageTypeProto_pb.TEAM_POS_SAVE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() if func then func(msg.pokemonInfo) end end) end --请求获取任务消息 function this.MissionInfoRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.MISSION_GET_ALL_REQUEST, MessageTypeProto_pb.MISSION_GET_ALL_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MissionInfoProto_pb.MissionGetAllResponse() msg:ParseFromString(data) MissionManager.InitMissionInfo(msg) if func then func(msg) end end) end -- 请求开启任务信息 function this.MissionOpenRequest(missionId, func) local data = MissionInfoProto_pb.OpenMissionRequest() data.missionId = missionId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MISSION_OPEN_REQUEST, MessageTypeProto_pb.MISSION_OPEN_RESPONSE, msg, function(buffer) local data = buffer:DataByte() if func then func(msg) end end) end --请求获取异妖消息 function this.DiffMonsterRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_POKEMON_REQUEST, MessageTypeProto_pb.GET_ALL_POKEMON_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.GetAllPokemonResponse() msg:ParseFromString(data) DiffMonsterManager.Init(msg.pokemonInfo) if func then func(msg) end end) end --请求异妖组件放置升级 function this.DemonCompUpRequest(diffMonId, compId, func) local data = HeroInfoProto_pb.PokenmonUpLevelRequest() data.pokemonId = diffMonId data.comonpentId = compId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.POKEMON_COMONPENT_LEVELUP_REQUEST, MessageTypeProto_pb.POKEMON_COMONPENT_LEVELUP_RESPONSE, msg, function(buffer) if func then func(msg) end end) end --请求异妖进阶 function this.DemonUpRequest(_id, func) Log("_id " .. _id) local data = HeroInfoProto_pb.PokemonAdvancedRequest() data.pokemonId = _id local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.POKEMON_ADVANCED_REQUEST, MessageTypeProto_pb.POKEMON_ADVANCED_RESPONSE, msg, function(buffer) if func then func(msg) end end) end --请求工坊信息 function this.GetWorkShopInfoRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_WORKSHOP_INFO_REQUEST, MessageTypeProto_pb.GET_WORKSHOP_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetWorkShopInfoResponse() msg:ParseFromString(data) WorkShopManager.InitWorkShopData(msg) if func then func(msg) end end) end --请求基础锻造 function this.GetWorkBaseRequest(_materialId, _nums, func) local data = PlayerInfoProto_pb.WorkShopFoundationRequest() data.materialId = _materialId data.nums = _nums local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.WORKSHOP_FOUNDATION_REQUEST, MessageTypeProto_pb.WORKSHOP_FOUNDATION_RESPONSE, msg, function(buffer) --local data = buffer:DataByte() --local msg = HeroInfoProto_pb.TakeMissionResponse() --msg:ParseFromString(data) if func then func() end end) end --请求装备锻造 function this.GetWorkShopEquipCreateRequest(_materialId, _runneIds, _nums, func) local data = PlayerInfoProto_pb.WorkShopEquipCreateRequest() data.equipTid = _materialId data.nums = _nums for i = 1, #_runneIds do data.runneIds:append(_runneIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.WORKSHOP_EQUIP_CREATE_REQUEST, MessageTypeProto_pb.WORKSHOP_EQUIP_CREATE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.WorkShopEquipCreateResponse() msg:ParseFromString(data) if msg.type == 1 then --工坊 if #msg.drop.itemlist > 0 then --防具 --for i = 1, #msg.drop.itemlist do -- BagManager.UpdateBagData(msg.drop.itemlist[i]) -- if func then -- func(msg.drop.itemlist[i]) -- end --end end if #msg.drop.equipId > 0 then --装备 --防具 if #msg.drop.equipId <= 1 then --工坊一个装备时 弹 装备工坊成功界面 for i = 1, #msg.drop.equipId do EquipManager.UpdateEquipData(msg.drop.equipId[i]) if func then func(msg.drop.equipId[i]) end end else --工坊多个装备时 弹 恭喜获得界面 if func then func(msg.drop) end end end if #msg.drop.Hero > 0 then end end end) end --请求装备重铸 function this.GetWorkShopEquipRebuildRequest(_equipId, _consumeEquipIds, func) local data = PlayerInfoProto_pb.WorkShopRebuildRequest() data.equipId = _equipId data.consumeEquipIds:append(_consumeEquipIds) local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.WORKSHOP_REBUILD_REQUEST, MessageTypeProto_pb.WORKSHOP_REBUILD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.WorkShopRebuildRespoonse() msg:ParseFromString(data) if func then func(msg.equip) end end) end --请求装备重铸二次确认 function this.GetWorkShopEquipRebuildSureRequest(_isSure, func) Log(Language[11430] .. _isSure) local data = PlayerInfoProto_pb.WorkShopRebuildConfirmRequest() data.state = _isSure local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.WORKSHOP_REBUILD_CONFIRM_REQUEST, MessageTypeProto_pb.WORKSHOP_REBUILD_CONFIRM_RESONSE, msg, function(buffer) if func then func(msg.equip) end end) end --请求工坊解锁蓝图 function this.GetWorkShopAvtiveLanTuRequest(_activiteId, _type, func) local data = PlayerInfoProto_pb.ActiviteWorkShopReqeust() data.type = _type data.activiteId = _activiteId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ACTIVITE_WORKSHOP_REQUEST, MessageTypeProto_pb.ACTIVITE_WORKSHOP_RESPONSE, msg, function(buffer) --local data = buffer:DataByte() --local msg = HeroInfoProto_pb.TakeMissionResponse() --msg:ParseFromString(data) if func then func() end end) end --请求工坊升级 function this.WorkShopLvUpRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.WORKSHOP_LEVELUP_REQUEST, MessageTypeProto_pb.WORKSHOP_LEVELUP_RESPONSE, nil, function(buffer) WorkShopManager.UpdataWorkShopLvAndExp() if func then func() end end) end --请求工坊天赋树升级 function this.WorkShopTreeLvUpRequest(treeId, upLv, func) Log("curTreeConfigData.TechId " .. treeId .. Language[11431] .. upLv) local data = PlayerInfoProto_pb.WorkTechnologyLevelRequest() data.id = treeId data.targetLevel = upLv local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.WORKSHOP_TECHNOLOGY_LEVEL_REQUEST, MessageTypeProto_pb.WORKSHOP_TECHNOLOGY_RESPONSE, msg, function(buffer) if func then func() end end) end --请求工坊天赋树重置 function this.WorkShopTreeResetRequest(professionId, func) local data = PlayerInfoProto_pb.WorkTechnologyResetRequest() data.professionId = professionId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.WORKSHOP_TECHNOLOGY_RESET_REQUEST, MessageTypeProto_pb.WORKSHOP_TECHNOLOGY_RESET_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.WorkTechnologyResetResponse() msg:ParseFromString(data) UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1) if func then func() end end) end ----请求冒险数据 --function this.GetAdventureInfoRequest(func) -- Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ADVENTURE_INFO_REQUEST, MessageTypeProto_pb.GET_ADVENTURE_INFO_RESPONSE, nil, function(buffer) -- local data = buffer:DataByte() -- local msg = FightInfoProto_pb.GetAdventureStateInfoResponse() -- msg:ParseFromString(data) -- AdventureManager.InitAdventureData(msg) -- if func then -- func(msg) -- end -- end) --end -- ----请求冒险驻扎 --function this.AdventureStationRequest(pos, heroList, func) -- local data = FightInfoProto_pb.AventureStationRequest() -- data.position = pos -- for i = 1, #heroList do -- Log("lllllllllllllllllllllllllllll========== " .. heroList[i]) -- data.heroIdList:append(heroList[i]) -- end -- --print(pos, duration, heroList) -- local msg = data:SerializeToString() -- Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_STATION_REQUEST, MessageTypeProto_pb.ADVENTURE_STATION_RESPONSE, msg, function(buffer) -- Log("请求冒险成功。。。。") -- AdventureManager.RefreshAdventureData(pos, heroList) -- if func then -- func() -- end -- end) --end -- ----请求冒险奖励 --function this.TakeAventureRewardRequest(pos, func) -- local data = FightInfoProto_pb.TakeAventureRewardRequest() -- data.position = pos -- local msg = data:SerializeToString() -- Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_REWARD_REQUEST, MessageTypeProto_pb.ADVENTURE_REWARD_RESPONSE, msg, function(buffer) -- local data = buffer:DataByte() -- local msg = FightInfoProto_pb.TakeAventureRewardResponse() -- msg:ParseFromString(data) -- Log("冒险奖励领取成功!!!") -- AdventureManager.TakeAventureReward(msg.Drop, pos) -- AdventureManager.RefreshAdventureData(pos) -- if func then -- func() -- end -- end) --end --请求所有邮件信息 function this.GetAllMailData(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_MAIL_INFO_REQUEST, MessageTypeProto_pb.GET_ALL_MAIL_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetAllMailInfoResponse() msg:ParseFromString(data) Log(Language[11432] .. #msg.mialList) MailManager.InitMailDataList(msg.mialList) if func then func(msg.mialList) end end) end --请求读取邮件信息 function this.ReadSingleMailData(_mailId, func) local data = PlayerInfoProto_pb.MailReadRequest() data.mailId = _mailId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAIL_READ_REQUEST, MessageTypeProto_pb.MAIL_READ_RESPONSE, msg, function(buffer) if func then func() end end) end --请求领取邮件信息 function this.GetSingleMailRewardData(_mailIds, func) local data = PlayerInfoProto_pb.TakeMailRequest() for i = 1, #_mailIds do data.mailIds:append(_mailIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAIL_TAKE_MAIL_ITEM_REQUEST, MessageTypeProto_pb.MAIL_TAKE_MAIL_ITEM_RESPONESE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.TakeMailResponse() msg:ParseFromString(data) if func then func(msg.drop) end end) end --请求删除邮件 function this.DelMailData(_mailIds, func) local data = PlayerInfoProto_pb.MailDelRequest() for i = 1, #_mailIds do Log(Language[11433].._mailIds[i]) data.mailId:append(_mailIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAIL_DELETE_REQUEST, MessageTypeProto_pb.MAIL_DELETE_RESPONSE, msg, function(buffer) --local data = buffer:DataByte() --local msg = PlayerInfoProto_pb.TakeMailResponse() --msg:ParseFromString(data) if func then func() end end) end --请求所有关卡信息 function this.GetAllFightDataRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_LEVE_DIFFICULTT_REQUEST, MessageTypeProto_pb.GET_ALL_LEVE_DIFFICULTT_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.getAllLevelDifficultyInfosResponse() msg:ParseFromString(data) --FightManager.InitAllMapPgData(msg.levelDifficultyInfos) MapTrialManager.RefreshTrialInfo(msg.towerCopyInfo) CarbonManager.InitCarbonState(msg.mapInfos) CarbonManager.InitNormalState(msg.playedGenMapId) CarbonManager.InitCountDownProcess() CarbonManager.difficultyId = msg.difficultMapOptions CarbonManager.hasGetRewardCostStar = msg.starNum if func then func(msg.levelDifficultyInfos) end end) end --请求单个关卡战斗 function this.LevelStarFightDataRequest(_monsterGroupId, _fightId, func) local data = FightInfoProto_pb.FightStartRequest() data.type = 6 data.fightId = _fightId data.teamId = FormationManager.curFormationIndex local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FIGHT_START_REQUEST, MessageTypeProto_pb.FIGHT_START_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.FightStartResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求单个关卡扫荡 function this.GetMopUpFightDataRequest(_type, _fightId, _num, _targetItemId, _targetItemNum, func) local data = FightInfoProto_pb.SweepRightRequest() data.type = _type data.fightId = _fightId data.num = _num data.targetItemId = _targetItemId data.targetItemNum = _targetItemNum Log("data.targetItemId " .. _targetItemId .. " " .. _targetItemNum) local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SWEEP_RIGHT_REQUEST, MessageTypeProto_pb.SWEEP_RIGHT_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.SweepRightResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求副本排行榜 function this.MapGetRankInfoRequest(_mapId, func) local data = MapInfoProto_pb.MapGetRankInfoRequest() data.mapId = _mapId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_GET_RANK_INFO_REQUEST, MessageTypeProto_pb.MAP_GET_RANK_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapGetRankInfoResponse() msg:ParseFromString(data) Log(Language[11434] .. #msg.mapRankInfo) if func then func(msg.mapRankInfo) end end) end --请求副本扫荡 function this.MapSweepRequest(_mapId, _sweepCount, func) local data = MapInfoProto_pb.MapSweepRequest() data.mapId = _mapId data.sweepCount = _sweepCount Log(Language[11435] .. data.mapId .. " " .. data.sweepCount) local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_SWEEP_REQUEST, MessageTypeProto_pb.MAP_SWEEP_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapSweepResponse() msg:ParseFromString(data) Log(Language[11434] .. #msg.drop) if func then func(msg) end end) end --请求道具 装备 分解 function this.UseAndPriceItemRequest(_type, _items, func) --_type 1:分解物品 2:分解装备3:分解妖灵师 4:分解法宝 5:分解魂印 6:自选宝箱 local data = PlayerInfoProto_pb.UseAndPriceItemRequest() Log("_type " .. _type) data.type = _type --data.itemId = _itemId if _type == 1 or _type == 0 then for i = 1, #_items do local itemData = data.items:add() itemData.itemId = _items[i].itemId itemData.itemNum = _items[i].itemNum end elseif _type == 2 then for i = 1, #_items do Log(Language[11436].._items[i]) data.equipIds:append(tostring(_items[i])) end elseif _type == 3 then for i = 1, #_items do data.heroIds:append(_items[i]) end elseif _type == 4 then for i = 1, #_items do data.equipIds:append(_items[i]) end elseif _type == 5 then for i = 1, #_items do data.equipIds:append(_items[i]) end elseif _type == 6 then data.itemId = _items[2] local itemData = data.items:add() itemData.itemId = _items[1] itemData.itemNum = _items[3] end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.USER_AND_PRICE_ITEM_REQUEST, MessageTypeProto_pb.USER_AND_PRICE_ITEM_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.UseAndPriceItemResponse() msg:ParseFromString(data) if func then func(msg.drop) end end) end --请求碎片合成 function this.HeroComposeRequest(_item, func) local data = HeroInfoProto_pb.HeroComposeRequest() data.item.itemId = _item.itemId data.item.itemNum = _item.itemNum local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.HERO_COMPOSE_REQUEST, MessageTypeProto_pb.HERO_COMPOSE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.HeroComposeResponse() msg:ParseFromString(data) if func then func(msg.drop) end end) end --新手引导任意名字请求 function this.GetRandomNameRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.RANDOMNAME_REQUEST, MessageTypeProto_pb.RANDOMNAME_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.RandomNameResponse() msg:ParseFromString(data) if func then func(msg.randomName) end end) end --玩家名字更改请求 function this.ChangeUserNameRequest(type, name, teamPosId, sex, func) local data = PlayerInfoProto_pb.ReNameRequest() data.type = type data.name = name if (teamPosId ~= nil) then data.teamPosId = teamPosId end if sex then data.sex = sex else data.sex = ROLE_SEX.BOY end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.RENAME_REQUEST, MessageTypeProto_pb.RENAME_RESPONSE, msg, function() if func then func() end end) end -- 请求副本完成数据 function this.CarbonInfoRequest() end -- 请求获取竞技场基础数据 function this.RequestBaseArenaData(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ARENA_INFO_REQUEST, MessageTypeProto_pb.ARENA_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.GetArenaInfoResponse() msg:ParseFromString(data) ArenaManager.ReceiveBaseArenaData(msg) if func then func(msg) end end) end -- 请求获取竞技场排行数据 function this.RequestArenaRankData(page, func) local data = ArenaInfoProto_pb.GetArenaRankInfoRequest() data.page = page or 1 local rqmsg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ARENA_RANK_REQUEST, MessageTypeProto_pb.ARENA_RANK_RESPONSE, rqmsg, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.GetArenaRankInfoResponse() msg:ParseFromString(data) ArenaManager.ReceiveArenaRankData(page, msg) if func then func(page, msg) end end) end --请求秘盒当前周期和抽取次数请求 function this.GetSecretBoxInfoRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_SECRETBOX_REQUEST, MessageTypeProto_pb.GET_SECRETBOX_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetSecretBoxInfoResponse() msg:ParseFromString(data) SecretBoxManager.SeasonTime = msg.season SecretBoxManager.count = msg.count SecretBoxManager.GetDifferDemonsBoxData() if func then func(msg) end end) end --请求秘盒抽奖协议 function this.GetSecretBoxRewardRequest(type, func) local data = PlayerInfoProto_pb.SecretBoxRandomRequest() data.typeId = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SECRETBOX_RANDOM_REQUEST, MessageTypeProto_pb.SECRETBOX_RANDOM_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.SecretBoxRandomResponse() msg:ParseFromString(data) --Dump(msg.drop) Log(Language[11437] .. #msg.drop.itemlist) if func then func(msg) end end) end -- 请求挑战 function this.RequestArenaChallenge(teamId, targetUid, isSkip, func) local data = ArenaInfoProto_pb.ArenaChallengeRequest() data.teamId = teamId data.challengeUid = targetUid data.skipFight = isSkip local rqmsg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ARENA_CHALLENGE_REQUEST, MessageTypeProto_pb.ARENA_CHALLENGE_RESPONSE, rqmsg, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.ArenaChallengeResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 竞技场刷新对手数据 function this.RequestNewArenaEnemy(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ARENA_RANDOM_ENEMY_REQUEST, MessageTypeProto_pb.ARENA_RANDOM_ENEMY_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.ArenaRandomResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 竞技场获取防守记录 function this.RequestArenaRecord(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ARENA_DEFENSE_REQUEST, MessageTypeProto_pb.ARENA_DEFENSE_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.ArenaRecordInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end --冒险挂机状态请求 function this.GetAdventureStateInfoRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_INFO_REQUEST, MessageTypeProto_pb.ADVENTURE_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.GetAdventureStateInfoResponse() msg:ParseFromString(data) AdventureManager.adventureStateInfoList = msg.adventureStateInfoList AdventureManager.GetAdventureData() AdventureManager.OnFlushShowData() if func then func(msg) end end) end --冒险召唤外敌协议 function this.CallAlianInvasionRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_CALL_BOSS_REQUEST, MessageTypeProto_pb.ADVENTURE_CALL_BOSS_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.AdventureCallBossResponse() msg:ParseFromString(data) if func then func(msg) end end) end --外敌界面Boss挑战请求 function this.GetAdventurenBossChallengeRequest(func, bossId, teamId, fightTimes, skipFight) local data = FightInfoProto_pb.AdventurenBossChallengeRequest() data.bossId = tostring(bossId) data.teamId = teamId data.fightTimes = fightTimes data.skipFight = skipFight local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_BOSS_CHALLENGE_REQEUST, MessageTypeProto_pb.ADVENTURE_BOSS_CHALLENGE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.AdventurenBossChallengeResponse() msg:ParseFromString(data) if func then func(msg) end end) end --外敌界面Boss分享请求 function this.GetAdventureBossShareRequest(func, bossId) local data = FightInfoProto_pb.AdventurenBossChallengeRequest() data.bossId = bossId local rqmsg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_BOSS_SHARE_REQUEST, MessageTypeProto_pb.ADVENTURE_BOSS_SHARE_RESPONSE, rqmsg, function() if func then func() end end) end -- 外敌入侵敌人信息获取 function this.RequestAdventureEnemyList(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_BOSSHURT_REQEUST, MessageTypeProto_pb.ADVENTURE_BOSSHURT_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.AdventureBossInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end --冒险伤害排行榜 function this.GetAdventurnInjureRankRequest(injueryData, _index, func) local data = FightInfoProto_pb.AdventurnRankRequest() --local dataNum=0 data.page = _index local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_BOSS_RANK_REQUEST, MessageTypeProto_pb.ADVENTURE_BOSS_RANK_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.AdventurnRankResponse() msg:ParseFromString(data) table.insert(injueryData, msg) if #msg.adventureRankItemInfo < 20 then if func then func(injueryData) end else --dataNum=dataNum+#msg.adventureRankItemInfo _index = _index + 1 this.GetAdventurnInjureRankRequest(injueryData, _index, func) end --if func then -- func(msg) --end end) end --冒险伤害排行榜(总排行榜) function this.GetAdventureRankRequest(page, func) local data = FightInfoProto_pb.AdventurnRankRequest() data.page = page local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_BOSS_RANK_REQUEST, MessageTypeProto_pb.ADVENTURE_BOSS_RANK_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.AdventurnRankResponse() msg:ParseFromString(data) if func then func(page, msg) end end) end --冒险解锁Boss战斗请求 function this.AdventurnChallengeRequest(func, arenaId, teamId, skipFight) local data = FightInfoProto_pb.AdventurnChallengeRequest() data.arenaId = arenaId data.teamId = teamId data.skipFight = skipFight local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_CHALLENGE_REQUEST, MessageTypeProto_pb.ADVENTURE_CHALLENGE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.AdventurnChallengeResponse() msg:ParseFromString(data) if func then func(msg) end end) end --冒险区域升级请求 function this.GetAdventurnUpLevelRequest(func, arenaId) local data = FightInfoProto_pb.AdventureUpLevelRequest() data.arenaId = arenaId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_UPLEVEL_REQUEST, MessageTypeProto_pb.ADVENTURE_UPLEVEL_RESPONSE, msg, function() if func then func() end end) end --冒险区域领取奖励请求(position:0代表消耗时光沙漏,1代表消耗妖晶) function this.GetAventureRewardRequest(func, type, position) local data = FightInfoProto_pb.TakeAventureRewardRequest() data.type = type if position then data.position = position else data.position = -1 end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ADVENTURE_REWARD_REQUEST, MessageTypeProto_pb.ADVENTURE_REWARD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.TakeAventureRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 获取主商店所有商店数据 function this.RequestMainShopData(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_STARE_INFOS_REQUEST, MessageTypeProto_pb.GET_STARE_INFOS_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetStoreInfosResponse() msg:ParseFromString(data) ShopManager.ReceiveShopData(msg) if func then func(msg) end end) end -- 请求购买物品 function this.RequestBuyShopItem(shopType, shopItemId, num, func) local data = PlayerInfoProto_pb.BuyStoreItemRequest() data.storeId = shopType data.itemId = shopItemId data.itemNum = num local rqmsg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.BUY_STORE_ITEM_REQUEST, MessageTypeProto_pb.BUY_STORE_ITEM_RESPONSE, rqmsg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.BuyStoreItemResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求刷新商店信息 function this.RequestRefreshShop(shopType, isAuto, func) local data = PlayerInfoProto_pb.StoreGoodsRefreshRequest() data.type = isAuto and 1 or 0 data.storeId = shopType local rqmsg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.STORE_GOODS_REFRESH_REQUEST, MessageTypeProto_pb.STORE_GOODS_REFRESH_RESPONSE, rqmsg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.StoreGoodsRefreshResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求获取所有功能状态 function this.GetAllFunState(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_FUNCTIONOFTIME_REQUEST, MessageTypeProto_pb.GET_FUNCTIONOFTIME_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetFunctionOfTimeResponse() msg:ParseFromString(data) ActTimeCtrlManager.InitMsg(msg) if func then func(msg) end end) end -------------------Vip特权相关----------------- --提升Vip等级 function this.RequestVipLevelUp(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.VIP_LEVELUP_REQEUST, MessageTypeProto_pb.VIP_LEVELUP_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.VipLevelUpResponse() msg:ParseFromString(data) VipManager.InitCommonData(msg.vipBaseInfo) TaskManager.SetTypeTaskList(TaskTypeDef.VipTask, msg.userMissionInfo) AdventureManager.UpdateStateTime() SubmitExtraData({ type = SDKSubMitType.TYPE_VIP_LEVELUP }) if func then func(msg) end end) end --领取Vip权益奖励(等级,每日) function this.RequestReceiveVipRights(type, func) local data = PlayerInfoProto_pb.VipTakeBoxRequest() data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.VIP_TAKE_REWARD_REQUEST, MessageTypeProto_pb.VIP_TAKE_REWARD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.VipTakeBoxResponse() msg:ParseFromString(data) if func then func(msg) end end) end --用户战力提升变化 function this.RequestUserForceChange(teamId, func) local data = PlayerInfoProto_pb.UserForceChangeRequest() data.teamId = teamId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.USER_FORCE_CHANGE_REQUEST, MessageTypeProto_pb.USER_FORCE_CHANGE_RESPONSE, msg, function() if func then func() end end) end ---------------------------------------------- --请求任务信息 function this.RequestMission(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_MISSION_REQUEST, MessageTypeProto_pb.GET_MISSION_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetMissionResponse() msg:ParseFromString(data) TaskManager.InitTypeTaskList(msg.userMissionInfo) if func then func(msg) end end) end --成长礼金 function this.RequestBuyGiftGoods(Id, func) local data = PlayerInfoProto_pb.TestBuyGiftGoodsRequest() data.goodsId = Id local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.TEST_BUY_GIGT_GOODS_REQEUST, MessageTypeProto_pb.TEST_BUY_GIGT_GOODS_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.BuyGoodsDropIndication() msg:ParseFromString(data) if func then func(msg) end end) end --获取好友信息请求 function this.RequestGetFriendInfo(type, func) local data = PlayerInfoProto_pb.GetFriendInfoRequest() data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_FRIEND_INFO_REQUEST, MessageTypeProto_pb.GET_FRIEND_INFO_REPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetFriendInfoResponse() msg:ParseFromString(data) GoodFriendManager.GetFriendInfoRequest(type, msg) if func then func(msg) end end) end -- 好友切磋 function this.RequestPlayWithSomeOne(uid, teamId, func) local data = ArenaInfoProto_pb.PlayWithSbRequest() data.challengeUid = uid data.myteamId = teamId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.PLAY_WITH_SB_REQUEST, MessageTypeProto_pb.PLAY_WITH_SB_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.PlayWithSbResponse() msg:ParseFromString(data) if func then func(msg) end end) end --申请好友请求 function this.RequestInviteFriend(inviteUids, func) local data = PlayerInfoProto_pb.InviteFriendRequest() data.inviteUids:append(inviteUids) local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FRIEND_INVITE_REQUEST, MessageTypeProto_pb.FRIEND_INVITE_RESPONSE, msg, function(buffer) --local data = buffer:DataByte() --local msg = PlayerInfoProto_pb.InviteFriendResponse() -- msg:ParseFromString(data) if func then func() end end) end --申请为好友操作 function this.RequestFriendInviteOperation(type, friendId, func) local data = PlayerInfoProto_pb.FriendInviteOperationRequest() data.type = type data.friendId = friendId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FRIEND_INVITE_OPERATION_REQUEST, MessageTypeProto_pb.FRIEND_INVITE_OPERATION_RESPONSE, msg, function(buffer) --local data = buffer:DataByte() --local msg = PlayerInfoProto_pb.FriendInviteOperationResponse() --msg:ParseFromString(data) if func then func() end end) end --赠送好友精力 function this.RequestFriendGivePresent(type, friendId, func) local data = PlayerInfoProto_pb.FriendGivePresentRequest() data.type = type data.friendId = friendId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FRIEND_GIVE_PRESENT_REQUEST, MessageTypeProto_pb.FRIEND_GIVE_PRESENT_RESPONSE, msg, function(buffer) --local data = buffer:DataByte() --local msg = PlayerInfoProto_pb.FriendGivePresentResponse() --msg:ParseFromString(data) if func then func() end end) end --删除好友 function this.RequestDelFriend(friendId, func) local data = PlayerInfoProto_pb.DelFriendRequest() data.friendId = friendId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.DEL_FRIEND_REQUEST, MessageTypeProto_pb.DEL_FRIEND_RESPONSE, msg, function(buffer) --local data = buffer:DataByte() --local msg = PlayerInfoProto_pb.DelFriendResponse() --msg:ParseFromString(data) if func then func() end end) end --领取一个人和所有人的精力值 function this.RequestFriendTakeHeart(type, friendId, func) local data = PlayerInfoProto_pb.FriendTakeHeartRequest() data.type = type data.friendId = friendId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FRIEND_TAKE_HEART_REQUEST, MessageTypeProto_pb.FRIEND_TAKE_HEART_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.FriendTakeHeartResponse() msg:ParseFromString(data) if func then func(msg) end end) end --根据名字查找好友 function this.RequestFriendSearch(name, func) local data = PlayerInfoProto_pb.FriendSearchRequest() data.name = name local msg = data:SerializeToString() GoodFriendManager.friendSearchInfo = {} Game.GlobalEvent:DispatchEvent(GameEvent.Friend.OnFriendSearch, this.friendSearchInfo) Network:SendMessageWithCallBack(MessageTypeProto_pb.FRIEND_SEARCH_REQUEST, MessageTypeProto_pb.FRIEND_SEARCH_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.FriendSearchResponse() msg:ParseFromString(data) if func then func(msg) end end) end --刷新好友在线状态 function this.RequestRefreshFriendState(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.REFRESH_FRIEND_STATE_REQEUST, MessageTypeProto_pb.REFRESH_FRIEND_STATE_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.RefreshFriendStateResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 加入/移除黑名单 function this.RequestOptBlackList(type, uid, func) local data = PlayerInfoProto_pb.FriendBlackOptRequest() data.type = type data.blackUid = uid local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FRIEND_BLACK_OPT_REQUEST, MessageTypeProto_pb.FRIEND_BLACK_OPT_RESPONSE, msg, function(buffer) if func then func() end end, true) end -- 请求聊天数据 function this.RequestChatMsg(type, msgId, func) local data = ChatProto_pb.GetChatMessageInfoRequest() data.chatType = type data.messageId = msgId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_CHAT_MESSAGE_REQUEST, MessageTypeProto_pb.GET_CHAT_MESSAGE_REPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = ChatProto_pb.GetChatMessageInfoResponse() msg:ParseFromString(data) if func then func(msg) end end, true) end -- 请求发送聊天数据 function this.RequestSendChatMsg(type, msg, friend, func) if string.utf8len(msg) > 140 then PopupTipPanel.ShowTip(Language[11438]) return end local data = ChatProto_pb.SendChatInfoReqest() data.chatType = type data.message = msg data.friendId = friend local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SEND_CHAT_INFO_REQUEST, MessageTypeProto_pb.SEND_CHAT_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = ChatProto_pb.SendChatInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end --------------------戒灵天赋--------------- --请求获取天赋消息 function this.TalentRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_RINGFIRE_INFO_REQUEST, MessageTypeProto_pb.GET_RINGFIRE_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.GetAllRingFireResponse() msg:ParseFromString(data) TalentManager.InitLocalTalentData(msg.ringFireInfo) if func then func(msg) end end) end --请求天赋鬼火激活 function this.TalentRingFireActiveRequest(talentId, compId, func) local data = HeroInfoProto_pb.RingFireLoadRequest() data.pokemonId = talentId data.comonpentId = compId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.RINGFIRE_LOAD_REQUEST, MessageTypeProto_pb.RINGFIRE_LOAD_RESPONSE, msg, function() if func then func() end end) end --请求戒灵天赋进阶 function this.TalentUpGradRequest(_id, func) local data = HeroInfoProto_pb.RingFirAdvanceRequest() data.pokemonId = _id local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.RINGFIRE_ADVANCED_REQUEST, MessageTypeProto_pb.RINGFIRE_ADVANCED_RESPONSE, msg, function() if func then func() end end) end --------------------------------------- -- 请求在地图外挑战精英怪 function this.RequestFightEliteMonsterOutMap(func) local data = FightInfoProto_pb.FightStartRequest() data.type = 3 data.teamId = FormationManager.curFormationIndex local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FIGHT_START_REQUEST, MessageTypeProto_pb.FIGHT_START_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.FightStartResponse() msg:ParseFromString(data) if func then func(msg) end end) end --副本普通星级奖励请求 function this.RequestFbStarReward(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FB_STAR_REWARD_REQUEST, MessageTypeProto_pb.FB_STAR_REWARD_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.FbStarRewardResponse() msg:ParseFromString(data) if func then func(msg.FbStarReward) end end) end -- 重置爬塔副本 function this.RequestResetTrialMap(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_TOWER_RESET_REQUEST, MessageTypeProto_pb.MAP_TOWER_RESET_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapTowerResetResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 召唤副本首领 function this.RequestMapBoss(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_TOWER_CALL_CHIEF_REQUEST, MessageTypeProto_pb.MAP_TOWER_CALL_CHIEF_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapTowerCallChiefResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 使用炸弹 function this.RequestUseBomb(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_TOWER_USEBOMB_REQUEST, MessageTypeProto_pb.MAP_TOWER_USEBOMB_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapTowerUseBombResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求使用Buff function this.RequestUseBuff(curLevel, optionId, func) local data = MapInfoProto_pb.UseTowerBuffRequest() data.towerLevel = curLevel data.optionId = optionId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_TOWER_USEBUFF_REQUEST, MessageTypeProto_pb.MAP_TOWER_USEBUFF_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.UseTowerBuffResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求刷新体力等 后端数据 function this.RefreshEnergyRequest(itemIdList, func) local data = PlayerInfoProto_pb.RefreshItemNumRequest() for i = 1, #itemIdList do data.itemId:append(itemIdList[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.REFRESH_ITEM_NUM_REQUEST, MessageTypeProto_pb.REFRESH_ITEM_NUM_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.RefreshItemNumResponse() msg:ParseFromString(data) BagManager.BackDataRefreshEnerny(msg.itemInfo) if func then func() end end) end --精英本难度状态存储请求 function this.DifficultMapRequest(mapId, index) local data = MapInfoProto_pb.DifficultMapRequest() data.mapInfo.Id = mapId data.mapInfo.mapdifficulty = index local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.DIFFICULT_MAP_OPTION_RECORD_REQUEST, MessageTypeProto_pb.DIFFICULT_MAP_OPTION_RECORD_RESPONSE, msg, function() end) end -- 请求获取试炼副本排行 function this.RequestTrialRank(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_TOWER_RANK_BY_PAGE_REQUEST, MessageTypeProto_pb.GET_TOWER_RANK_BY_PAGE_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.TowerRankResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 所有排行榜都走这个协议 function this.RequestRankInfo(rankType, func, id) local data = PlayerInfoProto_pb.RankRequest() data.type = rankType data.activiteId = id or 0 local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ONE_RANK_REQUEST, MessageTypeProto_pb.GET_ONE_RANK_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.RankResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求领取试炼层数奖励 function this.RequestLevelReward(levelnum, func) local data = MapInfoProto_pb.TowerRewardRequest() data.tower = levelnum local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.TAKE_TOWER_REWARD_REQUEST, MessageTypeProto_pb.TAKE_TOWER_REWARD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.TowerRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求更换头像框 0头像框,1头像,2称号,3坐骑,4皮肤 function this.RequestChangeModifyDecoration(type, id, func) local data = PlayerInfoProto_pb.ModifyDecorationRequest() data.type = type data.decorationId = id local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MODIFY_DECORATION_REQUEST, MessageTypeProto_pb.MODIFY_DECORATION_RESPONSE, msg, function(buffer) if func then func() end end) end --玩家坐骑升级 function this.RequestRideLvUp(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.RIDE_LEVEL_UP_REQUEST, MessageTypeProto_pb.RIDE_LEVEL_UP_RESPONSE, nil, function(buffer) if func then func() end end) end -- 初始化云梦祈福数据 function this.InitPrayDataRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.BLESS_INFO_REQUEST, MessageTypeProto_pb.BLESS_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.blessResponse() msg:ParseFromString(data) PrayManager.InitializeData(msg) if func then func(msg) end end) end -- 保存云梦祈福自选奖励 function this.SavePraySelectRewardRequest(_rewardIds, func) local data = PlayerInfoProto_pb.blessSaveRequest() for i = 1, #_rewardIds do data.rewardIds:append(_rewardIds[i]) --Log("selectRewardIds ".._rewardIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.BLESS_SAVE_REWARD_REQUEST, MessageTypeProto_pb.BLESS_SAVE_REWARD_RESPONSE, msg, function(buffer) if func then func() end end) end -- 翻牌云梦祈福奖励 function this.GetSinglePrayRewardRequest(rewardId, func) local data = PlayerInfoProto_pb.blessChooseRequest() --Log("翻牌位置 "..rewardId) data.locationId = rewardId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.BLESS_CHOOSE_REQUEST, MessageTypeProto_pb.BLESS_CHOOSE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.blessChooseResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 重置云梦祈福奖励 function this.ResetAllPrayRewardRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.BLESS_REFRESH_REQUEST, MessageTypeProto_pb.BLESS_REFRESH_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.blessRefresh() msg:ParseFromString(data) if func then func(msg.reward) end end) end --购买孙龙的宝藏 function this.BuyTreasureOfSomeBody(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.BUY_TREASURE_REQUEST, MessageTypeProto_pb.BUY_TREASURE_RESPONSE, nil, function(buffer) Game.GlobalEvent:DispatchEvent(GameEvent.TreasureOfSomeBody.OpenTreasureAward) if func then func() end end) end -- 请求获取所有药灵师血量 function this.RequestAllHeroHp(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ENDLESS_MAP_HERO_INFO_REQUEST, MessageTypeProto_pb.ENDLESS_MAP_HERO_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.GetEndlessHeroResponse() msg:ParseFromString(data) EndLessMapManager.InitHeroHp(msg, function() if func then func() end end) end) end -- 请求复位 function this.RequestResetState(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ENDLESS_MAP_RESET_REQUEST, MessageTypeProto_pb.ENDLESS_MAP_RESET_RESPONSE, nil, function(buffer) if func then func() end end) end -- 请求标记地图点 function this.RequestNotePoint(mapId, pos, info, type, func) local data = MapInfoProto_pb.SignEndlessCellRequest() data.sign.mapId = mapId data.sign.cellId = pos data.sign.info = info data.sign.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ENDLESS_MAP_SIGN_REQUEST, MessageTypeProto_pb.ENDLESS_MAP_SIGN_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.SignEndlessCellResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求战力排名 排名数据 function this.RequestWarPowerSortData(_page, _activityId, func) local data = PlayerInfoProto_pb.GetForceRankInfoRequest() Log("_page " .. _page .. " " .. _activityId) data.page = _page data.activiteId = _activityId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GETF_FORCE_RANK_INFO_REQUEST, MessageTypeProto_pb.GETF_FORCE_RANK_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetForceRankInfoResponse() msg:ParseFromString(data) if func then func(_page, msg) end end) end -- 刷新行动力 function this.ReqeustRefreshEnergy(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ENDLESS_EXECUTION_REFRESH_REQUEST, MessageTypeProto_pb.ENDLESS_EXECUTION_REFRESH_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.ExecutionRefreshResponse() msg:ParseFromString(data) EndLessMapManager.leftEnergy = msg.exeValue Log(Language[11439] .. msg.exeValue) if func then func() end end) end ---========================公会基础接口============================= -- 请求创建公会 function this.RequestCreateGuild(name, announce, func) local data = Family_pb.FamilyCreateReqeust() data.name = name data.announce = announce local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_CREATE_REQUEST, MessageTypeProto_pb.FAMILY_CREATE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyCreateResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求推荐公会列表 function this.RequestRecommandGuild(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_RECOMEND_REQUEST, MessageTypeProto_pb.FAMILY_RECOMEND_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyRecommandResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求搜索公会 function this.RequestSearchGuild(name, func) local data = Family_pb.FamilySearchReqeust() data.name = name local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_SEARCH_REQEUST, MessageTypeProto_pb.FAMILY_SEARCH_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilySeachResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求加入公会 function this.RequestJoinGuild(familyId, func) local data = Family_pb.FamilyJoinRequest() data.familyId = familyId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_JOIN_REQUEST, MessageTypeProto_pb.FAMILY_JOIN_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyJoinResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 申请加入公会 function this.RequestApplyGuild(familyIdList, func) local data = Family_pb.FamilyApplyRequest() for i = 1, #familyIdList do data.familyId:append(familyIdList[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_APPLY_REQEUST, MessageTypeProto_pb.FAMILY_APPLY_RESPONSE, msg, function(buffer) if func then func() end end) end -- 请求获取我的公会信息 function this.RequestMyGuildInfo(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_GET_INFO_REQUEST, MessageTypeProto_pb.FAMILY_GET_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetFamilyInfoResponse() msg:ParseFromString(data) -- 设置我的公会信息 MyGuildManager.SetMyGuildInfo(msg) MyGuildManager.SetMyMemInfo(msg) MyGuildManager.SetMyFeteInfo(msg) MyGuildManager.SetWalkData(msg) GuildBossManager.SetBossData(msg) GuildCarDelayManager.SetProgressData(msg.carDelayProgressIndication) GuildCarDelayManager.SetCarPlayTimeData(msg.carPlayTime) MyGuildManager.SetMyAidInfo(msg) if func then func() end -- 工会数据 ThinkingAnalyticsManager.SetSuperProperties({ guild_id = msg.familyBaseInfo.id, guild_name = msg.familyBaseInfo.name, guild_level = msg.familyBaseInfo.levle, }) end) end -- 请求获取公会成员信息 function this.RequestMyGuildMembers(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_GET_MEMBER_REQUEST, MessageTypeProto_pb.FAMILY_GET_MEMBER_RESPOSNE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetFamilyMemberInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求获取公会日志 function this.RequestMyGuildLog(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_GET_LOG_REQUEST, MessageTypeProto_pb.FAMILY_GET_LOG_RESPOSNE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetFamilyLogResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求获取申请信息 function this.RequestMyGuildApply(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_GET_APPLY_REQUEST, MessageTypeProto_pb.FAMILY_GET_APPLY_RESPOSNE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetFamilyApplyResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求操作申请 function this.RequestOperateMyGuildApply(opType, applyId, func) local data = Family_pb.FamilyOperationApplyRequest() data.type = opType data.applyId = applyId or 0 local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_OPERATION_APPLY_LIST_REQUEST, MessageTypeProto_pb.FAMILY_OPERATION_APPLY_LIST_RESPONSE, msg, function(buffer) if func then func() end end) end -- 请求踢人 function this.RequestKickOutFormMyGuild(uid, func) local data = Family_pb.FamilyKickOutRequest() data.targetUid = uid local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_KICK_OUT_REQUEST, MessageTypeProto_pb.FAMILY_KICK_OUT_RESPONSE, msg, function(buffer) if func then func() end end) end -- 请求委任职位 function this.RequestMyGuildAppointment(uid, pos, func) local data = Family_pb.FamilyAppointmentReqeust() data.targetUid = uid data.position = pos local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_APPOINTMENT_REQEUST, MessageTypeProto_pb.FAMILY_APPOINTMENT_RESPONSE, msg, function(buffer) if func then func() end end) end -- 请求修改公会宣言 function this.RequestChangeGuildBase(type, content, func) local data = Family_pb.FamilyChangeRequest() data.type = type data.content = content local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_CHANGE_NOTICE_REQUEST, MessageTypeProto_pb.FAMILY_CHANGE_NOTICE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyChangeResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求修改公会申请类型 function this.RequestChangeJoinType(joinType, limitLevel, func) local data = Family_pb.FamilyChangeJoinTypeRequest() data.type = joinType data.intoLevel = limitLevel local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_CHANGE_JOIN_TYPE_REQUEST, MessageTypeProto_pb.FAMILY_CHANGE_JOIN_TYPE_RESPONSE, msg, function(buffer) if func then func() end end) end -- 请求退出公会 function this.RequestQuitGuild(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_LEVEL_REQUEST, MessageTypeProto_pb.FAMILY_LEVEL_RESPONSE, nil, function(buffer) if func then func() end end) end -- 解散公会 function this.RequestDismissGuild(dType, func) local data = Family_pb.FamilyDissolutionRequest() data.type = dType local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_DISSOLUTION_REQUEST, MessageTypeProto_pb.FAMILY_DISSOLUTION_RESPONSE, msg, function(buffer) if func then func() end end) end --请求公会行走 function this.GuildWalkRequest(pathList, func) Log("FAMILY_WALK_REQUEST") local data = Family_pb.FamilyWalkRequest() for i = 1, #pathList do local point = pathList[i] data.path:append(GuildMap_UV2Pos(point.u, point.v)) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_WALK_REQUEST, MessageTypeProto_pb.FAMILY_WALK_RESPONSE, msg, function(buffer) Log("FAMILY_WALK_RESPONSE") if func then func() end end) end --请求修改公会图腾 function this.RequestChangeLogo(logoId, func) local data = Family_pb.ChangeIconRequest() data.iconId = logoId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_CHANGE_ICON_REQUEST, MessageTypeProto_pb.FAMILY_CHANGE_ICON_RESPONSE, msg, function(buffer) if func then func() end end) end ---========================公会基础接口end============================= ---========================公会战接口============================= -- 请求公会建筑布防信息 function this.RequestGuildFightBaseData(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_FIGHT_ROUND_INFO_REQUEST, MessageTypeProto_pb.FAMILY_FIGHT_ROUND_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyFightRoundResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求公会建筑布防信息 function this.RequestDefendStageData(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_VIEW_DEFEND_REQUEST, MessageTypeProto_pb.FAMILY_VIEW_DEFEND_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyDefendViewResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求布防公会建筑(buildType 为空或0 表示随机建筑) function this.RequestGuildFightDefend(uid, buildType, func) local data = Family_pb.FamilyQuickDefendRequest() data.buildId = buildType or 0 data.uid = uid local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_QUICK_SET_DEFEND_REQEUST, MessageTypeProto_pb.FAMILY_QUICK_SET_DEFEND_RESPONSE, msg, function(buffer) if func then func() end end) end -- 请求进攻阶段双方信息 function this.RequestAttackStageDefendData(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_FIGHT_INFO_REQUEST, MessageTypeProto_pb.FAMILY_FIGHT_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyFightInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求玩家布防编队信息 function this.RequestGuildFightDefendFormation(gid, uid, func) local data = Family_pb.FamilyDefendDetailViewRequest() data.gid = gid data.playerId = uid local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_VIEW_DEFEND_DETAIL_REQUEST, MessageTypeProto_pb.FAMILY_VIEW_DEFEND_DETAIL_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyDefendDetailViewResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求进攻 function this.RequestGuildFightAttackEnemy(gid, uid, func) local data = Family_pb.FamilyFightAttackRequest() data.gid = gid data.attackUid = uid local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_FIGHT_ATTACK_REQUEST, MessageTypeProto_pb.FAMILY_FIGHT_ATTACK_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyFightAttackResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求公会战结果 function this.RequestGuildFightResultData(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_FIGHT_TOTAL_RESULT_REQUEST, MessageTypeProto_pb.FAMILY_FIGHT_TOTAL_RESULT_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GuildFightResultResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求公会战排名 function this.RequestGuildFightAttackLogData(type, func) local data = Family_pb.PersonalFightResultRequest() data.type = type or 0 local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_PERSONAL_FIGHT_RESULT_REQUEST, MessageTypeProto_pb.FAMILY_PERSONAL_FIGHT_RESULT_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.PersonalFightResultResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求公会战排名 function this.RequestMyHeroBloodData(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.FAMILY_ATTACK_BLOOD_REQUEST, MessageTypeProto_pb.FAMILY_ATTACK_BLOOD_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetAttackHeroBloodResponse() msg:ParseFromString(data) if func then func(msg) end end) end ---========================公会战接口end============================= ---========================公会boss============================= -- 请求战斗 function this.RequestAttackGuildBoss(func) local data = FightInfoProto_pb.FightStartRequest() data.type = 7 data.teamId = FormationTypeDef.FORMATION_NORMAL local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FIGHT_START_REQUEST, MessageTypeProto_pb.FIGHT_START_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.FightStartResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求公会boss扫荡 function this.RequestSweepGuildBoss(func) local data = FightInfoProto_pb.SweepRightRequest() data.type = 2 -- 公会boss扫荡 local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SWEEP_RIGHT_REQUEST, MessageTypeProto_pb.SWEEP_RIGHT_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.SweepRightResponse() msg:ParseFromString(data) if func then func(msg) end end) end ---========================公会boss end============================= --累计签到 function this.RequestSignIn(dayIndex, func) local data = PlayerInfoProto_pb.SignInRequest() data.dayIndex = dayIndex local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SIGN_IN_REQUEST, MessageTypeProto_pb.SIGN_IN_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.SignInResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 获取玩家信息 function this.RequestPlayerInfo(uid, teamId, func) local data = PlayerInfoProto_pb.GetPlayerOneTeamInfoRequest() data.playerId = uid data.teamId = teamId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_PLAYER_ONE_TEAM_INFO_REQUEST, MessageTypeProto_pb.GET_PLAYER_ONE_TEAM_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetPlayerOneTeamInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 无尽副本出图统计数据 function this.RequestEndLessStats(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ENDLESS_OUT_CONSUME_REQUEST, MessageTypeProto_pb.ENDLESS_OUT_CONSUME_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.EndlessOutConsumeResponse() msg:ParseFromString(data) EndLessMapManager.OutMapStats(msg) if func then func(msg) end end) end --七日狂欢领取宝箱奖励 function this.GetSevenDayCarnivalBoxReward(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.TAKE_SEVEN_HAPPY_REWARD_REQUEST, MessageTypeProto_pb.TAKE_SEVEN_HAPPY_REWARD_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.TakeSenvenScoreRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求达人排名 function this.RequestGetExpertInfoData(_activityId, func) local data = PlayerInfoProto_pb.GetExpertInfoRequest() data.activiteId = _activityId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GETF_EXPERT_RANK_INFO_REQUEST, MessageTypeProto_pb.GETF_EXPERT_RANK_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetExpertInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end function this.RequestUpDateState(_type, func) local data = PlayerInfoProto_pb.UpdateStateRequest() data.type = _type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.UPDATE_STATE_REQUEST, MessageTypeProto_pb.UPDATE_STATE_RESPONSE, msg, function(buffer) if func then func() end end) end -- 请求兽潮排行 function this.RequestMonsterRankInfo(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_MONSTER_RANK_INFO_REQUEST, MessageTypeProto_pb.GET_MONSTER_RANK_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetMonsterRankInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求禽兽战斗 function this.RequestMonsterCampFight(curWave, func) local data = FightInfoProto_pb.FightStartRequest() data.type = 5 data.fightId = curWave data.teamId = FormationTypeDef.MONSTER_CAMP_ATTACK local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FIGHT_START_REQUEST, MessageTypeProto_pb.FIGHT_START_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.FightStartResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求小地图数据 function this.RequestMiniMapInfo(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.ENDLESS_MIN_MAP_INFO_REQUEST, MessageTypeProto_pb.ENDLESS_MIN_MAP_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.EndlessMinMapResponse() msg:ParseFromString(data) if func then func(msg) end end) end ---========我要变强评分数据============ function this.CheckGiveMePowerTask(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.TO_BE_STRONGER_REQUEST, MessageTypeProto_pb.TO_BE_STRONGER_RESPONSE, nil, function() if func then func() end end) end ---绑定手机相关 --获取绑定手机号奖励 function this.RequestGetPhoneBindReward(func) local data = PlayerInfoProto_pb.GetPhoneRewardRequest() local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_PHONE_REWARD_REQUEST, MessageTypeProto_pb.GET_PHONE_REWARD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetPhoneRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end --绑定手机号 function this.RequestUpDataBindPhoneInfo(phoneNumber, func) local data = PlayerInfoProto_pb.UpdatePhoneinfoRequest() data.phoneNum = phoneNumber local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.UPDATE_PHONE_INFO_REQUEST, MessageTypeProto_pb.UPDATE_PHONE_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.UpdatePhoneinfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求所有法宝数据 -- function this.AllTalismanRequest(_index, func) -- local data = HeroInfoProto_pb.GetAllEquipRequest() -- data.index = _index -- data.type = 2 -- local msg = data:SerializeToString() -- Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_EQUIP_REQUEST, MessageTypeProto_pb.GET_ALL_EQUIP_RESPONSE, msg, function(buffer) -- local data = buffer:DataByte() -- local msg = HeroInfoProto_pb.GetAllEquipResponse() -- msg:ParseFromString(data) -- TalismanManager.InitUpdateTalismanData(msg.equip) -- if msg.isSendFinish then -- if func then -- func(msg) -- end -- else -- _index = _index + #msg.equip -- this.AllTalismanRequest(_index, func) -- end -- end) -- end --请求所有魂印数据 function this.GetSoulPrintDataRequest(_index, func) if func then func() end -- local data = HeroInfoProto_pb.GetAllEquipRequest() -- data.index = _index -- data.type = 3 -- local msg = data:SerializeToString() -- Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_EQUIP_REQUEST, MessageTypeProto_pb.GET_ALL_EQUIP_RESPONSE, msg, function(buffer) -- local data = buffer:DataByte() -- local msg = HeroInfoProto_pb.GetAllEquipResponse() -- msg:ParseFromString(data) -- SoulPrintManager.InitServerData(msg.equip) -- if msg.isSendFinish then -- if func then -- func(msg) -- end -- else -- _index = _index + #msg.equip -- this.GetSoulPrintDataRequest(_index, func) -- end -- end) end --穿魂印请求(包括替换,装备,一键装备等) -- function this.SoulEquipWearRequest(_heroId, soulPrintIdList, type, func) -- local data = HeroInfoProto_pb.SoulEquipWearRequest() -- data.heroId = _heroId -- if (type == 1) then -- data.type = type -- else -- data.type = 0 -- end -- for i, v in pairs(soulPrintIdList) do -- local c = data.soulEquipIds:add() -- c.equipId = i -- c.position = v -- end -- local msg = data:SerializeToString() -- Network:SendMessageWithCallBack(MessageTypeProto_pb.SOUL_EQUIP_WEAR_REQUEST, MessageTypeProto_pb.SOUL_EQUIP_WEAR_RESPONSE, msg, function() -- if func then -- func(msg) -- end -- end) -- end --脱魂印请求 -- function this.SoulEquipUnLoadWearRequest(_heroId, soulPrintIdList, func) -- local data = HeroInfoProto_pb.SoulEquipUnLoadWearRequest() -- data.heroId = _heroId -- for i, v in pairs(soulPrintIdList) do -- local c = data.soulEquipIds:add() -- c.equipId = i -- c.position = v -- end -- local msg = data:SerializeToString() -- Network:SendMessageWithCallBack(MessageTypeProto_pb.SOUL_EQUIP_UNLOAD_OPT_REQUEST, MessageTypeProto_pb.SOUL_EQUIP_UNLOAD_OPT_RESPONSE, msg, function() -- if func then -- func(msg) -- end -- end) -- end --魂印快速升级请求 function this.UpQuickSoulEquipRequest(soulPrintId, soulEquipIds, func) local data = HeroInfoProto_pb.UpQuickSoulEquipRequest() data.equipId = tostring(soulPrintId) for i, v in pairs(soulEquipIds) do data.soulEquipIds:append(i) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.UP_SOUL_EQUIP_QUICK_REQUEST, MessageTypeProto_pb.UP_SOUL_EQUIP_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.UpSoulEquipResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求穿法宝 function this.TalismanWearRequest(_heroId, _talismanIds, func) local data = HeroInfoProto_pb.EquipWearRequest() data.heroId = _heroId data.type = 2 for i = 1, #_talismanIds do data.equipId:append(_talismanIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EQUIP_WEAR_REQUEST, MessageTypeProto_pb.EQUIP_WEAR_RESPONSE, msg, function(buffer) if func then func(msg) end end) end --请求脱法宝 function this.TalismanUnLoadOptRequest(_heroId, _talismanIds, func) local data = HeroInfoProto_pb.EquipUnLoadOptRequest() data.heroId = _heroId data.type = 2 for i = 1, #_talismanIds do data.equipIds:append(_talismanIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EQUIP_UNLOAD_OPT_REQUEST, MessageTypeProto_pb.EQUIP_UNLOAD_OPT_RESPONSE, msg, function(buffer) if func then func(msg) end end) end --请求法宝升星 function this.TalismanUpStarRequest(_talismanDid, func) local data = HeroInfoProto_pb.UpHeroStarRequest() data.heroId = _talismanDid data.type = 2 local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.UP_HERO_STAR_REQUEST, MessageTypeProto_pb.UP_HERO_STAR_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = CommonProto_pb.Drop() msg:ParseFromString(data) if func then func(msg) end end) end ---调查问卷相关 --获取调查问卷 function this.RequestGetQuestionnaireArgs(func) local data = PlayerInfoProto_pb.GetQuestionRequest() local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_QUESTION_REQUEST, MessageTypeProto_pb.GET_QUESTION_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetQuestionResponse() msg:ParseFromString(data) if func then func(msg) end end) end --提交问卷 function this.RequestUpDataQuestion(answers, func) local data = PlayerInfoProto_pb.upDataQuestionRequest() for i = 1, #answers do data.options:append(answers[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.UPDATE_QUESTION_REQUEST, MessageTypeProto_pb.UPDATE_QUESTION_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.upDataQuestionResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 保存跳过战斗 function this.RequestSaveSkipFight(type, func) local data = MapInfoProto_pb.EndlessSetSkipRequest() data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ENDLESS_SET_SKIPFIGHT_REQUEST, MessageTypeProto_pb.ENDLESS_SET_SKIPFIGHT_RESPONSE, msg, function(buffer) if func then func() end end) end --- ====== 血战奖励相关================ -- 获取奖励数据 function this.RequestBloodyScoreRewardData(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.BLOOD_GETSCORE_INFO_REQUEST, MessageTypeProto_pb.BLOOD_GETSCORE_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = RoomProto_pb.GetBloodyScoreInfoResponse() msg:ParseFromString(data) -- 保存数据 MatchDataManager.SetScoreRewardData(msg) if func then func() end end) end -- 领取奖励数据 function this.RequestGetScoreRewardData(id, func) local data = RoomProto_pb.BloodyTakeScoreRewardRequet() data.id = id local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.BLOOD_TAKE_SCORE_REWARD_REQEUST, MessageTypeProto_pb.BLOOD_TAKE_SCORE_REWARD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = RoomProto_pb.BloodyTakeScoreRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 购买令牌 function this.RequestBuyExtraReward(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.BLOOD_BUY_SCORE_REQUEST, MessageTypeProto_pb.BLOOD_BUY_SCORE_RESPONSE, nil, function(buffer) --local data = buffer:DataByte() --local msg = RoomProto_pb.GetBloodyScoreInfoResponse() --msg:ParseFromString(data) ---- 保存数据 --MatchDataManager.SetScoreRewardData(msg) if func then func() end end) end ---占星相关 --请求占星抽奖协议 function this.GetSoulRandRequest(time, func) local data = HeroInfoProto_pb.SoulRandRequest() data.time = time local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SOUL_RAND_EQUIP_REQUEST, MessageTypeProto_pb.SOUL_RAND_EQUIP_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.SoulRandResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求强行召唤协议 function this.GetSoulForceRandRequest(func) local data = HeroInfoProto_pb.SoulForceRandRequest() local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SOUL_FORCE_RAND_EQUIP_REQUEST, MessageTypeProto_pb.SOUL_FORCE_RAND_EQUIP_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.SoulForceRandResponse() msg:ParseFromString(data) if func then func(msg) end end) end --CDKey兑换 function this.GetExchangeCdkRequest(key, func) local data = PlayerInfoProto_pb.ExchangeCdkRequest() data.key = key local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EXCHANGE_CDK_REQUEST, MessageTypeProto_pb.EXCHANGE_CDK_RESPONSE, msg, function(buffer) if func then func() end end) end --登录获取新关卡的信息 function this.InitFightPointLevelInfo(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.MAIN_LEVEL_GET_INFO_REQUEST, MessageTypeProto_pb.MAIN_LEVEL_GET_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetMainLevelInfoResponse() msg:ParseFromString(data) if func then func(msg) end FightPointPassManager.InitAllFightPointState(msg) AdventureManager.GetAdventureData() end) end --请求英雄回溯 function this.HeroRetureEvent(heroId, func) local data = HeroInfoProto_pb.HeroReturnRequest() Log("HeroRetureEvent "..heroId) data.heroId = heroId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.HERO_RETURN_REQUEST, MessageTypeProto_pb.HERO_RETURN_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.HeroReturnResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求关卡排行 function this.RequestFightRank(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.MAIN_LEVEL_GET_RANK_REQUEST, MessageTypeProto_pb.MAIN_LEVEL_GET_RANK_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.MainLevelRankInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求兽潮战斗结果 function this.GetMonsterFightResult(fightId, teamId, func) local data = FightInfoProto_pb.QuickStartMonsterFightRequest() data.fightId = fightId data.teamId = teamId Log(Language[11440] .. teamId) local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.QUICK_START_MONSTERFIGHTER_REQUEST, MessageTypeProto_pb.QUICK_START_MONSTERFIGHTER_REPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.QuickStartMonsterFightResponse() msg:ParseFromString(data) if func then func(msg) end end) end --孙龙的宝藏购买等级 function this.RequestBuyTreasureLevel(level, func) local data = PlayerInfoProto_pb.QuickBuyTreasureLevelRequest() data.level = level local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.BUY_TREASURE_LEVEL_REQUEST, MessageTypeProto_pb.BUY_TREASURE_LEVEL_RESPONSE, msg, function(buffer) if func then func() end end) end ---幸运探宝 function this.GetLuckyTurnRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_LUCKWHEEL_REQUEST, MessageTypeProto_pb.GET_LUCKWHEEL_RESPONSE, nil,function(buffer) local data=buffer:DataByte() local msg=PlayerInfoProto_pb.LuckWheelIndication() msg:ParseFromString(data) if func then func(msg) end end) end --请求幸运转盘刷新 1活动id 2是否免费 function this.GetLuckyTurnRefreshRequest(activityId,isFree, func) local data = PlayerInfoProto_pb.RefreshLuckWheelRequest() data.activityId = activityId data.isFree=isFree local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.REFRESH_LUCKWHEEL_REQUEST, MessageTypeProto_pb.REFRESH_LUCKWHEEL_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.RefreshLuckWheelResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求抽取幸运转盘 1活动id 2是否是多次抽取 function this.GetLuckyTurnRankRequest(activityId,repeated,func) local data = PlayerInfoProto_pb.GetLuckWheelRandRewardRequest() data.activityId = activityId data.repeated=repeated local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_LUCKWHEEL_RANDREWARD_REQUEST, MessageTypeProto_pb.GET_LUCKWHEEL_RANDREWARD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetLuckWheelRandRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end --请求物品刷新 function this.GetRefreshCountDownRequest(itemIdList,func) local data = PlayerInfoProto_pb.RefreshItemNumRequest() for i = 1, #itemIdList do data.itemId:append(itemIdList[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.REFRESH_ITEM_NUM_REQUEST, MessageTypeProto_pb.REFRESH_ITEM_NUM_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.RefreshItemNumResponse() msg:ParseFromString(data) BagManager.BackDataRefreshEnerny(msg.itemInfo) if func then func(msg) end end) end --请求英雄上锁 function this.HeroLockEvent(heroId,lockState, func) local data = HeroInfoProto_pb.HeroLockChangeRequest() Log("HeroLockEvent "..heroId.." "..lockState) data.heroId = heroId data.lockState = lockState local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.HERO_LOCK_CHANGE_REQUEST, MessageTypeProto_pb.HERO_LOCK_CHANGE_RESPONSE, msg, function(buffer) if func then func() end end) end --好友上阵英雄预览信息 function this.ViewHeroInfoRequest(targetUid,heroId,func) local data = PlayerInfoProto_pb.ViewHeroInfoRequest() data.targetUid = targetUid data.heroId = heroId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.VIEW_HERO_INFO_REQUEST, MessageTypeProto_pb.VIEW_HERO_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.ViewHeroInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end ---东海寻仙限时抽卡相关--- function this.GetFindFairyRequest(activityId,func) local data = PlayerInfoProto_pb.NextActivityRequest() data.activityId = activityId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.NEXT_ACTIVITY_REQUEST, MessageTypeProto_pb.NEXT_ACTIVITY_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.NextActivityResponse() msg:ParseFromString(data) if func then func(msg) end end) end ---------------------- -- 领取Vip每日奖励 function this.GetVipDailyReward(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.VIP_TAKE_DAILY_REQUEST, MessageTypeProto_pb.VIP_TAKE_DAILY_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.VipTakeDilyResponse() msg:ParseFromString(data) if func then func(msg) end end) end --迷宫寻宝派遣 function this.FindTreasureMissingRoomSendHeroRequest(_missionId,_heroIds,func) local data = PlayerInfoProto_pb.MissingRoomSendHeroRequest() data.missionId = _missionId for i = 1, #_heroIds do data.heroIds:append(_heroIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MISSING_ROOM_HERO_SEND_REQUEST, MessageTypeProto_pb.MISSING_ROOM_HERO_SEND_RESPONSE, msg, function(buffer) if func then func() end end) end --迷宫寻宝单个任务加速 function this.FindTreasureMissingRoomAccelerateRequest(_missionId,func) local data = PlayerInfoProto_pb.MissingRoomAccelerateRequest() data.missionId = _missionId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MISSING_ROOM_MISSION_ACCELERATE_REQUEST, MessageTypeProto_pb.MISSING_ROOM_MISSION_ACCELERATE_RESPONSE, msg, function(buffer) if func then func() end end) end --迷宫寻宝刷新 function this.FindTreasureRefreshRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.MISSING_ROOM_MISSION_REFRESH_REQUEST, MessageTypeProto_pb.MISSING_ROOM_MISSION_REFRESH_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.MissingRoomRefreshResponse() msg:ParseFromString(data) if func then func(msg) end end) end ----===================巅峰赛相关+++++++++++++++++++++++ --- 获取基础数据 function NetManager.GetTopMatchBaseInfo(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.CHAMPION_GET_REQUEST, MessageTypeProto_pb.CHAMPION_GET_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.ChampionGetInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end --- 获取历史记录 function NetManager.GetTopMatchHistoryBattle(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.CHAMPION_GET_MYHISTORY_REQEUST, MessageTypeProto_pb.CHAMPION_GET_MYHISTORY_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.ChanpionGetAllMyBattleHistoryResponse() msg:ParseFromString(data) if func then func(msg) end end) end --- 获取选拔赛小组排名 function NetManager.GetTopMatchMyTeamRank(func) local data = ArenaInfoProto_pb.ChampionGetWorldRankRequest() data.page = 1 data.type = 1 local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.CHAMPION_GET_RANK_REQUEST, MessageTypeProto_pb.CHAMPION_GET_RANK_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.ChampionGetWorldRankResponse() msg:ParseFromString(data) if func then func(msg) end end) end --- 获取竞猜数据, type == 0 全量拉取数据, == 1 只获取赔率信息(用于界面定时刷新赔率) function NetManager.GetBetMatchInfo(type, func) local data = ArenaInfoProto_pb.ChampionGetBetRequest() data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.CHAMPION_BET_INFO_REQUEST, MessageTypeProto_pb.CHAMPION_BET_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.ChampionGetBetResponse() msg:ParseFromString(data) if func then func(msg) end end) end --- 竞猜下注 function NetManager.RequestBet(uid, coins, func) local data = ArenaInfoProto_pb.ChampionBetReqeust() data.winUid = uid data.coins = coins local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.CHAMPION_BET_GUESS_REQUEST, MessageTypeProto_pb.CHAMPION_BET_GUESS_RESPONSE, msg, function(buffer) if func then func() end end) end -- 获取历史竞猜信息 function NetManager.GetBetHistoryInfo(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.CHAMPION_GET_MYALL_BET_REQUEST, MessageTypeProto_pb.CHAMPION_GET_MYALL_BET_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.ChampionGetAllMyBetInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 获取淘汰赛数据(type == 1 32强, == 2 4强赛) function NetManager.GetTopMatchEliminationInfo(type, func) local data = ArenaInfoProto_pb.ChampionViewFinalRequest() data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.CHAMPION_VIEW_FINAL_REQUEST, MessageTypeProto_pb.CHAMPION_VIEW_FINAL_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.ChampionViewFinalResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 获取淘汰赛排行数据(page == 1 页签) function NetManager.GetTopMatchRankInfo(page, func) local data = ArenaInfoProto_pb.ChampionGetWorldRankRequest() data.page = page data.type = 0 local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.CHAMPION_GET_RANK_REQUEST, MessageTypeProto_pb.CHAMPION_GET_RANK_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.ChampionGetWorldRankResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 公会红包 获得所有红包信息 function NetManager.GetAllRedPacketResponse(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.J_GET_ALL_REDPACKAGE_INFO_REQUEST, MessageTypeProto_pb.J_GET_ALL_REDPACKAGE_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetAllRedPackageResponse() msg:ParseFromString(data) if func then func(msg) end end) end --公会红包 抢红包 function NetManager.GetRobRedPackageRequest(id,func) local data = Family_pb.RobRedPackageRequest() data.id = id local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.J_ROB_REDPACKAGE_INFO_REQUEST, MessageTypeProto_pb.J_ROB_REDPACKAGE_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.RobRedPackageResponse() msg:ParseFromString(data) if func then func(msg) end end) end --公会红包 查看红包详情 function NetManager.GetRedPackageDetailRequest(id,func) local data = Family_pb.RedPackageDetailRequest() data.id = id local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.J_GET_REDPACKAGE_DETAIL_REQUEST, MessageTypeProto_pb.J_GET_REDPACKAGE_DETAIL_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.RedPackageDetailResponse() msg:ParseFromString(data) if func then func(msg) end end) end --公会红包 点赞 function NetManager.GetRedPackageLikeRequest(uid,func) local data = Family_pb.RedPackageLikeRequest() data.uid = uid local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.J_REDPACKAGE_SEND_LIKE_REQUEST, MessageTypeProto_pb.J_REDPACKAGE_SEND_LIKE_RESPONSE, msg, function(buffer) if func then func() end end) end --公会红包 获取点赞信息 function NetManager.GetAllSendLikeResponse(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.J_GET_ALL_SEND_LIKE_REQUEST, MessageTypeProto_pb.J_GET_ALL_SEND_LIKE_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetAllSendLikeResponse() msg:ParseFromString(data) if func then func(msg) end end) end --远征开始 --远征获取节点信息 function NetManager.GetExpeditionRequest(leve,func) local data = Expedition_pb.GetExpeditionRequest() data.leve = leve or ExpeditionManager.expeditionLeve --LogGreen("data.leve "..data.leve) --if data.leve == -1 then -- if func then -- func() -- end -- return --end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EXPEDITION_GET_EXPEDITION_REQUEST, MessageTypeProto_pb.EXPEDITION_GET_EXPEDITION_RESONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.GetExpeditionResponse() msg:ParseFromString(data) ExpeditionManager.SetExpeditionState(1) ExpeditionManager.InitExpeditionData(msg) if func then func(msg) end end) end --获取层级奖励 function NetManager.TakeExpeditionBoxRewardRequest(_lay,func) local data = Expedition_pb.TakeExpeditionBoxRewardRequest() data.laycfg = _lay local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EXPEDITION_TAKE_BOXREWARD_REQUEST, MessageTypeProto_pb.EXPEDITION_TAKE_BOXREWARD_RESONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.TakeExpeditionBoxRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end --复活英雄 function NetManager.ReliveExpeditionHeroRequest(_heroId,_nodeId,func) local data = Expedition_pb.ReliveExpeditionHeroRequest() if _heroId then data.heroId = _heroId end data.nodeId = _nodeId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EXPEDITION_RELIVE_HERO_REQUEST, MessageTypeProto_pb.EXPEDITION_RELIVE_HERO_RESONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.ReliveExpeditionHeroResponse() msg:ParseFromString(data) if func then func(msg) end end) end --恢复节点 function NetManager.ReCoverExpeditionHeroRequest(_nodeId,func) local data = Expedition_pb.ReCoverExpeditionHeroRequest() data.nodeId = _nodeId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EXPEDITION_RECOVER_HERO_REQUEST, MessageTypeProto_pb.EXPEDITION_RECOVER_HERO_RESONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.ReCoverExpeditionHeroResponse() msg:ParseFromString(data) if func then func(msg) end end) end --领取圣物 function NetManager.TakeHolyEquipRequest(_nodeId,_type,func) local data = Expedition_pb.TakeHolyEquipRequest() data.nodeId = _nodeId data.type = _type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EXPEDITION_TAKE_HOLY_EQUIP_REQUEST, MessageTypeProto_pb.EXPEDITION_TAKE_HOLY_EQUIP_RESONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.TakeHolyEquipResponse() msg:ParseFromString(data) if func then func(msg) end end) end --开始节点战斗操作 function NetManager.StartExpeditionBattleRequest(_nodeId,_teamId,_expInfo,func) local data = Expedition_pb.StartExpeditionBattleRequest() Log("_nodeId ".._nodeId) data.nodeId = _nodeId data.teamId = _teamId --data.expInfo = _expInfo for i = 1, #_expInfo do data.expInfo:append(_expInfo[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EXPEDITION_START_BATTLE_REQUEST, MessageTypeProto_pb.EXPEDITION_START_BATTLE_RESONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.StartExpeditionBattleResponse() msg:ParseFromString(data) if func then func(msg) end end) end --战斗结束操作 function NetManager.EndExpeditionBattleRequest(_nodeId,_frames,func) local data = Expedition_pb.EndExpeditionBattleRequest() data.nodeId = _nodeId data.frames = _frames local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EXPEDITION_END_BATTLE_REQUEST, MessageTypeProto_pb.EXPEDITION_END_BATTLE_RESONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.EndExpeditionBattleResponse() msg:ParseFromString(data) if func then func(msg) end end) end --战斗结束失败操作 清空血量 保存当前状态请求 function NetManager.EndConfirmExpeditionBattleRequest(_nodeId,func) local data = Expedition_pb.EndConfirmExpeditionBattleRequest() data.nodeId = _nodeId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EndConfirmExpeditionBattleRequest, MessageTypeProto_pb.EndConfirmExpeditionBattleResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.EndConfirmExpeditionBattleResponse() msg:ParseFromString(data) if func then func(msg) end end) end --远征商店节点 function NetManager.StoreNodeRequest(_nodeId,func) local data = Expedition_pb.EndConfirmExpeditionBattleRequest() data.nodeId = _nodeId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.StoreNodeRequest, MessageTypeProto_pb.StoreNodeResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.StoreNodeResponse() msg:ParseFromString(data) if func then func(msg) end end) end --远征招募节点信息 function NetManager.HeroNodeGetInfoRequest(_nodeId,func) local data = Expedition_pb.HeroNodeGetInfoRequest() data.nodeId = _nodeId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.HeroNodeGetInfoRequest, MessageTypeProto_pb.HeroNodeGetInfoResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.HeroNodeGetInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end --远征招募 function NetManager.HeroNodeRequest(_nodeId,_heroId,func) local data = Expedition_pb.HeroNodeRequest() data.nodeId = _nodeId data.heroId = _heroId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.HeroNodeRequest, MessageTypeProto_pb.HeroNodeResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.HeroNodeResponse() msg:ParseFromString(data) if func then func(msg) end end) end --远征结束 --孙龙的宝藏时间倒计时请求 function NetManager.RefreshTimeSLRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.TREASURE_REFRESH_TIME_REQUEST, MessageTypeProto_pb.TREASURE_REFRESH_TIME_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.TreasureRefreshTimeResponse() msg:ParseFromString(data) if func then func(msg) end end) end --月卡领取奖励 function NetManager.MonthCardTakeDailyRequest(type,func) local data = PlayerInfoProto_pb.TakeMothDilyRequest() data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MONTHCARD_TAKE_DAILY_REQUEST, MessageTypeProto_pb.MONTHCARD_TAKE_DAILY_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.TakeMothDilyResponse() msg:ParseFromString(data) if func then func(msg.drop) end end) end --合成 --装备合成 function NetManager.ComplexEquipRequest(type,star,num,func)--type装备类型 star 装备星级 0一键合成 num合成数量 local data = HeroInfoProto_pb.ComplexEquipRequest() data.type = type data.star = star data.num = num local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EQUIP_COMPLEX_REQUEST, MessageTypeProto_pb.EQUIP_COMPLEX_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.ComplexEquipResponse() msg:ParseFromString(data) if func then func(msg) end end) end --宝物合成 function NetManager.ComplexTreasureRequest(equipType,type,star,num,func)--type : star 装备星级 0一键合成 num合成数量 local data = HeroInfoProto_pb.ComplexJewelEquipRequest() data.type = equipType data.rance = type data.targetleve=star data.num = num local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.ComplexJewelEquipRequest, MessageTypeProto_pb.ComplexJewelEquipResponse, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.ComplexJewelEquipResponse() msg:ParseFromString(data) if func then func(msg) end end) end --新魂印-- --穿戴 function NetManager.SoulEquipWearRequest(wearInfo, unloadInfo, func) local data = HeroInfoProto_pb.SoulEquipWearRequest() if wearInfo then -- LogError("wearInfo.heroId "..wearInfo.heroId.." "..wearInfo.equipId.." "..wearInfo.position) data.wearInfo.heroId=wearInfo.heroId local c = data.wearInfo.soulEquipIds:add() c.equipId = wearInfo.equipId c.position =wearInfo.position end if unloadInfo then -- LogError("unloadInfo.heroId "..unloadInfo.heroId.." "..unloadInfo.equipId.." "..unloadInfo.position) data.unloadInfo.heroId=unloadInfo.heroId local c = data.unloadInfo.soulEquipIds:add() c.equipId = unloadInfo.equipId c.position =unloadInfo.position end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SOUL_EQUIP_WEAR_REQUEST, MessageTypeProto_pb.SOUL_EQUIP_WEAR_RESPONSE, msg, function() if func then func(msg) end end) end --卸下 function NetManager.SoulEquipUnLoadWearRequest(_heroId, _equipId,_pos, func) local data = HeroInfoProto_pb.SoulEquipUnLoadWearRequest() data.heroId=_heroId local c = data.soulEquipIds:add() c.equipId = _equipId c.position =_pos local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SOUL_EQUIP_UNLOAD_OPT_REQUEST, MessageTypeProto_pb.SOUL_EQUIP_UNLOAD_OPT_RESPONSE, msg, function() if func then func(msg) end end) end --魂印合成 function NetManager.ComplexSoulPrintRequest(targetId,soulIds,func)--type装备类型 star 装备星级 0一键合成 num合成数量 local data = HeroInfoProto_pb.MergeSoulRequest() data.targetId = targetId for i = 1, #soulIds do data.soulId:append(soulIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.SOUL_MERGE_REQUEST, MessageTypeProto_pb.SOUL_MERGE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.MergeSoulResponse() msg:ParseFromString(data) if func then func(msg) end end) end --- 每日副本相关 --- --请求挑战 id为DailyChallengeConfig表ID type 1为挑战 2为扫荡 function NetManager.DailyChallengeRequest(id,type,func) local data = PlayerInfoProto_pb.DailyChallengeRequest() data.id = id data.type=type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.DAILY_CHALLENGE_REQUEST, MessageTypeProto_pb.DAILY_CHALLENGE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.DailyChallengeResponse() msg:ParseFromString(data) if func then func(msg) end end) end ------------------------------------------------ --主动请求活动刷新 function NetManager.RefreshAcitvityData(ids,func) local data = PlayerInfoProto_pb.GetSomeActivityInfoRequest() for i = 1, #ids do data.id:append(ids[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_SOME_ACTIVITY_INFO_REQUEST, MessageTypeProto_pb.GET_SOME_ACTIVITY_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.GetSomeActitityInfoRespone() msg:ParseFromString(data) if func then func(msg) end end) end --获取所有公会技能 function NetManager.GetAllGuildSkillData(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_GUILD_SKILL_REQUEST, MessageTypeProto_pb.GET_ALL_GUILD_SKILL_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetAllGuildSkillResponse() msg:ParseFromString(data) if func then func(msg) end GuildSkillManager.InitData(msg) end) end --公会技能升级 function NetManager.SinGleGuildSkillUpLv(profession,func) local data = Family_pb.GuildSkillLevelUpRequest() data.type = profession local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GUILD_SKILL_LEVEL_UP_REQUEST, MessageTypeProto_pb.GUILD_SKILL_LEVEL_UP_RESPONSE, msg, function(buffer) if func then func() end end) end --公会技能重置 function NetManager.ResetGuildSkillRequest(type,func) local data = Family_pb.ResetGuildSkillRequest() data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GUILD_SKILL_RESET_REQUEST, MessageTypeProto_pb.GUILD_SKILL_RESET_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.ResetGuildSkillResponse() msg:ParseFromString(data) if func then func(msg) end end) end --===== 公会祭祀相关 =====-- -- 请求领取公会祭祀 function NetManager.FamilyGetFeteRewardRequest(id,func) local data = Family_pb.FamilyGetFeteRewardRequest() data.id = id local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FamilyGetFeteRewardRequest, MessageTypeProto_pb.FamilyGetFeteRewardResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyGetFeteRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 公会祭祀 function NetManager.FamilyFeteRequest(type,func) local data = Family_pb.FamilyFeteRequest() data.type=type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FamilyFeteRequest, MessageTypeProto_pb.FamilyFeteResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.FamilyFeteResponse() msg:ParseFromString(data) if func then func(msg) end end) end ------------------------------ --===== 公会十绝阵相关 =====-- --获取十绝阵状态信息 function NetManager.GetDeathPathStatusResponse(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.DEATH_PATH_GET_STATUS_REQUEST, MessageTypeProto_pb.DEATH_PATH_GET_STATUS_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetDeathPathStatusResponse() msg:ParseFromString(data) if func then func(msg) end end) end --获取十绝阵主面板信息 function NetManager.GetDeathPathInfoResponse(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.DEATH_PATH_INFO_REQUEST, MessageTypeProto_pb.DEATH_PATH_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetDeathPathInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end --十绝阵请求挑战 pathId 当前阵Id function NetManager.ChallengeDeathPathRequest(pathId,func) local data = Family_pb.ChallengeDeathPathRequest() data.pathId=pathId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.DEATH_PATH_CHALLENGE_REQUEST, MessageTypeProto_pb.DEATH_PATH_CHALLENGE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.ChallengeDeathPathResponse() msg:ParseFromString(data) if func then func(msg) end end) end --十绝阵 请求所有奖励信息 function NetManager.GetAllDeathPathRewardInfoResponse(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.DEATH_PATH_GET_ALL_REWARD_INFO_REQUEST, MessageTypeProto_pb.DEATH_PATH_GET_ALL_REWARD_INFO_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetAllDeathPathRewardInfoResponse() msg:ParseFromString(data) if func then func(msg) end end) end --十绝阵 请求领取奖励 function NetManager.DoRewardDeathPathRequest(position,func) local data = Family_pb.DoRewardDeathPathRequest() data.position=position local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.DEATH_PATH_DO_REWARD_REQUEST, MessageTypeProto_pb.DEATH_PATH_DO_REWARD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.DoRewardDeathPathResponse() msg:ParseFromString(data) if func then func(msg) end end) end --============================================ --车迟请求挑战 function NetManager.FastFightChallengeRequest(_type,_challeageId,func) --LogError("_type ".._type.." _challeageId ".._challeageId) local data = FightInfoProto_pb.FastFightChallengeRequest() data.type=_type data.challeageId=_challeageId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.FAST_FIGHT_CHALLENGE_REQUEST, MessageTypeProto_pb.FAST_FIGHT_CHALLENGE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = FightInfoProto_pb.FastFightChallengeResponse() msg:ParseFromString(data) if func then func(msg) end end) end --车迟请求抢夺信息 function NetManager.GetCarChallenegListResponse(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_CAR_CHALLENEG_LIST_REQUEST, MessageTypeProto_pb.GET_CAR_CHALLENEG_LIST_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GetCarChallenegListResponse() msg:ParseFromString(data) if func then func(msg) end end) end --车迟请求抢夺记录信息 function NetManager.CarGrapRecordResponse(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_CAR_GRAP_RECORD_REQUEST, MessageTypeProto_pb.GET_CAR_GRAP_RECORD_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = Family_pb.CarGrapRecordResponse() msg:ParseFromString(data) if func then func(msg) end end) end --公会援助 function NetManager.GuildHelpGetAllRequest(func) if not PlayerManager.familyId or PlayerManager.familyId == 0 then if func then func() end return end local data = Family_pb.GuildHelpGetAllRequest() local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GuildHelpGetAllRequest, MessageTypeProto_pb.GuildHelpGetAllResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GuildHelpGetAllResponse() msg:ParseFromString(data) MyGuildManager.SetAllGuildHelpInfo(msg) if func then func(msg) end end) end --公会援助记录 function NetManager.GuildGetHelpLogRequest(func) local data = Family_pb.GuildGetHelpLogRequest() local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GuildGetHelpLogRequest, MessageTypeProto_pb.GuildGetHelpLogResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GuildGetHelpLogResponse() msg:ParseFromString(data) if func then func(msg) end end) end --公会援助 function NetManager.GuildSendHelpRequest(type,sendMessage,func) local data = Family_pb.GuildSendHelpRequest() for i = 1, #type do data.type:append(type[i]) end data.sendMessage = sendMessage local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GuildSendHelpRequest, MessageTypeProto_pb.GuildSendHelpResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GuildSendHelpResponse() msg:ParseFromString(data) if func then func(msg) end end) end --公会援助领奖 function NetManager.GuildTakeHelpRewardRequest(type,func) local data = Family_pb.GuildTakeHelpRewardRequest() data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GuildTakeHelpRewardRequest, MessageTypeProto_pb.GuildTakeHelpRewardRequese, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GuildTakeHelpRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end --公会援助领宝箱奖 function NetManager.GuildTakeHelpBoxRequest(func) local data = Family_pb.GuildTakeHelpBoxRequest() local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GuildTakeHelpBoxRequest, MessageTypeProto_pb.GuildTakeHelpBoxResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GuildTakeHelpRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end --公会援助援助 信息 function NetManager.GuildSendHelpMessageRequest(func) local data = Family_pb.GuildSendHelpMessageRequest() local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GuildSendHelpMessageRequest, MessageTypeProto_pb.GuildSendHelpMessageResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GuildSendHelpMessageResponse() msg:ParseFromString(data) if func then func(msg) end end) end --援助他人 自己援助次数修改 GuildHelpInfoIndication会推 function NetManager.GuildHelpHelpOtherRequest(uid,type,func) local data = Family_pb.GuildHelpHelpOtherRequest() data.uid = uid data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.GuildHelpHelpOtherRequest, MessageTypeProto_pb.GuildHelpHelpOtherResponse, msg, function(buffer) local data = buffer:DataByte() local msg = Family_pb.GuildHelpHelpOtherResponse() msg:ParseFromString(data) if func then func(msg) end end) end --天宫秘宝活动数据 function NetManager.TreasureOfHeavenScoreRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.EXPEDITION_TREASURE_INFO_REQUEST, MessageTypeProto_pb.EXPEDITION_TREASURE_INFO_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.ExpeditionTreasureInfoResponse() msg:ParseFromString(data) TreasureOfHeavenManger.SetScore(msg.score) TreasureOfHeavenManger.SetLimitTime(msg.resetTime) TreasureOfHeavenManger.SetState(msg.treasureRewardState) if func then func(msg) end end) end --天宫秘宝任务领取 function NetManager.GetTreasureOfHeavenRewardRequest(uid,func) local data = Expedition_pb.ExpeditionTakeTreasureRequest() data.id = uid local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.EXPEDITION_TAKE_TREASURE_REWARD_REQUEST, MessageTypeProto_pb.EXPEDITION_TAKE_TREASURE_REWARD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = Expedition_pb.ExpeditionTakeTreasureResponse() msg:ParseFromString(data) if func then func(msg) end end) end --森罗幻境请求保存上阵 function NetManager.TrialHeroInfoSaveRequest(heroIds,func) local data = MapInfoProto_pb.TrialHeroInfoSaveRequest() for i = 1, #heroIds do data.heroIds:append(heroIds[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.TRIAL_HERO_INFO_SAVE_REQUEST, MessageTypeProto_pb.TRIAL_HERO_INFO_SAVE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() if func then func(msg) end end) end --试练副本领取宝箱奖励 type 0为单个领取 1为全部领取 function NetManager.GetTrialBoxRewardRequest(type,func) local data = MapInfoProto_pb.GetTrialBoxRewardRequest() data.type = type local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.TRIAL_GET_BOX_REQUEST, MessageTypeProto_pb.TRIAL_GET_BOX_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.GetTrialBoxRewardResponse() msg:ParseFromString(data) if func then func(msg) end end) end --试练副本请求使用性药 heroId 英雄ID function NetManager.UseAddHpItemRequest(heroId,func) local data = MapInfoProto_pb.UseAddHpItemRequest() data.heroId = heroId local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.TRIAL_USE_ADD_HP_ITEM_REQUEST, MessageTypeProto_pb.TRIAL_USE_ADD_HP_ITEM_RESPONSE, msg, function(buffer) if func then func(msg) end end) end --排行榜初始化第一名 请求 function NetManager.RankFirstRequest(_types,activiteId,func) local data = PlayerInfoProto_pb.RankFirstRequest() for i = 1, #_types do data.types:append(_types[i]) end for i = 1, #activiteId do data.activiteId:append(activiteId[i]) end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.RANK_GET_FIRST_REQUEST, MessageTypeProto_pb.RANK_GET_FIRST_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.RankFirstResponse() msg:ParseFromString(data) RankingManager.SetAllRankProud(_types,msg.proud) RankingManager.SetAllFirstRankProud(_types,msg.ranks) if func then func(msg) end end) end --排行膜拜请求 function NetManager.RankProudRequest(rankType,func) local data = PlayerInfoProto_pb.RankProudRequest() data.rankType = rankType local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.RANK_PROUD_REQUEST, MessageTypeProto_pb.RANK_PROUD_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = PlayerInfoProto_pb.RankProudResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 小游戏相关接口 -- 初始化数据 function NetManager.MiniGameInitRequest(func) Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_GAME_GET_REQUEST, MessageTypeProto_pb.MAP_GAME_GET_RESPONSE, nil, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapGameResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 小游戏操作 function NetManager.MiniGameOperateRequest(index, func) local data = MapInfoProto_pb.MapGameUpdateRequest() data.index = index local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAP_GAME_UPDATE_REQUEST, MessageTypeProto_pb.MAP_GAME_UPDATE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = MapInfoProto_pb.MapGameUpdateResponse() msg:ParseFromString(data) if func then func(msg) end end) end -- 请求领取竞技场宝箱数据 function this.TakeArenaBattleRewardRequest(missionId, func) local data = ArenaInfoProto_pb.TakeArenaBattleRewardRequest() data.missionId = missionId or 1 local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.TakeArenaBattleRewardRequest, MessageTypeProto_pb.TakeArenaBattleRewardResponse, msg, function(buffer) local data = buffer:DataByte() local msg = ArenaInfoProto_pb.TakeArenaBattleRewardResponse() msg:ParseFromString(data) ArenaManager.SetHadTakeBoxData(missionId) if func then func(msg) end end) end return this