Example #1
0
	def deserialize(self):
		var1 = self.b.readUnsignedShort()
		msgId = var1>>2
		sizeLen = var1 & 0x03
	
		msgSize = 0
		if(sizeLen == 0):
			msgSize = 0
		elif(sizeLen == 1):
			msgSize = self.b.readUnsignedByte()
		elif(sizeLen == 2):
			msgSize = self.b.readUnsignedShort()
		else:
			printRed("wrong size {}\n".format(sizeLen))
			raise StopException()

		if(msgSize > self.b.getSize()):
			#printGreen("size: {}, cursor: {}\n".format(b.getSize(), b.getCursor()))
			if(sizeLen == 1):
				self.b.moveCursor(-3)
			elif(sizeLen == 2):
				self.b.moveCursor(-4)

			#printGreen("size: {}, cursor: {}\n".format(b.getSize(), b.getCursor()))
			printRed("message too short (id: {}) {} > {}\n".format(
				msgId, msgSize, self.b.getSize()
			))
			raise MessageToShort()

		if(msgId == MapComplementaryInformationsDataMessage.getProtocolId()):
			printBlue("[new map]\n")

			self.infos = MapComplementaryInformationsDataMessage()
			self.infos.deserialize(self.b)
		elif(msgId == BasicNoOperationMessage.getProtocolId()):
			self.basicBNOM = BasicNoOperationMessage()
			self.basicBNOM.deserialize(self.b)
		elif(msgId == BasicLatencyStatsRequestMessage.getProtocolId()):
			self.basicLSRM = BasicLatencyStatsRequestMessage()
			self.basicLSRM.deserialize(self.b)
		elif(msgId == NotificationListMessage.getProtocolId()):
			self.notiLM = NotificationListMessage()
			self.notiLM.deserialize(self.b)
		elif(msgId == CharacterSelectedSuccessMessage.getProtocolId()):
			self.characterSSM = CharacterSelectedSuccessMessage()
			self.characterSSM.deserialize(self.b)
		elif(msgId == InventoryContentAndPresetMessage.getProtocolId()):
			self.inventoryCAPM = InventoryContentAndPresetMessage()
			self.inventoryCAPM.deserialize(self.b)

			objs = self.inventoryCAPM.objects
			for obj in objs:
				if(obj.objectGID == 10418):
					for effect in obj.effects:
						monster = self.monsters.getObj(effect.diceConst)
						if(monster._race == 78):
							printBlue("{}\n".format(self.i18n_fr.getText(monster._nameId)))
		else:
			raise UnknowMessage(msgId)
Example #2
0
	def deserialize(self, b):
		self.objects = list()
		nbObject = b.readUnsignedShort()
		printBlue("nbObject: {}\n".format(nbObject))
		for i in range(0, nbObject):
			objectItem = ObjectItem()
			objectItem.deserialize(b)
			self.objects.append(objectItem)

		self.kamas = b.readInt()
		printGreen("kama: {}\n".format(self.kamas))
Example #3
0
	def deserialize(self, b):
		ObjectEffect.deserialize(self, b)

		self.value = b.readUTF()
		printBlue(", string: {}".format(self.value))