Example #1
0
def see_character_info_panel():
    """
    查看当前互动对象信息面板
    """
    character_info = text_loading.get_text_data(
        constant.FilePath.STAGE_WORD_PATH, "77")
    era_print.normal_print(character_info)
    character_id = cache_contorl.character_data["character_id"]
    character_data = cache_contorl.character_data["character"][character_id]
    character_name = character_data.name
    era_print.normal_print(character_name)
    era_print.normal_print(" ")
    sex = character_data.sex
    sex_text = text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH,
                                          "2") + attr_text.get_sex_text(sex)
    era_print.normal_print(sex_text)
    era_print.normal_print(" ")
    intimate_info = text_loading.get_text_data(
        constant.FilePath.STAGE_WORD_PATH, "16")
    graces_info = text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH,
                                             "17")
    character_intimate_text = intimate_info + f"{character_data.intimate}"
    character_graces_text = graces_info + f"{character_data.graces}"
    era_print.normal_print(character_intimate_text)
    era_print.normal_print(" ")
    era_print.normal_print(character_graces_text)
    state_text = attr_text.get_state_text(character_id)
    era_print.normal_print(" ")
    era_print.normal_print(state_text)
    era_print.little_line_print()
Example #2
0
def see_character_sex_experience_panel(character_id: int):
    """
    查看角色性经验面板
    Keyword arguments:
    character_id -- 角色Id
    """
    era_print.little_line_print()
    era_print.line_feed_print(
        text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "5")
    )
    character_data = cache_contorl.character_data["character"][character_id]
    character_sex_grade_list = character_data.sex_grade
    character_sex = cache_contorl.character_data["character"][character_id].sex
    character_sex_grade_text_list = attr_text.get_sex_grade_text_list(
        character_sex_grade_list, character_sex
    )
    era_print.list_print(character_sex_grade_text_list, 4, "center")
    era_print.line_feed_print(
        text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "7")
    )
    character_engraving = character_data.engraving
    character_engraving_text = attr_text.get_engraving_text(
        character_engraving
    )
    era_print.list_print(character_engraving_text, 3, "center")
Example #3
0
def see_scene_panel():
    """
    当前场景信息面板
    """
    title_text = text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH,
                                            "75")
    era_print.little_title_print(title_text)
    time_text = game_time.get_date_text()
    era_print.normal_print(time_text)
    era_print.normal_print(" ")
    scene_path = cache_contorl.character_data["character"][0].position
    scene_path_str = map_handle.get_map_system_path_str_for_list(scene_path)
    map_list = map_handle.get_map_hierarchy_list_for_scene_path(scene_path, [])
    map_path_text = ""
    map_list.reverse()
    for now_map in map_list:
        now_map_map_system_str = map_handle.get_map_system_path_str_for_list(
            now_map)
        map_name = cache_contorl.map_data[now_map_map_system_str]["MapName"]
        map_path_text += map_name + "-"
    scene_data = cache_contorl.scene_data[scene_path_str].copy()
    scene_name = map_path_text + scene_data["SceneName"]
    scene_info_head = text_loading.get_text_data(
        constant.FilePath.STAGE_WORD_PATH, "76")
    scene_info = scene_info_head + scene_name
    era_print.normal_print(scene_info)
    panel_state = cache_contorl.panel_state["SeeSceneCharacterListPage"]
    switch = panel_state_on_text
    if panel_state == "0":
        switch = panel_state_off_text
    scene_character_list = scene_data["SceneCharacterData"]
    if len(scene_character_list) > 1:
        era_print.normal_print(" ")
        py_cmd.pcmd(switch, "SeeSceneCharacterListPage")
    era_print.little_line_print()
Example #4
0
def see_character_wear_clothes_cmd(start_id: int) -> str:
    """
    用于控制查看角色已装备服装列表面板的命令菜单
    """
    era_print.little_line_print()
    yrn = cmd_button_queue.option_int(
        constant.CmdMenu.SEE_CHARACTER_WEAR_CHOTHES,
        id_size="center",
        askfor=False,
        start_id=start_id,
    )
    return yrn
Example #5
0
def show_scene_name_list_panel() -> str:
    """
    地图下场景名称绘制面板
    """
    title_text = text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH,
                                            "86")
    era_print.normal_print(title_text)
    panel_state = cache_contorl.panel_state["SeeSceneNameListPanel"]
    if panel_state == "0":
        py_cmd.pcmd(panel_state_off_text, "SeeSceneNameListPanel")
        era_print.line_feed_print()
        now_map = cache_contorl.now_map
        now_position = cache_contorl.character_data[0].position
        now_scene = map_handle.get_scene_id_in_map_for_scene_path_on_map_path(
            now_position, now_map)
        now_map_map_system_str = map_handle.get_map_system_path_str_for_list(
            now_map)
        scene_name_data = map_handle.get_scene_name_list_for_map_path(
            now_map_map_system_str)
        scene_name_list = {}
        null_scene = now_scene
        for scene in scene_name_data:
            scene_name_list[scene] = scene + ":" + scene_name_data[scene]
        cmd_button_queue.option_str(
            None,
            4,
            "center",
            False,
            False,
            list(scene_name_list.values()),
            null_scene,
            list(scene_name_list.keys()),
        )
    else:
        py_cmd.pcmd(panel_state_on_text, "SeeSceneNameListPanel")
        era_print.line_feed_print()
    era_print.little_line_print()
    return "SeeSceneNameListPanel"
Example #6
0
def see_character_list_panel(max_page: int) -> list:
    """
    查看角色列表面板
    Keyword arguments:
    max_page -- 最大角色列表页数
    """
    title_text = text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH,
                                            "74")
    era_print.little_title_print(title_text)
    input_s = []
    page_id = int(cache_contorl.panel_state["SeeCharacterListPanel"])
    page_show = int(game_config.character_list_show)
    character_max = len(cache_contorl.character_data["character"]) - 1
    if page_id == max_page:
        show_page_start = page_show * page_id
        show_page_over = show_page_start + (character_max + 1 -
                                            show_page_start)
    else:
        show_page_over = page_show * (page_id + 1)
        show_page_start = show_page_over - page_show
    for i in range(show_page_start, show_page_over):
        cmd_id = i - show_page_start
        cmd_id_text = cmd_button_queue.id_index(cmd_id)
        cmd_text = attr_text.get_character_abbreviations_info(i)
        cmd_id_text_index = text_handle.get_text_index(cmd_id_text)
        window_width = int(game_config.text_width)
        text_width = window_width - cmd_id_text_index
        cmd_text = text_handle.align(cmd_text, "center", text_width=text_width)
        cmd_text = cmd_id_text + " " + cmd_text
        cmd_id = str(cmd_id)
        era_print.little_line_print()
        py_cmd.pcmd(cmd_text, cmd_id, None)
        input_s.append(cmd_id)
        era_print.normal_print("\n")
    page_text = "(" + str(page_id) + "/" + str(max_page) + ")"
    era_print.page_line_print(sample="-", string=page_text)
    era_print.line_feed_print()
    return input_s
Example #7
0
def see_character_main_attr_panel(character_id: int):
    """
    查看角色主属性面板
    Keyword arguments:
    character_id -- 角色Id
    """
    title_1 = text_loading.get_text_data(
        constant.FilePath.STAGE_WORD_PATH, "1"
    )
    era_print.little_title_print(title_1)
    character_id_text = f"{text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, '0')}{character_id}"
    character_data = cache_contorl.character_data["character"][character_id]
    name = character_data.name
    nick_name = character_data.nick_name
    character_name = (
        text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "13")
        + name
    )
    character_nick_name = (
        text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "12")
        + nick_name
    )
    sex = character_data.sex
    sex_text = text_loading.get_text_data(
        constant.FilePath.STAGE_WORD_PATH, "2"
    ) + attr_text.get_sex_text(sex)
    name_text = (
        character_id_text
        + " "
        + character_name
        + " "
        + character_nick_name
        + " "
        + sex_text
    )
    hp_bar = attr_print.get_hp_or_mp_bar(
        character_id, "HitPoint", game_config.text_width / 2 - 4
    )
    era_print.list_print([name_text, hp_bar], 2, "center")
    era_print.line_feed_print()
    state_text = attr_text.get_state_text(character_id)
    mp_bar = attr_print.get_hp_or_mp_bar(
        character_id, "ManaPoint", game_config.text_width / 2 - 4
    )
    era_print.list_print([state_text, mp_bar], 2, "center")
    era_print.line_feed_print()
    era_print.little_line_print()
    stature_text = attr_text.get_stature_text(character_id)
    era_print.line_feed_print(stature_text)
    era_print.restart_line_print(".")
    era_print.line_feed_print(
        attr_text.get_character_dormitory_path_text(character_id)
    )
    era_print.little_line_print()
    character_species = f"{text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, '15')}{character_data.species}"
    character_age = f"{text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, '3')}{character_data.age}"
    birthday_text = f"{text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH,'140')}{character_data.birthday['month']}{text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH,'60')}{character_data.birthday['day']}{text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH,'61')}"
    era_print.list_print(
        [character_species, character_age, birthday_text], 3, "center"
    )
    era_print.restart_line_print(".")
    character_intimate = f"{text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, '16')}{character_data.intimate}"
    character_graces = f"{text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, '17')}{character_data.graces}"
    era_print.list_print([character_intimate, character_graces], 2, "center")
    era_print.restart_line_print(".")
    character_chest = character_data.chest["NowChest"]
    chest_group = attr_calculation.judge_chest_group(character_chest)
    chest_text = (
        text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "141")
        + text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "142")[
            chest_group
        ]
    )
    era_print.list_print([chest_text], 1, "center")
    era_print.restart_line_print(".")
    character_height = character_data.height["NowHeight"]
    character_weight = character_data.weight
    character_height_text = str(round(character_height, 2))
    character_weight_text = str(round(character_weight, 2))
    character_height_info = (
        text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "80")
        + character_height_text
    )
    character_weight_info = (
        text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "81")
        + character_weight_text
    )
    era_print.list_print(
        [character_height_info, character_weight_info], 2, "center"
    )
    era_print.restart_line_print(".")
    character_measurements = character_data.measurements
    character_bust = str(round(character_measurements["Bust"], 2))
    character_waist = str(round(character_measurements["Waist"], 2))
    character_hip = str(round(character_measurements["Hip"], 2))
    character_bust_info = (
        text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "82")
        + character_bust
    )
    character_waist_info = (
        text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "83")
        + character_waist
    )
    character_hip_info = (
        text_loading.get_text_data(constant.FilePath.STAGE_WORD_PATH, "84")
        + character_hip
    )
    era_print.list_print(
        [character_bust_info, character_waist_info, character_hip_info],
        3,
        "center",
    )
    era_print.restart_line_print(".")
Example #8
0
def see_character_wear_clothes(character_id: int, change_button: bool):
    """
    查看角色穿戴服装列表面板
    Keyword arguments:
    character_id -- 角色id
    change_button -- 将服装列表绘制成按钮的开关
    """
    character_clothing_data = cache_contorl.character_data[
        character_id
    ].clothing
    character_put_on_list = cache_contorl.character_data[character_id].put_on
    clothing_text_data = {}
    tag_text_index = 0
    for i in range(len(clothing.clothing_type_text_list.keys())):
        clothing_type = list(clothing.clothing_type_text_list.keys())[i]
        clothing_id = character_put_on_list[clothing_type]
        if clothing_id == "":
            clothing_text_data[clothing_type] = "None"
        else:
            clothing_data = character_clothing_data[clothing_type][clothing_id]
            clothing_text = (
                clothing.clothing_type_text_list[clothing_type]
                + ":"
                + clothing_data["Evaluation"]
                + clothing_data["Tag"]
                + clothing_data["Name"]
            )
            clothing_text_data[clothing_text] = {}
            for tag in clothing.clothing_tag_text_list:
                tag_text = clothing.clothing_tag_text_list[tag] + str(
                    clothing_data[tag]
                )
                clothing_text_data[clothing_text][tag_text] = 0
                now_tag_text_index = text_handle.get_text_index(tag_text)
                if now_tag_text_index > tag_text_index:
                    tag_text_index = now_tag_text_index
    long_clothing_text_index = text_handle.get_text_index(
        max(clothing_text_data.keys(), key=text_handle.get_text_index)
    )
    i = 0
    input_s = []
    for clothing_text in clothing_text_data:
        draw_text = ""
        era_print.little_line_print()
        if clothing_text_data[clothing_text] == "None":
            draw_text = (
                clothing.clothing_type_text_list[clothing_text]
                + ":"
                + text_loading.get_text_data(
                    constant.FilePath.STAGE_WORD_PATH, "117"
                )
            )
        else:
            now_clothing_text_index = text_handle.get_text_index(clothing_text)
            draw_text += clothing_text + " "
            if now_clothing_text_index < long_clothing_text_index:
                draw_text += " " * (
                    long_clothing_text_index - now_clothing_text_index
                )
            for tag_text in clothing_text_data[clothing_text]:
                now_tag_text_index = text_handle.get_text_index(tag_text)
                if now_tag_text_index < tag_text_index:
                    draw_text += (
                        " "
                        + tag_text
                        + " " * (tag_text_index - now_tag_text_index)
                    )
                else:
                    draw_text += " " + tag_text
        if change_button:
            id_info = cmd_button_queue.id_index(i)
            cmd_text = id_info + draw_text
            py_cmd.pcmd(cmd_text, i, None)
        else:
            era_print.normal_print(draw_text)
        input_s.append(f"{i}")
        i += 1
        era_print.normal_print("\n")
    return input_s
Example #9
0
def see_character_clothes_panel(
    character_id: str, clothing_type: str, max_page: int
) -> list:
    """
    用于查看角色服装列表的面板
    Keyword arguments:
    character_id -- 角色id
    clothing_type -- 服装类型
    max_page -- 服装列表最大页数
    Rerurn arguments:
    list -- 监听的按钮列表
    """
    era_print.line_feed_print()
    character_clothing_data = cache_contorl.character_data[
        character_id
    ].clothing[clothing_type]
    clothing_text_data = {}
    tag_text_index = 0
    now_page_id = int(cache_contorl.panel_state["SeeCharacterClothesPanel"])
    now_page_max = game_config.see_character_clothes_max
    now_page_start_id = now_page_id * now_page_max
    now_page_end_id = now_page_start_id + now_page_max
    if character_clothing_data == {}:
        era_print.normal_print(
            text_loading.get_text_data(constant.FilePath.MESSAGE_PATH, "34")
        )
        era_print.line_feed_print()
        return []
    if now_page_end_id > len(character_clothing_data.keys()):
        now_page_end_id = len(character_clothing_data.keys())
    pass_id = None
    for i in range(now_page_start_id, now_page_end_id):
        clothing_id = list(character_clothing_data.keys())[i]
        if (
            clothing_id
            == cache_contorl.character_data[character_id].put_on[clothing_type]
        ):
            pass_id = i - now_page_start_id
        clothing_data = character_clothing_data[clothing_id]
        clothing_text = (
            clothing_data["Evaluation"]
            + clothing_data["Tag"]
            + clothing_data["Name"]
        )
        clothing_text_data[clothing_text] = {}
        for tag in clothing.clothing_tag_text_list:
            tag_text = clothing.clothing_tag_text_list[tag] + str(
                clothing_data[tag]
            )
            clothing_text_data[clothing_text][tag_text] = 0
            now_tag_text_index = text_handle.get_text_index(tag_text)
            if now_tag_text_index == now_tag_text_index:
                tag_text_index = now_tag_text_index
    long_clothing_text_index = text_handle.get_text_index(
        max(clothing_text_data.keys(), key=text_handle.get_text_index)
    )
    i = 0
    input_s = []
    for clothing_text in clothing_text_data:
        draw_text = ""
        era_print.little_line_print()
        now_clothing_text_index = text_handle.get_text_index(clothing_text)
        draw_text += clothing_text + " "
        if now_clothing_text_index < long_clothing_text_index:
            draw_text += " " * (
                long_clothing_text_index - now_clothing_text_index
            )
        for tag_text in clothing_text_data[clothing_text]:
            now_tag_text_index = text_handle.get_text_index(tag_text)
            if now_tag_text_index < tag_text_index:
                draw_text += (
                    " "
                    + tag_text
                    + " " * (tag_text_index - now_tag_text_index)
                )
            else:
                draw_text += " " + tag_text
        if i == pass_id:
            draw_text += " " + text_loading.get_text_data(
                constant.FilePath.STAGE_WORD_PATH, "125"
            )
        id_info = cmd_button_queue.id_index(i)
        cmd_text = id_info + draw_text
        input_s.append(f"{i}")
        py_cmd.pcmd(cmd_text, i, None)
        era_print.line_feed_print()
        i += 1
    era_print.normal_print("\n")
    page_text = "(" + str(now_page_id) + "/" + str(max_page) + ")"
    era_print.page_line_print(sample="-", string=page_text)
    era_print.line_feed_print()
    return input_s
def see_save_list_panel(page_save_value: int,
                        last_save_page_value: int,
                        auto_save=False) -> list:
    """
    查看存档页面面板
    Keyword arguments:
    page_save_value -- 单页最大存档显示数量
    last_save_page_value -- 最后一页存档显示数量
    auto_save -- 自动存档显示开关 (default False)
    """
    save_panel_page = int(cache_contorl.panel_state["SeeSaveListPanel"]) + 1
    input_s = []
    id_text_list = []
    id_info_text = text_loading.get_text_data(
        constant.FilePath.STAGE_WORD_PATH, "72")
    text_width = int(game_config.text_width)
    save_none_text = text_loading.get_text_data(constant.FilePath.MESSAGE_PATH,
                                                "20")
    if save_panel_page == int(game_config.save_page) + 1:
        start_save_id = int(page_save_value) * (save_panel_page - 1)
        over_save_id = start_save_id + last_save_page_value
    else:
        over_save_id = int(page_save_value) * save_panel_page
        start_save_id = over_save_id - int(page_save_value)
    for i in range(0, over_save_id - start_save_id):
        id = cmd_button_queue.id_index(i)
        save_id = start_save_id + i
        if auto_save and not save_handle.judge_save_file_exist(str(save_id)):
            id_text = id_info_text + " " + str(save_id) + ":"
            id_text_list.append(id_text)
        else:
            id_text = id + id_info_text + " " + str(save_id) + ":"
            id_text_list.append(id_text)
    for i in range(0, over_save_id - start_save_id):
        id = str(i)
        id_text = id_text_list[i]
        era_print.little_line_print()
        save_id = str(save_handle.get_save_page_save_id(page_save_value, i))
        if save_handle.judge_save_file_exist(save_id):
            save_info_head = save_handle.load_save_info_head(save_id)
            game_time_data = save_info_head["game_time"]
            game_time_text = game_time.get_date_text(game_time_data)
            character_name = save_info_head["character_name"]
            save_verson = save_info_head["game_verson"]
            save_text = (character_name + " " + game_time_text + " " +
                         save_verson)
            id_text_index = int(text_handle.get_text_index(id_text))
            fix_id_width = text_width - id_text_index
            save_align = text_handle.align(save_text,
                                           "center",
                                           text_width=fix_id_width)
            id_text = id_text + save_align
            py_cmd.pcmd(id_text, id, None)
            input_s.append(id)
            era_print.normal_print("\n")
        else:
            id_text_index = int(text_handle.get_text_index(id_text))
            fix_id_width = text_width - id_text_index
            save_none_align = text_handle.align(save_none_text,
                                                "center",
                                                text_width=fix_id_width)
            id_text = id_text + save_none_align
            if auto_save:
                era_print.normal_print(id_text)
            else:
                py_cmd.pcmd(id_text, id, None)
                input_s.append(id)
        era_print.line_feed_print()
    if auto_save:
        auto_info_text = text_loading.get_text_data(
            constant.FilePath.STAGE_WORD_PATH, "73")
        i = page_save_value
        id = cmd_button_queue.id_index(i)
        era_print.little_line_print()
        if save_handle.judge_save_file_exist("auto"):
            save_info_head = save_handle.load_save_info_head("auto")
            game_time_data = save_info_head["game_time"]
            game_time_text = game_time.get_date_text(game_time_data)
            character_name = save_info_head["character_name"]
            save_verson = save_info_head["game_verson"]
            save_text = (character_name + " " + game_time_text + " " +
                         save_verson)
            id_text = id + auto_info_text
            id_text_index = int(text_handle.get_text_index(id_text))
            fix_id_width = text_width - id_text_index
            save_text_align = text_handle.align(save_text,
                                                "center",
                                                text_width=fix_id_width)
            id_text = id_text + save_text_align
            py_cmd.pcmd(id_text, id, None)
            input_s.append(id)
            era_print.line_feed_print()
        else:
            id_text_index = int(text_handle.get_text_index(auto_info_text))
            fix_id_width = text_width - id_text_index
            save_none_align = text_handle.align(save_none_text,
                                                "center",
                                                text_width=fix_id_width)
            id_text = auto_info_text + save_none_align
            era_print.normal_print(id_text)
            era_print.line_feed_print()
    return input_s