예제 #1
0
async def smoke(cmd):
    usermodel = EwUser(member=cmd.message.author)
    #item_sought = ewitem.find_item(item_search="cigarette", id_user=cmd.message.author.id, id_server=usermodel.id_server)
    item_sought = None
    space_adorned = 0
    item_stash = ewitem.inventory(id_user=cmd.message.author.id,
                                  id_server=usermodel.id_server)
    for item_piece in item_stash:
        item = EwItem(id_item=item_piece.get('id_item'))
        if item.item_props.get('adorned') == 'true':
            space_adorned += int(item.item_props.get('size'))

        if item_piece.get('item_type') == ewcfg.it_cosmetic and (
                item.item_props.get('id_cosmetic') == "cigarette"
                or item.item_props.get('id_cosmetic') == "cigar"
        ) and "lit" not in item.item_props.get('cosmetic_desc'):
            item_sought = item_piece

    if item_sought:
        item = EwItem(id_item=item_sought.get('id_item'))
        if item_sought.get(
                'item_type') == ewcfg.it_cosmetic and item.item_props.get(
                    'id_cosmetic') == "cigarette":
            if int(item.item_props.get('size')) > 0:
                space_adorned += int(item.item_props.get('size'))

            if space_adorned < ewutils.max_adornspace_bylevel(
                    usermodel.slimelevel):
                response = "You light a cig and bring it to your mouth. So relaxing. So *cool*. All those naysayers and PSAs in Health class can go f**k themselves."
                item.item_props[
                    'cosmetic_desc'] = "A single lit cigarette sticking out of your mouth. You huff these things down in seconds but you’re never seen without one. Everyone thinks you’re really, really cool."
                item.item_props['adorned'] = "true"
                item.persist()

                usermodel.persist()

                await ewutils.send_message(
                    cmd.client, cmd.message.channel,
                    ewutils.formatMessage(cmd.message.author, response))
                await asyncio.sleep(60)
                item = EwItem(id_item=item_sought.get('id_item'))

                response = "The cigarette fizzled out."

                item.item_props[
                    'cosmetic_desc'] = "It's a cigarette butt. What kind of hoarder holds on to these?"
                item.item_props['adorned'] = "false"
                item.item_props['id_cosmetic'] = "cigarettebutt"
                item.item_props['cosmetic_name'] = "cigarette butt"
                item.persist()

                usermodel.persist()

            else:
                response = "Sadly, you cannot smoke the cigarette. To smoke it, you'd have to have it inbetween your lips for approximately a minute, which technically counts as adorning something. " \
                     "And, seeing as you are out of adornable cosmetic space, you cannot do that. Sorry. Weird how this message doesn't show up when you suck all that dick though, huh?"

        elif item_sought.get(
                'item_type') == ewcfg.it_cosmetic and item.item_props.get(
                    'id_cosmetic') == "cigar":
            if int(item.item_props['size']) > 0:
                space_adorned += int(item.item_props['size'])

            if space_adorned < ewutils.max_adornspace_bylevel(
                    usermodel.slimelevel):
                response = "You light up your stogie and bring it to your mouth. So relaxing. So *cool*. All those naysayers and PSAs in Health class can go f**k themselves."
                item.item_props[
                    'cosmetic_desc'] = "A single lit cigar sticking out of your mouth. These thing take their time to kick in, but it's all worth it to look like a supreme gentleman."
                item.item_props['adorned'] = "true"

                item.persist()

                usermodel.persist()

                await ewutils.send_message(
                    cmd.client, cmd.message.channel,
                    ewutils.formatMessage(cmd.message.author, response))
                await asyncio.sleep(300)
                item = EwItem(id_item=item_sought.get('id_item'))

                response = "The cigar fizzled out."

                item.item_props[
                    'cosmetic_desc'] = "It's a cigar stump. It's seen better days."
                item.item_props['adorned'] = "false"
                item.item_props['id_cosmetic'] = "cigarstump"
                item.item_props['cosmetic_name'] = "cigar stump"
                item.persist()

                usermodel.persist()

            else:
                response = "Sadly, you cannot smoke the cigar. To smoke it, you'd have to have it inbetween your lips for approximately a minute, which technically counts as adorning something. " \
                     "And, seeing as you are out of adornable cosmetic space, you cannot do that. Sorry. Weird how this message doesn't show up when you suck all that dick though, huh?"
        else:
            response = "You can't smoke that."
    else:
        response = "There aren't any usable cigarettes or cigars in your inventory."
    return await ewutils.send_message(
        cmd.client, cmd.message.channel,
        ewutils.formatMessage(cmd.message.author, response))
예제 #2
0
async def adorn(cmd):
    user_data = EwUser(member=cmd.message.author)

    # Check to see if you even have the item you want to repair
    item_id = ewutils.flattenTokenListToString(cmd.tokens[1:])

    try:
        item_id_int = int(item_id)
    except:
        item_id_int = None

    if item_id is not None and len(item_id) > 0:
        response = "You don't have one."

        cosmetic_items = ewitem.inventory(id_user=cmd.message.author.id,
                                          id_server=cmd.guild.id,
                                          item_type_filter=ewcfg.it_cosmetic)

        item_sought = None
        item_from_slimeoid = None
        already_adorned = False
        space_adorned = 0

        for item in cosmetic_items:
            i = EwItem(item.get('id_item'))
            # Get space used adorned cosmetics
            if i.item_props['adorned'] == 'true':
                space_adorned += int(i.item_props['size'])

        # Check all cosmetics found
        for item in cosmetic_items:
            i = EwItem(item.get('id_item'))

            # Search for desired cosmetic
            if item.get(
                    'id_item'
            ) == item_id_int or item_id in ewutils.flattenTokenListToString(
                    item.get('name')):

                if item_from_slimeoid == None and i.item_props.get(
                        "slimeoid") == 'true':
                    item_from_slimeoid = i
                    continue
                if i.item_props.get("adorned") == 'true':
                    already_adorned = True
                elif i.item_props.get("context") == 'costume':
                    if not ewutils.check_fursuit_active(i.id_server):
                        response = "You can't adorn your costume right now."
                    else:
                        item_sought = i
                        break
                else:
                    item_sought = i
                    break

        if item_sought == None:
            item_sought = item_from_slimeoid

        # If the cosmetic you want to adorn is found
        if item_sought != None:

            # Calculate how much space you'll have after adorning...
            if int(item_sought.item_props['size']) > 0:
                space_adorned += int(item_sought.item_props['size'])

            # If you don't have enough space, abort
            if space_adorned > ewutils.max_adornspace_bylevel(
                    user_data.slimelevel):
                response = "Oh yeah? And, pray tell, just how do you expect to do that? You’re out of space, you can’t adorn any more garments!"

            # If you have enough space, adorn
            else:
                item_sought.item_props['adorned'] = 'true'

                # Take the hat from your slimeoid if necessary
                if item_sought.item_props.get('slimeoid') == 'true':
                    item_sought.item_props['slimeoid'] = 'false'
                    response = "You take your {} from your slimeoid and successfully adorn it.".format(
                        item_sought.item_props.get('cosmetic_name'))
                else:
                    onadorn_response = item_sought.item_props['str_onadorn']
                    response = onadorn_response.format(
                        item_sought.item_props['cosmetic_name'])

                item_sought.persist()
                user_data.persist()

        elif already_adorned:
            response = "You already have that garment adorned!"

        await ewutils.send_message(
            cmd.client, cmd.message.channel,
            ewutils.formatMessage(cmd.message.author, response))
    else:
        await ewutils.send_message(
            cmd.client, cmd.message.channel,
            ewutils.formatMessage(
                cmd.message.author,
                'Adorn which cosmetic? Check your **!inventory**.'))