async def one_eye_dm(id_user = None, id_server = None, poi = None): poi_obj = poi_static.id_to_poi.get(poi) client = ewutils.get_client() server = client.get_guild(id_server) server = client.get_guild(str(id_server)) server = client.get_guild(int(id_server)) id_player = EwPlayer(id_user=id_user, id_server=id_server) if poi_obj.pvp: try: recipients = bknd_core.execute_sql_query( "SELECT {id_user} FROM mutations WHERE {id_server} = %s AND {mutation} = %s and {data} = %s".format( data=ewcfg.col_mutation_data, id_server=ewcfg.col_id_server, id_user=ewcfg.col_id_user, mutation=ewcfg.col_id_mutation, ), ( id_server, ewcfg.mutation_id_oneeyeopen, str(id_user), )) for recipient in recipients: member = server.get_member(int(recipient[0])) mutation = EwMutation(id_server=id_server, id_user=recipient[0], id_mutation=ewcfg.mutation_id_oneeyeopen) mutation.data = "" mutation.persist() await fe_utils.send_message(client, member, fe_utils.formatMessage(member, "{} is stirring...".format(id_player.display_name))) except: ewutils.logMsg("Failed to do OEO notificaitons for {}.".format(id_user))
async def preserve(cmd): user_data = EwUser(member=cmd.message.author) mutations = user_data.get_mutations() item_search = ewutils.flattenTokenListToString(cmd.tokens[1:]) item_sought = bknd_item.find_item(item_search=item_search, id_user=cmd.message.author.id, id_server=cmd.guild.id if cmd.guild is not None else None) if item_sought: item_obj = EwItem(id_item=item_sought.get('id_item')) if item_obj.item_props.get('preserved') == None: preserve_id = 0 else: preserve_id = int(item_obj.item_props.get('preserved')) if ewcfg.mutation_id_rigormortis not in mutations: response = "You can't just preserve something by saying you're going to. Everything ends eventually." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif item_obj.soulbound == True: response = "This thing's bound to your soul. There's no need to preserve it twice." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif preserve_id == int(user_data.id_user): response = "Didn't you already preserve this? You're so paranoid." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif item_obj.item_props.get('preserved') == "nopreserve": response = "You shove it into your body but it just won't fit for some reason. That phrasing was completely intentional, by the way." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: rigor = EwMutation(id_user=cmd.message.author.id, id_server=cmd.message.guild.id, id_mutation=ewcfg.mutation_id_rigormortis) if rigor.data.isdigit() == False: num = 0 else: num = int(rigor.data) if num >= 5: response = "Your body's dried up, it's lost its ability to preserve objects." else: response = "You take the {} and embrace it with all your might. As you squeeze, it slowly but surely begins to phase inside your body. That won't get stolen anytime soon!".format(item_sought.get('name')) num += 1 rigor.data = str(num) item_obj.item_props['preserved'] = user_data.id_user rigor.persist() item_obj.persist() return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: response = "Preserve what?" return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def track_oneeyeopen(cmd): user_data = EwUser(id_user=cmd.message.author.id, id_server=cmd.message.guild.id) if cmd.mentions_count > 0: target_data = EwUser(member=cmd.mentions[0]) mutations = user_data.get_mutations() if ewcfg.mutation_id_oneeyeopen not in mutations: response = "No can do. Your third eye is feeling pretty flaccid today." elif cmd.mentions_count == 0: response = "Who are you tracking?" elif cmd.mentions_count > 1: response = "Nice try, but you're not the NSA. Limit your espionage to one poor sap." elif cmd.mentions[0] == cmd.message.author: response = "You set your third eye to track yourself. However, you are too uncomfortable with your body to keep it there. Better try something else." else: response = "Your third eye slips out of your forehead and wanders its way to {}'s location. Just a matter of time...".format(cmd.mentions[0].display_name) mutation_data = EwMutation(id_user=user_data.id_user, id_server=user_data.id_server, id_mutation=ewcfg.mutation_id_oneeyeopen) mutation_data.data = target_data.id_user mutation_data.persist() return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def slap(cmd): if ewutils.channel_name_is_poi(cmd.message.channel.name) == False: return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You must {} in a zone's channel.".format(cmd.tokens[0]))) time_now = int(time.time()) user_data = EwUser(member=cmd.message.author) user_poi = poi_static.id_to_poi.get(user_data.poi) target_data = -1 mutations = user_data.get_mutations() resp_cont = EwResponseContainer(id_server=cmd.guild.id) if cmd.tokens_count < 3: response = "You'll need to specify who and where you're slapping. Try !slap <target> <location>." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) dest_poi = cmd.tokens[2].lower() dest_poi_obj = poi_static.id_to_poi.get(dest_poi) response = "" if cmd.mentions_count == 0: response = "Who are you slapping?" elif cmd.mentions_count > 1: response = "Nobody's that good at slapping. Do it to one person at a time." else: target_data = EwUser(member=cmd.mentions[0]) if response != "": return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if target_data.poi != user_data.poi: response = "Not right now. You can't slap what you can't see." elif user_data.id_user == target_data.id_user: response = "Stop hitting yourself." elif ewutils.active_restrictions.get(target_data.id_user) != None and ewutils.active_restrictions.get(target_data.id_user) > 0: response = "They're in the middle of something, be patient." elif target_data.life_state == ewcfg.life_state_corpse: response = "You give {} a good whack. They're a ghost though, so your hand passes straight through.".format(cmd.mentions[0].display_name) elif ewcfg.mutation_id_ditchslap not in mutations: response = "You wind up your good arm and tacoom {} hard in the {}. The air gets knocked out of them but they stay firmly in place.".format(cmd.mentions[0].display_name, random.choice(['face', 'face', 'face', 'ass'])) else: mutation_data = EwMutation(id_mutation=ewcfg.mutation_id_ditchslap, id_user=cmd.message.author.id, id_server=cmd.message.guild.id) if len(mutation_data.data) > 0: time_lastuse = int(mutation_data.data) else: time_lastuse = 0 if dest_poi_obj.id_poi not in user_poi.neighbors.keys(): response = "You can't hit them that far." elif move_utils.inaccessible(user_data=target_data, poi=dest_poi_obj): response = "That place is locked up good. You can't get a good launch angle to send them there." # elif time_lastuse + 180 * 60 > time_now: # response = "Your arm is spent from the last time you obliterated someone. Try again in {} minutes.".format(math.ceil((time_lastuse + 180*60 - time_now)/60)) elif user_data.faction != target_data.faction: response = "You try to slap {}, but they realize what you're doing and jump back. Welp, back to the drawing board.".format(cmd.mentions[0].display_name) elif user_poi.id_poi in [ewcfg.poi_id_rowdyroughhouse, ewcfg.poi_id_copkilltown] or user_poi.is_apartment: response = "They're currently in their room. You'd have to carry {} out of it to slap them, which would be gay.".format(cmd.mentions[0].display_name) elif ewcfg.status_slapped_id in target_data.getStatusEffects(): response = "Don't turn this into domestic abuse now. Can't you see they're still reeling from the last time?" elif (ewutils.clenched.get(target_data.id_user) == None or ewutils.clenched.get(target_data.id_user) == 0) and (user_poi.is_subzone or user_poi.is_district): response = "You wind up your slappin' hand and take a swing, but {} is all relaxed and you can't get a good angle. They end up flying into the wall. Better not touch people who aren't prepared to get hit...".format(cmd.mentions[0].display_name) else: response = "You wind up your slap. This one's gonna hurt. Steady as she goes...WHAM! {} is sent flying helplessly into {}!".format(cmd.mentions[0].display_name, dest_poi_obj.str_name) target_data.applyStatus(id_status=ewcfg.status_slapped_id) dm_response = "WHAP! {} smacked you into {}!".format(cmd.message.author.display_name, dest_poi_obj.str_name) target_response = "**CRAAAAAAAAAAAASH!** You arrive in {}!".format(dest_poi_obj.str_name) ewutils.moves_active[cmd.message.author.id] = 0 target_data.poi = dest_poi_obj.id_poi user_data.time_lastenter = int(time.time()) mutation_data.data = str(time_now) mutation_data.persist() if target_data.poi == ewcfg.poi_id_thesewers: target_data.die(cause=ewcfg.cause_suicide) target_response += " But you hit your head really hard! Your precious little dome explodes into bits and pieces and you die!" user_data.persist() await ewrolemgr.updateRoles(client=ewutils.get_client(), member=cmd.mentions[0], new_poi=target_data.poi) target_data.persist() await user_data.move_inhabitants(id_poi=dest_poi_obj.id_poi) await prank_utils.activate_trap_items(dest_poi_obj.id_poi, user_data.id_server, target_data.id_user) await fe_utils.send_message(cmd.client, cmd.mentions[0], fe_utils.formatMessage(cmd.mentions[0], dm_response)) await fe_utils.send_message(cmd.client, fe_utils.get_channel(server=cmd.mentions[0].guild, channel_name=dest_poi_obj.channel), fe_utils.formatMessage(cmd.mentions[0], target_response)) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))