def getrep(self): return world.Entity.getrep(self) + "," + encoding.enquote(self.name) + \ "," + ",".join(map(encoding.enquote, map(str, self.desiredpos)));
def getrep(self): return world.Entity.getrep(self) + "," + encoding.enquote(self.name) + \ "," + ",".join(map(encoding.enquote, map(str, self.desiredpos)))
def say(self, text): self.command("say " + encoding.enquote(text))
def connect(self, name, pw): self.command("con " + encoding.enquote(name) + "," + encoding.enquote(pw))
if not file: # look for a back-up file, if we died while trying a rename() operation file = open("user/" + self.name + ".tmp", "rb") self.userdata = pickle.load(file) file.close() ok = (self.userdata["password"] == pw) except Exception, x: print("User file open exception " + str(x) + " on file " + self.name); if ok: self.entity = player.Player(self.userdata["entityrep"]) self.userdata["lastlogin"] = time.strftime("%Y-%m-%d %H:%M:%S") self.output("ok! " + str(self.entity.id) + "\n") self.savetofile() world.dumpentities(self) else: self.output("fai " + encoding.enquote(self.name) + "\n") def dumpentity(self, ent): cmd = "add " + str(ent.id) + "," + ent.getrep() + "\n"; self.output(cmd) def hasdata(cli): return cli.outputdata def getsock(cli): return cli.sock def main(): global now