async def reroll_last_mutation(cmd): last_mutation_counter = -1 last_mutation = "" user_data = EwUser(member = cmd.message.author) market_data = EwMarket(id_server = user_data.id_server) response = "" if cmd.message.channel.name != ewcfg.channel_slimeoidlab: response = "You require the advanced equipment at the Slimeoid Lab to modify your mutations." return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) if user_data.life_state == ewcfg.life_state_corpse: response = "How do you expect to mutate without exposure to slime, dumbass?" return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) mutations = user_data.get_mutations() if len(mutations) == 0: response = "You have not developed any specialized mutations yet." return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) for id_mutation in mutations: mutation_data = EwMutation(id_server = user_data.id_server, id_user = user_data.id_user, id_mutation = id_mutation) if mutation_data.mutation_counter > last_mutation_counter: last_mutation_counter = mutation_data.mutation_counter last_mutation = id_mutation reroll_fatigue = EwStatusEffect(id_status = ewcfg.status_rerollfatigue_id, user_data = user_data) poudrins_needed = 2 ** int(reroll_fatigue.value) poudrins = ewitem.find_item_all(item_search = ewcfg.item_id_slimepoudrin, id_user = cmd.message.author.id, id_server = cmd.message.server.id if cmd.message.server is not None else None, item_type_filter = ewcfg.it_item) poudrins_have = len(poudrins) if poudrins_have < poudrins_needed: response = "You need {} slime poudrin{} to replace a mutation, but you only have {}.".format(poudrins_needed, "" if poudrins_needed == 1 else "s", poudrins_have) return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) else: for delete in range(poudrins_needed): ewitem.item_delete(id_item = poudrins.pop(0).get('id_item')) # Remove Poudrins market_data.donated_poudrins += poudrins_needed market_data.persist() user_data.poudrin_donations += poudrins_needed user_data.persist() reroll_fatigue.value = int(reroll_fatigue.value) + 1 reroll_fatigue.persist() mutation_data = EwMutation(id_server = user_data.id_server, id_user = user_data.id_user, id_mutation = last_mutation) new_mutation = random.choice(list(ewcfg.mutation_ids)) while new_mutation in mutations: new_mutation = random.choice(list(ewcfg.mutation_ids)) mutation_data.id_mutation = new_mutation mutation_data.time_lastuse = int(time.time()) mutation_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 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 getting slime. They oblige.\nThey grab a butterfly needle and carefully stab you with it, draining some strangely colored slime from your bloodstream. Almost immediately, the effects of your last mutation fade away… but, this feeling of respite is fleeting. The SlimeCorp employee writes down a few notes, files away the freshly drawn sample, and soon enough you are stabbed with syringes. This time, it’s already filled with some bizarre, multi-colored serum you’ve never seen before. The effects are instantaneous. {}\nYou hand off {} of your hard-earned poudrins to the SlimeCorp employee for their troubles.".format(ewcfg.mutations_map[new_mutation].str_acquire, poudrins_needed) return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def clear_mutations(cmd): user_data = EwUser(member = cmd.message.author) market_data = EwMarket(id_server = user_data.id_server) response = "" if cmd.message.channel.name != ewcfg.channel_slimeoidlab: response = "You require the advanced equipment at the Slimeoid Lab to modify your mutations." return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) if user_data.life_state == ewcfg.life_state_corpse: response = "How do you expect to mutate without exposure to slime, dumbass?" return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) mutations = user_data.get_mutations() if len(mutations) == 0: response = "You have not developed any specialized mutations yet." return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) poudrin = ewitem.find_item(item_search = "slimepoudrin", id_user = cmd.message.author.id, id_server = cmd.message.server.id if cmd.message.server is not None else None, item_type_filter = ewcfg.it_item) if poudrin == None: response = "You need a slime poudrin to replace a mutation." return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) else: ewitem.item_delete(id_item = poudrin.get('id_item')) # Remove Poudrins market_data.donated_poudrins += 1 market_data.persist() user_data.poudrin_donations += 1 user_data.persist() user_data.clear_mutations() response = "After several minutes long elevator descents, in the depths of some basement level far below the laboratory's lobby, you lay down 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 getting slime. They oblige.\nThey grab a random used syringe with just a dash of black serum still left inside it. They carefully stab you with it, injecting the mystery formula into your bloodstream. Almost immediately, normalcy returns to your inherently abnormal life… your body returns to whatever might be considered normal for your species. You hand off one of your hard-earned poudrins to the SlimeCorp employee for their troubles." return 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 revive(cmd): time_now = int(time.time()) response = "" if cmd.message.channel.name != ewcfg.channel_endlesswar and cmd.message.channel.name != ewcfg.channel_sewers: response = "Come to me. I hunger. #{}.".format(ewcfg.channel_sewers) else: player_data = EwUser(member=cmd.message.author) time_until_revive = (player_data.time_lastdeath + player_data.degradation) - time_now if time_until_revive > 0: response = "ENDLESS WAR is not ready to {} you yet ({}s).".format( cmd.tokens[0], time_until_revive) return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) slimeoid = EwSlimeoid(member=cmd.message.author) if player_data.life_state == ewcfg.life_state_corpse: market_data = EwMarket(id_server=cmd.message.server.id) # Endless War collects his fee. #fee = (player_data.slimecoin / 10) #player_data.change_slimecoin(n = -fee, coinsource = ewcfg.coinsource_revival) #market_data.slimes_revivefee += fee #player_data.busted = False # Preserve negaslime if player_data.slimes < 0: #market_data.negaslime += player_data.slimes player_data.change_slimes(n=-player_data.slimes) # set to 0 # reset slimelevel to zero player_data.slimelevel = 0 # Set time of last revive. This used to provied spawn protection, but currently isn't used. player_data.time_lastrevive = time_now if player_data.degradation >= 100: player_data.life_state = ewcfg.life_state_shambler player_data.change_slimes(n=0.5 * ewcfg.slimes_shambler) player_data.trauma = "" poi_death = ewcfg.id_to_poi.get(player_data.poi_death) if ewmap.inaccessible(poi=poi_death, user_data=player_data): player_data.poi = ewcfg.poi_id_downtown else: player_data.poi = poi_death.id_poi else: # Set life state. This is what determines whether the player is actually alive. player_data.life_state = ewcfg.life_state_juvenile # Give player some initial slimes. player_data.change_slimes(n=ewcfg.slimes_onrevive) # Get the player out of the sewers. player_data.poi = ewcfg.poi_id_downtown player_data.persist() market_data.persist() # Shower every district in the city with slime from the sewers. sewer_data = EwDistrict(district=ewcfg.poi_id_thesewers, id_server=cmd.message.server.id) # the amount of slime showered is divided equally amongst the districts districts_amount = len(ewcfg.capturable_districts) geyser_amount = int(0.5 * sewer_data.slimes / districts_amount) # Get a list of all the districts for poi in ewcfg.capturable_districts: district_data = EwDistrict(district=poi, id_server=cmd.message.server.id) district_data.change_slimes(n=geyser_amount) sewer_data.change_slimes(n=-1 * geyser_amount) district_data.persist() sewer_data.persist() sewer_inv = ewitem.inventory(id_user=sewer_data.name, id_server=sewer_data.id_server) for item in sewer_inv: district = ewcfg.poi_id_slimesea if random.random() < 0.5: district = random.choice(ewcfg.capturable_districts) ewitem.give_item(id_item=item.get("id_item"), id_user=district, id_server=sewer_data.id_server) await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) response = '{slime4} Geysers of fresh slime erupt from every manhole in the city, showering their surrounding districts. {slime4} {name} has been reborn in slime. {slime4}'.format( slime4=ewcfg.emote_slime4, name=cmd.message.author.display_name) else: response = 'You\'re not dead just yet.' # deathreport = "You were {} by {}. {}".format(kill_descriptor, cmd.message.author.display_name, ewcfg.emote_slimeskull) # deathreport = "{} ".format(ewcfg.emote_slimeskull) + ewutils.formatMessage(member, deathreport) if slimeoid.life_state == ewcfg.slimeoid_state_active: reunite = "" brain = ewcfg.brain_map.get(slimeoid.ai) reunite += brain.str_revive.format(slimeoid_name=slimeoid.name) new_poi = ewcfg.id_to_poi.get(player_data.poi) revivechannel = ewutils.get_channel(cmd.message.server, new_poi.channel) reunite = ewutils.formatMessage(cmd.message.author, reunite) await ewutils.send_message(cmd.client, revivechannel, reunite) # Send the response to the player. await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def summon_negaslimeoid(cmd): response = "" user_data = EwUser(member=cmd.message.author) if user_data.life_state != ewcfg.life_state_corpse: response = "Only the dead have the occult knowledge required to summon a cosmic horror." return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) if user_data.poi not in ewcfg.capturable_districts: response = "You can't conduct the ritual here." return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) name = None if cmd.tokens_count > 1: #value = ewutils.getIntToken(tokens = cmd.tokens, allow_all = True, negate = True) slimeoid = EwSlimeoid(member=cmd.message.author, sltype=ewcfg.sltype_nega) if slimeoid.life_state != ewcfg.slimeoid_state_none: response = "You already have an active negaslimeoid." return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) negaslimeoid_name = cmd.message.content[(len(cmd.tokens[0])):].strip() if len(negaslimeoid_name) > 32: response = "That name is too long. ({:,}/32)".format( len(negaslimeoid_name)) return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) market_data = EwMarket(id_server=cmd.message.author.server.id) if market_data.negaslime >= 0: response = "The dead haven't amassed any negaslime yet." else: max_level = min( len(str(user_data.slimes)) - 1, len(str(market_data.negaslime)) - 1) level = random.randint(1, max_level) value = 10**(level - 1) #user_data.change_slimes(n = int(value/10)) market_data.negaslime += value slimeoid.sltype = ewcfg.sltype_nega slimeoid.life_state = ewcfg.slimeoid_state_active slimeoid.level = level slimeoid.id_user = user_data.id_user slimeoid.id_server = user_data.id_server slimeoid.poi = user_data.poi slimeoid.name = negaslimeoid_name slimeoid.body = random.choice(ewcfg.body_names) slimeoid.head = random.choice(ewcfg.head_names) slimeoid.legs = random.choice(ewcfg.mobility_names) slimeoid.armor = random.choice(ewcfg.defense_names) slimeoid.weapon = random.choice(ewcfg.offense_names) slimeoid.special = random.choice(ewcfg.special_names) slimeoid.ai = random.choice(ewcfg.brain_names) for i in range(level): rand = random.randrange(3) if rand == 0: slimeoid.atk += 1 elif rand == 1: slimeoid.defense += 1 else: slimeoid.intel += 1 user_data.persist() slimeoid.persist() market_data.persist() response = "You have summoned **{}**, a {}-foot-tall Negaslimeoid.".format( slimeoid.name, slimeoid.level) desc = ewslimeoid.slimeoid_describe(slimeoid) response += desc else: response = "To summon a negaslimeoid you must first know its name." await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def mill(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) # Checking availability of milling if user_data.life_state != ewcfg.life_state_juvenile: response = "Only Juveniles of pure heart and with nothing better to do can mill their vegetables." elif user_data.poi not in [ ewcfg.poi_id_jr_farms, ewcfg.poi_id_og_farms, ewcfg.poi_id_ab_farms ]: response = "Alas, there doesn’t seem to be an official SlimeCorp milling station anywhere around here. Probably because you’re in the middle of the f*****g city. Try looking where you reaped your vegetable in the first place, dumbass." elif user_data.slimes < ewcfg.slimes_permill: response = "It costs {} to !mill, and you only have {}.".format( ewcfg.slimes_permill, user_data.slimes) elif item_sought: items = [] vegetable = EwItem(id_item=item_sought.get('id_item')) for result in ewcfg.mill_results: if result.ingredients != vegetable.item_props.get('id_food'): pass else: items.append(result) if len(items) > 0: item = random.choice(items) item_props = ewitem.gen_item_props(item) 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 walk up to the official SlimeCorp Milling Station and shove your irradiated produce into the hand-crank. You painfully grip the needle-covered crank handle, dripping {} slime into a small compartment on the device’s side which supposedly fuels it. You begin slowly churning them into a glorious, pastry goo. As the goo tosses and turns inside the machine, it solidifies, and after a few moments a {} pops out!".format( ewcfg.slimes_permill, item.str_name) market_data.donated_slimes += ewcfg.slimes_permill market_data.persist() ewitem.item_delete(id_item=item_sought.get('id_item')) user_data.change_slimes(n=-ewcfg.slimes_permill, source=ewcfg.source_spending) user_data.slime_donations += ewcfg.slimes_permill user_data.persist() else: response = "You can only mill fresh vegetables! SlimeCorp obviously wants you to support local farmers." 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 = "Mill which item? (check **!inventory**)" await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def haunt(cmd): time_now = int(time.time()) response = "" resp_cont = ewutils.EwResponseContainer(id_server=cmd.message.server.id) if cmd.mentions_count > 1: response = "You can only spook one person at a time. Who do you think you are, the Lord of Ghosts?" elif cmd.mentions_count == 1: # Get the user and target data from the database. user_data = EwUser(member=cmd.message.author) member = cmd.mentions[0] haunted_data = EwUser(member=member) market_data = EwMarket(id_server=cmd.message.server.id) target_isshambler = haunted_data.life_state == ewcfg.life_state_shambler if user_data.life_state != ewcfg.life_state_corpse: # Only dead players can haunt. response = "You can't haunt now. Try {}.".format(ewcfg.cmd_suicide) elif haunted_data.life_state == ewcfg.life_state_kingpin: # Disallow haunting of generals. response = "He is too far from the sewers in his ivory tower, and thus cannot be haunted." elif (time_now - user_data.time_lasthaunt) < ewcfg.cd_haunt: # Disallow haunting if the user has haunted too recently. response = "You're being a little TOO spooky lately, don't you think? Try again in {} seconds.".format( int(ewcfg.cd_haunt - (time_now - user_data.time_lasthaunt))) elif ewmap.channel_name_is_poi(cmd.message.channel.name) == False: response = "You can't commit violence from here." elif time_now > haunted_data.time_expirpvp and not target_isshambler: # Require the target to be flagged for PvP response = "{} is not mired in the ENDLESS WAR right now.".format( member.display_name) elif haunted_data.life_state == ewcfg.life_state_corpse: # Dead players can't be haunted. response = "{} is already dead.".format(member.display_name) elif haunted_data.life_state == ewcfg.life_state_grandfoe: # Grand foes can't be haunted. response = "{} is invulnerable to ghosts.".format( member.display_name) elif haunted_data.life_state == ewcfg.life_state_enlisted or haunted_data.life_state == ewcfg.life_state_juvenile or haunted_data.life_state == ewcfg.life_state_shambler: # Target can be haunted by the player. haunted_slimes = int(haunted_data.slimes / ewcfg.slimes_hauntratio) # if user_data.poi == haunted_data.poi: # when haunting someone face to face, there is no cap and you get double the amount # haunted_slimes *= 2 if haunted_slimes > ewcfg.slimes_hauntmax: haunted_slimes = ewcfg.slimes_hauntmax #if -user_data.slimes < haunted_slimes: # cap on for how much you can haunt # haunted_slimes = -user_data.slimes haunted_data.change_slimes(n=-haunted_slimes, source=ewcfg.source_haunted) user_data.change_slimes(n=-haunted_slimes, source=ewcfg.source_haunter) market_data.negaslime -= haunted_slimes user_data.time_lasthaunt = time_now user_data.busted = False user_data.time_expirpvp = ewutils.calculatePvpTimer( user_data.time_expirpvp, (int(time.time()) + ewcfg.time_pvp_attack)) resp_cont.add_member_to_update(cmd.message.author) # Persist changes to the database. user_data.persist() haunted_data.persist() market_data.persist() response = "{} has been haunted by the ghost of {}! Slime has been lost!".format( member.display_name, cmd.message.author.display_name) haunted_channel = ewcfg.id_to_poi.get(haunted_data.poi).channel haunt_message = "You feel a cold shiver run down your spine" if cmd.tokens_count > 2: haunt_message_content = re.sub( "<.+>", "", cmd.message.content[(len(cmd.tokens[0])):]).strip() # Cut down really big messages so discord doesn't crash if len(haunt_message_content) > 500: haunt_message_content = haunt_message_content[:-500] haunt_message += " and faintly hear the words \"{}\"".format( haunt_message_content) haunt_message += "." haunt_message = ewutils.formatMessage(member, haunt_message) resp_cont.add_channel_response(haunted_channel, haunt_message) else: # Some condition we didn't think of. response = "You cannot haunt {}.".format(member.display_name) else: # No mentions, or mentions we didn't understand. response = "Your spookiness is appreciated, but ENDLESS WAR didn\'t understand that name." # Send the response to the player. resp_cont.add_channel_response(cmd.message.channel.name, response) await resp_cont.post()
async def mill(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, item_type_filter=ewcfg.it_food) # Checking availability of milling if user_data.life_state != ewcfg.life_state_juvenile: response = "Only Juveniles of pure heart and with nothing better to do can mill their vegetables." elif cmd.message.channel.name not in [ewcfg.channel_jr_farms, ewcfg.channel_og_farms, ewcfg.channel_ab_farms]: response = "Alas, there doesn’t seem to be an official SlimeCorp milling station anywhere around here. Probably because you’re in the middle of the f*****g city. Try looking where you reaped your vegetable in the first place, dumbass." # elif user_data.slimes < ewcfg.slimes_permill: # response = "It costs {} to !mill, and you only have {}.".format(ewcfg.slimes_permill, user_data.slimes) 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)) items = [] vegetable = EwItem(id_item = item_sought.get('id_item')) for result in ewcfg.mill_results: if type(result.ingredients) == str: if vegetable.item_props.get('id_food') != result.ingredients: pass else: items.append(result) elif type(result.ingredients) == list: if vegetable.item_props.get('id_food') not in result.ingredients: pass else: items.append(result) if len(items) > 0: item = random.choice(items) item_props = ewitem.gen_item_props(item) ewitem.item_create( item_type = item.item_type, id_user = cmd.message.author.id, id_server = cmd.guild.id, item_props = item_props ) response = "You walk up to the official ~~SlimeCorp~~ Garden Gankers Milling Station and shove your irradiated produce into the hand-crank. You begin slowly churning them into a glorious, pastry goo. As the goo tosses and turns inside the machine, it solidifies, and after a few moments a {} pops out!".format(item.str_name) #market_data.donated_slimes += ewcfg.slimes_permill market_data.persist() ewitem.item_delete(id_item = item_sought.get('id_item')) #user_data.change_slimes(n = -ewcfg.slimes_permill, source = ewcfg.source_spending) #user_data.slime_donations += ewcfg.slimes_permill user_data.persist() else: response = "You can only mill fresh vegetables! SlimeCorp obviously wants you to support local farmers." 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 = "Mill which item? (check **!inventory**)" await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def haunt(cmd): time_now = int(time.time()) response = "" resp_cont = ewutils.EwResponseContainer(id_server = cmd.guild.id) if cmd.mentions_count > 1: response = "You can only spook one person at a time. Who do you think you are, the Lord of Ghosts?" else: haunted_data = None member = None if cmd.mentions_count == 0 and cmd.tokens_count > 1: server = cmd.guild member = server.get_member(ewutils.getIntToken(cmd.tokens)) haunted_data = EwUser(member = member) elif cmd.mentions_count == 1: member = cmd.mentions[0] haunted_data = EwUser(member = member) if member: # Get the user and target data from the database. user_data = EwUser(member = cmd.message.author) market_data = EwMarket(id_server = cmd.guild.id) target_mutations = haunted_data.get_mutations() target_poi = ewcfg.id_to_poi.get(haunted_data.poi) target_is_shambler = haunted_data.life_state == ewcfg.life_state_shambler target_is_inhabitted = haunted_data.id_user == user_data.get_inhabitee() if user_data.life_state != ewcfg.life_state_corpse: # Only dead players can haunt. response = "You can't haunt now. Try {}.".format(ewcfg.cmd_suicide) elif haunted_data.life_state == ewcfg.life_state_kingpin: # Disallow haunting of generals. response = "He is too far from the sewers in his ivory tower, and thus cannot be haunted." elif (time_now - user_data.time_lasthaunt) < ewcfg.cd_haunt: # Disallow haunting if the user has haunted too recently. response = "You're being a little TOO spooky lately, don't you think? Try again in {} seconds.".format(int(ewcfg.cd_haunt-(time_now-user_data.time_lasthaunt))) elif ewutils.channel_name_is_poi(cmd.message.channel.name) == False: response = "You can't commit violence from here." elif target_poi.pvp == False: #Require the target to be in a PvP area, and flagged if it's a remote haunt response = "{} is not mired in the ENDLESS WAR right now.".format(member.display_name) elif haunted_data.life_state == ewcfg.life_state_corpse: # Dead players can't be haunted. response = "{} is already dead.".format(member.display_name) elif haunted_data.life_state == ewcfg.life_state_grandfoe: # Grand foes can't be haunted. response = "{} is invulnerable to ghosts.".format(member.display_name) elif haunted_data.life_state == ewcfg.life_state_enlisted or haunted_data.life_state == ewcfg.life_state_juvenile or haunted_data.life_state == ewcfg.life_state_shambler: haunt_power_multiplier = 1 # power to the ancients ghost_age = time_now - user_data.time_lastdeath if ghost_age > 60 * 60 * 24 * 7: # dead for longer than if ghost_age > 60 * 60 * 24 * 365: # one friggin year haunt_power_multiplier *= 2.5 if ghost_age > 60 * 60 * 24 * 90: # three months haunt_power_multiplier *= 2 elif ghost_age > 60 * 60 * 24 * 30: # one month haunt_power_multiplier *= 1.5 else: # one week haunt_power_multiplier *= 1.25 # vitriol as virtue list_ids = [] for quadrant in ewcfg.quadrant_ids: quadrant_data = ewquadrants.EwQuadrant(id_server=cmd.guild.id, id_user=cmd.message.author.id, quadrant=quadrant) if quadrant_data.id_target != -1 and quadrant_data.check_if_onesided() is False: list_ids.append(quadrant_data.id_target) if quadrant_data.id_target2 != -1 and quadrant_data.check_if_onesided() is False: list_ids.append(quadrant_data.id_target2) if haunted_data.id_user in list_ids: # any mutual quadrants haunt_power_multiplier *= 1.2 if haunted_data.faction and ((not user_data.faction) or (user_data.faction != haunted_data.faction)): # opposite faction (or no faction at all) haunt_power_multiplier *= 1.2 if user_data.id_killer == haunted_data.id_user: # haunting your murderer/buster haunt_power_multiplier *= 1.2 # places of power. if haunted_data.poi in [ewcfg.poi_id_thevoid, ewcfg.poi_id_wafflehouse, ewcfg.poi_id_blackpond]: haunt_power_multiplier *= 2 elif haunted_data.poi in ewmap.get_void_connection_pois(cmd.guild.id): haunt_power_multiplier *= 1.25 # glory to the vanquished target_kills = ewstats.get_stat(user = haunted_data, metric = ewcfg.stat_kills) if target_kills > 5: haunt_power_multiplier *= 1.25 + ((target_kills - 5) / 100) # 1% per kill after 5 else: haunt_power_multiplier *= 1 + (target_kills * 5 / 100) # 5% per kill if time_now - haunted_data.time_lastkill < (60 * 15): haunt_power_multiplier *= 1.5 # wet hands # misc if ewcfg.weather_map.get(market_data.weather) == ewcfg.weather_foggy: haunt_power_multiplier *= 1.1 if not haunted_data.has_soul: haunt_power_multiplier *= 1.2 # uncomment this after moon mechanics update # if (market_data.day % 31 == 15 and market_data.clock >= 20) or (market_data.day % 31 == 16 and market_data.clock <= 6): # haunt_power_multiplier *= 2 # divide haunt power by 2 if not in same area if user_data.poi != haunted_data.poi: haunt_power_multiplier /= 2 # Double Halloween #haunt_power_multiplier *= 4 haunted_slimes = int((haunted_data.slimes / ewcfg.slimes_hauntratio) * haunt_power_multiplier) slimes_lost = int(haunted_slimes / 5) # hauntee only loses 1/5th of what the ghost gets as antislime if ewcfg.mutation_id_coleblooded in target_mutations: haunted_slimes = -10000 if user_data.slimes > haunted_slimes: haunted_slimes = user_data.slimes haunted_data.change_slimes(n = -slimes_lost, source = ewcfg.source_haunted) user_data.change_slimes(n = -haunted_slimes, source = ewcfg.source_haunter) market_data.negaslime -= haunted_slimes user_data.time_lasthaunt = time_now user_data.busted = False resp_cont.add_member_to_update(cmd.message.author) # Persist changes to the database. user_data.persist() haunted_data.persist() market_data.persist() response = "{} has been haunted by the ghost of {}! Slime has been lost! {} antislime congeals within you.".format(member.display_name, cmd.message.author.display_name, haunted_slimes) if ewcfg.mutation_id_coleblooded in target_mutations: response = "{} has been haunted by the ghost of {}! Their exorcising coleslaw blood purges {} antislime from your being! Better not do that again.".format(member.display_name, cmd.message.author.display_name, -haunted_slimes) haunted_channel = ewcfg.id_to_poi.get(haunted_data.poi).channel haunt_message = "You feel a cold shiver run down your spine" if cmd.tokens_count > 2: haunt_message_content = re.sub("<.+>" if cmd.mentions_count == 1 else "\d{17,}", "", cmd.message.content[(len(cmd.tokens[0])):]).strip() # Cut down really big messages so discord doesn't crash if len(haunt_message_content) > 500: haunt_message_content = haunt_message_content[:-500] haunt_message += " and faintly hear the words \"{}\"".format(haunt_message_content) haunt_message += ". {} slime evaporates from your body.".format(slimes_lost) if ewcfg.mutation_id_coleblooded in target_mutations: haunt_message += " The ghost that did it wails in agony as their ectoplasm boils in your coleslaw blood!" haunt_message = ewutils.formatMessage(member, haunt_message) resp_cont.add_channel_response(haunted_channel, haunt_message) else: # No mentions, or mentions we didn't understand. response = "Your spookiness is appreciated, but ENDLESS WAR didn\'t understand that name." # Send the response to the player. resp_cont.add_channel_response(cmd.message.channel.name, response) await resp_cont.post()
async def on_ready(): global init_complete if init_complete: return init_complete = True ewcfg.set_client(client) ewutils.logMsg('Logged in as {} ({}).'.format(client.user.name, client.user.id)) ewutils.logMsg("Loaded NLACakaNM world map. ({}x{})".format(ewmap.map_width, ewmap.map_height)) ewmap.map_draw() # Flatten role names to all lowercase, no spaces. fake_observer = EwUser() fake_observer.life_state = ewcfg.life_state_observer for poi in ewcfg.poi_list: if poi.role != None: poi.role = ewutils.mapRoleName(poi.role) neighbors = [] neighbor_ids = [] if poi.coord != None: neighbors = ewmap.path_to(coord_start = poi.coord, user_data = fake_observer) #elif poi.id_poi == ewcfg.poi_id_thesewers: # neighbors = ewcfg.poi_list if neighbors != None: for neighbor in neighbors: neighbor_ids.append(neighbor.id_poi) ewcfg.poi_neighbors[poi.id_poi] = set(neighbor_ids) ewutils.logMsg("Found neighbors for poi {}: {}".format(poi.id_poi, ewcfg.poi_neighbors[poi.id_poi])) for id_poi in ewcfg.landmark_pois: ewutils.logMsg("beginning landmark precomputation for " + id_poi) poi = ewcfg.id_to_poi.get(id_poi) ewmap.landmarks[id_poi] = ewmap.score_map_from( coord_start = poi.coord, user_data = fake_observer, landmark_mode = True ) ewutils.logMsg("finished landmark precomputation") try: await client.change_presence(game = discord.Game(name = "EW " + ewcfg.version)) except: ewutils.logMsg("Failed to change_presence!") # Look for a Twitch client_id on disk. # FIXME debug - temporarily disable Twitch integration if False: twitch_client_id = ewutils.getTwitchClientId() # If no twitch client ID is available, twitch integration will be disabled. # FIXME debug - temporarily disable Twitch integration. if True: twitch_client_id = None ewutils.logMsg('Twitch integration disabled.') elif twitch_client_id == None or len(twitch_client_id) == 0: ewutils.logMsg('No twitch_client_id file found. Twitch integration disabled.') else: ewutils.logMsg("Enabled Twitch integration.") # Channels in the connected discord servers to announce to. channels_announcement = [] # Channels in the connected discord servers to send stock market updates to. Map of server ID to channel. channels_stockmarket = {} for server in client.servers: # Update server data in the database ewserver.server_update(server = server) # store the list of channels in an ewutils field ewcfg.update_server_list(server = server) # find roles and add them to the database ewrolemgr.setupRoles(client = client, id_server = server.id) # hides the names of poi roles await ewrolemgr.hideRoleNames(client = client, id_server = server.id) # Grep around for channels ewutils.logMsg("connected to server: {}".format(server.name)) for channel in server.channels: if(channel.type == discord.ChannelType.text): if(channel.name == ewcfg.channel_twitch_announcement): channels_announcement.append(channel) ewutils.logMsg("• found channel for announcements: {}".format(channel.name)) elif(channel.name == ewcfg.channel_stockexchange): channels_stockmarket[server.id] = channel ewutils.logMsg("• found channel for stock exchange: {}".format(channel.name)) # create all the districts in the database for poi_object in ewcfg.poi_list: poi = poi_object.id_poi # call the constructor to create an entry if it doesnt exist yet dist = EwDistrict(id_server = server.id, district = poi) # change the ownership to the faction that's already in control to initialize topic names try: # initialize gang bases if poi == ewcfg.poi_id_rowdyroughhouse: dist.controlling_faction = ewcfg.faction_rowdys elif poi == ewcfg.poi_id_copkilltown: dist.controlling_faction = ewcfg.faction_killers resp_cont = dist.change_ownership(new_owner = dist.controlling_faction, actor = "init", client = client) dist.persist() await resp_cont.post() except: ewutils.logMsg('Could not change ownership for {} to "{}".'.format(poi, dist.controlling_faction)) asyncio.ensure_future(ewdistrict.capture_tick_loop(id_server = server.id)) asyncio.ensure_future(ewutils.bleed_tick_loop(id_server = server.id)) asyncio.ensure_future(ewutils.enemy_action_tick_loop(id_server=server.id)) asyncio.ensure_future(ewutils.spawn_enemies_tick_loop(id_server = server.id)) asyncio.ensure_future(ewutils.burn_tick_loop(id_server = server.id)) asyncio.ensure_future(ewutils.remove_status_loop(id_server = server.id)) asyncio.ensure_future(ewworldevent.event_tick_loop(id_server = server.id)) asyncio.ensure_future(ewutils.sap_tick_loop(id_server = server.id)) if not debug: await ewtransport.init_transports(id_server = server.id) asyncio.ensure_future(ewweather.weather_tick_loop(id_server = server.id)) asyncio.ensure_future(ewslimeoid.slimeoid_tick_loop(id_server = server.id)) asyncio.ensure_future(ewfarm.farm_tick_loop(id_server = server.id)) try: ewutils.logMsg('Creating message queue directory.') os.mkdir(ewcfg.dir_msgqueue) except FileExistsError: ewutils.logMsg('Message queue directory already exists.') ewutils.logMsg('Ready.') """ Set up for infinite loop to perform periodic tasks. """ time_now = int(time.time()) time_last_pvp = time_now time_last_twitch = time_now time_twitch_downed = 0 # Every three hours we log a message saying the periodic task hook is still active. On startup, we want this to happen within about 60 seconds, and then on the normal 3 hour interval. time_last_logged = time_now - ewcfg.update_hookstillactive + 60 stream_live = None ewutils.logMsg('Beginning periodic hook loop.') while not ewutils.TERMINATE: time_now = int(time.time()) # Periodic message to log that this stuff is still running. if (time_now - time_last_logged) >= ewcfg.update_hookstillactive: time_last_logged = time_now ewutils.logMsg("Periodic hook still active.") # Check to see if a stream is live via the Twitch API. # FIXME disabled if False: #if twitch_client_id != None and (time_now - time_last_twitch) >= ewcfg.update_twitch: time_last_twitch = time_now try: # Twitch API call to see if there are any active streams. json_string = "" p = subprocess.Popen( "curl -H 'Client-ID: {}' -X GET 'https://api.twitch.tv/helix/streams?user_login = rowdyfrickerscopkillers' 2>/dev/null".format(twitch_client_id), shell = True, stdout = subprocess.PIPE ) for line in p.stdout.readlines(): json_string += line.decode('utf-8') json_parsed = json.loads(json_string) # When a stream is up, data is an array of stream information objects. data = json_parsed.get('data') if data != None: data_count = len(data) stream_was_live = stream_live stream_live = True if data_count > 0 else False if stream_was_live == True and stream_live == False: time_twitch_downed = time_now if stream_was_live == False and stream_live == True and (time_now - time_twitch_downed) > 600: ewutils.logMsg("The stream is now live.") # The stream has transitioned from offline to online. Make an announcement! for channel in channels_announcement: await ewutils.send_message( client, channel, "ATTENTION CITIZENS. THE **ROWDY F****R** AND THE **COP KILLER** ARE **STREAMING**. BEWARE OF INCREASED KILLER AND ROWDY ACTIVITY.\n\n@everyone\n{}".format( "https://www.twitch.tv/rowdyfrickerscopkillers" ) ) except: ewutils.logMsg('Twitch handler hit an exception (continuing): {}'.format(json_string)) traceback.print_exc(file = sys.stdout) # Clear PvP roles from players who are no longer flagged. if (time_now - time_last_pvp) >= ewcfg.update_pvp: time_last_pvp = time_now try: for server in client.servers: role_ids = [] for pvp_role in ewcfg.role_to_pvp_role.values(): role = ewrolemgr.EwRole(id_server = server.id, name = pvp_role) role_ids.append(role.id_role) # Monitor all user roles and update if a user is no longer flagged for PvP. for member in server.members: for role in member.roles: if role.id in role_ids: await ewrolemgr.updateRoles(client = client, member = member) break except: ewutils.logMsg('An error occurred in the scheduled role update task:') traceback.print_exc(file=sys.stdout) # Adjust the exchange rate of slime for the market. try: for server in client.servers: # Load market data from the database. market_data = EwMarket(id_server = server.id) if market_data.time_lasttick + ewcfg.update_market <= time_now: market_response = "" for stock in ewcfg.stocks: s = EwStock(server.id, stock) # we don't update stocks when they were just added if s.timestamp != 0: s.timestamp = time_now market_response = ewmarket.market_tick(s, server.id) await ewutils.send_message(client, channels_stockmarket.get(server.id), market_response) market_data = EwMarket(id_server = server.id) market_data.time_lasttick = time_now # Advance the time and potentially change weather. market_data.clock += 1 if market_data.clock >= 24 or market_data.clock < 0: market_data.clock = 0 market_data.day += 1 if market_data.clock == 6: # Update the list of available bazaar items by clearing the current list and adding the new items market_data.bazaar_wares.clear() bazaar_foods = [] bazaar_cosmetics = [] bazaar_general_items = [] bazaar_furniture = [] for item in ewcfg.vendor_inv.get(ewcfg.vendor_bazaar): if item in ewcfg.item_names: bazaar_general_items.append(item) elif item in ewcfg.food_names: bazaar_foods.append(item) elif item in ewcfg.cosmetic_names: bazaar_cosmetics.append(item) elif item in ewcfg.furniture_names: bazaar_furniture.append(item) market_data.bazaar_wares['slimecorp1'] = ewcfg.weapon_id_umbrella market_data.bazaar_wares['slimecorp2'] = ewcfg.cosmetic_id_raincoat market_data.bazaar_wares['generalitem'] = random.choice(bazaar_general_items) market_data.bazaar_wares['food1'] = random.choice(bazaar_foods) # Don't add repeated foods bw_food2 = None while bw_food2 is None or bw_food2 in market_data.bazaar_wares.values(): bw_food2 = random.choice(bazaar_foods) market_data.bazaar_wares['food2'] = bw_food2 market_data.bazaar_wares['cosmetic1'] = random.choice(bazaar_cosmetics) # Don't add repeated cosmetics bw_cosmetic2 = None while bw_cosmetic2 is None or bw_cosmetic2 in market_data.bazaar_wares.values(): bw_cosmetic2 = random.choice(bazaar_cosmetics) market_data.bazaar_wares['cosmetic2'] = bw_cosmetic2 bw_cosmetic3 = None while bw_cosmetic3 is None or bw_cosmetic3 in market_data.bazaar_wares.values(): bw_cosmetic3 = random.choice(bazaar_cosmetics) market_data.bazaar_wares['cosmetic3'] = bw_cosmetic3 bw_furniture2 = None while bw_furniture2 is None or bw_furniture2 in market_data.bazaar_wares.values(): bw_furniture2 = random.choice(bazaar_furniture) market_data.bazaar_wares['furniture2'] = bw_furniture2 bw_furniture3 = None while bw_furniture3 is None or bw_furniture3 in market_data.bazaar_wares.values(): bw_furniture3 = random.choice(bazaar_furniture) market_data.bazaar_wares['furniture3'] = bw_furniture3 if random.random() == 0.1: market_data.bazaar_wares['minigun'] = ewcfg.weapon_id_minigun market_data.persist() if not ewutils.check_fursuit_active(market_data.id_server): ewcosmeticitem.dedorn_all_costumes() if market_data.clock == 6 and market_data.day % 8 == 0: await ewapt.rent_time(id_server=server.id) market_data = EwMarket(id_server=server.id) market_data.persist() if market_data.clock == 6: response = ' The SlimeCorp Stock Exchange is now open for business.' await ewutils.send_message(client, channels_stockmarket.get(server.id), response) elif market_data.clock == 20: response = ' The SlimeCorp Stock Exchange has closed for the night.' await ewutils.send_message(client, channels_stockmarket.get(server.id), response) market_data = EwMarket(id_server = server.id) if random.randrange(3) == 0: pattern_count = len(ewcfg.weather_list) if pattern_count > 1: weather_old = market_data.weather if random.random() < 0.4: market_data.weather = ewcfg.weather_bicarbonaterain # Randomly select a new weather pattern. Try again if we get the same one we currently have. while market_data.weather == weather_old: pick = random.randrange(len(ewcfg.weather_list)) market_data.weather = ewcfg.weather_list[pick].name # Log message for statistics tracking. ewutils.logMsg("The weather changed. It's now {}.".format(market_data.weather)) # Persist new data. market_data.persist() # Decay slime totals ewutils.decaySlimes(id_server = server.id) # Increase hunger for all players below the max. #ewutils.pushupServerHunger(id_server = server.id) # Decrease inebriation for all players above min (0). ewutils.pushdownServerInebriation(id_server = server.id) # Remove fish offers which have timed out ewfish.kill_dead_offers(id_server = server.id) # kill advertisements that have timed out ewads.delete_expired_ads(id_server = server.id) await ewdistrict.give_kingpins_slime_and_decay_capture_points(id_server = server.id) await ewmap.kick(server.id) # Post leaderboards at 6am NLACakaNM time. if market_data.clock == 6: await ewleaderboard.post_leaderboards(client = client, server = server) except: ewutils.logMsg('An error occurred in the scheduled slime market update task:') traceback.print_exc(file = sys.stdout) # Parse files dumped into the msgqueue directory and send messages as needed. try: for msg_file in os.listdir(ewcfg.dir_msgqueue): fname = "{}/{}".format(ewcfg.dir_msgqueue, msg_file) msg = ewutils.readMessage(fname) os.remove(fname) msg_channel_names = [] msg_channel_names_reverb = [] if msg.channel != None: msg_channel_names.append(msg.channel) if msg.poi != None: poi = ewcfg.id_to_poi.get(msg.poi) if poi != None: if poi.channel != None and len(poi.channel) > 0: msg_channel_names.append(poi.channel) if msg.reverb == True: pois_adjacent = ewmap.path_to(poi_start = msg.poi) for poi_adjacent in pois_adjacent: if poi_adjacent.channel != None and len(poi_adjacent.channel) > 0: msg_channel_names_reverb.append(poi_adjacent.channel) if len(msg_channel_names) == 0: ewutils.logMsg('in file {} message for channel {} (reverb {})\n{}'.format(msg_file, msg.channel, msg.reverb, msg.message)) else: # Send messages to every connected server. for server in client.servers: for channel in server.channels: if channel.name in msg_channel_names: await ewutils.send_message(client, channel, "**{}**".format(msg.message)) elif channel.name in msg_channel_names_reverb: await ewutils.send_message(client, channel, "**Something is happening nearby...\n\n{}**".format(msg.message)) except: ewutils.logMsg('An error occurred while trying to process the message queue:') traceback.print_exc(file = sys.stdout) # Wait a while before running periodic tasks. await asyncio.sleep(15)
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))