Ejemplo n.º 1
0
async def pardon(cmd):
    user_data = EwUser(member=cmd.message.author)

    if user_data.life_state != ewcfg.life_state_kingpin and user_data.life_state != ewcfg.life_state_executive and not cmd.message.author.guild_permissions.administrator:
        response = "Only the Rowdy F****r {} and the Cop Killer {} can do that.".format(
            ewcfg.emote_rowdyfucker, ewcfg.emote_copkiller,
            ewcfg.emote_slimecorp)
    else:
        member = None
        if cmd.mentions_count == 1:
            member = cmd.mentions[0]
            if member.id == cmd.message.author.id:
                member = None

        if member == None:
            response = "Who?"
        else:
            member_data = EwUser(member=member)
            member_data.unban(faction=user_data.faction)

            if member_data.faction == "":
                response = "{} has been allowed to join the {} again.".format(
                    member.display_name, user_data.faction)
            else:
                faction_old = member_data.faction
                member_data.faction = ""

                if member_data.life_state == ewcfg.life_state_enlisted:
                    member_data.life_state = ewcfg.life_state_juvenile
                    member_data.weapon = -1
                    member_data.sidearm = -1

                response = "{} has been released from their association with the {}.".format(
                    member.display_name, faction_old)

            member_poi = poi_static.id_to_poi.get(member_data.poi)
            if move_utils.inaccessible(user_data=member_data, poi=member_poi):
                member_data.poi = ewcfg.poi_id_downtown
            member_data.persist()
            await ewrolemgr.updateRoles(client=cmd.client, member=member)

    await fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
Ejemplo n.º 2
0
async def banish(cmd):
    user_data = EwUser(member=cmd.message.author)

    if user_data.life_state != ewcfg.life_state_kingpin and user_data.life_state != ewcfg.life_state_executive and not cmd.message.author.guild_permissions.administrator:
        response = "Only the Rowdy F****r {} and the Cop Killer {} can do that.".format(
            ewcfg.emote_rowdyfucker, ewcfg.emote_copkiller)
    else:
        member = None
        if cmd.mentions_count == 1:
            member = cmd.mentions[0]

        # >:]

        # if member.id == cmd.message.author.id:
        # 	member = None

        if member == None:
            response = "Who?"
        else:
            member_data = EwUser(member=member)
            member_data.ban(faction=user_data.faction)
            member_data.unvouch(faction=user_data.faction)

            if member_data.faction == user_data.faction:
                member_data.faction = ""
                if member_data.life_state == ewcfg.life_state_enlisted:
                    member_data.life_state = ewcfg.life_state_juvenile

            member_poi = poi_static.id_to_poi.get(member_data.poi)
            if move_utils.inaccessible(user_data=member_data, poi=member_poi):
                member_data.poi = ewcfg.poi_id_downtown
            member_data.persist()
            response = "{} has been banned from enlisting in the {}".format(
                member.display_name, user_data.faction)
            await ewrolemgr.updateRoles(client=cmd.client, member=member)

    await fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
Ejemplo n.º 3
0
async def revive(cmd, player_auto=None):
    time_now = int(time.time())
    response = ""

    if cmd.message.channel.name != ewcfg.channel_endlesswar and cmd.message.channel.name != ewcfg.channel_sewers and player_auto is None:
        response = "Come to me. I hunger. #{}.".format(ewcfg.channel_sewers)
    else:
        if player_auto:
            player_data = EwUser(id_server=cmd.guild.id, id_user=player_auto)
        else:
            player_data = EwUser(member=cmd.message.author)

        # time_until_revive = (player_data.time_lastdeath + 600) - time_now
        time_until_revive = (player_data.time_lastdeath) - time_now

        if time_until_revive > 0 and player_auto is None:
            response = "ENDLESS WAR is not ready to {} you yet ({}s).".format(
                cmd.tokens[0], time_until_revive)
            return await fe_utils.send_message(
                cmd.client, cmd.message.channel,
                fe_utils.formatMessage(cmd.message.author, response))

        slimeoid = EwSlimeoid(member=cmd.message.author)

        if player_data.life_state == ewcfg.life_state_corpse:
            market_data = EwMarket(id_server=cmd.guild.id)

            # Endless War collects his fee.
            # fee = (player_data.slimecoin / 10)
            # player_data.change_slimecoin(n = -fee, coinsource = ewcfg.coinsource_revival)
            # market_data.slimes_revivefee += fee
            # player_data.busted = False

            # Preserve negaslime
            if player_data.slimes < 0:
                # market_data.negaslime += player_data.slimes
                player_data.change_slimes(n=-player_data.slimes)  # set to 0

            # reset slimelevel to zero
            player_data.slimelevel = 0

            # Set time of last revive. This used to provied spawn protection, but currently isn't used.
            player_data.time_lastrevive = time_now

            if False:  #player_data.degradation >= 100:
                player_data.life_state = ewcfg.life_state_shambler
                player_data.change_slimes(n=0.5 * ewcfg.slimes_shambler)
                player_data.trauma = ""
                poi_death = poi_static.id_to_poi.get(player_data.poi_death)
                if move_utils.inaccessible(poi=poi_death,
                                           user_data=player_data):
                    player_data.poi = ewcfg.poi_id_endlesswar
                else:
                    player_data.poi = poi_death.id_poi
            else:
                # Set life state. This is what determines whether the player is actually alive.
                player_data.life_state = ewcfg.life_state_juvenile
                # Give player some initial slimes.
                player_data.change_slimes(n=ewcfg.slimes_onrevive)
                # Get the player out of the sewers.
                player_data.poi = ewcfg.poi_id_endlesswar

            # Give newly spawned juvies a foul odour
            player_data.applyStatus(ewcfg.status_repelled_id)

            player_data.persist()
            market_data.persist()

            # Shower every district in the city with slime from the sewers.
            sewer_data = EwDistrict(district=ewcfg.poi_id_thesewers,
                                    id_server=cmd.guild.id)
            # the amount of slime showered is divided equally amongst the districts
            districts_amount = len(poi_static.capturable_districts)
            geyser_amount = int(0.5 * sewer_data.slimes / districts_amount)
            # Get a list of all the districts
            for poi in poi_static.capturable_districts:
                district_data = EwDistrict(district=poi,
                                           id_server=cmd.guild.id)

                district_data.change_slimes(n=geyser_amount)
                sewer_data.change_slimes(n=-1 * geyser_amount)

                district_data.persist()
                sewer_data.persist()

            sewer_inv = bknd_item.inventory(id_user=sewer_data.name,
                                            id_server=sewer_data.id_server)
            for item in sewer_inv:
                district = ewcfg.poi_id_slimesea
                if random.random() < 0.5:
                    district = random.choice(poi_static.capturable_districts)
                bknd_item.give_item(id_item=item.get("id_item"),
                                    id_user=district,
                                    id_server=sewer_data.id_server)

            await ewrolemgr.updateRoles(client=cmd.client,
                                        member=cmd.message.author)

            response = '{slime4} Geysers of fresh slime erupt from every manhole in the city, showering their surrounding districts. {slime4} {name} has been reborn in slime. {slime4}'.format(
                slime4=ewcfg.emote_slime4,
                name=cmd.message.author.display_name)
        else:
            response = 'You\'re not dead just yet.'

        #	deathreport = "You were {} by {}. {}".format(kill_descriptor, cmd.message.author.display_name, ewcfg.emote_slimeskull)
        #	deathreport = "{} ".format(ewcfg.emote_slimeskull) + fe_utils.formatMessage(member, deathreport)

        if slimeoid.life_state == ewcfg.slimeoid_state_active:
            reunite = ""
            brain = sl_static.brain_map.get(slimeoid.ai)
            reunite += brain.str_revive.format(slimeoid_name=slimeoid.name)
            new_poi = poi_static.id_to_poi.get(player_data.poi)
            revivechannel = fe_utils.get_channel(cmd.guild, new_poi.channel)
            reunite = fe_utils.formatMessage(cmd.message.author, reunite)
            await fe_utils.send_message(cmd.client, revivechannel, reunite)

    # Send the response to the player.
    await fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
Ejemplo n.º 4
0
async def defect(cmd):
    accepted = False

    member = cmd.message.author

    modauth = 0

    response = "You feel...traitor-ish today. Hey mods, any takers? Let them free, !yes or !no?"
    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=30,
            check=lambda message: 0 < ewrolemgr.checkClearance(
                member=message.author) <= 4 and message.content.lower(
                ) in [ewcfg.cmd_yes, ewcfg.cmd_no])

        if message != None:
            if message.content.lower() == ewcfg.cmd_yes:
                accepted = True
                modauth = message.author
            if message.content.lower() == ewcfg.cmd_no:
                accepted = False

    except Exception as e:
        print(e)
        accepted = False

    if not accepted:
        response = "Well if it isn't the boy who cried backstab. Guess you won't be going anywhere."
        return await fe_utils.send_message(
            cmd.client, cmd.message.channel,
            fe_utils.formatMessage(cmd.message.author, response))

    else:
        member_data = EwUser(member=cmd.message.author)
        mod_data = EwUser(member=modauth)
        member_data.unban(faction=mod_data.faction)

        if member_data.faction == "":
            response = "{} has been allowed to join the {} again.".format(
                member.display_name, mod_data.faction)
        else:
            faction_old = member_data.faction
            member_data.faction = ""

            if member_data.life_state == ewcfg.life_state_enlisted:
                member_data.life_state = ewcfg.life_state_juvenile
                member_data.weapon = -1
                member_data.sidearm = -1

            response = "{} has been released from their association with the {}.".format(
                member.display_name, faction_old)

        member_poi = poi_static.id_to_poi.get(member_data.poi)
        if move_utils.inaccessible(user_data=member_data, poi=member_poi):
            member_data.poi = ewcfg.poi_id_downtown
        member_data.persist()
        await ewrolemgr.updateRoles(client=cmd.client, member=member)

        leak_channel = fe_utils.get_channel(server=cmd.guild,
                                            channel_name='squickyleaks')
        await fe_utils.send_message(
            cmd.client, leak_channel,
            "{}: Let {} defect.".format(modauth.display_name,
                                        member.display_name))

    await fe_utils.send_message(
        cmd.client, cmd.message.channel,
        fe_utils.formatMessage(cmd.message.author, response))
Ejemplo n.º 5
0
async def slap(cmd):
    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])))

    time_now = int(time.time())
    user_data = EwUser(member=cmd.message.author)

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

    target_data = -1

    mutations = user_data.get_mutations()
    resp_cont = EwResponseContainer(id_server=cmd.guild.id)

    if cmd.tokens_count < 3:
        response = "You'll need to specify who and where you're slapping. Try !slap <target> <location>."
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    dest_poi = cmd.tokens[2].lower()
    dest_poi_obj = poi_static.id_to_poi.get(dest_poi)

    response = ""

    if cmd.mentions_count == 0:
        response = "Who are you slapping?"
    elif cmd.mentions_count > 1:
        response = "Nobody's that good at slapping. Do it to one person at a time."
    else:
        target_data = EwUser(member=cmd.mentions[0])

    if response != "":
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))

    if target_data.poi != user_data.poi:
        response = "Not right now. You can't slap what you can't see."
    elif user_data.id_user == target_data.id_user:
        response = "Stop hitting yourself."
    elif ewutils.active_restrictions.get(target_data.id_user) != None and ewutils.active_restrictions.get(target_data.id_user) > 0:
        response = "They're in the middle of something, be patient."
    elif target_data.life_state == ewcfg.life_state_corpse:
        response = "You give {} a good whack. They're a ghost though, so your hand passes straight through.".format(cmd.mentions[0].display_name)
    elif ewcfg.mutation_id_ditchslap not in mutations:
        response = "You wind up your good arm and tacoom {} hard in the {}. The air gets knocked out of them but they stay firmly in place.".format(cmd.mentions[0].display_name, random.choice(['face', 'face', 'face', 'ass']))
    else:
        mutation_data = EwMutation(id_mutation=ewcfg.mutation_id_ditchslap, id_user=cmd.message.author.id, id_server=cmd.message.guild.id)

        if len(mutation_data.data) > 0:
            time_lastuse = int(mutation_data.data)
        else:
            time_lastuse = 0

        if dest_poi_obj.id_poi not in user_poi.neighbors.keys():
            response = "You can't hit them that far."
        elif move_utils.inaccessible(user_data=target_data, poi=dest_poi_obj):
            response = "That place is locked up good. You can't get a good launch angle to send them there."
        # elif time_lastuse + 180 * 60 > time_now:
        # response = "Your arm is spent from the last time you obliterated someone. Try again in {} minutes.".format(math.ceil((time_lastuse + 180*60 - time_now)/60))
        elif user_data.faction != target_data.faction:
            response = "You try to slap {}, but they realize what you're doing and jump back. Welp, back to the drawing board.".format(cmd.mentions[0].display_name)
        elif user_poi.id_poi in [ewcfg.poi_id_rowdyroughhouse, ewcfg.poi_id_copkilltown] or user_poi.is_apartment:
            response = "They're currently in their room. You'd have to carry {} out of it to slap them, which would be gay.".format(cmd.mentions[0].display_name)
        elif ewcfg.status_slapped_id in target_data.getStatusEffects():
            response = "Don't turn this into domestic abuse now. Can't you see they're still reeling from the last time?"
        elif (ewutils.clenched.get(target_data.id_user) == None or ewutils.clenched.get(target_data.id_user) == 0) and (user_poi.is_subzone or user_poi.is_district):
            response = "You wind up your slappin' hand and take a swing, but {} is all relaxed and you can't get a good angle. They end up flying into the wall. Better not touch people who aren't prepared to get hit...".format(cmd.mentions[0].display_name)
        else:
            response = "You wind up your slap. This one's gonna hurt. Steady as she goes...WHAM! {} is sent flying helplessly into {}!".format(cmd.mentions[0].display_name, dest_poi_obj.str_name)
            target_data.applyStatus(id_status=ewcfg.status_slapped_id)
            dm_response = "WHAP! {} smacked you into {}!".format(cmd.message.author.display_name, dest_poi_obj.str_name)
            target_response = "**CRAAAAAAAAAAAASH!** You arrive in {}!".format(dest_poi_obj.str_name)
            ewutils.moves_active[cmd.message.author.id] = 0
            target_data.poi = dest_poi_obj.id_poi
            user_data.time_lastenter = int(time.time())

            mutation_data.data = str(time_now)
            mutation_data.persist()

            if target_data.poi == ewcfg.poi_id_thesewers:
                target_data.die(cause=ewcfg.cause_suicide)
                target_response += " But you hit your head really hard! Your precious little dome explodes into bits and pieces and you die!"

            user_data.persist()

            await ewrolemgr.updateRoles(client=ewutils.get_client(), member=cmd.mentions[0], new_poi=target_data.poi)
            target_data.persist()

            await user_data.move_inhabitants(id_poi=dest_poi_obj.id_poi)

            await prank_utils.activate_trap_items(dest_poi_obj.id_poi, user_data.id_server, target_data.id_user)

            await fe_utils.send_message(cmd.client, cmd.mentions[0], fe_utils.formatMessage(cmd.mentions[0], dm_response))
            await fe_utils.send_message(cmd.client, fe_utils.get_channel(server=cmd.mentions[0].guild, channel_name=dest_poi_obj.channel), fe_utils.formatMessage(cmd.mentions[0], target_response))

    return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
Ejemplo n.º 6
0
async def disembark(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)
    response = ""
    resp_cont = EwResponseContainer(client=cmd.client, id_server=user_data.id_server)

    # prevent ghosts currently inhabiting other players from moving on their own
    if user_data.get_inhabitee():
        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))

    # can only disembark when you're on a transport vehicle
    elif user_data.poi in poi_static.transports:
        transport_data = EwTransport(id_server=user_data.id_server, poi=user_data.poi)
        response = "{}ing.".format(cmd.tokens[0][1:].lower()).capitalize()

        stop_poi = poi_static.id_to_poi.get(transport_data.current_stop)
        # if stop_poi.is_subzone:
        # 	stop_poi = poi_static.id_to_poi.get(stop_poi.mother_district)

        if move_utils.inaccessible(user_data=user_data, poi=stop_poi):
            return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You're not allowed to go there (bitch)."))

        # 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]:
            return

        user_data = EwUser(member=cmd.message.author)
        transport_data = EwTransport(id_server=user_data.id_server, poi=transport_data.poi)

        # cancel move, if the user has left the transport while waiting for movement to be completed (e.g. by dying)
        if user_data.poi != transport_data.poi:
            return

        stop_poi = poi_static.id_to_poi.get(transport_data.current_stop)

        # juvies can't swim
        if transport_data.current_stop == ewcfg.poi_id_slimesea and user_data.life_state != ewcfg.life_state_corpse:
            if user_data.life_state == ewcfg.life_state_kingpin:
                response = "You try to heave yourself over the railing as you're hit by a sudden case of sea sickness. You puke into the sea and sink back on deck."
                response = fe_utils.formatMessage(cmd.message.author, response)
                return await fe_utils.send_message(cmd.client, cmd.message.channel, response)
            user_data.poi = ewcfg.poi_id_slimesea
            user_data.trauma = ewcfg.trauma_id_environment
            die_resp = user_data.die(cause=ewcfg.cause_drowning)
            user_data.persist()
            resp_cont.add_response_container(die_resp)

            response = "{} jumps over the railing of the ferry and promptly drowns in the slime sea.".format(cmd.message.author.display_name)
            resp_cont.add_channel_response(channel=ewcfg.channel_slimesea, response=response)
            resp_cont.add_channel_response(channel=ewcfg.channel_ferry, response=response)
            await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author)
        # they also can't fly

        elif transport_data.transport_type == ewcfg.transport_type_blimp and not stop_poi.is_transport_stop and user_data.life_state != ewcfg.life_state_corpse:
            user_mutations = user_data.get_mutations()
            if user_data.life_state == ewcfg.life_state_kingpin:
                response = "Your life flashes before your eyes, as you plummet towards your certain death. A lifetime spent being a piece of shit and playing videogames all day. You close your eyes and... BOING! You open your eyes again to see a crew of workers transporting the trampoline that broke your fall. You get up and dust yourself off, sighing heavily."
                response = fe_utils.formatMessage(cmd.message.author, response)
                resp_cont.add_channel_response(channel=stop_poi.channel, response=response)
                user_data.poi = stop_poi.id_poi
                user_data.persist()
                await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author)
                return await resp_cont.post()

            elif ewcfg.mutation_id_lightasafeather in user_mutations or ewcfg.mutation_id_airlock in user_mutations:
                response = "With a running jump you launch yourself out of the blimp and begin falling to your soon-to-be demise... but then a strong updraft breaks your fall and you land unscathed. "
                response = fe_utils.formatMessage(cmd.message.author, response)
                resp_cont.add_channel_response(channel=stop_poi.channel, response=response)
                user_data.poi = stop_poi.id_poi
                user_data.persist()
                await user_data.move_inhabitants(id_poi=stop_poi.id_poi)
                await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author)
                return await resp_cont.post()
            district_data = EwDistrict(id_server=user_data.id_server, district=stop_poi.id_poi)
            district_data.change_slimes(n=user_data.slimes)
            district_data.persist()
            user_data.poi = stop_poi.id_poi
            user_data.trauma = ewcfg.trauma_id_environment
            die_resp = user_data.die(cause=ewcfg.cause_falling)
            user_data.persist()
            resp_cont.add_response_container(die_resp)
            response = "SPLAT! A body collides with the asphalt with such force, that it is utterly annihilated, covering bystanders in blood and slime and guts."
            resp_cont.add_channel_response(channel=stop_poi.channel, response=response)
            await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author)

        # update user location, if move successful
        else:
            # if stop_poi.is_subzone:
            # 	stop_poi = poi_static.id_to_poi.get(stop_poi.mother_district)

            if move_utils.inaccessible(user_data=user_data, poi=stop_poi):
                return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You're not allowed to go there (bitch)."))

            user_data.poi = stop_poi.id_poi
            user_data.persist()
            await user_data.move_inhabitants(id_poi=stop_poi.id_poi)
            response = "You enter {}".format(stop_poi.str_name)
            await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author)
            await fe_utils.send_message(cmd.client, fe_utils.get_channel(cmd.guild, stop_poi.channel), fe_utils.formatMessage(cmd.message.author, response))

            # SWILLDERMUK
            await prank_utils.activate_trap_items(stop_poi.id_poi, user_data.id_server, user_data.id_user)

            return
        return await resp_cont.post()
    else:
        response = "You are not currently riding any transport."
        return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))