当前位置: 首页>>代码示例>>Python>>正文


Python Character.get_attribute方法代码示例

本文整理汇总了Python中Character.Character.get_attribute方法的典型用法代码示例。如果您正苦于以下问题:Python Character.get_attribute方法的具体用法?Python Character.get_attribute怎么用?Python Character.get_attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Character.Character的用法示例。


在下文中一共展示了Character.get_attribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_r_name

# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import get_attribute [as 别名]
    def get_r_name(self, nametype, gender="undecided"):
        x = Character()
        x.giveRandomName(gender)

        if nametype == "first":
            self.__char.set_attribute("First name", x.get_attribute("First name"))
            return x.get_attribute("First name")
        if nametype == "second":
            self.__char.set_attribute("Second name", x.get_attribute("Second name"))
            return x.get_attribute("Second name")
        if nametype == "last":
            self.__char.set_attribute("Last name", x.get_attribute("Last name"))
            return x.get_attribute("Last name")
        if nametype == "nick":
            self.__char.set_attribute("First alias", x.get_attribute("First alias"))
            self.__char.set_attribute("Last alias", x.get_attribute("Last alias"))
            alias = x.get_attribute("First alias") + " " + x.get_attribute("Last alias")
            self.__char.set_attribute("Alias", alias)
            return alias
开发者ID:Krypticdator,项目名称:First,代码行数:21,代码来源:Controller.py

示例2: add_to_inventory

# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import get_attribute [as 别名]
    def add_to_inventory(self, *args):
        id = self.box_list.curselection()
        luku = int(id[0])
        text = self.box_list.get(luku)
        if text=='Favor' or text=='Contact':
            x = Character()
            x.giveRandomName()
            name = x.get_attribute('Full name')
            text = text + '(' + name + ')'
        self.contr.set_to_ability_list(self.name, text, 1)
        #list = self.contr.get_from_ability_list(self.name)
        #value = self.contr.get_char_skill(text)
        value = self.contr.get_from_ability_list(self.name, text)

        text = text + '\t\t\t\t|' + str(value) + '\n'
        self.text_inventory.insert('end', text)

        
开发者ID:Krypticdator,项目名称:First,代码行数:18,代码来源:GUI_perks.py

示例3: load_pc_roster

# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import get_attribute [as 别名]
 def load_pc_roster(self, filepath_table):
     for path in filepath_table:
         c = Character(self.prefs)
         self.prefs.load_character(path, c)
         player = c.get_attribute('player')
         self.__pc_roster[player] = c
开发者ID:Krypticdator,项目名称:GameSession,代码行数:8,代码来源:Controller.py

示例4: Controller

# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import get_attribute [as 别名]
class Controller(object):
    """description of class"""
    def __init__(self):
        self.prefs = Preferences()
        self.db = SQLController()
        self.load_skill_bp_into_prefs()
        self.__ui_components = {}
        self.__pc_roster = {}
        self.__skill_shorts = {}
        pc_filepaths = []
        #pc_filepaths.append('preferences/Rasmus_Shawn Everette Slow Curve Manning.xml')
        pc_filepaths.append('preferences/Rasmus_Shawn Everette Slow Curve Manning.xml')
        self.load_pc_roster(pc_filepaths)
        #print(str(self.__pc_roster['Toni']))

        self.prepare_skill_shorts()

        weapons = self.prefs.transfer_wpns_from_txt_to_sql()
        wpn_table=self.db.table('wpn_blueprints')

        skills = self.prefs.get_skills_dictionary()
        skill_bp_table = self.db.table('skill_blueprints')
        #self.__wpn_db = WeaponSqlController()
        self.add_skills_bp_to_db(skills, skill_bp_table)
        
        #print(weapons)
        for weapon in weapons:
            name = str(weapon.get_attribute('name'))
            type = str(weapon.get_attribute('type'))
            wa = str(weapon.get_attribute('wa'))
            con = str(weapon.get_attribute('con'))
            av = str(weapon.get_attribute('av'))
            dmg = str(weapon.get_attribute('dmg'))
            ammo = str(weapon.get_attribute('ammo'))
            shts = str(weapon.get_attribute('shts'))
            rof = str(weapon.get_attribute('rof'))
            rel = str(weapon.get_attribute('rel'))
            range = str(weapon.get_attribute('range'))
            cost = str(weapon.get_attribute('cost'))
            source = str(weapon.get_attribute('source'))
            category = str(weapon.get_attribute('category'))
            wpn_table.add_wpn(name, type, wa, con, av, dmg, ammo, shts, rof, rel, range, cost, category=category, source=source)
        #wpn_table.print_table()
            

        
       

        self.load_character('preferences/Rasmus_Shawn Everette Slow Curve Manning.xml')
        self.db.add_character_to_database(self.c)
        start = StartMenu(self)
        #start = SkillShortsInspector(controller=self)
    def add_skills_bp_to_db(self, skill_list, skill_table):
        for key, value in skill_list.items():
            name = value.get_attribute('name')
            stat = value.get_attribute('stat')
            short = value.get_attribute('short')
            diff = value.get_attribute('diff')
            category = value.get_attribute('category')
            description = value.get_attribute('description')
            chip = value.get_attribute('ischippable')
            
            skill_table.add(name, stat, short, diff, category, chip, description) 
    def load_pc_roster(self, filepath_table):
        for path in filepath_table:
            c = Character(self.prefs)
            self.prefs.load_character(path, c)
            player = c.get_attribute('player')
            self.__pc_roster[player] = c
            #print(str(c))

    def load_wpn_sql_table(self):
        wpn = self.db.table('wpn_blueprints')
        return wpn.query_all()

    def load_single_sql_wpn(self, name):
        wpn = self.db.table('wpn_blueprints')
        return wpn.search_with_name(name)

    def update_sql_wpn(self, name, type, wa, con, av, dmg, ammo, shts, rof, rel, range, cost, weight, flags, options, alt_munitions, description, category):
        wpn_table = self.db.table('wpn_blueprints')
        wpn_table.update_wpn(name, type, wa, con, av, dmg, ammo, shts, rof, rel, range, cost, weight, flags, options, alt_munitions, description, category)

    def prepare_skill_shorts(self):
        skills = self.prefs.get_skills_dictionary()

        for key, value in skills.items():
            try:
                short = value.get_attribute('short')
                name = value.get_attribute('name')
                self.__skill_shorts[short] = name
            except Exception:
                pass
    def get_skill_from_short(self, short):
        try:
            skill = self.__skill_shorts[short]
            return skill
        except Exception:
            return 'error'

#.........这里部分代码省略.........
开发者ID:Krypticdator,项目名称:GameSession,代码行数:103,代码来源:Controller.py


注:本文中的Character.Character.get_attribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。