示例#1
0
async def create(cmd):
    # if not cmd.message.author.guild_permissions.administrator:
    if EwUser(
            member=cmd.message.author
    ).life_state != ewcfg.life_state_kingpin and not cmd.message.author.guild_permissions.administrator:
        response = 'Lowly Non-Kingpins cannot hope to create items with their bare hands.'
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    if len(cmd.tokens) not in [4, 5, 6]:
        response = 'Usage: !create "<item_name>" "<item_desc>" <recipient> <rarity(optional)>, <context>(optional)'
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    item_name = cmd.tokens[1]
    item_desc = cmd.tokens[2]
    rarity = cmd.tokens[4] if len(
        cmd.tokens) >= 5 and ewutils.flattenTokenListToString(
            cmd.tokens[4]) in ['princeps', 'plebeian', 'patrician'
                               ] else 'princeps'
    context = cmd.tokens[5] if len(cmd.tokens) >= 6 else ''

    if cmd.mentions[0]:
        recipient = cmd.mentions[0]
    else:
        response = 'You need to specify a recipient. Usage: !create "<item_name>" "<item_desc>" <recipient>'
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    item_props = {
        "cosmetic_name": item_name,
        "cosmetic_desc": item_desc,
        "adorned": "false",
        "rarity": rarity,
        "context": context
    }

    new_item_id = bknd_item.item_create(id_server=cmd.guild.id,
                                        id_user=recipient.id,
                                        item_type=ewcfg.it_cosmetic,
                                        item_props=item_props)

    itm_utils.soulbind(new_item_id)

    response = 'Item "{}" successfully created.'.format(item_name)
    return await fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
示例#2
0
async def exalt(cmd):
    author = cmd.message.author
    user_data = EwUser(member=author)

    if not author.guild_permissions.administrator and user_data.life_state != ewcfg.life_state_kingpin:
        response = "You do not have the power within you worthy of !exalting another player."
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    if cmd.mentions_count > 0:
        recipient = cmd.mentions[0]
    else:
        response = 'You need to specify a recipient. Usage: !exalt @[recipient].'
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    recipient_data = EwUser(member=recipient)

    # 	DOUBLE HALLOWEEN
    #
    # 	# Gather the Medallion
    if ewcfg.dh_active:
        medallion_results = []
        for m in cosmetics.cosmetic_items_list:
            if m.ingredients == 'HorsemanSoul':
                medallion_results.append(m)
            else:
                pass

        medallion = medallion_results[0]
        medallion_props = itm_utils.gen_item_props(medallion)

        medallion_id = bknd_item.item_create(item_type=medallion.item_type,
                                             id_user=recipient.id,
                                             id_server=cmd.guild.id,
                                             item_props=medallion_props)

        # Soulbind the medallion. A player can get at most twice, but later on a new command could be added to destroy them/trade them in.
        # I imagine this would be something similar to how players can destroy Australium Wrenches in TF2, which broadcasts a message to everyone in the game, or something.
        itm_utils.soulbind(medallion_id)

        response = "**{} has been gifted the Double Halloween Medallion!!**\n".format(
            recipient.display_name)
    elif ewcfg.swilldermuk_active:

        # 	SWILLDERMUK
        gambit = ewstats.get_stat(id_server=cmd.guild.id,
                                  id_user=recipient_data.id_user,
                                  metric=ewcfg.stat_gambit)
        if gambit > 0:
            # Give the user the Janus Mask

            mask_results = []
            for m in cosmetics.cosmetic_items_list:
                if m.ingredients == 'SwilldermukFinalGambit':
                    mask_results.append(m)
                else:
                    pass

            mask = mask_results[0]
            mask_props = itm_utils.gen_item_props(mask)

            mask_id = bknd_item.item_create(item_type=mask.item_type,
                                            id_user=recipient.id,
                                            id_server=cmd.guild.id,
                                            item_props=mask_props)

            itm_utils.soulbind(mask_id)

            response = "In light of their supreme reign over Swilldermuk, and in honor of their pranking prowess, {} recieves the Janus Mask!".format(
                recipient.display_name)

        else:
            # Give the user the Sword of Seething
            sword_results = []
            for s in static_items.item_list:
                if s.context == 'swordofseething':
                    sword_results.append(s)
                else:
                    pass

            sword = sword_results[0]
            sword_props = itm_utils.gen_item_props(sword)

            sword_id = bknd_item.item_create(item_type=sword.item_type,
                                             id_user=recipient.id,
                                             id_server=cmd.guild.id,
                                             item_props=sword_props)

            itm_utils.soulbind(sword_id)

            response = "In response to their unparalleled ability to let everything go to shit and be the laughingstock of all of NLACakaNM, {} recieves the SWORD OF SEETHING! God help us all...".format(
                recipient.display_name)
    else:
        response = "Exalting? Nah, not enough holiday cheer."

    return await fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
示例#3
0
async def create(cmd):
    # if not cmd.message.author.guild_permissions.administrator:
    #if EwUser(member=cmd.message.author).life_state != ewcfg.life_state_kingpin and not cmd.message.author.guild_permissions.administrator:
    if not (0 < ewrolemgr.checkClearance(member=cmd.message.author) <
            4) or EwUser(member=cmd.message.author
                         ).life_state != ewcfg.life_state_kingpin:
        response = 'Lowly Non-Kingpins cannot hope to create items with their bare hands.'
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    if len(cmd.tokens) not in [4, 5, 6]:
        response = 'Usage: !create "<item_name>" "<item_desc>" <recipient> <rarity(optional)>, <context>(optional)'
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    item_name = cmd.tokens[1]
    item_desc = cmd.tokens[2]
    rarity = cmd.tokens[4] if len(
        cmd.tokens) >= 5 and ewutils.flattenTokenListToString(
            cmd.tokens[4]) in ['princeps', 'plebeian', 'patrician'
                               ] else 'princeps'
    context = cmd.tokens[5] if len(cmd.tokens) >= 6 else ''

    if cmd.mentions[0]:
        recipient = cmd.mentions[0]
    else:
        response = 'You need to specify a recipient. Usage: !create "<item_name>" "<item_desc>" <recipient>'
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))
    # princeps stopped assigning durability and stuff for... reasons (idk!!!! something with the caching update???? As far as I can tell????) so I just assigned them here lol
    item_props = {
        "id_cosmetic": "princep",
        "cosmetic_name": item_name,
        "cosmetic_desc": item_desc,
        "str_onadorn": ewcfg.str_generic_onadorn,
        "str_unadorn": ewcfg.str_generic_unadorn,
        "str_onbreak": ewcfg.str_generic_onbreak,
        "rarity": rarity,
        "attack": 3,
        "defense": 3,
        "speed": 3,
        "ability": None,
        "durability": ewcfg.base_durability * 100,
        "size": 1,
        "fashion_style": ewcfg.style_cool,
        "freshness": 100,
        "adorned": "false",
        "context": context
    }

    new_item_id = bknd_item.item_create(id_server=cmd.guild.id,
                                        id_user=recipient.id,
                                        item_type=ewcfg.it_cosmetic,
                                        item_props=item_props)

    itm_utils.soulbind(new_item_id)

    response = 'Item "{}" successfully created.'.format(item_name)
    return await fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
async def create(cmd):
    """ 
    Command that creates a princeps cosmetic item. Usable only by admins and kingpins.
        - !create item_name item_desc recipient style rarity context
    
    """
    # Only BD admins and above can create princeps
    if (ewrolemgr.check_clearance(member=cmd.message.author) > 3) and (EwUser(
            member=cmd.message.author).life_state != ewcfg.life_state_kingpin):
        response = 'Lowly Non-Kingpins cannot hope to create items with their bare hands.'
        return await fe_utils.send_response(response, cmd)

    if len(cmd.tokens) not in [4, 5, 6, 7]:
        response = 'Usage: !create "<item_name>" "<item_desc>" <recipient> <style>(optional) <rarity(optional)>, <context>(optional).\n'
        return await fe_utils.send_response(response, cmd)

    item_name = cmd.tokens[1]
    item_desc = cmd.tokens[2]
    # recipient is the third token
    style = cmd.tokens[4] if len(
        cmd.tokens) >= 5 and ewutils.flattenTokenListToString(
            cmd.tokens[4]) in ewcfg.fashion_styles else ewcfg.style_cool
    rarity = cmd.tokens[5] if len(
        cmd.tokens) >= 6 and ewutils.flattenTokenListToString(
            cmd.tokens[5]) in ['princeps', 'plebeian', 'patrician'
                               ] else 'princeps'
    context = cmd.tokens[6] if len(cmd.tokens) >= 7 else ''

    if cmd.mentions and cmd.mentions[0]:
        recipient = cmd.mentions[0]
    else:
        response = 'You need to specify a recipient. Usage: !create "<item_name>" "<item_desc>" <recipient> <style>(optional) <rarity>(optional) <context>(optional)'
        return await fe_utils.send_response(response, cmd)

    # princeps stopped assigning durability and stuff for... reasons (idk!!!! something with the caching update???? As far as I can tell????) so I just assigned them here lol
    item_props = {
        "id_cosmetic": "princep",
        "cosmetic_name": item_name,
        "cosmetic_desc": item_desc,
        "str_onadorn": ewcfg.str_generic_onadorn,
        "str_unadorn": ewcfg.str_generic_unadorn,
        "str_onbreak": ewcfg.str_generic_onbreak,
        "rarity": rarity,
        "attack": 3,
        "defense": 3,
        "speed": 3,
        "ability": None,
        "durability": ewcfg.base_durability * 100,
        "size": 1,
        "fashion_style": style,
        "freshness": 100,
        "adorned": "false",
        "context": context
    }

    new_item_id = bknd_item.item_create(id_server=cmd.guild.id,
                                        id_user=recipient.id,
                                        item_type=ewcfg.it_cosmetic,
                                        item_props=item_props)

    itm_utils.soulbind(new_item_id)

    response = 'Item "{}" successfully created.'.format(item_name)
    return await fe_utils.send_response(response, cmd)