Ejemplo n.º 1
0
    def success(self, star):
        """
        挑战成功
        """

        unlock_new_instance = False
        if star > self.star:
            self.star = star

        if self.level_id == self.player.lastEliteInstance["lastEliteLevelId"]:
            self.player.lastEliteInstance["lastEliteFinished"] = True
            self.player.set_update("lastEliteInstance")
            #有后续关卡
            if self.eliteInstancelevel.eliteNextInstanceId:
                next_eliteinstancelevel = get_eliteinstancelevel(
                    self.eliteInstancelevel.eliteNextInstanceId)
                #开启同一章节关卡
                if self.eliteInstancelevel.instance_id == next_eliteinstancelevel.instance_id:
                    unlock_new_instance = PlayerEliteInstanceLevel.unlock(
                        self.player, next_eliteinstancelevel.id)
                #开启下一章节关卡
                else:
                    #普通章节当前关卡已通关
                    if self.player.lastInstance["lastFinished"]:
                        unlock_new_instance = PlayerEliteInstanceLevel.unlock(
                            self.player, next_eliteinstancelevel.id)

                    else:
                        instancelevel = get_instancelevel(
                            self.player.lastInstance["lastLevelId"])
                        if instancelevel.instance_id > next_eliteinstancelevel.instance_id:
                            unlock_new_instance = PlayerEliteInstanceLevel.unlock(
                                self.player, next_eliteinstancelevel.id)

        return unlock_new_instance
Ejemplo n.º 2
0
def instanceSetUp(request, response):
    '''
    请求敌军信息
    '''
    player = request.player
    level_id = getattr(request.logic_request, "instanceId", 0)
    version = getattr(request.logic_request, "version", 0)
    data = {}

    instancelevel = get_instancelevel(level_id)
    playerinstancelevel = player.instancelevels.get(level_id)
    #副本
    if not playerinstancelevel:
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_NOT_OPEN, u"instanceSetUp:instance(%s) is not open" % level_id)
        return response

    if instancelevel.minUserLevel > player.level:
        AlertHandler(player, response, AlertID.ALERT_LEVEL_SHORTAGE, u"instanceSetUp:instance(%s) level is %s and playerLevel is %s" % (level_id, instancelevel.minUserLevel, player.level))
        return response

    if playerinstancelevel.succeedCount >= instancelevel.maxPlayCount:
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_FIGHT_COUNT_EXCEED_MAX, u"instanceSetUp:instance(%s) fight count(%s) exceed max count(%s)" % (level_id, playerinstancelevel.succeedCount, instancelevel.maxPlayCount))
        return response

    #体力不足
    if player.power < instancelevel.powerCost:
        AlertHandler(player, response, AlertID.ALERT_POWER_NOT_ENOUGH, u"instanceSetUp:power error (%s)" % player.power)
        return response

    enemies = instancelevel.enemies
    if not enemies:
        raise ErrorException(player, u"instanceSetUp: enemyData(%s) is not existed" % level_id)

    # 这个打完boss的剧情以后进行的赋值 状态为400,并且完成,200进400出
    if player.tutorial_id == Static.TUTORIAL_ID_INIT_1:
        player.tutorial_begin()

        # 这里的firstIn是选名字的新手引导。如果一进游戏提示你选名字是因为这个没有置成0
        player.set("firstIn", 0)

    if player.tutorial_id == Static.TUTORIAL_ID_INSTANCE_1ST_3:
            player.tutorial_complete()

    # 一请求副本就把新手引导的状态关闭掉。防止断线以后游戏会卡主

    elif player.tutorial_id == Static.TUTORIAL_ID_HEROCOMPOSE2_11:
        player.tutorial_complete()

    # 这里做的奖励提前展示,结算后会把展示的奖励发放出去

    rewards = playerinstancelevel.make_rewards_before_fight()
    player.update_instancelevel(playerinstancelevel, True)

    response.logic_response.set("rewards", rewards)
    response.logic_response.set("enemies", [enemy.to_dict() for enemy in enemies])
    response.logic_response.set("version", version)
    return response
Ejemplo n.º 3
0
def instanceReset(request, response):
    '''
    刷新副本次数
    '''
    #type = 1 普通 2 精英
    player = request.player
    level_id = getattr(request.logic_request, "instanceId", 0)
    category = getattr(request.logic_request, "category", 0)


    if category == 1:
        isElite = False
        instancelevel = get_instancelevel(level_id)
    elif category == 2:
        isElite = True
        instancelevel = get_eliteinstancelevel(level_id)
    else:
        raise ErrorException(player, u"instance reset category error (%s)" % level_id)

    if isElite:
        playerinstancelevel = player.eliteinstancelevels.get(instancelevel.pk)
    else:
        playerinstancelevel = player.instancelevels.get(instancelevel.pk)

    if not playerinstancelevel:
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_NOT_OPEN, u"instanceReset:instance(%s) is not open" % level_id)
        return response


    vip = get_vip(player.vip_level)
    if playerinstancelevel.refreshCount >= vip.resetElitInstanceCount:
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_REFRESH_COUNT_EXCEED_MAX, u"instanceReset:instance(%s) refresh count(%s) exceed max(%s)" % (level_id, playerinstancelevel.refreshCount , vip.resetElitInstanceCount))
        return response

    cost_diamond = Static.REFRESH_INSTANCE_COST * (playerinstancelevel.refreshCount + 1)

    if player.yuanbo < cost_diamond:
        AlertHandler(player, response, AlertID.ALERT_DIAMOND_NOT_ENOUGH, u"instanceReset:instance(%s) refresh costDiamond(%s) playerDiamond(%s)" % (level_id, cost_diamond,  player.yuanbo ))
        return response

    player.sub_yuanbo(cost_diamond, info=u"重置副本次数")
    playerinstancelevel.refresh_count()

    if isElite:
        player.update_eliteinstancelevel(playerinstancelevel, True)
    else:
        player.update_instancelevel(playerinstancelevel, True)

    return response
Ejemplo n.º 4
0
def _debug_open_player_instance_at_instance_id(player, stop_instancelevel_id):
    """
    DEBUG 解锁玩家副本
    """
    instancelevel_id = Static.FIRST_INSTANCE_LEVEL_ID

    playerinstancelevels = player.instancelevels.all()
    for level_id, playerinstancelevel in playerinstancelevels.items():
        player.instancelevels.delete(playerinstancelevel.pk)

    while True:
        instancelevel = get_instancelevel(instancelevel_id)
        playerinstancelevel = PlayerInstanceLevel.unlock(
            player, instancelevel.id)
        playerinstancelevel.success(3)
        player.instancelevels.update(playerinstancelevel)
        instancelevel_id = instancelevel.nextInstanceId
        if instancelevel_id > stop_instancelevel_id:
            break
Ejemplo n.º 5
0
def instanceSweep(request, response):
    '''
    扫荡
    '''
    level_id = getattr(request.logic_request, "instanceId", 0)
    count = getattr(request.logic_request, "count", 0)
    category = getattr(request.logic_request, "category", 0)


    player = request.player
    if category == 2:
        isElite = True
        instancelevel = get_eliteinstancelevel(level_id)
        playerinstancelevel = player.eliteinstancelevels.get(level_id)
    else:
        isElite = False
        instancelevel = get_instancelevel(level_id)
        playerinstancelevel = player.instancelevels.get(level_id)

    #副本没有开启
    if not playerinstancelevel:
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_NOT_OPEN, u"instanceSweep:instance(%s) is not open" % level_id)
        return response

    if not playerinstancelevel.can_sweep():
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_CAN_NOT_SWEEP, u"instanceSweep:instance(%s) can not sweep" % level_id)
        return response

    # todo 10级以前不可以扫荡

    if player.level < Static.SWEEP_OPEN_LEVEL:
        return response

    #扫荡卷判断
    #Static.ITEM_TYPE_SWEEP  扫荡卷id
    item_sweep = player.items.get(Static.ITEM_SWEEP_ID)
    if item_sweep and item_sweep.count > 0:
        use_diamond = False
    else:
        use_diamond = True

    if player.vip_level < Static.SWEEP_VIP_LEVEL and use_diamond:
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_SWEEP_VIP_ERROR, u"instanceSweep:vip(%s)  error" % player.vip_level)
        return response

    #次数判断
    if isElite:
        maxCount = instancelevel.eliteMaxPlayCount
        powerCost = instancelevel.elitePowerCost
    else:
        maxCount = instancelevel.maxPlayCount
        powerCost = instancelevel.powerCost

    if count > maxCount - playerinstancelevel.succeedCount:
        count = maxCount - playerinstancelevel.succeedCount

    if count == 0:
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_FIGHT_COUNT_EXCEED_MAX, u"instanceSweep:instance(%s) fight number(%s) exceed maxCount(%s)" % (level_id, count, maxCount))
        return response

    #体力判断
    if count > player.power/powerCost:
        count = player.power/powerCost

    if count == 0:
        AlertHandler(player, response, AlertID.ALERT_POWER_NOT_ENOUGH, u"instanceSweep:instance(%s) power is not enough" % level_id)
        return response

    if not use_diamond and not item_sweep.can_sub(count):
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_ITEM_SWEEP_NOT_ENOUGH, u"instanceSweep:item sweep number (%s) not enough" % (item_sweep.count))
        return response

    if use_diamond:
        if player.yuanbo < Static.SWEEP_INSTANCE_COST*count:
            AlertHandler(player, response, AlertID.ALERT_DIAMOND_NOT_ENOUGH, u"instanceSweep:playerDiamond(%s) costDiamond(%s)" % (player.yuanbo, Static.SWEEP_INSTANCE_COST*count))
            return response
        player.sub_yuanbo(Static.SWEEP_INSTANCE_COST*count, info=u"扫荡")
    else:
        item_sweep.sub(count , info=u"扫荡:%s:%s" % (level_id, isElite))


    rewards_list = playerinstancelevel.sweep(count)
    for rewards in rewards_list:
        for rewardDict in rewards:
            rewardTemp = CommonReward(rewardDict["type"], rewardDict["count"], 0)
            reward_send(player, rewardTemp, info=u"副本扫荡结算:%s" % level_id)


    if not isElite:
        player.sub_power(instancelevel.powerCost * count)
        player.task_going(Static.TASK_CATEGORY_INSTANCE, number=count, c1=instancelevel.id, is_incr=False, is_series=False)

    else:
        player.sub_power(instancelevel.elitePowerCost * count)
        player.task_going(Static.TASK_CATEGORY_ELIT_INSTANCE, number=count, c1=instancelevel.pk, is_incr=False, is_series=False)
        player.dailytask_going(Static.DAILYTASK_CATEGORY_ELIT_INSTANCE, number=count, is_incr=True, is_series=True)

    player.dailytask_going(Static.DAILYTASK_CATEGORY_INSTANCE, number=count, is_incr=True, is_series=True)


    if isElite:
        player.update_eliteinstancelevel(playerinstancelevel, True)
    else:
        player.update_instancelevel(playerinstancelevel, True)
    response.logic_response.set("rewards", rewards_list)
    return response
Ejemplo n.º 6
0
def instanceStart(request, response):
    '''
    结算
    '''
    player = request.player
    level_id = getattr(request.logic_request, "instanceId", 0)
    heroLayoutData = getattr(request.logic_request, "heroLayoutData", [])
    isWin = getattr(request.logic_request, "isWin", False)
    summary = getattr(request.logic_request, "summary", {})

    deadCount = 0
    instancelevel = get_instancelevel(level_id)
    playerinstancelevel = player.instancelevels.get(instancelevel.pk)

    #副本没有开启
    if not playerinstancelevel:
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_NOT_OPEN, u"instanceStart:level_id(%s) is not open" % level_id)
        return response


    if instancelevel.minUserLevel > player.level:
        AlertHandler(player, response, AlertID.ALERT_LEVEL_SHORTAGE, u"instanceStart:level_id(%s) level is %s and playerLevel is %s" % (level_id, instancelevel.minUserLevel, player.level))
        return response

    if playerinstancelevel.succeedCount >= instancelevel.maxPlayCount:
        AlertHandler(player, response, AlertID.ALERT_INSTANCE_FIGHT_COUNT_EXCEED_MAX, u"instanceStart:instance(%s) fight number(%s) exceed maxCount(%s)" % (level_id, playerinstancelevel.succeedCount, instancelevel.maxPlayCount))
        return response

    #[玩家卡id, 卡id, 站位行, 列]
    player.update_hero_layout(heroLayoutData)

    if summary:
        leftWarriorDead = summary["leftWarriorDead"] #英雄小兵全部存在
        for i in range(0, len(leftWarriorDead), 2):
            #检查英雄死亡数量
            if int(str(leftWarriorDead[i])[0:2]) == 11:
                # 根据这个判断副本的星级
                deadCount += leftWarriorDead[i+1]
        new_summary = []
        # 这部分操作暂时没有效果的
        if player.level >= Static.NEW_PLAYER_LEVEL:
            for index in range(0, len(leftWarriorDead)):
                if index % 2 == 0:
                    warrior_id = leftWarriorDead[index]
                    w_count = leftWarriorDead[index+1]
                    if int(str(warrior_id)[0:2]) == 11:
                        continue
                    new_summary.append(warrior_id)
                    new_summary.append(w_count)
                    player.armies.lost(warrior_id, w_count)
        summary["leftWarriorDead"] = new_summary

    star = get_star(deadCount)
    # 如果是以新手向导的方式进入,那么不去发奖励也不加经验。
    if not player.tutorial_id == Static.TUTORIAL_ID_GASHAPON_2:

        data = playerinstancelevel.fight(star, isWin)

        heroLevelUp = data["heroLevelUp"]
        rewards = data["rewards"]
        if isWin:
            player.sub_power(instancelevel.powerCost)
            player.dailytask_going(Static.DAILYTASK_CATEGORY_INSTANCE, number=1, is_incr=True, is_series=True)
            player.task_going(Static.TASK_CATEGORY_INSTANCE, number=1, c1=level_id, is_incr=False, is_series=False)
            player.seven_days_task_going(Static.SEVEN_TASK_CATEGORY_INSTANCE, number=1, c1=level_id, is_incr=True, is_series=False)

    else:
        rewards = []
        heroLevelUp = []

    playerinstancelevel.rewardBoxes = []

    player.update_instancelevel(playerinstancelevel, True)
    response.logic_response.set("rewards", rewards)
    response.logic_response.set("heroLevelUp",heroLevelUp)
    response.logic_response.set("summary",summary)
    response.logic_response.set("star", star)
    response.common_response.player.set("soldiers", player.armies.to_dict())
    response.common_response.player.set("tutorial", player.tutorial)
    response.common_response.player.set("populationCost", player.populationCost)
    return response
Ejemplo n.º 7
0
    def success(self, star):
        """
        挑战成功
        """
        unlock_new_instance = False
        # 星级赋值这里有什么用??
        if star > self.star:
            self.star = star

        # 这个是最后的副本id
        # lastInstance = DictField(default = {"lastFinished":False, "lastLevelId":Static.FIRST_INSTANCE_LEVEL_ID})
        # 会初始化一个id但是默认的是false,在这里给他赋值的true记录玩家当前的关卡进度
        if self.level_id == self.player.lastInstance["lastLevelId"]:
            self.player.lastInstance["lastFinished"] = True
            # 更新相关信息 更新属性的字段值 这么使用
            self.player.set_update("lastInstance")
            # 如果有下一个关卡
            if self.instancelevel.nextInstanceId:
                # 取得下一个关卡通过 nextInstanceId
                next_instancelevel = get_instancelevel(
                    self.instancelevel.nextInstanceId)

                # 如果没有下一关证明,已经是副本的最后一关了.那么就返回当前的关卡。
                if not next_instancelevel:
                    return self.instancelevel
                # 如果玩家的等级满足条件就去解锁下一个
                if self.player.level >= next_instancelevel.minUserLevel:
                    # 这个是传入的下一个关卡id,目的是为了打通一关为新的信息赋值
                    unlock_new_instance = PlayerInstanceLevel.unlock(
                        self.player, next_instancelevel.pk)
                #普通副本第一章节通关开启第一章节精英副本
                # 判断当前关的章节id和下一关的章节id不同。证明这是某一章的最后一关。
                if self.instancelevel.instance_id != next_instancelevel.instance_id:

                    # 如果是第2章普通关卡全部完成,那么开启精英的关卡
                    if self.instancelevel.instance_id == 2:

                        # 解锁相应的精英关卡,这里的id需要重新设置。
                        PlayerEliteInstanceLevel.unlock(
                            self.player, Static.FIRST_ELITE_INSTANCE_LEVEL_ID)
                        self.player.start_tutorial_by_id(
                            Static.TUTORIAL_ID_ELITE_INSTANCE)
                    else:
                        # 如果已经不是第一章完成了。是第二章或者第三章。
                        # 最后一个精英关已经完成
                        if self.player.lastEliteInstance["lastEliteFinished"]:
                            # 拿到当前解锁的最后一关
                            eliteinstancelevel = get_eliteinstancelevel(
                                self.player.
                                lastEliteInstance["lastEliteLevelId"])
                            # 如果有下一关就取下一个。
                            if eliteinstancelevel.eliteNextInstanceId:
                                next_eliteinstancelevel = get_eliteinstancelevel(
                                    eliteinstancelevel.eliteNextInstanceId)
                                # 当前的精英关章节id 和 下一关的精英章节id不同,说明当前是某一章的最后一个精英关。这里就需要普通关卡和精英的章节对应起来。
                                if eliteinstancelevel.instance_id != next_eliteinstancelevel.instance_id and next_instancelevel.instance_id >= next_eliteinstancelevel.instance_id:
                                    # 对应解锁下一关精英
                                    PlayerEliteInstanceLevel.unlock(
                                        self.player,
                                        next_eliteinstancelevel.id)
        # 返回的是下一关的对象信息
        return unlock_new_instance
Ejemplo n.º 8
0
 def instancelevel(self):
     # self.level_id 继承子父类,就是玩家关卡的id
     return get_instancelevel(self.level_id)
Ejemplo n.º 9
0
def init(request, response):
    player = request.player

    player.init_md5Keys()  #初始化md5 seed
    #封号检查
    now = datetime.datetime.now()
    if delta_time(now, player.banAt) > 1:
        #时间差大于1秒
        response.common_response.set("success", False)
        response.common_response.set("errorCode", ErrorID.ERROR_BANNED)
        return response
    activities = get_activities()
    #更新所有奖励
    update_playeractivities(player)
    player.mysteryshop.refresh_auto()

    # player.guildshop.refresh_auto()

    playeritems = player.items.all().values()
    for playeritem in playeritems:
        player.update_item(playeritem)

    playerbuyrecords = player.buyrecords.all().values()
    for playerbuyrecord in playerbuyrecords:
        player.update_buyrecord(playerbuyrecord)

    #playerbuytowerrecords = player.buytowerrecords.all().values()
    #for playerbuytowerrecord in playerbuytowerrecords:
    #    player.update_buytowerrecord(playerbuytowerrecord)

    playerequips = player.equips.all().values()
    for playerequip in playerequips:
        player.update_equip(playerequip)

    playerequipfragments = player.equipfragments.all().values()
    for playerequipfragment in playerequipfragments:
        player.update_equipfragment(playerequipfragment)

    playerartifacts = player.artifacts.all().values()
    for playerartifact in playerartifacts:
        player.update_artifact(playerartifact)

    playerheroes = player.heroes.all().values()
    for playerhero in playerheroes:

        skillhero = get_heroskill(playerhero.warrior.cardId)
        for i in range(0, len(skillhero.skillinfo) / 3):
            skillGild, _, upgrade = skillhero.skillinfo[i * 3:(i + 1) * 3]
            if upgrade > playerhero.upgrade:
                setattr(playerhero, "skill%sLevel" % (i + 1), 0)
            else:
                if not getattr(playerhero, "skill%sLevel" % (i + 1), 0):
                    setattr(playerhero, "skill%sLevel" % (i + 1), 1)

        player.update_hero(playerhero, True)

    playerheroteams = player.heroteams.all().values()
    for playerheroteam in playerheroteams:
        playerheroteam.update_score()
        player.update_heroteam(playerheroteam, True)

    playersouls = player.souls.all().values()
    for playersoul in playersouls:
        player.update_soul(playersoul)

    playerbuildings = player.buildings.all().values()
    for playerbuilding in playerbuildings:
        playerbuilding.check_upgrade()
        player.update_building(playerbuilding)

    playerbuildingplants = player.buildingplants.all().values()
    for playerplant in playerbuildingplants:
        playerplant.check_status()
        player.update_buildingplant(playerplant)

    playerartifacts = player.artifacts.all().values()
    for playerartifact in playerartifacts:
        player.update_artifact(playerartifact)

    playerartifactfragments = player.artifactfragments.all().values()
    for playerartifactfragment in playerartifactfragments:
        player.update_artifactfragment(playerartifactfragment)

    playerbuildingfragments = player.buildingfragments.all().values()
    for playerbuildingfragment in playerbuildingfragments:
        player.update_buildingfragment(playerbuildingfragment)

    playeractivities = player.activities.all().values()
    for playeractivity in playeractivities:
        if playeractivity.activity.isOpen(player.userid):
            player.update_activity(playeractivity)

    for category, _ in player.dailyTasks.items():
        player.update_dailytask(category)

    for category, _ in player.tasks.items():
        player.update_task(category)

    for category, _ in player.dailyTasks.items():
        player.update_dailytask(category)

    for category, _ in player.sevenDaystasks.items():
        player.update_seven_days_task(category)

    if player.tutorial[
            "guideGid"] == Static.TUTORIAL_ID_ELITE_INSTANCE and player.tutorial[
                "status"] == 1:
        player.tutorial_complete()

    # 提前先更新,不然一会返回倒计时的时候会刷新时间
    #player.PVP.update_oppIds()

    #response.common_response.player.set("opps", sumOpps)
    response.common_response.player.set("dailyOppdata", get_yesterday_rank())
    response.common_response.player.set("weekOppdata", get_lastweek_rank())

    response.common_response.player.set("activityValue", player.activityValue)
    response.common_response.player.set("towerGold", player.towerGold)
    response.common_response.player.set("tavern", player.tavern)
    response.common_response.player.set("gold", player.gold)
    response.common_response.player.set("wood", player.wood)
    response.common_response.player.set("diamond", player.yuanbo)
    response.common_response.player.set("xp", player.xp)
    response.common_response.player.set("couragePoint", player.couragepoint)
    response.common_response.player.set("level", player.level)
    response.common_response.player.set("power", player.power)
    response.common_response.player.set("stamina", player.stamina)
    response.common_response.player.set("vip", player.vip)
    response.common_response.player.set("daysFromcreated",
                                        player.daysFromcreated)
    response.common_response.player.set("activityBoxIds",
                                        player.activityBoxIds)
    response.common_response.player.set(
        "completeTaskList",
        [(int(taskId), status)
         for taskId, status in player.completeSevenTasks.items()])
    response.common_response.player.set("dailyTaskActivity",
                                        player.dailyTaskActivity)
    response.common_response.player.set("halfBuyIds", player.halfBuyIds)
    #response.common_response.player.set("speedCount", player.speedCount)
    #response.common_response.player.set("beSpeededCount", player.beSpeededCount)
    response.common_response.player.set("powerCDTime", player.next_power_time)
    response.common_response.player.set("staminaCDTime",
                                        player.next_stamina_time)
    response.common_response.player.set("weekCardLeftDay",
                                        player.week_card_left_day)
    response.common_response.player.set("monthCardLeftDay",
                                        player.month_card_left_day)
    response.common_response.player.set("permanentCardActivity",
                                        player.permanent_card_is_activity)
    response.common_response.player.set("wallHp", player.wall_level)
    response.common_response.player.set("tutorial", player.tutorial)
    response.common_response.player.set("buyDiamondIds",
                                        player.yuanboshop.to_dict())
    response.common_response.player.set("hasUnReadMails",
                                        player.has_unread_mails)
    response.common_response.player.set("openDiamondShop",
                                        settings.OPEN_PAYMENT)
    response.common_response.player.set("mysteryShop",
                                        player.mysteryshop.to_dict())
    response.common_response.player.set("guildShop",
                                        player.guildshop.to_dict())
    response.common_response.player.set("guild",
                                        player.guild.to_dict(True, True))

    response.common_response.player.set("playerWarriorIds",
                                        player.playerWarriorIds)
    response.common_response.player.set("lastRaidId", player.lastRaidId)
    response.common_response.player.set("smallGameLeftTimes",
                                        player.smallGameLeftTimes)
    response.common_response.player.set("elementTower",
                                        player.elementTower.to_dict())
    response.common_response.player.set("offlinebonus", player.offlinebonus)
    response.common_response.player.set("wallWarriorIds",
                                        player.wallWarriorIds)
    response.common_response.player.set("safedTime", player.safedTime)

    #PVP
    if player.isOpenArena:
        player.arenashop.refresh_auto()
        response.common_response.player.set("honorShop",
                                            player.arenashop.to_dict())
        response.common_response.player.set("arena", player.PVP.to_dict())
    #攻城战
    if player.isOpenSiege:
        # TODO: 攻城战刷新
        # player.SiegeBattle.refresh_auto()
        response.common_response.player.set("siegeBattle",
                                            player.SiegeBattle.to_dict())

    # fire = get_fireinfo_by_guildId(player.guildId)
    # if fire:
    #     fire = fire[0]
    #     make_fireInfo(fire)

    # response.common_response.player.set("fireBuff", player.fireBuff)

    response.common_response.player.set("userInfo", player.userSimple_dict())
    response.common_response.player.set("soldiers", player.armies.to_dict())

    if player.tutorial_id == Static.TUTORIAL_ID_INIT_1:
        player_tutorial_heroes = get_tutorial_heroes(player)

        response.common_response.player.set(
            "tutorialHeroes",
            [hero.to_dict() for hero in player_tutorial_heroes])
        enemies = get_instancelevel(1).enemies
        response.common_response.player.set(
            "enemies", [enemy.to_dict() for enemy in enemies])

    response.common_response.player.set("instance",
                                        get_player_view_instance_dict(player))
    response.common_response.player.set("starBox",
                                        {"history": player.starChest})
    response.common_response.player.set("eliteStarBox",
                                        {"history": player.eliteStarChest})
    response.common_response.player.set(
        "raidInstance", {"instances": get_player_open_raidinstance(player)})
    # response.common_response.player.set("waravoidCDTime", player.waravoidCDTime)
    response.common_response.player.set("seeds", player.md5Seeds)
    response.common_response.player.set("firstIn", player.firstIn)
    #整点请求
    now = datetime.datetime.now()
    next_hour = now + datetime.timedelta(seconds=3600)
    next_int_hour = datetime.datetime(next_hour.year, next_hour.month,
                                      next_hour.day, next_hour.hour)
    serverIntCDTime = (next_int_hour - now).total_seconds() + 1
    response.common_response.set("serverIntCDTime", int(serverIntCDTime))
    response.common_response.player.set("defenseHeroIds",
                                        player.defenseHeroIds)
    response.common_response.player.set("defenseSiegeIds",
                                        player.defenseSiegeIds)
    response.common_response.player.set("defenseSiegeSoldierIds",
                                        player.defenseSiegeSoldierIds)
    #zrd
    response.common_response.set(
        "activities", [activity.to_dict() for activity in activities])
    response.common_response.set("serverTime", int(time.time()))
    return response