#coding:utf-8 from yy.entity import create_class, define, init_fields from yy.entity.formulas import register_formula import ujson as json extra_imports = ''' ''' mail_fields = init_fields([ define(0x0001, 'entityID', 'integer', '邮件ID', save=True), define(0x0002, 'playerID', 'integer', '玩家ID', save=True), define(0x0003, 'title', 'string', '邮件标题', save=True), define(0x0004, 'content', 'string', '邮件内容', save=True), define(0x0005, 'type', 'integer', '邮件类型', save=True), define(0x0006, 'addtime', 'integer', '添加时间', save=True), 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,
# 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)
# coding: utf-8 from yy.entity import create_class, define, init_fields from yy.entity.formulas import register_formula from equip import formulas import ujson as json extra_imports = ''' ''' equip_fields = init_fields([ define(0x0001, "entityID", "integer", "唯一实体ID", save=True, sync=True), define(0x0002, "prototypeID", "integer", "配置ID", save=True, sync=True), define(0x0003, "masterID", "integer", "主人的角色ID"), define(0x0004, "type", "integer", "类型"), define(0x0005, 'equipID', 'integer', '装备ID', formula='entityID'), define(0x0006, 'level', "integer", "强化等级", save=True, sync=True), define(0x0007, 'step', "integer", "装备阶数", save=True, sync=True, default=1), define(0x0008, 'rest_star', "integer", "剩余兵魂", save=True, sync=True, default=0), define(0x0009, "slugs", "integer", "加成属性槽数", formula="fn.get_slugs(step)"), define( 0x0020, "baseHP", "float", "基础血量",
# coding: utf-8 from yy.entity import create_class, define, init_fields from yy.entity.formulas import register_formula import formulas import ujson as json extra_imports = ''' ''' faction_fields = init_fields([ define(0x0001, "entityID", "integer", "唯一ID", save=True), define(0x0002, "factionID", "integer", "公会ID", formula='entityID'), define(0x0003, "name", "string", "公会名称", save=True), define(0x0004, "level", "integer", "公会等级"), define(0x0005, "totalfp", "integer", "总贡献", save=True, default=0), define(0x0006, "todayfp", "integer", "今日贡献", save=True, cycle=True, timestamp=0x0013, default=0), define(0x0007, "memberset", "set", "拥有的成员", save=True, decoder=json.decode, encoder=json.encode),
# coding: utf-8 from yy.entity import create_class, define, init_fields from yy.entity.formulas import register_formula import cPickle import ujson as json extra_imports = ''' from collections import defaultdict ''' player_fields = init_fields( define(0x000b, "entityID", "integer", "", save=True), define(0x0001, "plain", "integer", ""), define(0x0002, "persistent", "integer", "", save=True, sync=True), define(0x0003, "formula1", "integer", "", formula="plain + 1", sync=True), define(0x0004, "formula2", "integer", "", formula="plain + 2", save=True), define(0x0005, "formula3", "integer", "", formula="formula2 + 2", event=True), define(0x0006, "sp", "integer", "", cycle=True, timestamp='sp_update_time', resume=10, max='sp_max',
extra_imports = ''' ''' def decode_roles(s): '兼容旧数据格式' o = json.decode(s) if isinstance(o, int): return [o] else: return o user_fields = init_fields([ define(1, 'userID', 'integer', '用户ID', formula="entityID"), 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, 'roles', 'stored_dict', '各区角色ID', int_key=True, encoder=json.encode, decoder=decode_roles), define(7, 'entityID', 'integer', '用户ID', save=True), define(8, "blocktime", "integer", "限制登录时间", save=True), # define(9, "createRoleReward", "integer", "创建下一个角色时奖励", save=True, default=0),
# coding: utf-8 import ujson as json from yy.entity import create_class, define, init_fields from yy.entity.formulas import register_formula # NOQA import formulas # NOQA extra_imports = ''' ''' group_fields = init_fields([ define(0x0001, "entityID", "integer", "唯一ID", save=True), define(0x0002, "groupID", "integer", "同门ID", formula="entityID"), define(0x0003, "name", "string", "同门名称", save=True), define(0x0004, "applys", "stored_dict", "申请的成员", int_key=True, decoder=json.decode, encoder=json.encode), define(0x0005, "members", "stored_dict", "当前的成员", int_key=True, decoder=json.decode, encoder=json.encode), define(0x0006, "leaderID", "integer", "大师兄ID", save=True), define(0x0007, "invites", "stored_set", "已邀请的好友", int_value=True), define(0x0008, "leader_lastlogin", "datetime", "大师兄上次登录时间", save=True), define(0x0009, "gve_joineds", "stored_sequence", "观战列表", int_value=True),
#coding:utf-8 from yy.entity import create_class, define 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),