예제 #1
0
async def reroll_last_mutation(cmd):
	last_mutation_counter = -1
	last_mutation = ""
	user_data = EwUser(member = cmd.message.author)
	market_data = EwMarket(id_server = user_data.id_server)
	response = ""

	if cmd.message.channel.name != ewcfg.channel_slimeoidlab:
		response = "You require the advanced equipment at the Slimeoid Lab to modify your mutations."
		return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))

	if user_data.life_state == ewcfg.life_state_corpse:
		response = "How do you expect to mutate without exposure to slime, dumbass?"
		return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))


	mutations = user_data.get_mutations()
	if len(mutations) == 0:
		response = "You have not developed any specialized mutations yet."
		return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))

	for id_mutation in mutations:
		mutation_data = EwMutation(id_server = user_data.id_server, id_user = user_data.id_user, id_mutation = id_mutation)
		if mutation_data.mutation_counter > last_mutation_counter:
			last_mutation_counter = mutation_data.mutation_counter
			last_mutation = id_mutation

	reroll_fatigue = EwStatusEffect(id_status = ewcfg.status_rerollfatigue_id, user_data = user_data)

	poudrins_needed = 2 ** int(reroll_fatigue.value)

	poudrins = ewitem.find_item_all(item_search = ewcfg.item_id_slimepoudrin, id_user = cmd.message.author.id, id_server = cmd.message.server.id if cmd.message.server is not None else None, item_type_filter = ewcfg.it_item)

	poudrins_have = len(poudrins)

	if poudrins_have < poudrins_needed:
		response = "You need {} slime poudrin{} to replace a mutation, but you only have {}.".format(poudrins_needed, "" if poudrins_needed == 1 else "s", poudrins_have)

		return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
	else:
		for delete in range(poudrins_needed):
			ewitem.item_delete(id_item = poudrins.pop(0).get('id_item'))  # Remove Poudrins
		market_data.donated_poudrins += poudrins_needed
		market_data.persist()
		user_data.poudrin_donations += poudrins_needed
		user_data.persist()
		reroll_fatigue.value = int(reroll_fatigue.value) + 1
		reroll_fatigue.persist()

	mutation_data = EwMutation(id_server = user_data.id_server, id_user = user_data.id_user, id_mutation = last_mutation)
	new_mutation = random.choice(list(ewcfg.mutation_ids))
	while new_mutation in mutations:
		new_mutation = random.choice(list(ewcfg.mutation_ids))

	mutation_data.id_mutation = new_mutation
	mutation_data.time_lastuse = int(time.time())
	mutation_data.persist()

	response = "After several minutes long elevator descents, in the depths of some basement level far below the laboratory's lobby, you lay down on a reclined medical chair. A SlimeCorp employee finishes the novel length terms of service they were reciting and asks you if you have any questions. You weren’t listening so you just tell them to get on with it so you can go back to getting slime. They oblige.\nThey grab a butterfly needle and carefully stab you with it, draining some strangely colored slime from your bloodstream. Almost immediately, the effects of your last mutation fade away… but, this feeling of respite is fleeting. The SlimeCorp employee writes down a few notes, files away the freshly drawn sample, and soon enough you are stabbed with syringes. This time, it’s already filled with some bizarre, multi-colored serum you’ve never seen before. The effects are instantaneous. {}\nYou hand off {} of your hard-earned poudrins to the SlimeCorp employee for their troubles.".format(ewcfg.mutations_map[new_mutation].str_acquire, poudrins_needed)
	return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
예제 #2
0
파일: ew.py 프로젝트: seaniman/endless-war
	def applyStatus(self, id_status = None, value = 0, source = "", multiplier = 1, id_target = ""):
		response = ""
		if id_status != None:
			status = None

			status = ewcfg.status_effects_def_map.get(id_status)
			time_expire = status.time_expire * multiplier

			if status != None:
				statuses = self.getStatusEffects()

				status_effect = EwStatusEffect(id_status=id_status, user_data=self, time_expire= time_expire, value=value, source=source, id_target = id_target)
				
				if id_status in statuses:
					status_effect.value = value

					if status.time_expire > 0 and id_status in ewcfg.stackable_status_effects:
						status_effect.time_expire += time_expire
						response = status.str_acquire

					status_effect.persist()
				else:
					response = status.str_acquire
					

		return response		
예제 #3
0
    def apply_injury(self, id_injury, severity, source):
        statuses = self.getStatusEffects()

        if id_injury in statuses:
            status_data = EwStatusEffect(id_status=id_injury, user_data=self)

            try:
                value_int = int(status_data.value)

                if value_int > severity:
                    if random.randrange(value_int) < severity:
                        status_data.value = value_int + 1
                else:
                    status_data.value = severity
            except:
                status_data.value = severity

            status_data.source = source

            status_data.persist()

        else:
            self.applyStatus(id_status=id_injury,
                             value=severity,
                             source=source)
예제 #4
0
def removeExpiredStatuses(id_server = None):
	if id_server != None:
		time_now = int(time.time())

		#client = get_client()
		#server = client.get_server(id_server)

		statuses = execute_sql_query("SELECT {id_status},{id_user} FROM status_effects WHERE id_server = %s AND {time_expire} < %s".format(
			id_status = ewcfg.col_id_status,
			id_user = ewcfg.col_id_user,
			time_expire = ewcfg.col_time_expir
		), (
			id_server,
			time_now
		))

		for row in statuses:
			status = row[0]
			id_user = row[1]
			user_data = EwUser(id_user = id_user, id_server = id_server)
			status_def = ewcfg.status_effects_def_map.get(status)
			status_effect = EwStatusEffect(id_status=status, user_data = user_data)
	
			if status_def.time_expire > 0:
				if status_effect.time_expire < time_now:
					user_data.clear_status(id_status=status)

			# Status that expire under special conditions
			else:
				if status == ewcfg.status_stunned_id:
					if int(status_effect.value) < time_now:
						user_data.clear_status(id_status=status)
예제 #5
0
async def data(cmd):
    response = ""
    user_data = None
    member = None
    resp_cont = ewutils.EwResponseContainer(id_server=cmd.message.server.id)

    if len(cmd.tokens) > 1 and cmd.mentions_count == 0:
        user_data = EwUser(member=cmd.message.author)

        soughtenemy = " ".join(cmd.tokens[1:]).lower()
        enemy = find_enemy(soughtenemy, user_data)
        if enemy != None:
            if enemy.attacktype != ewcfg.enemy_attacktype_unarmed:
                response = "{} is a level {} enemy. They have {} slime, and attack with their {}.".format(
                    enemy.display_name, enemy.level, enemy.slimes,
                    enemy.attacktype)
            else:
                response = "{} is a level {} enemy. They have {} slime.".format(
                    enemy.display_name, enemy.level, enemy.slimes)
        else:
            response = "ENDLESS WAR didn't understand that name."

        resp_cont.add_channel_response(cmd.message.channel.name, response)

    elif cmd.mentions_count == 0:

        user_data = EwUser(member=cmd.message.author)
        slimeoid = EwSlimeoid(member=cmd.message.author)
        mutations = user_data.get_mutations()

        cosmetics = ewitem.inventory(id_user=cmd.message.author.id,
                                     id_server=cmd.message.server.id,
                                     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 = ewcfg.hue_map.get(cos.item_props.get('hue'))
                adorned_cosmetics.append((hue.str_name +
                                          " " if hue != None else "") +
                                         cosmetic.get('name'))

        poi = ewcfg.id_to_poi.get(user_data.poi)
        if poi != None:
            response = "You find yourself {} {}. ".format(
                poi.str_in, poi.str_name)

        # return my data
        if user_data.life_state == ewcfg.life_state_corpse:
            response += "You are a level {} deadboi.".format(
                user_data.slimelevel)
        else:
            response += "You are a level {} slimeboi.".format(
                user_data.slimelevel)

        coinbounty = int(user_data.bounty / ewcfg.slimecoin_exchangerate)

        weapon_item = EwItem(id_item=user_data.weapon)
        weapon = ewcfg.weapon_map.get(
            weapon_item.item_props.get("weapon_type"))

        if weapon != None:
            response += " {} {}{}.".format(
                ewcfg.str_weapon_married_self if user_data.weaponmarried
                == True else ewcfg.str_weapon_wielding_self,
                ("" 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_self.format(
                        rank=(user_data.weaponskill - 4)))

        trauma = ewcfg.weapon_map.get(user_data.trauma)
        # if trauma is not gathered from weapon_map, get it from attack_type_map
        if trauma == None:
            trauma = ewcfg.attack_type_map.get(user_data.trauma)

        if trauma != None:
            response += " {}".format(trauma.str_trauma_self)

        response_block = ""
        for mutation in mutations:
            mutation_flavor = ewcfg.mutations_map[mutation]
            response_block += "{} ".format(mutation_flavor.str_describe_self)

        if len(response_block) > 0:
            response += "\n\n" + response_block

        resp_cont.add_channel_response(cmd.message.channel.name, response)

        response = ""
        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)

        if user_kills > 0 and enemy_kills > 0:
            response_block += "You have {:,} confirmed kills, and {:,} confirmed hunts. ".format(
                user_kills, enemy_kills)
        elif user_kills > 0:
            response_block += "You have {:,} confirmed kills. ".format(
                user_kills)
        elif enemy_kills > 0:
            response_block += "You have {:,} confirmed hunts. ".format(
                enemy_kills)

        if coinbounty != 0:
            response_block += "SlimeCorp offers a bounty of {:,} SlimeCoin for your death. ".format(
                coinbounty)

        if len(adorned_cosmetics) > 0:
            response_block += "You have a {} adorned. ".format(
                ewutils.formatNiceList(adorned_cosmetics, 'and'))

        if user_data.hunger > 0:
            response_block += "You are {}% hungry. ".format(
                round(user_data.hunger * 100.0 / user_data.get_hunger_max(),
                      1))

        if user_data.busted and user_data.life_state == ewcfg.life_state_corpse:
            response_block += "You are busted and therefore cannot leave the sewers until your next !haunt. "

        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 = ewcfg.status_effects_def_map.get(status)
                if status_flavor is not None:
                    response_block += status_flavor.str_describe_self + " "

        if (slimeoid.life_state == ewcfg.slimeoid_state_active) and (
                user_data.life_state != ewcfg.life_state_corpse):
            response_block += "You are accompanied by {}, a {}-foot-tall Slimeoid. ".format(
                slimeoid.name, str(slimeoid.level))

        if len(response_block) > 0:
            response += "\n" + response_block

        response += "\n\nhttps://ew.krakissi.net/stats/player.html?pl={}".format(
            user_data.id_user)

        resp_cont.add_channel_response(cmd.message.channel.name, response)
    else:
        member = cmd.mentions[0]
        resp_cont = gen_data_text(id_user=member.id,
                                  id_server=member.server.id,
                                  display_name=member.display_name,
                                  channel_name=cmd.message.channel.name)

    # Send the response to the player.
    resp_cont.format_channel_response(cmd.message.channel.name,
                                      cmd.message.author)
    await resp_cont.post()

    await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author)
    if member != None:
        await ewrolemgr.updateRoles(client=cmd.client, member=member)
예제 #6
0
def gen_data_text(id_user=None,
                  id_server=None,
                  display_name=None,
                  channel_name=None):
    resp_cont = ewutils.EwResponseContainer(id_server=id_server)
    response = ""
    user_data = EwUser(id_user=id_user, id_server=id_server)
    slimeoid = EwSlimeoid(id_user=id_user, id_server=id_server)

    mutations = user_data.get_mutations()

    cosmetics = ewitem.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 = ewcfg.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 = ewcfg.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)

        resp_cont.add_channel_response(channel_name, response)
    else:

        # return somebody's score
        if user_data.life_state == ewcfg.life_state_corpse:
            response = "{} is a level {} deadboi.".format(
                display_name, user_data.slimelevel)
        else:
            response = "{} is a level {} slimeboi.".format(
                display_name, user_data.slimelevel)

        coinbounty = int(user_data.bounty / ewcfg.slimecoin_exchangerate)

        weapon_item = EwItem(id_item=user_data.weapon)
        weapon = ewcfg.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)))

        trauma = ewcfg.weapon_map.get(user_data.trauma)
        # if trauma is not gathered from weapon_map, get it from attack_type_map
        if trauma == None:
            trauma = ewcfg.attack_type_map.get(user_data.trauma)

        if trauma != None:
            response += " {}".format(trauma.str_trauma)

        response_block = ""
        for mutation in mutations:
            mutation_flavor = ewcfg.mutations_map[mutation]
            response_block += "{} ".format(mutation_flavor.str_describe_other)

        if len(response_block) > 0:
            response += "\n\n" + response_block

        resp_cont.add_channel_response(channel_name, response)

        response = ""
        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)

        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'))

        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 = ewcfg.status_effects_def_map.get(status)
                if status_flavor is not None:
                    response_block += status_flavor.str_describe + " "

        if (slimeoid.life_state == ewcfg.slimeoid_state_active) and (
                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 len(response_block) > 0:
            response += "\n" + response_block

        response += "\n\nhttps://ew.krakissi.net/stats/player.html?pl={}".format(
            id_user)

        resp_cont.add_channel_response(channel_name, response)

    return resp_cont
예제 #7
0
async def on_message(message):
	time_now = int(time.time())
	ewcfg.set_client(client)

	""" do not interact with our own messages """
	if message.author.id == client.user.id or message.author.bot == True:
		return

	if message.server != None:
		# Note that the user posted a message.
		active_map = active_users_map.get(message.server.id)
		if active_map == None:
			active_map = {}
			active_users_map[message.server.id] = active_map
		active_map[message.author.id] = True

		# Update player information.
		ewplayer.player_update(
			member = message.author,
			server = message.server
		)

	content_tolower = message.content.lower()
	re_awoo = re.compile('.*![a]+[w]+o[o]+.*')

	# update the player's time_last_action which is used for kicking AFK players out of subzones
	if message.server != None:

		try:
			ewutils.execute_sql_query("UPDATE users SET {time_last_action} = %s WHERE id_user = %s AND id_server = %s".format(
				time_last_action = ewcfg.col_time_last_action
			), (
				int(time.time()),
				message.author.id,
				message.server.id
			))
		except:
			ewutils.logMsg('server {}: failed to update time_last_action for {}'.format(message.server.id, message.author.id))
		
		user_data = EwUser(member = message.author)
		
		statuses = user_data.getStatusEffects()

		if ewcfg.status_strangled_id in statuses:
			strangle_effect = EwStatusEffect(id_status=ewcfg.status_strangled_id, user_data=user_data)
			source = EwPlayer(id_user=strangle_effect.source, id_server=message.server.id)
			response = "You manage to break {}'s garrote wire!".format(source.display_name)
			user_data.clear_status(ewcfg.status_strangled_id)			
			return await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))

	if message.content.startswith(ewcfg.cmd_prefix) or message.server == None or len(message.author.roles) < 2:
		"""
			Wake up if we need to respond to messages. Could be:
				message starts with !
				direct message (server == None)
				user is new/has no roles (len(roles) < 2)
		"""

		#Ignore users with weird characters in their name
		try:
			message.author.display_name[:3].encode('utf-8').decode('ascii')
		except UnicodeError:
			return await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, "We don't take kindly to moon runes around here."))

		# tokenize the message. the command should be the first word.
		try:
			tokens = shlex.split(message.content)  # it's split with shlex now because shlex regards text within quotes as a single token
		except:
			tokens = message.content.split(' ')  # if splitting via shlex doesnt work (odd number of quotes), use the old splitting method so it doesnt give an exception

		tokens_count = len(tokens)
		cmd = tokens[0].lower() if tokens_count >= 1 else ""

		# remove mentions to us
		mentions = list(filter(lambda user : user.id != client.user.id, message.mentions))
		mentions_count = len(mentions)

		# Create command object
		cmd_obj = ewcmd.EwCmd(
			tokens = tokens,
			message = message,
			client = client,
			mentions = mentions
		)

		"""
			Handle direct messages.
		"""
		if message.server == None:
			playermodel = ewplayer.EwPlayer(id_user = message.author.id)
			usermodel = EwUser(id_user=message.author.id, id_server= playermodel.id_server)
			poi = ewcfg.id_to_poi.get(usermodel.poi)
			# Direct message the player their inventory.
			if ewitem.cmd_is_inventory(cmd):
				return await ewitem.inventory_print(cmd_obj)
			elif cmd == ewcfg.cmd_inspect:
				return await ewitem.item_look(cmd_obj)
			elif poi.is_apartment:
				return await ewapt.aptCommands(cmd=cmd_obj)
			else:
				time_last = last_helped_times.get(message.author.id, 0)

				# Only send the help doc once every thirty seconds. There's no need to spam it.
				if (time_now - time_last) > 30:
					last_helped_times[message.author.id] = time_now
					await ewutils.send_message(client, message.channel, ewcfg.generic_help_response)

			# Nothing else to do in a DM.
			return

		# assign the appropriate roles to a user with less than @everyone, faction, location
		if len(message.author.roles) < 3:
			await ewrolemgr.updateRoles(client = client, member = message.author)

		user_data = EwUser(member = message.author)
		if user_data.arrested:
			return

		mutations = user_data.get_mutations()
		# Scold/ignore offline players.
		if message.author.status == discord.Status.offline:

			if ewcfg.mutation_id_chameleonskin not in mutations or cmd not in ewcfg.offline_cmds:

				response = "You cannot participate in the ENDLESS WAR while offline."
    
				return await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))


		if user_data.time_lastoffline > time_now - ewcfg.time_offline:

			if ewcfg.mutation_id_chameleonskin not in mutations or cmd not in ewcfg.offline_cmds:
				response = "You are too paralyzed by ENDLESS WAR's judgemental stare to act."

				return await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))

		# Ignore stunned players
		if ewcfg.status_stunned_id in statuses:
			return

		# Check the main command map for the requested command.
		global cmd_map
		cmd_fn = cmd_map.get(cmd)

		if user_data.poi in ewcfg.tutorial_pois:	
			return await ewdungeons.tutorial_cmd(cmd_obj)

		elif cmd_fn != None:
			# Execute found command
			return await cmd_fn(cmd_obj)

		# FIXME debug
		# Test item creation
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'createtestitem'):
			item_id = ewitem.item_create(
				item_type = 'medal',
				id_user = message.author.id,
				id_server = message.server.id,
				item_props = {
					'medal_name': 'Test Award',
					'medal_desc': '**{medal_name}**: *Awarded to Krak by Krak for testing shit.*'
				}
			)

			ewutils.logMsg('Created item: {}'.format(item_id))
			item = EwItem(id_item = item_id)
			item.item_props['test'] = 'meow'
			item.persist()

			item = EwItem(id_item = item_id)

			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, ewitem.item_look(item)))

		# Creates a poudrin
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'createpoudrin'):
			for item in ewcfg.item_list:
				if item.context == "poudrin":
					ewitem.item_create(
						item_type = ewcfg.it_item,
						id_user = message.author.id,
						id_server = message.server.id,
						item_props = {
							'id_item': item.id_item,
							'context': item.context,
							'item_name': item.str_name,
							'item_desc': item.str_desc,
						}
					),
					ewutils.logMsg('Created item: {}'.format(item.id_item))
					item = EwItem(id_item = item.id_item)
					item.persist()
			else:
				pass

			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, "Poudrin created."))

		# Gives the user some slime
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'getslime'):
			user_data = EwUser(member = message.author)
			user_initial_level = user_data.slimelevel

			response = "You get 100,000 slime!"

			levelup_response = user_data.change_slimes(n = 100000)

			was_levelup = True if user_initial_level < user_data.slimelevel else False

			if was_levelup:
				response += " {}".format(levelup_response)

			user_data.persist()
			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'getcoin'):
			user_data = EwUser(member=message.author)
			user_data.change_slimecoin(n=1000000000, coinsource=ewcfg.coinsource_spending)

			response = "You get 1,000,000,000 slimecoin!"

			user_data.persist()
			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))

		# Deletes all items in your inventory.
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'clearinv'):
			user_data = EwUser(member = message.author)
			ewitem.item_destroyall(id_server = message.server.id, id_user = message.author.id)
			response = "You destroy every single item in your inventory."
			user_data.persist()
			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))

		elif debug == True and cmd == (ewcfg.cmd_prefix + 'createapple'):
			item_id = ewitem.item_create(
				id_user = message.author.id,
				id_server = message.server.id,
				item_type = ewcfg.it_food,
				item_props = {
					'id_food': "direapples",
					'food_name': "Dire Apples",
					'food_desc': "This sure is a illegal Dire Apple!",
					'recover_hunger': 500,
					'str_eat': "You chomp into this illegal Dire Apple.",
					'time_expir': int(time.time() + ewcfg.farm_food_expir)
				}
			)

			ewutils.logMsg('Created item: {}'.format(item_id))
			item = EwItem(id_item = item_id)
			item.item_props['test'] = 'meow'
			item.persist()

			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, "Apple created."))

		elif debug == True and cmd == (ewcfg.cmd_prefix + 'createhat'):
			patrician_rarity = 20
			patrician_smelted = random.randint(1, patrician_rarity)
			patrician = False

			if patrician_smelted == 1:
				patrician = True

			items = []

			for cosmetic in ewcfg.cosmetic_items_list:
				if patrician and cosmetic.rarity == ewcfg.rarity_patrician:
					items.append(cosmetic)
				elif not patrician and cosmetic.rarity == ewcfg.rarity_plebeian:
					items.append(cosmetic)

			item = items[random.randint(0, len(items) - 1)]

			item_id = ewitem.item_create(
				item_type = ewcfg.it_cosmetic,
				id_user = message.author.id,
				id_server = message.server.id,
				item_props = {
					'id_cosmetic': item.id_cosmetic,
					'cosmetic_name': item.str_name,
					'cosmetic_desc': item.str_desc,
					'rarity': item.rarity,
					'adorned': 'false'
				}
			)

			ewutils.logMsg('Created item: {}'.format(item_id))
			item = EwItem(id_item = item_id)
			item.item_props['test'] = 'meow'
			item.persist()

			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, "Hat created."))

		elif debug == True and cmd == (ewcfg.cmd_prefix + 'createfood'):
			item = ewcfg.food_list[random.randint(0, len(ewcfg.food_list) - 1)]

			item_id = ewitem.item_create(
				item_type = ewcfg.it_food,
				id_user = message.author.id,
				id_server = message.server.id,
				item_props = {
					'id_food': item.id_food,
					'food_name': item.str_name,
					'food_desc': item.str_desc,
					'recover_hunger': item.recover_hunger,
					'str_eat': item.str_eat,
					'time_expir': item.time_expir
				}
			)

			ewutils.logMsg('Created item: {}'.format(item_id))
			item = EwItem(id_item = item_id)
			item.item_props['test'] = 'meow'
			item.persist()

			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, "Food created."))

		# FIXME debug
		# Test item deletion
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'delete'):
			items = ewitem.inventory(
				id_user = message.author.id,
				id_server = message.server.id
			)

			for item in items:
				ewitem.item_delete(
					id_item = item.get('id_item')
				)

			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, 'ok'))

		# AWOOOOO
		elif re_awoo.match(cmd):
			return await ewcmd.cmd_howl(cmd_obj)

		# Debug command to override the role of a user
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'setrole'):

			response = ""

			if mentions_count == 0:
				response = 'Set who\'s role?'
			else:
				roles_map = ewutils.getRoleMap(message.server.roles)
				role_target = tokens[1]
				role = roles_map.get(role_target)

				if role != None:
					for user in mentions:
						try:
							await client.replace_roles(user, role)
						except:
							ewutils.logMsg('Failed to replace_roles for user {} with {}.'.format(user.display_name, role.name))

					response = 'Done.'
				else:
					response = 'Unrecognized role.'

			await ewutils.send_message(client, cmd.message.channel, ewutils.formatMessage(message.author, response))
			
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'getrowdy'):
			response = "You get rowdy. F**k. YES!"
			user_data = EwUser(member=message.author)
			user_data.life_state = ewcfg.life_state_enlisted
			user_data.faction = ewcfg.faction_rowdys
			user_data.time_lastenlist = time_now + ewcfg.cd_enlist
			user_data.persist()
			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))
		
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'getkiller'):
			response = "You uh... 'get' killer. Sure."
			user_data = EwUser(member=message.author)
			user_data.life_state = ewcfg.life_state_enlisted
			user_data.faction = ewcfg.faction_killers
			user_data.time_lastenlist = time_now + ewcfg.cd_enlist
			user_data.persist()
			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))
			
		# Toggles rain on and off
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'toggledownfall'):
			market_data = EwMarket(id_server=message.server.id)
			
			if market_data.weather == ewcfg.weather_bicarbonaterain:
				newweather = ewcfg.weather_sunny
				
				market_data.weather = newweather
				response = "Bicarbonate rain turned OFF. Weather was set to {}.".format(newweather)
			else:
				market_data.weather = ewcfg.weather_bicarbonaterain
				response = "Bicarbonate rain turned ON."
				
			market_data.persist()
			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))

		elif debug == True and cmd == (ewcfg.cmd_prefix + 'dayforward'):
			market_data = EwMarket(id_server=message.server.id)

			market_data.day += 1
			market_data.persist()

			response = "Time has progressed 1 day forward manually."
			
			if ewutils.check_fursuit_active(market_data.id_server):
				response += "\nIt's a full moon!"
				
			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))
			
		elif debug == True and cmd == (ewcfg.cmd_prefix + 'hourforward'):
			market_data = EwMarket(id_server=message.server.id)
			
			market_data.clock += 1
			response = "Time has progressed 1 hour forward manually."

			if market_data.clock >= 24 or market_data.clock < 0:
				market_data.clock = 0
				market_data.day += 1
				response += "\nMidnight has come. 1 day progressed forward."
				
			if ewutils.check_fursuit_active(market_data.id_server):
				response += "\nIt's a full moon!"
				
			market_data.persist()
			await ewutils.send_message(client, message.channel, ewutils.formatMessage(message.author, response))
			
			
		# didn't match any of the command words.
		else:
			""" couldn't process the command. bail out!! """
			""" bot rule 0: be cute """
			randint = random.randint(1,3)
			msg_mistake = "ENDLESS WAR is growing frustrated."
			if randint == 2:
				msg_mistake = "ENDLESS WAR denies you his favor."
			elif randint == 3:
				msg_mistake = "ENDLESS WAR pays you no mind."

			msg = await ewutils.send_message(client, cmd_obj.message.channel, msg_mistake)
			await asyncio.sleep(2)
			try:
				await client.delete_message(msg)
			except:
				pass

	elif content_tolower.find(ewcfg.cmd_howl) >= 0 or content_tolower.find(ewcfg.cmd_howl_alt1) >= 0 or re_awoo.match(content_tolower):
		""" Howl if !howl is in the message at all. """
		return await ewcmd.cmd_howl(ewcmd.EwCmd(
			message = message,
			client = client
		))