event.split(" ", 1)[1] if "@" in mapnumber: self.isDead = True self.room.isCustom = True self.room.customMap = mapnumber.replace("@", "") self.room.killAll() else: self.isDead = True self.room.informAll(TransformiceClientHandler.sendPlayerDied, [self.playerCode, self.score]) self.room.worldChangeSpecific(mapnumber) elif event.startswith("friend ") or event.startswith("amigo "): #self.sendData("\x1A" + "\x04", ["Friends list is not enabled."]) users = event.split(" ", 1)[1] users = str(users.title()) found = self.server.findPlayer(users) if not found == "Offline": friends = self.server.getUserFriends(self.username) #print "Friends = "+friends if users in friends: self.sendAlreadyFriend(users) else: oldfriends = friends.split(",") number = len(oldfriends) if number >= 100: self.sendMaxFriends() else: oldfriends.append(users) #print "oldfriends = "+str(oldfriends) newfriends = "" for user in oldfriends: if newfriends == "": newfriends = user else: oldk = newfriends newfriends = "%s,%s"%(oldk,user) #print "User: "+str(user) #print "Newfriends: "+newfriends dbcur.execute('UPDATE users SET friends = ? WHERE name = ?', [newfriends, self.username]) self.sendNewFriend(users) #self.sendServeurMessage("%s tried to friend %s" % (self.username, users)) elif event.startswith("shamperf "): if self.privilegeLevel==10 or self.privilegeLevel==6 and not self.isDrawer: if EVENTCOUNT >= 3: _, hname, hsaves = event_raw.split(" ", 2) self.room.informAll(TransformiceClientHandler.sendShamanPerformance, [hname, hsaves]) elif event.startswith("music ") or event.startswith("playmusic ") or event.startswith("musique "): if self.privilegeLevel==10 or self.privilegeLevel==6 or self.privilegeLevel==5 and not self.isDrawer: if EVENTCOUNT >= 2: _, musicmessage = event_raw.split(" ", 1) self.sendServeurMessage("[%s] Music started (%s)" % (self.username, self.room.name)) self.room.informAll(TransformiceClientHandler.sendPlayMusic, [musicmessage]) elif event.startswith("smusic "): if self.privilegeLevel==10 and not self.isDrawer: if EVENTCOUNT >= 2: _, musicmessage = event_raw.split(" ", 1) self.sendServeurMessage("[%s] Server music" % (self.username)) for room in self.server.rooms.itervalues(): room.informAll(TransformiceClientHandler.sendPlayMusic, [musicmessage]) else: pass elif eventToken1 == "\x05": if eventToken2 == "\x07": #Anchor thing #jointType, object1, o1x, o1y, o1r, object2, o2x, o2y, o2r = values #self.room.stateRecorder.addAnchor(values) self.room.sendAllOthersAndSelf(self, eventTokens, values) #self.room.sendAll(eventTokens, values) elif eventToken2 == "\x08": #object begin #objectCode, x, y, rotation = values self.room.sendAllOthersAndSelf(self, eventTokens, [self.playerCode] + values) if self.isAfk==True: self.isAfk=False elif eventToken2 == "\x09": self.room.sendAllOthersAndSelf(self, eventTokens, [self.playerCode]) elif eventToken2 == "\x0E": # "Demande_Creation_Clou" #pass self.room.sendAll(eventTokens, values) elif eventToken2 == "\x0F": # "Demande_Creation_Sol" #pass self.room.sendAll(eventTokens, values) elif eventToken2 == "\x10": # "Demande_Deplacement_Fromage" #x, y = values self.room.sendAll(eventTokens, values) elif eventToken2 == "\x11": # "Demande_Explosion" #pass self.room.sendAll(eventTokens, values) elif eventToken2 == "\x12": cantgoin = 0 #Mouse got cheese into hole objectID, someothervalue = values if self.room.isEditeur: if self.room.ISCMVdata[7]==0 and self.room.ISCMV!=0: self.room.ISCMVdata[7]=1 self.sendMapValidated() if self.isShaman: checkISCGI = self.room.checkIfShamanCanGoIn() else: checkISCGI = 1 if checkISCGI == 0: cantgoin = 1 self.saveRemainingMiceMessage() if cantgoin != 1: self.isDead = True if self.gotGift == 1: self.giftCount += 1 self.gotGift = 0 if self.giftCount == 5: playerCode = self.playerCode self.sendUnlockedTitle(playerCode, "127") elif self.giftCount == 10: playerCode = self.playerCode self.sendUnlockedTitle(playerCode, "128") elif self.giftCount == 15: playerCode = self.playerCode self.sendUnlockedTitle(playerCode, "129") elif self.giftCount == 20: playerCode = self.playerCode self.sendUnlockedTitle(playerCode, "130") else: pass self.room.numCompleted += 1 place = self.room.numCompleted timeTaken = int( (time.time() - self.room.gameStartTime)*10 ) #Score stuff playerscorep = self.score if place==1: playerscorep = playerscorep+16 if self.room.getPlayerCount() >= 3: #Change this number for how many have to be in the room for firsts to count if self.isShaman: self.firstcount = self.firstcount else: self.firstcount += 1 elif place==2: playerscorep = playerscorep+14 elif place==3: playerscorep = playerscorep+12 else: playerscorep = playerscorep+10 if self.isShaman==True: playerscorep = self.score self.score = playerscorep #end if int(self.room.getPlayerCount()) >= 2: if self.playerCode == self.room.currentShamanCode: self.shamancheese += 1 else: self.cheesecount += 1 self.shopcheese += 1 self.room.informAll(TransformiceClientHandler.sendPlayerGotCheese, [self.playerCode, self.score, place,