rrf is None: return -1 else: return rrf[0] def getMapXML(self, code): try: dbcur.execute('select mapxml from mapeditor where code = ?', [code]) rrf = dbcur.fetchone() if rrf is None: return -1 else: return rrf[0] except: dbcur2.execute('select mapxml from mapeditor where code = ?', [code]) rrf = dbcur2.fetchone() if rrf is None: return -1 else: return rrf[0] def getMapYesVotes(self, code): dbcur.execute('select yesvotes from mapeditor where code = ?', [code]) rrf = dbcur.fetchone() if rrf is None: return -1 else: return rrf[0] def getMapNoVotes(self, code): dbcur.execute('select novotes from mapeditor where code = ?', [code]) rrf = dbcur.fetchone() if rrf is None: return -1 else: return rrf[0] def getMapPerma(self, code): dbcur.execute('select perma from mapeditor where code = ?', [code]) rrf = dbcur.fetchone() if rrf is None: return -1 else: return rrf[0] def getMapDel(self, code): dbcur.execute('select deleted from mapeditor where code = ?', [code]) rrf = dbcur.fetchone() if rrf is None: return -1 else: return rrf[0] def getProfileTitle(self, username): found = False for room in self.rooms.itervalues(): for player in room.clients.itervalues(): if player.username == username: found = player.titleNumber return found def getProfileTribe(self, username): found = False for room in self.rooms.itervalues(): for player in room.clients.itervalues(): if player.username == username: found = player.tribe return found def getProfileSaves(self, username): found = False for room in self.rooms.itervalues(): for player in room.clients.itervalues(): if player.username == username: found = player.micesaves return found def getProfileShamanCheese(self, username): found = False for room in self.rooms.itervalues(): for player in room.clients.itervalues(): if player.username == username: found = player.shamancheese return found def getProfileFirstCount(self, username): found = False for room in self.rooms.itervalues(): for player in room.clients.itervalues(): if player.username == username: found = player.firstcount return found def getProfileCheeseCount(self, username): found = False for room in self.rooms.itervalues(): for player in room.clients.itervalues(): if player.username == username: found = player.cheesecount return found def getProfileTitleList(self, username): found = False for room in self.rooms.itervalues(): for player in room.clients.itervalues(): if player.username == username: titlelist = player.titleList titlelist = json.dumps(titlelist) titlelist = titlelist.replace("[","") titlelist = titlelist.replace("]","") titlelist = titlelist.replace("\"","") titlelist = titlelist.replace(" ","") return titlelist return found def sendPrivMsg(self, fromUsername, toUsername, message): found = False for room in self.rooms.itervalues(): for player in room.clients.itervalues(): if player.username.lower() == toUsername.lower(): player.sendRecievePrivMsg(fromUsername, message) found = True return found def disconnectPlayer(self, username): found = False for room in self.rooms.itervalues(): for player in room.clients.itervalues(): if player.username == username: room.informAll(TransformiceClientHandler.sendPlayerDisconnect, [player.playerCode]) room.removeClient(player) player.close() found = True print '%s disconnected' % (player.username) break return found def banPlayer(self, username, time, reason, modname): found = False time = int(time) for room in self.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): if client.username == username: client.sendPlayerBan(time, reason) if time >= 25: clientaddr = client.address[0] dbcur.execute("insert into ippermaban (ip, bannedby, reason) values (?, ?, ?)", (clientaddr, modname, reason)) dbcur.execute("insert into userpermaban (name, bannedby, reason) values (?, ?, ?)", (username, modname, reason)) #player.close() found = True break return found def getIPaddress(self, username): found = False for room in self.rooms.itervalues(): for playerCode, client in room.clients.iteritems(): if client.username == username: found = client.address[0] break return found def restartServer(self): logging.info("Restarting") found = False for room in self.rooms.itervalues(): for player in room.clients.itervalues(): #room.informAll(TransformiceClientHandler.sendPlayerDiscnnect, [player.playerCode]) room.updatesqlserver() #os.system("restart.bat") def updateit(self): room.updatesqlserver() def stopServer(self): logging.info("Stopping") found = False for room in