Ejemplo n.º 1
0
    def test(cls):
        import types

        class Owner:
            inventory = []

        creature = cls()
        creature.owner = Owner()

        dic = {}
        dic_keys = dir(creature)
        for att in dic_keys:
            if isinstance(getattr(creature, att), types.FunctionType):
                continue
            elif att[-2:] == "__":
                continue
            elif isinstance(getattr(type(creature), att, None), property):
                dic[att] = getattr(
                    type(creature), att).__get__(creature, type(creature))

            else:
                dic[att] = getattr(creature, att, None)

        from mylib.data_tree import tk_tree_view
        tk_tree_view(dic)
Ejemplo n.º 2
0
    def test(cls):
        """..."""
        class Owner():
            inventory = []

        from mylib.data_tree import tk_tree_view

        weapon = WeaponComponent("aklys")
        tk_tree_view(weapon.__dict__)
Ejemplo n.º 3
0
def tree_view(obj, expand=None):
    """..."""
    expand = expand if expand else []
    if isinstance(obj, dict):
        _obj = type('dummy', (object,), obj)
    else:
        _obj = obj

    dic = Tree(_obj, expand)
    recursive_adjustments(dic)
    tk_tree_view(dic)
Ejemplo n.º 4
0
def view(creature):
    import types
    from mylib.data_tree import tk_tree_view

    dic = {}
    dic_keys = dir(creature)
    for att in dic_keys:
        if isinstance(getattr(creature, att), types.FunctionType):
            continue
        elif att[-2:] == "__":
            continue
        elif isinstance(getattr(type(creature), att, None), property):
            dic[att] = getattr(type(creature),
                               att).__get__(creature, type(creature))
        else:
            dic[att] = getattr(creature, att, None)

    tk_tree_view(dic)
Ejemplo n.º 5
0
    def test_all(self):
        return

        import tree_view
        d = {}
        for _class in ["rogue"]:  # combat.char_roll.classes:
            for race in ["dwarf"]:  # combat.char_roll.races:
                d["_".join((_class, race))] = PCreature(scene=self.scene,
                                                        x=0,
                                                        y=0,
                                                        _class=_class,
                                                        race=race).combat

        for character in d.keys():
            skills = d[character].__dict__.pop('skills')
            d[character] = tree_view.Tree(d[character])
            d[character] = tree_view.Tree(skills,
                                          expand=[combat.skills.SkillNode])

        from mylib.data_tree import tk_tree_view

        tk_tree_view(d)
Ejemplo n.º 6
0
        'var': RangedDictionary({
            intuitive: (6, 6),
            self_taught: (9, 6),
            trained: (3, 100)})},
    "vanara": {
        "ini": 14, "mid": 30, "old": 45, "ven": 70, "max": (1, 4),
        'var': RangedDictionary({
            intuitive: (1, 6),
            self_taught: (2, 6),
            trained: (2, 10)})},
    "vishkanya": {
        "ini": 15, "mid": 35, "old": 53, "ven": 70, "max": (1, 4),
        'var': RangedDictionary({
            intuitive: (1, 6),
            self_taught: (2, 6),
            trained: (2, 20)})},
    "wayang": {
        "ini": 40, "mid": 100, "old": 150, "ven": 70, "max": (4, 6),
        'var': RangedDictionary({
            intuitive: (5, 6),
            self_taught: (6, 6),
            trained: (1, 100)})}
}


if __name__ == '__main__':
    print(data['saving_throws']['sorcerer'])
    exit()
    from mylib.data_tree import tk_tree_view
    tk_tree_view(data['bab'])
Ejemplo n.º 7
0
            print(result)
    elif mode == 'discard_lowest':
        min_roll = min(roll_list)
        result = sum(roll_list) - min_roll
        if verbose:
            print(result, '(discarding %i)' % min_roll)
    return result


def pretty_stats():
    att = roll_attributes()
    att_mod = [AttributeModifers.get(x) for x in att]

    [
        print("{}: {}({})".format(a, b, c))
        for a, b, c in zip(att_names, att, att_mod)
    ]


if __name__ == '__main__':
    pretty_stats()
    exit()
    from mylib.data_tree import tk_tree_view
    tk_tree_view(AttributeModifers.dic)
    exit()

    c = Character()
    print(c.att_mod)
    exit()
    tk_tree_view(c.__dict__)
Ejemplo n.º 8
0
 def test(cls):
     """..."""
     from mylib.data_tree import tk_tree_view
     tk_tree_view(cls.templates)