Example #1
0
	def process_bytes(self, bytes):
		experience_formats = [
			(0x1a, 1),
			(0x1b, 2)
		]
		
		self.experience = craw.get_experience()
		if self.experience == None:
			return
			
		elif len(bytes) >= 5 and bytes[0] == 0x1c:
			new_experience = utility.read_bytes(bytes, 1, 4)
			self.process_experience(new_experience - self.experience)
		
		else:
			for identifier, size in experience_formats:
				if len(bytes) >= 1 + size and bytes[0] == identifier:
					experience_gained = utility.read_bytes(bytes, 1, size)
					self.process_experience(experience_gained)
					break
Example #2
0
	def experience(self, arguments):
		experience = craw.get_experience()
		if experience == None:
			print 'Unable to retrieve experience'
		else:
			print 'Experience: %d' % experience