Beispiel #1
0
    def _init_succeed(self, data, req, res, timer):
        response = res.SerializeToString()

        log = log_formater.output(data, "Init succeed", req, res,
                                  timer.count_ms())
        logger.notice(log)
        return response
Beispiel #2
0
    def _get_melee_win_num_reward_succeed(self, data, req, res, timer):
        response = res.SerializeToString()
        log = log_formater.output(data, "Get melee win num reward succeed",
                req, res, timer.count_ms())
        logger.notice(log)

        return response
Beispiel #3
0
    def _pack_query_melee_ranking_response(self, proxy, data, melee, melee_matcher, users, req, timer):
        """构造返回
        args:
        Returns:
            res[protobuf]: 向客户端的返回的响应
        """
        res = arena_pb2.QueryArenaInfoRes()
        res.status = 0

        pack.pack_melee_info(data.user.get(True), melee, res.arena_info, timer.now,
                melee_matcher.rank)
        res.arena_info.own.ranking_index = melee_matcher.rank
        #榜单信息
        for user in users:
            message = res.arena_info.player_rankings.add()
            message.user_id = user[0]
            message.name = user[1]
            message.level = user[2]
            message.icon_id = user[3]
            message.title_level = user[4]
            message.score = user[5]
            message.ranking_index = user[6]

        response = res.SerializeToString()
        log = log_formater.output(data, "Query melee ranking succeed", req, res, timer.count_ms())
        logger.notice(log)

        return response
Beispiel #4
0
 def _receive_accept_friend_succeed(self, data, req, res, timer):
     """请求处理成功"""
     response = res.SerializeToString()
     log = log_formater.output(data, "Receive accept friend apply succeed",
                               req, res, timer.count_ms())
     logger.notice(log)
     return response
Beispiel #5
0
    def _finish_sweep_succeed(self, data, anneal, sweep_rewards, items, heroes,
                              req, timer):

        #构造返回
        res = anneal_pb2.FinishSweepRes()
        res.status = 0
        pack.pack_anneal_info(data, anneal, res.anneal, timer.now)

        pack.pack_resource_info(data.resource.get(True), res.resource)

        for (money, food, reward) in sweep_rewards:
            reward_message = res.reward.add()
            reward_message.resource.money = money
            reward_message.resource.food = food
            for (basic_id, num) in reward:
                item_message = reward_message.items.add()
                item_message.basic_id = basic_id
                item_message.num = num

        for item in items:
            pack.pack_item_info(item, res.items.add())

        for hero in heroes:
            hero_message = res.heros.add()
            hero_message.basic_id = hero[0]
            hero_message.level = hero[1]
            hero_message.exp = hero[2]

        response = res.SerializeToString()

        log = log_formater.output(data, "Finish sweep succeed", req, res,
                                  timer.count_ms())
        logger.notice(log)
        return response
Beispiel #6
0
    def _refresh_arena_succeed(self, data, req, res, timer):
        response = res.SerializeToString()
        log = log_formater.output(data, "Refresh arena succeed", req, res,
                                  timer.count_ms())
        logger.notice(log)

        return response
Beispiel #7
0
 def _read_mail_succeed(self, data, req, timer):
     res = mail_pb2.UseMailRes()
     res.status = 0
     response = res.SerializeToString()
     log = log_formater.output(data, "Read mail succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response
Beispiel #8
0
 def _update_succeed(self, data, req, timer):
     res = team_pb2.ModifyTeamsRes()
     res.status = 0
     response = res.SerializeToString()
     log = log_formater.output(data, "Update team succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response
Beispiel #9
0
 def _receive_refresh_all_teams_succeed(self, data, req, timer):
     res = team_pb2.ReceiveRefreshAllTeamsRes()
     res.status = 0
     response = res.SerializeToString()
     log = log_formater.output(data, "Receive refresh all teams succeed",
                               req, res, timer.count_ms())
     logger.notice(log)
     return response
Beispiel #10
0
 def _update_garrison_hero_exp_succeed(self, data, req, res, timer):
     """
     """
     response = res.SerializeToString()
     log = log_formater.output(data, "Update garrison hero exp succeed",
                               req, res, timer.count_ms())
     logger.notice(log)
     return response
Beispiel #11
0
 def _update_soldier_succeed(self, data, req, timer):
     res = hero_pb2.UpdateHeroRes()
     res.status = 0
     response = res.SerializeToString()
     log = log_formater.output(data, "Upgrade hero soldier succeed", req,
                               res, timer.count_ms())
     logger.notice(log)
     return response
Beispiel #12
0
 def _start_conscript_succeed(self, data, req, timer):
     res = conscript_pb2.StartConscriptRes()
     res.status = 0
     pack.pack_resource_info(data.resource.get(True), res.resource)
     response = res.SerializeToString()
     log = log_formater.output(data, "Start conscript succeed", req, res, timer.count_ms())
     logger.notice(log)
     return response
Beispiel #13
0
 def _query_pay_succeed(self, data, req, res, timer):
     """查询充值商店成功
     """
     response = res.SerializeToString()
     log = log_formater.output(data, "Query pay succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response
Beispiel #14
0
 def _start_pay_succeed(self, data, req, res, timer):
     """开始购买成功
     """
     response = res.SerializeToString()
     log = log_formater.output(data, "Start pay succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response
Beispiel #15
0
 def _add_succeed(self, data, req, timer):
     res = internal_pb2.AddResourceRes()
     res.status = 0
     response = res.SerializeToString()
     log = log_formater.output(data, "Add resource succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response
Beispiel #16
0
 def _upgrade_equipment_stone_succeed(self, data, req, timer):
     res = hero_pb2.UpgradeStoneRes()
     res.status = 0
     pack.pack_resource_info(data.resource.get(True), res.resource)
     response = res.SerializeToString()
     log = log_formater.output(data, "Upgrade equipment stone succeed", req, res, timer.count_ms())
     logger.notice(log)
     return response
Beispiel #17
0
 def _manage_guide_succeed(self, data, req, timer):
     res = guide_pb2.ManageGuideRes()
     res.status = 0
     response = res.SerializeToString()
     log = log_formater.output(data, "Manage guide succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response
Beispiel #18
0
    def _seek_goods_succeed(self, data, req, res, timer):
        response = res.SerializeToString()

        log = log_formater.output(data, "Seek union goods succeed", req, res,
                                  timer.count_ms())
        logger.notice(log)

        return response
Beispiel #19
0
 def _update_city_info_succeed(self, data, req, timer):
     res = city_pb2.UpdateCityRes()
     res.status = 0
     response = res.SerializeToString()
     log = log_formater.output(data, "Update city info succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response
Beispiel #20
0
 def _gather_succeed(self, data, req, res, timer):
     """采集成功
     """
     response = res.SerializeToString()
     log = log_formater.output(data, "Gather succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response
Beispiel #21
0
 def _update_team_succeed(self, data, req, timer):
     res = cityDefence_pb2.UpdateDefenceRes()
     res.status = 0
     response = res.SerializeToString()
     log = log_formater.output(data, "Update guard team succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response
Beispiel #22
0
    def _receive_notice_succeed(self, data, req, melee, melee_matcher, record, timer):
        res = internal_pb2.ArenaResultNoticeRes()
        res.status = 0
        response = res.SerializeToString()
        log = log_formater.output(data, "Receive melee notice succeed", req, res, timer.count_ms())
        logger.notice(log)

        self._push_record(data, data.user.get(True), melee, melee_matcher.rank, record, timer)
        return response
Beispiel #23
0
 def _cancel_research_succeed(self, data, req, timer):
     res = technology_pb2.UpgradeTechRes()
     res.status = 0
     pack.pack_resource_info(data.resource.get(True), res.resource)
     response = res.SerializeToString()
     log = log_formater.output(data, "Cancel research technology succeed",
                               req, res, timer.count_ms())
     logger.notice(log)
     return response
Beispiel #24
0
    def _unload_succeed(self, data, req, timer):
        res = herostar_pb2.UnloadHeroStarRes()
        res.status = 0

        response = res.SerializeToString()
        log = log_formater.output(data, "Unload hero star succeed", req, res,
                                  timer.count_ms())
        logger.notice(log)
        return response
Beispiel #25
0
 def _strength_succeed(self, data, req, timer):
     res = herostar_pb2.StrengthHeroStarRes()
     res.status = 0
     pack.pack_resource_info(data.resource.get(True), res.resource)
     response = res.SerializeToString()
     log = log_formater.output(data, "Strength hero star succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response
Beispiel #26
0
 def _buy_buff_succeed(self, data, req, timer):
     res = legendcity_pb2.BuyLegendCityBuffRes()
     res.status = 0
     pack.pack_resource_info(data.resource.get(True), res.resource)
     response = res.SerializeToString()
     log = log_formater.output(data, "Buy legend city buff succeed", req,
                               res, timer.count_ms())
     logger.notice(log)
     return response
Beispiel #27
0
    def _add_kill_enemy_num_succeed(self, data, req, timer):
        res = internal_pb2.AddKillEnemyNumRes()
        res.status = 0
        response = res.SerializeToString()

        log = log_formater.output(data, "Add kill enemy num succeed", req, res,
                                  timer.count_ms())
        logger.notice(log)
        return response
Beispiel #28
0
 def _update_garrison_hero_succeed(self, data, req, timer):
     res = building_pb2.UpdateGarrisonHeroRes()
     res.status = 0
     pack.pack_resource_info(data.resource.get(True), res.resource)
     response = res.SerializeToString()
     log = log_formater.output(data, "Update garrison hero succeed", req,
                               res, timer.count_ms())
     logger.notice(log)
     return response
Beispiel #29
0
 def _cancel_upgrade_succeed(self, data, req, timer):
     res = building_pb2.UpgradeBuildingRes()
     res.status = 0
     pack.pack_resource_info(data.resource.get(True), res.resource)
     response = res.SerializeToString()
     log = log_formater.output(data, "Cancel upgrade building succeed", req,
                               res, timer.count_ms())
     logger.notice(log)
     return response
Beispiel #30
0
 def _exchange_succeed(self, data, req, timer):
     res = resource_pb2.UseGoldRes()
     res.status = 0
     pack.pack_resource_info(data.resource.get(True), res.resource)
     response = res.SerializeToString()
     log = log_formater.output(data, "Exchange succeed", req, res,
                               timer.count_ms())
     logger.notice(log)
     return response