async def send_gangbase_messages(server_id, clock): # this can be added onto for events and such lucky_lucy = 0 casino_response = "**Lucky Lucy has arrived!** Now's the time to make your fortune!" casino_end = "Aww, Lucy left." response = "" if clock == 3: response = "The police are probably asleep, the lazy f***s. It's a good time for painting the town!" elif clock == 11: response = "Spray time's over, looks like the cops are back out. F**k those guys." if random.randint(1, 50) == 2: lucky_lucy = 1 client = ewutils.get_client() server = client.get_guild(server_id) channels = ewcfg.hideout_channels casino_channel = fe_utils.get_channel(server=server, channel_name=ewcfg.channel_casino) if response != "": for channel in channels: post_channel = fe_utils.get_channel(server, channel) await fe_utils.send_message(client, post_channel, response) if lucky_lucy == 1: await fe_utils.send_message(client, casino_channel, casino_response) await asyncio.sleep(300) await fe_utils.send_message(client, casino_channel, casino_end)
async def send_gangbase_messages(server_id, clock): # this can be added onto for events and such lucky_lucy = 0 casino_response = "**Lucky Lucy has arrived!** Now's the time to make your fortune!" casino_end = "Aww, Lucy left." highnoon = 0 response = "" #if clock == 3: # response = "The police are probably asleep, the lazy f***s. It's a good time for painting the town!" #elif clock == 11: # response = "Spray time's over, looks like the cops are back out. F**k those guys." if random.randint(1, 50) == 2: lucky_lucy = 1 if clock == 11: highnoon = 1 if clock == 12: highnoon = 2 client = ewutils.get_client() server = client.get_guild(server_id) channels = ewcfg.hideout_channels casino_channel = fe_utils.get_channel(server=server, channel_name=ewcfg.channel_casino) dueling_channel = fe_utils.get_channel(server=server, channel_name='hang-em-square') if response != "": for channel in channels: post_channel = fe_utils.get_channel(server, channel) await fe_utils.send_message(client, post_channel, response) if lucky_lucy == 1: pass #taking this out until we have a better method #await fe_utils.send_message(client, casino_channel, casino_response) #await asyncio.sleep(300) #await fe_utils.send_message(client, casino_channel, casino_end) if highnoon != 0: district = EwDistrict(district='hangemsquare', id_server=server_id) if len( district.get_players_in_district( min_slimes=0, life_states=[ ewcfg.life_state_enlisted, ewcfg.life_state_juvenile, ewcfg.life_state_shambler, ewcfg.life_state_corpse ], ignore_offline=True)) > 0: if highnoon == 1: response = "It's almost high noon..." else: response = "**DRAW!!!!**" await fe_utils.send_message(client, dueling_channel, response)
async def shamble(cmd): user_data = EwUser(member=cmd.message.author) if user_data.life_state != ewcfg.life_state_shambler and user_data.poi != ewcfg.poi_id_assaultflatsbeach: response = "You have too many higher brain functions left to {}.".format(cmd.tokens[0]) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif user_data.life_state in [ewcfg.life_state_juvenile, ewcfg.life_state_enlisted] and user_data.poi == ewcfg.poi_id_assaultflatsbeach: response = "You feel an overwhelming sympathy for the plight of the Shamblers and decide to join their ranks." await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) await asyncio.sleep(5) user_data = EwUser(member=cmd.message.author) user_data.life_state = ewcfg.life_state_shambler #user_data.degradation = 100 ewutils.moves_active[user_data.id_user] = 0 user_data.poi = ewcfg.poi_id_nuclear_beach_edge user_data.persist() member = cmd.message.author base_poi_channel = fe_utils.get_channel(cmd.message.guild, 'nuclear-beach-edge') response = 'You arrive inside the facility and are injected with a unique strain of the Modelovirus. Not long after, a voice on the intercom chimes in.\n**"Welcome, {}. Welcome to Downpour Laboratories. It\'s safer here. Please treat all machines and facilities with respect, they are precious to our cause."**'.format(member.display_name) await ewrolemgr.updateRoles(client=cmd.client, member=member) return await fe_utils.send_message(cmd.client, base_poi_channel, fe_utils.formatMessage(cmd.message.author, response)) else: pass
async def rejuvenate(cmd): user_data = EwUser(member=cmd.message.author) if user_data.life_state == ewcfg.life_state_shambler and user_data.poi != ewcfg.poi_id_oozegardens: response = "You lack the higher brain functions required to {}.".format(cmd.tokens[0]) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif user_data.life_state == ewcfg.life_state_shambler and user_data.poi == ewcfg.poi_id_oozegardens: response = "You decide to change your ways and become one of the Garden Gankers in order to overthrow your old master." await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) await asyncio.sleep(5) user_data = EwUser(member=cmd.message.author) user_data.life_state = ewcfg.life_state_juvenile #user_data.degradation = 0 # user_data.gvs_currency = 0 ewutils.moves_active[user_data.id_user] = 0 user_data.poi = ewcfg.poi_id_og_farms user_data.persist() client = ewutils.get_client() server = client.get_guild(user_data.id_server) member = server.get_member(user_data.id_user) base_poi_channel = fe_utils.get_channel(cmd.message.guild, ewcfg.channel_og_farms) response = "You enter into Atomic Forest inside the farms of Ooze Gardens and are sterilized of the Modelovirus. Hortisolis gives you a big hug and says he's glad you've overcome your desire for vengeance in pursuit of deposing Downpour." await ewrolemgr.updateRoles(client=cmd.client, member=member) return await fe_utils.send_message(cmd.client, base_poi_channel, fe_utils.formatMessage(cmd.message.author, response)) else: pass
async def pa_command(cmd): user_data = EwUser(member=cmd.message.author) if not cmd.message.author.guild_permissions.administrator and user_data.life_state != ewcfg.life_state_executive: return await cmd_utils.fake_failed_command(cmd) else: if cmd.tokens_count >= 3: poi = ewutils.flattenTokenListToString(cmd.tokens[1]) poi_obj = poi_static.id_to_poi.get(poi) if poi == "auditorium": channel = "auditorium" else: channel = poi_obj.channel loc_channel = fe_utils.get_channel(cmd.guild, channel) if poi is not None: patext = re.sub( "<.+>", "", cmd.message.content[(len(cmd.tokens[0]) + len(cmd.tokens[1]) + 1):]).strip() if len(patext) > 500: patext = patext[:-500] return await fe_utils.send_message(cmd.client, loc_channel, patext)
async def kick(id_server): # Gets data for all living players from the database all_living_players = bknd_core.execute_sql_query("SELECT {poi}, {id_user} FROM users WHERE id_server = %s AND {life_state} > 0 AND {time_last_action} < %s".format( poi=ewcfg.col_poi, id_user=ewcfg.col_id_user, time_last_action=ewcfg.col_time_last_action, life_state=ewcfg.col_life_state ), ( id_server, (int(time.time()) - ewcfg.time_kickout) )) client = ewutils.get_client() for player in all_living_players: try: poi = poi_static.id_to_poi[player[0]] id_user = player[1] # checks if the player should be kicked from the subzone and kicks them if they should. if poi.is_subzone and poi.id_poi not in [ewcfg.poi_id_thesphere, ewcfg.poi_id_thebreakroom]: # Don't load the user until we know that we need to user_data = EwUser(id_user=id_user, id_server=id_server) # Some subzones could potentially have multiple mother districts. # Make sure to get one that's accessible before attempting a proper kickout. mother_district_chosen = random.choice(poi.mother_districts) if inaccessible(user_data=user_data, poi=poi_static.id_to_poi.get(mother_district_chosen)): # If the randomly chosen mother district is inaccessible, make one more attempt. mother_district_chosen = random.choice(poi.mother_districts) else: pass if not inaccessible(user_data=user_data, poi=poi_static.id_to_poi.get(mother_district_chosen)): if user_data.life_state not in [ewcfg.life_state_kingpin, ewcfg.life_state_lucky, ewcfg.life_state_executive] and user_data.id_user != 799933061080416266: server = ewcfg.server_list[id_server] member_object = server.get_member(id_user) user_data.poi = mother_district_chosen user_data.time_lastenter = int(time.time()) user_data.persist() await ewrolemgr.updateRoles(client=client, member=member_object) await user_data.move_inhabitants(id_poi=mother_district_chosen) mother_district_channel = fe_utils.get_channel(server, poi_static.id_to_poi[mother_district_chosen].channel) response = "You have been kicked out for loitering! You can only stay in a sub-zone and twiddle your thumbs for 1 hour at a time." await fe_utils.send_message(client, mother_district_channel, fe_utils.formatMessage(member_object, response)) except: ewutils.logMsg('failed to move inactive player out of subzone with poi {}: {}'.format(player[0], player[1]))
async def hogtie(cmd): if not 0 < ewrolemgr.checkClearance(member=cmd.message.author) < 4: return await cmd_utils.fake_failed_command(cmd) else: if cmd.mentions_count == 1: target_data = EwUser(member=cmd.mentions[0]) member = cmd.mentions[0] if target_data.hogtied == 1: target_data.hogtied = 0 target_data.persist() response = "Whew-whee! She's buckin' so we gotta let 'er go." await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) leak_channel = fe_utils.get_channel( server=cmd.guild, channel_name='squickyleaks') await fe_utils.send_message( cmd.client, leak_channel, "{}:Released {} from eternal bondage.".format( cmd.message.author.display_name, member.display_name)) else: target_data.hogtied = 1 target_data.persist() response = "Boy howdy! Looks like we lasso'd up a real heifer there! A dang ol' big'un." await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) leak_channel = fe_utils.get_channel( server=cmd.guild, channel_name='squickyleaks') await fe_utils.send_message( cmd.client, leak_channel, "{}: Hogtied {}.".format(cmd.message.author.display_name, member.display_name))
async def tweet(cmd): user_data = EwUser(id_user=cmd.message.author.id, id_server=cmd.guild.id) if user_data.has_gellphone(): if cmd.tokens_count < 2: if len(cmd.message.attachments) == 0: response = "Tweet what?" return await fe_utils.send_response(response, cmd) else: tweet_content = "\u200d" else: tweet_content = ' '.join( "`{}`".format(token) if token.startswith("#") else token for token in cmd.tokens[1:]) # embed limits if len(tweet_content) > 280: response = "Alright there bud, slow down a bit. No one's gonna read all that ({}/280).".format( len(tweet_content)) return await fe_utils.send_response(response, cmd) tweet = fe_utils.discord.Embed() tweet.set_thumbnail(url=cmd.message.author.avatar_url) # we use the description to set the author since members cannot be mentioned from the author field checkmark = ewcfg.emote_verified if user_data.verified else "" tweet.description = "<@!{}>{}".format(cmd.message.author.id, checkmark) tweet.color = get_tweet_color(user_data) # \u200b is a whitespace character, since we cannot leave field names empty tweet.add_field(name='\u200b', value=tweet_content) # works as long as the first attachment is an image # other file types are ignored if len(cmd.message.attachments) > 0: tweet.set_image(url=cmd.message.attachments[0].url) channel = fe_utils.get_channel(server=cmd.guild, channel_name=ewcfg.channel_slimetwitter) await fe_utils.send_message(cmd.client, channel, embed=tweet) else: response = "You need to have a gellphone to !tweet." return await fe_utils.send_response(response, cmd)
async def disembark(cmd): # can only use movement commands in location channels 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]))) user_data = EwUser(member=cmd.message.author) response = "" resp_cont = EwResponseContainer(client=cmd.client, id_server=user_data.id_server) # prevent ghosts currently inhabiting other players from moving on their own if user_data.get_inhabitee(): response = "You might want to **{}** of the poor soul you've been tormenting first.".format(ewcfg.cmd_letgo) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) # can only disembark when you're on a transport vehicle elif user_data.poi in poi_static.transports: transport_data = EwTransport(id_server=user_data.id_server, poi=user_data.poi) response = "{}ing.".format(cmd.tokens[0][1:].lower()).capitalize() stop_poi = poi_static.id_to_poi.get(transport_data.current_stop) # if stop_poi.is_subzone: # stop_poi = poi_static.id_to_poi.get(stop_poi.mother_district) if move_utils.inaccessible(user_data=user_data, poi=stop_poi): return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You're not allowed to go there (bitch).")) # schedule tasks for concurrent execution message_task = asyncio.ensure_future(fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))) wait_task = asyncio.ensure_future(asyncio.sleep(ewcfg.time_embark)) # Take control of the move for this player. move_utils.move_counter += 1 move_current = ewutils.moves_active[cmd.message.author.id] = move_utils.move_counter await message_task await wait_task # check if the user entered another movement command while waiting for the current one to be completed if move_current != ewutils.moves_active[cmd.message.author.id]: return user_data = EwUser(member=cmd.message.author) transport_data = EwTransport(id_server=user_data.id_server, poi=transport_data.poi) # cancel move, if the user has left the transport while waiting for movement to be completed (e.g. by dying) if user_data.poi != transport_data.poi: return stop_poi = poi_static.id_to_poi.get(transport_data.current_stop) # juvies can't swim if transport_data.current_stop == ewcfg.poi_id_slimesea and user_data.life_state != ewcfg.life_state_corpse: if user_data.life_state == ewcfg.life_state_kingpin: response = "You try to heave yourself over the railing as you're hit by a sudden case of sea sickness. You puke into the sea and sink back on deck." response = fe_utils.formatMessage(cmd.message.author, response) return await fe_utils.send_message(cmd.client, cmd.message.channel, response) user_data.poi = ewcfg.poi_id_slimesea user_data.trauma = ewcfg.trauma_id_environment die_resp = user_data.die(cause=ewcfg.cause_drowning) user_data.persist() resp_cont.add_response_container(die_resp) response = "{} jumps over the railing of the ferry and promptly drowns in the slime sea.".format(cmd.message.author.display_name) resp_cont.add_channel_response(channel=ewcfg.channel_slimesea, response=response) resp_cont.add_channel_response(channel=ewcfg.channel_ferry, response=response) await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) # they also can't fly elif transport_data.transport_type == ewcfg.transport_type_blimp and not stop_poi.is_transport_stop and user_data.life_state != ewcfg.life_state_corpse: user_mutations = user_data.get_mutations() if user_data.life_state == ewcfg.life_state_kingpin: response = "Your life flashes before your eyes, as you plummet towards your certain death. A lifetime spent being a piece of shit and playing videogames all day. You close your eyes and... BOING! You open your eyes again to see a crew of workers transporting the trampoline that broke your fall. You get up and dust yourself off, sighing heavily." response = fe_utils.formatMessage(cmd.message.author, response) resp_cont.add_channel_response(channel=stop_poi.channel, response=response) user_data.poi = stop_poi.id_poi user_data.persist() await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) return await resp_cont.post() elif ewcfg.mutation_id_lightasafeather in user_mutations or ewcfg.mutation_id_airlock in user_mutations: response = "With a running jump you launch yourself out of the blimp and begin falling to your soon-to-be demise... but then a strong updraft breaks your fall and you land unscathed. " response = fe_utils.formatMessage(cmd.message.author, response) resp_cont.add_channel_response(channel=stop_poi.channel, response=response) user_data.poi = stop_poi.id_poi user_data.persist() await user_data.move_inhabitants(id_poi=stop_poi.id_poi) await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) return await resp_cont.post() district_data = EwDistrict(id_server=user_data.id_server, district=stop_poi.id_poi) district_data.change_slimes(n=user_data.slimes) district_data.persist() user_data.poi = stop_poi.id_poi user_data.trauma = ewcfg.trauma_id_environment die_resp = user_data.die(cause=ewcfg.cause_falling) user_data.persist() resp_cont.add_response_container(die_resp) response = "SPLAT! A body collides with the asphalt with such force, that it is utterly annihilated, covering bystanders in blood and slime and guts." resp_cont.add_channel_response(channel=stop_poi.channel, response=response) await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) # update user location, if move successful else: # if stop_poi.is_subzone: # stop_poi = poi_static.id_to_poi.get(stop_poi.mother_district) if move_utils.inaccessible(user_data=user_data, poi=stop_poi): return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You're not allowed to go there (bitch).")) user_data.poi = stop_poi.id_poi user_data.persist() await user_data.move_inhabitants(id_poi=stop_poi.id_poi) response = "You enter {}".format(stop_poi.str_name) await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) await fe_utils.send_message(cmd.client, fe_utils.get_channel(cmd.guild, stop_poi.channel), fe_utils.formatMessage(cmd.message.author, response)) # SWILLDERMUK await prank_utils.activate_trap_items(stop_poi.id_poi, user_data.id_server, user_data.id_user) return return await resp_cont.post() else: response = "You are not currently riding any transport." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def abduct(cmd): user_data = EwUser(member=cmd.message.author) item_sought = bknd_item.find_item(item_search='batterypack', id_user=cmd.message.author.id, id_server=cmd.guild.id) protected = False cosmetics = bknd_item.inventory(id_user=user_data.id_user, id_server=cmd.guild.id, item_type_filter=ewcfg.it_cosmetic) for cosmetic in cosmetics: cosmetic_data = EwItem(id_item=cosmetic.get('id_item')) if cosmetic_data.item_props.get('id_cosmetic') == 'skinsuit': if cosmetic_data.item_props.get('adorned') == 'true': protected = True shipstate = EwGamestate(id_server=user_data.id_server, id_state='shipstate') if user_data.poi != 'ufoufo': response = "Abduct what, dumbass? My patience?" elif not protected: response = "The aliens aren't gonna let you start the ship. You're basically their captive now." elif not ewcfg.dh_active or ewcfg.dh_stage != 3: response = "Wait, your alien espionage is waaaay out of season." elif cmd.mentions_count == 0: response = "Abduct who?" elif cmd.mentions_count > 1: response = "One victim at a time, please." elif shipstate.bit == 1: response = 'The ship\'s on the ground right now, it can\'t reach you.' else: if item_sought: target_data = EwUser(member = cmd.mentions[0]) target_poi = poi_static.id_to_poi.get(target_data.poi) target_channel = fe_utils.get_channel(cmd.message.guild, target_poi.channel) if target_poi.id_poi == 'blackpond' or ( not target_poi.is_district and not target_poi.is_outskirts and not target_poi.is_pier and target_poi.id_poi not in [ ewcfg.poi_id_slimesendcliffs, ewcfg.poi_id_ferry, ewcfg.poi_id_sodafountain, ewcfg.poi_id_stockexchange, ewcfg.poi_id_ab_farms, ewcfg.poi_id_og_farms, ewcfg.poi_id_jr_farms]): response = "The tractor beam on this ship sucks. You can't really see indoors." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif target_poi.id_poi in [ewcfg.poi_id_rowdyroughhouse, ewcfg.poi_id_copkilltown]: response = "Don't do that." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) bknd_item.item_delete(id_item=item_sought.get('id_item')) ewutils.moves_active[target_data.id_user] = 0 response = 'You plug in your battery pack and begin to abduct {} They\'re 20 seconds away.'.format(cmd.mentions[0].display_name) await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) await fe_utils.send_message(cmd.client, target_channel, fe_utils.formatMessage(cmd.mentions[0], "You are being abducted by aliens. The ship is 20 seconds away.")) ewutils.active_restrictions[target_data.id_user] = 2 await asyncio.sleep(20) ewutils.active_restrictions[target_data.id_user] = 0 ewutils.moves_active[cmd.message.author.id] = 0 target_data.poi = 'ufoufo' user_data.persist() target_data.persist() await ewrolemgr.updateRoles(client=ewutils.get_client(), member=cmd.mentions[0]) await target_data.move_inhabitants(id_poi='ufoufo') else: response = "The going energy cost for abduction is pretty expensive these days. You better have a battery pack before you do something like that." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def revive(cmd, player_auto=None): time_now = int(time.time()) response = "" if cmd.message.channel.name != ewcfg.channel_endlesswar and cmd.message.channel.name != ewcfg.channel_sewers and player_auto is None: response = "Come to me. I hunger. #{}.".format(ewcfg.channel_sewers) else: if player_auto: player_data = EwUser(id_server=cmd.guild.id, id_user=player_auto) else: player_data = EwUser(member=cmd.message.author) # time_until_revive = (player_data.time_lastdeath + 600) - time_now time_until_revive = (player_data.time_lastdeath) - time_now if time_until_revive > 0 and player_auto is None: response = "ENDLESS WAR is not ready to {} you yet ({}s).".format( cmd.tokens[0], time_until_revive) return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) slimeoid = EwSlimeoid(member=cmd.message.author) if player_data.life_state == ewcfg.life_state_corpse: market_data = EwMarket(id_server=cmd.guild.id) # Endless War collects his fee. # fee = (player_data.slimecoin / 10) # player_data.change_slimecoin(n = -fee, coinsource = ewcfg.coinsource_revival) # market_data.slimes_revivefee += fee # player_data.busted = False # Preserve negaslime if player_data.slimes < 0: # market_data.negaslime += player_data.slimes player_data.change_slimes(n=-player_data.slimes) # set to 0 # reset slimelevel to zero player_data.slimelevel = 0 # Set time of last revive. This used to provied spawn protection, but currently isn't used. player_data.time_lastrevive = time_now if False: #player_data.degradation >= 100: player_data.life_state = ewcfg.life_state_shambler player_data.change_slimes(n=0.5 * ewcfg.slimes_shambler) player_data.trauma = "" poi_death = poi_static.id_to_poi.get(player_data.poi_death) if move_utils.inaccessible(poi=poi_death, user_data=player_data): player_data.poi = ewcfg.poi_id_endlesswar else: player_data.poi = poi_death.id_poi else: # Set life state. This is what determines whether the player is actually alive. player_data.life_state = ewcfg.life_state_juvenile # Give player some initial slimes. player_data.change_slimes(n=ewcfg.slimes_onrevive) # Get the player out of the sewers. player_data.poi = ewcfg.poi_id_endlesswar # Give newly spawned juvies a foul odour player_data.applyStatus(ewcfg.status_repelled_id) player_data.persist() market_data.persist() # Shower every district in the city with slime from the sewers. sewer_data = EwDistrict(district=ewcfg.poi_id_thesewers, id_server=cmd.guild.id) # the amount of slime showered is divided equally amongst the districts districts_amount = len(poi_static.capturable_districts) geyser_amount = int(0.5 * sewer_data.slimes / districts_amount) # Get a list of all the districts for poi in poi_static.capturable_districts: district_data = EwDistrict(district=poi, id_server=cmd.guild.id) district_data.change_slimes(n=geyser_amount) sewer_data.change_slimes(n=-1 * geyser_amount) district_data.persist() sewer_data.persist() sewer_inv = bknd_item.inventory(id_user=sewer_data.name, id_server=sewer_data.id_server) for item in sewer_inv: district = ewcfg.poi_id_slimesea if random.random() < 0.5: district = random.choice(poi_static.capturable_districts) bknd_item.give_item(id_item=item.get("id_item"), id_user=district, id_server=sewer_data.id_server) await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) response = '{slime4} Geysers of fresh slime erupt from every manhole in the city, showering their surrounding districts. {slime4} {name} has been reborn in slime. {slime4}'.format( slime4=ewcfg.emote_slime4, name=cmd.message.author.display_name) else: response = 'You\'re not dead just yet.' # deathreport = "You were {} by {}. {}".format(kill_descriptor, cmd.message.author.display_name, ewcfg.emote_slimeskull) # deathreport = "{} ".format(ewcfg.emote_slimeskull) + fe_utils.formatMessage(member, deathreport) if slimeoid.life_state == ewcfg.slimeoid_state_active: reunite = "" brain = sl_static.brain_map.get(slimeoid.ai) reunite += brain.str_revive.format(slimeoid_name=slimeoid.name) new_poi = poi_static.id_to_poi.get(player_data.poi) revivechannel = fe_utils.get_channel(cmd.guild, new_poi.channel) reunite = fe_utils.formatMessage(cmd.message.author, reunite) await fe_utils.send_message(cmd.client, revivechannel, reunite) # Send the response to the player. await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def setOffAlarms(id_server=None): ewutils.logMsg('Setting off alarms...') if id_server != None: client = ewutils.get_client() server = client.get_guild(id_server) time_current = EwMarket(id_server=id_server).clock if time_current <= 12: displaytime = str(time_current) ampm = 'am' if time_current > 12: displaytime = str(time_current - 12) ampm = 'pm' if time_current == 24: ampm = "am" elif time_current == 12: ampm = "pm" item_search = "alarm clock set to {}{}".format(displaytime, ampm) item_search_brick = "brick{:02d}".format(time_current) clockinv = item_utils.find_item_all( item_search="alarmclock", id_server=id_server, item_type_filter=ewcfg.it_furniture) brickinv = item_utils.find_item_all( item_search=item_search_brick, id_server=id_server, item_type_filter=ewcfg.it_furniture, search_names=True) for clock in clockinv: isFurnished = False clock_obj = EwItem(id_item=clock.get('id_item')) if clock_obj.item_props.get('furniture_name') == item_search: if "decorate" in clock_obj.id_owner: isFurnished = True clock_user = clock_obj.id_owner.replace("decorate", "") clock_member = server.get_member(user_id=clock_user) if clock_member != None: clock_player = EwUser(member=clock_member) if (isFurnished == False or ("apt" in clock_player.poi and clock_player.visiting == "empty")) and clock_member: try: await fe_utils.send_message( client, clock_member, fe_utils.formatMessage( clock_member, "BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP" )) except: ewutils.logMsg( "failed to send alarm to user {}".format( clock_member.id)) for brick in brickinv: brick_obj = EwItem(id_item=brick.get('id_item')) id_user = brick_obj.id_owner.replace("brickshit", "") print(id_user) brick_user = EwUser(id_server=id_server, id_user=id_user) brick_member = server.get_member(user_id=int(id_user)) poi = poi_static.id_to_poi.get(brick_user.poi) channel_brick = fe_utils.get_channel(server, poi.channel) print('pass1') if brick_member != None: print('pass2') if brick_member: print('pass3') try: await fe_utils.send_message( client, channel_brick, fe_utils.formatMessage( brick_member, "UUUUUUUUUUGGGGGGGGGGGGHHHHHHHHHHH... OOOOOOOOOOOOOOOOOAAAAAAAAAAAAAAAHHHHH th-tunk. You just shit a brick. Congratulations?" )) brick_obj.id_owner = poi.id_poi brick_obj.item_props['furniture_name'] = 'brick' brick_obj.persist() except: ewutils.logMsg( "failed to shit brick on user {}".format( brick_member.id))
async def rent_time(id_server=None): try: conn_info = bknd_core.databaseConnect() conn = conn_info.get('conn') cursor = conn.cursor() client = ewutils.get_client() if id_server != None: # get all players with apartments. If a player is evicted, thir rent is 0, so this will not affect any bystanders. cursor.execute( "SELECT apartment.rent, users.id_user FROM users INNER JOIN apartment ON users.id_user=apartment.id_user WHERE users.id_server = %s AND apartment.id_server = %s AND apartment.rent > 0" .format(), ( id_server, id_server, )) landowners = cursor.fetchall() for landowner in landowners: owner_id_user = int(landowner[1]) owner_rent_price = landowner[0] user_data = EwUser(id_user=owner_id_user, id_server=id_server) user_poi = poi_static.id_to_poi.get(user_data.poi) poi = poi_static.id_to_poi.get(user_data.apt_zone) if owner_rent_price > user_data.slimecoin: if (user_poi.is_apartment and user_data.visiting == ewcfg.location_id_empty): user_data.poi = user_data.apt_zone # toss out player user_data.persist() server = ewcfg.server_list[user_data.id_server] member_object = server.get_member(owner_id_user) await ewrolemgr.updateRoles(client=client, member=member_object) player = EwPlayer(id_user=owner_id_user) response = "{} just got evicted. Point and laugh, everyone.".format( player.display_name) await fe_utils.send_message( client, fe_utils.get_channel(server, poi.channel), response) user_data = EwUser(id_user=owner_id_user, id_server=id_server) user_apt = EwApartment(id_user=owner_id_user, id_server=id_server) poi = poi_static.id_to_poi.get(user_data.apt_zone) toss_items(id_user=str(user_data.id_user) + 'closet', id_server=user_data.id_server, poi=poi) toss_items(id_user=str(user_data.id_user) + 'fridge', id_server=user_data.id_server, poi=poi) toss_items(id_user=str(user_data.id_user) + 'decorate', id_server=user_data.id_server, poi=poi) user_data.apt_zone = ewcfg.location_id_empty user_data.persist() user_apt.rent = 0 user_apt.poi = " " user_apt.persist() await toss_squatters(user_id=user_data.id_user, server_id=id_server) else: user_data.change_slimecoin( n=-owner_rent_price, coinsource=ewcfg.coinsource_spending) user_data.persist() finally: cursor.close() bknd_core.databaseClose(conn_info)
async def usekey(cmd, owner_user): owner_apartment = EwApartment(id_user=owner_user.id_user, id_server=cmd.guild.id) user_data = EwUser(member=cmd.message.author) poi = poi_static.id_to_poi.get(user_data.poi) poi_dest = poi_static.id_to_poi.get( ewcfg.poi_id_apt + owner_apartment.poi ) # there isn't an easy way to change this, apologies for being a little hacky inv = bknd_item.inventory(id_user=cmd.message.author.id, id_server=cmd.guild.id) key = None for item_inv in inv: if "key to" in item_inv.get('name'): item_key_check = EwItem(id_item=item_inv.get('id_item')) if item_key_check.item_props.get("houseID") == str( owner_user.id_user): key = item_key_check 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 enter an apartment in a zone's channel.".format( cmd.tokens[0]))) elif key == None: response = "You don't have a key for their apartment." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif owner_apartment.apt_class == ewcfg.property_class_c or ( owner_apartment.apt_class in [ewcfg.property_class_a, ewcfg.property_class_b] and key.id_item == owner_apartment.key_2): return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage( cmd.message.author, "Your key's not working at this new flat. Your roomates must've forgotten to upgrade apartments. Congratulations on the homelessness by the way." .format(cmd.tokens[0]))) elif owner_apartment.poi != poi.id_poi: response = "Your key doesn't match an apartment here." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: move_utils.move_counter += 1 move_current = ewutils.moves_active[ cmd.message.author.id] = move_utils.move_counter await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You start walking toward the apartment.")) await asyncio.sleep(20) if move_current == ewutils.moves_active[cmd.message.author.id]: user_data = EwUser(member=cmd.message.author) user_data.poi = poi_dest.id_poi user_data.visiting = owner_user.id_user user_data.persist() await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) response = "You're in the apartment." try: await fe_utils.send_message(cmd.client, cmd.message.author, response) except: await fe_utils.send_message( cmd.client, fe_utils.get_channel(cmd.guild, poi_dest.channel), fe_utils.formatMessage(cmd.message.author, response))
async def embark(cmd): # can only use movement commands in location channels 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]))) user_data = EwUser(member=cmd.message.author) poi = poi_static.id_to_poi.get(user_data.poi) district_data = EwDistrict(district=poi.id_poi, id_server=cmd.guild.id) if district_data.is_degraded(): response = "{} has been degraded by shamblers. You can't {} here anymore.".format(poi.str_name, cmd.tokens[0]) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) response = "" if ewutils.active_restrictions.get(user_data.id_user) != None and ewutils.active_restrictions.get(user_data.id_user) > 0: response = "You can't do that right now." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if user_data.get_inhabitee(): # prevent ghosts currently inhabiting other players from moving on their own response = "You might want to **{}** of the poor soul you've been tormenting first.".format(ewcfg.cmd_letgo) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) # poi = ewmap.fetch_poi_if_coordless(cmd.message.channel.name) # must be at a transport stop to enter a transport if poi != None and poi.id_poi in poi_static.transport_stops: transport_ids = get_transports_at_stop(id_server=user_data.id_server, stop=poi.id_poi) # can't embark, when there's no vehicles to embark on if len(transport_ids) == 0: response = "There are currently no transport vehicles to embark on here." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) # automatically embark on the only transport at the station, if no arguments were provided elif len(transport_ids) == 1 and cmd.tokens_count < 2: transport_data = EwTransport(id_server=user_data.id_server, poi=transport_ids[0]) target_name = transport_data.current_line # get target name from command arguments else: target_name = ewutils.flattenTokenListToString(cmd.tokens[1:]) # report failure, if the vehicle to be boarded couldn't be ascertained if target_name == None or len(target_name) == 0: return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "Which transport line?")) transport_line = poi_static.id_to_transport_line.get(target_name) # report failure, if an invalid argument was given if transport_line == None: return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "Never heard of it.")) for transport_id in transport_ids: transport_data = EwTransport(id_server=user_data.id_server, poi=transport_id) # check if one of the vehicles at the stop matches up with the line, the user wants to board if transport_data.current_line == transport_line.id_line: ticket = None # TODO remove after double halloween # user_data = EwUser(member = cmd.message.author) # if user_data.poi in [ewcfg.poi_id_dt_subway_station, ewcfg.poi_id_rr_subway_station, ewcfg.poi_id_jr_subway_station]: # if transport_line.id_line in [ewcfg.transport_line_subway_white_eastbound, ewcfg.transport_line_subway_white_westbound]: # ticket = bknd_item.find_item(item_search=ewcfg.item_id_whitelineticket, id_user=cmd.message.author.id, id_server=cmd.message.guild.id) # if ticket is None: # response = "You need a ticket to embark on the White Line." # return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) last_stop_poi = poi_static.id_to_poi.get(transport_line.last_stop) response = "Embarking on {}.".format(transport_line.str_name) # schedule tasks for concurrent execution message_task = asyncio.ensure_future(fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))) wait_task = asyncio.ensure_future(asyncio.sleep(ewcfg.time_embark)) # Take control of the move for this player. move_utils.move_counter += 1 move_current = ewutils.moves_active[cmd.message.author.id] = move_utils.move_counter await message_task await wait_task # check if the user entered another movement command while waiting for the current one to be completed if move_current == ewutils.moves_active[cmd.message.author.id]: user_data = EwUser(member=cmd.message.author) transport_data = EwTransport(id_server=user_data.id_server, poi=transport_id) # check if the transport is still at the same stop if transport_data.current_stop == poi.id_poi: user_data.poi = transport_data.poi user_data.persist() transport_poi = poi_static.id_to_poi.get(transport_data.poi) response = "You enter the {}.".format(transport_data.transport_type) if ticket is not None: bknd_item.item_delete(ticket.get("id_item")) await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) await user_data.move_inhabitants(id_poi=transport_data.poi) return await fe_utils.send_message(cmd.client, fe_utils.get_channel(cmd.guild, transport_poi.channel), fe_utils.formatMessage(cmd.message.author, response)) else: response = "The {} starts moving just as you try to get on.".format(transport_data.transport_type) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) response = "There is currently no vehicle following that line here." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: response = "No transport vehicles stop here. Try going to a subway station or a ferry port." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def defect(cmd): accepted = False member = cmd.message.author modauth = 0 response = "You feel...traitor-ish today. Hey mods, any takers? Let them free, !yes or !no?" await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) try: message = await cmd.client.wait_for( 'message', timeout=30, check=lambda message: 0 < ewrolemgr.checkClearance( member=message.author) <= 4 and message.content.lower( ) in [ewcfg.cmd_yes, ewcfg.cmd_no]) if message != None: if message.content.lower() == ewcfg.cmd_yes: accepted = True modauth = message.author if message.content.lower() == ewcfg.cmd_no: accepted = False except Exception as e: print(e) accepted = False if not accepted: response = "Well if it isn't the boy who cried backstab. Guess you won't be going anywhere." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: member_data = EwUser(member=cmd.message.author) mod_data = EwUser(member=modauth) member_data.unban(faction=mod_data.faction) if member_data.faction == "": response = "{} has been allowed to join the {} again.".format( member.display_name, mod_data.faction) else: faction_old = member_data.faction member_data.faction = "" if member_data.life_state == ewcfg.life_state_enlisted: member_data.life_state = ewcfg.life_state_juvenile member_data.weapon = -1 member_data.sidearm = -1 response = "{} has been released from their association with the {}.".format( member.display_name, faction_old) member_poi = poi_static.id_to_poi.get(member_data.poi) if move_utils.inaccessible(user_data=member_data, poi=member_poi): member_data.poi = ewcfg.poi_id_downtown member_data.persist() await ewrolemgr.updateRoles(client=cmd.client, member=member) leak_channel = fe_utils.get_channel(server=cmd.guild, channel_name='squickyleaks') await fe_utils.send_message( cmd.client, leak_channel, "{}: Let {} defect.".format(modauth.display_name, member.display_name)) await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def handle_hourly_events(id_server=None): if id_server != None: client = ewutils.get_client() server = client.get_guild(id_server) time_current = EwMarket(id_server=id_server).clock events = bknd_event.get_world_events(id_server, True) for we_id, we_type in events.items(): if we_type in ewcfg.hourly_events: we = EwWorldEvent(id_event=we_id) if we.event_props.get("time") == str(time_current): # Handle brickshitting code if we_type == ewcfg.event_type_brickshit: brick_obj = EwItem( id_item=we.event_props.get("brick_id")) id_user = brick_obj.id_owner.replace("stomach", "") brick_user = EwUser(id_server=id_server, id_user=id_user) brick_member = server.get_member(user_id=int(id_user)) poi = poi_static.id_to_poi.get(brick_user.poi) channel_brick = fe_utils.get_channel( server, poi.channel) if brick_member: try: await fe_utils.send_message( client, channel_brick, fe_utils.formatMessage( brick_member, "UUUUUUUUUUGGGGGGGGGGGGHHHHHHHHHHH... OOOOOOOOOOOOOOOOOAAAAAAAAAAAAAAAHHHHH th-tunk. You just shit a brick. Congratulations?" )) brick_obj.id_owner = poi.id_poi brick_obj.item_props[ 'furniture_name'] = 'brick' brick_obj.persist() except: ewutils.logMsg( "failed to shit brick on user {}".format( brick_member.id)) else: bknd_event.delete_world_event(we_id) # Handle alarm clock code elif we_type == ewcfg.event_type_alarmclock: clock_obj = EwItem( id_item=we.event_props.get("clock_id")) if "decorate" in clock_obj.id_owner: isFurnished = True clock_user = clock_obj.id_owner.replace("decorate", "") clock_member = server.get_member(user_id=clock_user) if clock_member != None: clock_player = EwUser(member=clock_member) if (isFurnished == False or ("apt" in clock_player.poi and clock_player.visiting == "empty")) and clock_member: try: await fe_utils.send_message( client, clock_member, fe_utils.formatMessage( clock_member, "BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP BLAAAP" )) except: ewutils.logMsg( "failed to send alarm to user {}". format(clock_member.id))
async def writhe(cmd): resp = await cmd_utils.start(cmd=cmd) response = "" user_data = EwUser(member=cmd.message.author) if user_data.life_state != ewcfg.life_state_grandfoe: response = "Only the NEGASLIME {} can do that.".format( ewcfg.emote_negaslime) await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: # play animation he = ewcfg.emote_he s_ = ewcfg.emote_s_ ve = ewcfg.emote_ve vt = ewcfg.emote_vt v_ = ewcfg.emote_v_ h_ = ewcfg.emote_h_ va = ewcfg.emote_va ht = ewcfg.emote_ht hs = ewcfg.emote_hs blank = ewcfg.emote_blank writhing1 = he writhing2 = s_ + he + "\n" + ve writhing3 = s_ + h_ + he + "\n" + vt + he writhing4 = s_ + h_ + ht + "\n" + vt + he + ve writhing5 = s_ + h_ + ht + "\n" + va + he + vt + he + "\n" + ve writhing6 = s_ + h_ + ht + "\n" + va + ht + va + ht + "\n" + v_ + ve + ve + ve + "\n" + ve writhing7 = s_ + h_ + ht + "\n" + va + ht + va + hs + he + "\n" + v_ + ve + v_ + vt + he + "\n" + ve + blank + ve writhing8 = s_ + h_ + ht + "\n" + va + ht + va + hs + he + "\n" + v_ + ve + v_ + vt + h_ + he + "\n" + vt + he + vt + he writhing9 = s_ + h_ + ht + "\n" + va + ht + va + hs + h_ + he + "\n" + v_ + ve + v_ + vt + h_ + ht + "\n" + vt + ht + vt + ht + blank + ve + "\n" + blank + ve + blank + ve writhing10 = s_ + h_ + ht + "\n" + va + ht + va + hs + h_ + he + "\n" + v_ + ve + v_ + vt + h_ + ht + "\n" + vt + ht + vt + ht + blank + vt + he + "\n" + blank + ve + blank + vt + he writhings = [ writhing1, writhing2, writhing3, writhing4, writhing5, writhing6, writhing7, writhing8, writhing9, writhing10 ] for writhing in writhings: cur_time = time.time() await fe_utils.edit_message(cmd.client, resp, writhing) elapsed = time.time() - cur_time await asyncio.sleep(2.0 - elapsed) id_server = cmd.guild.id targets = [] # search for players in the negaslime's location in database and put them in a list if id_server != None: try: conn_info = bknd_core.databaseConnect() conn = conn_info.get('conn') cursor = conn.cursor() cursor.execute( "SELECT id_user FROM users WHERE id_server = %s AND poi = '{}' AND life_state IN (1, 2);" .format(user_data.poi), (id_server, )) # convert pulled IDs into member objects target_ids = cursor.fetchall() for target_id in target_ids: target = cmd.guild.get_member(target_id[0]) targets.append(target) conn.commit() finally: # Clean up the database handles. cursor.close() bknd_core.databaseClose(conn_info) victim_list = [] # kill everyone in the negaslime's poi and remember their names for target in targets: if target != None: user_data_target = EwUser(member=target) user_data_target.id_killer = cmd.message.author.id user_data_target.die(cause=ewcfg.cause_grandfoe) user_data_target.persist() await ewrolemgr.updateRoles(client=cmd.client, member=target) sewerchannel = fe_utils.get_channel(cmd.guild, ewcfg.channel_sewers) await fe_utils.send_message( cmd.client, sewerchannel, "{} ".format(ewcfg.emote_slimeskull) + fe_utils.formatMessage( target, "You have been crushed by tendrils. {}".format( ewcfg.emote_slimeskull))) victim_list.append(target) # display result of the writhing if len(victim_list) > 0: victims_string = ewutils.userListToNameString(victim_list) response = "Your tendrils have successfully killed {}.".format( victims_string) else: response = "Your tendrils didn't kill anyone :(" 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))