def addGuildByInfo(self, guildinfo): '''根据id添加一个行会到管理器 @param guildID: int 行会的id ''' guildId = guildinfo['id'] if self._guilds.has_key(guildId): raise Exception("系统记录冲突") guild = Guild('guild%d' % guildId) guild.id = guildId guild.initGuildData(guildinfo) self._guilds[guildId] = guild
def addGuildByInfo(self,guildinfo): '''根据id添加一个行会到管理器 @param guildID: int 行会的id ''' guildId = guildinfo['id'] if self._guilds.has_key(guildId): raise Exception("系统记录冲突") guild = Guild('guild%d'%guildId) guild.id = guildId guild.initGuildData(guildinfo) self._guilds[guildId] = guild
def creatGuild(self, guildName, president, camp): '''创建行会 @param guildName: str 行会的名称 @param president: int 会长的id ''' if dbGuild.checkHasGuildByName(guildName): return -1 gid = dbGuild.creatGuild(guildName, president, camp) if not gid: return 0 dbGuild.insertCharacterGuildInfo(president, gid, post=4) guild = Guild('guild%d' % gid) guild.id = gid guildinfo = dbGuild.getGuildInfoById(gid) guild.initGuildData(guildinfo) nowguildlist = self.guildIdList nowguildlist.append(gid) self.self.guildIdList = nowguildlist self._guilds[gid] = guild return gid
def creatGuild(self,guildName,president,camp): '''创建行会 @param guildName: str 行会的名称 @param president: int 会长的id ''' if dbGuild.checkHasGuildByName(guildName): return -1 gid = dbGuild.creatGuild(guildName, president,camp) if not gid: return 0 dbGuild.insertCharacterGuildInfo(president, gid, post=4) guild = Guild('guild%d'%gid) guild.id = gid guildinfo = dbGuild.getGuildInfoById(gid) guild.initGuildData(guildinfo) nowguildlist = self.guildIdList nowguildlist.append(gid) self.self.guildIdList=nowguildlist self._guilds[gid] = guild return gid