async def launch(cmd):
    user_data = EwUser(member=cmd.message.author)
    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

    if user_data.poi != 'ufoufo':
        response = "Launch 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."
    else:
        launchstate = EwGamestate(id_state='shipstate', id_server=cmd.guild.id)
        if launchstate.bit == 1:
            response = "PCHOOOOOOOOOO! Weird bleeps and bloops begin to increase in frequency as the ship rises back into the air!"
            launchstate.bit = 0
            launchstate.persist()
        else:
            response = "WHOOOOOOOO -CRASH! Your poor piloting crashes the ship back down. Your fellow alien crew seems excited, like you just chugged a whole bottle of their galactic lager or something. Good thing the hull is so shock resistant or you wouldn't be able to joyride again."
            launchstate.bit = 1
            launchstate.persist()
    return await fe_utils.send_message(cmd.client, cmd.message.channel,fe_utils.formatMessage(cmd.message.author, response))
示例#2
0
def canCreateRelic(item, id_server, createstate=0):
    state = EwGamestate(id_server=id_server, id_state=item)

    if state.bit is not None:
        return None
    else:
        state.bit = 0
        state.value = ""
        if createstate == 1:
            state.persist()
        return 1
async def blockparty(cmd):
    if not cmd.message.author.guild_permissions.administrator:
        return
    else:
        blockstate = EwGamestate(id_server=cmd.guild.id, id_state='blockparty')
        if cmd.tokens_count > 1:
                if cmd.tokens[1] == 'slimegen':
                    blockstate.bit = 1
                    blockstate.persist()
                    response = "Slimegen turned on."
                elif cmd.tokens[1] == 'close':
                    blockstate.bit = 0
                    blockstate.value = ''
                    blockstate.persist()
                    response = "OK, closing up."
                else:
                    poi_sought = ewutils.flattenTokenListToString(cmd.tokens[1:])
                    poi = poi_static.id_to_poi.get(poi_sought)
                    if poi is not None:
                        time_end = int(time()) + (60 * 60 * 6) # 6 hours
                        blockstate.value = "{}{}".format(poi.id_poi, time_end)
                        blockstate.persist()
                        response = "Block party in {}! Everybody in!".format(poi.str_name)
                    else:
                        response = "Never heard of it."
        else:
            response = "I see you haven't gotten any smarter. Try !blockparty <setting>. Settings include 'close', 'slimegen', and any POI."
    return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))