Ejemplo n.º 1
0
Archivo: pack.py Proyecto: hw233/test-2
def pack_team_info(team, message):
    message.index = team.index
    #message.status = team.status

    heroes_id = team.get_heroes()
    assert len(heroes_id) == 3
    for hero_id in heroes_id:
        basic_id = HeroInfo.get_basic_id(hero_id)
        message.heroes.add().basic_id = basic_id

    message.battle_node_id = team.battle_node_basic_id
    message.union_battle_node_index = team.union_battle_node_index
    message.in_anneal_sweep = (team.anneal_sweep_floor != 0)
Ejemplo n.º 2
0
Archivo: pack.py Proyecto: hw233/test-2
def _pack_node_exploitation_info(data, node, message, now):
    message.node_id = node.basic_id #TODO delete
    message.type = node.exploit_type

    message.gather_speed = node.gather_speed
    message.gather_duration = now - node.gather_start_time

    message.total_time = node.exploit_total_time
    message.duration = now - node.exploit_start_time
    if node.is_exploit_money():
        message.total_money = node.exploit_reserve
        message.level = node.exploit_level

    elif node.is_exploit_food():
        message.total_food = node.exploit_reserve
        message.level = node.exploit_level

    elif node.is_exploit_gold():
        message.total_gold = node.exploit_reserve
        message.level = node.exploit_level

    elif node.is_exploit_material():
        message.level = node.exploit_level

    elif node.is_exploit_random_item():
        exploitation = data.exploitation.get()
        if node.is_exploit_exist():
            message.level = node.exploit_level
        else:
            message.level = exploitation.search_level
        message.progress = exploitation.get_search_progress()

    elif node.is_exploit_enchant_material():
        exploitation = data.exploitation.get()
        if node.is_exploit_exist():
            message.level = node.exploit_level
        else:
            message.level = exploitation.deep_mining_level
        message.progress = exploitation.get_deep_mining_progress()

    elif node.is_exploit_hero_star_soul():
        exploitation = data.exploitation.get()
        if node.is_exploit_exist():
            message.level = node.exploit_level
        else:
            message.level = exploitation.hermit_level
        message.progress = exploitation.get_hermit_progress()

    for hero_id in node.get_exploit_hero():
        message.hero_basic_ids.append(HeroInfo.get_basic_id(hero_id))
Ejemplo n.º 3
0
Archivo: pack.py Proyecto: hw233/test-2
def pack_building_info(info, message, now):
    message.basic_id = info.basic_id
    message.city_basic_id = BuildingInfo.get_city_basic_id(info.id)
    message.location_index = info.slot_index

    message.level = info.level
    message.garrision_num = info.garrison_num
    hero_ids = utils.split_to_int(info.hero_ids)
    for id in hero_ids:
        message.hero_basic_ids.append(HeroInfo.get_basic_id(id))

    message.is_upgrading = info.is_upgrade
    message.upgrade_start_time = info.upgrade_start_time
    message.upgrade_consume_time = info.upgrade_consume_time
    message.upgrade_passed_time = now - message.upgrade_start_time