def init_character(character_id: int, character_tem: game_type.NpcTem): """ 按id生成角色属性 Keyword arguments: character_id -- 角色id character_tem -- 角色生成模板数据 """ now_character = game_type.Character() now_character.name = character_tem.Name now_character.sex = character_tem.Sex if character_tem.MotherTongue != "": now_character.mother_tongue = character_tem.MotherTongue if character_tem.Age != "": now_character.age = attr_calculation.get_age(character_tem.Age) if character_tem.Weight != "": now_character.weigt_tem = character_tem.Weight if character_tem.SexExperienceTem != "": if character_tem.SexExperienceTem != "Rand": now_character.sex_experience_tem = character_tem.SexExperienceTem else: now_character.sex_experience_tem = get_rand_npc_sex_experience_tem( now_character.age, now_character.sex) if character_tem.BodyFat: now_character.bodyfat_tem = character_tem.BodyFat else: now_character.bodyfat_tem = now_character.weigt_tem if character_tem.Chest: now_character.chest_tem = character_tem.Chest character.init_attr(now_character) cache_contorl.character_data[character_id] = now_character
def detailed_setting_func_1(): """ 询问玩家年龄模板流程 """ flow_retun = creator_character_panel.detailed_setting_1_panel() character_age_tem_name = attr_calculation.get_age_tem_list()[flow_retun] cache_contorl.character_data[0].age = attr_calculation.get_age( character_age_tem_name) py_cmd.clr_cmd() detailed_setting_func_3()
def setting_age_tem_panel(): """ 设置年龄模板 """ character_data: game_type.Character = cache.character_data[0] message = _("{character_nick_name}是一个小孩子吗?").format( character_nick_name=character_data.nick_name) ask_list = [ _("嘎呜~嘎呜~"), _("才,才不是小孩子!"), _("已经成年了哦~"), _("我也想回到小时候呢~"), _("你说什么?我听不清~"), ] button_panel = panel.OneMessageAndSingleColumnButton() button_panel.set(ask_list, message) return_list = button_panel.get_return_list() button_panel.draw() ans = flow_handle.askfor_all(return_list.keys()) character_data.age = attr_calculation.get_age(int(ans))
def init_character(character_id: int, character_tem: dict): """ 按id生成角色属性 Keyword arguments: character_id -- 角色id character_tem -- 角色生成模板数据 """ now_character = character.Character() now_character.name = character_tem["Name"] now_character.sex = character_tem["Sex"] if "MotherTongue" in character_tem: now_character.mother_tongue = character_tem["MotherTongue"] if "Age" in character_tem: now_character.age = attr_calculation.get_age(character_tem["Age"]) if "Weight" in character_tem: now_character.weigt_tem = character_tem["Weight"] if "BodyFat" in character_tem: now_character.bodyfat_tem = character_tem["BodyFat"] else: now_character.bodyfat_tem = now_character.weigt_tem if "Chest" in character_tem: now_character.chest_tem = character_tem["Chest"] now_character.init_attr() cache_contorl.character_data["character"][character_id] = now_character