async def smoke(cmd): usermodel = EwUser(member=cmd.message.author) #item_sought = ewitem.find_item(item_search="cigarette", id_user=cmd.message.author.id, id_server=usermodel.id_server) item_sought = None item_stash = ewitem.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_piece.get('item_type') == ewcfg.it_cosmetic and item.item_props.get('id_cosmetic') == "cigarette" 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": 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." item.item_props['adorned'] = "true" item.persist() await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.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() else: response = "There aren't any usable cigarettes in your inventory." else: response = "There aren't any usable cigarettes in your inventory." return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
def dedorn_all_costumes(): costumes = ewutils.execute_sql_query( "SELECT id_item FROM items_prop WHERE name = 'context' AND value = 'costume' AND id_item IN (SELECT id_item FROM items_prop WHERE (name = 'adorned' OR name = 'slimeoid') AND value = 'true')" ) costume_count = 0 for costume_id in costumes: costume_item = EwItem(id_item=costume_id) usermodel = EwUser(id_user=costume_item.id_owner, id_server=costume_item.id_server) costume_item.item_props['adorned'] = 'false' if costume_item.item_props['slimeoid'] == 'false': usermodel.persist() costume_item.item_props['slimeoid'] = 'false' costume_item.persist() costume_count += 1 ewutils.logMsg( "Dedorned {} costumes after full moon ended.".format(costume_count))
async def store(cmd): user_data = EwUser(member=cmd.message.author) response = "" poi = ewcfg.id_to_poi.get(user_data.poi) if poi.community_chest == None: response = "There is no community chest here." return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.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 ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) item_search = ewutils.flattenTokenListToString(cmd.tokens[1:]) item_sought = ewitem.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 = ewcfg.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 ewutils.send_message(cmd.client, cmd.message.channel, ewutils.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() ewitem.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 ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def dye(cmd): first_id = ewutils.flattenTokenListToString(cmd.tokens[1:2]) second_id = ewutils.flattenTokenListToString(cmd.tokens[2:]) try: first_id_int = int(first_id) second_id_int = int(second_id) except: first_id_int = None second_id_int = None if first_id != None and len(first_id) > 0 and second_id != None and len(second_id) > 0: response = "You don't have one." items = ewitem.inventory( id_user = cmd.message.author.id, id_server = cmd.message.server.id, ) cosmetic = None dye = None for item in items: if item.get('id_item') in [first_id_int, second_id_int] or first_id in ewutils.flattenTokenListToString(item.get('name')) or second_id in ewutils.flattenTokenListToString(item.get('name')): if item.get('item_type') == ewcfg.it_cosmetic and cosmetic is None: cosmetic = item if item.get('item_type') == ewcfg.it_item and item.get('name') in ewcfg.dye_map and dye is None: dye = item if cosmetic != None and dye != None: break if cosmetic != None: if dye != None: user_data = EwUser(member = cmd.message.author) cosmetic_item = EwItem(id_item=cosmetic.get("id_item")) dye_item = EwItem(id_item=dye.get("id_item")) hue = ewcfg.hue_map.get(dye_item.item_props.get('id_item')) response = "You dye your {} in {} paint!".format(cosmetic_item.item_props.get('cosmetic_name'), hue.str_name) cosmetic_item.item_props['hue'] = hue.id_hue cosmetic_item.persist() ewitem.item_delete(id_item=dye.get('id_item')) else: response = 'Use which dye? Check your **!inventory**.' else: response = 'Dye which cosmetic? Check your **!inventory**.' await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) else: await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, 'You need to specify which cosmetic you want to paint and which dye you want to use! Check your **!inventory**.'))
async def order(cmd): user_data = EwUser(member=cmd.message.author) 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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 = ewcfg.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 = ewcfg.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( ) and poi.id_poi != ewcfg.poi_id_nuclear_beach_edge: 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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(ewcfg.furniture_pony) item = ewcfg.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 = ewcfg.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 = ewcfg.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 = ewcfg.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 ewcfg.furniture_pony: item.vendors = [ewcfg.vendor_bazaar] if item == None: item = ewcfg.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_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 ewcfg.furniture_pony and "mylittleponyfigurine" in market_data.bazaar_wares.values( ): pass else: current_vendor = None if current_vendor == ewcfg.vendor_downpourlaboratory: currency_used = 'brainz' current_currency_amount = user_data.gvs_currency 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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 = ewutils.get_subzone_controlling_faction( user_data.poi, user_data.id_server) if controlling_faction != "" and poi.id_poi != ewcfg.poi_id_nuclear_beach_edge: # 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: if item_type == ewcfg.it_food: food_ordered = True food_items = ewitem.inventory( id_user=cmd.message.author.id, id_server=cmd.guild.id, item_type_filter=ewcfg.it_food) 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage( cmd.message.author, response)) if len(food_items) >= user_data.get_food_capacity( ) and target_data == None and togo: # user_data never got persisted so the player won't lose money unnecessarily response = "You can't carry any more food than that." return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) elif item_type == ewcfg.it_weapon: weapons_held = ewitem.inventory( id_user=user_data.id_user, id_server=cmd.guild.id, item_type_filter=ewcfg.it_weapon) has_weapon = False # Thrown weapons are stackable if ewcfg.weapon_class_thrown in item.classes: # Check the player's inventory for the weapon and add amount to stack size. Create a new item the max stack size has been reached for wep in weapons_held: weapon = EwItem(id_item=wep.get("id_item")) if weapon.item_props.get( "weapon_type" ) == item.id_weapon and weapon.stack_size < weapon.stack_max: has_weapon = True weapon.stack_size += 1 weapon.persist() if value == 0: response = "You swipe a {} from the counter at {}.".format( item.str_weapon, current_vendor) else: response = "You slam {:,} slime down on the counter at {} for {}.".format( value, current_vendor, item.str_weapon) user_data.change_slimes( n=-value, source=ewcfg.source_spending) user_data.persist() return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage( cmd.message.author, response)) if has_weapon == False: if len(weapons_held ) >= user_data.get_weapon_capacity(): response = "You can't carry any more weapons." return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage( cmd.message.author, response)) elif user_data.life_state == ewcfg.life_state_corpse: response = "Ghosts can't hold weapons." return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage( cmd.message.author, response)) item_props = ewitem.gen_item_props(item) customtext = cmd.message.content[(len(cmd.tokens[0]) + len(cmd.tokens[1]) + 2):] if item.item_type == ewcfg.it_furniture and "custom" in item_props.get( 'id_furniture'): if customtext == "": response = "You need to specify the customization text before buying a custom item. Come on, isn't that self-evident?" return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) # 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) elif currency_used == 'brainz': user_data.gvs_currency -= value 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'): item_props['furniture_name'] = item_props[ 'furniture_name'].format(custom=customtext) item_props['furniture_desc'] = item_props[ 'furniture_desc'].format(custom=customtext) item_props['furniture_look_desc'] = item_props[ 'furniture_look_desc'].format( custom=customtext) item_props['furniture_place_desc'] = item_props[ 'furniture_place_desc'].format( custom=customtext) item.str_name = item.str_name.format( custom=customtext) id_item = ewitem.item_create( item_type=item_type, id_user=cmd.message.author.id, id_server=cmd.guild.id, stack_max=20 if item_type == ewcfg.it_weapon and ewcfg.weapon_class_thrown in item.classes else -1, stack_size=1 if item_type == ewcfg.it_weapon and ewcfg.weapon_class_thrown in item.classes else 0, item_props=item_props) if value == 0: response = "You swipe a {} from the counter at {}.".format( item.str_name, current_vendor) else: response = "You slam {:,} {} down on the counter at {} for {}.".format( value, currency_used, current_vendor, item.str_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( item.str_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, item.str_name, target_player_data.display_name) response += "\n\n*{}*: ".format( target_player_data.display_name ) + target_data.eat(item_data) target_data.persist() asyncio.ensure_future( ewutils.decrease_food_multiplier( user_data.id_user)) else: if value == 0: response = "You swipe a {} from the counter at {} and eat it right on the spot.".format( item.str_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, item.str_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() asyncio.ensure_future( ewutils.decrease_food_multiplier( user_data.id_user)) 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def reel(cmd): user_data = EwUser(member = cmd.message.author) if cmd.message.author.id not in fishers.keys(): fishers[cmd.message.author.id] = EwFisher() fisher = fishers[cmd.message.author.id] poi = ewcfg.id_to_poi.get(user_data.poi) # Ghosts cannot fish. if user_data.life_state == ewcfg.life_state_corpse: response = "You can't fish while you're dead. Try {}.".format(ewcfg.cmd_revive) elif cmd.message.channel.name in [ewcfg.channel_tt_pier, ewcfg.channel_jp_pier, ewcfg.channel_cl_pier, ewcfg.channel_afb_pier, ewcfg.channel_vc_pier, ewcfg.channel_se_pier, ewcfg.channel_ferry]: # Players who haven't cast a line cannot reel. if fisher.fishing == False: response = "You haven't cast your hook yet. Try !cast." # If a fish isn't biting, then a player reels in nothing. elif fisher.bite == False and fisher.fishing == True: fisher.current_fish = "" fisher.current_size = "" fisher.fishing = False fisher.pier = "" response = "You reeled in too early! Nothing was caught." # On successful reel. else: if fisher.current_fish == "item": slimesea_inventory = ewitem.inventory(id_server = cmd.message.server.id, id_user = ewcfg.poi_id_slimesea) pier_poi = ewcfg.id_to_poi.get(fisher.pier) if pier_poi.pier_type != ewcfg.fish_slime_saltwater or len(slimesea_inventory) == 0 or random.random() < 0.5: item = random.choice(ewcfg.mine_results) unearthed_item_amount = (random.randrange(5) + 8) # anywhere from 8-12 drops item_props = ewitem.gen_item_props(item) for creation in range(unearthed_item_amount): ewitem.item_create( item_type = item.item_type, id_user = cmd.message.author.id, id_server = cmd.message.server.id, item_props = item_props ) response = "You reel in {} {}s! ".format(unearthed_item_amount, item.str_name) else: item = random.choice(slimesea_inventory) ewitem.give_item(id_item = item.get('id_item'), member = cmd.message.author) response = "You reel in a {}!".format(item.get('name')) fisher.fishing = False fisher.bite = False fisher.current_fish = "" fisher.current_size = "" fisher.pier = "" user_data.persist() else: user_initial_level = user_data.slimelevel gang_bonus = False has_fishingrod = False if user_data.weapon >= 0: weapon_item = EwItem(id_item = user_data.weapon) weapon = ewcfg.weapon_map.get(weapon_item.item_props.get("weapon_type")) if weapon.id_weapon == "fishingrod": has_fishingrod = True value = 0 if fisher.current_size == ewcfg.fish_size_miniscule: slime_gain = ewcfg.fish_gain * 1 value += 10 elif fisher.current_size == ewcfg.fish_size_small: slime_gain = ewcfg.fish_gain * 2 value += 20 elif fisher.current_size == ewcfg.fish_size_average: slime_gain = ewcfg.fish_gain * 3 value += 30 elif fisher.current_size == ewcfg.fish_size_big: slime_gain = ewcfg.fish_gain * 4 value += 40 elif fisher.current_size == ewcfg.fish_size_huge: slime_gain = ewcfg.fish_gain * 5 value += 50 else: slime_gain = ewcfg.fish_gain * 6 value += 60 if ewcfg.fish_map[fisher.current_fish].rarity == ewcfg.fish_rarity_common: value += 10 if ewcfg.fish_map[fisher.current_fish].rarity == ewcfg.fish_rarity_uncommon: value += 20 if ewcfg.fish_map[fisher.current_fish].rarity == ewcfg.fish_rarity_rare: value += 30 if ewcfg.fish_map[fisher.current_fish].rarity == ewcfg.fish_rarity_promo: value += 40 if user_data.life_state == 2: if ewcfg.fish_map[fisher.current_fish].catch_time == ewcfg.fish_catchtime_day and user_data.faction == ewcfg.faction_rowdys: gang_bonus = True slime_gain = slime_gain * 1.5 value += 20 if ewcfg.fish_map[fisher.current_fish].catch_time == ewcfg.fish_catchtime_night and user_data.faction == ewcfg.faction_killers: gang_bonus = True slime_gain = slime_gain * 1.5 value += 20 if has_fishingrod == True: slime_gain = slime_gain * 2 if fisher.current_fish == "plebefish": slime_gain = ewcfg.fish_gain * .5 value = 10 if poi.is_subzone: district_data = EwDistrict(district = poi.mother_district, id_server = cmd.message.server.id) else: district_data = EwDistrict(district = poi.id_poi, id_server = cmd.message.server.id) if district_data.controlling_faction != "" and district_data.controlling_faction == user_data.faction: slime_gain *= 2 ewitem.item_create( id_user = cmd.message.author.id, id_server = cmd.message.server.id, item_type = ewcfg.it_food, item_props = { 'id_food': ewcfg.fish_map[fisher.current_fish].id_fish, 'food_name': ewcfg.fish_map[fisher.current_fish].str_name, 'food_desc': ewcfg.fish_map[fisher.current_fish].str_desc, 'recover_hunger': 20, 'str_eat': ewcfg.str_eat_raw_material.format(ewcfg.fish_map[fisher.current_fish].str_name), 'rarity': ewcfg.fish_map[fisher.current_fish].rarity, 'size': fisher.current_size, 'time_expir': time.time() + ewcfg.std_food_expir, 'time_fridged': 0, 'acquisition': ewcfg.acquisition_fishing, 'value': value } ) response = "You reel in a {fish}! {flavor} You grab hold and wring {slime} slime from it. "\ .format(fish = ewcfg.fish_map[fisher.current_fish].str_name, flavor = ewcfg.fish_map[fisher.current_fish].str_desc, slime = str(slime_gain)) if gang_bonus == True: if user_data.faction == ewcfg.faction_rowdys: response += "The Rowdy-pride this fish is showing gave you more slime than usual. " elif user_data.faction == ewcfg.faction_killers: response += "The Killer-pride this fish is showing gave you more slime than usual. " levelup_response = user_data.change_slimes(n = slime_gain, source = ewcfg.source_fishing) was_levelup = True if user_initial_level < user_data.slimelevel else False # Tell the player their slime level increased. if was_levelup: response += levelup_response market_data = EwMarket(id_server=user_data.id_server) if market_data.caught_fish == ewcfg.debugfish_goal and fisher.pier in ewcfg.debugpiers: item = ewcfg.debugitem ewitem.item_create( item_type=ewcfg.it_item, id_user=user_data.id_user, id_server=user_data.id_server, item_props={ 'id_item': item.id_item, 'context': item.context, 'item_name': item.str_name, 'item_desc': item.str_desc, } ), ewutils.logMsg('Created item: {}'.format(item.id_item)) item = EwItem(id_item=item.id_item) item.persist() response += ewcfg.debugfish_response market_data.caught_fish += 1 market_data.persist() elif market_data.caught_fish < ewcfg.debugfish_goal and fisher.pier in ewcfg.debugpiers: market_data.caught_fish += 1 market_data.persist() fisher.fishing = False fisher.bite = False fisher.current_fish = "" fisher.current_size = "" fisher.pier = "" user_data.persist() else: response = "You cast your fishing rod unto a sidewalk. That is to say, you've accomplished nothing. Go to a pier if you want to fish." await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def embiggen(cmd): user_data = EwUser(member = cmd.message.author) market_data = EwMarket(id_server = user_data.id_server) item_search = ewutils.flattenTokenListToString(cmd.tokens[1:]) item_sought = ewitem.find_item(item_search = item_search, id_user = cmd.message.author.id, id_server = cmd.message.server.id if cmd.message.server is not None else None) if cmd.message.channel.name != ewcfg.channel_slimeoidlab: response = "How are you going to embiggen your fish on the side of the street? You’ve got to see a professional for this, man. Head to the SlimeCorp Laboratory, they’ve got dozens of modern day magic potions ‘n shit over there." elif item_sought: name = item_sought.get('name') fish = EwItem(id_item = item_sought.get('id_item')) acquisition = fish.item_props.get('acquisition') if acquisition != ewcfg.acquisition_fishing: response = "You can only embiggen fishes, dummy. Otherwise everyone would be walking around with colossal nunchucks and huge chicken buckets. Actually, that gives me an idea..." else: size = fish.item_props.get('size') poudrin_cost = 0 if size == ewcfg.fish_size_miniscule: poudrin_cost = 2 if size == ewcfg.fish_size_small: poudrin_cost = 4 if size == ewcfg.fish_size_average: poudrin_cost = 8 if size == ewcfg.fish_size_big: poudrin_cost = 16 if size == ewcfg.fish_size_huge: poudrin_cost = 32 poudrins_owned = ewitem.find_item_all(item_search = "slimepoudrin", id_user = user_data.id_user, id_server = user_data.id_server) poudrin_amount = len(poudrins_owned) if poudrin_cost == 0: response = "Your {} is already as colossal as a fish can get!".format(name) elif poudrin_amount < poudrin_cost: response = "You need {} poudrins to embiggen your {}, but you only have {}!!".format(poudrin_cost, name, poudrin_amount) else: if size == ewcfg.fish_size_miniscule: fish.item_props['size'] = ewcfg.fish_size_small if size == ewcfg.fish_size_small: fish.item_props['size'] = ewcfg.fish_size_average if size == ewcfg.fish_size_average: fish.item_props['size'] = ewcfg.fish_size_big if size == ewcfg.fish_size_big: fish.item_props['size'] = ewcfg.fish_size_huge if size == ewcfg.fish_size_huge: fish.item_props['size'] = ewcfg.fish_size_colossal fish.persist() for delete in range(poudrin_cost): poudrin = poudrins_owned.pop() ewitem.item_delete(id_item = poudrin.get("id_item")) market_data.donated_poudrins += poudrin_cost market_data.persist() user_data.poudrin_donations += poudrin_cost user_data.persist() response = "After several minutes long elevator descents, in the depths of some basement level far below the laboratory's lobby, you lay down your {} on a reclined medical chair. A SlimeCorp employee finishes the novel length terms of service they were reciting and asks you if you have any questions. You weren’t listening so you just tell them to get on with it so you can go back to haggling prices with Captain Albert Alexander. They oblige.\nThey grab a butterfly needle and carefully stab your fish with it, injecting filled with some bizarre, multi-colored serum you’ve never seen before. Sick, it’s bigger now!!".format(name) else: if item_search: # If they didn't forget to specify an item and it just wasn't found. response = "You don't have one." else: response = "Embiggen which fish? (check **!inventory**)" await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def on_message(message): time_now = int(time.time()) """ do not interact with our own messages """ if message.author.id == client.user.id or message.author.bot == True: return if message.server != None: # Note that the user posted a message. active_map = active_users_map.get(message.server.id) if active_map == None: active_map = {} active_users_map[message.server.id] = active_map active_map[message.author.id] = True # Update player information. ewplayer.player_update(member=message.author, server=message.server) content_tolower = message.content.lower() re_awoo = re.compile('.*![a]+[w]+o[o]+.*') if message.content.startswith( ewcfg.cmd_prefix) or message.server == None or len( message.author.roles) < 2: """ Wake up if we need to respond to messages. Could be: message starts with ! direct message (server == None) user is new/has no roles (len(roles) < 2) """ # tokenize the message. the command should be the first word. tokens = message.content.split(' ') tokens_count = len(tokens) cmd = tokens[0].lower() # remove mentions to us mentions = list( filter(lambda user: user.id != client.user.id, message.mentions)) mentions_count = len(mentions) # Create command object cmd_obj = ewcmd.EwCmd(tokens=tokens, message=message, client=client, mentions=mentions) """ reply to DMs with help document """ if message.server == None: # Direct message the player their inventory. if ewitem.cmd_is_inventory(cmd): return await ewitem.inventory_print(cmd_obj) else: time_last = last_helped_times.get(message.author.id, 0) # Only send the help doc once every thirty seconds. There's no need to spam it. if (time_now - time_last) > 30: last_helped_times[message.author.id] = time_now await client.send_message( message.channel, 'Check out the guide for help: https://ew.krakissi.net/guide/' ) # Nothing else to do in a DM. return # common data we'll need roles_map = cmd_obj.roles_map # assign the juveniles role to a user with only 1 or 0 roles. if len(message.author.roles) < 2: role_juvenile = roles_map[ewcfg.role_juvenile] await client.replace_roles(message.author, role_juvenile) return # Scold/ignore offline players. if message.author.status == discord.Status.offline: resp = await ewcmd.start(cmd=cmd_obj) response = "You cannot participate in the ENDLESS WAR while offline." if resp != None: await client.edit_message( resp, ewutils.formatMessage(message.author, response)) else: await client.send_message( message.channel, ewutils.formatMessage(message.author, response)) return # process command words if cmd == ewcfg.cmd_kill or cmd == ewcfg.cmd_shoot: return await ewwep.attack(cmd_obj) # Choose your weapon elif cmd == ewcfg.cmd_equip: return await ewwep.equip(cmd_obj) # Kill yourself to return slime to your general. elif cmd == ewcfg.cmd_suicide: return await ewwep.suicide(cmd_obj) # Spar with an ally elif cmd == ewcfg.cmd_spar: return await ewwep.spar(cmd_obj) # Name your current weapon. elif cmd == ewcfg.cmd_annoint: return await ewwep.annoint(cmd_obj) # move from juvenile to one of the armies (rowdys or killers) elif cmd == ewcfg.cmd_enlist: return await ewjuviecmd.enlist(cmd_obj) # gives slime to the miner (message.author) elif cmd == ewcfg.cmd_mine: return await ewjuviecmd.mine(cmd_obj) # Show the current slime score of a player. elif cmd == ewcfg.cmd_score or cmd == ewcfg.cmd_score_alt1: return await ewcmd.score(cmd_obj) # Show a player's combat data. elif cmd == ewcfg.cmd_data: return await ewcmd.data(cmd_obj) #check what time it is, and the weather elif cmd == ewcfg.cmd_time or cmd == ewcfg.cmd_clock or cmd == ewcfg.cmd_weather: return await ewcmd.weather(cmd_obj) # Show the total of negative slime in the world. elif cmd == ewcfg.cmd_negaslime: return await ewspooky.negaslime(cmd_obj) # revive yourself as a juvenile after having been killed. elif cmd == ewcfg.cmd_revive: return await ewspooky.revive(cmd_obj) # Ghosts can haunt enlisted players to reduce their slime score. elif cmd == ewcfg.cmd_haunt: return await ewspooky.haunt(cmd_obj) # Play slime pachinko! elif cmd == ewcfg.cmd_slimepachinko: return await ewcasino.pachinko(cmd_obj) # Toss the dice at slime craps! elif cmd == ewcfg.cmd_slimecraps: return await ewcasino.craps(cmd_obj) # Pull the lever on a slot machine! elif cmd == ewcfg.cmd_slimeslots: return await ewcasino.slots(cmd_obj) # See what's for sale in the Food Court. elif cmd == ewcfg.cmd_menu: return await ewfood.menu(cmd_obj) # Order refreshing food and drinks! elif cmd == ewcfg.cmd_order: return await ewfood.order(cmd_obj) # Transfer slime between players. Shares a cooldown with investments. elif cmd == ewcfg.cmd_transfer or cmd == ewcfg.cmd_transfer_alt1: return await ewmarket.xfer(cmd_obj) # Invest in the slime market! elif cmd == ewcfg.cmd_invest: return await ewmarket.invest(cmd_obj) # Withdraw your investments! elif cmd == ewcfg.cmd_withdraw: return await ewmarket.withdraw(cmd_obj) # Show the current slime market exchange rate (slime per credit). elif cmd == ewcfg.cmd_exchangerate or cmd == ewcfg.cmd_exchangerate_alt1: return await ewmarket.rate(cmd_obj) # Show the player's slime credit. elif cmd == ewcfg.cmd_slimecredit or cmd == ewcfg.cmd_slimecredit_alt1: return await ewmarket.slimecoin(cmd_obj) # faction leader consumes the mentioned players of their own faction to absorb their slime count # kills the mentioned players elif cmd == ewcfg.cmd_devour: return await ewkingpin.devour(cmd_obj) # rowdy f****r and cop killer (leaders) can give slimes to anybody elif cmd == ewcfg.cmd_giveslime or cmd == ewcfg.cmd_giveslime_alt1: return await ewkingpin.giveslime(cmd_obj) # Remove a megaslime (1 mil slime) from a general. elif cmd == ewcfg.cmd_deadmega: return await ewkingpin.deadmega(cmd_obj) # FIXME debug # Test item creation elif cmd == '!create': item_id = ewitem.item_create( item_type='medal', id_user=message.author.id, id_server=message.server.id, item_props={ 'medal_name': 'Test Award', 'medal_desc': '**{medal_name}**: *Awarded to Krak by Krak for testing shit.*' }) ewutils.logMsg('Created item: {}'.format(item_id)) item = EwItem(id_item=item_id) item.item_props['test'] = 'meow' item.persist() item = EwItem(id_item=item_id) await client.send_message( message.channel, ewutils.formatMessage(message.author, ewitem.item_look(item))) # FIXME debug # Test item deletion elif cmd == '!delete': items = ewitem.inventory(id_user=message.author.id, id_server=message.server.id) for item in items: ewitem.item_delete(id_item=item.get('id_item')) await client.send_message( message.channel, ewutils.formatMessage(message.author, 'ok')) # Direct message the player their inventory. elif ewitem.cmd_is_inventory(cmd): return await ewitem.inventory_print(cmd_obj) # !harvest is not a command elif cmd == ewcfg.cmd_harvest: await client.send_message( message.channel, ewutils.formatMessage( message.author, '**HARVEST IS NOT A COMMAND YOU F*****G IDIOT**')) # AWOOOOO elif cmd == ewcfg.cmd_howl or cmd == ewcfg.cmd_howl_alt1 or re_awoo.match( cmd): return await ewcmd.cmd_howl(cmd_obj) # advertise patch notes elif cmd == ewcfg.cmd_patchnotes: await client.send_message( message.channel, ewutils.formatMessage( message.author, 'Look for the latest patchnotes on the news page: https://ew.krakissi.net/news/' )) # advertise help services elif cmd == ewcfg.cmd_help or cmd == ewcfg.cmd_help_alt1 or cmd == ewcfg.cmd_help_alt2: await client.send_message( message.channel, ewutils.formatMessage( message.author, 'Check out the guide for help: https://ew.krakissi.net/guide/' )) # Debug command to override the role of a user elif debug == True and cmd == (ewcfg.cmd_prefix + 'setrole'): resp = await ewcmd.start(cmd=cmd_obj) response = "" if mentions_count == 0: response = 'Set who\'s role?' else: role_target = tokens[1] role = roles_map.get(role_target) if role != None: for user in mentions: await client.replace_roles(user, role) response = 'Done.' else: response = 'Unrecognized role.' await client.edit_message( resp, ewutils.formatMessage(message.author, response)) # didn't match any of the command words. else: resp = await ewcmd.start(cmd=cmd_obj) """ couldn't process the command. bail out!! """ """ bot rule 0: be cute """ randint = random.randint(1, 3) msg_mistake = "ENDLESS WAR is growing frustrated." if randint == 2: msg_mistake = "ENDLESS WAR denies you his favor." elif randint == 3: msg_mistake = "ENDLESS WAR pays you no mind." await asyncio.sleep(1) await client.edit_message(resp, msg_mistake) await asyncio.sleep(2) await client.delete_message(resp) elif content_tolower.find(ewcfg.cmd_howl) >= 0 or content_tolower.find( ewcfg.cmd_howl_alt1) >= 0 or re_awoo.match(content_tolower): """ Howl if !howl is in the message at all. """ return await ewcmd.cmd_howl(ewcmd.EwCmd(message=message, client=client))
async def order(cmd): user_data = EwUser(member=cmd.message.author) market_data = EwMarket(id_server=cmd.message.server.id) poi = ewmap.fetch_poi_if_coordless(cmd.message.channel.name) if poi is None or len(poi.vendors) == 0: # 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: value = ewutils.flattenTokenListToString(cmd.tokens[1:]) #if cmd.tokens_count > 1: # value = cmd.tokens[1] # value = value.lower() # Finds the item if it's an EwGeneralItem. item = ewcfg.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 = ewcfg.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 = ewcfg.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 = ewcfg.furniture_map.get(value) item_type = ewcfg.it_furniture if item != None: item_id = item.id_furniture name = item.str_name if item == None: item = ewcfg.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_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(): 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 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 if poi.is_subzone: district_data = EwDistrict(district=poi.mother_district, id_server=cmd.message.server.id) else: district_data = EwDistrict(district=poi.id_poi, id_server=cmd.message.server.id) if district_data.controlling_faction != "": # prices are halved for the controlling gang if district_data.controlling_faction == user_data.faction: value /= 2 # and 4 times as much for enemy gangsters elif user_data.faction != "": value *= 4 value = int(value) # 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 # Yo, Slimernalia! if item_type == ewcfg.it_food: value = 0 if value > user_data.slimes: # Not enough money. response = "A {} costs {:,} slime, and you only have {:,}.".format( name, value, user_data.slimes) else: if item_type == ewcfg.it_food: food_items = ewitem.inventory( id_user=cmd.message.author.id, id_server=cmd.message.server.id, item_type_filter=ewcfg.it_food) if len(food_items) >= user_data.get_food_capacity(): # user_data never got persisted so the player won't lose money unnecessarily response = "You can't carry any more food than that." return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) elif item_type == ewcfg.it_weapon: weapons_held = ewitem.inventory( id_user=user_data.id_user, id_server=cmd.message.server.id, item_type_filter=ewcfg.it_weapon) has_weapon = False # Thrown weapons are stackable if ewcfg.weapon_class_thrown in item.classes: # Check the player's inventory for the weapon and add amount to stack size. Create a new item the max stack size has been reached for wep in weapons_held: weapon = EwItem(id_item=wep.get("id_item")) if weapon.item_props.get( "weapon_type" ) == item.id_weapon and weapon.stack_size < weapon.stack_max: has_weapon = True weapon.stack_size += 1 weapon.persist() response = "You slam {:,} slime down on the counter at {} for {}.".format( value, current_vendor, item.str_weapon) user_data.change_slimes( n=-value, source=ewcfg.source_spending) user_data.persist() return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage( cmd.message.author, response)) if has_weapon == False: if len(weapons_held ) >= user_data.get_weapon_capacity(): response = "You can't carry any more weapons." return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage( cmd.message.author, response)) elif user_data.life_state == ewcfg.life_state_corpse: response = "Ghosts can't hold weapons." return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage( cmd.message.author, response)) user_data.change_slimes(n=-value, source=ewcfg.source_spending) if company_data is not None: company_data.recent_profits += value company_data.persist() item_props = ewitem.gen_item_props(item) if item.str_name == "arcade cabinet": item_props['furniture_desc'] = random.choice( ewcfg.cabinets_list) ewitem.item_create( item_type=item_type, id_user=cmd.message.author.id, id_server=cmd.message.server.id, stack_max=20 if item_type == ewcfg.it_weapon and ewcfg.weapon_class_thrown in item.classes else -1, stack_size=1 if item_type == ewcfg.it_weapon and ewcfg.weapon_class_thrown in item.classes else 0, item_props=item_props) response = "You slam {:,} slime down on the counter at {} for {}.".format( value, current_vendor, item.str_name) 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def smoke(cmd): usermodel = EwUser(member=cmd.message.author) #item_sought = ewitem.find_item(item_search="cigarette", id_user=cmd.message.author.id, id_server=usermodel.id_server) item_sought = None space_adorned = 0 item_stash = ewitem.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')) if space_adorned < ewutils.max_adornspace_bylevel( usermodel.slimelevel): 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." item.item_props['adorned'] = "true" item.persist() usermodel.persist() await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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() usermodel.persist() else: response = "Sadly, you cannot smoke the cigarette. To smoke it, you'd have to have it inbetween your lips for approximately a minute, which technically counts as adorning something. " \ "And, seeing as you are out of adornable cosmetic space, you cannot do that. Sorry. Weird how this message doesn't show up when you suck all that dick though, huh?" 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']) if space_adorned < ewutils.max_adornspace_bylevel( usermodel.slimelevel): 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." item.item_props['adorned'] = "true" item.persist() usermodel.persist() await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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() usermodel.persist() else: response = "Sadly, you cannot smoke the cigar. To smoke it, you'd have to have it inbetween your lips for approximately a minute, which technically counts as adorning something. " \ "And, seeing as you are out of adornable cosmetic space, you cannot do that. Sorry. Weird how this message doesn't show up when you suck all that dick though, huh?" else: response = "You can't smoke that." else: response = "There aren't any usable cigarettes or cigars in your inventory." return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def adorn(cmd): item_id = ewutils.flattenTokenListToString(cmd.tokens[1:]) try: item_id_int = int(item_id) except: item_id_int = None if item_id != None and len(item_id) > 0: response = "You don't have one." items = ewitem.inventory(id_user=cmd.message.author.id, id_server=cmd.message.server.id, item_type_filter=ewcfg.it_cosmetic) item_sought = None for item in items: if item.get( 'id_item' ) == item_id_int or item_id in ewutils.flattenTokenListToString( item.get('name')): item_sought = item break if item_sought != None: id_item = item_sought.get('id_item') item_def = item_sought.get('item_def') name = item_sought.get('name') item_type = item_sought.get('item_type') adorned_items = 0 for it in items: i = EwItem(it.get('id_item')) if i.item_props['adorned'] == 'true': adorned_items += 1 item = EwItem(id_item=id_item) user_data = EwUser(member=cmd.message.author) if item.item_props['adorned'] == 'true': item.item_props['adorned'] = 'false' response = "You successfully dedorn your " + item.item_props[ 'cosmetic_name'] + "." else: if adorned_items >= math.ceil( user_data.slimelevel / ewcfg.max_adorn_mod): response = "You can't adorn anymore cosmetics." else: item.item_props['adorned'] = 'true' response = "You successfully adorn your " + item.item_props[ 'cosmetic_name'] + "." item.persist() await cmd.client.send_message( cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) else: await cmd.client.send_message( cmd.message.channel, ewutils.formatMessage( cmd.message.author, 'Adorn which cosmetic? Check your **!inventory**.'))
async def on_message(message): time_now = int(time.time()) """ do not interact with our own messages """ if message.author.id == client.user.id or message.author.bot == True: return if message.server != None: # Note that the user posted a message. active_map = active_users_map.get(message.server.id) if active_map == None: active_map = {} active_users_map[message.server.id] = active_map active_map[message.author.id] = True # Update player information. ewplayer.player_update(member=message.author, server=message.server) content_tolower = message.content.lower() re_awoo = re.compile('.*![a]+[w]+o[o]+.*') if message.content.startswith( ewcfg.cmd_prefix) or message.server == None or len( message.author.roles) < 2: """ Wake up if we need to respond to messages. Could be: message starts with ! direct message (server == None) user is new/has no roles (len(roles) < 2) """ # tokenize the message. the command should be the first word. try: tokens = shlex.split( message.content ) # it's split with shlex now because shlex regards text within quotes as a single token except: tokens = message.content.split( ' ' ) # if splitting via shlex doesnt work (odd number of quotes), use the old splitting method so it doesnt give an exception tokens_count = len(tokens) cmd = tokens[0].lower() # remove mentions to us mentions = list( filter(lambda user: user.id != client.user.id, message.mentions)) mentions_count = len(mentions) # Create command object cmd_obj = ewcmd.EwCmd(tokens=tokens, message=message, client=client, mentions=mentions) """ Handle direct messages. """ if message.server == None: # Direct message the player their inventory. if ewitem.cmd_is_inventory(cmd): return await ewitem.inventory_print(cmd_obj) elif cmd == ewcfg.cmd_inspect: return await ewitem.item_look(cmd_obj) # FIXME add this back when the help doc is updated. """ else: time_last = last_helped_times.get(message.author.id, 0) # Only send the help doc once every thirty seconds. There's no need to spam it. if (time_now - time_last) > 30: last_helped_times[message.author.id] = time_now await client.send_message(message.channel, 'Check out the guide for help: https://ew.krakissi.net/guide/') """ # Nothing else to do in a DM. return # assign the appropriate roles to a user with less than @everyone, faction, location if len(message.author.roles) < 3: return await ewrolemgr.updateRoles(client=client, member=message.author) # Scold/ignore offline players. if message.author.status == discord.Status.offline: response = "You cannot participate in the ENDLESS WAR while offline." await client.send_message( message.channel, ewutils.formatMessage(message.author, response)) return # Check the main command map for the requested command. global cmd_map cmd_fn = cmd_map.get(cmd) if cmd_fn != None: # Execute found command return await cmd_fn(cmd_obj) # FIXME debug # Test item creation elif debug == True and cmd == '!createtestitem': item_id = ewitem.item_create( item_type='medal', id_user=message.author.id, id_server=message.server.id, item_props={ 'medal_name': 'Test Award', 'medal_desc': '**{medal_name}**: *Awarded to Krak by Krak for testing shit.*' }) ewutils.logMsg('Created item: {}'.format(item_id)) item = EwItem(id_item=item_id) item.item_props['test'] = 'meow' item.persist() item = EwItem(id_item=item_id) await client.send_message( message.channel, ewutils.formatMessage(message.author, ewitem.item_look(item))) # Creates a poudrin elif debug == True and cmd == '!createpoudrin': item_id = ewitem.item_create(item_type=ewcfg.it_slimepoudrin, id_user=message.author.id, id_server=message.server.id) ewutils.logMsg('Created item: {}'.format(item_id)) item = EwItem(id_item=item_id) item.persist() item = EwItem(id_item=item_id) await client.send_message( message.channel, ewutils.formatMessage(message.author, "Poudrin created.")) # Gives the user some slime elif debug == True and cmd == '!getslime': user_data = EwUser(member=message.author) user_data.change_slimes(n=10000) user_data.persist() await client.send_message( message.channel, ewutils.formatMessage(message.author, "You receive 10,000 slime.")) # FIXME debug # Test item deletion elif debug == True and cmd == '!delete': items = ewitem.inventory(id_user=message.author.id, id_server=message.server.id) for item in items: ewitem.item_delete(id_item=item.get('id_item')) await client.send_message( message.channel, ewutils.formatMessage(message.author, 'ok')) # AWOOOOO elif re_awoo.match(cmd): return await ewcmd.cmd_howl(cmd_obj) # Debug command to override the role of a user elif debug == True and cmd == (ewcfg.cmd_prefix + 'setrole'): response = "" if mentions_count == 0: response = 'Set who\'s role?' else: roles_map = ewutils.getRoleMap(message.server.roles) role_target = tokens[1] role = roles_map.get(role_target) if role != None: for user in mentions: await client.replace_roles(user, role) response = 'Done.' else: response = 'Unrecognized role.' await client.send_message( cmd.message.channel, ewutils.formatMessage(message.author, response)) # didn't match any of the command words. else: """ couldn't process the command. bail out!! """ """ bot rule 0: be cute """ randint = random.randint(1, 3) msg_mistake = "ENDLESS WAR is growing frustrated." if randint == 2: msg_mistake = "ENDLESS WAR denies you his favor." elif randint == 3: msg_mistake = "ENDLESS WAR pays you no mind." msg = await client.send_message(cmd_obj.message.channel, msg_mistake) await asyncio.sleep(2) await client.delete_message(msg) elif content_tolower.find(ewcfg.cmd_howl) >= 0 or content_tolower.find( ewcfg.cmd_howl_alt1) >= 0 or re_awoo.match(content_tolower): """ Howl if !howl is in the message at all. """ return await ewcmd.cmd_howl(ewcmd.EwCmd(message=message, client=client))
async def on_message(message): time_now = int(time.time()) ewcfg.set_client(client) """ do not interact with our own messages """ if message.author.id == client.user.id or message.author.bot == True: return if message.server != None: # Note that the user posted a message. active_map = active_users_map.get(message.server.id) if active_map == None: active_map = {} active_users_map[message.server.id] = active_map active_map[message.author.id] = True # Update player information. ewplayer.player_update( member = message.author, server = message.server ) content_tolower = message.content.lower() re_awoo = re.compile('.*![a]+[w]+o[o]+.*') # update the player's time_last_action which is used for kicking AFK players out of subzones if message.server != None: try: ewutils.execute_sql_query("UPDATE users SET {time_last_action} = %s WHERE id_user = %s AND id_server = %s".format( time_last_action = ewcfg.col_time_last_action ), ( int(time.time()), message.author.id, message.server.id )) except: ewutils.logMsg('server {}: failed to update time_last_action for {}'.format(message.server.id, message.author.id)) user_data = EwUser(member = message.author) statuses = user_data.getStatusEffects() if ewcfg.status_strangled_id in statuses: strangle_effect = EwStatusEffect(id_status=ewcfg.status_strangled_id, user_data=user_data) source = EwPlayer(id_user=strangle_effect.source, id_server=message.server.id) response = "You manage to break {}'s garrote wire!".format(source.display_name) user_data.clear_status(ewcfg.status_strangled_id) return await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) if message.content.startswith(ewcfg.cmd_prefix) or message.server == None or len(message.author.roles) < 2: """ Wake up if we need to respond to messages. Could be: message starts with ! direct message (server == None) user is new/has no roles (len(roles) < 2) """ #Ignore users with weird characters in their name try: message.author.display_name[:3].encode('utf-8').decode('ascii') except UnicodeError: return await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, "We don't take kindly to moon runes around here.")) # tokenize the message. the command should be the first word. try: tokens = shlex.split(message.content) # it's split with shlex now because shlex regards text within quotes as a single token except: tokens = message.content.split(' ') # if splitting via shlex doesnt work (odd number of quotes), use the old splitting method so it doesnt give an exception tokens_count = len(tokens) cmd = tokens[0].lower() if tokens_count >= 1 else "" # remove mentions to us mentions = list(filter(lambda user : user.id != client.user.id, message.mentions)) mentions_count = len(mentions) # Create command object cmd_obj = ewcmd.EwCmd( tokens = tokens, message = message, client = client, mentions = mentions ) """ Handle direct messages. """ if message.server == None: playermodel = ewplayer.EwPlayer(id_user = message.author.id) usermodel = EwUser(id_user=message.author.id, id_server= playermodel.id_server) poi = ewcfg.id_to_poi.get(usermodel.poi) # Direct message the player their inventory. if ewitem.cmd_is_inventory(cmd): return await ewitem.inventory_print(cmd_obj) elif cmd == ewcfg.cmd_inspect: return await ewitem.item_look(cmd_obj) elif poi.is_apartment: return await ewapt.aptCommands(cmd=cmd_obj) else: time_last = last_helped_times.get(message.author.id, 0) # Only send the help doc once every thirty seconds. There's no need to spam it. if (time_now - time_last) > 30: last_helped_times[message.author.id] = time_now await ewutils.send_message(client, message.channel, ewcfg.generic_help_response) # Nothing else to do in a DM. return # assign the appropriate roles to a user with less than @everyone, faction, location if len(message.author.roles) < 3: await ewrolemgr.updateRoles(client = client, member = message.author) user_data = EwUser(member = message.author) if user_data.arrested: return mutations = user_data.get_mutations() # Scold/ignore offline players. if message.author.status == discord.Status.offline: if ewcfg.mutation_id_chameleonskin not in mutations or cmd not in ewcfg.offline_cmds: response = "You cannot participate in the ENDLESS WAR while offline." return await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) if user_data.time_lastoffline > time_now - ewcfg.time_offline: if ewcfg.mutation_id_chameleonskin not in mutations or cmd not in ewcfg.offline_cmds: response = "You are too paralyzed by ENDLESS WAR's judgemental stare to act." return await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) # Ignore stunned players if ewcfg.status_stunned_id in statuses: return # Check the main command map for the requested command. global cmd_map cmd_fn = cmd_map.get(cmd) if user_data.poi in ewcfg.tutorial_pois: return await ewdungeons.tutorial_cmd(cmd_obj) elif cmd_fn != None: # Execute found command return await cmd_fn(cmd_obj) # FIXME debug # Test item creation elif debug == True and cmd == (ewcfg.cmd_prefix + 'createtestitem'): item_id = ewitem.item_create( item_type = 'medal', id_user = message.author.id, id_server = message.server.id, item_props = { 'medal_name': 'Test Award', 'medal_desc': '**{medal_name}**: *Awarded to Krak by Krak for testing shit.*' } ) ewutils.logMsg('Created item: {}'.format(item_id)) item = EwItem(id_item = item_id) item.item_props['test'] = 'meow' item.persist() item = EwItem(id_item = item_id) await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, ewitem.item_look(item))) # Creates a poudrin elif debug == True and cmd == (ewcfg.cmd_prefix + 'createpoudrin'): for item in ewcfg.item_list: if item.context == "poudrin": ewitem.item_create( item_type = ewcfg.it_item, id_user = message.author.id, id_server = message.server.id, item_props = { 'id_item': item.id_item, 'context': item.context, 'item_name': item.str_name, 'item_desc': item.str_desc, } ), ewutils.logMsg('Created item: {}'.format(item.id_item)) item = EwItem(id_item = item.id_item) item.persist() else: pass await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, "Poudrin created.")) # Gives the user some slime elif debug == True and cmd == (ewcfg.cmd_prefix + 'getslime'): user_data = EwUser(member = message.author) user_initial_level = user_data.slimelevel response = "You get 100,000 slime!" levelup_response = user_data.change_slimes(n = 100000) was_levelup = True if user_initial_level < user_data.slimelevel else False if was_levelup: response += " {}".format(levelup_response) user_data.persist() await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) elif debug == True and cmd == (ewcfg.cmd_prefix + 'getcoin'): user_data = EwUser(member=message.author) user_data.change_slimecoin(n=1000000000, coinsource=ewcfg.coinsource_spending) response = "You get 1,000,000,000 slimecoin!" user_data.persist() await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) # Deletes all items in your inventory. elif debug == True and cmd == (ewcfg.cmd_prefix + 'clearinv'): user_data = EwUser(member = message.author) ewitem.item_destroyall(id_server = message.server.id, id_user = message.author.id) response = "You destroy every single item in your inventory." user_data.persist() await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) elif debug == True and cmd == (ewcfg.cmd_prefix + 'createapple'): item_id = ewitem.item_create( id_user = message.author.id, id_server = message.server.id, item_type = ewcfg.it_food, item_props = { 'id_food': "direapples", 'food_name': "Dire Apples", 'food_desc': "This sure is a illegal Dire Apple!", 'recover_hunger': 500, 'str_eat': "You chomp into this illegal Dire Apple.", 'time_expir': int(time.time() + ewcfg.farm_food_expir) } ) ewutils.logMsg('Created item: {}'.format(item_id)) item = EwItem(id_item = item_id) item.item_props['test'] = 'meow' item.persist() await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, "Apple created.")) elif debug == True and cmd == (ewcfg.cmd_prefix + 'createhat'): patrician_rarity = 20 patrician_smelted = random.randint(1, patrician_rarity) patrician = False if patrician_smelted == 1: patrician = True items = [] for cosmetic in ewcfg.cosmetic_items_list: if patrician and cosmetic.rarity == ewcfg.rarity_patrician: items.append(cosmetic) elif not patrician and cosmetic.rarity == ewcfg.rarity_plebeian: items.append(cosmetic) item = items[random.randint(0, len(items) - 1)] item_id = ewitem.item_create( item_type = ewcfg.it_cosmetic, id_user = message.author.id, id_server = message.server.id, item_props = { 'id_cosmetic': item.id_cosmetic, 'cosmetic_name': item.str_name, 'cosmetic_desc': item.str_desc, 'rarity': item.rarity, 'adorned': 'false' } ) ewutils.logMsg('Created item: {}'.format(item_id)) item = EwItem(id_item = item_id) item.item_props['test'] = 'meow' item.persist() await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, "Hat created.")) elif debug == True and cmd == (ewcfg.cmd_prefix + 'createfood'): item = ewcfg.food_list[random.randint(0, len(ewcfg.food_list) - 1)] item_id = ewitem.item_create( item_type = ewcfg.it_food, id_user = message.author.id, id_server = message.server.id, item_props = { 'id_food': item.id_food, 'food_name': item.str_name, 'food_desc': item.str_desc, 'recover_hunger': item.recover_hunger, 'str_eat': item.str_eat, 'time_expir': item.time_expir } ) ewutils.logMsg('Created item: {}'.format(item_id)) item = EwItem(id_item = item_id) item.item_props['test'] = 'meow' item.persist() await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, "Food created.")) # FIXME debug # Test item deletion elif debug == True and cmd == (ewcfg.cmd_prefix + 'delete'): items = ewitem.inventory( id_user = message.author.id, id_server = message.server.id ) for item in items: ewitem.item_delete( id_item = item.get('id_item') ) await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, 'ok')) # AWOOOOO elif re_awoo.match(cmd): return await ewcmd.cmd_howl(cmd_obj) # Debug command to override the role of a user elif debug == True and cmd == (ewcfg.cmd_prefix + 'setrole'): response = "" if mentions_count == 0: response = 'Set who\'s role?' else: roles_map = ewutils.getRoleMap(message.server.roles) role_target = tokens[1] role = roles_map.get(role_target) if role != None: for user in mentions: try: await client.replace_roles(user, role) except: ewutils.logMsg('Failed to replace_roles for user {} with {}.'.format(user.display_name, role.name)) response = 'Done.' else: response = 'Unrecognized role.' await ewutils.send_message(client, cmd.message.channel, ewutils.formatMessage(message.author, response)) elif debug == True and cmd == (ewcfg.cmd_prefix + 'getrowdy'): response = "You get rowdy. F**k. YES!" user_data = EwUser(member=message.author) user_data.life_state = ewcfg.life_state_enlisted user_data.faction = ewcfg.faction_rowdys user_data.time_lastenlist = time_now + ewcfg.cd_enlist user_data.persist() await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) elif debug == True and cmd == (ewcfg.cmd_prefix + 'getkiller'): response = "You uh... 'get' killer. Sure." user_data = EwUser(member=message.author) user_data.life_state = ewcfg.life_state_enlisted user_data.faction = ewcfg.faction_killers user_data.time_lastenlist = time_now + ewcfg.cd_enlist user_data.persist() await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) # Toggles rain on and off elif debug == True and cmd == (ewcfg.cmd_prefix + 'toggledownfall'): market_data = EwMarket(id_server=message.server.id) if market_data.weather == ewcfg.weather_bicarbonaterain: newweather = ewcfg.weather_sunny market_data.weather = newweather response = "Bicarbonate rain turned OFF. Weather was set to {}.".format(newweather) else: market_data.weather = ewcfg.weather_bicarbonaterain response = "Bicarbonate rain turned ON." market_data.persist() await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) elif debug == True and cmd == (ewcfg.cmd_prefix + 'dayforward'): market_data = EwMarket(id_server=message.server.id) market_data.day += 1 market_data.persist() response = "Time has progressed 1 day forward manually." if ewutils.check_fursuit_active(market_data.id_server): response += "\nIt's a full moon!" await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) elif debug == True and cmd == (ewcfg.cmd_prefix + 'hourforward'): market_data = EwMarket(id_server=message.server.id) market_data.clock += 1 response = "Time has progressed 1 hour forward manually." if market_data.clock >= 24 or market_data.clock < 0: market_data.clock = 0 market_data.day += 1 response += "\nMidnight has come. 1 day progressed forward." if ewutils.check_fursuit_active(market_data.id_server): response += "\nIt's a full moon!" market_data.persist() await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response)) # didn't match any of the command words. else: """ couldn't process the command. bail out!! """ """ bot rule 0: be cute """ randint = random.randint(1,3) msg_mistake = "ENDLESS WAR is growing frustrated." if randint == 2: msg_mistake = "ENDLESS WAR denies you his favor." elif randint == 3: msg_mistake = "ENDLESS WAR pays you no mind." msg = await ewutils.send_message(client, cmd_obj.message.channel, msg_mistake) await asyncio.sleep(2) try: await client.delete_message(msg) except: pass elif content_tolower.find(ewcfg.cmd_howl) >= 0 or content_tolower.find(ewcfg.cmd_howl_alt1) >= 0 or re_awoo.match(content_tolower): """ Howl if !howl is in the message at all. """ return await ewcmd.cmd_howl(ewcmd.EwCmd( message = message, client = client ))
async def embiggen(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 ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) market_data = EwMarket(id_server = user_data.id_server) item_search = ewutils.flattenTokenListToString(cmd.tokens[1:]) item_sought = ewitem.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 cmd.message.channel.name != ewcfg.channel_slimeoidlab: response = "How are you going to embiggen your fish on the side of the street? You’ve got to see a professional for this, man. Head to the SlimeCorp Laboratory, they’ve got dozens of modern day magic potions ‘n shit over there." elif item_sought: poi = ewcfg.id_to_poi.get(user_data.poi) district_data = EwDistrict(district = poi.id_poi, id_server = user_data.id_server) 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 ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) name = item_sought.get('name') fish = EwItem(id_item = item_sought.get('id_item')) acquisition = fish.item_props.get('acquisition') if fish.item_props.get('id_furniture') == "singingfishplaque": poudrins_owned = ewitem.find_item_all(item_search="slimepoudrin", id_user=user_data.id_user, id_server=user_data.id_server, item_type_filter=ewcfg.it_item) poudrin_amount = len(poudrins_owned) if poudrin_amount < 2: response = "You don't have the poudrins for it." else: for delete in range(2): poudrin = poudrins_owned.pop() ewitem.item_delete(id_item = poudrin.get("id_item")) fish.item_props['id_furniture'] = "colossalsingingfishplaque" fish.item_props['furniture_look_desc'] = "There's a fake fish mounted on the wall. Hoo boy, it's a whopper." fish.item_props['furniture_place_desc'] = "You take a nail gun to the wall to force it to hold this fish. Christ, this thing is your f*****g Ishmael. Er, Moby Dick. Whatever." fish.item_props['furniture_name'] = "colossal singing fish plaque" fish.item_props['furniture_desc'] = "You press the button on your gigantic plaque.\n***" + fish.item_props.get('furniture_desc')[38:-87].upper().replace(":NOTES:", ":notes:") + "***\nYou abruptly turn the fish off before you rupture an eardrum." fish.persist() response = "The elevator ride down to the embiggening ward feels like an eterninty. Are they going to find out the fish you're embiggening is fake? God, you hope not. But eventually, you make it down, and place the plaque in the usual reclined surgeon's chair. A stray spark from one of the defibrilators nearly gives you a heart attack. But even so, the embiggening process begins like usual. You sign the contract, and they take a butterfly needle to your beloved wall prop. And sure enough, it begins to grow. You hear the sounds of cracked plastic and grinding electronics, and catch a whiff of burnt wires. It's growing. It's 6 feet, no, 10 feet long. Good god. You were hoping for growth, but science has gone too far. Eventually, it stops. Although you raise a few eyebrows with ths anomaly, you still get back the colossal fish plaque without a hitch." elif acquisition != ewcfg.acquisition_fishing: response = "You can only embiggen fishes, dummy. Otherwise everyone would be walking around with colossal nunchucks and huge chicken buckets. Actually, that gives me an idea..." else: size = fish.item_props.get('size') poudrin_cost = 0 if size == ewcfg.fish_size_miniscule: poudrin_cost = 2 if size == ewcfg.fish_size_small: poudrin_cost = 4 if size == ewcfg.fish_size_average: poudrin_cost = 8 if size == ewcfg.fish_size_big: poudrin_cost = 16 if size == ewcfg.fish_size_huge: poudrin_cost = 32 poudrins_owned = ewitem.find_item_all(item_search = "slimepoudrin", id_user = user_data.id_user, id_server = user_data.id_server, item_type_filter = ewcfg.it_item) poudrin_amount = len(poudrins_owned) if poudrin_cost == 0: response = "Your {} is already as colossal as a fish can get!".format(name) elif poudrin_amount < poudrin_cost: response = "You need {} poudrins to embiggen your {}, but you only have {}!!".format(poudrin_cost, name, poudrin_amount) else: if size == ewcfg.fish_size_miniscule: fish.item_props['size'] = ewcfg.fish_size_small if size == ewcfg.fish_size_small: fish.item_props['size'] = ewcfg.fish_size_average if size == ewcfg.fish_size_average: fish.item_props['size'] = ewcfg.fish_size_big if size == ewcfg.fish_size_big: fish.item_props['size'] = ewcfg.fish_size_huge if size == ewcfg.fish_size_huge: fish.item_props['size'] = ewcfg.fish_size_colossal fish.persist() for delete in range(poudrin_cost): poudrin = poudrins_owned.pop() ewitem.item_delete(id_item = poudrin.get("id_item")) market_data.donated_poudrins += poudrin_cost market_data.persist() user_data.poudrin_donations += poudrin_cost user_data.persist() response = "After several minutes long elevator descents, in the depths of some basement level far below the laboratory's lobby, you lay down your {} on a reclined medical chair. A SlimeCorp employee finishes the novel length terms of service they were reciting and asks you if you have any questions. You weren’t listening so you just tell them to get on with it so you can go back to haggling prices with Captain Albert Alexander. They oblige.\nThey grab a butterfly needle and carefully stab your fish with it, injecting filled with some bizarre, multi-colored serum you’ve never seen before. Sick, it’s bigger now!!".format(name) else: if item_search: # If they didn't forget to specify an item and it just wasn't found. response = "You don't have one." else: response = "Embiggen which fish? (check **!inventory**)" await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))