def chatstuffThreaded(talker, channel, text): global convos global last_response global talkon key = (talker, channel) if (player.name in text) or (channel == 'says') or (channel.startswith('tell')): if (talker, channel) not in convos: sage.echo("Starting a new convo") val = { 'time': time.time(), 'response': '', 'bot': cleverbot.Cleverbot() } convos[key] = val val = convos[key] response = '' if channel == 'says': response = 'say ' elif channel.startswith('clt'): response = 'clan switch %s;clt ' % (re.sub('clt', '', channel)) elif channel.startswith('tell'): response = channel + ' ' else: sage.echo("SOMEONE SAID MY NAME OVER %s!!!" % channel) return sage.echo(re.sub('"', '', re.sub('.*, "', '', text))) sage.echo(talker) sage.echo(channel) response = response + ' ' + val['bot'].ask(text) last_response = max(time.time(), last_response) time_to_type = len(response) / 5.0 last_response = last_response + time_to_type sage.delay(last_response - time.time(), sage.send, response)
def pull_comms(): global login_info global last_pull_time update_time = False db = mysql.connect(host=login_info[0], user=login_info[1],passwd=login_info[2], db='achaea',cursorclass=MySQLdb.cursors.DictCursor) cur=db.cursor() cur.execute('select `char`, `talker`, `channel`, `message` from achaea.messages_heard ' ' where `time` > %s and `char` != %s', (last_pull_time, player.name)) allres = cur.fetchall() if len(allres) > 0: update_time = True for res in allres: output = '%s heard %s say on %s : %s' % (res['char'], res['talker'], res['channel'], res['message']) sage.echo(output) cur.execute('select `from_char`, `message` from achaea.messages_sent' ' where `time` > %s and `to_char` = %s', (last_pull_time, player.name)) allres = cur.fetchall() if len(allres) > 0: update_time = True for res in allres: sage.echo(res['from_char'] + " said do " + res['message']) sage.send(res['message']) if(update_time): last_pull_time = time.time() cur.close() db.commit() db.close() if do_pull: sage.delay(5, pull_comms)
def chatstuffThreaded(talker, channel, text): global convos global last_response global talkon key = (talker, channel) if (player.name in text) or (channel == 'says') or (channel.startswith('tell')): if (talker, channel) not in convos: sage.echo("Starting a new convo") val = { 'time' : time.time(), 'response' : '', 'bot' : cleverbot.Cleverbot() } convos[key] = val val = convos[key] response = '' if channel == 'says': response = 'say ' elif channel.startswith('clt'): response = 'clan switch %s;clt '%(re.sub('clt','',channel)) elif channel.startswith('tell'): response = channel + ' ' else: sage.echo("SOMEONE SAID MY NAME OVER %s!!!"%channel) return sage.echo(re.sub('"','',re.sub('.*, "','',text))) sage.echo(talker) sage.echo(channel) response = response + ' ' + val['bot'].ask(text) last_response = max(time.time(), last_response) time_to_type = len(response)/5.0 last_response = last_response + time_to_type sage.delay(last_response-time.time(), sage.send, response)
def xplr_act(alias): explr.roomact = ' '.join(alias.line.split()[1:]) if explr.roomact.startswith('wait '): waittime = float(re.sub('wait ','',explr.roomact.split('/')[0])) sage.delay(waittime,sage.send, explr.roomact.split('/')[1]) else: sage.send(explr.roomact)
def xplr_act(alias): explr.roomact = ' '.join(alias.line.split()[1:]) if explr.roomact.startswith('wait '): waittime = float(re.sub('wait ', '', explr.roomact.split('/')[0])) sage.delay(waittime, sage.send, explr.roomact.split('/')[1]) else: sage.send(explr.roomact)
def get_miner_deploy(alias): query = alias.line.split() if len(query) < 4: sage.echo("USAGE: miner deploy (army|miner) (number) (assualt)") mtype = query[2] count = int(query[3]) get_miner_stats(alias) sage.delay(1, deploy_miners, count, mtype)
def sip_trigger(trigger): # set sip balance to off player.sip.off() # disable the 'sips' group trigger.parent().disable() # in 4 seconds, turn on the restored sip balance trigger sage.delay(4, lambda: ss('restored_balance').enable())
def doSip(type): """ Perform sipping action """ if player.sip.balance is False: return overwatch.last_siptype = type sip_group.enable() osys.system_echo('DEBUG: sipping ' + type + ' at ' + str(player.mana.percentage) + ' [threshold: ' + str(overwatch.mana_sipat) + ']') sage.send('sip ' + type) overwatch.currently_sipping = True sage.delay(12, lambda: sip_timeout())
def action_loop(): global do_loop if player.health.value == 0: sage.send('qq') return if do_loop: explr.on_begin() explr.scope_it_out() explr.room_actions() explr.quest_actions() explr.attacks() explr.other() #explr.on_end() sage.delay(0.1, action_loop)
def pull_comms(): global login_info global last_pull_time update_time = False db = mysql.connect(host=login_info[0], user=login_info[1], passwd=login_info[2], db='achaea', cursorclass=MySQLdb.cursors.DictCursor) cur = db.cursor() cur.execute( 'select `char`, `talker`, `channel`, `message` from achaea.messages_heard ' ' where `time` > %s and `char` != %s', (last_pull_time, player.name)) allres = cur.fetchall() if len(allres) > 0: update_time = True for res in allres: output = '%s heard %s say on %s : %s' % ( res['char'], res['talker'], res['channel'], res['message']) sage.echo(output) cur.execute( 'select `from_char`, `message` from achaea.messages_sent' ' where `time` > %s and `to_char` = %s', (last_pull_time, player.name)) allres = cur.fetchall() if len(allres) > 0: update_time = True for res in allres: sage.echo(res['from_char'] + " said do " + res['message']) sage.send(res['message']) if (update_time): last_pull_time = time.time() cur.close() db.commit() db.close() if do_pull: sage.delay(5, pull_comms)
def xplr_time(alias): channel = alias.line.split()[1] query = ' '.join(alias.line.split()[2:]) if ":" in query: query, cmd = query.split(":") sage.delay(1,sage.send, '%s %s in 5'%(channel, query)) sage.delay(2,sage.send, '%s 4'%channel) sage.delay(3,sage.send, '%s 3'%channel) sage.delay(4,sage.send, '%s 2'%channel) sage.delay(5,sage.send, '%s 1'%channel) sage.delay(6,sage.send, '%s NOW'%channel) sage.delay(6.01,sage.send, cmd)
def scope_it_out(self): if not self.do_scope: return if player.room is not None and player.room.id is not None and player.name is not None: db = mysql.connect(host=self.login[0], user=self.login[1], passwd=self.login[2], db='achaea', cursorclass=MySQLdb.cursors.DictCursor) cur = db.cursor() cur.execute( "INSERT into achaea.allies (`ally`,`roomid`) VALUES (%s,%s)" " ON DUPLICATE KEY UPDATE ally=ally, roomid=values(roomid) ", (player.name, player.room.id)) cur.execute( "select ally,roomid from achaea.allies where `leader`=1") allres = cur.fetchall() if allres is not None and len(allres) == 1: leader = allres[0]['ally'].lower() self.leader_room = long(allres[0]['roomid']) if (leader != self.leader): sage.echo("Changing leader from %s to %s" % (self.leader, leader)) self.leader = leader cur.close() db.commit() db.close() self.do_scope = False just_entered = False if (player.room.id != self.cur_room) or (time.time() - self.times['entered'] < 0.5): self.cur_room = player.room.id just_entered = True self.times['entered'] = time.time() if (self.roomact is not None): if self.roomact.startswith('wait '): waittime = float( re.sub('wait ', '', self.roomact.split('/')[0])) sage.delay(waittime, sage.send, self.roomact.split('/')[1]) else: sage.send(self.roomact) just_entered = just_entered and (self.times['last_room'] > self.times['last_scope']) others_here = [p.lower() for p in player.room.players] allies_here = list(set(others_here) & set(self.allies)) others_here = list(set(others_here) - set(self.allies)) if self.leader_following: self.leader_here = self.leader in others_here or self.leader in allies_here else: self.leader_here = True room_dps = len([ iid for iid, item in player.room.items.iteritems() if item.denizen ]) if just_entered: #print 'just entered' self.canAttack = True if just_entered and len(others_here) != 0: print 'people here' self.canAttack = False self.can_take_stuff = False elif just_entered: self.can_take_stuff = not self.block_can_take_stuff if room_dps > self.my_hps * (1 + len(self.allies)): print 'dps too high' self.canAttack = False self.times['last_scope'] = self.times['time']
def other(self): #print self.times idle_time = self.times['time'] - self.times['last_action'] action_idle = self.times['time'] - self.times['last_action'] idle_time = min(idle_time, self.times['time'] - self.times['last_room']) lagging = self.times['last_ping'] < self.times['last_action'] healthy = (player.health.value > player.health.max * .99 and player.mana.value > player.mana.max * .9) if self.path is not None and len(self.path.route) < self.path.step: self.path = None #sage.echo("health status: (%s,%s,%s)"%(self.htracker.health, self.htracker.ema_health_loss, self.htracker.cur_health_loss)) if ((self.htracker.health < 1.5 * max(self.htracker.ema_health_loss, self.htracker.cur_health_loss) and (player.health.value < player.health.max * .7) or self.htracker.mana < 200) and self.state != State.RETREAT and not healthy): sage.echo("Retreat!") self.pre_state = self.state self.state = State.RETREAT self.path = None if (idle_time > 10 and self.path is not None and self.state != State.REST): if (len(self.path.route) > self.path.step and player.room.id != self.path.route[self.path.step]): sage.echo("Blocking room %s" ", current room %s" ", path: %s" % (self.path.route[self.path.step], player.room.id, self.path.route)) self.blocked.append(self.path.route[self.path.step]) self.visited.add(self.path.route[self.path.step]) self.times['last_action'] = time.time() self.path = None min_will = 500 max_will = player.willpower.max do_rest = ((self.state != State.REST) and ((player.willpower.value < (min_will + max_will / 10)) or (player.endurance.value < min_will + max_will / 10)) and (player.room.id == 6838)) if do_rest: sage.echo("Setting the state to be rest") self.path = None self.state = State.REST self.times['last_action'] = time.time() self.vials_empty = 0 self.sips_health = 0 self.sips_mana = 0 vial_triggers('vial_empty').enable() vial_triggers('vial_stat').enable() sage.send('consolidate health') sage.send('consolidate mana') sage.send('elixsum health') sage.send('elixsum mana') sage.send('elixlist empty') sage.delay(1, self.buyElixirs) #if player.willpower.value < player.endurance.value: # sage.send('meditate') #else: # sage.send('sleep') end_rest = ((self.state == State.REST) and ( (player.willpower.value >= min(max_will, player.willpower.max)) and (player.endurance.value >= min(max_will, player.endurance.max))) and (player.room.id == 6838)) if end_rest: sage.echo("Done resting!") self.state = State.EXPLORE self.times['last_action'] = time.time() if (len(self.explore_area) > 0): self.path = self.map.path_to_area(player.room.id, self.explore_area[0], self.blocked) go_to_rest = ((self.state != State.REST) and (self.state != State.QUEST) and ((player.willpower.value < min_will) or (player.endurance.value < min_will))) find_new_quest = ((self.state == State.QUEST) and ((self.path is None) or (self.path.route[-1] == player.room.id))) find_new_room = ((self.state == State.EXPLORE) and ((self.path is None) or (self.path.route[-1] == player.room.id) or (idle_time > 20)) and len(self.explore_area) > 0) #print find_new_room, self.state, self.path, self.explore_area if (not self.leader_here and self.state == State.EXPLORE and player.room.id != self.leader_room and (self.path is None or self.leader_room != self.path.route[-1])): sage.echo("Setting path to walk to leader") self.path = self.map.path_to_room(player.room.id, self.leader_room, self.blocked) if go_to_rest: sage.echo("Setting the state to be quest to walk to sleepzone") self.state = State.QUEST self.path = self.map.path_to_room(player.room.id, 6838, self.blocked) find_new_quest = find_new_room = False if (self.state == State.RETREAT) and (len(self.visited_order) > 1): if (player.health.value > player.health.max * .9 and player.mana.value > player.mana.max * self.manamin): self.times['last_action'] = time.time() sage.echo("Done with retreat!") self.state = self.pre_state if ((player.room.id == self.visited_order[-1]) and (idle_time > 0.5) and (len(self.to_attack) > 0) and self.path == None): self.visited.remove(self.visited_order[-1]) self.visited_order.pop() self.path = self.map.path_to_room(player.room.id, self.visited_order[-1], self.blocked) sage.echo("Moving to retreat room") sage.echo(self.path.route) if find_new_room: self.visited.add(player.room.id) if player.room.area == self.explore_area[0]: self.path = self.map.path_to_new_room(player.room.id, self.visited, self.explore_area[0], self.blocked) else: self.path = self.map.path_to_area(player.room.id, self.explore_area[0], self.blocked) if self.path is None: echo("Done exploring area: %s" % self.explore_area[0]) self.took_items = [] self.state = State.QUEST self.visited = set() old_area = self.explore_area.pop(0) if self.explore_loop: self.explore_area.append(old_area) if find_new_quest: items = [ self.imap.items[iid] for iid in player.inv.keys() if iid in self.imap.items ] items = [ item for item in items if item['quest_actions'] != '' and item['quest_actions'] is not None and item['itemid'] not in self.unquest_items ] found_quest = False for item in items: print "command: ", item['quest_actions'] commands = item['quest_actions'].split(';') for command in commands: action = command.split(' ')[0] if (action == 'give'): target = command.split(' ')[2] targ_item = self.imap.items[long(target)] if targ_item['lastroom'] != player.room.id: self.path = self.map.path_to_room( player.room.id, targ_item['lastroom'], self.blocked) found_quest = True if self.path is None: self.unquest_items.append(item['itemid']) found_quest = False elif self.state == State.QUEST: break if not found_quest and len(self.explore_area) > 0: self.state = State.EXPLORE #if('shop' in player.room.details): # check_shop() if self.path is None: return if ((self.path is not None) and (player.room.id == self.path.route[-1])): self.visited.add(player.room.id) if (self.state != State.PROSP): if self.leader_following: sage.send("follow %s" % self.leader) echo("We appear to be at the end of our route:" "{end},{cur}".format(end=self.path.route[-1], cur=player.room.id)) self.path = None return self.path.step = self.path.step + 1 return do_move = ((self.state == State.EXPLORE or self.state == State.QUEST or self.state == State.RETREAT or self.state == State.PROSP) and idle_time > self.move_idle_wait and not lagging and self.can_move and action_idle > self.action_idle_wait) if self.path.step >= len(self.path.route): self.path = None return if (player.room.id == self.path.route[self.path.step] and do_move): sage.send(self.path.directions[self.path.step]) self.last_move = self.path.directions[self.path.step] self.path.step = self.path.step + 1 #self.times['last_action'] = self.times['time'] self.times['last_move'] = self.times['time']
def xplr_mab(alias): move = alias.line.split()[1] block = alias.line.split()[2] cmd = 'unblock | %s | block %s' % (move, block) sage.delay(1, sage.send, 'pt Moving %s, block %s, in 5' % (move, block)) sage.delay(2, sage.send, 'pt Moving %s, block %s, in 4' % (move, block)) sage.delay(3, sage.send, 'pt Moving %s, block %s, in 3' % (move, block)) sage.delay(4, sage.send, 'pt Moving %s, block %s, in 2' % (move, block)) sage.delay(5, sage.send, 'pt Moving %s, block %s, in 1' % (move, block)) sage.delay(6, sage.send, 'pt Moving %s, block %s, NOW' % (move, block)) sage.delay(6.01, sage.send, cmd)
def xplr_time(alias): channel = alias.line.split()[1] query = ' '.join(alias.line.split()[2:]) if ":" in query: query, cmd = query.split(":") sage.delay(1, sage.send, '%s %s in 5' % (channel, query)) sage.delay(2, sage.send, '%s 4' % channel) sage.delay(3, sage.send, '%s 3' % channel) sage.delay(4, sage.send, '%s 2' % channel) sage.delay(5, sage.send, '%s 1' % channel) sage.delay(6, sage.send, '%s NOW' % channel) sage.delay(6.01, sage.send, cmd)
def xplr_mab(alias): move = alias.line.split()[1] block= alias.line.split()[2] cmd = 'unblock | %s | block %s'%(move,block) sage.delay(1,sage.send, 'pt Moving %s, block %s, in 5'%(move, block)) sage.delay(2,sage.send, 'pt Moving %s, block %s, in 4'%(move, block)) sage.delay(3,sage.send, 'pt Moving %s, block %s, in 3'%(move,block)) sage.delay(4,sage.send, 'pt Moving %s, block %s, in 2'%(move,block)) sage.delay(5,sage.send, 'pt Moving %s, block %s, in 1'%(move,block)) sage.delay(6,sage.send, 'pt Moving %s, block %s, NOW'%(move,block)) sage.delay(6.01,sage.send, cmd)
def no_SipLeft(trigger): if overwatch.currently_sipping is True: osys.system_echo('SIPPING: Run out of elixir to sip! Trying again in 4 seconds') sage.delay(4, lambda: doSip(overwatch.last_siptype))
def other(self): #print self.times idle_time = self.times['time'] - self.times['last_action'] action_idle = self.times['time'] - self.times['last_action'] idle_time = min(idle_time, self.times['time'] - self.times['last_room']) lagging = self.times['last_ping'] < self.times['last_action'] healthy = (player.health.value > player.health.max*.99 and player.mana.value > player.mana.max*.9) if self.path is not None and len(self.path.route) < self.path.step: self.path = None #sage.echo("health status: (%s,%s,%s)"%(self.htracker.health, self.htracker.ema_health_loss, self.htracker.cur_health_loss)) if ((self.htracker.health < 1.5* max(self.htracker.ema_health_loss, self.htracker.cur_health_loss) and (player.health.value < player.health.max*.7) or self.htracker.mana < 200) and self.state != State.RETREAT and not healthy): sage.echo("Retreat!") self.pre_state = self.state self.state = State.RETREAT self.path = None if(idle_time > 10 and self.path is not None and self.state != State.REST): if(len(self.path.route) > self.path.step and player.room.id != self.path.route[self.path.step]): sage.echo("Blocking room %s" ", current room %s" ", path: %s"%( self.path.route[self.path.step], player.room.id,self.path.route)) self.blocked.append(self.path.route[self.path.step]) self.visited.add(self.path.route[self.path.step]) self.times['last_action'] = time.time() self.path = None min_will = 500 max_will = player.willpower.max do_rest = ((self.state != State.REST) and ((player.willpower.value < (min_will+max_will/10)) or (player.endurance.value < min_will+max_will/10)) and (player.room.id == 6838)) if do_rest: sage.echo("Setting the state to be rest") self.path = None self.state = State.REST self.times['last_action'] = time.time() self.vials_empty = 0 self.sips_health = 0 self.sips_mana = 0 vial_triggers('vial_empty').enable() vial_triggers('vial_stat').enable() sage.send('consolidate health') sage.send('consolidate mana') sage.send('elixsum health') sage.send('elixsum mana') sage.send('elixlist empty') sage.delay(1, self.buyElixirs) #if player.willpower.value < player.endurance.value: # sage.send('meditate') #else: # sage.send('sleep') end_rest = ((self.state == State.REST) and ((player.willpower.value >= min(max_will, player.willpower.max)) and (player.endurance.value >= min(max_will, player.endurance.max))) and (player.room.id == 6838)) if end_rest: sage.echo("Done resting!") self.state = State.EXPLORE self.times['last_action'] = time.time() if(len(self.explore_area) > 0): self.path = self.map.path_to_area( player.room.id, self.explore_area[0], self.blocked) go_to_rest = ((self.state != State.REST) and (self.state != State.QUEST) and ((player.willpower.value < min_will) or (player.endurance.value < min_will))) find_new_quest = ((self.state == State.QUEST) and ((self.path is None) or (self.path.route[-1] == player.room.id))) find_new_room = ((self.state == State.EXPLORE) and ((self.path is None) or (self.path.route[-1] == player.room.id) or (idle_time > 20)) and len(self.explore_area) > 0) #print find_new_room, self.state, self.path, self.explore_area if (not self.leader_here and self.state == State.EXPLORE and player.room.id != self.leader_room and (self.path is None or self.leader_room != self.path.route[-1])): sage.echo("Setting path to walk to leader") self.path = self.map.path_to_room( player.room.id, self.leader_room, self.blocked) if go_to_rest: sage.echo("Setting the state to be quest to walk to sleepzone") self.state = State.QUEST self.path = self.map.path_to_room( player.room.id, 6838, self.blocked) find_new_quest = find_new_room = False if (self.state == State.RETREAT) and (len(self.visited_order) > 1): if (player.health.value > player.health.max*.9 and player.mana.value > player.mana.max*self.manamin): self.times['last_action'] = time.time() sage.echo("Done with retreat!") self.state = self.pre_state if ((player.room.id == self.visited_order[-1]) and (idle_time > 0.5) and (len(self.to_attack) > 0) and self.path == None): self.visited.remove(self.visited_order[-1]) self.visited_order.pop() self.path = self.map.path_to_room( player.room.id, self.visited_order[-1], self.blocked) sage.echo("Moving to retreat room") sage.echo(self.path.route) if find_new_room: self.visited.add(player.room.id) if player.room.area == self.explore_area[0]: self.path = self.map.path_to_new_room( player.room.id, self.visited, self.explore_area[0], self.blocked) else: self.path = self.map.path_to_area( player.room.id, self.explore_area[0], self.blocked) if self.path is None: echo ("Done exploring area: %s" % self.explore_area[0]) self.took_items = [] self.state = State.QUEST self.visited = set() old_area = self.explore_area.pop(0) if self.explore_loop: self.explore_area.append(old_area) if find_new_quest: items = [self.imap.items[iid] for iid in player.inv.keys() if iid in self.imap.items] items = [item for item in items if item['quest_actions'] != '' and item['quest_actions'] is not None and item['itemid'] not in self.unquest_items] found_quest = False for item in items: print "command: ", item['quest_actions'] commands = item['quest_actions'].split(';') for command in commands: action = command.split(' ')[0] if(action == 'give'): target = command.split(' ')[2] targ_item = self.imap.items[long(target)] if targ_item['lastroom'] != player.room.id: self.path = self.map.path_to_room( player.room.id, targ_item['lastroom'], self.blocked) found_quest = True if self.path is None: self.unquest_items.append(item['itemid']) found_quest = False elif self.state == State.QUEST: break if not found_quest and len(self.explore_area) > 0: self.state = State.EXPLORE #if('shop' in player.room.details): # check_shop() if self.path is None: return if ((self.path is not None) and (player.room.id == self.path.route[-1])): self.visited.add(player.room.id) if(self.state != State.PROSP): if self.leader_following: sage.send("follow %s"%self.leader) echo("We appear to be at the end of our route:" "{end},{cur}".format(end=self.path.route[-1], cur=player.room.id)) self.path = None return self.path.step = self.path.step+1 return do_move = ((self.state == State.EXPLORE or self.state == State.QUEST or self.state == State.RETREAT or self.state == State.PROSP) and idle_time > self.move_idle_wait and not lagging and self.can_move and action_idle > self.action_idle_wait) if self.path.step >= len(self.path.route): self.path = None return if(player.room.id == self.path.route[self.path.step] and do_move): sage.send(self.path.directions[self.path.step]) self.last_move = self.path.directions[self.path.step] self.path.step = self.path.step+1 #self.times['last_action'] = self.times['time'] self.times['last_move'] = self.times['time']
def scope_it_out(self): if not self.do_scope: return if player.room is not None and player.room.id is not None and player.name is not None: db = mysql.connect(host=self.login[0], user=self.login[1],passwd=self.login[2], db='achaea',cursorclass=MySQLdb.cursors.DictCursor) cur=db.cursor() cur.execute("INSERT into achaea.allies (`ally`,`roomid`) VALUES (%s,%s)" " ON DUPLICATE KEY UPDATE ally=ally, roomid=values(roomid) ", (player.name, player.room.id)) cur.execute("select ally,roomid from achaea.allies where `leader`=1") allres = cur.fetchall() if allres is not None and len(allres) == 1: leader=allres[0]['ally'].lower() self.leader_room=long(allres[0]['roomid']) if(leader != self.leader): sage.echo("Changing leader from %s to %s"%(self.leader, leader)) self.leader = leader cur.close() db.commit() db.close() self.do_scope=False just_entered = False if (player.room.id != self.cur_room) or (time.time() - self.times['entered'] < 0.5): self.cur_room = player.room.id just_entered = True self.times['entered'] = time.time() if(self.roomact is not None): if self.roomact.startswith('wait '): waittime = float(re.sub('wait ','',self.roomact.split('/')[0])) sage.delay(waittime,sage.send, self.roomact.split('/')[1]) else: sage.send(self.roomact) just_entered = just_entered and (self.times['last_room'] > self.times['last_scope']) others_here = [p.lower() for p in player.room.players] allies_here = list(set(others_here) & set(self.allies)) others_here = list(set(others_here) - set(self.allies)) if self.leader_following: self.leader_here = self.leader in others_here or self.leader in allies_here else: self.leader_here = True room_dps = len([iid for iid,item in player.room.items.iteritems() if item.denizen]) if just_entered: #print 'just entered' self.canAttack = True if just_entered and len(others_here) != 0: print 'people here' self.canAttack = False self.can_take_stuff = False elif just_entered: self.can_take_stuff = not self.block_can_take_stuff if room_dps > self.my_hps * (1 + len(self.allies)): print 'dps too high' self.canAttack = False self.times['last_scope'] = self.times['time']