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))
async def order(cmd): user_data = EwUser(member=cmd.message.author) mutations = user_data.get_mutations() if user_data.life_state == ewcfg.life_state_shambler and user_data.poi != ewcfg.poi_id_nuclear_beach_edge: 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)) market_data = EwMarket(id_server=cmd.guild.id) currency_used = 'slime' current_currency_amount = user_data.slimes # poi = ewmap.fetch_poi_if_coordless(cmd.message.channel.name) poi = poi_static.id_to_poi.get(user_data.poi) if poi is None or len(poi.vendors) == 0 or ewutils.channel_name_is_poi(cmd.message.channel.name) == False: # Only allowed in the food court. response = "There’s nothing to buy here. If you want to purchase some items, go to a sub-zone with a vendor in it, like the food court, the speakeasy, or the bazaar." else: poi = poi_static.id_to_poi.get(user_data.poi) district_data = EwDistrict(district=poi.id_poi, id_server=user_data.id_server) shambler_multiplier = 1 # for speakeasy during shambler times if district_data.is_degraded(): if poi.id_poi == ewcfg.poi_id_speakeasy: shambler_multiplier = 4 else: 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)) # value = ewutils.flattenTokenListToString(cmd.tokens[1:2]) # if cmd.tokens_count > 1: # value = cmd.tokens[1] # value = value.lower() value = None togo = False if cmd.tokens_count > 1: for token in cmd.tokens[1:]: if token.startswith('<@') == False and token.lower() not in "togo": # togo can be spelled together or separate value = token break for token in cmd.tokens[1:]: if token.lower() in "togo": # lets people get away with just typing only to or only go (or only t etc.) but whatever togo = True break # Finds the item if it's an EwGeneralItem. if value == "mylittleponyfigurine": value = random.choice(static_items.furniture_pony) item = static_items.item_map.get(value) item_type = ewcfg.it_item if item != None: item_id = item.id_item name = item.str_name # Finds the item if it's an EwFood item. if item == None: item = static_food.food_map.get(value) item_type = ewcfg.it_food if item != None: item_id = item.id_food name = item.str_name # Finds the item if it's an EwCosmeticItem. if item == None: item = static_cosmetics.cosmetic_map.get(value) item_type = ewcfg.it_cosmetic if item != None: item_id = item.id_cosmetic name = item.str_name if item == None: item = static_items.furniture_map.get(value) item_type = ewcfg.it_furniture if item != None: item_id = item.id_furniture name = item.str_name if item_id in static_items.furniture_pony: item.vendors = [ewcfg.vendor_bazaar] if item == None: item = static_weapons.weapon_map.get(value) item_type = ewcfg.it_weapon if item != None: item_id = item.id_weapon name = item.str_weapon if item == None: item = static_relic.relic_map.get(value) item_type = ewcfg.it_relic if item != None and relic_utils.canCreateRelic(item.id_relic, cmd.guild.id): item_id = item.id_relic name = item.str_name elif item != None: item = None if item != None: item_type = item.item_type # Gets a vendor that the item is available and the player currently located in try: current_vendor = (set(item.vendors).intersection(set(poi.vendors))).pop() except: current_vendor = None # Check if the item is available in the current bazaar item rotation if current_vendor == ewcfg.vendor_bazaar: if item_id not in market_data.bazaar_wares.values(): if item_id in static_items.furniture_pony and "mylittleponyfigurine" in market_data.bazaar_wares.values(): pass else: current_vendor = None if current_vendor is None or len(current_vendor) < 1: response = "Check the {} for a list of items you can {}.".format(ewcfg.cmd_menu, ewcfg.cmd_order) else: response = "" value = item.price premium_purchase = True if item_id in ewcfg.premium_items else False if premium_purchase: togo = True # Just in case they order a premium food item, don't make them eat it right then and there. if ewcfg.cd_premium_purchase > (int(time.time()) - user_data.time_lastpremiumpurchase): response = "That item is in very limited stock! The vendor asks that you refrain from purchasing it for a day or two." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif ewcfg.cd_new_player > (int(time.time()) - user_data.time_joined): response = "You've only been in the city for a few days. The vendor doesn't trust you with that item very much..." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) stock_data = None company_data = None # factor in the current stocks for vendor in item.vendors: if vendor in ewcfg.vendor_stock_map: stock = ewcfg.vendor_stock_map.get(vendor) company_data = EwCompany(id_server=user_data.id_server, stock=stock) stock_data = EwStock(id_server=user_data.id_server, stock=stock) if stock_data is not None: value *= (stock_data.exchange_rate / ewcfg.default_stock_exchange_rate) ** 0.2 controlling_faction = poi_utils.get_subzone_controlling_faction(user_data.poi, user_data.id_server) if controlling_faction != "": # prices are halved for the controlling gang if controlling_faction == user_data.faction: value /= 2 # and 4 times as much for enemy gangsters elif user_data.faction != "": value *= 4 # raise shambled speakeasy price 4 times value *= shambler_multiplier # Raise the price for togo ordering. This gets lowered back down later if someone does togo ordering on a non-food item by mistake. if togo: value *= 1.5 if current_vendor == ewcfg.vendor_breakroom and user_data.faction == ewcfg.faction_slimecorp: value = 0 value = int(value) food_ordered = False target_data = None # Kingpins eat free. if (user_data.life_state == ewcfg.life_state_kingpin or user_data.life_state == ewcfg.life_state_grandfoe) and item_type == ewcfg.it_food: value = 0 if value > current_currency_amount: # Not enough money. response = "A {} costs {:,} {}, and you only have {:,}.".format(name, value, currency_used, current_currency_amount) else: mutations = user_data.get_mutations() if random.randrange(5) == 0 and ewcfg.mutation_id_stickyfingers in mutations: value = 0 user_data.change_crime(n=ewcfg.cr_larceny_points) inv_response = bknd_item.check_inv_capacity(user_data=user_data, item_type=item_type, return_strings=True, pronoun="You") if inv_response != "" and (item_type != ewcfg.it_food or togo): return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, inv_response)) if item_type == ewcfg.it_food: food_ordered = True target = None target_data = None if not togo: # cant order togo for someone else, you can just give it to them in person if cmd.mentions_count == 1: target = cmd.mentions[0] if target.id == cmd.message.author.id: target = None if target != None: target_data = EwUser(member=target) if target_data.life_state == ewcfg.life_state_corpse and target_data.get_possession(): response = "How are you planning to feed them while they're possessing you?" return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif target_data.poi != user_data.poi: response = "You can't order anything for them because they aren't here!" return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif item_type == ewcfg.it_weapon: if user_data.life_state == ewcfg.life_state_corpse: response = "Ghosts can't hold weapons." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) item_props = itm_utils.gen_item_props(item) # Only food should have the value multiplied. If someone togo orders a non-food item by mistake, lower it back down. if not food_ordered and togo: value = int(value / 1.5) if currency_used == 'slime': user_data.change_slimes(n=-value, source=ewcfg.source_spending) if company_data is not None: company_data.recent_profits += value company_data.persist() if item.str_name == "arcade cabinet": item_props['furniture_desc'] = random.choice(ewcfg.cabinets_list) elif item.item_type == ewcfg.it_furniture: if "custom" in item_props.get('id_furniture'): if cmd.tokens_count < 4 or cmd.tokens[2] == "" or cmd.tokens[3] == "": response = "You need to specify the customization text before buying a custom item. Come on, isn't that self-evident? (!order [custom item] \"custom name\" \"custom description\")" return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: customname = cmd.tokens[2] if len(customname) > 32: response = "That name is too long. ({:,}/32)".format(len(customname)) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) customdesc = cmd.tokens[3] if len(customdesc) > 500: response = "That description is too long. ({:,}/500)".format(len(customdesc)) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) name = item_props['furniture_name'] = item_props['furniture_name'].format(custom=customname) item_props['furniture_desc'] = customdesc item_props['furniture_look_desc'] = item_props['furniture_look_desc'].format(custom=customname) item_props['furniture_place_desc'] = item_props['furniture_place_desc'].format(custom=customname) id_item = bknd_item.item_create( item_type=item_type, id_user=cmd.message.author.id, id_server=cmd.guild.id, stack_max=-1, stack_size=0, item_props=item_props ) if value == 0: response = "You swipe a {} from the counter at {}.".format(name, current_vendor) else: response = "You slam {:,} {} down on the counter at {} for {}.".format(value, currency_used, current_vendor, name) if food_ordered and not togo: item_data = EwItem(id_item=id_item) # Eat food on the spot! if target_data != None: target_player_data = EwPlayer(id_user=target_data.id_user) if value == 0: response = "You swipe a {} from the counter at {} and give it to {}.".format(name, current_vendor, target_player_data.display_name) else: response = "You slam {:,} slime down on the counter at {} for {} and give it to {}.".format(value, current_vendor, name, target_player_data.display_name) response += "\n\n*{}*: ".format(target_player_data.display_name) + target_data.eat(item_data) target_data.persist() else: if value == 0: response = "You swipe a {} from the counter at {} and eat it right on the spot.".format(name, current_vendor) else: response = "You slam {:,} slime down on the counter at {} for {} and eat it right on the spot.".format(value, current_vendor, name) user_player_data = EwPlayer(id_user=user_data.id_user) response += "\n\n*{}*: ".format(user_player_data.display_name) + user_data.eat(item_data) user_data.persist() if premium_purchase: user_data.time_lastpremiumpurchase = int(time.time()) user_data.persist() else: response = "Check the {} for a list of items you can {}.".format(ewcfg.cmd_menu, ewcfg.cmd_order) # 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 smoke(cmd): usermodel = EwUser(member=cmd.message.author) # item_sought = bknd_item.find_item(item_search="cigarette", id_user=cmd.message.author.id, id_server=usermodel.id_server) item_sought = None space_adorned = 0 item_stash = bknd_item.inventory(id_user=cmd.message.author.id, id_server=usermodel.id_server) for item_piece in item_stash: item = EwItem(id_item=item_piece.get('id_item')) if item.item_props.get('adorned') == 'true': space_adorned += int(item.item_props.get('size')) if item_piece.get('item_type') == ewcfg.it_cosmetic and ( item.item_props.get('id_cosmetic') == "cigarette" or item.item_props.get('id_cosmetic') == "cigar" ) and "lit" not in item.item_props.get('cosmetic_desc'): item_sought = item_piece if item_sought: item = EwItem(id_item=item_sought.get('id_item')) if item_sought.get( 'item_type') == ewcfg.it_cosmetic and item.item_props.get( 'id_cosmetic') == "cigarette": if int(item.item_props.get('size')) > 0: space_adorned += int(item.item_props.get('size')) usermodel.change_crime(n=ewcfg.cr_underage_smoking_points) response = "You light a cig and bring it to your mouth. So relaxing. So *cool*. All those naysayers and PSAs in Health class can go f**k themselves." item.item_props[ 'cosmetic_desc'] = "A single lit cigarette sticking out of your mouth. You huff these things down in seconds but you’re never seen without one. Everyone thinks you’re really, really cool." if space_adorned < ewutils.max_adornspace_bylevel( usermodel.slimelevel): item.item_props['adorned'] = "true" item.persist() usermodel.persist() await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) await asyncio.sleep(60) item = EwItem(id_item=item_sought.get('id_item')) response = "The cigarette fizzled out." item.item_props[ 'cosmetic_desc'] = "It's a cigarette butt. What kind of hoarder holds on to these?" item.item_props['adorned'] = "false" item.item_props['id_cosmetic'] = "cigarettebutt" item.item_props['cosmetic_name'] = "cigarette butt" item.persist() elif item_sought.get( 'item_type') == ewcfg.it_cosmetic and item.item_props.get( 'id_cosmetic') == "cigar": if int(item.item_props['size']) > 0: space_adorned += int(item.item_props['size']) usermodel.change_crime(n=ewcfg.cr_underage_smoking_points) response = "You light up your stogie and bring it to your mouth. So relaxing. So *cool*. All those naysayers and PSAs in Health class can go f**k themselves." item.item_props[ 'cosmetic_desc'] = "A single lit cigar sticking out of your mouth. These thing take their time to kick in, but it's all worth it to look like a supreme gentleman." if space_adorned < ewutils.max_adornspace_bylevel( usermodel.slimelevel): item.item_props['adorned'] = "true" item.persist() usermodel.persist() await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) await asyncio.sleep(300) item = EwItem(id_item=item_sought.get('id_item')) response = "The cigar fizzled out." item.item_props[ 'cosmetic_desc'] = "It's a cigar stump. It's seen better days." item.item_props['adorned'] = "false" item.item_props['id_cosmetic'] = "cigarstump" item.item_props['cosmetic_name'] = "cigar stump" item.persist() else: response = "You can't smoke that." else: response = "There aren't any usable cigarettes or cigars in your inventory." return 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() blockparty = EwGamestate(id_server=id_server, id_state='blockparty') party_poi = ''.join([i for i in blockparty.value if not i.isdigit()]) if party_poi == 'outsidethe': party_poi = ewcfg.poi_id_711 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.poi != party_poi and user_data.life_state not in [ ewcfg.life_state_kingpin, ewcfg.life_state_lucky, ewcfg.life_state_executive ]: 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.change_crime( n=50) # loitering:punishable by death 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 piss(cmd): user_data = EwUser(member=cmd.message.author) mutations = user_data.get_mutations() if ewcfg.mutation_id_enlargedbladder in mutations: user_data.change_crime(n=1) user_data.persist() cosmetics = bknd_item.inventory(id_user=user_data.id_user, id_server=cmd.guild.id, item_type_filter=ewcfg.it_cosmetic) protected = False for cosmetic in cosmetics: cosmetic_data = EwItem(id_item=cosmetic.get('id_item')) if cosmetic_data.item_props.get('id_cosmetic') == 'chastitybelt': if cosmetic_data.item_props.get('adorned') == 'true': protected = True if protected == True: response = "Reaching for your weewee, you instead hear the desolate metal clank of your hand against a steel groincage. Damn you, chastity belt. DAMN YOU TO HELL!!! " return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if cmd.mentions_count == 0: response = "You unzip your dick and just start pissing all over the goddamn f*****g floor. God, you’ve waited so long for this moment, and it’s just as perfect as you could have possibly imagined. You love pissing so much." if random.randint(1, 100) < 2: slimeoid = EwSlimeoid(member=cmd.message.author) if slimeoid.life_state == ewcfg.slimeoid_state_active: hue = hue_static.hue_map.get("yellow") response = "CONGRATULATIONS. You suddenly lose control of your HUGE C**K and saturate your {} with your PISS. {}".format(slimeoid.name, hue.str_saturate) slimeoid.hue = (hue_static.hue_map.get("yellow")).id_hue slimeoid.persist() return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if cmd.mentions_count == 1: target_member = cmd.mentions[0] target_user_data = EwUser(member=target_member) if user_data.id_user == target_user_data.id_user: response = "Your love for piss knows no bounds. You aim your urine stream sky high, causing it to land right back into your own mouth. Mmmm, tasty~!" return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if user_data.poi == target_user_data.poi: if target_user_data.life_state == ewcfg.life_state_corpse: response = "You piss right through them! Their ghostly form ripples as the stream of urine pours endlessly unto them." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) response = "You piss HARD and FAST right onto {}!!".format(target_member.display_name) else: response = "You can't !piss on someone who isn't there! Moron!" elif cmd.mentions_count > 1: response = "Whoa, one water-sports fetishist at a time, pal!" elif user_data.life_state == ewcfg.life_state_corpse: if cmd.mentions_count == 0: response = "You grow a ghost dick, unzip it, and just start ghost pissing all over the goddamn f*****g floor. God, you’ve waited so long for this moment, and it’s just as perfect as you could have possibly imagined. You love ghost pissing so much." if random.randint(1, 100) < 3: response = "You grow a gussy, unzip it, and just start ghost pissing all over the goddamn f*****g floor. God, you've waited so long for this moment, and it's just as perfect as you could have possibly imagined. You love ghost pissing so much." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if cmd.mentions_count == 1: target_member = cmd.mentions[0] target_user_data = EwUser(member=target_member) if user_data.id_user == target_user_data.id_user: response = "Your love for negapiss knows no bounds. You aim your antiurine stream sky high, causing it to land right back into your own ghastly mouth. Mmmm, tasty~!" return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if user_data.poi == target_user_data.poi: if target_user_data.life_state == ewcfg.life_state_corpse: response = "You ghost piss HARD and FAST right onto {}!!".format(target_member.display_name) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) response = "Your ghost piss passes right through them! {} seems annoyed at the negapiss you're streaming at them, but they're entirely unaffected.".format(target_member.display_name) else: response = "You can't !piss on someone who isn't there! Moron!" elif cmd.mentions_count > 1: response = "Whoa, one necrophiliac at a time, pal!" else: response = "You lack the moral fiber necessary for urination." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))