== 0: self.room.sendAllOthersAndSelf(self, eventTokens, [self.playerCode] + values) elif eventToken2 == "\x15": # "Creation_Objet_Monde" - world object creation #objectCode, x, y, unkn1, unkn2, unkn3, unkn4 = values if self.isSyncroniser: self.room.sendAllOthers(self, eventToken1 + "\x14", values) elif eventToken2 == "\x16": # "Demande_Changement_Gravite" #gx, gy = values if self.isSyncroniser: self.room.sendAll(eventTokens, values) else: logging.warning("Unimplemented %r" % eventTokens) #raise NotImplementedError, eventTokens elif eventToken1 == "\x14": if eventToken2 == "\x14": #open shop self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if eventToken2 == "\x12": #remove item if int(values[0])>=100 and int(values[0]) <=199: itemcategory=1 elif int(values[0])>=200 and int(values[0]) <=299: itemcategory=2 elif int(values[0])>=300 and int(values[0]) <=399: itemcategory=3 elif int(values[0])>=400 and int(values[0]) <=499: itemcategory=4 else: itemcategory=0 looklist = self.look.split(",") if itemcategory==0: looklist[0]="0" self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if itemcategory==1: looklist[1]="0" self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if itemcategory==2: looklist[2]="0" self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if itemcategory==3: looklist[3]="0" self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if itemcategory==4: looklist[4]="0" self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if eventToken2 == "\x11": #equip item fullitem = str(values[0]) if int(values[0])>=100 and int(values[0]) <=199: itemcategory=1 item=fullitem[1:] item=int(item) item=str(item) elif int(values[0])>=200 and int(values[0]) <=299: itemcategory=2 item=fullitem[1:] item=int(item) item=str(item) elif int(values[0])>=300 and int(values[0]) <=399: itemcategory=3 item=fullitem[1:] item=int(item) item=str(item) elif int(values[0])>=400 and int(values[0]) <=499: itemcategory=4 item=fullitem[1:] item=int(item) item=str(item) else: itemcategory=0 item=values[0] looklist = self.look.split(",") if itemcategory==0: looklist[0]=str(item) self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if itemcategory==1: looklist[1]=str(item) self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if itemcategory==2: looklist[2]=str(item) self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if itemcategory==3: looklist[3]=str(item) self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if itemcategory==4: looklist[4]=str(item) self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) if eventToken2 == "\x13": #buy item itemcat0 = {3:20, 5:100, 2:200, 4:200, 1:500, 6:500, 7:200, 8:300, 9:500, 10:100, 11:500, 12:200, 13:500, 14:300, 15:200, 16:300, 17:200, 18:300, 19:300, 20:500, 21:200, 22:300, 23:400, 24:50, 25:250, 26:300, 27:800, 28:300, 29:500, 30:200, 31:300, 32:800, 33:150, 34:400, 35:1000, 36:500, 37:200, 38:800, 39:200, 40:500, 41:800, 42:500, 43:200, 44:250, 45:300, 46:100, 47:1500} #39:1000000, 40:1000000, 41:1000000, 42:1000000, itemcat1 = {1:200, 2:200, 4:200, 3:200, 5:300, 6:800, 7:50} itemcat2 = {1:100, 2:50, 3:20, 4:20} #{1:100, 2:1000000, 3:\1000000, 4:20} itemcat3 = {1:100, 2:25, 3:150, 4:400, 5:300, 6:300, 7:300} itemcat4 = {1:200, 2:200, 3:200, 4:50} #{1:200, 2:200, 3:1000000, 4:50} fullitem = str(values[0]) if int(values[0])>=100 and int(values[0]) <=199: itemcategory=1 item=fullitem[1:] item=int(item) item=str(item) elif int(values[0])>=200 and int(values[0]) <=299: itemcategory=2 item=fullitem[1:] item=int(item) item=str(item) elif int(values[0])>=300 and int(values[0]) <=399: itemcategory=3 item=fullitem[1:] item=int(item) item=str(item) elif int(values[0])>=400 and int(values[0]) <=499: itemcategory=4 item=fullitem[1:] item=int(item) item=str(item) else: itemcategory=0 item=values[0] shopcheese = int(self.shopcheese) looklist = self.look.split(",") if itemcategory==0: if shopcheese < itemcat0[int(item)]: self.sendData("\x14" + "\x06", []) if shopcheese >= itemcat0[int(item)]: if self.shopitems=="": self.shopitems=str(fullitem) self.shopcheese=self.shopcheese-itemcat0[int(item)] looklist[0]=str(item) self.look=json.dumps(looklist) self.look = self.look.strip('[]') self.look = self.look.replace("\"","") self.look = self.look.replace(" ","") self.sendData("\x14" + "\x14",[str(self.shopcheese),self.shoplist,self.look,self.shopitems]) else: self.shopitems=self.shopitems+","+str(fullitem) self.shopcheese=self.shopcheese-itemcat0[int(item)] looklist[0]=str(item) self.look = json.dumps(looklist) self.look = self.look.strip('[]')