Пример #1
0
def create_pclist():
    global pclist
    pclist = {}
    print "[ all ]", "loading pclist ...",
    for a, b, c in os.walk(os.getcwd() + "/UserDB"):
        for x in c:
            if len(str(x)) > 4 and x[-4:] == ".ini":
                pclist[x[:-4]] = None
    for name in pclist:
        pclist[name] = PC(global_itemobj, global_itemdic)
        pclist[name].loadallconfig("UserDB/%s.ini" % name)
        pclist[name].account = name
    print "over", "	", len(pclist), "	pc load"
Пример #2
0
def create_pclist():
    global pclist
    pclist = {}
    print "[ all ]", "loading pclist ...",
    for a, b, c in os.walk(os.getcwd() + "/UserDB"):
        for x in c:
            if len(str(x)) > 4 and x[-4:] == ".ini":
                pclist[x[:-4]] = None
    for name in pclist:
        pclist[name] = PC(global_itemobj, global_itemdic)
        pclist[name].loadallconfig("UserDB/%s.ini" % name)
        pclist[name].account = name
    print "over", "	", len(pclist), "	pc load"
Пример #3
0
 def __init__(self, serverobj):
     # set itemdic, mapdic, etc...
     serverobj.setlibdic(serverobj.libdic, self)
     self.packethandle_map = {}
     self.serverobj.clientlistcount_map += 1
     self.clientindex = int(self.serverobj.clientlistcount_map)
     self.serverobj.clientlist_map[self.clientindex] = PC(
         self.itemobj, self.itemdic)
     self.serverobj.clientlist_map[self.clientindex].name = ""
     self.serverobj.clientlist_map[self.clientindex].mapclient = self
     self.serverobj.packethandle_map[self.clientindex] = PacketHandle_Map()
     self.serverobj.packethandle_map[self.clientindex].init(self.serverobj)
     self.pc = self.serverobj.clientlist_map[self.clientindex]
     self.buffer = ""
     self.ecoinit = False
     self.ecorecvkey = False
     self.encode = self.cryptio.encode
     self.decode = self.cryptio.decode
Пример #4
0
 def __init__(self, serverobj):
     # set itemdic, mapdic, etc...
     serverobj.setlibdic(serverobj.libdic, self)
     self.packethandle = {}
     self.waitmapserverrequest = False
     self.serverobj.clientlistcount += 1
     self.clientindex = int(self.serverobj.clientlistcount)
     self.serverobj.clientlist[self.clientindex] = PC(
         self.itemobj, self.itemdic)
     self.serverobj.clientlist[self.clientindex].name = ""
     self.serverobj.clientlist[self.clientindex].client = self
     self.serverobj.packethandle[self.clientindex] = PacketHandle()
     self.serverobj.packethandle[self.clientindex].init(self.serverobj)
     self.serverobj.packethandle[self.clientindex].setpclist(self.pclist)
     self.pc = self.serverobj.clientlist[self.clientindex]
     self.buffer = ""
     self.ecoinit = False
     self.ecorecvkey = False
     self.encode = self.cryptio.encode
     self.decode = self.cryptio.decode
     self.count_s00a8 = 0
     self.timer_s00a8 = None
Пример #5
0
 def createaccount(self, postdic):
     createsuccess = False
     account = postdic.get("account")
     charactername = postdic.get("charactername")
     password = postdic.get("password")
     password = hashlib.md5(password).hexdigest()
     deletepassword = postdic.get("deletepassword")
     deletepassword = hashlib.md5(deletepassword).hexdigest()
     with self.lock_pclist and self.lock_moblist:
         if not self.pclist.get(account):
             existid = []
             for p in self.pclist.values():
                 try:
                     existid.append(int(p.sid))
                 except:
                     print "[ web ]", "createaccount error at append pc sid", traceback.format_exc(
                     )
             existid.extend(self.moblist.keys())  #maybe need map(int, keys)
             newcharid = 100
             while newcharid in existid:
                 newcharid += 1
             newcharid = int(newcharid)
             gmlevel = int(self.serverobj.defaultgmlevel)
             #self.serverobj.newcharid = int(newcharid)+1
             self.serverobj.saveallconfig("server.ini")
             newpc = PC(self.itemobj, self.itemdic)
             newpc = newpc.makenewpc()
             newpc.account = account
             newpc.charid = newcharid
             newpc.sid = newcharid
             newpc.name = charactername
             newpc.password = password
             newpc.delpassword = deletepassword
             newpc.gmlevel = gmlevel
             if postdic.get("gender"):
                 newpc.gender = int(postdic.get("gender"))
                 if newpc.gender == 0:
                     #スモック♂
                     newpc.item[1] = self.itemobj.createitem(
                         self.itemdic, 50000000)
                     newpc.item[3] = self.itemobj.createitem(
                         self.itemdic, 50060150)
             if postdic.get("race"):
                 newpc.race = int(postdic.get("race"))
             if postdic.get("face"):
                 newpc.face = int(postdic.get("face"))
             self.pclist[account] = newpc
             self.pclist[account].saveallconfig("UserDB/%s.ini" % account)
             createsuccess = True
     return createsuccess
Пример #6
0
	def createaccount(self, postdic):
		createsuccess = False
		account = postdic.get("account")
		charactername = postdic.get("charactername")
		password = postdic.get("password")
		password = hashlib.md5(password).hexdigest()
		deletepassword = postdic.get("deletepassword")
		deletepassword = hashlib.md5(deletepassword).hexdigest()
		with self.lock_pclist and self.lock_moblist:
			if not self.pclist.get(account):
				existid = []
				for p in self.pclist.values():
					try:
						existid.append(int(p.sid))
					except:
						print "[ web ]", "createaccount error at append pc sid", traceback.format_exc()
				existid.extend(self.moblist.keys()) #maybe need map(int, keys)
				newcharid = 100
				while newcharid in existid:
					newcharid += 1
				newcharid = int(newcharid)
				gmlevel = int(self.serverobj.defaultgmlevel)
				#self.serverobj.newcharid = int(newcharid)+1
				self.serverobj.saveallconfig("server.ini")
				newpc = PC(self.itemobj, self.itemdic)
				newpc = newpc.makenewpc()
				newpc.account = account
				newpc.charid = newcharid
				newpc.sid = newcharid
				newpc.name = charactername
				newpc.password = password
				newpc.delpassword = deletepassword
				newpc.gmlevel = gmlevel
				if postdic.get("gender"):
					newpc.gender = int(postdic.get("gender"))
					if newpc.gender == 0:
						#スモック♂
						newpc.item[1] = self.itemobj.createitem(self.itemdic, 50000000)
						newpc.item[3] = self.itemobj.createitem(self.itemdic, 50060150)
				if postdic.get("race"):
					newpc.race = int(postdic.get("race"))
				if postdic.get("face"):
					newpc.face = int(postdic.get("face"))
				self.pclist[account] = newpc
				self.pclist[account].saveallconfig("UserDB/%s.ini"%account)
				createsuccess = True
		return createsuccess