def __init__(self, client): Engine.__init__(self, client) self.player = client.world.player self.skills = None self.stats = None # get current stat & skill values client.send(p.MobileQuery(0x04, self.player.serial)) client.send(p.MobileQuery(0x05, self.player.serial)) self.update()
def _check_stats(self): if self.player.stats is None or self.player.stat_locks is None: print("no stats available") self.tries -= 1 if self.tries > 0: self._client.send(p.MobileQuery(0x04, self.player.serial)) else: self._failure() return cap = self.player.stat_cap or 225 stats = self.player.stats or (0, 0, 0) total = reduce(lambda x, y: x + y, stats) if total < cap: # below cap: all locks up for stat in range(3): self._set_lock(stat, LOCK_UP) return complete = True for stat in range(3): if stats[stat] > self.goal[stat]: self._set_lock(stat, LOCK_DOWN) complete = False elif stats[stat] < self.goal[stat]: self._set_lock(stat, LOCK_UP) complete = False else: self._set_lock(stat, LOCK_LOCKED) if complete: self._success()
def _should_heal(self, m): if not m.is_human(): return False if m.hits is None: self._client.send(p.MobileQuery(0x04, m.serial)) return False # heal if below 2/3 health return m.hits.value <= (m.hits.limit * 2) / 3
def __init__(self, client, goal): Engine.__init__(self, client) self.player = client.world.player self.goal = goal self.tries = 10 if self.player.stat_locks is None: # query stats client.send(p.MobileQuery(0x04, self.player.serial)) self._check_stats()
def __init__(self, client): Engine.__init__(self, client) self.stats = None client.send(p.MobileQuery(0x04, client.world.player.serial))