def add_guild_level_remote(data, player): args = cPickle.loads(data) level = int(args.get('level')) name = args.get('name') guild_name_data = tb_guild_info.getObj('names') guild_id = guild_name_data.hget(name) if not guild_id: logger.debug('guild name not find') return {'success': 0} guild_data = tb_guild_info.getObj(guild_id).hgetall() if not guild_data: logger.debug('guild name not find1') return 0 if level > 10: level = 10 guild_obj = Guild() guild_obj.init_data(guild_data) guild_obj.level = int(level) remote_gate.add_guild_to_rank_remote(guild_obj.g_id, guild_obj.level) guild_obj.save_data() return {'success': 1}
def init_guild(player): guild_obj = Guild() guild_obj.create_guild(player.base_info.id, '自动生成') player.guild.g_id = guild_obj.g_id player.guild.worship = 0 player.guild.worship_time = 1 player.guild.contribution = 0 player.guild.all_contribution = 0 player.guild.k_num = 0 player.guild.position = 1 player.guild.save_data() guild_obj.level = 7 guild_obj.save_data() player.finance.save_data() remote_gate.add_guild_to_rank_remote(guild_obj.g_id, guild_obj.level) # 加入公会聊天 remote_gate.login_guild_chat_remote(player.dynamic_id, player.guild.g_id)