Exemple #1
0
           "附魔属性",
           sync=True,
           formula="fn.get_enchant_attrs(prototypeID, slugs, enchants)"),
    define(
        0x0080,
        "base_power",
        "float",
        "装备战力",
        formula=
        "fn.get_equip_base_power(entityID, prototypeID, masterID, baseHP, baseATK, baseDEF, baseCRI, baseEVA)"
    ),
    define(0x0081, "power", "integer", "战力", sync=True, formula="base_power"),
    define(0x0099, "player_equip1", "integer", "玩家装备等级1", default=0),
    define(0x009a, "player_equip2", "integer", "玩家装备等级2", default=0),
    define(0x009b, "player_equip3", "integer", "玩家装备等级3", default=0),
    define(0x009c, "player_equip4", "integer", "玩家装备等级4", default=0),
    define(0x009d, "player_equip5", "integer", "玩家装备等级5", default=0),
    define(0x009e, "player_equip6", "integer", "玩家装备等级6", default=0),
])

store_tag = 'e'
EquipBase = create_class("EquipBase", equip_fields, store_tag)

if __name__ == '__main__':
    import os
    from yy.entity import gen_cython
    c = gen_cython(equip_fields.values(), 'c_EquipBase',
                   'from equip.define import EquipBase as PureEntity',
                   store_tag, extra_imports)
    open(os.path.join(os.path.dirname(__file__), 'c_equip.pyx'), 'w').write(c)
Exemple #2
0
    define(0x0007,
           'addition',
           'dict',
           '邮件附件',
           save=True,
           decoder=json.decode,
           encoder=json.encode),
    define(0x0008, 'isread', 'boolean', '是否已读', save=True),
    define(0x0009, 'isreceived', 'boolean', '是否已领', save=True),
    define(0x000c, 'mailID', 'integer', '邮件ID', formula='entityID'),
    define(0x000d,
           'limitdata',
           'dict',
           '用户限制条件',
           save=True,
           decoder=json.decode,
           encoder=json.encode),
    define(0x000e, 'cd', 'integer', '剩余时间,自动销毁', save=True, default=0),
    define(0x000f, "configID", "integer", "配置ID,可能没有", save=True, default=0),
])
store_tag = 'm'
MailBase = create_class('MailBase', mail_fields, store_tag)

if __name__ == '__main__':
    import os
    from yy.entity import gen_cython
    c = gen_cython(mail_fields.values(), 'c_MailBase',
                   'from mail.define import MailBase as PureEntity', store_tag,
                   extra_imports)
    open(os.path.join(os.path.dirname(__file__), 'c_mail.pyx'), 'w').write(c)
Exemple #3
0
# coding: utf-8
from yy.entity import create_class, define, init_fields

extra_imports = '''
'''

user_fields = init_fields([
    define(1, 'userID', 'integer', '用户ID', save=True),
    define(2, 'username', 'string', '用户名', save=True, event=True),
    define(3, 'password', 'string', '密码', save=True),
    define(4, 'imsi', 'string', 'imsi', save=True),
    define(5, 'createtime', 'datetime', '创建时间', save=True),
    define(6, "blocktime", "integer", "限制登录时间", save=True),
    define(7, "lock_device", "string", "锁定登录设备", save=True),
])
store_tag = 'u'
UserBase = create_class('UserBase', user_fields, store_tag)

if __name__ == '__main__':
    import os
    from yy.entity import gen_cython
    c = gen_cython(user_fields.values(), 'c_UserBase',
                   'from user.define import UserBase as PureEntity', store_tag,
                   extra_imports)
    open(os.path.join(os.path.dirname(__file__), 'c_user.pyx'), 'w').write(c)
Exemple #4
0
           decoder=json.decode,
           encoder=json.encode),
    define(0x0018, "faction_treasure", "integer", "公会宝藏", save=True,
           default=0),
    define(0x0019,
           "city_top_member",
           "dict",
           "黄金城第一名成员",
           decoder=json.decode,
           encoder=json.encode,
           save=True),
    define(0x0020,
           "city_top_member_kills",
           "integer",
           "黄金城第一名成员所杀怪个数",
           save=True,
           default=0),
])

store_tag = 'f'
FactionBase = create_class('FactionBase', faction_fields, store_tag)

if __name__ == '__main__':
    import os
    from yy.entity import gen_cython
    c = gen_cython(faction_fields.values(), 'c_FactionBase',
                   'from faction.define import FactionBase as PureEntity',
                   store_tag, extra_imports)
    open(os.path.join(os.path.dirname(__file__), 'c_faction.pyx'),
         'w').write(c)
Exemple #5
0
           timestamp=0x0033,
           save=True,
           default=0),

    # stored_set encoding
    define(0x0040,
           'fbrewards',
           'stored_set',
           '',
           encoder=cPickle.dumps,
           decoder=cPickle.loads),

    # stored_list encoding
    define(0x0041,
           'mylist',
           'stored_sequence',
           '',
           encoder=json.encode,
           decoder=json.decode),
)
store_tag = 'p'
PlayerBase = create_class('PlayerBase', player_fields, store_tag)

if __name__ == '__main__':
    import os
    from yy.entity import gen_cython
    c = gen_cython(player_fields.values(), 'c_PlayerBase',
                   'from tests.entity import PlayerBase as PureEntity',
                   store_tag, extra_imports)
    open(os.path.join(os.path.dirname(__file__), 'c_player.pyx'), 'w').write(c)
Exemple #6
0
    define(0x0014,
           "gve_end_activateds",
           "stored_sequence",
           "备份活跃列表",
           int_value=True),
    define(0x0015,
           "gve_activateds_detail",
           "stored_dict",
           "备份活跃详细",
           int_key=True,
           decoder=json.decode,
           encoder=json.encode),
    define(0x0016,
           "lastlogin",
           "datetime",
           "同门大师兄最后一次登录",
           save=True,
           default=0),
])

store_tag = "g"
GroupBase = create_class("GroupBase", group_fields, store_tag)

if __name__ == "__main__":
    import os
    from yy.entity import gen_cython
    c = gen_cython(group_fields.values(), "c_GroupBase",
                   "from group.define import GroupBase as PureEntity",
                   store_tag, extra_imports)
    open(os.path.join(os.path.dirname(__file__), "c_group.pyx"), "w").write(c)
Exemple #7
0
PlayerBase = create_class(
    'Player',
    attributes=(
        #临时属性
        define(0x0001, "userID", "integer", "用户ID"),
        define(0x0002, "username", "string", "用户名"),
        define(0x0003, "IMEI", "string", "IMEI"),
        #持久化属性, 同步属性
        define(0x0004,
               "entityID",
               "integer",
               "唯一实体ID",
               isPers=True,
               isSync=True),
        define(0x0005,
               "name",
               "string",
               "名称",
               isPers=True,
               isSync=True,
               isBase=True),
        define(0x0006,
               "level",
               "integer",
               "等级",
               isPers=True,
               isSync=True,
               isBase=True),
        #恢复属性, 每**时间恢复1点,timestamp 用于指定存储时间戳的属性, 如果不指定, 会自动生成一个, max用于指定恢复的最大值
        define(0x0007,
               "sp",
               "integer",
               "体力",
               isPers=True,
               isSync=True,
               isCycle=True,
               resume=5 * 60,
               timestamp='resume_sp_cd',
               max='spmax'),
        define(0x0008, "money", "integer", "金钱", isPers=True, isSync=True),
        define(0x0009, "gold", "integer", "金币", isPers=True, isSync=True),
        define(0x000a, "vs", "integer", "PVP入场券", isPers=True, isSync=True),
        define(0x000b, "gp", "integer", "抽怪货币", isPers=True, isSync=True),
        define(0x000c, "bp", "integer", "工会货币", isPers=True, isSync=True),
        define(0x000d, "slate", "integer", "成就点数", isPers=True, isSync=True),
        define(0x000e,
               "power",
               "integer",
               "统领力",
               isPers=True,
               isSync=True,
               default=20),
        define(0x000f, "modelID", "integer", "模型ID", isPers=True, isBase=True),
        define(0x0010,
               "sex",
               "integer",
               "性别",
               isPers=True,
               isSync=True,
               isBase=True),
        define(0x0011,
               "career",
               "integer",
               "职业",
               isPers=True,
               isSync=True,
               isBase=True),
        define(0x0012,
               "lastlogin",
               "datetime",
               "最后一次登录时间",
               isPers=True,
               isBase=True),
        define(0x0013, "totallogin", "integer", "累计登录次数", isPers=True),
        define(0x0014, "seriallogin", "integer", "连续登录次数", isPers=True),
        define(0x0015,
               "createtime",
               "datetime",
               "角色创建时间",
               isPers=True,
               isBase=True),
        define(0x0020, "pets", "object", "玩家的所有怪物", default=dict),
        define(0x0023, "spmax", "integer", "最大体力", isPers=True, isSync=True),
        define(0x0024, "petmax", "integer", "最大怪物数量", isPers=True,
               isSync=True),
        define(0x0025,
               "lineups",
               "object",
               "阵形",
               isPers=True,
               decoder=decode_pickle,
               encoder=encode_pickle,
               default=list),
        define(0x0026,
               "on_lineup",
               "integer",
               "激活的阵形",
               isPers=True,
               isSync=True,
               default=0),
        define(0x0027, "fbscores", "object", "副本进度", default=dict),
        define(0x0028,
               "currentfbID",
               "integer",
               "当前所在副本ID",
               isPers=True,
               default=0),
        define(0x0029,
               "fbreward",
               "object",
               "副本奖励",
               isPers=True,
               decoder=decode_pickle,
               encoder=encode_pickle,
               default=dict),
        define(0x0030,
               "exp",
               "integer",
               "经验",
               isSync=True,
               isPers=True,
               default=0),

        #公式属性
        define(0x0031,
               "expmax",
               "integer",
               "人物升级需要经验",
               isSync=True,
               isForm=True,
               form="formulas.get_max_exp(level)"),
        define(0x0032,
               "expnxt",
               "integer",
               "下一级升级需要经验",
               isSync=True,
               isForm=True,
               form="formulas.get_next_exp(level)"),
        define(0x0033,
               "resume_sp_cd",
               "integer",
               "下一次恢复体力剩余时间",
               isPers=True,
               isSync=True,
               syncTimeout=True),
        define(0x0034, "spprop", "integer", "体力道具数量", isPers=True,
               isSync=True),
        define(0x0035, "dbtag", "string", "数据库ID"),
        #复杂结构
        define(0x0036,
               "book",
               "object",
               "怪物图鉴",
               isPers=True,
               decoder=decode_json_set,
               encoder=encode_json_set,
               default=set),
    ))