def get_scalp_collection(id_item, id_server): item = EwItem(id_item=id_item) if 'decorate' not in str(item.id_owner): return 'It\'s a scalp board, detailing the people you\'ve eliminated. Somehow, show and tell in public seems like a bad idea.' id_item_col = "{}collection".format(id_item) scalp_inv = bknd_item.inventory(id_server=id_server, id_user=id_item_col) response = "You take a gander at all these marks.\n __**SHIT LIST**__:" if len(scalp_inv) == 0: return "Soon. This board will fill someday." for scalp in scalp_inv: scalp_item = EwItem(scalp.get('id_item')) victim_name = scalp_item.item_props.get('cosmetic_name').replace( '\'s scalp', '').capitalize() victim_death = scalp_item.item_props.get('cosmetic_desc').replace( 'A scalp.', '') for weapon in weapon_list: if weapon.str_scalp == victim_death: victim_death = "{}{}".format( weapon.str_killdescriptor.capitalize(), '.') break response += "\n~~{}~~ *{}*".format(victim_name, victim_death) return response
def gen_score_text(ew_id, skune): user_data = EwUser(ew_id=ew_id) items = bknd_item.inventory(id_user=user_data.id_user, id_server=user_data.id_server, item_type_filter=ewcfg.it_item) poudrin_amount = bknd_item.find_poudrin(id_user=user_data.id_user, id_server=user_data.id_server) if user_data.life_state == ewcfg.life_state_grandfoe: # Can't see a raid boss's slime score. response = "{}'s power is beyond your understanding.".format( ew_id.display_name) else: # return somebody's score response = "{} currently has {:,} {}{}.".format( ew_id.display_name, user_data.slimes, "slime" if skune is False else "skune", (" and {} {} poudrin{}".format( poudrin_amount, "slime" if skune is False else "skune", ("" if poudrin_amount == 1 else "s")) if poudrin_amount > 0 else "")) return response
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))
def get_soul_collection(id_item, id_server): item = EwItem(id_item=id_item) if 'decorate' not in str(item.id_owner): return 'It\'s a soul cylinder. You can\'t really tell whose soul is whose. You\'ve been carrying this thing around and all the souls are jostled and queasy.' id_item_col = "{}collection".format(id_item) soul_inv = bknd_item.inventory(id_server=id_server, id_user=id_item_col) if len(soul_inv) == 0: return "No souls. Just ask anyone." response = "You look into the cylinder to check how the souls are doing.\n\n" for soul in soul_inv: soul_item = EwItem(id_item=soul.get('id_item')) soul_user = EwUser(id_server=id_server, id_user=soul_item.item_props.get('user_id')) if soul_user.race is None or soul_user.race == '': soul_user.race = ewcfg.race_humanoid #do not persist this! soul_text = ewcfg.defined_races.get( soul_user.race).get('soul_behavior') soul_name = soul_item.item_props.get('cosmetic_name') response += "{} {}\n".format(soul_name, soul_text) return response
def get_slimeoid_count(user_id=None, server_id=None): if user_id != None and server_id != None: count = 0 slimeoid_data = EwSlimeoid(id_user=user_id, id_server=server_id) secondary_user = str(user_id) + "freeze" name_list = [] if slimeoid_data.name != "": count += 1 items = bknd_item.inventory(id_user=user_id, id_server=server_id, item_type_filter=ewcfg.it_item) bottles = [] for item in items: item_data = EwItem(id_item=item.get('id_item')) if item_data.item_props.get( 'context') == ewcfg.context_slimeoidbottle: count += 1 try: conn_info = bknd_core.databaseConnect() conn = conn_info.get('conn') cursor = conn.cursor() sql = "SELECT {} FROM slimeoids WHERE {} = %s" cursor.execute(sql.format(ewcfg.col_name, ewcfg.col_id_user), [secondary_user]) count += cursor.rowcount finally: # Clean up the database handles. cursor.close() bknd_core.databaseClose(conn_info) return count
def get_random_prank_item(user_data, district_data): response = "" items_in_poi = bknd_item.inventory(id_user=user_data.poi, id_server=district_data.id_server) prank_items = [] for item in items_in_poi: id_item = item.get("id_item") possible_prank_item = EwItem(id_item=id_item) context = possible_prank_item.item_props.get('context') food_item_id = possible_prank_item.item_props.get('id_food') if (context == ewcfg.context_prankitem or food_item_id == "defectivecreampie"): prank_items.append(id_item) if len(prank_items) > 0: id_item = random.choice(prank_items) prank_item = EwItem(id_item=id_item) item_name = prank_item.item_props.get('item_name') if item_name == None: item_name = prank_item.item_props.get('food_name') response = "\n\nYou think you can spot a {} lying on the ground somewhere...".format( item_name) return response
def get_weapon_collection(id_item, id_server): item = EwItem(id_item=id_item) if 'decorate' not in str(item.id_owner): return "It's a weapon rack. You can't admire its splendor while it's on your back, though." id_item_col = "{}collection".format(id_item) weapon_inv = bknd_item.inventory(id_server=id_server, id_user=id_item_col) if len(weapon_inv) == 0: return "There are no weapons in here. Arms are meant to be used, not preserved." response = "You take a look at the archive of your violent history...\n\n" for wep in weapon_inv: weapon_item = EwItem(id_item=wep.get('id_item')) kills = weapon_item.item_props.get('totalkills') if kills is None: kills = 0 name = weapon_item.item_props.get('weapon_name') if name is None or name == '': name = 'Generic {}'.format( weapon_item.item_props.get('weapon_type')) response += "{}: {} KILLS\n".format(name, kills) return response
async def dye(cmd): hat_id = ewutils.flattenTokenListToString(cmd.tokens[1:2]) dye_id = ewutils.flattenTokenListToString(cmd.tokens[2:]) try: hat_id_int = int(hat_id) except: hat_id_int = None try: dye_id_int = int(dye_id) except: dye_id_int = None if hat_id != None and len(hat_id) > 0 and dye_id != None and len(dye_id) > 0: response = "You don't have one." items = bknd_item.inventory( id_user=cmd.message.author.id, id_server=cmd.guild.id, ) cosmetic = None dye = None for item in items: if int(item.get('id_item')) == hat_id_int or hat_id in ewutils.flattenTokenListToString(item.get('name')): if item.get('item_type') == ewcfg.it_cosmetic and cosmetic is None: cosmetic = item if int(item.get('id_item')) == dye_id_int or dye_id in ewutils.flattenTokenListToString(item.get('name')): if item.get('item_type') == ewcfg.it_item and item.get('name') in static_items.dye_map and dye is None: dye = item if cosmetic != None and dye != None: break if cosmetic != None: if dye != None: cosmetic_item = EwItem(id_item=cosmetic.get("id_item")) dye_item = EwItem(id_item=dye.get("id_item")) hue = hue_static.hue_map.get(dye_item.item_props.get('id_item')) response = "You dye your {} in {} paint!".format(cosmetic_item.item_props.get('cosmetic_name'), hue.str_name) cosmetic_item.item_props['hue'] = hue.id_hue cosmetic_item.persist() bknd_item.item_delete(id_item=dye.get('id_item')) else: response = 'Use which dye? Check your **!inventory**.' else: response = 'Dye which cosmetic? Check your **!inventory**.' await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, 'You need to specify which cosmetic you want to paint and which dye you want to use! Check your **!inventory**.'))
async def dedorn(cmd): user_data = EwUser(member=cmd.message.author) # ewutils.moves_active[cmd.message.author.id] = 0 # 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 = bknd_item.inventory( id_user=cmd.message.author.id, id_server=cmd.guild.id, item_type_filter=ewcfg.it_cosmetic ) item_sought = None already_adorned = False # 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 i.item_props.get("adorned") == 'true': already_adorned = True item_sought = i break # If the cosmetic you want to adorn is found if item_sought != None: # Unadorn the cosmetic if already_adorned: item_sought.item_props['adorned'] = 'false' unadorn_response = str(item_sought.item_props['str_unadorn']) response = unadorn_response.format(item_sought.item_props['cosmetic_name']) item_sought.persist() user_data.persist() # That garment has not be adorned.. else: response = "You haven't adorned that garment in the first place! How can you dedorn something you haven't adorned? You disgust me." await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, 'Adorn which cosmetic? Check your **!inventory**.'))
async def offer_item(cmd): user_data = EwUser(member=cmd.message.author) if user_data.life_state == ewcfg.life_state_shambler: response = "You lack the higher brain functions required to {}.".format(cmd.tokens[0]) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) user_trade = ewutils.active_trades.get(user_data.id_user) if user_trade != None and len(user_trade) > 0 and user_trade.get("state") > ewcfg.trade_state_proposed: item_search = ewutils.flattenTokenListToString(cmd.tokens[1:]) try: item_id_int = int(item_search) except: item_id_int = None if item_search != None and len(item_search) > 0: item_sought = None inventory = bknd_item.inventory( id_user=user_data.id_user, id_server=user_data.id_server ) for item in inventory: if (item.get('id_item') == item_id_int or item_search in ewutils.flattenTokenListToString(item.get('name'))) \ and item not in ewutils.trading_offers.get(user_data.id_user): item_sought = item if item_sought: item = EwItem(id_item=item_sought.get("id_item")) if not item.soulbound or EwItem(id_item=item_sought.get('id_item')).item_props.get("context") == "housekey": if item.id_item == user_data.weapon and user_data.weaponmarried: response = "Unfortunately for you, the contract you signed before won't let you trade your partner away. You'll have to get your cuckoldry fix from somewhere else." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) ewutils.trading_offers[user_data.id_user].append(item_sought) response = "You add a {} to your offers.".format(item_sought.get("name")) user_trade["state"] = ewcfg.trade_state_ongoing ewutils.active_trades.get(user_trade.get("trader"))["state"] = ewcfg.trade_state_ongoing else: response = "You can't trade soulbound items." else: if item_search: response = "You don't have one." else: response = "Offer which item? (check **!inventory**)" else: response = "You need to be trading with someone to offer an item." await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def ufo_observe(cmd): user_data = EwUser(member = cmd.message.author) cosmetics = bknd_item.inventory(id_user=user_data.id_user, id_server=cmd.guild.id, item_type_filter=ewcfg.it_cosmetic) protected = False 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 shipstate = EwGamestate(id_state='shipstate', id_server=cmd.guild.id) if user_data.poi != 'ufoufo': return await ewdebug.scrutinize(cmd=cmd) elif not protected: response = "Those aliens would probably ass-probe the f**k out of you if you messed with their equipment. Better not." elif shipstate.bit == 1: response = "The ship is grounded. Can't see much from here." elif cmd.tokens_count <= 1: response = "Observe what?" elif not ewcfg.dh_active or ewcfg.dh_stage != 3: response = "Wait, your alien espionage is waaaay out of season." else: poi_seek = ewutils.flattenTokenListToString(cmd.tokens[1:]) poi_sought = poi_static.id_to_poi.get(poi_seek) if poi_sought is None: response = "The aliens know all the district names. You don't have to make up weird shit." elif poi_sought.id_poi == 'ufoufo': return await ewdebug.scrutinize(cmd=cmd) elif poi_sought.is_street: response = "You try to zoom in on a specific street, but you're a little too high up to get that level of detail." elif poi_sought.id_poi == 'blackpond' or (not poi_sought.is_district and not poi_sought.is_outskirts and not poi_sought.is_pier and poi_sought.id_poi not in [ewcfg.poi_id_slimesendcliffs, ewcfg.poi_id_ferry, ewcfg.poi_id_sodafountain, ewcfg.poi_id_stockexchange, ewcfg.poi_id_ab_farms, ewcfg.poi_id_og_farms, ewcfg.poi_id_jr_farms]): response = "The X-ray vision on this viewport sucks. You can't really see indoors." elif poi_sought.id_poi in [ewcfg.poi_id_rowdyroughhouse, ewcfg.poi_id_copkilltown]: response = "Do you want to blow your cover, dumbass? Stop acting like a gangster. The gang bases are mostly indoors anyway." else: new_permissions = {"ufo-ufo": ["read", "send", "connect"]} new_permissions[poi_sought.channel] = ["read"] current_poi = poi_static.id_to_poi.get('ufoufo') response = "" if current_poi is not None: response = 'You point the observation reticle over at {}.'.format(poi_sought.str_name) district_data = EwDistrict(id_server=cmd.guild.id, district='ufoufo') poi_static.id_to_poi['ufoufo'].permissions = new_permissions players_in_district = district_data.get_players_in_district(min_slimes=0, life_states=[ewcfg.life_state_enlisted, ewcfg.life_state_corpse, ewcfg.life_state_juvenile, ewcfg.life_state_shambler], ignore_offline=True) server = ewcfg.server_list[cmd.guild.id] for playerid in players_in_district: member_object = server.get_member(playerid) await ewrolemgr.updateRoles(client=cmd.client, member=member_object) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def beam_me_up(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')) print(cosmetic_data.item_props) if cosmetic_data.item_props.get('id_cosmetic') == 'skinsuit': if cosmetic_data.item_props.get('adorned') == 'true': protected = True poi_sought = poi_static.id_to_poi.get(user_data.poi) shipstate = EwGamestate(id_server=user_data.id_server, id_state='shipstate') if not protected: response = "Why would aliens abduct you? What makes you so special?" elif poi_sought.id_poi == 'ufoufo': response = 'You\'re already in here.' elif poi_sought.id_poi != ewcfg.poi_id_west_outskirts: response = "Hey, get a bit closer. The ship's in the West Outskirts. Beam up power doesn't grow on trees, you know." elif shipstate.bit == 1: response = 'The ship\'s on the ground right now, it can\'t beam shit.' else: await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage( cmd.message.author, "You are being abducted by aliens. The ship is 20 seconds away." )) ewutils.active_restrictions[user_data.id_user] = 2 await asyncio.sleep(20) ewutils.active_restrictions[user_data.id_user] = 0 ewutils.moves_active[cmd.message.author.id] = 0 user_data.poi = 'ufoufo' user_data.persist() await ewrolemgr.updateRoles(client=ewutils.get_client(), member=cmd.message.author) await user_data.move_inhabitants(id_poi='ufoufo') return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def eat_item(cmd): user_data = EwUser(member=cmd.message.author) mutations = user_data.get_mutations() item_search = ewutils.flattenTokenListToString(cmd.tokens[1:]) food_item = None # look for a food item if a name was given if item_search: item_sought = bknd_item.find_item(item_search=item_search, id_user=user_data.id_user, id_server=user_data.id_server, item_type_filter=ewcfg.it_food) if item_sought: food_item = EwItem(id_item=item_sought.get('id_item')) else: item_sought = bknd_item.find_item(item_search=item_search, id_user=user_data.id_user, id_server=user_data.id_server) if item_sought and ewcfg.mutation_id_trashmouth in mutations: return await devour(cmd=cmd) # otherwise find the first useable food else: food_inv = bknd_item.inventory(id_user=user_data.id_user, id_server=user_data.id_server, item_type_filter=ewcfg.it_food) for food in food_inv: food_item = EwItem(id_item=food.get('id_item')) # check if the user can eat this item if float(getattr(food_item, "time_expir", 0)) > time.time() or \ food_item.item_props.get('perishable') not in ['true', '1'] or \ ewcfg.mutation_id_spoiledappetite in user_data.get_mutations(): break if food_item != None: response = user_data.eat(food_item) user_data.persist() else: if item_search: response = "Are you sure you have that item?" else: response = "You don't have anything to eat." await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
def get_items_resp(user_data, district_data): items_resp = "" # If the user has Stink Eye, make a response. If not, have effectively none. mutations = user_data.get_mutations() if ewcfg.mutation_id_stinkeye in mutations: single_response = "" items_listed = 0 item = EwItem # Get all items in the POI the player is in, sorted by Item ID. items_in_poi = bknd_item.inventory( id_user=user_data.poi, id_server=district_data.id_server, item_sorting_method='id', ) # If there are items in the poi if items_in_poi: # Start the beginning of the flavor text items_resp += "\n\nYou sense a few items on the ground: " # Iterate for every item within the POI for item in items_in_poi: # Add the item's name as the next line items_resp += "\n{}".format(item.get('name')) # If it's the first item, create a non-plural one line response. if items_listed == 0: single_response = "\n\nYou sense a {} on the ground.".format( item.get('name')) # Count the item currently listed items_listed += 1 # If it's the fourth item, break the loop. if items_listed >= 4: break # If there was only one item, make the response the non-plural version. if items_listed == 1: items_resp = single_response return items_resp
async def remove_offer(cmd): user_data = EwUser(member=cmd.message.author) if user_data.life_state == ewcfg.life_state_shambler: response = "You lack the higher brain functions required to {}.".format(cmd.tokens[0]) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) user_trade = ewutils.active_trades.get(user_data.id_user) if user_trade != None and len(user_trade) > 0 and user_trade.get("state") > ewcfg.trade_state_proposed: item_search = ewutils.flattenTokenListToString(cmd.tokens[1:]) try: item_id_int = int(item_search) except: item_id_int = None if item_search != None and len(item_search) > 0: item_sought = None inventory = bknd_item.inventory( id_user=user_data.id_user, id_server=user_data.id_server ) for item in inventory: if (item.get('id_item') == item_id_int or item_search in ewutils.flattenTokenListToString(item.get('name'))) \ and item in ewutils.trading_offers.get(user_data.id_user): item_sought = item if item_sought: item = EwItem(id_item=item_sought.get("id_item")) ewutils.trading_offers[user_data.id_user].remove(item_sought) response = "You remove {} from your offers.".format(item_sought.get("name")) user_trade["state"] = ewcfg.trade_state_ongoing ewutils.active_trades.get(user_trade.get("trader"))["state"] = ewcfg.trade_state_ongoing else: if item_search: response = "You don't have one." else: response = "Remove which offer? (check **!trade**)" else: response = "You need to be trading with someone to remove an offer." await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
def toss_items(id_user=None, id_server=None, poi=None): if id_user != None and id_server != None and poi != None: inv_toss = bknd_item.inventory(id_user=id_user, id_server=id_server) for stuff in inv_toss: # toss all items out stuffing = EwItem(id_item=stuff.get('id_item')) stuffing.id_owner = poi.id_poi if stuff.get('item_type') == ewcfg.it_food and id_user[ -6:] == ewcfg.compartment_id_fridge: if int(float(stuffing.item_props.get('time_fridged'))) != 0: stuffing.item_props['time_expir'] = str( int(float(stuffing.item_props.get('time_expir'))) + (int(time.time()) - int(float(stuffing.item_props.get('time_fridged'))))) else: stuffing.item_props['time_expir'] = str( int(float(stuffing.item_props.get('time_fridged'))) + 43200) stuffing.time_expir = int( float(stuffing.item_props.get('time_expir'))) stuffing.item_props['time_fridged'] = '0' stuffing.persist()
def get_general_collection(id_item, id_server): item = EwItem(id_item=id_item) if 'decorate' not in str(item.id_owner): return "It's a multi-item display case. Best viewed when placed." id_item_col = "{}collection".format(id_item) item_inv = bknd_item.inventory(id_server=id_server, id_user=id_item_col) if len(item_inv) == 0: return "There's nothing in here at the moment." response = "You examine your preserved collection. Inside is " item_arr = [] for gen_item in item_inv: item_arr.append("a {} ({})".format(gen_item.get('name'), gen_item.get('id_item'))) response += "{}{}".format(ewutils.formatNiceList(names=item_arr), ".") return response
def get_fish_collection(id_item, id_server): item = EwItem(id_item=id_item) if 'decorate' not in str(item.id_owner): return 'It\'s a large aquarium, built for whole schools of fish. You can\'t see what\'s inside because you\'re nearly killing yourself carrying it.' id_item_col = "{}collection".format(id_item) fish_inv = bknd_item.inventory(id_server=id_server, id_user=id_item_col) response = "" if len(fish_inv) == 0: return "Look at all these- wait, you don't have any fish in here." elif len(fish_inv) == 1: response += "There's just one fish in here. It's feeling very loved." elif len(fish_inv) < 6: response += "It's pretty spacious in here!" elif len(fish_inv) < 43: response += "Look at all these fish!" else: response += "This thing is packed!" response += " There's " fish_arr = [] for fish in fish_inv: fish_item = EwItem(fish.get('id_item')) length = fish_item.item_props.get('length') if length is None: length = float( (ewcfg.fish_size_range.get(fish_item.item_props.get('size'))[0] + ewcfg.fish_size_range.get( fish_item.item_props.get('size'))[1]) / 2) fish_item.item_props['length'] = length fish_item.persist() fish_arr.append("a {} ({} in)".format(fish.get('name'), length)) response += "{}{}".format(ewutils.formatNiceList(names=fish_arr), ".") return response
async def skullbash(cmd): user_data = EwUser(member=cmd.message.author) item_stash = bknd_item.inventory(id_user=cmd.message.author.id, id_server=user_data.id_server) item_sought = None for item_piece in item_stash: item = EwItem(id_item=item_piece.get('id_item')) if item_piece.get('item_type') == ewcfg.it_furniture and item.item_props.get('id_furniture') == "brick": item_sought = item_piece if item_sought: if user_data.life_state == ewcfg.life_state_corpse: response = "Your head is too incorporeal to do that." else: ewutils.active_restrictions[user_data.id_user] = 2 response = "You suck in your gut and mentally prepare to lose a few brain cells. 3...2...1...WHACK! Ugh. You're gonna need a minute." await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) await asyncio.sleep(600) ewutils.active_restrictions[user_data.id_user] = 0 response = "The stars slowly begin to fade from your vision. Looks like you're lucid again." else: response = "You don't have a hard enough brick to bash your head in." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
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))
async def complete_trade(cmd): user_data = EwUser(member=cmd.message.author) if user_data.life_state == ewcfg.life_state_shambler: response = "You lack the higher brain functions required to {}.".format(cmd.tokens[0]) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) user_trade = ewutils.active_trades.get(user_data.id_user) if user_trade != None and len(user_trade) > 0 and user_trade.get("state") > ewcfg.trade_state_proposed: user_trade["state"] = ewcfg.trade_state_complete trader_id = user_trade.get("trader") if ewutils.active_trades.get(trader_id).get("state") != ewcfg.trade_state_complete: partner_player = EwPlayer(id_user=trader_id, id_server=user_data.id_server) response = "You tell {} that you're ready to finish the trade.".format(partner_player.display_name) else: trade_partner = EwUser(id_user=trader_id, id_server=user_data.id_server) # items this player is offering items_offered = {} # items the other player is offering trader_items_offered = {} for item in ewutils.trading_offers.get(user_data.id_user): if items_offered.get(item.get("item_type")) != None: items_offered[item.get("item_type")] += 1 else: items_offered[item.get("item_type")] = 1 for item in ewutils.trading_offers.get(trade_partner.id_user): if trader_items_offered.get(item.get("item_type")) != None: trader_items_offered[item.get("item_type")] += 1 else: trader_items_offered[item.get("item_type")] = 1 # check items currently held + items being given to the player - items the player is giving # check other user's inventory capacity for item_type in items_offered: it_held = bknd_item.inventory( id_user=trade_partner.id_user, id_server=trade_partner.id_server, item_type_filter=item_type ) if item_type == ewcfg.it_food: if (len(it_held) + items_offered[ewcfg.it_food] - trader_items_offered.get(ewcfg.it_food, 0)) > trade_partner.get_food_capacity(): response = "They can't carry any more food items." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif item_type == ewcfg.it_weapon: if (len(it_held) + items_offered[ewcfg.it_weapon] - trader_items_offered.get(ewcfg.it_weapon, 0)) > trade_partner.get_weapon_capacity(): response = "They can't carry any more weapon items." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: if (len(it_held) + items_offered[item_type] - trader_items_offered.get(item_type, 0)) > ewcfg.generic_inv_limit: response = "They can't carry any more {}s.".format(item_type) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) # check own user's inventory capacity for item_type in trader_items_offered: it_held = bknd_item.inventory( id_user=user_data.id_user, id_server=user_data.id_server, item_type_filter=item_type ) if item_type == ewcfg.it_food: if (len(it_held) + trader_items_offered[ewcfg.it_food] - items_offered.get(ewcfg.it_food, 0)) > user_data.get_food_capacity(): response = "You can't carry any more food items." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif item_type == ewcfg.it_weapon: if (len(it_held) + trader_items_offered[ewcfg.it_weapon] - items_offered.get(ewcfg.it_weapon, 0)) > user_data.get_weapon_capacity(): response = "You can't carry any more weapon items." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: if (len(it_held) + trader_items_offered.get(item_type) - items_offered.get(item_type, 0)) > ewcfg.generic_inv_limit: response = "You can't carry any more {}s.".format(item_type) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) for item in list(ewutils.trading_offers.get(user_data.id_user)): if item.get("id_item") == user_data.weapon: user_data.weapon = -1 user_data.persist() elif item.get("id_item") == user_data.sidearm: user_data.sidearm = -1 user_data.persist() elif item.get("item_type") == ewcfg.it_cosmetic: cosmetic = EwItem(id_item=item.get("id_item")) cosmetic.item_props["adorned"] = 'false' cosmetic.item_props["slimeoid"] = 'false' cosmetic.persist() bknd_item.give_item(id_item=item.get("id_item"), id_user=trade_partner.id_user, id_server=trade_partner.id_server) for item in list(ewutils.trading_offers.get(trade_partner.id_user)): if item.get("id_item") == trade_partner.weapon: trade_partner.weapon = -1 trade_partner.persist() elif item.get("id_item") == trade_partner.sidearm: trade_partner.sidearm = -1 user_data.persist() elif item.get("item_type") == ewcfg.it_cosmetic: cosmetic = EwItem(id_item=item.get("id_item")) cosmetic.item_props["adorned"] = 'false' cosmetic.item_props["slimeoid"] = 'false' cosmetic.persist() bknd_item.give_item(id_item=item.get("id_item"), id_user=user_data.id_user, id_server=user_data.id_server) ewutils.active_trades[user_data.id_user] = {} ewutils.active_trades[trade_partner.id_user] = {} ewutils.trading_offers[user_data.id_user] = [] ewutils.trading_offers[trade_partner.id_user] = [] response = "You shake hands to commemorate another successful deal. That is their hand, right?" else: response = "You're not trading with anyone right now." await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def smoke(cmd): usermodel = EwUser(member=cmd.message.author) # item_sought = bknd_item.find_item(item_search="cigarette", id_user=cmd.message.author.id, id_server=usermodel.id_server) item_sought = None space_adorned = 0 item_stash = bknd_item.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')) usermodel.change_crime(n=ewcfg.cr_underage_smoking_points) 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." if space_adorned < ewutils.max_adornspace_bylevel( usermodel.slimelevel): item.item_props['adorned'] = "true" item.persist() usermodel.persist() await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.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() 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']) usermodel.change_crime(n=ewcfg.cr_underage_smoking_points) 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." if space_adorned < ewutils.max_adornspace_bylevel( usermodel.slimelevel): item.item_props['adorned'] = "true" item.persist() usermodel.persist() await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.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() else: response = "You can't smoke that." else: response = "There aren't any usable cigarettes or cigars in your inventory." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def award_fish(fisher, cmd, user_data): response = "" actual_fisherman = None actual_fisherman_data = user_data if fisher.inhabitant_id: actual_fisherman = user_data.get_possession()[1] actual_fisherman_data = EwUser(id_user=actual_fisherman, id_server=cmd.guild.id) if fisher.current_fish in ["item", "seaitem"]: slimesea_inventory = bknd_item.inventory(id_server=cmd.guild.id, id_user=ewcfg.poi_id_slimesea) if (fisher.pier.pier_type != ewcfg.fish_slime_saltwater or len(slimesea_inventory) == 0 or random.random() < 0.2) and fisher.current_fish == "item": item = random.choice(vendors.mine_results) unearthed_item_amount = (random.randrange(5) + 8 ) # anywhere from 8-12 drops item_props = itm_utils.gen_item_props(item) # Ensure item limits are enforced, including food since this isn't the fish section if bknd_item.check_inv_capacity(user_data=actual_fisherman_data, item_type=item.item_type): for creation in range(unearthed_item_amount): bknd_item.item_create(item_type=item.item_type, id_user=actual_fisherman or cmd.message.author.id, id_server=cmd.guild.id, item_props=item_props) response = "You reel in {} {}s! ".format( unearthed_item_amount, item.str_name) else: response = "You woulda reeled in some {}s, but your back gave out under the weight of the rest of your {}s.".format( item.str_name, item.item_type) else: item = random.choice(slimesea_inventory) if bknd_item.give_item(id_item=item.get('id_item'), member=cmd.message.author): response = "You reel in a {}!".format(item.get('name')) else: response = "You woulda reeled in a {}, but your back gave out under the weight of the rest of your {}s.".format( item.str_name, item.item_type) fisher.stop() user_data.persist() else: user_initial_level = user_data.slimelevel gang_bonus = False has_fishingrod = False if user_data.weapon >= 0: weapon_item = EwItem(id_item=user_data.weapon) weapon = static_weapons.weapon_map.get( weapon_item.item_props.get("weapon_type")) if weapon.id_weapon == "fishingrod": has_fishingrod = True value = 0 # Rewards from the fish's size slime_gain = ewcfg.fish_gain * static_fish.size_to_reward[ fisher.current_size] value += 10 * static_fish.size_to_reward[fisher.current_size] # Rewards from the fish's rarity value += 10 * static_fish.rarity_to_reward[static_fish.fish_map[ fisher.current_fish].rarity] if user_data.life_state == 2: if fisher.current_fish in static_fish.day_fish and user_data.faction == ewcfg.faction_rowdys: gang_bonus = True slime_gain = slime_gain * 1.5 value += 20 if fisher.current_fish in static_fish.night_fish and user_data.faction == ewcfg.faction_killers: gang_bonus = True slime_gain = slime_gain * 1.5 value += 20 # Disabled while I try out the new mastery fishing #if has_fishingrod == True: # slime_gain = slime_gain * 2 # trauma = se_static.trauma_map.get(user_data.trauma) # if trauma != None and trauma.trauma_class == ewcfg.trauma_class_slimegain: # slime_gain *= (1 - 0.5 * user_data.degradation / 100) if fisher.pier.pier_type == ewcfg.fish_slime_void: slime_gain = slime_gain * 1.5 value += 30 if fisher.current_fish == "plebefish": slime_gain = ewcfg.fish_gain * .5 value = 10 controlling_faction = poi_utils.get_subzone_controlling_faction( user_data.poi, user_data.id_server) if controlling_faction != "" and controlling_faction == user_data.faction: slime_gain *= 2 if user_data.poi == ewcfg.poi_id_juviesrow_pier: slime_gain = int(slime_gain / 4) #trauma = se_static.trauma_map.get(user_data.trauma) #if trauma != None and trauma.trauma_class == ewcfg.trauma_class_slimegain and False: #slime_gain *= (1 - 0.5 * user_data.degradation / 100) slime_gain = max(0, round(slime_gain)) bknd_item.item_create( id_user=actual_fisherman or cmd.message.author.id, id_server=cmd.guild.id, item_type=ewcfg.it_food, item_props={ 'id_food': static_fish.fish_map[fisher.current_fish].id_fish, 'food_name': static_fish.fish_map[fisher.current_fish].str_name, 'food_desc': "{}\nIt's {} inches long.".format( static_fish.fish_map[fisher.current_fish].str_desc, fisher.length), 'recover_hunger': 20, 'str_eat': ewcfg.str_eat_raw_material.format( static_fish.fish_map[fisher.current_fish].str_name), 'rarity': static_fish.fish_map[fisher.current_fish].rarity, 'size': fisher.current_size, 'time_expir': time.time() + ewcfg.std_food_expir, 'time_fridged': 0, 'acquisition': ewcfg.acquisition_fishing, 'value': value, 'noslime': 'false', 'length': fisher.length }) if fisher.inhabitant_id: server = cmd.guild inhabitant_member = server.get_member(fisher.inhabitant_id) inhabitant_name = inhabitant_member.display_name inhabitant_data = EwUser(id_user=fisher.inhabitant_id, id_server=user_data.id_server) inhabitee_name = server.get_member(actual_fisherman).display_name slime_gain = int(0.25 * slime_gain) response = "The two of you together manage to reel in a {fish}! {flavor} {ghost} haunts {slime:,} slime away from the fish before placing it on {fleshling}'s hands." \ .format( fish=static_fish.fish_map[fisher.current_fish].str_name, flavor=static_fish.fish_map[fisher.current_fish].str_desc, ghost=inhabitant_name, fleshling=inhabitee_name, slime=slime_gain, ) inhabitant_data.change_slimes(n=-slime_gain) inhabitant_data.persist() fisher.stop() else: response = "You reel in a {fish}! {flavor} You grab hold and wring {slime:,} slime from it. " \ .format(fish=static_fish.fish_map[fisher.current_fish].str_name, flavor=static_fish.fish_map[fisher.current_fish].str_desc, slime=slime_gain) if gang_bonus == True: if user_data.faction == ewcfg.faction_rowdys: response += "The Rowdy-pride this fish is showing gave you more slime than usual. " elif user_data.faction == ewcfg.faction_killers: response += "The Killer-pride this fish is showing gave you more slime than usual. " levelup_response = user_data.change_slimes( n=slime_gain, source=ewcfg.source_fishing) was_levelup = True if user_initial_level < user_data.slimelevel else False # Tell the player their slime level increased. if was_levelup: response += levelup_response fisher.stop() user_data.persist() return response
async def barter_all(cmd): user_data = EwUser(member=cmd.message.author) mutations = user_data.get_mutations() # if non-zone channel, break 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]))) # if not in speakeasy, break if cmd.message.channel.name != ewcfg.channel_speakeasy: if user_data.poi in poi_static.piers: response = 'You ask a nearby fisherman if he wants to trade you anything for this fish you just caught. He tells you to f**k off, but also helpfully informs you that there’s an old sea captain that frequents the Speakeasy that might be able to help you. What an inexplicably helpful/grouchy fisherman!' else: response = 'What random passerby is going to give two shits about your fish? You’ll have to consult a fellow fisherman… perhaps you’ll find some on a pier?' return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) # if corpse, break if user_data.life_state == ewcfg.life_state_corpse: response = 'Captain Albert Alexander hits the table with his glass and shouts "Nay laddy, you can fool me once but not twice! I dont do deals with spirits, get out of my sight!"' return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) food_items = bknd_item.inventory(id_user=user_data.id_user, id_server=user_data.id_server, item_type_filter=ewcfg.it_food) offer_items = [] # list of items to create when offer goes through offer_slime = 0 # slime to give player when offer goes through fish_ids_to_remove = [] # list of fish to delete when offer goes through # check if food item is a fish and add to offer if it is for item in food_items: fish = EwItem(id_item=item.get('id_item')) # if item is a fish, add to offer if fish.item_props.get('acquisition') == ewcfg.acquisition_fishing: fish_ids_to_remove.append(fish.id_item) value = int(fish.item_props['value']) # Random choice between 0, 1, and 2 offer_decision = random.randint(0, 2) if (offer_decision != 2 or ewcfg.mutation_id_davyjoneskeister in mutations) and fish.item_props.get('noslime') != "true" and ewcfg.mutation_id_onemansjunk not in mutations: # If Captain Albert Alexander wants to offer you slime for your fish. 66% chance. max_value = value * 6000 # 600,000 slime for a colossal promo fish, 120,000 for a miniscule common fish. min_value = max_value / 5 # 120,000 slime for a colossal promo fish, 24,000 for a miniscule common fish. slime_gain = round(random.triangular(min_value, max_value, min_value * 2)) offer_slime += slime_gain else: # If Captain Albert Alexander wants to offer you an item for your fish. 33% chance. Once there are more unique items, we'll make this 50%. potential_items = [] # Filters out all non-generic items without the current fish as an ingredient. for result in vendors.appraise_results: if result.ingredients == fish.item_props.get('id_item') or result.ingredients == "generic" and result.acquisition == ewcfg.acquisition_bartering: # Generic means that it can be made with any fish. potential_items.append(result) else: pass # Filters out items of greater value than your fish. for value_filter in potential_items: if value < value_filter.context: potential_items.remove(value_filter) else: pass offer_items.append(random.choice(potential_items)) # if player had some fish to offer if offer_slime > 0 or len(offer_items) > 0: response = "You approach a man of particularly swashbuckling appearance, adorned in an old sea captain's uniform and bicorne cap, and surrounded by empty glass steins. You ask him if he is Captain Albert Alexander and he replies that he hasn’t heard that name in a long time. You drop all of your fish at his feet." items_desc = "" if len(offer_items) > 0: if len(offer_items) > 4: items_desc = "a handful items" elif len(offer_items) > 1: items_desc = "a few items" else: items_desc = "a {}".format(offer_items[0].str_name) offer_desc = "{}{}{}".format((str(offer_slime) + " slime") if (offer_slime > 0) else "", " and " if (offer_slime > 0 and len(items_desc) > 0) else "", items_desc if (len(items_desc) > 0) else "") response += ' \n"Hm, alright… for your fish... I’ll trade you {}!"'.format(offer_desc) await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) response = "" if offer_slime > 0: slime_gain = offer_slime user_initial_level = user_data.slimelevel levelup_response = user_data.change_slimes(n=slime_gain, source=ewcfg.source_fishing) was_levelup = True if user_initial_level < user_data.slimelevel else False # Tell the player their slime level increased. if was_levelup: response += levelup_response response += "\n\n" if len(offer_items): for item in offer_items: item_props = itm_utils.gen_item_props(item) bknd_item.item_create( item_type=item.item_type, id_user=cmd.message.author.id, id_server=cmd.guild.id, item_props=item_props ) for id in fish_ids_to_remove: bknd_item.item_delete(id_item=id) user_data.persist() response += '"Pleasure doing business with you, laddy!"' # player has no fish else: response = "You need some fish to barter with Captain Albert Alexander. Get out there and do some fishing!" await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def sew(cmd): user_data = EwUser(member=cmd.message.author) # Player must be at the Bodega if user_data.poi == ewcfg.poi_id_bodega: item_id = ewutils.flattenTokenListToString(cmd.tokens[1:]) try: item_id_int = int(item_id) except: item_id_int = None # Check to see if you even have the item you want to repair if item_id != None and len(item_id) > 0: response = "You don't have one." cosmetic_items = bknd_item.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 for item in cosmetic_items: if item.get( 'id_item' ) == item_id_int or item_id in ewutils.flattenTokenListToString( item.get('name')): i = EwItem(item.get('id_item')) if item_from_slimeoid == None and i.item_props.get( "slimeoid") == 'true': item_from_slimeoid = i continue else: item_sought = i break if item_sought == None: item_sought = item_from_slimeoid # If the cosmetic you want to have repaired is found if item_sought != None: # Can't repair items without durability limits, since they couldn't have been damaged in the first place if item_sought.item_props['durability'] is None: response = "I'm sorry, but I can't repair that piece of clothing!" else: if item_sought.item_props['id_cosmetic'] == 'soul': original_durability = ewcfg.soul_durability elif item_sought.item_props['id_cosmetic'] == 'scalp': if 'original_durability' not in item_sought.item_props.keys( ): # If it's a scalp created before this update original_durability = ewcfg.generic_scalp_durability else: original_durability = int( float(item_sought. item_props['original_durability']) ) # If it's a scalp created after else: # Find the mold of the item in cosmetics.cosmetic_items_list if item_sought.item_props.get( 'rarity') == ewcfg.rarity_princeps: original_durability = ewcfg.base_durability * 100 original_item = None # Princeps do not have existing templates else: try: original_item = cosmetics.cosmetic_map.get( item_sought.item_props['id_cosmetic']) original_durability = original_item.durability except: original_durability = ewcfg.base_durability current_durability = int( float(item_sought.item_props['durability'])) # If the cosmetic is actually damaged at all if current_durability < original_durability: difference = abs(current_durability - original_durability) # cost_ofrepair = difference * 4 # NO ONE SAID IT WOULD BE EASY cost_ofrepair = 10000 # I did... if cost_ofrepair > user_data.slimes: response = 'The hipster behind the counter narrows his gaze, his thick-rimmed glasses magnify his hatred of your ignoble ancestry.\n"Sir… it would cost {:,} to sew this garment back together. That’s more slime than you or your clan could ever accrue. Good day, sir. I SAID GOOD DAY. Come back when you’re a little, mmmmhh, *richer*."'.format( cost_ofrepair) else: response = '"Let’s see, all told… including tax… plus gratuity… and a hefty tip, of course… your total comes out to {}, sir."'.format( cost_ofrepair) response += "\n**!accept** or **!refuse** the deal." await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) # Wait for an answer accepted = False try: message = await cmd.client.wait_for( 'message', timeout=20, check=lambda message: message.author == cmd .message.author and message.content.lower( ) in [ewcfg.cmd_accept, ewcfg.cmd_refuse]) if message != None: if message.content.lower( ) == ewcfg.cmd_accept: accepted = True if message.content.lower( ) == ewcfg.cmd_refuse: accepted = False except: accepted = False # Cancel deal if the hat is no longer in user's inventory if item_sought.id_owner != str(user_data.id_user): accepted = False # Cancel deal if the user has left Krak Bay if user_data.poi != ewcfg.poi_id_bodega: accepted = False # Candel deal if the user doesn't have enough slime anymore if cost_ofrepair > user_data.slimes: accepted = False if accepted == True: user_data.change_slimes( n=-cost_ofrepair, source=ewcfg.source_spending) user_data.persist() item_sought.item_props[ 'durability'] = original_durability item_sought.persist() response = '"Excellent. Just a moment… one more stitch and-- there, perfect! Your {}, sir. It’s good as new, no? Well, no refunds in any case."'.format( item_sought.item_props['cosmetic_name']) else: response = '"Oh, yes, of course. I understand, sir. No, really that’s okay. I get it. I totally get it. That’s your decision. Really, it’s okay. No problem here. Yep. Yup. Uh-huh, uh-huh. Yep. It’s fine, sir. That’s completely fine. For real. Seriously. I understand, sir. It’s okay. I totally get it. Yep. Uh-huh. Yes, sir. Really, it’s okay. Some people just don’t care how they look. I understand, sir."' else: response = 'The hipster behind the counter looks over your {} with the thoroughness that a true man would only spend making sure all the blood really was wrung from his most recent hunt’s neck or all the cum was ejactulated from his partner’s throbbing c**k…\n"Sir," he begins to say, turning back to you before almost vomiting at the sight. After he regains his composure, he continues, "I understand you are an, shall we say, uneducated peasant, to put it delicately, but even still you should be able to tell that your {} is in mint condition. Please, do not bother me with such wastes of my boss’ time again. I do enough of that on my own."'.format( item_sought.item_props['cosmetic_name'], item_sought.item_props['cosmetic_name']) else: response = "Sew which cosmetic? Check your **!inventory**." else: response = "Heh, yeah right. What kind of self-respecting juvenile delinquent knows how to sew? Sewing totally f*****g lame, everyone knows that! Even people who sew know that! You’re gonna have to find some nerd to do it for you." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def take(cmd): user_data = EwUser(member=cmd.message.author) response = "" admin = 0 if cmd.message.author.guild_permissions.administrator: admin = 1 poi = poi_static.id_to_poi.get(user_data.poi) if poi.community_chest == None: response = "There is no community chest here." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: if len(poi.factions) > 0 and user_data.faction not in poi.factions: response = "Get real, asshole. You haven't even enlisted into this gang yet, so it's not like they'd trust you with a key to their valubles." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) multisnag = 1 startparse = 1 if cmd.tokens[1] == 'all': cmd.tokens[1] = '100' if cmd.tokens[1].isnumeric() and cmd.tokens_count > 2: startparse = 2 multisnag = int(cmd.tokens[1]) if multisnag > 100: multisnag = 100 item_search = ewutils.flattenTokenListToString(cmd.tokens[startparse:]) item_sought = bknd_item.find_item( item_search=item_search, id_user=poi.community_chest, id_server=cmd.guild.id if cmd.guild is not None else None, admin=admin) items_snagged = 0 item_list = [] item_cache = bknd_core.get_cache(obj_type="EwItem") if item_sought: item_search = ewutils.flattenTokenListToString(item_sought.get('name')) loop_sought = item_sought.copy() while multisnag > 0 and loop_sought is not None: if items_snagged == 0: inv_response = bknd_item.check_inv_capacity( user_data=user_data, item_type=loop_sought.get('item_type'), return_strings=True, pronoun="You") if inv_response != "": return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, inv_response)) list_items = bknd_item.inventory( id_user=cmd.message.author.id, id_server=cmd.guild.id, item_type_filter=loop_sought.get('item_type')) if loop_sought.get('item_type') == ewcfg.it_food: food_items = bknd_item.inventory( id_user=cmd.message.author.id, id_server=cmd.guild.id, item_type_filter=ewcfg.it_food) if user_data.get_food_capacity() - len( food_items) < multisnag: multisnag = user_data.get_food_capacity() - len( food_items) del food_items elif loop_sought.get('item_type') == ewcfg.it_weapon: weapons_held = bknd_item.inventory( id_user=cmd.message.author.id, id_server=cmd.guild.id, item_type_filter=ewcfg.it_weapon) if user_data.life_state == ewcfg.life_state_corpse: del weapons_held response = "Ghosts can't hold weapons." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif user_data.get_weapon_capacity() - len( weapons_held) < multisnag: multisnag = user_data.get_weapon_capacity() - len( weapons_held) del weapons_held else: other_items = bknd_item.inventory( id_user=cmd.message.author.id, id_server=user_data.id_server, item_type_filter=loop_sought.get('item_type')) if ewcfg.generic_inv_limit - len(other_items) < multisnag: multisnag = ewcfg.generic_inv_limit - len(other_items) del other_items items_snagged += 1 multisnag -= 1 bknd_item.give_item(id_item=loop_sought.get('id_item'), id_server=user_data.id_server, id_user=user_data.id_user) item_list.append(loop_sought.get('id_item')) cache_item = item_cache.get_entry( unique_vals={"id_item": loop_sought.get('id_item')}) cache_item.update({'id_owner': cmd.message.author.id}) item_cache.set_entry(data=cache_item) #loop_sought = bknd_item.find_item(item_search=item_search, id_user=poi.community_chest, id_server=cmd.guild.id if cmd.guild is not None else None, admin=admin) func = partial( bknd_item.find_item, item_search=item_search, id_user=poi.community_chest, id_server=cmd.guild.id if cmd.guild is not None else None, admin=admin) event_loop = asyncio.get_event_loop() loop_sought = await event_loop.run_in_executor(None, func) if items_snagged > 1: name_string = "{}(x{})".format(item_sought.get("name"), items_snagged) else: name_string = item_sought.get('name') response = "You retrieve a {} from the community chest.".format( name_string) del item_sought else: if item_search: response = "There isn't one here." else: response = "{} which item? (check **{}**)".format( cmd.tokens[0], ewcfg.cmd_communitychest) return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def retrofit(cmd): user_data = EwUser(member=cmd.message.author) # Player must be at the Bodega if user_data.poi == ewcfg.poi_id_bodega: item_id = ewutils.flattenTokenListToString(cmd.tokens[1:]) try: item_id_int = int(item_id) except: item_id_int = None # Check to see if you even have the item you want to retrofit if item_id != None and len(item_id) > 0: response = "You don't have one." cosmetic_items = bknd_item.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 for item in cosmetic_items: if item.get( 'id_item' ) == item_id_int or item_id in ewutils.flattenTokenListToString( item.get('name')): i = EwItem(item.get('id_item')) if item_from_slimeoid == None and i.item_props.get( "slimeoid") == 'true': item_from_slimeoid = i continue else: item_sought = i break if item_sought == None: item_sought = item_from_slimeoid # If the cosmetic you want to have repaired is found if item_sought != None: if item_sought.item_props.get( 'id_cosmetic') == 'soul' or item_sought.item_props.get( 'id_cosmetic') == 'scalp': response = 'The hipster behind the counter is taken aback by your total lack of self awareness. "By Doctor Who!" He exclaims. "This is a place where fine clothing is sold, sir. Not a common circus freak show for ill-bred worms to feed upon the suffering of others, where surely someone of your morally bankrupt description must surely have originated! That or the w***e house, oh my Rainbow Dash..." He begins to tear up. "Just… go. Take your {} and go. Do come back if you want it sewn back together, though."'.format( item_sought.item_props['cosmetic_name']) else: current_item_stats = {} # Get the current stats of your cosmetic for stat in ewcfg.playerstats_list: if stat in item_sought.item_props.keys(): if abs(int(item_sought.item_props[stat])) > 0: current_item_stats[stat] = int( item_sought.item_props[stat]) if 'ability' in item_sought.item_props.keys(): current_item_stats['ability'] = item_sought.item_props[ 'ability'] # Get the stats retrofitting would give you from the item model in cosmetics.cosmetic_items_list desired_item = cosmetics.cosmetic_map.get( item_sought.item_props['id_cosmetic']) if desired_item == None: response = "The hipster behind the counter doesn't really know what to do with that cosmetic, it's simply too outdated and worn out. He thinks you should just take it home and stuff it inside a box as a souvenir." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) desired_item_stats = {} for stat in ewcfg.playerstats_list: if stat in desired_item.stats.keys(): if abs(int(desired_item.stats[stat])) > 0: desired_item_stats[stat] = desired_item.stats[ stat] if desired_item.ability is not None: desired_item_stats['ability'] = desired_item.ability # Check to see if the cosmetic is actually outdated if current_item_stats != desired_item_stats: cost_ofretrofit = 100 # This is a completely random number that I arbitrarily pulled out of my ass if cost_ofretrofit > user_data.slimes: response = 'The hipster behind the counter narrows his gaze, his thick-rimmed glasses magnify his hatred of your ignoble ancestry.\n"Sir… it would cost {:,} to retrofit this garment with updated combat abilities. That’s more slime than you or your clan could ever accrue. Good day, sir. I SAID GOOD DAY. Come back when you’re a little, mmmmhh, *richer*."'.format( cost_ofretrofit) else: response = '"Let’s see, all told… including tax… plus gratuity… and a hefty tip, of course… your total comes out to {}, sir."'.format( cost_ofretrofit) response += "\n**!accept** or **!refuse** the deal." await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) # Wait for an answer accepted = False try: message = await cmd.client.wait_for( 'message', timeout=20, check=lambda message: message.author == cmd .message.author and message.content.lower( ) in [ewcfg.cmd_accept, ewcfg.cmd_refuse]) if message != None: if message.content.lower( ) == ewcfg.cmd_accept: accepted = True if message.content.lower( ) == ewcfg.cmd_refuse: accepted = False except: accepted = False # Cancel deal if the hat is no longer in user's inventory if item_sought.id_owner != str(user_data.id_user): accepted = False # Cancel deal if the user has left Krak Bay if user_data.poi != ewcfg.poi_id_bodega: accepted = False # Candel deal if the user doesn't have enough slime anymore if cost_ofretrofit > user_data.slimes: accepted = False if accepted == True: for stat in ewcfg.playerstats_list: if stat in desired_item_stats.keys(): item_sought.item_props[ stat] = desired_item_stats[stat] item_sought.persist() user_data.slimes -= cost_ofretrofit user_data.persist() response = '"Excellent. Just a moment… one more iron press and-- there, perfect! Your {}, sir. It’s like you just smelted it, no? Well, no refunds in any case."'.format( item_sought.item_props['cosmetic_name']) else: response = '"Oh, yes, of course. I understand, sir. No, really that’s okay. I get it. I totally get it. That’s your decision. Really, it’s okay. No problem here. Yep. Yup. Uh-huh, uh-huh. Yep. It’s fine, sir. That’s completely fine. For real. Seriously. I understand, sir. It’s okay. I totally get it. Yep. Uh-huh. Yes, sir. Really, it’s okay. Some people just don’t care how they look. I understand, sir."' else: response = 'The hipster behind the counter looks over your {} with the thoroughness that a true man would only spend making sure all the blood really was wrung from his most recent hunt’s neck or all the cum was ejactulated from his partner’s throbbing c**k…\n"Sir," he begins to say, turning back to you before almost vomiting at the sight. After he regains his composure, he continues, "I understand you are an, shall we say, uneducated peasant, to put it delicately, but even still you should be able to tell that your {} is already completely up-to-date. Please, do not bother me with such wastes of my boss’ time again. I do enough of that on my own."'.format( item_sought.item_props['cosmetic_name'], item_sought.item_props['cosmetic_name']) else: response = "Sew which cosmetic? Check your **!inventory**." else: response = "Heh, yeah right. What kind of self-respecting juvenile delinquent knows how to sew? Sewing totally lame, everyone knows that! Even people who sew know that! Looks like you’re gonna have to find some nerd to do it for you." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def usekey(cmd, owner_user): owner_apartment = EwApartment(id_user=owner_user.id_user, id_server=cmd.guild.id) user_data = EwUser(member=cmd.message.author) poi = poi_static.id_to_poi.get(user_data.poi) poi_dest = poi_static.id_to_poi.get( ewcfg.poi_id_apt + owner_apartment.poi ) # there isn't an easy way to change this, apologies for being a little hacky inv = bknd_item.inventory(id_user=cmd.message.author.id, id_server=cmd.guild.id) key = None for item_inv in inv: if "key to" in item_inv.get('name'): item_key_check = EwItem(id_item=item_inv.get('id_item')) if item_key_check.item_props.get("houseID") == str( owner_user.id_user): key = item_key_check 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 enter an apartment in a zone's channel.".format( cmd.tokens[0]))) elif key == None: response = "You don't have a key for their apartment." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif owner_apartment.apt_class == ewcfg.property_class_c or ( owner_apartment.apt_class in [ewcfg.property_class_a, ewcfg.property_class_b] and key.id_item == owner_apartment.key_2): return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage( cmd.message.author, "Your key's not working at this new flat. Your roomates must've forgotten to upgrade apartments. Congratulations on the homelessness by the way." .format(cmd.tokens[0]))) elif owner_apartment.poi != poi.id_poi: response = "Your key doesn't match an apartment here." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: move_utils.move_counter += 1 move_current = ewutils.moves_active[ cmd.message.author.id] = move_utils.move_counter await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, "You start walking toward the apartment.")) await asyncio.sleep(20) if move_current == ewutils.moves_active[cmd.message.author.id]: user_data = EwUser(member=cmd.message.author) user_data.poi = poi_dest.id_poi user_data.visiting = owner_user.id_user user_data.persist() await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) response = "You're in the apartment." try: await fe_utils.send_message(cmd.client, cmd.message.author, response) except: await fe_utils.send_message( cmd.client, fe_utils.get_channel(cmd.guild, poi_dest.channel), fe_utils.formatMessage(cmd.message.author, response))
async def abduct(cmd): user_data = EwUser(member=cmd.message.author) item_sought = bknd_item.find_item(item_search='batterypack', id_user=cmd.message.author.id, id_server=cmd.guild.id) 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 shipstate = EwGamestate(id_server=user_data.id_server, id_state='shipstate') if user_data.poi != 'ufoufo': response = "Abduct 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." elif cmd.mentions_count == 0: response = "Abduct who?" elif cmd.mentions_count > 1: response = "One victim at a time, please." elif shipstate.bit == 1: response = 'The ship\'s on the ground right now, it can\'t reach you.' else: if item_sought: target_data = EwUser(member = cmd.mentions[0]) target_poi = poi_static.id_to_poi.get(target_data.poi) target_channel = fe_utils.get_channel(cmd.message.guild, target_poi.channel) if target_poi.id_poi == 'blackpond' or ( not target_poi.is_district and not target_poi.is_outskirts and not target_poi.is_pier and target_poi.id_poi not in [ ewcfg.poi_id_slimesendcliffs, ewcfg.poi_id_ferry, ewcfg.poi_id_sodafountain, ewcfg.poi_id_stockexchange, ewcfg.poi_id_ab_farms, ewcfg.poi_id_og_farms, ewcfg.poi_id_jr_farms]): response = "The tractor beam on this ship sucks. You can't really see indoors." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif target_poi.id_poi in [ewcfg.poi_id_rowdyroughhouse, ewcfg.poi_id_copkilltown]: response = "Don't do that." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) bknd_item.item_delete(id_item=item_sought.get('id_item')) ewutils.moves_active[target_data.id_user] = 0 response = 'You plug in your battery pack and begin to abduct {} They\'re 20 seconds away.'.format(cmd.mentions[0].display_name) await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) await fe_utils.send_message(cmd.client, target_channel, fe_utils.formatMessage(cmd.mentions[0], "You are being abducted by aliens. The ship is 20 seconds away.")) ewutils.active_restrictions[target_data.id_user] = 2 await asyncio.sleep(20) ewutils.active_restrictions[target_data.id_user] = 0 ewutils.moves_active[cmd.message.author.id] = 0 target_data.poi = 'ufoufo' user_data.persist() target_data.persist() await ewrolemgr.updateRoles(client=ewutils.get_client(), member=cmd.mentions[0]) await target_data.move_inhabitants(id_poi='ufoufo') else: response = "The going energy cost for abduction is pretty expensive these days. You better have a battery pack before you do something like that." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
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