async def prank_item_effect_instantuse(cmd, item): item_action = "" mentions_user = False use_mention_displayname = False side_effect = "" if cmd.mentions_count == 1: mentions_user = True if mentions_user: member = cmd.mentions[0] pranker_data = EwUser(member=cmd.message.author) pranked_data = EwUser(member=member) if pranker_data.id_user == pranked_data.id_user: response = "A bit masochistic, don't you think?" return item_action, response, use_mention_displayname, side_effect if pranked_data.time_last_action < (int(time.time()) - afk_timer): response = "Whoa whoa WHOA! Slow down there, big guy, this person's practically asleep! Where's the fun in pranking them right now, when you won't even be able to get a reaction out of them?\n**(Hint: {} is AFK! Try pranking someone else.)**".format(member.display_name) return item_action, response, use_mention_displayname, side_effect if pranker_data.poi != pranked_data.poi: response = "You need to be in the same place as your target to prank them with that item." return item_action, response, use_mention_displayname, side_effect if ewcfg.swilldermuk_active: pranker_credence = ewstats.get_stat(id_server=cmd.guild.id, id_user=pranker_data.id_user, metric=ewcfg.stat_credence) pranked_credence = ewstats.get_stat(id_server=cmd.guild.id, id_user=pranked_data.id_user, metric=ewcfg.stat_credence) if pranker_credence == 0 or pranked_credence == 0: if pranker_credence == 0: response = "You can't prank that person right now, you don't have any credence!" else: response = "You can't prank that person right now, they don't have any credence!" return item_action, response, use_mention_displayname, side_effect if (ewutils.active_restrictions.get(pranker_data.id_user) != None and ewutils.active_restrictions.get(pranker_data.id_user) == 2) or (ewutils.active_restrictions.get(pranked_data.id_user) != None and ewutils.active_restrictions.get(pranked_data.id_user) == 2): response = "You can't prank that person right now." return item_action, response, use_mention_displayname, side_effect prank_item_data = item # calculate_gambit_exchange(pranker_data, pranked_data, prank_item_data) response = prank_item_data.item_props.get('prank_desc') side_effect = prank_item_data.item_props.get('side_effect') response = response.format(cmd.message.author.display_name) item_action = "delete" use_mention_displayname = True else: response = "You gotta find someone to prank someone with that item, first!\n**(Hint: !use item @player)**" return item_action, response, use_mention_displayname, side_effect
async def verification(cmd): user_data = EwUser(member=cmd.message.author) if user_data.poi == ewcfg.poi_id_slimecorphq: if user_data.verified: response = "*Huh? You're already verified! Get outta here you goofster!*" return await fe_utils.send_response(response, cmd) time_now = int(time.time()) time_in_server = time_now - user_data.time_joined if time_in_server >= 60 * 60 * 24 * 180: # 6 months lifetime_slime = ewstats.get_stat( user=user_data, metric=ewcfg.stat_lifetime_slimes) # you can use haunted slimes too cause we're nicer to ghosts than we should be lifetime_haunted = ewstats.get_stat( user=user_data, metric=ewcfg.stat_lifetime_slimeshaunted) if lifetime_slime > 1000000000 or lifetime_haunted > 100000000: user_data.verified = True user_data.persist() response = "*Alright, everything checks out. Congratulations, you're #verified now.*" # TODO emote else: response = "*Yeah, sorry, looks but it like you don't love slime enough. Try getting some more slime, then come back. Freak.*" if user_data.life_state != ewcfg.life_state_corpse: response += " ({current:,}/{needed:,} lifetime slime)".format( current=lifetime_slime, needed=1000000000) else: response += " ({current:,}/{needed:,} lifetime slime haunted)".format( current=lifetime_haunted, needed=100000000) else: response = "*We can't just verify any random schmuck who wanders into our city, it'd be a bad look. Stick around for a while, then we'll consider verifying you.*" else: if user_data.poi == ewcfg.poi_id_stockexchange: response = "*Hey buddy, I think you got the wrong door, the HQ's two blocks down.*" else: response = "Only the Slimecorp employees at the HQ can get you verified on Slime Twitter." return await fe_utils.send_response(response, cmd)
async def update_slimernalia_kingpin(client, server): return # Depose current slimernalia kingpin kingpin_state = EwGamestate(id_server=server.id, id_state='slimernaliakingpin') old_kingpin_id = int(kingpin_state.value) if old_kingpin_id != None and old_kingpin_id > 0: kingpin_state.value = '-1' try: old_kingpin_member = server.get_member(old_kingpin_id) await ewrolemgr.updateRoles(client=client, member=old_kingpin_member) except: ewutils.logMsg( "Error removing kingpin of slimernalia role from {} in server {}." .format(old_kingpin_id, server.id)) # Update the new kingpin of slimernalia new_kingpin_id = ewutils.get_most_festive(server) kingpin_state.value = str(new_kingpin_id) # Reset the new kingpin's festivity upon getting the award old_festivity = ewstats.get_stat(id_server=server.id, id_user=new_kingpin_id, metric=ewcfg.stat_festivity) ewstats.set_stat(id_server=server.id, id_user=new_kingpin_id, metric=ewcfg.stat_festivity, value=0) #new_kingpin.festivity = 0 #new_kingpin.persist() try: new_kingpin_member = server.get_member(new_kingpin_id) await ewrolemgr.updateRoles(client=client, member=new_kingpin_member) except: ewutils.logMsg( "Error adding kingpin of slimernalia role to user {} in server {}." .format(new_kingpin_id, server.id)) if new_kingpin_member: # Format and release a message from Phoebus about how who just won and how much slime they got announce_content = ewcfg.slimernalia_kingpin_announcement.format( player=("@" + str(new_kingpin_member.id)), festivity=old_festivity) announce = discord.Embed() announce.set_thumbnail(url="https://i.imgur.com/aVfaB9I.png") announce.description = "**Phoebus**{}".format(ewcfg.emote_verified) announce.color = discord.Color.green() announce.add_field(name='\u200b', value=announce_content) channel = get_channel(server=server, channel_name="auditorium") await send_message(client, channel, embed=announce)
async def favor(cmd): user_data = EwUser(member=cmd.message.author) await debug13(cmd, user_data) if ewcfg.dh_active and ewcfg.dh_stage >= 2: favor = ewstats.get_stat(user=user_data, metric='sacrificerate') response = "You have {} favor with the ancient eldritch gods.".format( favor) return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def gambit(cmd): if cmd.mentions_count == 0: gambit = ewstats.get_stat(id_server=cmd.guild.id, id_user=cmd.message.author.id, metric=ewcfg.stat_gambit) response = "You currently have {:,} gambit.".format(gambit) else: member = cmd.mentions[0] gambit = ewstats.get_stat(id_server=cmd.guild.id, id_user=member.id, metric=ewcfg.stat_gambit) response = "{} currently has {:,} gambit.".format( member.display_name, gambit) # Send the response to the player. await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def credence(cmd): if not cmd.message.author.server_permissions.administrator: adminmode = False else: adminmode = True if cmd.mentions_count == 0: credence = ewstats.get_stat(id_server=cmd.guild.id, id_user=cmd.message.author.id, metric=ewcfg.stat_credence) credence_used = ewstats.get_stat(id_server=cmd.guild.id, id_user=cmd.message.author.id, metric=ewcfg.stat_credence_used) if adminmode: response = "DEBUG: You currently have {:,} credence, and {:,} credence used.".format( credence, credence_used) else: if credence > 0: response = "You have credence. Don't f**k this up." else: response = "You don't have any credence. You'll need to build some up in the city before you can get to pranking again." else: member = cmd.mentions[0] credence = ewstats.get_stat(id_server=cmd.guild.id, id_user=member.id, metric=ewcfg.stat_credence) credence_used = ewstats.get_stat(id_server=cmd.guild.id, id_user=member.id, metric=ewcfg.stat_credence_used) if adminmode: response = "{} currently has {:,} credence, and {:,} credence used.".format( member.display_name, credence, credence_used) else: if credence > 0: response = "They have credence. Time for a little anarchy." else: response = "They don't have any credence." # Send the response to the player. await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def prank_item_effect_trap(cmd, item): item_action = "" mentions_user = False use_mention_displayname = False side_effect = "" if cmd.mentions_count == 1: mentions_user = True if mentions_user: response = "You can't use that item on someone else! You gotta lay it down in a district!\n**(Hint: !use item)**" else: pranker_data = EwUser(member=cmd.message.author) if ewcfg.swilldermuk_active: credence = ewstats.get_stat(id_server=cmd.guild.id, id_user=cmd.message.author.id, metric=ewcfg.stat_credence) if credence == 0: response = "You can't lay down a trap without any credence!" return item_action, response, use_mention_displayname, side_effect # Store values inside the trap's item_props halved_credence = int(credence / 2) if halved_credence == 0: halved_credence = 1 ewstats.set_stat(id_server=cmd.guild.id, id_user=cmd.message.author.id, metric=ewcfg.stat_credence_used, value=halved_credence) ewstats.change_stat(id_server=cmd.guild.id, id_user=cmd.message.author.id, metric=ewcfg.stat_credence_used, n=halved_credence) item.item_props["trap_stored_credence"] = halved_credence else: item.item_props["trap_stored_credence"] = 0 item.item_props["trap_user_id"] = str(pranker_data.id_user) item.persist() pranker_data.persist() response = "You lay down a {}. Hopefully someone's dumb enough to fall for it.".format( item.item_props.get('item_name')) item_action = "drop" return item_action, response, use_mention_displayname, side_effect
async def haunt(cmd): time_now = int(time.time()) response = "" resp_cont = EwResponseContainer(id_server=cmd.guild.id) if cmd.mentions_count > 1: response = "You can only spook one person at a time. Who do you think you are, the Lord of Ghosts?" else: haunted_data = None member = None if cmd.mentions_count == 0 and cmd.tokens_count > 1: server = cmd.guild member = server.get_member(ewutils.getIntToken(cmd.tokens)) haunted_data = EwUser(member=member) elif cmd.mentions_count == 1: member = cmd.mentions[0] haunted_data = EwUser(member=member) if member: # Get the user and target data from the database. user_data = EwUser(member=cmd.message.author) market_data = EwMarket(id_server=cmd.guild.id) target_mutations = haunted_data.get_mutations() target_poi = poi_static.id_to_poi.get(haunted_data.poi) target_is_shambler = haunted_data.life_state == ewcfg.life_state_shambler target_is_inhabitted = haunted_data.id_user == user_data.get_inhabitee( ) if user_data.life_state != ewcfg.life_state_corpse: # Only dead players can haunt. response = "You can't haunt now. Try {}.".format( ewcfg.cmd_suicide) elif haunted_data.life_state == ewcfg.life_state_kingpin: # Disallow haunting of generals. response = "He is too far from the sewers in his ivory tower, and thus cannot be haunted." elif (time_now - user_data.time_lasthaunt) < ewcfg.cd_haunt: # Disallow haunting if the user has haunted too recently. response = "You're being a little TOO spooky lately, don't you think? Try again in {} seconds.".format( int(ewcfg.cd_haunt - (time_now - user_data.time_lasthaunt))) elif ewutils.channel_name_is_poi( cmd.message.channel.name) == False: response = "You can't commit violence from here." elif target_poi.pvp == False: # Require the target to be in a PvP area, and flagged if it's a remote haunt response = "{} is not mired in the ENDLESS WAR right now.".format( member.display_name) elif haunted_data.life_state == ewcfg.life_state_corpse: # Dead players can't be haunted. response = "{} is already dead.".format(member.display_name) elif haunted_data.life_state == ewcfg.life_state_grandfoe: # Grand foes can't be haunted. response = "{} is invulnerable to ghosts.".format( member.display_name) elif haunted_data.life_state == ewcfg.life_state_enlisted or haunted_data.life_state == ewcfg.life_state_juvenile or haunted_data.life_state == ewcfg.life_state_shambler: haunt_power_multiplier = 1 # power to the ancients ghost_age = time_now - user_data.time_lastdeath if ghost_age > 60 * 60 * 24 * 7: # dead for longer than if ghost_age > 60 * 60 * 24 * 365: # one friggin year haunt_power_multiplier *= 2.5 if ghost_age > 60 * 60 * 24 * 90: # three months haunt_power_multiplier *= 2 elif ghost_age > 60 * 60 * 24 * 30: # one month haunt_power_multiplier *= 1.5 else: # one week haunt_power_multiplier *= 1.25 # vitriol as virtue list_ids = [] for quadrant in ewcfg.quadrant_ids: quadrant_data = EwQuadrant(id_server=cmd.guild.id, id_user=cmd.message.author.id, quadrant=quadrant) if quadrant_data.id_target != -1 and quadrant_data.check_if_onesided( ) is False: list_ids.append(quadrant_data.id_target) if quadrant_data.id_target2 != -1 and quadrant_data.check_if_onesided( ) is False: list_ids.append(quadrant_data.id_target2) if haunted_data.id_user in list_ids: # any mutual quadrants haunt_power_multiplier *= 1.2 if haunted_data.faction and ( (not user_data.faction) or (user_data.faction != haunted_data.faction) ): # opposite faction (or no faction at all) haunt_power_multiplier *= 1.2 if user_data.id_killer == haunted_data.id_user: # haunting your murderer/buster haunt_power_multiplier *= 1.2 # places of power. if haunted_data.poi in [ ewcfg.poi_id_thevoid, ewcfg.poi_id_wafflehouse, ewcfg.poi_id_blackpond ]: haunt_power_multiplier *= 2 elif haunted_data.poi in get_void_connection_pois( cmd.guild.id): haunt_power_multiplier *= 1.25 # glory to the vanquished target_kills = ewstats.get_stat(user=haunted_data, metric=ewcfg.stat_kills) if target_kills > 5: haunt_power_multiplier *= 1.25 + ( (target_kills - 5) / 100) # 1% per kill after 5 else: haunt_power_multiplier *= 1 + (target_kills * 5 / 100 ) # 5% per kill if time_now - haunted_data.time_lastkill < (60 * 15): haunt_power_multiplier *= 1.5 # wet hands # misc if weather_static.weather_map.get( market_data.weather) == ewcfg.weather_foggy: haunt_power_multiplier *= 1.1 if not haunted_data.has_soul: haunt_power_multiplier *= 1.2 # uncomment this after moon mechanics update # if (market_data.day % 31 == 15 and market_data.clock >= 20) or (market_data.day % 31 == 16 and market_data.clock <= 6): # haunt_power_multiplier *= 2 # divide haunt power by 2 if not in same area if user_data.poi != haunted_data.poi: haunt_power_multiplier /= 2 # Double Halloween if ewcfg.dh_active: haunt_power_multiplier *= 4 haunted_slimes = int( (haunted_data.slimes / ewcfg.slimes_hauntratio) * haunt_power_multiplier) slimes_lost = int( haunted_slimes / 5 ) # hauntee only loses 1/5th of what the ghost gets as antislime if ewcfg.mutation_id_coleblooded in target_mutations: haunted_slimes = -10000 if user_data.slimes > haunted_slimes: haunted_slimes = user_data.slimes haunted_data.change_slimes(n=-slimes_lost, source=ewcfg.source_haunted) user_data.change_slimes(n=-haunted_slimes, source=ewcfg.source_haunter) market_data.negaslime -= haunted_slimes user_data.time_lasthaunt = time_now user_data.clear_status(id_status=ewcfg.status_busted_id) resp_cont.add_member_to_update(cmd.message.author) # Persist changes to the database. user_data.persist() haunted_data.persist() market_data.persist() response = "{} has been haunted by the ghost of {}! Slime has been lost! {} antislime congeals within you.".format( member.display_name, cmd.message.author.display_name, haunted_slimes) if ewcfg.mutation_id_coleblooded in target_mutations: response = "{} has been haunted by the ghost of {}! Their exorcising coleslaw blood purges {} antislime from your being! Better not do that again.".format( member.display_name, cmd.message.author.display_name, -haunted_slimes) haunted_channel = poi_static.id_to_poi.get( haunted_data.poi).channel haunt_message = "You feel a cold shiver run down your spine" if cmd.tokens_count > 2: haunt_message_content = re.sub( "<.+>" if cmd.mentions_count == 1 else "\d{17,}", "", cmd.message.content[(len(cmd.tokens[0])):]).strip() # Cut down really big messages so discord doesn't crash if len(haunt_message_content) > 500: haunt_message_content = haunt_message_content[:-500] haunt_message += " and faintly hear the words \"{}\"".format( haunt_message_content) haunt_message += ". {} slime evaporates from your body.".format( slimes_lost) if ewcfg.mutation_id_coleblooded in target_mutations: haunt_message += " The ghost that did it wails in agony as their ectoplasm boils in your coleslaw blood!" haunt_message = fe_utils.formatMessage(member, haunt_message) resp_cont.add_channel_response(haunted_channel, haunt_message) else: # No mentions, or mentions we didn't understand. response = "Your spookiness is appreciated, but ENDLESS WAR didn\'t understand that name." # Send the response to the player. resp_cont.add_channel_response(cmd.message.channel.name, response) await resp_cont.post()
def gen_data_text(id_user=None, id_server=None, display_name=None, channel_name=None): user_data = EwUser(id_user=id_user, id_server=id_server, data_level=2) slimeoid = EwSlimeoid(id_user=id_user, id_server=id_server) cosmetics = bknd_item.inventory(id_user=user_data.id_user, id_server=user_data.id_server, item_type_filter=ewcfg.it_cosmetic) adorned_cosmetics = [] for cosmetic in cosmetics: cos = EwItem(id_item=cosmetic.get('id_item')) if cos.item_props['adorned'] == 'true': hue = hue_static.hue_map.get(cos.item_props.get('hue')) adorned_cosmetics.append((hue.str_name + " " if hue != None else "") + cosmetic.get('name')) if user_data.life_state == ewcfg.life_state_grandfoe: poi = poi_static.id_to_poi.get(user_data.poi) if poi != None: response = "{} is {} {}.".format(display_name, poi.str_in, poi.str_name) else: response = "You can't discern anything useful about {}.".format( display_name) else: # return somebody's score # get race flavor text player_race = ewcfg.defined_races.get(user_data.race) if player_race != None: race_prefix = player_race.get("race_prefix", "") race_suffix = player_race.get("race_suffix", "") else: race_prefix = "" race_suffix = "" if user_data.life_state == ewcfg.life_state_corpse: response = "{} is a {}level {} {}dead{}.".format( display_name, race_prefix, user_data.slimelevel, race_suffix, user_data.gender) elif user_data.life_state == ewcfg.life_state_shambler: response = "{} is a {}level {} {}shambler.".format( display_name, race_prefix, user_data.slimelevel, race_suffix) else: response = "{} is a {}level {} {}slime{}.".format( display_name, race_prefix, user_data.slimelevel, race_suffix, user_data.gender) """if user_data.degradation < 20: pass elif user_data.degradation < 40: response += " Their bodily integrity is starting to slip." elif user_data.degradation < 60: response += " Their face seems to be melting and they periodically have to put it back in place." elif user_data.degradation < 80: response += " They are walking a bit funny, because their legs are getting mushy." elif user_data.degradation < 100: response += " Their limbs keep falling off. It's really annoying." else: response += " They almost look like a shambler already.""" coinbounty = int(user_data.bounty / ewcfg.slimecoin_exchangerate) weapon_item = EwItem(id_item=user_data.weapon) weapon = static_weapons.weapon_map.get( weapon_item.item_props.get("weapon_type")) if weapon != None: response += " {} {}{}.".format( ewcfg.str_weapon_married if user_data.weaponmarried == True else ewcfg.str_weapon_wielding, ("" if len(weapon_item.item_props.get("weapon_name")) == 0 else "{}, ".format(weapon_item.item_props.get("weapon_name"))), weapon.str_weapon) if user_data.weaponskill >= 5: response += " {}".format( weapon.str_weaponmaster.format( rank=(user_data.weaponskill - 4), title="master")) else: response += " {}".format( weapon.str_weaponmaster.format(rank=user_data.weaponskill, title="rookie")) sidearm_item = EwItem(id_item=user_data.sidearm) sidearm = static_weapons.weapon_map.get( sidearm_item.item_props.get("weapon_type")) if sidearm != None: response += " They have sidearmed {}{}.".format( ("" if len(sidearm_item.item_props.get("weapon_name")) == 0 else "{}, ".format( sidearm_item.item_props.get("weapon_name"))), sidearm.str_weapon) trauma = se_static.trauma_map.get(user_data.trauma) if trauma != None: response += " {}".format(trauma.str_trauma) response_block = "" user_kills = ewstats.get_stat(user=user_data, metric=ewcfg.stat_kills) enemy_kills = ewstats.get_stat(user=user_data, metric=ewcfg.stat_pve_kills) response_block += "{}{}".format( get_crime_level(num=user_data.crime, forYou=0), " ") if user_kills > 0 and enemy_kills > 0: response_block += "They have {:,} confirmed kills, and {:,} confirmed hunts. ".format( user_kills, enemy_kills) elif user_kills > 0: response_block += "They have {:,} confirmed kills. ".format( user_kills) elif enemy_kills > 0: response_block += "They have {:,} confirmed hunts. ".format( enemy_kills) if coinbounty != 0: response_block += "SlimeCorp offers a bounty of {:,} SlimeCoin for their death. ".format( coinbounty) if len(adorned_cosmetics) > 0: response_block += "They have a {} adorned. ".format( ewutils.formatNiceList(adorned_cosmetics, 'and')) if user_data.freshness < ewcfg.freshnesslevel_1: response_block += "Their outfit is starting to look pretty fresh, but They’ve got a long way to go if they wanna be NLACakaNM’s next top model. " elif user_data.freshness < ewcfg.freshnesslevel_2: response_block += "Their outfit is low-key on point, not gonna lie. They’re goin’ places, kid. " elif user_data.freshness < ewcfg.freshnesslevel_3: response_block += "Their outfit is lookin’ fresh as hell, goddamn! They shop so much they can probably speak Italian. " elif user_data.freshness < ewcfg.freshnesslevel_4: response_block += "Their outfit is straight up **GOALS!** Like, honestly. I’m being, like, totally sincere right now. Their Instragrime has attracted a small following. " else: response_block += "Holy shit! Their outfit is downright, positively, without a doubt, 100% **ON FLEEK!!** They’ve blown up on Instragrime, and they’ve got modeling gigs with fashion labels all across the city. " statuses = user_data.getStatusEffects() for status in statuses: status_effect = EwStatusEffect(id_status=status, user_data=user_data) if status_effect.time_expire > time.time( ) or status_effect.time_expire == -1: status_flavor = se_static.status_effects_def_map.get(status) severity = "" try: value_int = int(status_effect.value) if value_int < 3: severity = "lightly injured." elif value_int < 7: severity = "battered and bruised." elif value_int < 11: severity = "severely damaged." else: severity = "completely f****d up, holy shit!" except: pass format_status = {'severity': severity} if status_flavor is not None: response_block += status_flavor.str_describe.format_map( format_status) + " " if (slimeoid.life_state == ewcfg.slimeoid_state_active): # If the user isn't a corpse if user_data.life_state != ewcfg.life_state_corpse: response_block += "They are accompanied by {}, a {}-foot-tall Slimeoid. ".format( slimeoid.name, str(slimeoid.level)) # If the user is a corpse, but has a negaslimeoid elif slimeoid.sltype == ewcfg.sltype_nega: response_block += "They are accompanied by {}, a {}-foot-tall Negaslimeoid. ".format( slimeoid.name, str(slimeoid.level)) # if user_data.swear_jar >= 500: # response_block += "They're going to The Underworld for the things they've said." # elif user_data.swear_jar >= 100: # response_block += "They swear like a sailor!" # elif user_data.swear_jar >= 50: # response_block += "They have quite a profane vocabulary." # elif user_data.swear_jar >= 10: # response_block += "They've said some naughty things in the past." # elif user_data.swear_jar >= 5: # response_block += "They've cussed a handful of times here and there." # elif user_data.swear_jar > 0: # response_block += "They've sworn only a few times." # else: # response_block += "Their mouth is clean as a whistle." if len(response_block) > 0: response += "\n" + response_block return response
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))
async def prank_item_effect_response(cmd, item): item_action = "" mentions_user = False use_mention_displayname = False side_effect = "" if cmd.mentions_count == 1: mentions_user = True if mentions_user: member = cmd.mentions[0] pranker_data = EwUser(member=cmd.message.author) pranked_data = EwUser(member=member) if pranker_data.id_user == pranked_data.id_user: response = "A bit masochistic, don't you think?" return item_action, response, use_mention_displayname, side_effect if pranked_data.time_last_action < (int(time.time()) - afk_timer): response = "Whoa whoa WHOA! Slow down there, big guy, this person's practically asleep! Where's the fun in pranking them right now, when you won't even be able to get a reaction out of them?\n**(Hint: {} is AFK! Try pranking someone else.)**".format( member.display_name) return item_action, response, use_mention_displayname, side_effect if pranker_data.poi != pranked_data.poi: response = "You need to be in the same place as your target to prank them with that item." return item_action, response, use_mention_displayname, side_effect if ewcfg.swilldermuk_active: pranker_credence = ewstats.get_stat(id_server=cmd.guild.id, id_user=pranker_data.id_user, metric=ewcfg.stat_credence) pranked_credence = ewstats.get_stat(id_server=cmd.guild.id, id_user=pranked_data.id_user, metric=ewcfg.stat_credence) if pranker_credence == 0 or pranked_credence == 0: if pranker_credence == 0: response = "You can't prank that person right now, you don't have any credence!" else: response = "You can't prank that person right now, they don't have any credence!" return item_action, response, use_mention_displayname, side_effect if (ewutils.active_restrictions.get(pranker_data.id_user) != None and ewutils.active_restrictions.get(pranker_data.id_user) == 2 ) or (ewutils.active_restrictions.get(pranked_data.id_user) != None and ewutils.active_restrictions.get( pranked_data.id_user) == 2): response = "You can't prank that person right now." return item_action, response, use_mention_displayname, side_effect prank_item_data = item response = prank_item_data.item_props.get('prank_desc') extra_response_1 = prank_item_data.item_props.get('response_desc_1') extra_response_2 = prank_item_data.item_props.get('response_desc_2') extra_response_3 = prank_item_data.item_props.get('response_desc_3') extra_response_4 = prank_item_data.item_props.get('response_desc_4') possible_responses_list = [ response, extra_response_1, extra_response_2, extra_response_3, extra_response_4, ] # response = response.format(cmd.message.author.display_name) # Apply restrictions, stop both users in their tracks # Restriction level 2 -- No one else can prank you at this time. ewutils.active_target_map[pranker_data.id_user] = pranked_data.id_user ewutils.active_target_map[pranked_data.id_user] = pranker_data.id_user ewutils.moves_active[pranker_data.id_user] = 0 # ewutils.moves_active[pranked_data.id_user] = 0 ewutils.active_restrictions[pranker_data.id_user] = 2 ewutils.active_restrictions[pranked_data.id_user] = 2 # The command needed to remove the response item response_command = prank_item_data.item_props.get('response_command') use_mention_displayname = True # The pranked person has 5 chances to type in the proper command before more and more gambit builds up limit = 0 accepted = 0 has_escaped = False has_escaped_fast = False while limit < 6: limit += 1 if limit != 6: chosen_response = possible_responses_list[limit - 1] # Some response item messages wont have formatting in them. try: chosen_response = chosen_response.format( cmd.message.author.display_name) except: pass await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage( (cmd.message.author if use_mention_displayname == False else cmd.mentions[0]), chosen_response)) # prank_feed_channel = fe_utils.get_channel(cmd.guild, 'prank-feed') # await fe_utils.send_message(cmd.client, prank_feed_channel, fe_utils.formatMessage((cmd.message.author if use_mention_displayname == False else cmd.mentions[0]), (chosen_response+"\n`-------------------------`"))) # The longer time goes on without the pranked person typing in the command, the more gambit they lose pranker_data = EwUser(member=cmd.message.author) pranked_data = EwUser(member=member) # calculate_gambit_exchange(pranker_data, pranked_data, prank_item_data, limit) accepted = 0 try: msg = await cmd.client.wait_for( 'message', timeout=response_timer, check=lambda message: message.author == member) if msg != None: if msg.content.lower() == "!" + response_command: accepted = 1 if limit != 5: has_escaped = True # if limit == 1: # has_escaped_fast = True limit = 6 except: accepted = 0 if accepted == 1 and has_escaped: response = "You manage to resist {}'s prank efforts for now.".format( cmd.message.author.display_name) # if has_escaped_fast: # response = "You swiftly dodge {}'s prank attempt!".format(cmd.message.author.display_name) # limit = 7 else: response = "It's over. The damage {} has done to you will stay with you until your death. Or at least for the rest of the week, whichever comes first.".format( cmd.message.author.display_name) pranker_data = EwUser(member=cmd.message.author) pranked_data = EwUser(member=member) # calculate_gambit_exchange(pranker_data, pranked_data, prank_item_data, limit) # Remove restrictions ewutils.active_target_map[pranker_data.id_user] = "" ewutils.active_target_map[pranked_data.id_user] = "" ewutils.active_restrictions[pranker_data.id_user] = 0 ewutils.active_restrictions[pranked_data.id_user] = 0 item_action = "delete" else: response = "You gotta find someone to prank someone with that item, first!\n**(Hint: !use item @player)**" return item_action, response, use_mention_displayname, side_effect