Example #1
0
 def __init__(self,ip,sock,ist,mainist):
   #self.lastping = time.time()
   self.privtable = { 0 : "Logged in" , 1 : "Bot" , 2 : "Moderator", 3 : "Server administrator" , 4 : "In battle" , 5 : "Not in battle", 6 : "Battlefounder"}
   #		     { 1 : "Logged in" , 2 : "Bot" , 4 : "Moderator", 8 : "Server administrator" , 16 : "In battle" , 32 : "Not in battle" , 64 : "Battlefounder"}
   self.accountid = 0
   self.supportedfeatures = [] 
   self.userid = "" #Just to have it, it's useless
   self.lobbyversion = "Unknown"
   # FEATURES: CLIENTCHANNELSTATUS, ZIPSTREAM, 250PLAYERS
   #
   #
   #
   self.lanip = "*"
   self.main = mainist
   self.loginlock = threading.Lock()
   self.loggingin = False
   self.ip = [ip[0],ip[1]]
   
   self.sql = False
   self.lgstatus = 0 # 0 Just connected,1: Logged in
   self.username = ""
   self.afk = 0
   self.rank = 0
   self.oldname = ""
   self.bs = 0
   self.lastlogin = 0.0
   self.lastbsreset = time.time()
   self.battlestatus = "0"
   self.mod = 0
   if ip[0] == "127.0.0.1" or ip[0].startswith("192.168.1"):
     self.ip[0] = self.main.externip
   self.country = ip2country.lookup(self.ip[0])
     
   self.bot = 0
   self.admin = 0
   self.ist = ist
   self.sso = ssock(sock,self.ist)
   self.ingame = 0
   self.ptimecounter = None
   self.ptime = 0
   self.teamcolor = "0"
   self.password = ""
   self.battlestatus = BattleStatus(0)
   self.inbuf = ""
   self.lastping = time.time()
   self.cpu = 0
   self.battle = -1
Example #2
0
	def setFlagByIP(self, ip, force=True):
		cc = ip2country.lookup(ip)
		if force or cc != '??':
			self.country_code = cc
Example #3
0
 def setFlagByIP(self, ip, force=True):
     cc = ip2country.lookup(ip)
     if force or cc != '??':
         self.country_code = cc