def __init__(self, sklpglvl=INFO, silent=False): self.__sklpglvl = sklpglvl self.client = pytibia.Client() self.__defcon = defcon.BotDefcon( ) if silent else defcon.BeepingBotDefcon() self.__skilprog = [ self.client.skill_progress(skillnam) for skillnam in pytibia.SKILL_NAMES ] assert len(self.__skilprog) == len(pytibia.SKILL_NAMES)
newexpr = raw_input("Enter new expression: ") if not newexpr: print "Taking memory snapshot" elif newexpr == ".show": show_candidates() continue else: try: newexpr = compile(newexpr, "<newexpr>", 'eval') except SyntaxError as e: print e continue break newaddrs = set() newmemrs = {} for address, data in tuple(pytibia.Client().iter_memory_regions()): if newexpr: if oldaddrs is None: idxiter = xrange(0, len(data), valalign) else: idxiter = set() for addr in oldaddrs.copy(): if addr >= address and addr < address + len(data): oldaddrs.remove(addr) idxiter.add(addr - address) for index in idxiter: if address not in oldmemrs: old = None else: old = valstrct.unpack(oldmemrs[address][index:index + valstrct.size])[0]
#!/usr/bin/env python import time import pytibia, botutil client = pytibia.Client() oldonscr = set() while True: newonscr = set() for entity in client.iter_entities(): if entity.onscreen and entity.is_player() and entity.id != client.player_entity_id(): if entity.name not in oldonscr: print entity.human_readable(reltopos=client.player_coords()) botutil.beep() newonscr.add(entity.name) oldonscr = newonscr time.sleep(1.0)