async def crystalize_negapoudrin(cmd): user_data = EwUser(member=cmd.message.author) response = "" if user_data.life_state != ewcfg.life_state_corpse: response = "What the f**k do you think you're doing, you corporeal bitch?" elif user_data.slimes >= ewcfg.slimes_to_crystalize_negapoudrin: response = "Crystalizing a negapoudrin requires a lot of negaslime, and you're not quite there yet." else: negapoudrin_data = next(i for i in static_items.item_list if i.id_item == ewcfg.item_id_negapoudrin) bknd_item.item_create(item_type=ewcfg.it_item, id_user=user_data.id_user, id_server=cmd.guild.id, item_props={ 'id_item': negapoudrin_data.id_item, 'item_name': negapoudrin_data.str_name, 'item_desc': negapoudrin_data.str_desc, }) user_data.change_slimes(n=-ewcfg.slimes_to_crystalize_negapoudrin, source=ewcfg.source_spending) user_data.persist() response = "The cathedral's bells toll in the distance, and a rumbling {} can be heard echoing from deep within the sewers. A negapoudrin has formed.".format( ewcfg.cmd_boo) return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def renounce(cmd): user_data = EwUser(member=cmd.message.author) if user_data.life_state == ewcfg.life_state_shambler: 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)) if user_data.life_state == ewcfg.life_state_corpse: response = "You're dead, bitch." 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_enlisted: response = "What exactly are you renouncing? Your lackadaisical, idyllic life free of vice and violence? You aren't actually currently enlisted in any gang, retard." elif user_data.poi not in [ewcfg.poi_id_rowdyroughhouse, ewcfg.poi_id_copkilltown, ewcfg.poi_id_thebreakroom]: response = "To turn in your badge, you must return to your soon-to-be former gang base." else: renounce_fee = int(user_data.slimes) / 2 user_data.change_slimes(n=-renounce_fee) faction = user_data.faction user_data.life_state = ewcfg.life_state_juvenile user_data.weapon = -1 user_data.sidearm = -1 user_data.persist() response = "You are no longer enlisted in the {}, but you are not free of association with them. Your former teammates immediately begin to beat the shit out of you, knocking {} slime out of you before you're able to get away.".format(faction, renounce_fee) await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
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 hailcab(cmd): user_data = EwUser(member = cmd.message.author) blockstate = EwGamestate(id_server=cmd.guild.id, id_state='blockparty') poi = ''.join([i for i in blockstate.value if not i.isdigit()]) if poi == 'outsidethe': poi = ewcfg.poi_id_711 if poi != user_data.poi: response = "You can't hail a cab right now. All the cabbies are hiding for cover thanks to all the violence. Good job on that, by the way." else: if user_data.life_state in [ewcfg.life_state_enlisted, ewcfg.life_state_juvenile]: if user_data.faction == ewcfg.faction_rowdys and user_data.life_state == ewcfg.life_state_enlisted: dest = ewcfg.poi_id_rowdyroughhouse elif user_data.faction == ewcfg.faction_killers and user_data.life_state == ewcfg.life_state_enlisted: dest = ewcfg.poi_id_copkilltown else: dest = ewcfg.poi_id_juviesrow await asyncio.sleep(5) response = "**TAXI!** You shout into the crowd for a ride home. The drivers don't notice you're a miscreant, and pick you up without a second thought. They got nervous when you asked to return to your gang base, and forgot to ask for any fare. Nice!" await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) ewutils.moves_active[cmd.message.author.id] = 0 user_data.poi = dest user_data.persist() await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) return await user_data.move_inhabitants(id_poi=dest, visitor=user_data.id_user) elif user_data.life_state == ewcfg.life_state_corpse: response = "You're already dead. The cabbies unfortunately tend to avoid black people, so you should probably just float back to the sewers." else: response = "The cabbie looks confused. Why would a person like you need a cab?" return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, 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 set_race(cmd): response = "" user_data = EwUser(member=cmd.message.author) time_now = int(time.time()) forbidden_races = [ 'retard', 'anime', 'animegirl', 'white', 'black', 'aryan', 'epic', # this one is for you, meaty 'based', 'cringe', 'f*****g idiot', ] if time_now > user_data.time_racialability or ewutils.DEBUG_OPTIONS[ 'no_race_cooldown'] == True: #pass cooldown check when debug racecooldown is on if len(cmd.tokens) > 1: desired_race = cmd.tokens[1] if desired_race in forbidden_races: desired_race = ewcfg.race_forbidden selected_race = ewcfg.defined_races.get(desired_race) #if race found in dictionary, set race if selected_race == ewcfg.race_clown and user_data.faction != ewcfg.faction_rowdys: response = "Only hot-blooded, reckless ROWDYS can become CLOWNS. !ENLIST ROWDYS MF'ERRRRRRRRRRRRRRRR !THRASH !THRASH !THRASH" elif selected_race != None: response = selected_race.get("acknowledgement_str").format( cmd=selected_race.get("racial_cmd")) # only set the cooldown if the user is switching race, rather than setting it up for the first time if user_data.race: user_data.time_racialability = time_now + ewcfg.cd_change_race user_data.race = desired_race user_data.persist() else: race_list = list(ewcfg.defined_races.keys()) race_list.remove("forbidden") response = '"{unknown_race}" is not an officially recognized race in NLACakaNM. Try one of the following instead: {race_list}.'.format( unknown_race=desired_race, race_list=", ".join( ["**{}**".format(race) for race in race_list])) else: race_list = list(ewcfg.defined_races.keys()) race_list.remove("forbidden") response = "Please select a race from the following: {race_list}.".format( race_list=", ".join( ["**{}**".format(race) for race in race_list])) else: response = "You have changed your race recently. Try again later, race traitor." return await fe_utils.send_response(response, cmd)
async def dedorn(cmd): user_data = EwUser(member=cmd.message.author) # ewutils.moves_active[cmd.message.author.id] = 0 # Check to see if you even have the item you want to repair item_id = ewutils.flattenTokenListToString(cmd.tokens[1:]) try: item_id_int = int(item_id) except: item_id_int = None if item_id is not None and len(item_id) > 0: response = "You don't have one." cosmetic_items = bknd_item.inventory( id_user=cmd.message.author.id, id_server=cmd.guild.id, item_type_filter=ewcfg.it_cosmetic ) item_sought = None already_adorned = False # Check all cosmetics found for item in cosmetic_items: i = EwItem(item.get('id_item')) # Search for desired cosmetic if item.get('id_item') == item_id_int or item_id in ewutils.flattenTokenListToString(item.get('name')): if i.item_props.get("adorned") == 'true': already_adorned = True item_sought = i break # If the cosmetic you want to adorn is found if item_sought != None: # Unadorn the cosmetic if already_adorned: item_sought.item_props['adorned'] = 'false' unadorn_response = str(item_sought.item_props['str_unadorn']) response = unadorn_response.format(item_sought.item_props['cosmetic_name']) item_sought.persist() user_data.persist() # That garment has not be adorned.. else: response = "You haven't adorned that garment in the first place! How can you dedorn something you haven't adorned? You disgust me." await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, 'Adorn which cosmetic? Check your **!inventory**.'))
async def name_slimeoid(cmd): user_data = EwUser(member=cmd.message.author) slimeoid_data = EwSlimeoid(member=cmd.message.author) command_used = "" # Check if player is in the labs and has a slimeoid incubating response = basic_slimeoid_incubation_checks( channel_name=cmd.message.channel.name, user_data=user_data, slimeoid_data=slimeoid_data) # If response returns None go to final response # Lifestate check for flavor text if slimeoid_data.sltype == ewcfg.sltype_nega: slimeoidtype = "Negaslimeoid" else: slimeoidtype = "Slimeoid" if response is None: # Slimeoid is incubating # Check if player has specified a name if cmd.tokens_count < 2: response = "You must specify a name." # Go to final response else: # Turn entire message minus "!nameslimeoid" in to name variable command_used = ewutils.flattenTokenListToString(cmd.tokens[0]) name = cmd.message.content[(len(command_used) + len(ewcfg.cmd_prefix)):].strip() # Limit name length to 32 characters if len(name) > 32: response = "That name is too long. ({:,}/32)".format(len(name)) # Go to final response else: # Save slimeoid name slimeoid_data.name = str(name) user_data.persist() slimeoid_data.persist() if slimeoidtype == "Slimeoid": response = "You enter the name {} into the console.".format( str(name)) else: response = "You move the planchette between letters, spelling out the name {}.".format( str(name)) # Go to final response # Final response await send_response(response, cmd)
async def store(cmd): user_data = EwUser(member=cmd.message.author) response = "" poi = poi_static.id_to_poi.get(user_data.poi) if poi.community_chest == None: response = "There is no community chest here." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: if len(poi.factions) > 0 and user_data.faction not in poi.factions: response = "Get real, asshole. You haven't even enlisted into this gang yet, so it's not like they'd trust you with a key to their valubles." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) 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 = EwItem(id_item=item_sought.get("id_item")) if not item.soulbound: if item.item_type == ewcfg.it_weapon: if user_data.weapon >= 0 and item.id_item == user_data.weapon: if user_data.weaponmarried: weapon = static_weapons.weapon_map.get(item.item_props.get("weapon_type")) response = "Your cuckoldry is appreciated, but your {} will always remain faithful to you.".format(item_sought.get('name')) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: user_data.weapon = -1 user_data.persist() elif item.id_item == user_data.sidearm: user_data.sidearm = -1 user_data.persist() if item.item_type == ewcfg.it_cosmetic: if "adorned" in item.item_props: item.item_props["adorned"] = "false" if "slimeoid" in item.item_props: item.item_props["slimeoid"] = "false" item.persist() bknd_item.give_item(id_item=item.id_item, id_server=item.id_server, id_user=poi.community_chest) response = "You store your {} in the community chest.".format(item_sought.get("name")) else: response = "You can't {} soulbound items.".format(cmd.tokens[0]) else: if item_search: response = "You don't have one" else: response = "{} which item? (check **!inventory**)".format(cmd.tokens[0]) await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
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 identify(cmd): user_data = EwUser(member=cmd.message.author) gender = cmd.message.content[(len(ewcfg.cmd_identify)):].strip() if gender == "": response = "Cool. Noted. Enjoy your lack of gender, slime." user_data.gender = "" user_data.persist() elif gender in ewcfg.curse_words: response = "Hey, no matter what, you're still a juvenile. **NO SWEARS**." elif "\n" in gender: response = "No f*****g line breaks! WTF!" elif len(gender) > 16: response = "F*****g god, your gender **CANNOT** be longer than that. Sorry, them's the rules." elif gender == "boy": response = "Radical! Enjoy your gender, slimeboi." user_data.gender = "boi" user_data.persist() elif gender == "girl": response = "Radical! Enjoy your gender, slimegorl." user_data.gender = "gorl" user_data.persist() elif gender == "ancient obelisk": response = "You can't have that gender. It's mine." else: response = "Radical! Enjoy your gender, slime{}.".format(gender) user_data.gender = gender user_data.persist() return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def change_spray(cmd): user_data = EwUser(member=cmd.message.author) newspray = cmd.message.content[(len(ewcfg.cmd_changespray)):].strip() if newspray == "": response = "You need to add an image link to change your spray." elif len(newspray) > 400: response = "F*****g christ, are you painting the Sistine Chapel? Use a shorter link." else: response = "Got it. Spray set." user_data.spray = newspray user_data.persist() return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def graft(cmd): user_data = EwUser(member=cmd.message.author) if cmd.message.channel.name != ewcfg.channel_clinicofslimoplasty: response = "Chemotherapy doesn't just grow on trees. You'll need to go to the clinic in Crookline to get some." 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_corpse: response = '"You get out of here, dirty nega. We don\'t serve your kind." \n\n Auntie Dusttrap threatingly flails a jar of cole slaw at you. Looks like you need a body to mutate a body.' return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif len(cmd.tokens) <= 1: response = '"What, just anything? I love a good improv surgery! I had to leave town the last one I did though, so you\'ll have to pick an actual surgical procedure. Sorry, sonny."' return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) target_name = ewutils.flattenTokenListToString(cmd.tokens[1:]) target = ewutils.get_mutation_alias(target_name) mutations = user_data.get_mutations() incompatible = False if target == 0: response = '"What? My ears aren\'t what they used to be. I thought you suggested I give you {}. Only braindead squicks would say that."'.format(' '.join(cmd.tokens[1:])) incompatible = True elif target in mutations: response = '"Nope, you already have that mutation. Hey, I thought I was supposed to be the senile one here!"' incompatible = True elif user_data.get_mutation_level() + static_mutations.mutations_map[target].tier > min([user_data.slimelevel, 50]): response = '"Your body\'s already full of mutations. Your sentient tumors will probably start bitin\' once I take out my scalpel."\n\nLevel:{}/50\nMutation Levels Added:{}/{}'.format(user_data.slimelevel, user_data.get_mutation_level(), min(user_data.slimelevel, 50)) incompatible = True elif static_mutations.mutations_map.get(target).tier * 10000 > user_data.slimes: response = '"We\'re not selling gumballs here. It\'s cosmetic surgery. It\'ll cost at least {} slime, ya idjit!"'.format(static_mutations.mutations_map.get(target).tier * 10000) incompatible = True for mutation in mutations: mutation = static_mutations.mutations_map[mutation] if target in mutation.incompatible: response = mutation.incompatible[target] incompatible = True break if incompatible: return await fe_utils.send_response(response, cmd) else: price = static_mutations.mutations_map.get(target).tier * 10000 user_data.change_slimes(n=-price, source=ewcfg.source_spending) user_data.persist() user_data.add_mutation(id_mutation=target, is_artificial=1) response = static_mutations.mutations_map[target].str_transplant + "\n\nMutation Levels Added:{}/{}".format(user_data.get_mutation_level(), min(user_data.slimelevel, 50)) await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def beam_me_up(cmd): user_data = EwUser(member=cmd.message.author) 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')) print(cosmetic_data.item_props) if cosmetic_data.item_props.get('id_cosmetic') == 'skinsuit': if cosmetic_data.item_props.get('adorned') == 'true': protected = True poi_sought = poi_static.id_to_poi.get(user_data.poi) shipstate = EwGamestate(id_server=user_data.id_server, id_state='shipstate') if not protected: response = "Why would aliens abduct you? What makes you so special?" elif poi_sought.id_poi == 'ufoufo': response = 'You\'re already in here.' elif poi_sought.id_poi != ewcfg.poi_id_west_outskirts: response = "Hey, get a bit closer. The ship's in the West Outskirts. Beam up power doesn't grow on trees, you know." elif shipstate.bit == 1: response = 'The ship\'s on the ground right now, it can\'t beam shit.' else: await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage( cmd.message.author, "You are being abducted by aliens. The ship is 20 seconds away." )) ewutils.active_restrictions[user_data.id_user] = 2 await asyncio.sleep(20) ewutils.active_restrictions[user_data.id_user] = 0 ewutils.moves_active[cmd.message.author.id] = 0 user_data.poi = 'ufoufo' user_data.persist() await ewrolemgr.updateRoles(client=ewutils.get_client(), member=cmd.message.author) await user_data.move_inhabitants(id_poi='ufoufo') return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def toss_squatters(user_id=None, server_id=None, keepKeys=False): player_info = EwPlayer(id_user=user_id) apt_info = EwApartment(id_user=user_id, id_server=server_id) client = ewutils.get_client() server = client.get_guild(server_id) member_data = server.get_member(player_info.id_user) if player_info.id_server != None and member_data != None: try: conn_info = bknd_core.databaseConnect() conn = conn_info.get('conn') cursor = conn.cursor() client = ewutils.get_client() # get all players visiting an evicted apartment and kick them out cursor.execute( "SELECT {} FROM users WHERE {} = %s AND {} = %s".format( ewcfg.col_id_user, ewcfg.col_visiting, ewcfg.col_id_server, ), ( member_data.id, server_id, )) squatters = cursor.fetchall() key_1 = EwItem(id_item=apt_info.key_1).id_owner key_2 = EwItem(id_item=apt_info.key_2).id_owner for squatter in squatters: sqt_data = EwUser(id_user=squatter[0], id_server=player_info.id_server) if keepKeys and (sqt_data.id_user == key_1 or sqt_data.id_user == key_2): pass else: server = ewcfg.server_list[sqt_data.id_server] member_object = server.get_member(squatter[0]) sqt_data.poi = sqt_data.poi[3:] if sqt_data.poi[ 3:] in poi_static.id_to_poi.keys() else sqt_data.poi sqt_data.visiting = ewcfg.location_id_empty sqt_data.persist() await ewrolemgr.updateRoles(client=client, member=member_object) finally: # Clean up the database handles. cursor.close() bknd_core.databaseClose(conn_info)
async def eat_item(cmd): user_data = EwUser(member=cmd.message.author) mutations = user_data.get_mutations() item_search = ewutils.flattenTokenListToString(cmd.tokens[1:]) food_item = None # look for a food item if a name was given if item_search: item_sought = bknd_item.find_item(item_search=item_search, id_user=user_data.id_user, id_server=user_data.id_server, item_type_filter=ewcfg.it_food) if item_sought: food_item = EwItem(id_item=item_sought.get('id_item')) else: item_sought = bknd_item.find_item(item_search=item_search, id_user=user_data.id_user, id_server=user_data.id_server) if item_sought and ewcfg.mutation_id_trashmouth in mutations: return await devour(cmd=cmd) # otherwise find the first useable food else: food_inv = bknd_item.inventory(id_user=user_data.id_user, id_server=user_data.id_server, item_type_filter=ewcfg.it_food) for food in food_inv: food_item = EwItem(id_item=food.get('id_item')) # check if the user can eat this item if float(getattr(food_item, "time_expir", 0)) > time.time() or \ food_item.item_props.get('perishable') not in ['true', '1'] or \ ewcfg.mutation_id_spoiledappetite in user_data.get_mutations(): break if food_item != None: response = user_data.eat(food_item) user_data.persist() else: if item_search: response = "Are you sure you have that item?" else: response = "You don't have anything to eat." await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def clowncar(cmd): #shoves everyone not there into JR or the sewers if not cmd.message.author.guild_permissions.administrator: return id_server = cmd.guild.id server = ewcfg.server_list[cmd.guild.id] gellphones = itm_utils.find_item_all(item_search=ewcfg.item_id_gellphone, id_server=id_server, item_type_filter=ewcfg.it_item) for phone in gellphones: phone_data = EwItem(id_item=phone.get('id_item')) phone_data.item_props['gellphoneactive'] = 'false' phone_data.persist() if phone_data.id_owner.isnumeric() and int(phone_data.id_owner) > 0: print(phone_data.id_owner) member_object = server.get_member(int(phone_data.id_owner)) if member_object is None: continue user_data = EwUser(member=member_object) print('{}{}'.format('clowning:', user_data.id_user)) user_data.poi = 'juviesrow' user_data.persist() await ewrolemgr.updateRoles(client=cmd.client, member=member_object) if id_server != None: try: selection = bknd_core.execute_sql_query( "SELECT {id_user} FROM users WHERE id_server = %s AND {poi} NOT IN('juviesrow', 'thesewers', 'rowdyroughhouse', 'copkilltown')" .format(id_user=ewcfg.col_id_user, poi=ewcfg.col_poi), ([str(id_server)])) bknd_core.execute_sql_query( "UPDATE users SET {poi} = %s WHERE id_server = %s AND {poi} NOT IN('juviesrow', 'thesewers', 'rowdyroughhouse', 'copkilltown')" .format(poi=ewcfg.col_poi), ('juviesrow', [str(id_server)])) iterator = 0 for member in selection: iterator += 1 if iterator % 20 == 0: await asyncio.sleep(5) member_object = server.get_member(member[0]) await ewrolemgr.updateRoles(client=cmd.client, member=member_object) except: ewutils.logMsg('server {}: failed to clowncar.'.format( cmd.message.guild.id, cmd.message.author.id))
async def rattle(cmd): user_data = EwUser(member=cmd.message.author) if user_data.race == ewcfg.race_skeleton: time_now = int(time.time()) # generate bone item when off cooldown if (time_now > user_data.time_racialability or ewutils.DEBUG_OPTIONS['no_race_cooldown'] == True ) and random.randrange( 10) == 0: #pass cooldown check when debug racecooldown is on bone_item = next(i for i in static_items.item_list if i.context == "player_bone") bknd_item.item_create(item_type=ewcfg.it_item, id_user=user_data.poi, id_server=cmd.guild.id, item_props={ 'id_item': bone_item.id_item, 'context': bone_item.context, 'item_name': bone_item.str_name, 'item_desc': bone_item.str_desc, }) user_data.time_racialability = time_now + ewcfg.cd_drop_bone user_data.persist() # spook mentioned player if cmd.mentions_count == 1: responses = [ ", sending a shiver down their spine.", ", who clearly does not appreciate it.", ". They almost faint in shock.", ", scaring them so bad they pee themselves a little.", ". **NYEEEH!**", ", trying to appeal to the bones deep within them.", " a little bit too hard. Oof ouch owie.", " so viciously they actually get offended.", " in an attempt to socialize, but they don't think you should.", ] response = "You rattle your bones at {}{}".format( cmd.mentions[0].display_name, random.choice(responses)) # rattle alone else: response = "You rattle your bones." else: response = "You people are not allowed to do that." return await fe_utils.send_response(response, cmd)
async def autocannibalize(cmd): user_data = EwUser(member=cmd.message.author) response = "" if user_data.race == ewcfg.race_food: time_now = int(time.time()) if time_now > user_data.time_racialability or ewutils.DEBUG_OPTIONS['no_race_cooldown'] == True: #pass cooldown check when debug racecooldown is on response = "You give in to the the existential desire all foods have, and take a small bite out of yourself. It hurts like a bitch, but God **DAMN** you're tasty." user_data.time_racialability = time_now + ewcfg.cd_autocannibalize user_data.hunger = max(user_data.hunger - (user_data.get_hunger_max() * 0.01), 0) user_data.change_slimes(n=-user_data.slimes * 0.001) user_data.persist() else: response = "Slow down! You don't want to eat yourself into oblivion." else: response = "You people are not allowed to do that." return await fe_utils.send_response(response, cmd)
async def pardon(cmd): user_data = EwUser(member=cmd.message.author) if user_data.life_state != ewcfg.life_state_kingpin and user_data.life_state != ewcfg.life_state_executive and not cmd.message.author.guild_permissions.administrator: response = "Only the Rowdy F****r {} and the Cop Killer {} can do that.".format( ewcfg.emote_rowdyfucker, ewcfg.emote_copkiller, ewcfg.emote_slimecorp) else: member = None if cmd.mentions_count == 1: member = cmd.mentions[0] if member.id == cmd.message.author.id: member = None if member == None: response = "Who?" else: member_data = EwUser(member=member) member_data.unban(faction=user_data.faction) if member_data.faction == "": response = "{} has been allowed to join the {} again.".format( member.display_name, user_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) await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def begin_manuscript(cmd): user_data = EwUser(member=cmd.message.author) title = cmd.message.content[(len(cmd.tokens[0])):].strip() if user_data.life_state == ewcfg.life_state_shambler: 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)) cost = 20000 poi = poi_static.id_to_poi.get(user_data.poi) if not poi.write_manuscript or poi.id_poi == ewcfg.poi_id_clinicofslimoplasty: response = "You'd love to work on your zine, however your current location doesn't strike you as a particularly good place to write. Try heading over the the Cafe, the Comic Shop, or one of the colleges (NLACU/NMS)." elif user_data.slimes < cost: response = "You don't have enough slime to create a manuscript. ({:,}/{:,})".format(user_data.slimes, cost) elif user_data.hunger >= user_data.get_hunger_max() and user_data.life_state != ewcfg.life_state_corpse: response = "You are just too hungry to begin your masterpiece!" elif title == "": response = "Specify a title." elif len(title) > 50: response = "Alright buddy, reel it in. That title is just too long. ({:,}/50)".format(len(title)) else: if user_data.manuscript != -1: response = "You already have a manuscript deployed you eager beaver!" else: book = EwBook(member=cmd.message.author, book_state=0) book.author = cmd.message.author.display_name book.title = title user_data.manuscript = book.id_book user_data.change_slimes(n=-cost, source=ewcfg.source_spending) book.persist() user_data.persist() response = "You exchange 20,000 slime for a shoddily-bound manuscript. You scrawl the name \"{} by {}\" into the cover.".format(book.title, book.author) await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def verification(cmd): user_data = EwUser(member=cmd.message.author) if user_data.poi == ewcfg.poi_id_slimecorphq: if user_data.verified: response = "*Huh? You're already verified! Get outta here you goofster!*" return await fe_utils.send_response(response, cmd) time_now = int(time.time()) time_in_server = time_now - user_data.time_joined if time_in_server >= 60 * 60 * 24 * 180: # 6 months lifetime_slime = ewstats.get_stat( user=user_data, metric=ewcfg.stat_lifetime_slimes) # you can use haunted slimes too cause we're nicer to ghosts than we should be lifetime_haunted = ewstats.get_stat( user=user_data, metric=ewcfg.stat_lifetime_slimeshaunted) if lifetime_slime > 1000000000 or lifetime_haunted > 100000000: user_data.verified = True user_data.persist() response = "*Alright, everything checks out. Congratulations, you're #verified now.*" # TODO emote else: response = "*Yeah, sorry, looks but it like you don't love slime enough. Try getting some more slime, then come back. Freak.*" if user_data.life_state != ewcfg.life_state_corpse: response += " ({current:,}/{needed:,} lifetime slime)".format( current=lifetime_slime, needed=1000000000) else: response += " ({current:,}/{needed:,} lifetime slime haunted)".format( current=lifetime_haunted, needed=100000000) else: response = "*We can't just verify any random schmuck who wanders into our city, it'd be a bad look. Stick around for a while, then we'll consider verifying you.*" else: if user_data.poi == ewcfg.poi_id_stockexchange: response = "*Hey buddy, I think you got the wrong door, the HQ's two blocks down.*" else: response = "Only the Slimecorp employees at the HQ can get you verified on Slime Twitter." return await fe_utils.send_response(response, cmd)
async def begin_tutorial(member): user_data = EwUser(member=member) dungeonutils.user_to_tutorial_state[user_data.id_user] = 0 scene = poi_static.dungeon_tutorial[0] if scene.poi != None: user_data.poi = scene.poi if scene.life_state != None: user_data.life_state = scene.life_state user_data.persist() await ewrolemgr.updateRoles(client=ewutils.get_client(), member=member) response = format_tutorial_response(scene) poi_def = poi_static.id_to_poi.get(user_data.poi) channels = [poi_def.channel] return await fe_utils.post_in_channels( member.guild.id, fe_utils.formatMessage(member, response), channels)
async def bleedout(cmd): user_data = EwUser(member=cmd.message.author) mutations = user_data.get_mutations() if ewcfg.mutation_id_bleedingheart not in mutations: response = "You don't have an open enough wound to just gush your blood everywhere." elif user_data.bleed_storage == 0: response = "There's nothing to bleed. Sounds like someone has a persecution complex..." elif user_data.bleed_storage > user_data.slimes: # don't think this is possible, but just in case response = "Wait, wouldn't that kill you? Better not." else: response = "You clutch your malformed heart and squeeze as hard as you can. The intense pain makes you fall to your knees, and your slime drops in spurts to the floor under you as you gasp desperately for relief. You have been bled dry." poi = poi_static.id_to_poi.get(user_data.poi) district_data = EwDistrict(id_server=cmd.message.guild.id, district=poi.id_poi) user_data.change_slimes(n=-user_data.bleed_storage, source=ewcfg.source_bleeding) district_data.change_slimes(n=user_data.bleed_storage, source=ewcfg.source_bleeding) user_data.bleed_storage = 0 user_data.persist() district_data.persist() return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def longdrop(cmd): user_data = EwUser(member=cmd.message.author) mutations = user_data.get_mutations() poi = poi_static.id_to_poi.get(user_data.poi) destination = ewutils.flattenTokenListToString(cmd.tokens[1]) dest_poi = poi_static.id_to_poi.get(destination) item_search = ewutils.flattenTokenListToString(cmd.tokens[2:]) item_sought = bknd_item.find_item(item_search=item_search, id_user=cmd.message.author.id, id_server=user_data.id_server) if ewcfg.mutation_id_longarms not in mutations: response = "As if anything on you was long enough to do that." elif cmd.tokens_count == 1: response = "You'll need for information that that. Try !longdrop <location> <item>." elif not item_sought: response = "You don't have that item." elif dest_poi == None: response = "Never heard of it." elif poi_utils.inaccessible(user_data=user_data, poi=dest_poi) or dest_poi.is_street: response = "Your arm hits a wall before it can make the drop off. Shit, probably can't take it over there." elif user_data.poi not in dest_poi.neighbors.keys() and dest_poi.id_poi not in poi.mother_districts: response = "You can't take it that far. What if a bird or car runs into your hand?" else: item_obj = EwItem(item_sought.get('id_item')) if item_obj.soulbound == True and item_obj.item_props.get('context') != 'housekey': response = "You still can't drop a soulbound item. Having really long arms doesn't grant you that ability." elif item_obj.item_type == ewcfg.it_weapon and user_data.weapon >= 0 and item_obj.id_item == user_data.weapon: if user_data.weaponmarried: weapon = static_weapons.weapon_map.get(item_obj.item_props.get("weapon_type")) response = "As much as it would be satisfying to just chuck your {} down an alley and be done with it, here in civilization we deal with things *maturely.* You’ll have to speak to the guy that got you into this mess in the first place, or at least the guy that allowed you to make the retarded decision in the first place. Luckily for you, they’re the same person, and he’s at the Dojo.".format( weapon.str_weapon) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: user_data.weapon = -1 user_data.persist() itm_utils.item_drop(id_item=item_sought.get('id_item'), other_poi=dest_poi.id_poi) response = "You stretch your arms and drop your " + item_sought.get("name") + ' into {}.'.format(dest_poi.str_name) await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def name_slimeoid(cmd): user_data = EwUser(member=cmd.message.author) slimeoid_data = EwSlimeoid(member=cmd.message.author) # Check if player is in the labs and has a slimeoid incubating response = basic_slimeoid_incubation_checks( channel_name=cmd.message.channel.name, user_data=user_data, slimeoid_data=slimeoid_data) # If response returns None go to final response if response is None: # Slimeoid is incubating # Check if player has specified a name if cmd.tokens_count < 2: response = "You must specify a name." # Go to final response else: # Turn entire message minus "!nameslimeoid" in to name variable name = cmd.message.content[(len(ewcfg.cmd_nameslimeoid)):].strip() # Limit name length to 32 characters if len(name) > 32: response = "That name is too long. ({:,}/32)".format(len(name)) # Go to final response else: # Save slimeoid name slimeoid_data.name = str(name) user_data.persist() slimeoid_data.persist() response = "You enter the name {} into the console.".format( str(name)) # Go to final response # Final response await send_response(response, cmd)
async def banish(cmd): user_data = EwUser(member=cmd.message.author) if user_data.life_state != ewcfg.life_state_kingpin and user_data.life_state != ewcfg.life_state_executive and not cmd.message.author.guild_permissions.administrator: response = "Only the Rowdy F****r {} and the Cop Killer {} can do that.".format( ewcfg.emote_rowdyfucker, ewcfg.emote_copkiller) else: member = None if cmd.mentions_count == 1: member = cmd.mentions[0] # >:] # if member.id == cmd.message.author.id: # member = None if member == None: response = "Who?" else: member_data = EwUser(member=member) member_data.ban(faction=user_data.faction) member_data.unvouch(faction=user_data.faction) if member_data.faction == user_data.faction: member_data.faction = "" if member_data.life_state == ewcfg.life_state_enlisted: member_data.life_state = ewcfg.life_state_juvenile 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() response = "{} has been banned from enlisting in the {}".format( member.display_name, user_data.faction) await ewrolemgr.updateRoles(client=cmd.client, member=member) await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
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 deadmega(cmd): response = "" user_data = EwUser(member=cmd.message.author) if user_data.life_state != ewcfg.life_state_kingpin: response = "Only the Rowdy F****r {} and the Cop Killer {} can do that.".format( ewcfg.emote_rowdyfucker, ewcfg.emote_copkiller) else: value = 1000000 user_slimes = 0 if value > user_data.slimes: response = "You don't have that much slime to lose ({:,}/{:,}).".format( user_data.slimes, value) else: user_data.change_slimes(n=-value) user_data.persist() response = "Alas, poor megaslime. You have {:,} slime remaining.".format( user_data.slimes) # 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 scrub(cmd): user_data = EwUser(member=cmd.message.author) poi = poi_static.id_to_poi.get(user_data.poi) district = EwDistrict(id_server=cmd.guild.id, district=poi.id_poi) if user_data.life_state != ewcfg.life_state_juvenile: response = "You wouldn't stoop that low. Only Juvies would be that needlessly obedient." elif not poi.is_capturable: response = "No need to scrub, scrub. The gangs don't really mark up this place." elif district.capture_points == 0: response = "{} is clean. Good job, assuming you actually did anything.".format(poi.str_name) elif district.all_neighbors_friendly(): response = "You're too deep into enemy territory. Scrub here and you might wet yourself." else: if random.randint(0, 2) == 0: district.change_capture_points(progress=-1, actor=ewcfg.actor_decay) district.persist() if user_data.crime >= 1: user_data.change_crime(n = -1) user_data.persist() response = "-" if response != "-": return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))