Esempio n. 1
0
async def dye(cmd):
    hat_id = ewutils.flattenTokenListToString(cmd.tokens[1:2])
    dye_id = ewutils.flattenTokenListToString(cmd.tokens[2:])

    try:
        hat_id_int = int(hat_id)
    except:
        hat_id_int = None

    try:
        dye_id_int = int(dye_id)
    except:
        dye_id_int = None

    if hat_id != None and len(hat_id) > 0 and dye_id != None and len(dye_id) > 0:
        response = "You don't have one."

        items = bknd_item.inventory(
            id_user=cmd.message.author.id,
            id_server=cmd.guild.id,
        )

        cosmetic = None
        dye = None
        for item in items:

            if int(item.get('id_item')) == hat_id_int or hat_id in ewutils.flattenTokenListToString(item.get('name')):
                if item.get('item_type') == ewcfg.it_cosmetic and cosmetic is None:
                    cosmetic = item

            if int(item.get('id_item')) == dye_id_int or dye_id in ewutils.flattenTokenListToString(item.get('name')):
                if item.get('item_type') == ewcfg.it_item and item.get('name') in static_items.dye_map and dye is None:
                    dye = item

            if cosmetic != None and dye != None:
                break

        if cosmetic != None:
            if dye != None:
                cosmetic_item = EwItem(id_item=cosmetic.get("id_item"))
                dye_item = EwItem(id_item=dye.get("id_item"))

                hue = hue_static.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()
                bknd_item.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 fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
    else:
        await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, 'You need to specify which cosmetic you want to paint and which dye you want to use! Check your **!inventory**.'))
Esempio n. 2
0
 def stop(self):
     self.fishing = False
     self.bite = False
     self.current_fish = ""
     self.current_size = ""
     self.pier = ""
     if self.bait == True and self.bait_id != 0:
         bknd_item.item_delete(self.bait_id)
     self.bait = False
     self.bait_id = 0
     self.high = False
     self.fishing_id = 0
     self.inhabitant_id = None
     self.fleshling_reeled = False
     self.ghost_reeled = False
Esempio n. 3
0
async def smeltsoul(cmd):
    item = bknd_item.find_item(item_search="reanimatedcorpse", id_user=cmd.message.author.id, id_server=cmd.guild.id)
    if not item:
        response = "You can't rip a soul out of a nonexistent object."
    else:
        item_obj = EwItem(id_item=item.get('id_item'))
        if item_obj.item_props.get('target') != None and item_obj.item_props.get('target') != "":
            targetid = item_obj.item_props.get('target')
            if bknd_item.give_item(id_user=cmd.message.author.id, id_item=targetid, id_server=cmd.guild.id):
                response = "You ripped the soul out of the reanimated corpse. It's in mangled bits now."
                bknd_item.item_delete(id_item=item.get('id_item'))
            else:
                response = "You reach for the soul in the reanimated corpse, but your hands are full of cosmetics! Get rid of a few, freak."
        else:
            response = "That's not a reanimated corpse. It only looks like one. Get rid of the fake shit and we'll get started."
    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 4
0
def item_off(id_item, id_server, item_name="", is_pushed_off=False):
    item_obj = EwItem(id_item=id_item)
    districtmodel = EwDistrict(id_server=id_server,
                               district=ewcfg.poi_id_slimesendcliffs)
    slimetotal = 0

    if item_obj.item_props.get('id_furniture') == 'sord':
        response = "You toss the sord off the cliff, but for whatever reason, the damn thing won't go down. It just keeps going up and up, as though gravity itself blocked this piece of shit jpeg artifact on Twitter. It eventually goes out of sight, where you assume it flies into the sun."
        bknd_item.item_delete(id_item=id_item)
    elif random.randrange(500) < 125 or item_obj.item_type in ([
            ewcfg.it_questitem, item_obj.item_type == ewcfg.it_medal,
            ewcfg.it_relic
    ]) or item_obj.item_props.get(
            'rarity') == ewcfg.rarity_princeps or item_obj.item_props.get(
                'id_cosmetic'
            ) == "soul" or item_obj.item_props.get(
                'id_furniture'
            ) == "propstand" or item_obj.item_props.get(
                'id_furniture'
            ) in static_items.furniture_collection or item_obj.item_props.get(
                'acquisition') == 'relic':
        response = "You toss the {} off the cliff. It sinks into the ooze disappointingly.".format(
            item_name)
        if item_obj.item_props.get('id_item') in [
                ewcfg.item_id_oldboot, ewcfg.item_id_seaweed,
                ewcfg.item_id_tincan, ewcfg.item_id_slimepoudrin
        ] or item_obj.item_props.get(
                'acquisition') == ewcfg.acquisition_fishing:
            bknd_item.item_delete(id_item=id_item)
        else:
            bknd_item.give_item(id_item=id_item,
                                id_server=id_server,
                                id_user=ewcfg.poi_id_slimesea)

    elif random.randrange(500) < 498:
        response = "You toss the {} off the cliff. A nearby kraken swoops in and chomps it down with the cephalapod's equivalent of a smile. Your new friend kicks up some sea slime for you. Sick!".format(
            item_name)
        slimetotal = 2000 + random.randrange(10000)
        bknd_item.item_delete(id_item=id_item)

    else:
        response = "{} Oh f**k. FEEDING FRENZY!!! Sea monsters lurch down on the spoils like it's f*****g christmas, and a ridiculous level of slime debris covers the ground. {}".format(
            ewcfg.emote_slime1, ewcfg.emote_slime1)
        slimetotal = 100000 + random.randrange(900000)

        bknd_item.item_delete(id_item=id_item)

    districtmodel.change_slimes(n=slimetotal)
    districtmodel.persist()
    return response
Esempio n. 5
0
async def donate(cmd):
    user_data = EwUser(member=cmd.message.author)
    if user_data.life_state == ewcfg.life_state_shambler:
        response = "You lack the higher brain functions required to {}.".format(cmd.tokens[0])
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    market_data = EwMarket(id_server=user_data.id_server)

    time_now = round(time.time())

    if user_data.poi == ewcfg.poi_id_slimecorphq:
        poi = poi_static.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 fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

        value = None
        if cmd.tokens_count > 1:
            value = ewutils.getIntToken(tokens=cmd.tokens, allow_all=True)

        if value != None:
            if value < 0:
                value = user_data.slimes
            if value <= 0:
                value = None

        if value != None and value < ewcfg.slimecoin_exchangerate:
            response = "You must volunteer to donate at least %d slime to receive compensation." % ewcfg.slimecoin_exchangerate

        elif value != None:
            # Amount of slime invested.
            cost_total = round(value)
            coin_total = round(value / ewcfg.slimecoin_exchangerate)

            if user_data.slimes < cost_total:
                response = "Acid-green flashes of light and bloodcurdling screams emanate from small window of SlimeCorp HQ. Unfortunately, you did not survive the procedure. Your body is dumped down a disposal chute to the sewers."
                market_data.donated_slimes += user_data.slimes
                market_data.persist()
                user_data.trauma = ewcfg.trauma_id_environment
                die_resp = user_data.die(cause=ewcfg.cause_donation)
                user_data.persist()
                # Assign the corpse role to the player. He dead.
                await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author)
                await die_resp.post()
            else:
                # Do the transfer if the player can afford it.
                market_data.donated_slimes += cost_total
                market_data.persist()
                user_data.change_slimes(n=-cost_total, source=ewcfg.source_spending)
                user_data.change_slimecoin(n=coin_total, coinsource=ewcfg.coinsource_donation)
                user_data.slime_donations += cost_total

                # Persist changes
                user_data.persist()

                response = "You stumble out of a Slimecorp HQ vault room in a stupor. You don't remember what happened in there, but your body hurts and you've got {slimecoin:,} shiny new SlimeCoin in your pocket.".format(slimecoin=coin_total)

        else:
            response = ewcfg.str_exchange_specify.format(currency="slime", action="donate")

    elif user_data.poi == ewcfg.poi_id_slimeoidlab:
        poi = poi_static.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 fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

        poudrins = bknd_item.find_item(item_search="slimepoudrin", id_user=cmd.message.author.id, id_server=cmd.guild.id if cmd.guild is not None else None, item_type_filter=ewcfg.it_item)

        if poudrins == None:
            response = "You have to own a poudrin in order to donate a poudrin. Duh."

        else:
            bknd_item.item_delete(id_item=poudrins.get('id_item'))  # Remove Poudrins
            market_data.donated_poudrins += 1
            market_data.persist()
            user_data.poudrin_donations += 1
            user_data.persist()

            response = "You hand off one of your hard-earned poudrins to the front desk receptionist, who is all too happy to collect it. Pretty uneventful, but at the very least you’re glad donating isn’t physically painful anymore."

    else:
        response = "To donate slime, go to the SlimeCorp HQ in Downtown. To donate poudrins, go to the N.L.A.C.U. Lab in Brawlden."

    # Send the response to the player.
    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 6
0
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 fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    market_data = EwMarket(id_server=user_data.id_server)
    item_search = ewutils.flattenTokenListToString(cmd.tokens[1:])
    item_sought = bknd_item.find_item(
        item_search=item_search,
        id_user=cmd.message.author.id,
        id_server=cmd.guild.id if cmd.guild is not None else None,
        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 = poi_static.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 fe_utils.send_message(
                cmd.client, cmd.message.channel,
                fe_utils.formatMessage(cmd.message.author, response))
        items = []
        vegetable = EwItem(id_item=item_sought.get('id_item'))

        for result in vendors.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 = itm_utils.gen_item_props(item)

            bknd_item.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()

            bknd_item.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 fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 7
0
async def sow(cmd):
    user_data = EwUser(member=cmd.message.author)
    if user_data.life_state == ewcfg.life_state_shambler:
        response = "You lack the higher brain functions required to {}.".format(
            cmd.tokens[0])
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    # check if the user has a farming tool equipped
    weapon_item = EwItem(id_item=user_data.weapon)
    weapon = static_weapons.weapon_map.get(
        weapon_item.item_props.get("weapon_type"))
    has_tool = False
    if weapon is not None:
        if ewcfg.weapon_class_farming in weapon.classes:
            has_tool = True

    # Checking availability of sow action
    if user_data.life_state != ewcfg.life_state_juvenile:
        response = "Only Juveniles of pure heart and with nothing better to do can farm."

    elif cmd.message.channel.name not in [
            ewcfg.channel_jr_farms, ewcfg.channel_og_farms,
            ewcfg.channel_ab_farms
    ]:
        response = "The cracked, filthy concrete streets around you would be a pretty terrible place for a farm. Try again on more arable land."

    else:
        poi = poi_static.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 fe_utils.send_message(
                cmd.client, cmd.message.channel,
                fe_utils.formatMessage(cmd.message.author, response))
        if user_data.poi == ewcfg.poi_id_jr_farms:
            farm_id = ewcfg.poi_id_jr_farms
        elif user_data.poi == ewcfg.poi_id_og_farms:
            farm_id = ewcfg.poi_id_og_farms
        else:  # if it's the farm in arsonbrook
            farm_id = ewcfg.poi_id_ab_farms

        farm = EwFarm(id_server=cmd.guild.id,
                      id_user=cmd.message.author.id,
                      farm=farm_id)

        if farm.time_lastsow > 0:
            response = "You’ve already sown something here. Try planting in another farming location. If you’ve planted in all three farming locations, you’re shit out of luck. Just wait, asshole."
        else:
            it_type_filter = None

            # gangsters can only plant poudrins
            if cmd.tokens_count > 1 and user_data.life_state == ewcfg.life_state_juvenile:
                item_search = ewutils.flattenTokenListToString(cmd.tokens[1:])

                # if the item selected was a vegetable, use a food only filter in find_item
                for v in static_food.vegetable_list:
                    if item_search in v.id_food or item_search in v.str_name:
                        it_type_filter = ewcfg.it_food
                        break
            else:
                item_search = "slimepoudrin"

            item_sought = bknd_item.find_item(
                item_search=item_search,
                id_user=cmd.message.author.id,
                id_server=cmd.guild.id if cmd.guild is not None else None,
                item_type_filter=it_type_filter)

            if item_sought == None:
                response = "You don't have anything to plant! Try collecting a poudrin."
            else:
                slimes_onreap = ewcfg.reap_gain
                item_data = EwItem(id_item=item_sought.get("id_item"))
                if item_data.item_type == ewcfg.it_item:
                    if item_data.item_props.get(
                            "id_item") == ewcfg.item_id_slimepoudrin:
                        vegetable = random.choice(static_food.vegetable_list)
                        slimes_onreap *= 2
                    elif item_data.item_props.get(
                            "context") == ewcfg.context_slimeoidheart:
                        vegetable = random.choice(static_food.vegetable_list)
                        slimes_onreap *= 2

                        slimeoid_data = EwSlimeoid(
                            id_slimeoid=item_data.item_props.get("subcontext"))
                        slimeoid_data.delete()

                    else:
                        response = "The soil has enough toxins without you burying your trash here."
                        return await fe_utils.send_message(
                            cmd.client, cmd.message.channel,
                            fe_utils.formatMessage(cmd.message.author,
                                                   response))
                elif item_data.item_type == ewcfg.it_food:
                    food_id = item_data.item_props.get("id_food")
                    vegetable = static_food.food_map.get(food_id)
                    if ewcfg.vendor_farm not in vegetable.vendors:
                        response = "It sure would be nice if {}s grew on trees, but alas they do not. Idiot.".format(
                            item_sought.get("name"))
                        return await fe_utils.send_message(
                            cmd.client, cmd.message.channel,
                            fe_utils.formatMessage(cmd.message.author,
                                                   response))
                    elif user_data.life_state != ewcfg.life_state_juvenile:
                        response = "You lack the knowledge required to grow {}.".format(
                            item_sought.get("name"))
                        return await fe_utils.send_message(
                            cmd.client, cmd.message.channel,
                            fe_utils.formatMessage(cmd.message.author,
                                                   response))

                else:
                    response = "The soil has enough toxins without you burying your trash here."
                    return await fe_utils.send_message(
                        cmd.client, cmd.message.channel,
                        fe_utils.formatMessage(cmd.message.author, response))

                mutations = user_data.get_mutations()
                growth_time = ewcfg.crops_time_to_grow
                if user_data.life_state == ewcfg.life_state_juvenile:
                    growth_time /= 2
                if ewcfg.mutation_id_greenfingers in mutations:
                    growth_time /= 1.5

                hours = int(growth_time / 60)
                minutes = int(growth_time % 60)

                str_growth_time = "{} hour{}{}".format(
                    hours, "s" if hours > 1 else "",
                    " and {} minutes".format(minutes) if minutes > 0 else "")

                # Sowing
                response = "You sow a {} into the fertile soil beneath you. It will grow in about {}.".format(
                    item_sought.get("name"), str_growth_time)

                farm.time_lastsow = int(time.time() /
                                        60)  # Grow time is stored in minutes.
                farm.time_lastphase = int(time.time())
                farm.slimes_onreap = slimes_onreap
                farm.crop = vegetable.id_food
                farm.phase = ewcfg.farm_phase_sow
                farm.action_required = ewcfg.farm_action_none
                farm.sow_life_state = user_data.life_state
                if ewcfg.mutation_id_greenfingers in mutations:
                    if user_data.life_state == ewcfg.life_state_juvenile:
                        farm.sow_life_state = ewcfg.farm_life_state_juviethumb
                    else:
                        farm.sow_life_state = ewcfg.farm_life_state_thumb

                bknd_item.item_delete(
                    id_item=item_sought.get('id_item'))  # Remove Poudrins

                farm.persist()

    await fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 8
0
async def barter_all(cmd):
    user_data = EwUser(member=cmd.message.author)
    mutations = user_data.get_mutations()

    # if non-zone channel, break
    if ewutils.channel_name_is_poi(cmd.message.channel.name) == False:
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You must {} in a zone's channel.".format(cmd.tokens[0])))

    # if not in speakeasy, break
    if cmd.message.channel.name != ewcfg.channel_speakeasy:
        if user_data.poi in poi_static.piers:
            response = 'You ask a nearby fisherman if he wants to trade you anything for this fish you just caught. He tells you to f**k off, but also helpfully informs you that there’s an old sea captain that frequents the Speakeasy that might be able to help you. What an inexplicably helpful/grouchy fisherman!'
        else:
            response = 'What random passerby is going to give two shits about your fish? You’ll have to consult a fellow fisherman… perhaps you’ll find some on a pier?'

        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    # if corpse, break
    if user_data.life_state == ewcfg.life_state_corpse:
        response = 'Captain Albert Alexander hits the table with his glass and shouts "Nay laddy, you can fool me once but not twice! I dont do deals with spirits, get out of my sight!"'
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    food_items = bknd_item.inventory(id_user=user_data.id_user, id_server=user_data.id_server, item_type_filter=ewcfg.it_food)
    offer_items = []  # list of items to create when offer goes through
    offer_slime = 0  # slime to give player when offer goes through
    fish_ids_to_remove = []  # list of fish to delete when offer goes through

    # check if food item is a fish and add to offer if it is
    for item in food_items:
        fish = EwItem(id_item=item.get('id_item'))
        # if item is a fish, add to offer
        if fish.item_props.get('acquisition') == ewcfg.acquisition_fishing:
            fish_ids_to_remove.append(fish.id_item)
            value = int(fish.item_props['value'])

            # Random choice between 0, 1, and 2
            offer_decision = random.randint(0, 2)

            if (offer_decision != 2 or ewcfg.mutation_id_davyjoneskeister in mutations) and fish.item_props.get('noslime') != "true" and ewcfg.mutation_id_onemansjunk not in mutations:  # If Captain Albert Alexander wants to offer you slime for your fish. 66% chance.
                max_value = value * 6000  # 600,000 slime for a colossal promo fish, 120,000 for a miniscule common fish.
                min_value = max_value / 5  # 120,000 slime for a colossal promo fish, 24,000 for a miniscule common fish.

                slime_gain = round(random.triangular(min_value, max_value, min_value * 2))

                offer_slime += slime_gain

            else:  # If Captain Albert Alexander wants to offer you an item for your fish. 33% chance. Once there are more unique items, we'll make this 50%.
                potential_items = []
                # Filters out all non-generic items without the current fish as an ingredient.
                for result in vendors.appraise_results:
                    if result.ingredients == fish.item_props.get('id_item') or result.ingredients == "generic" and result.acquisition == ewcfg.acquisition_bartering:  # Generic means that it can be made with any fish.
                        potential_items.append(result)
                    else:
                        pass
                # Filters out items of greater value than your fish.
                for value_filter in potential_items:
                    if value < value_filter.context:
                        potential_items.remove(value_filter)
                    else:
                        pass

                offer_items.append(random.choice(potential_items))

    # if player had some fish to offer
    if offer_slime > 0 or len(offer_items) > 0:

        response = "You approach a man of particularly swashbuckling appearance, adorned in an old sea captain's uniform and bicorne cap, and surrounded by empty glass steins. You ask him if he is Captain Albert Alexander and he replies that he hasn’t heard that name in a long time. You drop all of your fish at his feet."

        items_desc = ""
        if len(offer_items) > 0:
            if len(offer_items) > 4:
                items_desc = "a handful items"
            elif len(offer_items) > 1:
                items_desc = "a few items"
            else:
                items_desc = "a {}".format(offer_items[0].str_name)

        offer_desc = "{}{}{}".format((str(offer_slime) + " slime") if (offer_slime > 0) else "", " and " if (offer_slime > 0 and len(items_desc) > 0) else "", items_desc if (len(items_desc) > 0) else "")
        response += ' \n"Hm, alright… for your fish... I’ll trade you {}!"'.format(offer_desc)

        await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

        response = ""

        if offer_slime > 0:
            slime_gain = offer_slime

            user_initial_level = user_data.slimelevel

            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
                response += "\n\n"

        if len(offer_items):
            for item in offer_items:
                item_props = itm_utils.gen_item_props(item)

                bknd_item.item_create(
                    item_type=item.item_type,
                    id_user=cmd.message.author.id,
                    id_server=cmd.guild.id,
                    item_props=item_props
                )

        for id in fish_ids_to_remove:
            bknd_item.item_delete(id_item=id)

        user_data.persist()

        response += '"Pleasure doing business with you, laddy!"'


    # player has no fish
    else:
        response = "You need some fish to barter with Captain Albert Alexander. Get out there and do some fishing!"

    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 9
0
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 = bknd_item.find_item(item_search=item_search, id_user=cmd.message.author.id, id_server=cmd.guild.id if cmd.guild is not None else None)

    if 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 fish.item_props.get('id_furniture') == "singingfishplaque":

            poudrins_owned = itm_utils.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()
                    bknd_item.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..."

        elif fish.item_props.get('embiggened') is not None:
            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. An NLACU med student 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, avoiding the rumbling tumors it's grown from its previous embiggening. All of a sudden, before the surgeon can inject, the {}'s heart rate monitor starts going f*****g nuts. The nurses begin to panic and duck behind equipment as the syringe flies out of the fish and sprays caustic rainbow goop over all the expensive machinery. Some of it lands on your pinky, and it expands into a second thumb. You are escorted out of the basement with a combination of fury and embarrassment.\n\nWelp, guess you can't embiggen the same fish twice. Too many...surgical complications.".format(
                name, name)
        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

            if size == ewcfg.fish_size_colossal:
                poudrin_cost = 32

            poudrins_owned = itm_utils.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 fish.item_props.get('length') is None:
                    fish.item_props['length'] = float((ewcfg.fish_size_range.get(fish.item_props.get('size'))[0] + ewcfg.fish_size_range.get(fish.item_props.get('size'))[1])/2)

                fish.item_props['length'] =  float(fish.item_props['length']) + random.randint(5 + poudrin_cost, 15 + poudrin_cost)

                fish.item_props['size'] = fishutils.length_to_size(size_number=float(fish.item_props['length']))
                fish.item_props['embiggened'] = 'illegal'

                fish.persist()

                for delete in range(poudrin_cost):
                    poudrin = poudrins_owned.pop()
                    bknd_item.item_delete(id_item=poudrin.get("id_item"))

                market_data.donated_poudrins += poudrin_cost
                market_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. An NLACU med student 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 fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 10
0
async def embark(cmd):
    # can only use movement commands in location channels
    if ewutils.channel_name_is_poi(cmd.message.channel.name) == False:
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You must {} in a zone's channel.".format(cmd.tokens[0])))

    user_data = EwUser(member=cmd.message.author)
    poi = poi_static.id_to_poi.get(user_data.poi)
    district_data = EwDistrict(district=poi.id_poi, id_server=cmd.guild.id)

    if district_data.is_degraded():
        response = "{} has been degraded by shamblers. You can't {} here anymore.".format(poi.str_name, cmd.tokens[0])
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    response = ""

    if ewutils.active_restrictions.get(user_data.id_user) != None and ewutils.active_restrictions.get(user_data.id_user) > 0:
        response = "You can't do that right now."
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    if user_data.get_inhabitee():
        # prevent ghosts currently inhabiting other players from moving on their own
        response = "You might want to **{}** of the poor soul you've been tormenting first.".format(ewcfg.cmd_letgo)
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    # poi = ewmap.fetch_poi_if_coordless(cmd.message.channel.name)

    # must be at a transport stop to enter a transport
    if poi != None and poi.id_poi in poi_static.transport_stops:
        transport_ids = get_transports_at_stop(id_server=user_data.id_server, stop=poi.id_poi)

        # can't embark, when there's no vehicles to embark on
        if len(transport_ids) == 0:
            response = "There are currently no transport vehicles to embark on here."
            return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

        # automatically embark on the only transport at the station, if no arguments were provided
        elif len(transport_ids) == 1 and cmd.tokens_count < 2:
            transport_data = EwTransport(id_server=user_data.id_server, poi=transport_ids[0])
            target_name = transport_data.current_line

        # get target name from command arguments
        else:
            target_name = ewutils.flattenTokenListToString(cmd.tokens[1:])

        # report failure, if the vehicle to be boarded couldn't be ascertained
        if target_name == None or len(target_name) == 0:
            return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "Which transport line?"))

        transport_line = poi_static.id_to_transport_line.get(target_name)

        # report failure, if an invalid argument was given
        if transport_line == None:
            return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "Never heard of it."))

        for transport_id in transport_ids:
            transport_data = EwTransport(id_server=user_data.id_server, poi=transport_id)

            # check if one of the vehicles at the stop matches up with the line, the user wants to board
            if transport_data.current_line == transport_line.id_line:
                ticket = None
                # TODO remove after double halloween
                # user_data = EwUser(member = cmd.message.author)
                # if user_data.poi in [ewcfg.poi_id_dt_subway_station, ewcfg.poi_id_rr_subway_station, ewcfg.poi_id_jr_subway_station]:
                #	if transport_line.id_line in [ewcfg.transport_line_subway_white_eastbound, ewcfg.transport_line_subway_white_westbound]:
                #		ticket = bknd_item.find_item(item_search=ewcfg.item_id_whitelineticket, id_user=cmd.message.author.id,  id_server=cmd.message.guild.id)
                #		if ticket is None:
                #			response = "You need a ticket to embark on the White Line."
                #			return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

                last_stop_poi = poi_static.id_to_poi.get(transport_line.last_stop)
                response = "Embarking on {}.".format(transport_line.str_name)
                # schedule tasks for concurrent execution
                message_task = asyncio.ensure_future(fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)))
                wait_task = asyncio.ensure_future(asyncio.sleep(ewcfg.time_embark))

                # Take control of the move for this player.
                move_utils.move_counter += 1
                move_current = ewutils.moves_active[cmd.message.author.id] = move_utils.move_counter
                await message_task
                await wait_task

                # check if the user entered another movement command while waiting for the current one to be completed
                if move_current == ewutils.moves_active[cmd.message.author.id]:
                    user_data = EwUser(member=cmd.message.author)

                    transport_data = EwTransport(id_server=user_data.id_server, poi=transport_id)

                    # check if the transport is still at the same stop
                    if transport_data.current_stop == poi.id_poi:
                        user_data.poi = transport_data.poi
                        user_data.persist()

                        transport_poi = poi_static.id_to_poi.get(transport_data.poi)

                        response = "You enter the {}.".format(transport_data.transport_type)
                        if ticket is not None:
                            bknd_item.item_delete(ticket.get("id_item"))
                        await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author)
                        await user_data.move_inhabitants(id_poi=transport_data.poi)
                        return await fe_utils.send_message(cmd.client, fe_utils.get_channel(cmd.guild, transport_poi.channel), fe_utils.formatMessage(cmd.message.author, response))
                    else:
                        response = "The {} starts moving just as you try to get on.".format(transport_data.transport_type)
                        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

        response = "There is currently no vehicle following that line here."
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))


    else:
        response = "No transport vehicles stop here. Try going to a subway station or a ferry port."
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 11
0
async def appraise(cmd):
    user_data = EwUser(member=cmd.message.author)

    if ewutils.channel_name_is_poi(cmd.message.channel.name) == False:
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You must {} in a zone's channel.".format(cmd.tokens[0])))

    market_data = EwMarket(id_server=user_data.id_server)
    item_search = ewutils.flattenTokenListToString(cmd.tokens[1:])
    item_sought = bknd_item.find_item(item_search=item_search, id_user=cmd.message.author.id, id_server=cmd.guild.id if cmd.guild is not None else None)
    payment = bknd_item.find_item(item_search="manhattanproject", 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 appraisal
    # if market_data.clock < 8 or market_data.clock > 17:
    #	response = "You ask the bartender if he knows someone who would want to trade you something for your recently caught fish. Apparently, at night, an old commodore by the name of Captain Albert Alexander comes to drown his sorrows at this very tavern. You guess you’ll just have to sit here and wait for him, then."

    if cmd.message.channel.name != ewcfg.channel_speakeasy:
        if user_data.poi in poi_static.piers:
            response = 'You ask a nearby fisherman if he could appraise this fish you just caught. He tells you to f**k off, but also helpfully informs you that there’s an old sea captain that frequents the Speakeasy that might be able to help you. What an inexplicably helpful/grouchy fisherman!'
        else:
            response = 'What random passerby is going to give two shits about your fish? You’ll have to consult a fellow fisherman… perhaps you’ll find some on a pier?'
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
    elif item_sought:
        name = item_sought.get('name')
        fish = EwItem(id_item=item_sought.get('id_item'))
        item_props = fish.item_props
        # str_fish = fish.item_props.get('str_name')
        # id_fish = item_props['id_food']
        acquisition = item_props.get('acquisition')

        response = "You approach a man of particularly swashbuckling appearance, adorned in an old sea captain's uniform and bicorne cap, and surrounded by empty glass steins. You ask him if he is Captain Albert Alexander and he replies that he hasn’t heard that name in a long time. You submit your {} for appraisal".format(name)

        if acquisition != ewcfg.acquisition_fishing:
            response += '. \n"Have you lost yer mind, laddy? That’s not a fish!! Just what’re you trying to pull??"'.format(name)

        else:

            if payment == None:
                response += ", but he says he won’t provide his services for free... but, if you bring him a Manhattan Project, you might be able to get an appraisal."

            else:
                item_props = fish.item_props
                rarity = item_props['rarity']
                size = item_props['size']
                value = int(item_props['value'])

                response += ' and offer him a Manhattan Project as payment. \n"Hm, alright, let’s see here...'

                if rarity == ewcfg.fish_rarity_common:
                    response += "Ah, a {}, that’s a pretty common fish... ".format(name)

                if rarity == ewcfg.fish_rarity_uncommon:
                    response += "Interesting, a {}, that’s a pretty uncommon fish you’ve got there... ".format(name)

                if rarity == ewcfg.fish_rarity_rare:
                    response += "Amazing, it’s a {}! Consider yourself lucky, that’s a pretty rare fish! ".format(name)

                if rarity == ewcfg.fish_rarity_promo:
                    response += "Shiver me timbers, is that a {}?? Unbelievable, that’s an extremely rare fish!! It was only ever released as a promotional item in Japan during the late ‘90s. ".format(name)

                if size == ewcfg.fish_size_miniscule:
                    response += "Or, is it just a speck of dust? Seriously, that {} is downright miniscule! ".format(name)

                if size == ewcfg.fish_size_small:
                    response += "Hmmm, it’s a little small, don’t you think? "

                if size == ewcfg.fish_size_average:
                    response += "It’s an average size for the species. "

                if size == ewcfg.fish_size_big:
                    response += "Whoa, that’s a big one, too! "

                if size == ewcfg.fish_size_huge:
                    response += "Look at the size of that thing, it’s huge! "

                if size == ewcfg.fish_size_colossal:
                    response += "By Neptune’s beard, what a sight to behold, this {name} is absolutely colossal!! In all my years in the Navy, I don’t think I’ve ever seen a {name} as big as yours!! ".format(name=name)

                response += "So, I’d say this fish "

                if value <= 20:
                    response += 'is absolutely worthless."'

                if value <= 40 and value >= 21:
                    response += 'isn’t worth very much."'

                if value <= 60 and value >= 41:
                    response += 'is somewhat valuable."'

                if value <= 80 and value >= 61:
                    response += 'is highly valuable!"'

                if value <= 99 and value >= 81:
                    response += 'is worth a fortune!!"'

                if value >= 100:
                    response += 'is the most magnificent specimen I’ve ever seen!"'

                bknd_item.item_delete(id_item=payment.get('id_item'))

                user_data.persist()
    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 = "Ask Captain Albert Alexander to appraise which fish? (check **!inventory**)"

    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 12
0
async def crush(cmd):
    member = cmd.message.author
    user_data = EwUser(member=member)
    response = ""  # if it's not overwritten
    crush_slimes = ewcfg.crush_slimes

    command = "crush"
    if cmd.tokens[0] == (ewcfg.cmd_prefix + 'crunch'):
        command = "crunch"

    if user_data.life_state == ewcfg.life_state_corpse:
        response = "Alas, your ghostly form cannot {} anything. Lame.".format(command)
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    item_search = ewutils.flattenTokenListToString(cmd.tokens[1:])
    item_sought = bknd_item.find_item(item_search=item_search, id_user=user_data.id_user, id_server=user_data.id_server)

    if item_sought:
        sought_id = item_sought.get('id_item')
        item_data = EwItem(id_item=sought_id)

        response = "The item doesn't have !{} functionality".format(command)  # if it's not overwritten

        if item_data.item_props.get("id_item") == ewcfg.item_id_slimepoudrin:
            # delete a slime poudrin from the player's inventory
            bknd_item.item_delete(id_item=sought_id)

            levelup_response = user_data.change_slimes(n=crush_slimes, source=ewcfg.source_crush)
            user_data.persist()

            response = "You {} the hardened slime crystal with your bare teeth.\nYou gain {} slime. Sick, dude!!".format(command, crush_slimes)

            if len(levelup_response) > 0:
                response += "\n\n" + levelup_response

        elif item_data.item_props.get("id_item") == ewcfg.item_id_royaltypoudrin:
            # delete a royalty poudrin from the player's inventory
            bknd_item.item_delete(id_item=sought_id)
            crush_slimes = 5000

            levelup_response = user_data.change_slimes(n=crush_slimes, source=ewcfg.source_crush)
            user_data.persist()

            response = "You {} your hard-earned slime crystal with your bare teeth.\nYou gain {} slime. Ah, the joy of writing!".format(command, crush_slimes)

            if len(levelup_response) > 0:
                response += "\n\n" + levelup_response

        elif item_data.item_props.get("id_food") in static_food.vegetable_to_cosmetic_material.keys():
            bknd_item.item_delete(id_item=sought_id)

            crop_name = item_data.item_props.get('food_name')
            # Turn the crop into its proper cosmetic material item.
            cosmetic_material_id = static_food.vegetable_to_cosmetic_material[item_data.item_props.get("id_food")]
            new_item = static_items.item_map.get(cosmetic_material_id)

            new_item_type = ewcfg.it_item
            if new_item != None:
                new_name = new_item.str_name
                new_item_props = itm_utils.gen_item_props(new_item)
            else:
                ewutils.logMsg("ERROR: !crunch failed to retrieve proper cosmetic material for crop {}.".format(item_data.item_props.get("id_food")))
                new_name = None
                new_item_props = None

            generated_item_id = bknd_item.item_create(
                item_type=new_item_type,
                id_user=cmd.message.author.id,
                id_server=cmd.guild.id,
                item_props=new_item_props
            )

            response = "You {} your {} in your mouth and spit it out to create some {}!!".format(command, crop_name, new_name)

        elif item_data.item_props.get("id_food") in static_food.candy_ids_list:

            bknd_item.item_delete(id_item=sought_id)
            item_name = item_data.item_props.get('food_name')

            if float(getattr(item_data, "time_expir", 0)) < time.time():
                response = "The {} melts disappointingly in your hand...".format(item_name)

            else:
                gristnum = random.randrange(2) + 1
                gristcount = 0

                response = "You crush the {} with an iron grip. You gain {} piece(s) of Double Halloween Grist!".format(item_name, gristnum)

                while gristcount < gristnum:
                    grist = static_items.item_map.get(ewcfg.item_id_doublehalloweengrist)
                    grist_props = itm_utils.gen_item_props(grist)

                    bknd_item.item_create(
                        item_type=grist.item_type,
                        id_user=cmd.message.author.id,
                        id_server=cmd.message.guild.id,
                        item_props=grist_props
                    )

                    gristcount += 1
        elif item_data.item_props.get("id_item") == ewcfg.item_id_negapoudrin:
            # delete a negapoudrin from the player's inventory
            bknd_item.item_delete(id_item=sought_id)
            crush_slimes = -1000000
            # kill player if they have less than 1 million slime
            if user_data.slimes < 1000000:
                user_data.die(cause=ewcfg.cause_suicide)
            # remove 1 million slime from the player
            else:
                levelup_response = user_data.change_slimes(n = crush_slimes, source = ewcfg.source_crush)
                user_data.persist()

                response = "You {} your hard-earned slime crystal with your bare teeth.\nAs the nerve endings in your teeth explode, you realize you bit into a negapoudrin! You writhe on the ground as slime gushes from all of your orifices.".format(command)
            
                if len(levelup_response) > 0:
                    response += "\n\n" + levelup_response	

    else:
        if item_search:  # if they didnt forget to specify an item and it just wasn't found
            response = "You don't have one."
        else:
            response = "{} which item? (check **!inventory**)".format(command)

    # Send the response to the player.
    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 13
0
async def incubate_slimeoid(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    if cmd.message.channel.name != ewcfg.channel_slimeoidlab:
        response = "You must go to the NLACU Laboratories in Brawlden to create a Slimeoid."
        # Go to final response

    elif user_data.life_state == ewcfg.life_state_corpse:
        response = "Ghosts cannot interact with the NLACU Lab apparati."
        # Go to final response

    #TODO: change this because player can have more than one slimeoid now
    # this is f*****g brutal. poor slimeoid
    elif slimeoid_data.life_state == ewcfg.slimeoid_state_active:
        response = "You have already created a Slimeoid. Bottle or dissolve your current slimeoid before incubating a new one."
        # Go to final response

    elif slimeoid_data.life_state == ewcfg.slimeoid_state_forming:
        response = "You are already in the process of incubating a Slimeoid."
        # Go to final response

    else:

        #Check if player has too many slimeoids
        slimeoid_count = get_slimeoid_count(user_id=cmd.message.author.id,
                                            server_id=cmd.guild.id)

        if slimeoid_count >= 3:
            response = "You have too many slimeoids."
            # Go to final response

        else:
            #Check if player has a poudrin
            poudrin = bknd_item.find_item(
                item_search=ewcfg.item_id_slimepoudrin,
                id_user=cmd.message.author.id,
                id_server=cmd.guild.id if cmd.guild is not None else None,
                item_type_filter=ewcfg.it_item)
            if poudrin is None:
                response = "You need a slime poudrin."
                # Go to final response

            else:
                # Get arguement for how big the slimeoid should be made
                injected_slime = None
                if cmd.tokens_count > 1:
                    injected_slime = ewutils.getIntToken(tokens=cmd.tokens,
                                                         allow_all=True)
                    # -1 from getIntToken() means use all slime
                    if injected_slime == -1:
                        injected_slime = user_data.slimes

                if injected_slime == None:
                    response = "You must contribute some of your own slime to create a Slimeoid. Specify how much slime you will sacrifice."
                    # Go to final response

                elif injected_slime > user_data.slimes:
                    response = "You do not have that much slime to sacrifice."
                    # Go to final response

                else:
                    # delete a slime poudrin from the player's inventory
                    bknd_item.item_delete(id_item=poudrin.get('id_item'))

                    # Remove slime
                    user_data.change_slimes(n=-injected_slime)

                    # Setup gestating slimeoid
                    level = len(str(injected_slime))
                    slimeoid_data.life_state = ewcfg.slimeoid_state_forming
                    slimeoid_data.level = level
                    slimeoid_data.id_user = str(user_data.id_user)
                    slimeoid_data.id_server = user_data.id_server

                    # Save changes
                    slimeoid_data.persist()
                    user_data.persist()

                    response = "You place a poudrin into a small opening on the console. As you do, a needle shoots up and pricks your finger, intravenously extracting {injected_slime:,} slime from your body. The poudrin is then dropped into the gestation tank. Looking through the observation window, you see what was once your slime begin to seep into the tank and accrete around the poudrin. The incubation of a new Slimeoid has begun! {slime_emote}".format(
                        injected_slime=injected_slime,
                        slime_emote=ewcfg.emote_slime2)
                    # Go to final response

    # Final response
    await send_response(response, cmd)
Esempio n. 14
0
async def incubate_negaslimeoid(cmd):
    user_data = EwUser(member=cmd.message.author)
    slimeoid_data = EwSlimeoid(member=cmd.message.author)

    # Check for if the player is a corpse
    if user_data.life_state != ewcfg.life_state_corpse:
        if cmd.message.channel.name == ewcfg.channel_wafflehouse:
            response = "You feel as though there is some ancient power here, but the slime coursing through your veins prevents you from using it."
        else:
            response = "Huh? What'd you say?"

    # Check for if the player is at Waffle House
    elif cmd.message.channel.name != ewcfg.channel_wafflehouse:
        response = "You can't exactly summon anything in {}. Go to Waffle House first.".format(
            cmd.message.channel.name)

    # Check if the player already has a Slimeoid or a Negaslimeoid.
    elif slimeoid_data.life_state == ewcfg.slimeoid_state_active:
        if slimeoid_data.sltype == ewcfg.sltype_nega:
            response = "You already have a Negaslimeoid by your side. Destroy your current Negaslimeoid before you commune with the Ancient Ones yet again."
        else:
            response = "You wish to summon a Negaslimeoid, yet you have a Slimeoid that still calls you its master. !destroyslimeoid if you wish to commune with the Ancient Ones properly."

    # Check if the player is already incubating a Slimeoid or Negaslimeoid
    elif slimeoid_data.life_state == ewcfg.slimeoid_state_forming:
        if slimeoid_data.sltype == ewcfg.sltype_nega:
            response = "You are already in the process of conjuring a Negaslimeoid."
        else:
            response = "You wish to summon a Negaslimeoid, yet you have a Slimeoid that is still yet to call you its master. !destroyslimeoid if you wish to commune with the Ancient Ones properly."

    else:

        #Check if player has too many slimeoids
        slimeoid_count = get_slimeoid_count(user_id=cmd.message.author.id,
                                            server_id=cmd.guild.id)

        if slimeoid_count >= 3:
            response = "You have too many slimeoids."
            # Go to final response

        else:
            #Check if player has a negapoudrin
            negapoudrin = bknd_item.find_item(
                item_search=ewcfg.item_id_negapoudrin,
                id_user=cmd.message.author.id,
                id_server=cmd.guild.id if cmd.guild is not None else None,
                item_type_filter=ewcfg.it_item)
            if negapoudrin is None:
                response = "You need a negapoudrin to bind a Negaslimeoid to your command."
                # Go to final response

            else:
                # Get argument for how big the negaslimeoid should be made
                sacrificed_negaslime = None
                if cmd.tokens_count > 1:
                    # -1 from getIntToken() could possibly be gotten from player input, so do a check here.
                    if cmd.tokens[1] == "all":
                        if user_data.slimes < 0:
                            sacrificed_negaslime = -user_data.slimes

                    else:
                        print(cmd.tokens[0])
                        sacrificed_negaslime = ewutils.getIntToken(
                            tokens=cmd.tokens)
                        if sacrificed_negaslime < 0:
                            sacrificed_negaslime = -sacrificed_negaslime

                # Check if player sacrificed any negaslime or if they have enough to sacrifice.
                if sacrificed_negaslime == None:
                    response = "You must sacrifice your own negaslime to conjure a Negaslimeoid. Specify how much negaslime you will sacrifice."
                    # Go to final response

                elif -sacrificed_negaslime < user_data.slimes:
                    response = "You do not have that much negaslime to sacrifice."
                    # Go to final response

                else:
                    # delete a negapoudrin from the player's inventory
                    bknd_item.item_delete(id_item=negapoudrin.get('id_item'))

                    # Remove negaslime
                    user_data.change_slimes(n=+sacrificed_negaslime)

                    # Establish these stats for conjuring the negaslimeoid
                    level = len(str(sacrificed_negaslime))
                    slimeoid_data.life_state = ewcfg.slimeoid_state_forming
                    slimeoid_data.level = level
                    slimeoid_data.sltype = ewcfg.sltype_nega
                    slimeoid_data.hue = ewcfg.hue_id_negative
                    slimeoid_data.id_user = str(user_data.id_user)
                    slimeoid_data.id_server = user_data.id_server

                    # Save changes
                    slimeoid_data.persist()
                    user_data.persist()

                    response = "Floating in front of the Ouija® Board, you place both of your ghastly appendages on the planchette. {sacrificed_negaslime:,} negaslime rises from your body, flowing towards your negapoudrin. The negapoudrin appears to lift into the air, held up by a pool of rising negaslime. Whispers awake around you, indiscernible and unknowable. It feels as though the planchette beneath your ghastly fingers has more than one set of hands on it. \n\nThe conjuration of a Negaslimeoid has begun! {negaslime_emote}".format(
                        sacrificed_negaslime=sacrificed_negaslime,
                        negaslime_emote=ewcfg.emote_negaslime)
                    # Go to final response

    # Final response
    await send_response(response, cmd)
Esempio n. 15
0
async def order_zine(cmd):
    user_data = EwUser(member=cmd.message.author)
    if user_data.life_state == ewcfg.life_state_shambler:
        response = "You lack the higher brain functions required to {}.".format(cmd.tokens[0])
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    poi = poi_static.id_to_poi.get(user_data.poi)

    if not poi.write_manuscript:
        response = "You can't buy zines here! Try going to the cafe. If you're looking for educational books, try the colleges. If you can't read, then you might want to try the comic shop."

    elif len(cmd.tokens) == 1:
        response = "Specify a zine to purchase. Find zine IDs with !browse."

    elif not bknd_item.check_inv_capacity(user_data=user_data, item_type=ewcfg.it_book):
        response = "You can't carry any more zines."

    else:
        if cmd.tokens[1].isdigit():
            id_book = int(cmd.tokens[1])

            if int_is_zine(id_book, cmd.guild.id):
                book = EwBook(id_book=id_book)
                accepted = True
                if book.genre == 3:
                    accepted = False
                    response = "THIS ZINE IS PORNOGRAPHY. CONFIRM THAT YOU ARE AT LEAST 18 YEARS OLD. **!accept** or **!refuse**"

                    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

                    try:
                        message = await cmd.client.wait_for('message', timeout=20, check=lambda message: message.author == cmd.message.author and
                                                                                                         message.content.lower() in [ewcfg.cmd_accept, ewcfg.cmd_refuse])

                        if message != None:
                            if message.content.lower() == ewcfg.cmd_accept:
                                accepted = True
                            if message.content.lower() == ewcfg.cmd_refuse:
                                accepted = False
                    except:
                        accepted = False

                if not accepted:
                    response = "No p**n for you."

                elif accepted:
                    if book.genre != 10 and poi.id_poi == ewcfg.poi_id_clinicofslimoplasty:
                        response = "Specify a zine to purchase. Find zine IDs with !browse."
                        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

                    user_data = EwUser(member=cmd.message.author)

                    #if book.genre != 10:
                    #    price = ewcfg.zine_cost
                    #else:
                    #    price = ewcfg.zine_cost / 4

                    #if user_data.slimes < price:
                    poudrins = bknd_item.find_item(item_search="slimepoudrin", id_user=cmd.message.author.id, id_server=cmd.guild.id if cmd.guild is not None else None, item_type_filter=ewcfg.it_item)

                    if poudrins == None:
                        response = "YOU CAN'T AFFORD IT. YOU NEED A POUDRIN."

                    else:
                        bknd_item.item_create(
                            item_type=ewcfg.it_book,
                            id_user=user_data.id_user,
                            id_server=cmd.guild.id,
                            item_props={
                                "title": book.title,
                                "author": book.author,
                                "date_published": book.date_published,
                                "id_book": book.id_book,
                                "book_desc": "A book by {}, published on {}.".format(book.author, book.date_published)
                            })
                        book_sale = EwBookSale(id_book=book.id_book, member=cmd.message.author)

                        if book.id_user != user_data.id_user:
                            if book_sale.bought == 0:
                                book_sale.bought = 1
                                book.sales += 1
                                book_sale.persist()
                                book.persist()

                        bknd_item.item_delete(id_item=poudrins.get('id_item'))
                        #user_data.change_slimes(n=-(price), source=ewcfg.source_spending)

                        user_data.persist()

                        if book.genre != 10:
                            author = EwUser(id_user=book.id_user, id_server=book.id_server)

                            if author.id_user != user_data.id_user and bknd_item.check_inv_capacity(user_data=user_data, item_type=ewcfg.it_item):
                                bknd_item.item_create(
                                    item_type=ewcfg.it_item,
                                    id_user=author.id_user,
                                    id_server=cmd.guild.id,
                                    item_props={
                                        'context': 'poudrin',
                                        'item_name': 'Royalty Poudrin',
                                        'item_desc': 'You received this less powerful poudrin from some fool who decided to buy your zine. !crush it for 5k slime.',
                                        'id_item': 'royaltypoudrin'
                                    })

                        response = "You manage to locate {} by {} in the vast array of zines on the bookshelf, so you bring it to the counter and hand over {:,} slime to the employee. Now it's time to !read it.".format(book.title, book.author, ewcfg.zine_cost)

            else:
                response = "Specify a zine to purchase. Find zine IDs with !browse."

        else:
            response = "Specify a zine to purchase. Find zine IDs with !browse."

    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 16
0
async def abduct(cmd):
    user_data = EwUser(member=cmd.message.author)
    item_sought = bknd_item.find_item(item_search='batterypack', id_user=cmd.message.author.id, id_server=cmd.guild.id)

    protected = False
    cosmetics = bknd_item.inventory(id_user=user_data.id_user, id_server=cmd.guild.id,
                                    item_type_filter=ewcfg.it_cosmetic)
    for cosmetic in cosmetics:
        cosmetic_data = EwItem(id_item=cosmetic.get('id_item'))
        if cosmetic_data.item_props.get('id_cosmetic') == 'skinsuit':
            if cosmetic_data.item_props.get('adorned') == 'true':
                protected = True

    shipstate = EwGamestate(id_server=user_data.id_server, id_state='shipstate')

    if user_data.poi != 'ufoufo':
        response = "Abduct what, dumbass? My patience?"
    elif not protected:
        response = "The aliens aren't gonna let you start the ship. You're basically their captive now."
    elif not ewcfg.dh_active or ewcfg.dh_stage != 3:
        response = "Wait, your alien espionage is waaaay out of season."
    elif cmd.mentions_count == 0:
        response = "Abduct who?"
    elif cmd.mentions_count > 1:
        response = "One victim at a time, please."
    elif shipstate.bit == 1:
        response = 'The ship\'s on the ground right now, it can\'t reach you.'

    else:
        if item_sought:
            target_data = EwUser(member = cmd.mentions[0])
            target_poi = poi_static.id_to_poi.get(target_data.poi)
            target_channel = fe_utils.get_channel(cmd.message.guild, target_poi.channel)

            if target_poi.id_poi == 'blackpond' or (
                        not target_poi.is_district and not target_poi.is_outskirts and not target_poi.is_pier and target_poi.id_poi not in [
                    ewcfg.poi_id_slimesendcliffs, ewcfg.poi_id_ferry, ewcfg.poi_id_sodafountain,
                    ewcfg.poi_id_stockexchange, ewcfg.poi_id_ab_farms, ewcfg.poi_id_og_farms, ewcfg.poi_id_jr_farms]):
                response = "The tractor beam on this ship sucks. You can't really see indoors."
                return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
            elif target_poi.id_poi in [ewcfg.poi_id_rowdyroughhouse, ewcfg.poi_id_copkilltown]:
                response = "Don't do that."
                return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

            bknd_item.item_delete(id_item=item_sought.get('id_item'))
            ewutils.moves_active[target_data.id_user] = 0
            response = 'You plug in your battery pack and begin to abduct {} They\'re 20 seconds away.'.format(cmd.mentions[0].display_name)
            await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

            await fe_utils.send_message(cmd.client, target_channel, fe_utils.formatMessage(cmd.mentions[0], "You are being abducted by aliens. The ship is 20 seconds away."))
            ewutils.active_restrictions[target_data.id_user] = 2
            await asyncio.sleep(20)

            ewutils.active_restrictions[target_data.id_user] = 0
            ewutils.moves_active[cmd.message.author.id] = 0
            target_data.poi = 'ufoufo'
            user_data.persist()
            target_data.persist()

            await ewrolemgr.updateRoles(client=ewutils.get_client(), member=cmd.mentions[0])
            await target_data.move_inhabitants(id_poi='ufoufo')


        else:
            response = "The going energy cost for abduction is pretty expensive these days. You better have a battery pack before you do something like that."

    return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 17
0
async def smelt(cmd):
    user_data = EwUser(member=cmd.message.author)
    if user_data.life_state == ewcfg.life_state_shambler:
        response = "You lack the higher brain functions required to {}.".format(cmd.tokens[0])
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    # Find sought recipe.
    if cmd.tokens_count > 1:
        sought_result = ewutils.flattenTokenListToString(cmd.tokens[1:])
        found_recipe = smelting.smelting_recipe_map.get(sought_result)

        if found_recipe != None:
            if 'soul' in found_recipe.products:
                return await smeltsoul(cmd=cmd)

            # Checks what ingredients are needed to smelt the recipe.
            necessary_ingredients = found_recipe.ingredients
            necessary_ingredients_list = []

            owned_ingredients = []

            # Seeks out the necessary ingredients in your inventory.
            missing_ingredients = []

            for matched_item in necessary_ingredients:
                necessary_items = necessary_ingredients.get(matched_item)
                necessary_str = "{} {}".format(necessary_items, matched_item)
                if necessary_items > 1:
                    necessary_str += "s"
                necessary_ingredients_list.append(necessary_str)

                sought_items = itm_utils.find_item_all(item_search=matched_item, id_user=user_data.id_user, id_server=user_data.id_server)
                missing_items = necessary_items - len(sought_items)
                if missing_items > 0:
                    missing_str = "{} {}".format(missing_items, matched_item)
                    if missing_items > 1:
                        missing_str += "s"
                    missing_ingredients.append(missing_str)
                else:
                    for i in range(necessary_ingredients.get(matched_item)):
                        sought_item = sought_items.pop()
                        owned_ingredients.append(sought_item.get('id_item'))

            # If you don't have all the necessary ingredients.
            if len(missing_ingredients) > 0:
                response = "You've never done this before, have you? To smelt {}, you’ll need to combine *{}*.".format(found_recipe.str_name, ewutils.formatNiceList(names=necessary_ingredients_list, conjunction="and"))

                response += " You are missing *{}*.".format(ewutils.formatNiceList(names=missing_ingredients, conjunction="and"))

            else:
                # If you try to smelt a random cosmetic, use old smelting code to calculate what your result will be.
                if found_recipe.id_recipe == "coolcosmetic" or found_recipe.id_recipe == "toughcosmetic" or found_recipe.id_recipe == "smartcosmetic" or found_recipe.id_recipe == "beautifulcosmetic" or found_recipe.id_recipe == "cutecosmetic":

                    if not bknd_item.check_inv_capacity(user_data=user_data, item_type=ewcfg.it_cosmetic):
                        response = "You can't carry anymore cosmetic items."
                        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

                    patrician_rarity = 100
                    patrician_smelted = random.randint(1, patrician_rarity)
                    patrician = False

                    if patrician_smelted <= 5:
                        patrician = True

                    cosmetics_list = []

                    if found_recipe.id_recipe == "toughcosmetic":
                        style = ewcfg.style_tough
                    elif found_recipe.id_recipe == "smartcosmetic":
                        style = ewcfg.style_smart
                    elif found_recipe.id_recipe == "beautifulcosmetic":
                        style = ewcfg.style_beautiful
                    elif found_recipe.id_recipe == "cutecosmetic":
                        style = ewcfg.style_cute
                    else:
                        style = ewcfg.style_cool

                    for result in static_cosmetics.cosmetic_items_list:
                        if result.style == style and result.acquisition == ewcfg.acquisition_smelting:
                            cosmetics_list.append(result)
                        else:
                            pass

                    items = []

                    for cosmetic in cosmetics_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_props = itm_utils.gen_item_props(item)

                    bknd_item.item_create(
                        item_type=item.item_type,
                        id_user=cmd.message.author.id,
                        id_server=cmd.guild.id,
                        item_props=item_props
                    )

                # If you're trying to smelt a specific item.
                else:
                    possible_results = []

                    # Matches the recipe's listed products to actual items.
                    for result in vendors.smelt_results:
                        if hasattr(result, 'id_item'):
                            if result.id_item not in found_recipe.products:
                                pass
                            else:
                                possible_results.append(result)
                        if hasattr(result, 'id_food'):
                            if result.id_food not in found_recipe.products:
                                pass
                            else:
                                possible_results.append(result)
                        if hasattr(result, 'id_cosmetic'):
                            if result.id_cosmetic not in found_recipe.products:
                                pass
                            else:
                                possible_results.append(result)
                        if hasattr(result, 'id_weapon'):
                            if result.id_weapon not in found_recipe.products:
                                pass
                            else:
                                possible_results.append(result)
                        if hasattr(result, 'id_furniture'):
                            if result.id_furniture not in found_recipe.products:
                                pass
                            else:
                                possible_results.append(result)
                    # If there are multiple possible products, randomly select one.
                    item = random.choice(possible_results)

                    if not bknd_item.check_inv_capacity(user_data=user_data, item_type=item.item_type):
                        response = "You can't carry any more {}s.".format(item.item_type)
                        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

                    item_props = itm_utils.gen_item_props(item)

                    newitem_id = bknd_item.item_create(
                        item_type=item.item_type,
                        id_user=cmd.message.author.id,
                        id_server=cmd.guild.id,
                        item_props=item_props
                    )

                for id_item in owned_ingredients:
                    item_check = EwItem(id_item=id_item)
                    if item_check.item_props.get('id_cosmetic') != 'soul':
                        bknd_item.item_delete(id_item=id_item)
                    else:
                        newitem = EwItem(id_item=newitem_id)
                        newitem.item_props['target'] = id_item
                        newitem.persist()
                        bknd_item.give_item(id_item=id_item, id_user='******', id_server=cmd.guild.id)

                name = ""
                if hasattr(item, 'str_name'):
                    name = item.str_name
                elif hasattr(item, 'id_weapon'):
                    name = item.id_weapon

                response = "You sacrifice your {} to smelt a {}!!".format(ewutils.formatNiceList(names=necessary_ingredients_list, conjunction="and"), name)

                user_data.persist()

        else:
            response = "There is no recipe by the name."

    else:
        response = "Please specify a desired smelt result."

    # Send response
    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Esempio n. 18
0
async def barter(cmd):
    user_data = EwUser(member=cmd.message.author)
    mutations = user_data.get_mutations()

    if ewutils.channel_name_is_poi(cmd.message.channel.name) == False:
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You must {} in a zone's channel.".format(cmd.tokens[0])))

    market_data = EwMarket(id_server=user_data.id_server)
    item_search = ewutils.flattenTokenListToString(cmd.tokens[1:])
    item_sought = bknd_item.find_item(item_search=item_search, id_user=cmd.message.author.id, id_server=cmd.guild.id if cmd.guild is not None else None)

    # Checking availability of appraisal
    # if market_data.clock < 8 or market_data.clock > 17:
    #	response = "You ask the bartender if he knows someone who would want to trade you something for your recently caught fish. Apparently, at night, an old commodore by the name of Captain Albert Alexander comes to drown his sorrows at this very tavern. You guess you’ll just have to sit here and wait for him, then."

    if cmd.message.channel.name != ewcfg.channel_speakeasy:
        if user_data.poi in poi_static.piers:
            response = 'You ask a nearby fisherman if he wants to trade you anything for this fish you just caught. He tells you to f**k off, but also helpfully informs you that there’s an old sea captain that frequents the Speakeasy that might be able to help you. What an inexplicably helpful/grouchy fisherman!'
        else:
            response = 'What random passerby is going to give two shits about your fish? You’ll have to consult a fellow fisherman… perhaps you’ll find some on a pier?'
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    if user_data.life_state == ewcfg.life_state_corpse:
        response = 'Captain Albert Alexander hits the table with his glass and shouts "Nay laddy, you can fool me once but not twice! I dont do deals with spirits, get out of my sight!"'
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    elif item_sought:

        name = item_sought.get('name')
        fish = EwItem(id_item=item_sought.get('id_item'))
        id_fish = fish.id_item
        # str_fish = fish.item_props.get('str_name')
        item_props = fish.item_props
        acquisition = item_props.get('acquisition')
        response = "You approach a man of particularly swashbuckling appearance, adorned in an old sea captain's uniform and bicorne cap, and surrounded by empty glass steins. You ask him if he is Captain Albert Alexander and he replies that he hasn’t heard that name in a long time. You submit your {} for bartering".format(name)

        if acquisition != ewcfg.acquisition_fishing:
            response += '. \n"Have you lost yer mind, laddy? That’s not a fish!! Just what’re you trying to pull??"'

        else:
            value = int(item_props['value'])

            items = []

            # Filters out all non-generic items without the current fish as an ingredient.
            for result in vendors.appraise_results:
                if result.ingredients == fish.item_props.get('id_item') or result.ingredients == "generic" and result.acquisition == ewcfg.acquisition_bartering:  # Generic means that it can be made with any fish.
                    items.append(result)
                else:
                    pass

            # Filters out items of greater value than your fish.
            for value_filter in items:
                if value < value_filter.context:
                    items.remove(value_filter)
                else:
                    pass

            else:
                offer = EwOffer(
                    id_server=cmd.guild.id,
                    id_user=cmd.message.author.id,
                    offer_give=id_fish
                )

                cur_time_min = time.time() / 60
                time_offered = cur_time_min - offer.time_sinceoffer

                if offer.time_sinceoffer > 0 and time_offered < ewcfg.fish_offer_timeout:
                    offer_receive = str(offer.offer_receive)

                    if offer_receive.isdigit() == True and ewcfg.mutation_id_onemansjunk in mutations:
                        item = random.choice(items)

                        if hasattr(item, 'id_item'):
                            offer.offer_receive = item.id_item

                        if hasattr(item, 'id_food'):
                            offer.offer_receive = item.id_food

                        if hasattr(item, 'id_cosmetic'):
                            offer.offer_receive = item.id_cosmetic

                        response = '\n"Well, back again I see! That fish certainly looked better the last time I saw it. Best I’ll do is trade ya a {} for your {}."'.format(item.str_name, name)
                    elif offer_receive.isdigit() == True:
                        slime_gain = int(offer.offer_receive)

                        response = '\n"Well, back again I see! My offer still stands, I’ll trade ya {} slime for your {}"'.format(slime_gain, name)

                    elif ewcfg.mutation_id_davyjoneskeister in mutations and item_props.get('noslime') != "true":
                        max_value = value * 6000  # 600,000 slime for a colossal promo fish, 120,000 for a miniscule common fish.
                        min_value = max_value / 10  # 60,000 slime for a colossal promo fish, 12,000 for a miniscule common fish.

                        slime_gain = round(random.triangular(min_value, max_value, min_value * 2))

                        offer.offer_receive = slime_gain
                        offer.persist()
                        response = '\n"You know what, laddy? I like the cut of your jib. I\'ll change my offer. How about {} slime for your {}?"'.format(slime_gain, name)

                    else:
                        for result in vendors.appraise_results:
                            if hasattr(result, 'id_item'):
                                if result.id_item != offer.offer_receive:
                                    pass
                                else:
                                    item = result

                            if hasattr(result, 'id_food'):
                                if result.id_food != offer.offer_receive:
                                    pass
                                else:
                                    item = result

                            if hasattr(result, 'id_cosmetic'):
                                if result.id_cosmetic != offer.offer_receive:
                                    pass
                                else:
                                    item = result

                        response = '\n"Well, back again I see! My offer still stands, I’ll trade ya a {} for your {}"'.format(item.str_name, name)

                    response += "\n**!accept** or **!refuse** Captain Albert Alexander's deal."

                    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

                else:
                    # Random choice between 0, 1, and 2
                    offer_decision = random.randint(0, 2)

                    if (offer_decision != 2 or ewcfg.mutation_id_davyjoneskeister in mutations) and item_props.get('noslime') != "true" and ewcfg.mutation_id_onemansjunk not in mutations:  # If Captain Albert Alexander wants to offer you slime for your fish. 66% chance.
                        max_value = value * 6000  # 600,000 slime for a colossal promo fish, 120,000 for a miniscule common fish.
                        min_value = max_value / 10  # 60,000 slime for a colossal promo fish, 12,000 for a miniscule common fish.

                        slime_gain = round(random.triangular(min_value, max_value, min_value * 2))

                        offer.offer_receive = slime_gain

                        response = '"Hm, alright… for this {}... I’ll offer you {} slime! Trust me, you’re not going to get a better deal anywhere else, laddy."'.format(name, slime_gain)

                    else:  # If Captain Albert Alexander wants to offer you an item for your fish. 33% chance. Once there are more unique items, we'll make this 50%.
                        item = random.choice(items)

                        if hasattr(item, 'id_item'):
                            offer.offer_receive = item.id_item

                        if hasattr(item, 'id_food'):
                            offer.offer_receive = item.id_food

                        if hasattr(item, 'id_cosmetic'):
                            offer.offer_receive = item.id_cosmetic

                        response = '"Hm, alright… for this {}... I’ll offer you a {}! Trust me, you’re not going to get a better deal anywhere else, laddy."'.format(name, item.str_name)

                    offer.time_sinceoffer = int(time.time() / 60)
                    offer.persist()

                    response += "\n**!accept** or **!refuse** Captain Albert Alexander's deal."

                    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

                # Wait for an answer
                accepted = False

                try:
                    message = await cmd.client.wait_for('message', timeout=20, check=lambda message: message.author == cmd.message.author and
                                                                                                     message.content.lower() in [ewcfg.cmd_accept, ewcfg.cmd_refuse])

                    if message != None:
                        if message.content.lower() == ewcfg.cmd_accept:
                            accepted = True
                        if message.content.lower() == ewcfg.cmd_refuse:
                            accepted = False
                except:
                    accepted = False

                offer = EwOffer(
                    id_server=cmd.guild.id,
                    id_user=cmd.message.author.id,
                    offer_give=id_fish
                )

                user_data = EwUser(member=cmd.message.author)
                fish = EwItem(id_item=id_fish)

                # cancel deal if fish is no longer in user's inventory
                if fish.id_owner != str(user_data.id_user):
                    accepted = False

                # cancel deal if the user has left Vagrant's Corner
                if user_data.poi != ewcfg.poi_id_speakeasy:
                    accepted = False

                # cancel deal if the offer has been deleted
                if offer.time_sinceoffer == 0:
                    accepted = False

                if accepted == True:
                    offer_receive = str(offer.offer_receive)

                    response = ""

                    if offer_receive.isdigit() == True:
                        slime_gain = int(offer_receive)

                        user_initial_level = user_data.slimelevel

                        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
                            response += "\n\n"

                    else:
                        item_props = itm_utils.gen_item_props(item)

                        bknd_item.item_create(
                            item_type=item.item_type,
                            id_user=cmd.message.author.id,
                            id_server=cmd.guild.id,
                            item_props=item_props
                        )

                    bknd_item.item_delete(id_item=item_sought.get('id_item'))

                    user_data.persist()

                    offer.deal()

                    response += '"Pleasure doing business with you, laddy!"'

                else:
                    response = '"Ah, what a shame. Maybe you’ll change your mind in the future…?"'

    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 = "Offer Captain Albert Alexander which fish? (check **!inventory**)"

    await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))