def summoner_thread(self): while True: player = utility.get_my_player() if player == None: #print 'No summoner unit' time.sleep(configuration.summoner_check_delay) continue break if player.name not in configuration.summoners: #print 'This is not a summoner' return while True: my_unit = utility.get_my_unit() if my_unit == None: print 'Unable to retrieve summoner unit' return standing_still = my_unit.mode == 1 if standing_still and not utility.town_check(): targets = self.get_targets() if len(targets) == 0: craw.print_text('There are no nearby corpses') else: target = random.choice(targets) description, skill = random.choice(skills) craw.print_text('%s: %08x' % (description, target)) packets.set_right_skill(skill) time.sleep(configuration.summoner_switch_delay) packets.cast_right_skill_at_target(1, target) time.sleep(configuration.summoner_cast_delay) continue time.sleep(configuration.summoner_check_delay)
def enchant(self, target, type): packets.set_right_skill(enchant_handler_class.enchant_skill) packets.cast_right_skill_at_target(type, target) current_mana, maximum_mana = self.mana current_mana -= self.mana_per_cast self.mana = (current_mana, maximum_mana) time.sleep(configuration.enchant_delay) return current_mana >= self.mana_per_cast
def attack(self): if utility.town_check(): print 'You cannot attack other players in town.' return self.i = utility.get_my_player() target = self.get_target() if target == None: return self.target = target print 'Picked target %s' % target.name if target.id in self.movement: x, y = self.movement[target.id] print 'It is a moving target: %d, %d' % (x, y) bone_spirit_attack = self.left_skill == bone_spirit_skill and self.skill_check([bone_prison_skill, teleport_skill], attack_mode_bone_prison_bone_spirit_tppk) bone_spear_attack = self.left_skill == bone_spear_skill and self.skill_check([bone_prison_skill], attack_mode_bone_prison_bone_spear_tppk) foh_attack = self.left_skill == fist_of_heavens_skill and self.skill_check([fist_of_heavens_skill], attack_mode_fist_of_heavens_tppk) self.start_of_attack = time.time() if bone_spirit_attack or bone_spear_attack: self.debug('Setting the right skill to Bone Prison') packets.set_right_skill(bone_prison_skill) elif foh_attack: if craw.get_skill_level(teleport_skill) > 0: self.debug('Setting the right skill to teleport') packets.set_right_skill(teleport_skill) else: if utility.get_d2_distance(utility.get_my_player(), target) > configuration.fist_of_heavens_distance: print 'You are not in range for a Fist of Heavens attack' return self.debug('Casting Fist of Heavens at the target') packets.cast_left_skill_at_target(0, self.target.id) nil.thread.create_thread(lambda: self.town_portal(configuration.fist_of_heavens_delay)) else: print 'Performing default attack "%s"' % attack_mode_cast_left_skill packets.cast_left_skill_at_target(0, self.target.id)
def bone_prison_teleport(self): self.sleep(configuration.bone_prison_delay) packets.set_right_skill(teleport_skill)