Browse Source

Remove dupe directory

Devn00b 1 year ago
parent
commit
82a280bdec

+ 0 - 1
EQ2EMu/DB/updates/mood_command_may_2022.sql

@@ -1 +0,0 @@
-UPDATE commands SET handler='800' WHERE  id=32;

+ 0 - 11596
EQ2EMu/EQ2/source/WorldServer/Commands/Commands.cpp

@@ -1,11596 +0,0 @@
-/*  
-EQ2Emulator:  Everquest II Server Emulator
-Copyright (C) 2007  EQ2EMulator Development Team (http://www.eq2emulator.net)
-
-This file is part of EQ2Emulator.
-
-EQ2Emulator is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-EQ2Emulator is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with EQ2Emulator.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#include <sys/types.h>
-#include "Commands.h"
-#include "../ClientPacketFunctions.h"
-#include "../../common/version.h"
-#include "../../common/seperator.h"
-#include "../../common/servertalk.h"
-#include "../WorldDatabase.h"
-#include "../World.h"
-#include "../../common/ConfigReader.h"
-#include "../VisualStates.h"
-#include "../../common/debug.h"
-#include "../LuaInterface.h"
-#include "../Quests.h"
-#include "../client.h"
-#include "../NPC.h"
-#include "../Guilds/Guild.h"
-#include "../SpellProcess.h"
-#include "../Tradeskills/Tradeskills.h"
-#include "../../common/Log.h"
-#include "../../common/MiscFunctions.h"
-#include "../Languages.h"
-#include "../IRC/IRC.h"
-#include "../Traits/Traits.h"
-#include "../Chat/Chat.h"
-#include "../Rules/Rules.h"
-#include "../AltAdvancement/AltAdvancement.h"
-#include "../RaceTypes/RaceTypes.h"
-#include "../classes.h"
-#include "../Transmute.h"
-#include "../Bots/Bot.h"
-
-extern WorldDatabase database;
-extern MasterSpellList master_spell_list;
-extern MasterTraitList master_trait_list;
-extern MasterRecipeList master_recipe_list;
-extern MasterRecipeBookList master_recipebook_list;
-extern World world;
-extern ClientList client_list;
-extern ConfigReader configReader;
-extern VisualStates visual_states;
-extern ZoneList	zone_list;
-extern LuaInterface* lua_interface;
-extern MasterQuestList master_quest_list;
-extern MasterCollectionList master_collection_list;
-extern MasterSkillList master_skill_list;
-extern MasterFactionList master_faction_list;
-extern GuildList guild_list;
-extern MasterLanguagesList master_languages_list;
-extern IRC irc;
-extern Chat chat;
-extern RuleManager rule_manager;
-extern MasterAAList master_aa_list;
-extern MasterRaceTypeList race_types_list;
-extern Classes classes;
-
-//devn00b: Fix for linux builds since we dont use stricmp we use strcasecmp
-#if defined(__GNUC__)
-#define stricmp strcasecmp
-#define strnicmp strncasecmp
-#endif
-
-
-EQ2Packet* RemoteCommands::serialize(){
-	buffer.clear();
-	vector<EQ2_RemoteCommandString>::iterator command_list;
-	buffer.append((char*)&num_commands, sizeof(int16));
-	for( command_list = commands.begin(); command_list != commands.end(); command_list++ ) {
-		AddDataCommand(&(*command_list));
-	}
-	EQ2Packet* app = new EQ2Packet(OP_SetRemoteCmdsMsg, (uchar*)buffer.c_str(), buffer.length() + 1);
-	return app;
-}
-
-Commands::Commands(){ 
-	remote_commands = new RemoteCommands(); 
-	spawn_set_values["list"] = SPAWN_SET_VALUE_LIST;
-	spawn_set_values["name"] = SPAWN_SET_VALUE_NAME;
-	spawn_set_values["level"] = SPAWN_SET_VALUE_LEVEL;	// TODO: Fix this, min_level, max_level
-	spawn_set_values["difficulty"] = SPAWN_SET_VALUE_DIFFICULTY;
-	spawn_set_values["model_type"] = SPAWN_SET_VALUE_MODEL_TYPE;
-	spawn_set_values["class"] = SPAWN_SET_VALUE_CLASS;
-	spawn_set_values["gender"] = SPAWN_SET_VALUE_GENDER;
-	spawn_set_values["show_name"] = SPAWN_SET_VALUE_SHOW_NAME;
-	spawn_set_values["attackable"] = SPAWN_SET_VALUE_ATTACKABLE;
-	spawn_set_values["show_level"] = SPAWN_SET_VALUE_SHOW_LEVEL;
-	spawn_set_values["targetable"] = SPAWN_SET_VALUE_TARGETABLE;
-	spawn_set_values["show_command_icon"] = SPAWN_SET_VALUE_SHOW_COMMAND_ICON;
-	spawn_set_values["display_hand_icon"] = SPAWN_SET_VALUE_HAND_ICON;
-	spawn_set_values["hair_type"] = SPAWN_SET_VALUE_HAIR_TYPE;
-	spawn_set_values["facial_hair_type"] = SPAWN_SET_VALUE_FACIAL_HAIR_TYPE;
-	spawn_set_values["wing_type"] = SPAWN_SET_VALUE_WING_TYPE;
-	spawn_set_values["chest_type"] = SPAWN_SET_VALUE_CHEST_TYPE;
-	spawn_set_values["legs_type"] = SPAWN_SET_VALUE_LEGS_TYPE;
-	spawn_set_values["soga_hair_type"] = SPAWN_SET_VALUE_SOGA_HAIR_TYPE;
-	spawn_set_values["soga_facial_hair_type"] = SPAWN_SET_VALUE_SOGA_FACIAL_HAIR_TYPE;
-	spawn_set_values["soga_model_type"] = SPAWN_SET_VALUE_SOGA_MODEL_TYPE;
-	spawn_set_values["size"] = SPAWN_SET_VALUE_SIZE;
-	spawn_set_values["hp"] = SPAWN_SET_VALUE_HP;
-	spawn_set_values["power"] = SPAWN_SET_VALUE_POWER;
-	spawn_set_values["heroic"] = SPAWN_SET_VALUE_HEROIC;
-	spawn_set_values["respawn"] = SPAWN_SET_VALUE_RESPAWN;
-	spawn_set_values["x"] = SPAWN_SET_VALUE_X;
-	spawn_set_values["y"] = SPAWN_SET_VALUE_Y;
-	spawn_set_values["z"] = SPAWN_SET_VALUE_Z;
-	spawn_set_values["heading"] = SPAWN_SET_VALUE_HEADING;
-	spawn_set_values["location"] = SPAWN_SET_VALUE_LOCATION;
-	spawn_set_values["command_primary"] = SPAWN_SET_VALUE_COMMAND_PRIMARY;
-	spawn_set_values["command_secondary"] = SPAWN_SET_VALUE_COMMAND_SECONDARY;
-	spawn_set_values["visual_state"] = SPAWN_SET_VALUE_VISUAL_STATE;
-	spawn_set_values["action_state"] = SPAWN_SET_VALUE_ACTION_STATE;
-	spawn_set_values["mood_state"] = SPAWN_SET_VALUE_MOOD_STATE;
-	spawn_set_values["initial_state"] = SPAWN_SET_VALUE_INITIAL_STATE;
-	spawn_set_values["activity_state"] = SPAWN_SET_VALUE_ACTIVITY_STATE;
-	spawn_set_values["collision_radius"] = SPAWN_SET_VALUE_COLLISION_RADIUS;
-	spawn_set_values["faction"] = SPAWN_SET_VALUE_FACTION;
-	spawn_set_values["spawn_script"] = SPAWN_SET_VALUE_SPAWN_SCRIPT;
-	spawn_set_values["spawnentry_script"] = SPAWN_SET_VALUE_SPAWNENTRY_SCRIPT;
-	spawn_set_values["spawnlocation_script"] = SPAWN_SET_VALUE_SPAWNLOCATION_SCRIPT;
-	spawn_set_values["sub_title"] = SPAWN_SET_VALUE_SUB_TITLE;
-	spawn_set_values["expire"] = SPAWN_SET_VALUE_EXPIRE;
-	spawn_set_values["expire_offset"] = SPAWN_SET_VALUE_EXPIRE_OFFSET;
-	spawn_set_values["x_offset"] = SPAWN_SET_VALUE_X_OFFSET;
-	spawn_set_values["y_offset"] = SPAWN_SET_VALUE_Y_OFFSET;
-	spawn_set_values["z_offset"] = SPAWN_SET_VALUE_Z_OFFSET;
-	spawn_set_values["device_id"] = SPAWN_SET_VALUE_DEVICE_ID;
-	spawn_set_values["pitch"] = SPAWN_SET_VALUE_PITCH;
-	spawn_set_values["roll"] = SPAWN_SET_VALUE_ROLL;
-	spawn_set_values["hide_hood"] = SPAWN_SET_VALUE_HIDE_HOOD;
-	spawn_set_values["emote_state"] = SPAWN_SET_VALUE_EMOTE_STATE;
-	spawn_set_values["icon"] = SPAWN_SET_VALUE_ICON;
-	spawn_set_values["prefix"] = SPAWN_SET_VALUE_PREFIX;
-	spawn_set_values["suffix"] = SPAWN_SET_VALUE_SUFFIX;
-	spawn_set_values["lastname"] = SPAWN_SET_VALUE_LASTNAME;
-	spawn_set_values["expansion_flag"] = SPAWN_SET_VALUE_EXPANSION_FLAG;
-	spawn_set_values["holiday_flag"] = SPAWN_SET_VALUE_HOLIDAY_FLAG;
-	spawn_set_values["merchant_min_level"] = SPAWN_SET_VALUE_MERCHANT_MIN_LEVEL;
-	spawn_set_values["merchant_max_level"] = SPAWN_SET_VALUE_MERCHANT_MAX_LEVEL;
-	spawn_set_values["skin_color"] = SPAWN_SET_SKIN_COLOR;
-	spawn_set_values["aaxp_rewards"] = SPAWN_SET_AAXP_REWARDS;
-	
-	spawn_set_values["hair_color1"] = SPAWN_SET_HAIR_COLOR1;
-	spawn_set_values["hair_color2"] = SPAWN_SET_HAIR_COLOR2;
-	spawn_set_values["hair_type_color"] = SPAWN_SET_HAIR_TYPE_COLOR;
-	spawn_set_values["hair_face_color"] = SPAWN_SET_HAIR_FACE_COLOR;
-	spawn_set_values["hair_type_highlight_color"] = SPAWN_SET_HAIR_TYPE_HIGHLIGHT_COLOR;
-	spawn_set_values["face_hairlight_color"] = SPAWN_SET_HAIR_FACE_HIGHLIGHT_COLOR;
-	spawn_set_values["hair_highlight"] = SPAWN_SET_HAIR_HIGHLIGHT;
-	spawn_set_values["model_color"] = SPAWN_SET_MODEL_COLOR;
-	spawn_set_values["eye_color"] = SPAWN_SET_EYE_COLOR;
-	
-	spawn_set_values["soga_skin_color"] = SPAWN_SET_SOGA_SKIN_COLOR;
-	spawn_set_values["soga_hair_color1"] = SPAWN_SET_SOGA_HAIR_COLOR1;
-	spawn_set_values["soga_hair_color2"] = SPAWN_SET_SOGA_HAIR_COLOR2;
-	spawn_set_values["soga_hair_type_color"] = SPAWN_SET_SOGA_HAIR_TYPE_COLOR;
-	spawn_set_values["soga_hair_face_color"] = SPAWN_SET_SOGA_HAIR_FACE_COLOR;
-	spawn_set_values["soga_hair_type_highlight_color"] = SPAWN_SET_SOGA_HAIR_TYPE_HIGHLIGHT_COLOR;
-	spawn_set_values["soga_face_hairlight_color"] = SPAWN_SET_SOGA_HAIR_FACE_HIGHLIGHT_COLOR;
-	spawn_set_values["soga_hair_highlight"] = SPAWN_SET_SOGA_HAIR_HIGHLIGHT;
-	spawn_set_values["soga_model_color"] = SPAWN_SET_SOGA_MODEL_COLOR;
-	spawn_set_values["soga_eye_color"] = SPAWN_SET_SOGA_EYE_COLOR;
-	
-	spawn_set_values["cheek_type"] = SPAWN_SET_CHEEK_TYPE;
-	spawn_set_values["chin_type"] = SPAWN_SET_CHIN_TYPE;
-	spawn_set_values["ear_type"] = SPAWN_SET_EAR_TYPE;
-	spawn_set_values["eye_brow_type"] = SPAWN_SET_EYE_BROW_TYPE;
-	spawn_set_values["eye_type"] = SPAWN_SET_EYE_TYPE;
-	spawn_set_values["lip_type"] = SPAWN_SET_LIP_TYPE;
-	spawn_set_values["nose_type"] = SPAWN_SET_NOSE_TYPE;
-	spawn_set_values["body_size"] = SPAWN_SET_BODY_SIZE;
-	spawn_set_values["body_age"] = SPAWN_SET_BODY_AGE;
-	spawn_set_values["soga_cheek_type"] = SPAWN_SET_SOGA_CHEEK_TYPE;
-	spawn_set_values["soga_chin_type"] = SPAWN_SET_SOGA_CHIN_TYPE;
-	spawn_set_values["soga_ear_type"] = SPAWN_SET_SOGA_EAR_TYPE;
-	spawn_set_values["soga_eye_brow_type"] = SPAWN_SET_SOGA_EYE_BROW_TYPE;
-	spawn_set_values["soga_eye_type"] = SPAWN_SET_SOGA_EYE_TYPE;
-	spawn_set_values["soga_lip_type"] = SPAWN_SET_SOGA_LIP_TYPE;
-	spawn_set_values["soga_nose_type"] = SPAWN_SET_SOGA_NOSE_TYPE;
-	spawn_set_values["soga_body_size"] = SPAWN_SET_SOGA_BODY_SIZE;
-	spawn_set_values["soga_body_age"] = SPAWN_SET_SOGA_BODY_AGE;
-
-	zone_set_values["expansion_id"] = ZONE_SET_VALUE_EXPANSION_ID;
-	zone_set_values["name"] = ZONE_SET_VALUE_NAME;
-	zone_set_values["file"] = ZONE_SET_VALUE_FILE	;
-	zone_set_values["description"] = ZONE_SET_VALUE_DESCRIPTION;
-	zone_set_values["safe_x"] = ZONE_SET_VALUE_SAFE_X;
-	zone_set_values["safe_y"] = ZONE_SET_VALUE_SAFE_Y;
-	zone_set_values["safe_z"] = ZONE_SET_VALUE_SAFE_Z;
-	zone_set_values["underworld"] = ZONE_SET_VALUE_UNDERWORLD;
-	zone_set_values["min_recommended"] = ZONE_SET_VALUE_MIN_RECOMMENDED;
-	zone_set_values["max_recommended"] = ZONE_SET_VALUE_MAX_RECOMMENDED;
-	zone_set_values["zone_type"] = ZONE_SET_VALUE_ZONE_TYPE;
-	zone_set_values["always_loaded"] = ZONE_SET_VALUE_ALWAYS_LOADED;
-	zone_set_values["city_zone"] = ZONE_SET_VALUE_CITY_ZONE;
-	zone_set_values["weather_allowed"] = ZONE_SET_VALUE_WEATHER_ALLOWED;
-	zone_set_values["min_status"] = ZONE_SET_VALUE_MIN_STATUS;
-	zone_set_values["min_level"] = ZONE_SET_VALUE_MIN_LEVEL;
-	zone_set_values["start_zone"] = ZONE_SET_VALUE_START_ZONE;
-	zone_set_values["instance_type"] = ZONE_SET_VALUE_INSTANCE_TYPE;
-	zone_set_values["default_reenter_time"] = ZONE_SET_VALUE_DEFAULT_REENTER_TIME;
-	zone_set_values["default_reset_time"] = ZONE_SET_VALUE_DEFAULT_RESET_TIME;
-	zone_set_values["default_lockout_time"] = ZONE_SET_VALUE_DEFAULT_LOCKOUT_TIME;
-	zone_set_values["force_group_to_zone"] = ZONE_SET_VALUE_FORCE_GROUP_TO_ZONE;
-	zone_set_values["lua_script"] = ZONE_SET_VALUE_LUA_SCRIPT;
-	zone_set_values["shutdown_timer"] = ZONE_SET_VALUE_SHUTDOWN_TIMER;
-	zone_set_values["zone_motd"] = ZONE_SET_VALUE_ZONE_MOTD;
-}
-
-Commands::~Commands() { 
-	safe_delete(remote_commands); 
-}
-
-int32 Commands::GetSpawnSetType(string val){
-	if(spawn_set_values.count(val) > 0)
-		return spawn_set_values[val];
-	return 0xFFFFFFFF;
-}
-
-bool Commands::SetSpawnCommand(Client* client, Spawn* target, int8 type, const char* value, bool send_update, bool temporary, string* temp_value, int8 index){
-	if(!target)
-		return false;
-	int32 val = 0;
-	try{
-		if(type != SPAWN_SET_VALUE_NAME && 
-			!(type >= SPAWN_SET_VALUE_SPAWN_SCRIPT && type <= SPAWN_SET_VALUE_SUB_TITLE) && !(type >= SPAWN_SET_VALUE_PREFIX && type <= SPAWN_SET_VALUE_EXPANSION_FLAG || type == SPAWN_SET_VALUE_HOLIDAY_FLAG))
-			{
-				switch(type)
-				{
-					case SPAWN_SET_SKIN_COLOR:
-					case SPAWN_SET_HAIR_COLOR1:
-					case SPAWN_SET_HAIR_COLOR2:
-					case SPAWN_SET_HAIR_TYPE_COLOR:
-					case SPAWN_SET_HAIR_FACE_COLOR:
-					case SPAWN_SET_HAIR_TYPE_HIGHLIGHT_COLOR:
-					case SPAWN_SET_HAIR_FACE_HIGHLIGHT_COLOR:
-					case SPAWN_SET_HAIR_HIGHLIGHT:
-					case SPAWN_SET_EYE_COLOR:
-					case SPAWN_SET_SOGA_SKIN_COLOR:
-					case SPAWN_SET_SOGA_HAIR_COLOR1:
-					case SPAWN_SET_SOGA_HAIR_COLOR2:
-					case SPAWN_SET_SOGA_HAIR_TYPE_COLOR:
-					case SPAWN_SET_SOGA_HAIR_FACE_COLOR:
-					case SPAWN_SET_SOGA_HAIR_TYPE_HIGHLIGHT_COLOR:
-					case SPAWN_SET_SOGA_HAIR_FACE_HIGHLIGHT_COLOR:
-					case SPAWN_SET_SOGA_HAIR_HIGHLIGHT:
-					case SPAWN_SET_SOGA_EYE_COLOR:
-					// ignore these are colors can't pass as a integer value
-						break;
-					default:
-						val = atoul(value);
-				}
-			}
-	}
-	catch(...){
-		if(client)
-			client->Message(CHANNEL_COLOR_RED, "Invalid numeric spawn value: %s", value);
-		return false;
-	}
-	if(temporary){
-		char tmp[128] = {0};
-		switch(type){
-			case SPAWN_SET_VALUE_NAME:{
-				sprintf(tmp, "%s", target->GetName());
-				target->SetName(value);
-				if(target->GetZone())
-					target->GetZone()->SendUpdateTitles(target);
-				break;
-									  }
-			case SPAWN_SET_VALUE_X_OFFSET: 
-				{
-				sprintf(tmp, "%f", target->GetXOffset());
-				target->SetXOffset(float(val));
-				break;
-				}
-			case SPAWN_SET_VALUE_Y_OFFSET: 
-				{
-				sprintf(tmp, "%f", target->GetYOffset());
-				target->SetYOffset(float(val));
-				break;
-				}
-			case SPAWN_SET_VALUE_Z_OFFSET: 
-				{
-				sprintf(tmp, "%f", target->GetZOffset());
-				target->SetZOffset(float(val));
-				break;
-				}
-			case SPAWN_SET_VALUE_EXPIRE: {
-				sprintf(tmp, "%u", target->GetExpireTime());
-				target->SetExpireTime(val);
-				break;
-											}
-			case SPAWN_SET_VALUE_EXPIRE_OFFSET: {
-				sprintf(tmp, "%u", target->GetExpireOffsetTime());
-				target->SetExpireOffsetTime(val);
-				break;
-											}
-			case SPAWN_SET_VALUE_SUB_TITLE: {
-				sprintf(tmp, "%s", target->GetSubTitle());
-				target->SetSubTitle(value);
-				if(target->GetZone())
-					target->GetZone()->SendUpdateTitles(target);
-				break;
-											}
-			case SPAWN_SET_VALUE_LEVEL:{
-				sprintf(tmp, "%i", target->GetLevel());
-				target->SetLevel(val, send_update);
-				break;
-									   }
-			case SPAWN_SET_VALUE_DIFFICULTY:{
-				sprintf(tmp, "%i", target->GetEncounterLevel());
-				target->SetEncounterLevel(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_MODEL_TYPE:{
-				sprintf(tmp, "%i", target->GetModelType());
-				target->SetModelType(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_CLASS:{
-				sprintf(tmp, "%i", target->GetAdventureClass());
-				target->SetAdventureClass(val, send_update);
-				break;
-									   }
-			case SPAWN_SET_VALUE_GENDER:{
-				sprintf(tmp, "%i", target->GetGender());
-				target->SetGender(val, send_update);
-				break;
-										}
-			case SPAWN_SET_VALUE_SHOW_NAME:{
-				sprintf(tmp, "%i", target->GetShowName());
-				target->SetShowName(val, send_update);
-				break;
-										   }
-			case SPAWN_SET_VALUE_ATTACKABLE:{
-				sprintf(tmp, "%i", target->GetAttackable());
-				target->SetAttackable(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_SHOW_LEVEL:{
-				sprintf(tmp, "%i", target->GetShowLevel());
-				target->SetShowLevel(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_TARGETABLE:{
-				sprintf(tmp, "%i", target->GetTargetable());
-				target->SetTargetable(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_SHOW_COMMAND_ICON:{
-				sprintf(tmp, "%i", target->GetShowCommandIcon());
-				target->SetShowCommandIcon(val, send_update);
-				break;
-												   }
-			case SPAWN_SET_VALUE_HAND_ICON:{
-				sprintf(tmp, "%i", target->GetShowHandIcon());
-				target->SetShowHandIcon(val, send_update);
-				break;
-										   }
-			case SPAWN_SET_VALUE_HAIR_TYPE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->GetHairType());
-					((Entity*)target)->SetHairType(val, send_update);
-				}
-				break;
-										   }
-			case SPAWN_SET_VALUE_FACIAL_HAIR_TYPE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->GetFacialHairType());
-					((Entity*)target)->SetFacialHairType(val, send_update);
-				}
-				break;
-												  }
-			case SPAWN_SET_VALUE_WING_TYPE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->GetWingType());
-					((Entity*)target)->SetWingType(val, send_update);
-				}
-				break;
-										   }
-			case SPAWN_SET_VALUE_CHEST_TYPE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->GetChestType());
-					((Entity*)target)->SetChestType(val, send_update);
-				}
-				break;
-											}
-			case SPAWN_SET_VALUE_LEGS_TYPE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->GetLegsType());
-					((Entity*)target)->SetLegsType(val, send_update);
-				}
-				break;
-										   }
-			case SPAWN_SET_VALUE_SOGA_HAIR_TYPE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->GetSogaHairType());
-					((Entity*)target)->SetSogaHairType(val, send_update);
-				}
-				break;
-												}
-			case SPAWN_SET_VALUE_SOGA_FACIAL_HAIR_TYPE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->GetSogaFacialHairType());
-					((Entity*)target)->SetSogaFacialHairType(val, send_update);
-				}
-				break;
-													   }
-			case SPAWN_SET_VALUE_SOGA_MODEL_TYPE:{
-				sprintf(tmp, "%i", target->GetSogaModelType());
-				target->SetSogaModelType(val, send_update);
-				break;
-												 }
-			case SPAWN_SET_VALUE_SIZE:{
-				sprintf(tmp, "%i", target->GetSize());
-				target->SetSize(val, send_update);
-				break;
-									  }
-			case SPAWN_SET_VALUE_HP:{
-				sprintf(tmp, "%i", target->GetHP());
-				target->SetHP(val, send_update);
-				break;
-									}
-			case SPAWN_SET_VALUE_POWER:{
-				sprintf(tmp, "%i", target->GetPower());
-				target->SetPower(val, send_update);
-				break;
-									   }
-			case SPAWN_SET_VALUE_HEROIC:{
-				sprintf(tmp, "%i", target->GetHeroic());
-				target->SetHeroic(val, send_update);
-				break;
-										}
-			case SPAWN_SET_VALUE_RESPAWN:{
-				sprintf(tmp, "%u", target->GetRespawnTime());
-				target->SetRespawnTime(val);
-				break;
-										 }
-			case SPAWN_SET_VALUE_X:{
-				sprintf(tmp, "%f", target->GetX());
-				target->SetX(atof(value), send_update);
-				break;
-								   }
-			case SPAWN_SET_VALUE_Y:{
-				sprintf(tmp, "%f", target->GetY());
-				target->SetY(atof(value), send_update);
-				break;
-								   }
-			case SPAWN_SET_VALUE_Z:{
-				sprintf(tmp, "%f", target->GetZ());
-				target->SetZ(atof(value), send_update);
-				break;
-								   }
-			case SPAWN_SET_VALUE_HEADING:{
-				sprintf(tmp, "%f", target->GetHeading());
-				target->SetHeading(atof(value) + 360, send_update);
-				break;
-										 }
-			case SPAWN_SET_VALUE_VISUAL_STATE:{
-				sprintf(tmp, "%i", target->GetVisualState());
-				target->SetVisualState(val, send_update);
-				break;
-											  }
-			case SPAWN_SET_VALUE_ACTION_STATE:{
-				sprintf(tmp, "%i", target->GetActionState());
-				target->SetActionState(val, send_update);
-				break;
-											  }
-			case SPAWN_SET_VALUE_MOOD_STATE:{
-				sprintf(tmp, "%i", target->GetMoodState());
-				target->SetMoodState(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_INITIAL_STATE:{
-				sprintf(tmp, "%i", target->GetInitialState());
-				target->SetInitialState(val, send_update);
-				break;
-											   }
-			case SPAWN_SET_VALUE_ACTIVITY_STATE:{
-				sprintf(tmp, "%i", target->GetActivityStatus());
-				target->SetActivityStatus(val, send_update);
-				break;
-												}
-			case SPAWN_SET_VALUE_COLLISION_RADIUS:{
-				sprintf(tmp, "%i", target->GetCollisionRadius());
-				target->SetCollisionRadius(val, send_update);
-				break;
-												  }
-			case SPAWN_SET_VALUE_DEVICE_ID: {
-				if (target->IsObject()) {
-					sprintf(tmp, "%i", ((Object*)target)->GetDeviceID());
-					((Object*)target)->SetDeviceID(val);
-				}
-				break;
-											}
-			case SPAWN_SET_VALUE_PITCH: {
-				sprintf(tmp, "%f", target->GetPitch());
-				target->SetPitch(atof(value), send_update);
-				break;
-										}
-			case SPAWN_SET_VALUE_ROLL: {
-				sprintf(tmp, "%f", target->GetRoll());
-				target->SetRoll(atof(value), send_update);
-				break;
-									   }
-			case SPAWN_SET_VALUE_HIDE_HOOD: {
-				sprintf(tmp, "%i", target->appearance.hide_hood);
-				target->SetHideHood(val);
-				break;
-											}
-			case SPAWN_SET_VALUE_EMOTE_STATE: {
-				sprintf(tmp, "%i", target->appearance.emote_state);
-				target->SetEmoteState(val);
-				break;
-											  }
-			case SPAWN_SET_VALUE_ICON: {
-			    sprintf(tmp, "%i", target->GetIconValue());
-			    target->SetIcon(val);
-			    break;
-			}
-
-			case SPAWN_SET_VALUE_PREFIX: {
-				sprintf(tmp, "%s", target->GetPrefixTitle());
-				target->SetPrefixTitle(value);
-				if(target->GetZone())
-					target->GetZone()->SendUpdateTitles(target);
-				break;
-			}
-
-			case SPAWN_SET_VALUE_SUFFIX: {
-				sprintf(tmp, "%s", target->GetSuffixTitle());
-				target->SetSuffixTitle(value);
-				if(target->GetZone())
-					target->GetZone()->SendUpdateTitles(target);
-				break;
-			}
-
-			case SPAWN_SET_VALUE_LASTNAME: {
-				sprintf(tmp, "%s", target->GetLastName());
-				target->SetLastName(value);
-				if(target->GetZone())
-					target->GetZone()->SendUpdateTitles(target);
-				break;
-			}
-			case SPAWN_SET_VALUE_EXPANSION_FLAG:
-			case SPAWN_SET_VALUE_HOLIDAY_FLAG: {
-				// nothing to do must reload spawns
-				break;
-			}
-			case SPAWN_SET_VALUE_MERCHANT_MIN_LEVEL: {
-				sprintf(tmp, "%i", target->GetMerchantMinLevel());
-				target->SetMerchantLevelRange(atoul(value), target->GetMerchantMaxLevel());
-				break;
-			}
-			case SPAWN_SET_VALUE_MERCHANT_MAX_LEVEL: {
-				sprintf(tmp, "%i", target->GetMerchantMaxLevel());
-				target->SetMerchantLevelRange(target->GetMerchantMinLevel(), atoul(value));
-				break;
-			}
-			case SPAWN_SET_VALUE_FACTION:{
-				sprintf(tmp, "%i", target->faction_id);
-				ZoneServer* zone = target->GetZone();
-				if (!zone && client)
-					zone = client->GetCurrentZone();
-
-				target->faction_id = atoul(value);
-				if(zone)
-				{
-					zone->RemoveDeadEnemyList(target);
-					if(target->IsNPC())
-						zone->AddEnemyList((NPC*)target);
-				}
-				break;
-			}
-			case SPAWN_SET_SKIN_COLOR:
-			case SPAWN_SET_HAIR_COLOR1:
-			case SPAWN_SET_HAIR_COLOR2:
-			case SPAWN_SET_HAIR_TYPE_COLOR:
-			case SPAWN_SET_HAIR_FACE_COLOR:
-			case SPAWN_SET_HAIR_TYPE_HIGHLIGHT_COLOR:
-			case SPAWN_SET_HAIR_FACE_HIGHLIGHT_COLOR:
-			case SPAWN_SET_HAIR_HIGHLIGHT:
-			case SPAWN_SET_MODEL_COLOR:
-			case SPAWN_SET_EYE_COLOR:
-			case SPAWN_SET_SOGA_SKIN_COLOR:
-			case SPAWN_SET_SOGA_HAIR_COLOR1:
-			case SPAWN_SET_SOGA_HAIR_COLOR2:
-			case SPAWN_SET_SOGA_HAIR_TYPE_COLOR:
-			case SPAWN_SET_SOGA_HAIR_FACE_COLOR:
-			case SPAWN_SET_SOGA_HAIR_TYPE_HIGHLIGHT_COLOR:
-			case SPAWN_SET_SOGA_HAIR_FACE_HIGHLIGHT_COLOR:
-			case SPAWN_SET_SOGA_HAIR_HIGHLIGHT:
-			case SPAWN_SET_SOGA_MODEL_COLOR:
-			case SPAWN_SET_SOGA_EYE_COLOR:
-					{
-				if (target->IsEntity())
-				{
-					Seperator* skinsep = new Seperator(value, ' ', 3, 500, true);
-					if (skinsep->IsNumber(0) && skinsep->IsNumber(1) && skinsep->IsNumber(2))
-					{
-						EQ2_Color clr;
-						clr.red = atoul(skinsep->arg[0]);
-						clr.green = atoul(skinsep->arg[1]);
-						clr.blue = atoul(skinsep->arg[2]);
-
-						switch(type)
-						{
-							case SPAWN_SET_SKIN_COLOR:
-								((Entity*)target)->SetSkinColor(clr);
-							break;
-							case SPAWN_SET_HAIR_COLOR1:
-								((Entity*)target)->SetHairColor1(clr);
-							break;
-							case SPAWN_SET_HAIR_COLOR2:
-								((Entity*)target)->SetHairColor2(clr);
-							break;
-							case SPAWN_SET_HAIR_TYPE_COLOR:
-								((Entity*)target)->SetHairColor(clr);
-							break;
-							case SPAWN_SET_HAIR_FACE_COLOR:
-								((Entity*)target)->SetFacialHairColor(clr);
-							break;
-							case SPAWN_SET_HAIR_TYPE_HIGHLIGHT_COLOR:
-								((Entity*)target)->SetHairTypeHighlightColor(clr);
-							break;
-							case SPAWN_SET_HAIR_FACE_HIGHLIGHT_COLOR:
-								((Entity*)target)->SetFacialHairHighlightColor(clr);
-							break;
-							case SPAWN_SET_HAIR_HIGHLIGHT:
-								((Entity*)target)->SetHairHighlightColor(clr);
-							break;
-							case SPAWN_SET_MODEL_COLOR:
-								((Entity*)target)->SetModelColor(clr);
-							break;
-							case SPAWN_SET_EYE_COLOR:
-								((Entity*)target)->SetEyeColor(clr);
-							break;
-							case SPAWN_SET_SOGA_SKIN_COLOR:
-								((Entity*)target)->SetSogaSkinColor(clr);
-							break;
-							case SPAWN_SET_SOGA_HAIR_COLOR1:
-								((Entity*)target)->SetSogaHairColor1(clr);
-							break;
-							case SPAWN_SET_SOGA_HAIR_COLOR2:
-								((Entity*)target)->SetSogaHairColor2(clr);
-							break;
-							case SPAWN_SET_SOGA_HAIR_TYPE_COLOR:
-								((Entity*)target)->SetSogaHairColor(clr);
-							break;
-							case SPAWN_SET_SOGA_HAIR_FACE_COLOR:
-								((Entity*)target)->SetSogaFacialHairColor(clr);
-							break;
-							case SPAWN_SET_SOGA_HAIR_TYPE_HIGHLIGHT_COLOR:
-								((Entity*)target)->SetSogaHairTypeHighlightColor(clr);
-							break;
-							case SPAWN_SET_SOGA_HAIR_FACE_HIGHLIGHT_COLOR:
-								((Entity*)target)->SetSogaFacialHairHighlightColor(clr);
-							break;
-							case SPAWN_SET_SOGA_HAIR_HIGHLIGHT:
-								((Entity*)target)->SetSogaHairHighlightColor(clr);
-							break;
-							case SPAWN_SET_SOGA_MODEL_COLOR:
-								((Entity*)target)->SetSogaModelColor(clr);
-							break;
-							case SPAWN_SET_SOGA_EYE_COLOR:
-								((Entity*)target)->SetSogaEyeColor(clr);
-							break;
-						}
-					}
-					safe_delete(skinsep);
-				}
-				break;
-			}
-			case SPAWN_SET_AAXP_REWARDS: {
-				target->SetAAXPRewards(atoul(value));
-				break;
-			}
-			case SPAWN_SET_CHEEK_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.cheek_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.cheek_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_CHIN_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.chin_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.chin_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_EAR_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.ear_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.ear_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_EYE_BROW_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.eye_brow_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.eye_brow_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_EYE_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.eye_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.eye_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_LIP_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.lip_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.lip_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_NOSE_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.nose_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.nose_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_BODY_SIZE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->features.body_size);
-					int8 new_value = atoul(value);
-					((Entity*)target)->features.body_size = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_BODY_AGE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->features.body_age);
-					int8 new_value = atoul(value);
-					((Entity*)target)->features.body_age = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_CHEEK_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.soga_cheek_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_cheek_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_CHIN_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.soga_chin_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_chin_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_EAR_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.soga_ear_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_ear_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_EYE_BROW_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.soga_eye_brow_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_eye_brow_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_EYE_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.soga_eye_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_eye_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_LIP_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sprintf(tmp, "%i", ((Entity*)target)->features.soga_lip_type[index]);
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_lip_type[index] = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_BODY_SIZE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->features.soga_body_size);
-					int8 new_value = atoul(value);
-					((Entity*)target)->features.soga_body_size = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_BODY_AGE:{
-				if(target->IsEntity()){
-					sprintf(tmp, "%i", ((Entity*)target)->features.soga_body_age);
-					int8 new_value = atoul(value);
-					((Entity*)target)->features.soga_body_age = new_value;
-					((Entity*)target)->info_changed = true;
-				}
-				break;
-			}
-
-			if(temp_value)
-				*temp_value = string(tmp);
-		}
-	}
-	else{ 
-		/**** NOT TEMPORARY ELSE STATEMENT ****/
-		/**** MUST RE-DEFINE WHAT IS ALREADY IN THE IF TEMPORARY BLOCK HERE ****/
-
-		switch(type){
-		case SPAWN_SET_VALUE_MERCHANT_MIN_LEVEL: {
-			target->SetMerchantLevelRange(atoul(value), target->GetMerchantMaxLevel());
-			break;
-		}
-		case SPAWN_SET_VALUE_MERCHANT_MAX_LEVEL: {
-			target->SetMerchantLevelRange(target->GetMerchantMinLevel(), atoul(value));
-			break;
-		}
-		case SPAWN_SET_VALUE_EXPANSION_FLAG: {
-
-			if (target->GetDatabaseID() > 0)
-			{
-				char query[256];
-				snprintf(query, 256, "update spawn set expansion_flag=%u where id=%i", atoul(value), target->GetDatabaseID());
-				if (database.RunQuery(query, strnlen(query, 256)))
-				{
-					if(client)
-						client->Message(CHANNEL_COLOR_RED, "Ran query:%s", query);
-				}
-			}
-			break;
-		}
-		case SPAWN_SET_VALUE_HOLIDAY_FLAG: {
-
-			if (target->GetDatabaseID() > 0)
-			{
-				char query[256];
-				snprintf(query, 256, "update spawn set holiday_flag=%u where id=%i", atoul(value), target->GetDatabaseID());
-				if (database.RunQuery(query, strnlen(query, 256)))
-				{
-					if(client)
-						client->Message(CHANNEL_COLOR_RED, "Ran query:%s", query);
-				}
-			}
-			break;
-		}
-		case SPAWN_SET_AAXP_REWARDS: {
-
-			if (target->GetDatabaseID() > 0)
-			{
-				char query[256];
-				snprintf(query, 256, "update spawn set aaxp_rewards=%u where id=%i", atoul(value), target->GetDatabaseID());
-				if (database.RunQuery(query, strnlen(query, 256)))
-				{
-					if(client)
-						client->Message(CHANNEL_COLOR_RED, "Ran query:%s", query);
-				}
-			}
-			break;
-		}
-			case SPAWN_SET_VALUE_NAME:{
-				target->SetName(value);
-				if(target->GetZone())
-					target->GetZone()->SendUpdateTitles(target);
-				break;
-									  }
-			case SPAWN_SET_VALUE_SUB_TITLE: {
-				target->SetSubTitle(value);
-				if(target->GetZone())
-					target->GetZone()->SendUpdateTitles(target);
-				break;
-											}
-			case SPAWN_SET_VALUE_X_OFFSET: 
-				{
-				target->SetXOffset(atof(value));
-				break;
-				}
-			case SPAWN_SET_VALUE_Y_OFFSET: 
-				{
-				target->SetYOffset(atof(value));
-				break;
-				}
-			case SPAWN_SET_VALUE_Z_OFFSET: 
-				{
-				target->SetZOffset(atof(value));
-				break;
-				}
-			case SPAWN_SET_VALUE_EXPIRE: {
-				target->SetExpireTime(val);
-				break;
-											}
-			case SPAWN_SET_VALUE_EXPIRE_OFFSET: {
-				target->SetExpireOffsetTime(val);
-				break;
-											}
-			case SPAWN_SET_VALUE_LEVEL:{
-				target->SetLevel(val, send_update);
-				break;
-									   }
-			case SPAWN_SET_VALUE_DIFFICULTY:{
-				target->SetEncounterLevel(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_MODEL_TYPE:{
-				target->SetModelType(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_CLASS:{
-				target->SetAdventureClass(val, send_update);
-				break;
-									   }
-			case SPAWN_SET_VALUE_GENDER:{
-				target->SetGender(val, send_update);
-				break;
-										}
-			case SPAWN_SET_VALUE_SHOW_NAME:{
-				target->SetShowName(val, send_update);
-				break;
-										   }
-			case SPAWN_SET_VALUE_ATTACKABLE:{
-				target->SetAttackable(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_SHOW_LEVEL:{
-				target->SetShowLevel(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_TARGETABLE:{
-				target->SetTargetable(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_SHOW_COMMAND_ICON:{
-				target->SetShowCommandIcon(val, send_update);
-				break;
-												   }
-			case SPAWN_SET_VALUE_HAND_ICON:{
-				target->SetShowHandIcon(val, send_update);
-				break;
-										   }
-			case SPAWN_SET_VALUE_HAIR_TYPE:{
-				if(target->IsEntity())
-					((Entity*)target)->SetHairType(val, send_update);
-				break;
-										   }
-			case SPAWN_SET_VALUE_FACIAL_HAIR_TYPE:{
-				if(target->IsEntity())
-					((Entity*)target)->SetFacialHairType(val, send_update);
-				break;
-												  }
-			case SPAWN_SET_VALUE_WING_TYPE:{
-				if(target->IsEntity())
-					((Entity*)target)->SetWingType(val, send_update);
-				break;
-										   }
-			case SPAWN_SET_VALUE_CHEST_TYPE:{
-				if(target->IsEntity())
-					((Entity*)target)->SetChestType(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_LEGS_TYPE:{
-				if(target->IsEntity())
-					((Entity*)target)->SetLegsType(val, send_update);
-				break;
-										   }
-			case SPAWN_SET_VALUE_SOGA_HAIR_TYPE:{
-				if(target->IsEntity())
-					((Entity*)target)->SetSogaHairType(val, send_update);
-				break;
-												}
-			case SPAWN_SET_VALUE_SOGA_FACIAL_HAIR_TYPE:{
-				if(target->IsEntity())
-					((Entity*)target)->SetSogaFacialHairType(val, send_update);
-				break;
-													   }
-			case SPAWN_SET_VALUE_SOGA_MODEL_TYPE:{
-				target->SetSogaModelType(val, send_update);
-				break;
-												 }
-			case SPAWN_SET_VALUE_SIZE:{
-				target->SetSize(val, send_update);
-				break;
-									  }
-			case SPAWN_SET_VALUE_HP:{
-				target->SetHP(val, send_update);
-				break;
-									}
-			case SPAWN_SET_VALUE_POWER:{
-				target->SetPower(val, send_update);
-				break;
-									   }
-			case SPAWN_SET_VALUE_HEROIC:{
-				target->SetHeroic(val, send_update);
-				break;
-										}
-			case SPAWN_SET_VALUE_RESPAWN:{
-				target->SetRespawnTime(val);
-				break;
-										 }
-			case SPAWN_SET_VALUE_X:{
-				target->SetX(atof(value), send_update);
-				target->SetSpawnOrigX(target->GetX());
-				break;
-								   }
-			case SPAWN_SET_VALUE_Y:{
-				target->SetY(atof(value), send_update);
-				target->SetSpawnOrigY(target->GetY());
-				break;
-								   }
-			case SPAWN_SET_VALUE_Z:{
-				target->SetZ(atof(value), send_update);
-				target->SetSpawnOrigZ(target->GetZ());
-				break;
-								   }
-			case SPAWN_SET_VALUE_HEADING:{
-				target->SetHeading(atof(value), send_update);
-				target->SetSpawnOrigHeading(target->GetHeading());
-				break;
-										 }
-			case SPAWN_SET_VALUE_COMMAND_PRIMARY:{
-				ZoneServer* zone = target->GetZone();
-				if (!zone && client)
-					zone = client->GetCurrentZone();
-
-				if(zone && zone->GetEntityCommandList(val))
-					target->SetPrimaryCommands(zone->GetEntityCommandList(val));
-				target->primary_command_list_id = val;
-				break;
-												 }
-			case SPAWN_SET_VALUE_COMMAND_SECONDARY:{
-				ZoneServer* zone = target->GetZone();
-				if (!zone && client)
-					zone = client->GetCurrentZone();
-
-				if (zone && zone->GetEntityCommandList(val))
-					target->SetSecondaryCommands(zone->GetEntityCommandList(val));
-				target->secondary_command_list_id = val;
-				break;
-												   }
-			case SPAWN_SET_VALUE_VISUAL_STATE:{
-				target->SetVisualState(val, send_update);
-				break;
-											  }
-			case SPAWN_SET_VALUE_ACTION_STATE:{
-				target->SetActionState(val, send_update);
-				break;
-											  }
-			case SPAWN_SET_VALUE_MOOD_STATE:{
-				target->SetMoodState(val, send_update);
-				break;
-											}
-			case SPAWN_SET_VALUE_INITIAL_STATE:{
-				target->SetInitialState(val, send_update);
-				break;
-											   }
-			case SPAWN_SET_VALUE_ACTIVITY_STATE:{
-				target->SetActivityStatus(val, send_update);
-				break;
-												}
-			case SPAWN_SET_VALUE_COLLISION_RADIUS:{
-				target->SetCollisionRadius(val, send_update);
-				break;
-												  }
-			case SPAWN_SET_VALUE_FACTION:{
-				ZoneServer* zone = target->GetZone();
-				if (!zone && client)
-					zone = client->GetCurrentZone();
-
-				target->faction_id = val;
-				if(zone)
-				{
-					zone->RemoveDeadEnemyList(target);
-					if(target->IsNPC())
-						zone->AddEnemyList((NPC*)target);
-				}
-				break;
-										 }
-			case SPAWN_SET_VALUE_DEVICE_ID:{
-				if (target->IsObject())
-					((Object*)target)->SetDeviceID(val);
-				break;
-										   }
-			case SPAWN_SET_VALUE_PITCH: {
-				target->SetPitch(atof(value), send_update);
-				target->SetSpawnOrigPitch(atof(value));
-				break;
-										}
-			case SPAWN_SET_VALUE_ROLL: {
-				target->SetRoll(atof(value), send_update);
-				target->SetSpawnOrigRoll(atof(value));
-				break;
-									   }
-			case SPAWN_SET_VALUE_HIDE_HOOD: {
-				target->SetHideHood(val);
-				break;
-											}
-			case SPAWN_SET_VALUE_EMOTE_STATE: {
-				target->SetEmoteState(val);
-				break;
-											  }
-			case SPAWN_SET_VALUE_ICON: {
-				target->SetIcon(val);
-				break;
-									   }
-			case SPAWN_SET_VALUE_PREFIX: {
-				target->SetPrefixTitle(value);
-				if(target->GetZone())
-					target->GetZone()->SendUpdateTitles(target);
-				break;
-										 }
-			case SPAWN_SET_VALUE_SUFFIX: {
-				target->SetSuffixTitle(value);
-				if(target->GetZone())
-					target->GetZone()->SendUpdateTitles(target);
-				break;
-			}
-			case SPAWN_SET_VALUE_LASTNAME: {
-				target->SetLastName(value);
-				if(target->GetZone())
-					target->GetZone()->SendUpdateTitles(target);
-			    break;
-			}
-			case SPAWN_SET_VALUE_SPAWN_SCRIPT:{
-				if(lua_interface && lua_interface->GetSpawnScript(value) == 0){
-					if(client){
-						client->Message(CHANNEL_COLOR_RED, "Invalid Spawn Script file.  Be sure you give the absolute path.");
-						client->Message(CHANNEL_COLOR_RED, "Example: /spawn set spawn_script 'SpawnScripts/example.lua'");
-					}
-					return false;
-				}
-				else if(!database.UpdateSpawnScriptData(target->GetDatabaseID(), 0, 0, value))
-					return false;
-				else{
-					if(!world.GetSpawnLocationScript(target->GetSpawnLocationID()))
-						target->SetSpawnScript(value);
-				}
-				break;
-											  }
-			case SPAWN_SET_VALUE_SPAWNLOCATION_SCRIPT:{
-				if(lua_interface && lua_interface->GetSpawnScript(value) == 0){
-					if(client){
-						client->Message(CHANNEL_COLOR_RED, "Invalid Spawn Script file.  Be sure you give the absolute path.");
-						client->Message(CHANNEL_COLOR_RED, "Example: /spawn set spawnlocation_script 'SpawnScripts/example.lua'");
-					}
-					return false;
-				}
-				else if(!database.UpdateSpawnScriptData(0, target->GetSpawnLocationID(), 0, value))
-					return false;
-				else{
-					if(!world.GetSpawnEntryScript(target->GetSpawnEntryID()))
-						target->SetSpawnScript(value);
-				}
-				break;
-												   }
-			case SPAWN_SET_VALUE_SPAWNENTRY_SCRIPT:{
-				if(lua_interface && lua_interface->GetSpawnScript(value) == 0){
-					if(client){
-						client->Message(CHANNEL_COLOR_RED, "Invalid Spawn Script file.  Be sure you give the absolute path.");
-						client->Message(CHANNEL_COLOR_RED, "Example: /spawn set spawnentry_script 'SpawnScripts/example.lua'");
-					}
-					return false;
-				}
-				else if(!database.UpdateSpawnScriptData(0, 0, target->GetSpawnEntryID(), value))
-					return false;
-				else
-					target->SetSpawnScript(value);
-				break;
-			}
-
-			case SPAWN_SET_SKIN_COLOR:
-			case SPAWN_SET_HAIR_COLOR1:
-			case SPAWN_SET_HAIR_COLOR2:
-			case SPAWN_SET_HAIR_TYPE_COLOR:
-			case SPAWN_SET_HAIR_FACE_COLOR:
-			case SPAWN_SET_HAIR_TYPE_HIGHLIGHT_COLOR:
-			case SPAWN_SET_HAIR_FACE_HIGHLIGHT_COLOR:
-			case SPAWN_SET_HAIR_HIGHLIGHT:
-			case SPAWN_SET_MODEL_COLOR:
-			case SPAWN_SET_EYE_COLOR:
-			case SPAWN_SET_SOGA_SKIN_COLOR:
-			case SPAWN_SET_SOGA_HAIR_COLOR1:
-			case SPAWN_SET_SOGA_HAIR_COLOR2:
-			case SPAWN_SET_SOGA_HAIR_TYPE_COLOR:
-			case SPAWN_SET_SOGA_HAIR_FACE_COLOR:
-			case SPAWN_SET_SOGA_HAIR_TYPE_HIGHLIGHT_COLOR:
-			case SPAWN_SET_SOGA_HAIR_FACE_HIGHLIGHT_COLOR:
-			case SPAWN_SET_SOGA_HAIR_HIGHLIGHT:
-			case SPAWN_SET_SOGA_MODEL_COLOR:
-			case SPAWN_SET_SOGA_EYE_COLOR: {
-				if (target->IsNPC())
-				{
-					Seperator* skinsep = new Seperator(value, ' ', 3, 500, true);
-					if (skinsep->IsNumber(0) && skinsep->IsNumber(1) && skinsep->IsNumber(2))
-					{
-						EQ2_Color clr;
-						clr.red = atoul(skinsep->arg[0]);
-						clr.green = atoul(skinsep->arg[1]);
-						clr.blue = atoul(skinsep->arg[2]);
-						Query replaceSkinQuery;
-
-						string fieldName("");
-						switch(type)
-						{
-							case SPAWN_SET_SKIN_COLOR:
-								((Entity*)target)->SetSkinColor(clr);
-								fieldName.append("skin_color");
-								break;
-							case SPAWN_SET_HAIR_COLOR1:
-								((Entity*)target)->SetHairColor1(clr);
-								fieldName.append("hair_color1");
-								break;
-							case SPAWN_SET_HAIR_COLOR2:
-								((Entity*)target)->SetHairColor2(clr);
-								fieldName.append("hair_color2");
-								break;
-							case SPAWN_SET_HAIR_TYPE_COLOR:
-								((Entity*)target)->SetHairColor(clr);
-								fieldName.append("hair_type_color");
-								break;
-							case SPAWN_SET_HAIR_FACE_COLOR:
-								((Entity*)target)->SetFacialHairColor(clr);
-								fieldName.append("hair_face_color");
-								break;
-							case SPAWN_SET_HAIR_TYPE_HIGHLIGHT_COLOR:
-								((Entity*)target)->SetHairTypeHighlightColor(clr);
-								fieldName.append("hair_type_highlight_color");
-								break;
-							case SPAWN_SET_HAIR_FACE_HIGHLIGHT_COLOR:
-								((Entity*)target)->SetFacialHairHighlightColor(clr);
-								fieldName.append("hair_face_highlight_color");
-								break;
-							case SPAWN_SET_HAIR_HIGHLIGHT:
-								((Entity*)target)->SetHairHighlightColor(clr);
-								fieldName.append("hair_highlight");
-								break;
-							case SPAWN_SET_MODEL_COLOR:
-								((Entity*)target)->SetModelColor(clr);
-								fieldName.append("model_color");
-								break;
-							case SPAWN_SET_EYE_COLOR:
-								((Entity*)target)->SetEyeColor(clr);
-								fieldName.append("eye_color");
-								break;
-							case SPAWN_SET_SOGA_SKIN_COLOR:
-								((Entity*)target)->SetSogaSkinColor(clr);
-								fieldName.append("soga_skin_color");
-								break;
-							case SPAWN_SET_SOGA_HAIR_COLOR1:
-								((Entity*)target)->SetSogaHairColor1(clr);
-								fieldName.append("soga_hair_color1");
-								break;
-							case SPAWN_SET_SOGA_HAIR_COLOR2:
-								((Entity*)target)->SetSogaHairColor2(clr);
-								fieldName.append("soga_hair_color2");
-								break;
-							case SPAWN_SET_SOGA_HAIR_TYPE_COLOR:
-								((Entity*)target)->SetSogaHairColor(clr);
-								fieldName.append("soga_hair_type_color");
-								break;
-							case SPAWN_SET_SOGA_HAIR_FACE_COLOR:
-								((Entity*)target)->SetSogaFacialHairColor(clr);
-								fieldName.append("soga_hair_face_color");
-								break;
-							case SPAWN_SET_SOGA_HAIR_TYPE_HIGHLIGHT_COLOR:
-								((Entity*)target)->SetSogaHairTypeHighlightColor(clr);
-								fieldName.append("soga_hair_type_highlight_color");
-								break;
-							case SPAWN_SET_SOGA_HAIR_FACE_HIGHLIGHT_COLOR:
-								((Entity*)target)->SetSogaFacialHairHighlightColor(clr);
-								fieldName.append("soga_hair_face_highlight_color");
-								break;
-							case SPAWN_SET_SOGA_HAIR_HIGHLIGHT:
-								((Entity*)target)->SetSogaHairHighlightColor(clr);
-								fieldName.append("soga_hair_highlight");
-								break;
-							case SPAWN_SET_SOGA_MODEL_COLOR:
-								((Entity*)target)->SetSogaModelColor(clr);
-								fieldName.append("soga_model_color");
-								break;
-							case SPAWN_SET_SOGA_EYE_COLOR:
-								((Entity*)target)->SetSogaEyeColor(clr);
-								fieldName.append("soga_eye_color");
-								break;
-						}
-						replaceSkinQuery.AddQueryAsync(0, &database, Q_DELETE, "delete from npc_appearance where spawn_id=%u and type='%s'", target->GetDatabaseID(), fieldName.c_str());
-						replaceSkinQuery.AddQueryAsync(0, &database, Q_INSERT, "insert into npc_appearance set spawn_id=%u, type='%s', red=%u, green=%u, blue=%u", target->GetDatabaseID(), fieldName.c_str(), clr.red, clr.green, clr.blue);
-					}
-					safe_delete(skinsep);
-				}
-				break;
-			}
-			
-			case SPAWN_SET_CHEEK_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.cheek_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "cheek_type", ((Entity*)target)->features.cheek_type[0], ((Entity*)target)->features.cheek_type[1], ((Entity*)target)->features.cheek_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_CHIN_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.chin_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "chin_type", ((Entity*)target)->features.chin_type[0], ((Entity*)target)->features.chin_type[1], ((Entity*)target)->features.chin_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_EAR_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.ear_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "ear_type", ((Entity*)target)->features.ear_type[0], ((Entity*)target)->features.ear_type[1], ((Entity*)target)->features.ear_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_EYE_BROW_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.eye_brow_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "eye_brow_type", ((Entity*)target)->features.eye_brow_type[0], ((Entity*)target)->features.eye_brow_type[1], ((Entity*)target)->features.eye_brow_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_EYE_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.eye_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "eye_type", ((Entity*)target)->features.eye_type[0], ((Entity*)target)->features.eye_type[1], ((Entity*)target)->features.eye_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_LIP_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.lip_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "lip_type", ((Entity*)target)->features.lip_type[0], ((Entity*)target)->features.lip_type[1], ((Entity*)target)->features.lip_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_NOSE_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.nose_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "nose_type", ((Entity*)target)->features.nose_type[0], ((Entity*)target)->features.nose_type[1], ((Entity*)target)->features.nose_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_BODY_SIZE:{
-				if(target->IsEntity()){
-					int8 new_value = atoul(value);
-					((Entity*)target)->features.body_size = new_value;
-					UpdateDatabaseAppearance(client, target, "body_size", ((Entity*)target)->features.body_size, 0, 0);
-				}
-				break;
-			}
-			case SPAWN_SET_BODY_AGE:{
-				if(target->IsEntity()){
-					int8 new_value = atoul(value);
-					((Entity*)target)->features.body_age = new_value;
-					UpdateDatabaseAppearance(client, target, "body_age", ((Entity*)target)->features.body_age, 0, 0);
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_CHEEK_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_cheek_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "soga_cheek_type", ((Entity*)target)->features.soga_cheek_type[0], ((Entity*)target)->features.soga_cheek_type[1], ((Entity*)target)->features.soga_cheek_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_CHIN_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_chin_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "soga_chin_type", ((Entity*)target)->features.soga_chin_type[0], ((Entity*)target)->features.soga_chin_type[1], ((Entity*)target)->features.soga_chin_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_EAR_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_ear_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "soga_ear_type", ((Entity*)target)->features.soga_ear_type[0], ((Entity*)target)->features.soga_ear_type[1], ((Entity*)target)->features.soga_ear_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_EYE_BROW_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_eye_brow_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "soga_eye_brow_type", ((Entity*)target)->features.soga_eye_brow_type[0], ((Entity*)target)->features.soga_eye_brow_type[1], ((Entity*)target)->features.soga_eye_brow_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_EYE_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_eye_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "soga_eye_type", ((Entity*)target)->features.soga_eye_type[0], ((Entity*)target)->features.soga_eye_type[1], ((Entity*)target)->features.soga_eye_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_LIP_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_lip_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "soga_lip_type", ((Entity*)target)->features.soga_lip_type[0], ((Entity*)target)->features.soga_lip_type[1], ((Entity*)target)->features.soga_lip_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_NOSE_TYPE:{
-				if(target->IsEntity() && index < 3){
-					sint8 new_value = atoi(value);
-					((Entity*)target)->features.soga_nose_type[index] = new_value;
-					UpdateDatabaseAppearance(client, target, "soga_nose_type", ((Entity*)target)->features.soga_nose_type[0], ((Entity*)target)->features.soga_nose_type[1], ((Entity*)target)->features.soga_nose_type[2]);
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_BODY_SIZE:{
-				if(target->IsEntity()){
-					int8 new_value = atoul(value);
-					((Entity*)target)->features.body_size = new_value;
-					UpdateDatabaseAppearance(client, target, "body_size", ((Entity*)target)->features.body_size, 0, 0);
-				}
-				break;
-			}
-			case SPAWN_SET_SOGA_BODY_AGE:{
-				if(target->IsEntity()){
-					int8 new_value = atoul(value);
-					((Entity*)target)->features.body_age = new_value;
-					UpdateDatabaseAppearance(client, target, "body_age", ((Entity*)target)->features.body_age, 0, 0);
-				}
-				break;
-			}
-		}
-	}
-	return true;
-}
-
-void Commands::UpdateDatabaseAppearance(Client* client, Spawn* target, string fieldName, sint8 r, sint8 g, sint8 b)
-{
-	Query replaceQuery;
-
-	if(target->IsBot())
-	{
-		Bot* bot = (Bot*)target;
-		if(bot->BotID)
-			database.SaveBotFloats(bot->BotID, fieldName.c_str(), r, g, b);
-	}
-	else if(target->IsPlayer())
-	{
-		replaceQuery.AddQueryAsync(0, &database, Q_DELETE, "delete from char_colors where char_id=%u and type='%s'", ((Player*)target)->GetCharacterID(), fieldName.c_str());
-		replaceQuery.AddQueryAsync(0, &database, Q_INSERT, "insert into char_colors set char_id=%u, type='%s', red=%i, green=%i, blue=%i", ((Player*)target)->GetCharacterID(), fieldName.c_str(), r, g, b);
-	}
-	else
-	{
-		replaceQuery.AddQueryAsync(0, &database, Q_DELETE, "delete from npc_appearance where spawn_id=%u and type='%s'", target->GetDatabaseID(), fieldName.c_str());
-		replaceQuery.AddQueryAsync(0, &database, Q_INSERT, "insert into npc_appearance set spawn_id=%u, type='%s', red=%i, green=%i, blue=%i", target->GetDatabaseID(), fieldName.c_str(), r, g, b);
-	}
-
-	((Entity*)target)->changed = true;
-	((Entity*)target)->info_changed = true;
-	if(target->GetZone())
-		target->GetZone()->AddChangedSpawn(target);
-}
-
-/* The zone object will be NULL if the zone is not currently running.  We pass both of these in so we can update 
-   the database fields always and also update the zone in memory if it's running. */
-bool Commands::SetZoneCommand(Client* client, int32 zone_id, ZoneServer* zone, int8 type, const char* value) {
-	if (client && zone_id > 0 && type > 0 && value) {
-		sint32 int_value = 0;
-		float float_value = 0;
-		if (type == ZONE_SET_VALUE_SAFE_X || type == ZONE_SET_VALUE_SAFE_Y || type == ZONE_SET_VALUE_SAFE_Z || type == ZONE_SET_VALUE_UNDERWORLD) {
-			try {
-				float_value = atof(value);
-			}
-			catch (...) {
-				client->Message(CHANNEL_COLOR_RED, "Error converting '%s' to a float value", value);
-				return false;
-			}
-		}
-		else if (type != ZONE_SET_VALUE_NAME && type != ZONE_SET_VALUE_FILE && type != ZONE_SET_VALUE_DESCRIPTION && type != ZONE_SET_VALUE_ZONE_TYPE && type != ZONE_SET_VALUE_LUA_SCRIPT && type != ZONE_SET_VALUE_ZONE_MOTD) {
-			try {
-				int_value = atoi(value);
-			}
-			catch (...) {
-				client->Message(CHANNEL_COLOR_RED, "Error converting '%s' to an integer value", value);
-				return false;
-			}
-		}
-		switch (type) {
-			case ZONE_SET_VALUE_EXPANSION_ID: {
-				break;
-			}
-			case ZONE_SET_VALUE_NAME: {
-				if (zone)
-					zone->SetZoneName(const_cast<char*>(value));
-				database.SaveZoneInfo(zone_id, "name", value);
-				break;
-			}
-			case ZONE_SET_VALUE_FILE: {
-				if (zone)
-					zone->SetZoneFile(const_cast<char*>(value));
-				database.SaveZoneInfo(zone_id, "file", value);
-				break;
-			}
-			case ZONE_SET_VALUE_DESCRIPTION: {
-				if (zone)
-					zone->SetZoneDescription(const_cast<char*>(value));
-				database.SaveZoneInfo(zone_id, "description", value);
-				break;
-			}
-			case ZONE_SET_VALUE_SAFE_X: {
-				if (zone)
-					zone->SetSafeX(float_value);
-				database.SaveZoneInfo(zone_id, "safe_x", float_value);
-				break;
-			}
-			case ZONE_SET_VALUE_SAFE_Y: {
-				if (zone)
-					zone->SetSafeY(float_value);
-				database.SaveZoneInfo(zone_id, "safe_y", float_value);
-				break;
-			}
-			case ZONE_SET_VALUE_SAFE_Z: {
-				if (zone)
-					zone->SetSafeZ(float_value);
-				database.SaveZoneInfo(zone_id, "safe_z", float_value);
-				break;
-			}
-			case ZONE_SET_VALUE_UNDERWORLD: {
-				if (zone)
-					zone->SetUnderWorld(float_value);
-				database.SaveZoneInfo(zone_id, "underworld", float_value);
-				break;
-			}
-			case ZONE_SET_VALUE_MIN_RECOMMENDED: {
-				break;
-			}
-			case ZONE_SET_VALUE_MAX_RECOMMENDED: {
-				break;
-			}
-			case ZONE_SET_VALUE_ZONE_TYPE: {
-				break;
-			}
-			case ZONE_SET_VALUE_ALWAYS_LOADED: {
-				if (zone)
-					zone->SetAlwaysLoaded(int_value == 1);
-				database.SaveZoneInfo(zone_id, "always_loaded", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_CITY_ZONE: {
-				if (zone)
-					zone->SetCityZone(int_value == 1);
-				database.SaveZoneInfo(zone_id, "city_zone", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_WEATHER_ALLOWED: {
-				if (zone)
-					zone->SetWeatherAllowed(int_value == 1);
-				database.SaveZoneInfo(zone_id, "weather_allowed", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_MIN_STATUS: {
-				if (zone)
-					zone->SetMinimumStatus(int_value);
-				database.SaveZoneInfo(zone_id, "min_status", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_MIN_LEVEL: {
-				if (zone)
-					zone->SetMinimumLevel(int_value);
-				database.SaveZoneInfo(zone_id, "min_level", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_MAX_LEVEL: {
-				if (zone)
-					zone->SetMaximumLevel(int_value);
-				database.SaveZoneInfo(zone_id, "max_level", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_START_ZONE: {
-				database.SaveZoneInfo(zone_id, "start_zone", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_INSTANCE_TYPE: {
-				if (zone)
-					zone->SetInstanceType(int_value);
-				database.SaveZoneInfo(zone_id, "instance_type", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_DEFAULT_REENTER_TIME: {
-				if (zone)
-					zone->SetDefaultReenterTime(int_value);
-				database.SaveZoneInfo(zone_id, "default_reenter_time", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_DEFAULT_RESET_TIME: {
-				if (zone)
-					zone->SetDefaultResetTime(int_value);
-				database.SaveZoneInfo(zone_id, "default_reset_time", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_DEFAULT_LOCKOUT_TIME: {
-				if (zone)
-					zone->SetDefaultLockoutTime(int_value);
-				database.SaveZoneInfo(zone_id, "default_lockout_time", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_FORCE_GROUP_TO_ZONE: {
-				if (zone)
-					zone->SetForceGroupZoneOption(int_value);
-				database.SaveZoneInfo(zone_id, "force_group_to_zone", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_LUA_SCRIPT: {
-				if (lua_interface && lua_interface->GetZoneScript(value) == 0) {
-					client->Message(CHANNEL_COLOR_RED, "Invalid Zone Script file.  Be sure you give the absolute path.");
-					client->Message(CHANNEL_COLOR_RED, "Example: /zone set lua_script 'ZoneScripts/QueensColony.lua'");
-					return false;
-				}
-				else {
-					world.AddZoneScript(zone_id, const_cast<char*>(value));
-					database.SaveZoneInfo(zone_id, "lua_script", value);
-				}
-				break;
-			}
-			case ZONE_SET_VALUE_SHUTDOWN_TIMER: {
-				if (zone)
-					zone->SetShutdownTimer(int_value);
-				database.SaveZoneInfo(zone_id, "shutdown_timer", int_value);
-				break;
-			}
-			case ZONE_SET_VALUE_ZONE_MOTD: {
-				if (zone)
-					zone->SetZoneMOTD(string(value));
-				database.SaveZoneInfo(zone_id, "zone_motd", value);
-				break;
-			}
-			default: {
-				client->Message(CHANNEL_COLOR_RED, "Invalid zone attribute %i", type);
-				return false;
-			}
-		}
-	}
-	else {
-		if (client)
-			client->SimpleMessage(CHANNEL_COLOR_RED, "An error occured saving new zone data.");
-		return false;
-	}
-	return true;
-}
-
-void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* client, Spawn* targetOverride) {
-
-	if (index >= remote_commands->commands.size()) {
-		LogWrite(COMMAND__ERROR, 0, "Command", "Error, command handler of %u was requested, but max handler is %u", index, remote_commands->commands.size());
-		return;
-	}
-
-	Spawn* cmdTarget = targetOverride ? targetOverride : client->GetPlayer()->GetTarget();
-
-	EQ2_RemoteCommandString* parent_command = 0;
-	EQ2_RemoteCommandString* command = &remote_commands->commands[index];
-	Seperator* sep = 0;
-	if (command_parms->size > 0) {
-		sep = new Seperator(command_parms->data.c_str(), ' ', 10, 500, true);
-		if (sep && sep->arg[0] && remote_commands->validSubCommand(command->command.data, string(sep->arg[0]))) {
-			parent_command = command;
-			command = &(remote_commands->subcommands[command->command.data][string(sep->arg[0])]);
-			safe_delete(sep);
-			if (command_parms->data.length() > (command->command.data.length() + 1))
-				sep = new Seperator(command_parms->data.c_str() + (command->command.data.length() + 1), ' ', 10, 500, true);
-			LogWrite(COMMAND__DEBUG, 1, "Command", "Handler: %u, COMMAND: '%s', SUBCOMMAND: '%s'", index, parent_command->command.data.c_str(), command->command.data.c_str());
-		}
-		else
-			LogWrite(COMMAND__DEBUG, 1, "Command", "Handler: %u, COMMAND: '%s'", index, command->command.data.c_str());
-	}
-
-	int ndx = 0;
-	if (command->required_status > client->GetAdminStatus())
-	{
-		LogWrite(COMMAND__ERROR, 0, "Command", "Player '%s' (%u) needs status %i to use command: %s", client->GetPlayer()->GetName(), client->GetAccountID(), command->required_status, command->command.data.c_str());
-		safe_delete(sep);
-		client->SimpleMessage(3, "Error: Your status is insufficient for this command.");
-		return;
-	}
-
-	Player* player = client->GetPlayer();
-	LogWrite(COMMAND__DEBUG, 0, "Command", "Player '%s' (%u), Command: %s", player->GetName(), client->GetAccountID(), command->command.data.c_str());
-
-	switch (command->handler) {
-	case COMMAND_RELOAD: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reload commands:");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload structs");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload items");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload luasystem");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload spawnscripts");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload spells");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload quests");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload spawns");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload groundspawns");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload zonescripts");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload entity_commands");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload factions");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload mail");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload guilds");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload locations");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload rules");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload transporters");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/reload startabilities");
-		break;
-	}
-	case COMMAND_RELOADSTRUCTS: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Structs...");
-		world.SetReloadingSubsystem("Structs");
-		configReader.ReloadStructs();
-		world.RemoveReloadingSubSystem("Structs");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_RELOAD_QUESTS: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Quests...");
-		world.SetReloadingSubsystem("Quests");
-		master_quest_list.Reload();
-		client_list.ReloadQuests();
-		zone_list.ReloadClientQuests();
-		world.RemoveReloadingSubSystem("Quests");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_RELOAD_SPAWNS: {
-		client->GetCurrentZone()->ReloadSpawns();
-		break;
-	}
-	case COMMAND_RELOAD_SPELLS: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Spells...");
-		world.SetReloadingSubsystem("Spells");
-		zone_list.DeleteSpellProcess();
-		master_spell_list.Reload();
-		if (lua_interface)
-			lua_interface->ReloadSpells();
-		zone_list.LoadSpellProcess();
-		world.RemoveReloadingSubSystem("Spells");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");		
-		break;
-	}
-	case COMMAND_RELOAD_GROUNDSPAWNS: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Groundspawn Entries...");
-		world.SetReloadingSubsystem("GroundSpawns");
-		client->GetCurrentZone()->DeleteGroundSpawnItems();
-		client->GetCurrentZone()->LoadGroundSpawnEntries();
-		world.RemoveReloadingSubSystem("GroundSpawns");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-
-	case COMMAND_RELOAD_ZONESCRIPTS: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Zone Scripts...");
-		world.SetReloadingSubsystem("ZoneScripts");
-		world.ResetZoneScripts();
-		database.LoadZoneScriptData();
-		if (lua_interface)
-			lua_interface->DestroyZoneScripts();
-		world.RemoveReloadingSubSystem("ZoneScripts");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_RELOAD_ENTITYCOMMANDS: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Entity Commands...");
-		world.SetReloadingSubsystem("EntityCommands");
-		client->GetCurrentZone()->ClearEntityCommands();
-		database.LoadEntityCommands(client->GetCurrentZone());
-		world.RemoveReloadingSubSystem("EntityCommands");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_RELOAD_FACTIONS: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Factions...");
-		world.SetReloadingSubsystem("Factions");
-		master_faction_list.Clear();
-		database.LoadFactionList();
-		world.RemoveReloadingSubSystem("Factions");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_RELOAD_MAIL: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Mail...");
-		zone_list.ReloadMail();
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_RELOAD_GUILDS: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Guilds...");
-		world.ReloadGuilds();
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_RELOAD_LOCATIONS: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Locations...");
-		client->GetPlayer()->GetZone()->RemoveLocationGrids();
-		database.LoadLocationGrids(client->GetPlayer()->GetZone());
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_RELOAD_RULES: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Rules...");
-		database.LoadRuleSets(true);
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_RELOAD_TRANSPORTERS: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Transporters in your current zone...");
-		database.LoadTransporters(client->GetCurrentZone());
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_RELOAD_STARTABILITIES: {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Starting Skills/Spells...");
-		world.PurgeStartingLists();
-		world.LoadStartingLists();
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Done!");
-		break;
-	}
-	case COMMAND_READ: {
-		if (sep && sep->arg[1][0] && sep->IsNumber(1)) {
-			if (strcmp(sep->arg[0], "read") == 0) {
-				int32 item_index = atol(sep->arg[1]);
-				Item* item = client->GetPlayer()->item_list.GetItemFromIndex(item_index);
-				if (item) {
-					Spawn* spawn = cmdTarget;
-					client->SendShowBook(client->GetPlayer(), item->name, item->book_pages);
-					break;
-				}
-			}
-		}
-		break;
-	}
-		case COMMAND_USEABILITY:{
-			if (sep && sep->arg[0][0] && sep->IsNumber(0)) {
-				if (client->GetPlayer()->GetHP() == 0) {
-					client->SimpleMessage(CHANNEL_COLOR_RED, "You cannot do that right now.");
-				}
-				else {
-					int32 spell_id = atoul(sep->arg[0]);
-					int8 spell_tier = 0;
-					if (sep->arg[1][0] && sep->IsNumber(1))
-						spell_tier = atoi(sep->arg[1]);
-					else
-						spell_tier = client->GetPlayer()->GetSpellTier(spell_id);
-					if (!spell_tier)
-						spell_tier = 1;
-					Spell* spell = master_spell_list.GetSpell(spell_id, spell_tier);
-					if (spell) {
-						if (strncmp(spell->GetName(), "Gathering", 9) == 0 || strncmp(spell->GetName(), "Mining", 6) == 0 || strncmp(spell->GetName(), "Trapping", 8) == 0 || strncmp(spell->GetName(), "Foresting", 9) == 0 || strncmp(spell->GetName(), "Fishing", 7) == 0 || strncmp(spell->GetName(), "Collecting", 10) == 0)
-							client->GetCurrentZone()->ProcessSpell(spell, client->GetPlayer(), cmdTarget, true, true);
-						else
-						{
-							if (cmdTarget)
-								client->GetCurrentZone()->ProcessSpell(spell, client->GetPlayer(), cmdTarget);
-							else
-								client->GetCurrentZone()->ProcessSpell(spell, client->GetPlayer(), client->GetPlayer());
-						}
-					}
-				}
-			}
-			else if (cmdTarget && cmdTarget->IsWidget())
-			{
-				Widget* widget = (Widget*)cmdTarget;
-				widget->HandleUse(client, "use", WIDGET_TYPE_DOOR);
-			}
-			else
-			{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /useability {spell_id} [spell_tier]");
-			}
-			break;
-								}
-		case COMMAND_INFO:{
-			if(sep && sep->arg[1][0] && sep->IsNumber(1)){
-				if(strcmp(sep->arg[0], "inventory") == 0){
-					int32 item_index = atol(sep->arg[1]);
-					Item* item = client->GetPlayer()->item_list.GetItemFromIndex(item_index);
-					if(item){
-						if (item->IsCollectable() && client->SendCollectionsForItem(item))
-							break;
-
-						EQ2Packet* app = item->serialize(client->GetVersion(), (!item->GetItemScript() || !lua_interface), client->GetPlayer());
-						//DumpPacket(app);
-						client->QueuePacket(app);
-						if(item->GetItemScript() && lua_interface)
-							lua_interface->RunItemScript(item->GetItemScript(), "examined", item, client->GetPlayer());
-						else if(item->generic_info.offers_quest_id > 0){ //leave the current functionality in place if it doesnt have an item script
-							Quest* quest = master_quest_list.GetQuest(item->generic_info.offers_quest_id, false);
-							if(quest && client->GetPlayer()->GetCompletedQuest(item->generic_info.offers_quest_id) == 0 && client->GetPlayer()->GetQuest(item->generic_info.offers_quest_id) == 0)
-								client->AddPendingQuest(new Quest(quest)); // copy quest since we pulled the master quest to see if it existed or not
-						}
-					}
-					else
-						LogWrite(COMMAND__ERROR, 0, "Command", "Unknown Index: %u", item_index);
-				}
-				else if(strcmp(sep->arg[0], "equipment") == 0){
-					int32 item_index = atol(sep->arg[1]);
-					Item* item = client->GetPlayer()->GetEquipmentList()->GetItem(item_index);
-					if(item){
-						EQ2Packet* app = item->serialize(client->GetVersion(), true, client->GetPlayer());
-						client->QueuePacket(app);
-						if(item->GetItemScript() && lua_interface)
-							lua_interface->RunItemScript(item->GetItemScript(), "examined", item, client->GetPlayer());
-					}
-					else
-						LogWrite(COMMAND__ERROR, 0, "Command", "Unknown Index: %u", item_index);
-				}
-				else if(strcmp(sep->arg[0], "appearance") == 0){
-					int32 item_index = atol(sep->arg[1]);
-					Item* item = client->GetPlayer()->GetAppearanceEquipmentList()->GetItem(item_index);
-					if(item){
-						EQ2Packet* app = item->serialize(client->GetVersion(), true, client->GetPlayer());
-						client->QueuePacket(app);
-						if(item->GetItemScript() && lua_interface)
-							lua_interface->RunItemScript(item->GetItemScript(), "examined", item, client->GetPlayer());
-					}
-					else
-						LogWrite(COMMAND__ERROR, 0, "Command", "Unknown Index: %u", item_index);
-				}
-				else if(strcmp(sep->arg[0], "item") == 0 || strcmp(sep->arg[0], "merchant") == 0 || strcmp(sep->arg[0], "store") == 0 || strcmp(sep->arg[0], "buyback") == 0 || strcmp(sep->arg[0], "consignment") == 0){
-					int32 item_id = atoul(sep->arg[1]);
-					Item* item = master_item_list.GetItem(item_id);
-					if(item){
-						EQ2Packet* app = item->serialize(client->GetVersion(), true, client->GetPlayer());
-						client->QueuePacket(app);
-					}
-					else
-						LogWrite(COMMAND__ERROR, 0, "Command", "Unknown Item ID: %u", item_id);
-				}
-				else if (strcmp(sep->arg[0], "spell") == 0) {
-					sint32 spell_id = atol(sep->arg[1]);
-					int8 tier = atoi(sep->arg[3]);
-					EQ2Packet* outapp = master_spell_list.GetSpellPacket(spell_id, tier, client, true, 0x2A);
-					if (outapp)
-						client->QueuePacket(outapp);
-					else
-						LogWrite(COMMAND__ERROR, 0, "Command", "Unknown Spell ID and/or Tier, ID: %u, Tier: %i", spell_id, tier);
-				}
-				else if (strcmp(sep->arg[0], "achievement") == 0) {
-					sint32 spell_id = atol(sep->arg[2]);
-					
-					int8 group = atoi(sep->arg[1]);
-					AltAdvanceData* data = 0;
-					SpellBookEntry* spellentry = 0;
-					int8 tier = client->GetPlayer()->GetSpellTier(spell_id);
-				
-					LogWrite(COMMAND__ERROR, 0, "Command", "AA Spell ID and/or Tier, ID: %u, Group: %i", spell_id, group);
-					EQ2Packet* outapp = master_spell_list.GetAASpellPacket(spell_id, tier, client, true, 0x45);
-					if (outapp)
-						client->QueuePacket(outapp);
-					else
-						LogWrite(COMMAND__ERROR, 0, "Command", "Unknown Spell ID and/or Tier, ID: %u, Tier: %i", spell_id, group);
-				}
-				else if (strcmp(sep->arg[0], "spellbook") == 0) {
-					sint32 spell_id = atol(sep->arg[1]);
-					int32 tier = atoi(sep->arg[2]);
-					if (tier > 255) {
-						SpellBookEntry* ent = client->GetPlayer()->GetSpellBookSpell(spell_id);
-						if (ent)
-							tier = ent->tier;
-					}
-					EQ2Packet* outapp = master_spell_list.GetSpellPacket(spell_id, (int8)tier, client, true, 0x2A);
-					if (outapp)
-						client->QueuePacket(outapp);
-					else
-						LogWrite(COMMAND__ERROR, 0, "Command", "Unknown Spell ID and/or Tier, ID: %u, Tier: %i", spell_id, tier);
-				}
-				else if (strcmp(sep->arg[0], "recipe") == 0) {
-					sint32 recipe_id = atol(sep->arg[1]);
-					EQ2Packet* outapp = master_recipe_list.GetRecipePacket(recipe_id, client, true, 0x2C);
-					if(outapp)
-						client->QueuePacket(outapp);
-					else
-						LogWrite(COMMAND__ERROR, 0, "Command", "Unknown Recipe ID: %u", recipe_id);
-				}
-				else if (strcmp(sep->arg[0], "maintained") ==0) {
-					int32 slot = atol(sep->arg[1]);
-					int32 spell_id = atol(sep->arg[2]);
-					LogWrite(COMMAND__DEBUG, 5, "Command", "Unknown Spell ID - Slot: %u unknown: %u", slot, spell_id);
-					//int8 tier = client->GetPlayer()->GetSpellTier(spell_id);
-					MaintainedEffects* info = client->GetPlayer()->GetMaintainedSpellBySlot(slot);
-					EQ2Packet* outapp = master_spell_list.GetSpellPacket(info->spell_id, info->tier, client, true, 0x00);
-					if(outapp)
-						client->QueuePacket(outapp);
-					else
-						LogWrite(COMMAND__ERROR, 0, "Command", "Unknown Spell ID: %u", spell_id);
-				}
-				else if (strcmp(sep->arg[0], "effect") == 0) {
-					int32 spell_id = atol(sep->arg[1]);
-					LogWrite(COMMAND__DEBUG, 5, "Command", "Unknown Spell ID: %u", spell_id);
-					int8 tier = client->GetPlayer()->GetSpellTier(spell_id);
-					int8 type = 0;
-					if (client->GetVersion() <= 546)
-						type = 1;
-					EQ2Packet* outapp = master_spell_list.GetSpecialSpellPacket(spell_id, tier, client, true, type);
-					if (outapp){
-						client->QueuePacket(outapp);
-					}
-					else
-						LogWrite(COMMAND__ERROR, 0, "Command", "Unknown Spell ID: %u", spell_id);
-				}
-			}
-			else if (sep && strcmp(sep->arg[0], "overflow") == 0) {
-				Item* item = player->item_list.GetOverflowItem();
-				if(item) {
-					EQ2Packet* app = item->serialize(client->GetVersion(), true, client->GetPlayer());
-					client->QueuePacket(app);
-				}
-				else
-					LogWrite(COMMAND__ERROR, 0,"Command", "Unable to retrieve an overflow item.");
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /info {inventory|equipment|spell} {id}");
-			break;
-						  }
-		case COMMAND_USE_EQUIPPED_ITEM:{
-			if (sep && sep->arg[0] && sep->IsNumber(0)){
-				int32 slot_id = atoul(sep->arg[0]);
-				Item* item = player->GetEquipmentList()->GetItem(slot_id);
-				if (item && item->generic_info.usable && item->GetItemScript())
-					lua_interface->RunItemScript(item->GetItemScript(), "used", item, player);
-			}
-			break;
-		}
-	    case COMMAND_USE_ITEM: {
-			if (sep && sep->arg[0] && sep->IsNumber(0)) {
-				int32 item_index = atoul(sep->arg[0]);
-				Item* item = player->item_list.GetItemFromIndex(item_index);
-				if (item && item->GetItemScript()) {
-					if (item->generic_info.max_charges == 0 || item->generic_info.max_charges == 0xFFFF)
-						lua_interface->RunItemScript(item->GetItemScript(), "used", item, player);
-					else {
-						if (item->details.count > 0) {
-							std::string itemName = string(item->name);
-							int32 item_id = item->details.item_id;
-							sint64 flags = 0;
-							if(lua_interface->RunItemScript(item->GetItemScript(), "used", item, player, &flags) && flags >= 0)
-							{
-								//reobtain item make sure it wasn't removed
-								item = player->item_list.GetItemFromIndex(item_index);
-								if(!item)
-									LogWrite(PLAYER__WARNING, 0, "Command", "%s: Item %s (%i) was used, however after the item looks to be removed.", client->GetPlayer()->GetName(), itemName.c_str(), item_id);
-								else if(!item->generic_info.display_charges && item->generic_info.max_charges == 1) {
-									client->Message(CHANNEL_NARRATIVE, "%s is out of charges.  It has been removed.", item->name.c_str());
-									client->RemoveItem(item, 1); // end of a set of charges OR an item that uses a stack count of actual item quantity
-								}
-								else
-								{
-									item->details.count--; // charges
-									item->save_needed = true;
-									client->QueuePacket(item->serialize(client->GetVersion(), false, client->GetPlayer()));
-
-									if(!item->details.count) {
-										client->Message(CHANNEL_NARRATIVE, "%s is out of charges.  It has been removed.", item->name.c_str());
-										client->RemoveItem(item, 1); // end of a set of charges OR an item that uses a stack count of actual item quantity
-									}
-								}
-							}
-							else
-									LogWrite(PLAYER__WARNING, 0, "Command", "%s: Item %s (%i) was used, after it returned %i, bypassing any removal/update of items.", client->GetPlayer()->GetName(), itemName.c_str(), item_id, flags);
-						}
-						else
-						{
-							//reobtain item make sure it wasn't removed
-							item = player->item_list.GetItemFromIndex(item_index);
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Item is out of charges.");
-							if(item) {
-								LogWrite(PLAYER__ERROR, 0, "Command", "%s: Item %s (%i) attempted to be used, however details.count is 0.", client->GetPlayer()->GetName(), item->name.c_str(), item->details.item_id);
-							}
-						}
-					}
-				}
-			}
-			break;
-							   }
-		case COMMAND_SCRIBE_SCROLL_ITEM: {
-			if (sep && sep->arg[0] && sep->IsNumber(0)) {
-				Item* item = player->item_list.GetItemFromUniqueID(atoul(sep->arg[0]));
-				if (item) {
-					LogWrite(ITEM__DEBUG, 0, "Items", "ITEM ID: %u", item->details.item_id);
-
-					if(item->generic_info.item_type == 6) {
-						Spell* spell = master_spell_list.GetSpell(item->skill_info->spell_id, item->skill_info->spell_tier);
-						int8 old_slot = 0;
-						if (spell) {
-
-							int16 tier_up = player->GetTierUp(spell->GetSpellTier());
-							if (rule_manager.GetGlobalRule(R_Spells, RequirePreviousTierScribe)->GetInt8() && !player->HasSpell(spell->GetSpellID(), tier_up, false, true))
-								client->SimpleMessage(CHANNEL_COLOR_RED, "You have not scribed the required previous version of this ability.");
-							else if (!player->HasSpell(spell->GetSpellID(), spell->GetSpellTier(), true)) {
-								old_slot = player->GetSpellSlot(spell->GetSpellID());
-								player->RemoveSpellBookEntry(spell->GetSpellID());
-								player->AddSpellBookEntry(spell->GetSpellID(), spell->GetSpellTier(), old_slot, spell->GetSpellData()->spell_book_type, spell->GetSpellData()->linked_timer, true);
-								player->UnlockSpell(spell);
-								client->SendSpellUpdate(spell);
-								database.DeleteItem(client->GetCharacterID(), item, 0);
-								player->item_list.RemoveItem(item, true);
-								client->QueuePacket(player->GetSpellBookUpdatePacket(client->GetVersion()));
-								client->QueuePacket(player->SendInventoryUpdate(client->GetVersion()));
-
-								// force purge client cache and display updated spell for hover over
-								EQ2Packet* app = spell->SerializeSpell(client, false, false);
-								client->QueuePacket(app);
-													}
-						}
-						else
-							LogWrite(COMMAND__ERROR, 0, "Command", "Unknown spell ID: %u and tier: %u", item->skill_info->spell_id, item->skill_info->spell_tier);
-					}
-					else if(item->generic_info.item_type == 7){
-						LogWrite(TRADESKILL__DEBUG, 0, "Recipe", "Scribing recipe book %s (%u) for player %s.", item->name.c_str(), item->details.item_id, player->GetName());
-						Recipe* recipe_book = new Recipe(master_recipebook_list.GetRecipeBooks(item->details.item_id));
-						// if valid recipe book and the player doesn't have it
-						if (recipe_book && recipe_book->GetLevel() > client->GetPlayer()->GetTSLevel()) {
-							client->Message(CHANNEL_NARRATIVE, "Your tradeskill level is not high enough to scribe this book.");
-							safe_delete(recipe_book);
-						}
-						else if (recipe_book && !(client->GetPlayer()->GetRecipeBookList()->HasRecipeBook(item->details.item_id))) {
-							LogWrite(TRADESKILL__DEBUG, 0, "Recipe", "Valid recipe book that the player doesn't have");
-							// Add recipe book to the players list
-							client->GetPlayer()->GetRecipeBookList()->AddRecipeBook(recipe_book);
-
-							// Get a list of all recipes this book contains
-							vector<Recipe*>* book_recipes = master_recipe_list.GetRecipes(recipe_book->GetBookName());
-							LogWrite(TRADESKILL__DEBUG, 0, "Recipe", "%i recipes found for %s book", book_recipes->size(), recipe_book->GetBookName());
-
-							// Create the packet to send to update the players recipe list
-							PacketStruct* packet = 0;
-							if (client->GetRecipeListSent()) {
-								packet = configReader.getStruct("WS_RecipeList", client->GetVersion());
-
-								if (packet)
-									packet->setArrayLengthByName("num_recipes", book_recipes->size());
-							}
-
-							// loop through the list
-							vector<Recipe*>::iterator itr;
-							int16 i = 0;
-							for (itr = book_recipes->begin(); itr != book_recipes->end(); itr++) {
-								// check to see if the player already has this recipe some how
-								if (!client->GetPlayer()->GetRecipeList()->GetRecipe((*itr)->GetID())) {
-									// Player doesn't already have this recipe so lets add it
-									Recipe* recipe = new Recipe(master_recipe_list.GetRecipe((*itr)->GetID()));
-									client->GetPlayer()->GetRecipeList()->AddRecipe(recipe);
-									database.SavePlayerRecipe(client->GetPlayer(), recipe->GetID());
-									client->Message(CHANNEL_NARRATIVE, "Recipe: \"%s\" put in recipe book.", recipe->GetName());
-
-									if (packet && client->GetRecipeListSent()) {
-										packet->setArrayDataByName("id", recipe->GetID(), i);
-										packet->setArrayDataByName("tier", recipe->GetTier(), i);
-										packet->setArrayDataByName("level", recipe->GetLevel(), i);
-										packet->setArrayDataByName("icon", recipe->GetIcon(), i);
-										packet->setArrayDataByName("classes", recipe->GetClasses(), i);
-										packet->setArrayDataByName("skill", recipe->GetSkill(), i);
-										packet->setArrayDataByName("technique", recipe->GetTechnique(), i);
-										packet->setArrayDataByName("knowledge", recipe->GetKnowledge(), i);
-										packet->setArrayDataByName("unknown2", recipe->GetUnknown2(), i);
-										packet->setArrayDataByName("recipe_name", recipe->GetName(), i);
-										packet->setArrayDataByName("recipe_book", recipe->GetBook(), i);
-										packet->setArrayDataByName("unknown3", recipe->GetUnknown3(), i);
-										i++;
-									}
-								}
-							}
-							LogWrite(TRADESKILL__DEBUG, 0, "Recipe", "Done adding recipes");
-							database.SavePlayerRecipeBook(client->GetPlayer(), recipe_book->GetBookID());
-							database.DeleteItem(client->GetCharacterID(), item, 0);
-							client->GetPlayer()->item_list.RemoveItem(item, true);
-							client->QueuePacket(client->GetPlayer()->SendInventoryUpdate(client->GetVersion()));
-							if (packet && client->GetRecipeListSent())
-								client->QueuePacket(packet->serialize());
-
-							safe_delete(packet);
-						}
-						else {
-							if (recipe_book)
-								client->Message(CHANNEL_NARRATIVE, "You have already learned all you can from this item.");
-							safe_delete(recipe_book);
-						}
-						
-					}
-				}
-				else
-					LogWrite(COMMAND__ERROR, 0, "Command", "Unknown unique item ID: %s", sep->arg[0]);
-			}
-			break;
-		}
-		case COMMAND_SUMMONITEM: {
-			if (sep && sep->IsNumber(0)) {
-				int32 item_id = atol(sep->arg[0]);
-				int32 quantity = 1;
-				
-				if (sep->arg[1] && sep->IsNumber(1))
-					quantity = atoi(sep->arg[1]);
-				
-				if (sep->arg[2] && strncasecmp(sep->arg[2], "bank", 4) == 0) {
-					client->AddItemToBank(item_id,quantity);
-				}
-				else {
-					client->AddItem(item_id, quantity);
-				}
-			}
-			else {
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /summonitem {item_id} [quantity] or");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /summonitem {item_id} {quantity} [location] where location = bank");
-			}
-			break;
-		}
-		case COMMAND_COLLECTION_ADDITEM: {
-			// takes 2 params: collection_id, slot
-			if (sep && sep->arg[0] && sep->arg[1] && sep->IsNumber(0) && sep->IsNumber(1)) {
-				Item *item = client->GetPlayer()->GetPlayerItemList()->GetItemFromIndex(atoul(sep->arg[1]));
-				if (item)
-					client->HandleCollectionAddItem(atoul(sep->arg[0]), item);
-				else
-					LogWrite(COLLECTION__ERROR, 0, "Collect", "Error in 'COMMAND_COLLECTION_ADDITEM'. Unable to get item from player '%s' at index %u", client->GetPlayer()->GetName(), atoul(sep->arg[0]));
-			}
-			else
-				LogWrite(COLLECTION__ERROR, 0, "Collect", "Received command 'COMMAND_COLLECTION_ADDITEM' with unhandeled argument types");
-			break;
-		}
-		case COMMAND_COLLECTION_FILTER_MATCHITEM: {
-			// takes 1 param: slot
-			printf("COMMAND_COLLECTION_FILTER_MATCHITEM:\n");
-			int i = 0;
-			while (sep->arg[i] && strlen(sep->arg[i]) > 0) {
-				printf("\t%u: %s\n", i, sep->arg[i]);
-				i++;
-			}
-			break;
-		}
-		case COMMAND_WAYPOINT: {
-			bool success = false;
-			client->ClearWaypoint();
-			if (sep && sep->IsNumber(0) && sep->IsNumber(1) && sep->IsNumber(2)) {
-				if (!client->ShowPathToTarget(atof(sep->arg[0]), atof(sep->arg[1]), atof(sep->arg[2]), 0))
-					client->Message(CHANNEL_COLOR_RED, "Invalid coordinates given");
-			}
-			else if ( client->GetAdminStatus() > 100 && cmdTarget ) {
-				if (!client->ShowPathToTarget(cmdTarget->GetX(), cmdTarget->GetY(), cmdTarget->GetZ(), 0))
-					client->Message(CHANNEL_COLOR_RED, "Invalid coordinates given");
-			}
-			else {
-				client->Message(CHANNEL_COLOR_YELLOW, "Usage: /waypoint x y z");
-			}
-			break;
-		}
-		case COMMAND_WHO:{
-			const char* who = 0;
-			if(sep && sep->arg[0]){
-				//cout << "Who query: \n";
-				who = sep->argplus[0];
-				//cout << who << endl;
-			}
-			zone_list.ProcessWhoQuery(who, client);
-			break;
-						 }
-		case COMMAND_SELECT_JUNCTION:{
-			LogWrite(MISC__TODO, 1, "TODO", "For access/travel selections (i.e. Mariner Bells, Player Death Window, etc.)\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-			int32 choice = 0;
-			if(sep && sep->arg[0] && sep->IsNumber(0))
-				choice = atoul(sep->arg[0]);
-			if(client->GetPlayer()->GetHP() == 0){ //dead and this is a revive request
-				client->HandlePlayerRevive(choice);
-			}
-			break;
-									 }
-		case COMMAND_SPAWN_MOVE: {
-			if (cmdTarget && cmdTarget->IsPlayer() == false) {
-				PacketStruct* packet = configReader.getStruct("WS_MoveObjectMode", client->GetVersion());
-				if (packet) {
-					float unknown2_3 = 0;
-					int8 placement_mode = 0;
-					client->SetSpawnPlacementMode(Client::ServerSpawnPlacementMode::DEFAULT);
-					if (sep && sep->arg[0][0]) {
-						if (strcmp(sep->arg[0], "wall") == 0) {
-							placement_mode = 2;
-							unknown2_3 = 150;
-						}
-						else if (strcmp(sep->arg[0], "ceiling") == 0)
-							placement_mode = 1;
-						else if (strcmp(sep->arg[0], "openheading") == 0 && cmdTarget->IsWidget())
-						{
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW, "[PlacementMode] WIDGET OPEN HEADING MODE");
-							client->SetSpawnPlacementMode(Client::ServerSpawnPlacementMode::OPEN_HEADING);
-						}
-						else if (strcmp(sep->arg[0], "closeheading") == 0 && cmdTarget->IsWidget())
-						{
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW, "[PlacementMode] WIDGET CLOSE HEADING MODE");
-							client->SetSpawnPlacementMode(Client::ServerSpawnPlacementMode::CLOSE_HEADING);
-						}
-						else if (strcmp(sep->arg[0], "myloc") == 0)
-						{
-							if (cmdTarget->GetSpawnLocationPlacementID() < 1) {
-								client->Message(CHANNEL_COLOR_YELLOW, "[PlacementMode] Spawn %s cannot be moved it is not assigned a spawn location placement id.", cmdTarget->GetName());
-								safe_delete(packet);
-								break;
-							}
-
-							cmdTarget->SetX(client->GetPlayer()->GetX(), true);
-							cmdTarget->SetY(client->GetPlayer()->GetY(), true);
-							cmdTarget->SetZ(client->GetPlayer()->GetZ(), true);
-							cmdTarget->SetHeading(client->GetPlayer()->GetHeading(), true);
-
-							if (database.UpdateSpawnLocationSpawns(cmdTarget))
-								client->Message(CHANNEL_COLOR_YELLOW, "[PlacementMode] Spawn %s placed at your location.  Updated spawn_location_placement for spawn.", cmdTarget->GetName());
-							safe_delete(packet);
-							break;
-						}
-					}
-					packet->setDataByName("placement_mode", placement_mode);
-					packet->setDataByName("spawn_id", client->GetPlayer()->GetIDWithPlayerSpawn(cmdTarget));
-					packet->setDataByName("model_type", cmdTarget->GetModelType());
-					packet->setDataByName("unknown", 1); //size
-					packet->setDataByName("unknown2", 1); //size 2
-					packet->setDataByName("unknown2", .5, 1); //size 3
-					packet->setDataByName("unknown2", 3, 2);
-					packet->setDataByName("unknown2", unknown2_3, 3);
-					packet->setDataByName("max_distance", 500);
-					packet->setDataByName("CoEunknown", 0xFFFFFFFF);
-					client->QueuePacket(packet->serialize());
-					safe_delete(packet);
-				}
-			}
-			else {
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /spawn move (wall OR ceiling)");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Moves a spawn anywhere you like.  Optionally wall/ceiling can be provided to place wall/ceiling items.");
-			}
-			break;
-		}
-		case COMMAND_HAIL:{
-			Spawn* spawn = cmdTarget;
-			if(spawn && spawn->GetTargetable())
-			{
-				char tmp[75] = {0};
-
-				sprintf(tmp, "Hail, %s", spawn->GetName());
-
-				bool show_bubble = true;
-
-				if (spawn->IsNPC())
-					show_bubble = false;
-				client->GetCurrentZone()->HandleChatMessage(client->GetPlayer(), 0, CHANNEL_SAY, tmp, HEAR_SPAWN_DISTANCE, 0, show_bubble);
-				if(spawn->IsPlayer() == false && spawn->Alive() && spawn->GetDistance(client->GetPlayer()) < rule_manager.GetGlobalRule(R_Spawn, HailDistance)->GetInt32()){
-					if(spawn->IsNPC() && ((NPC*)spawn)->EngagedInCombat())
-						spawn->GetZone()->CallSpawnScript(spawn, SPAWN_SCRIPT_HAILED_BUSY, client->GetPlayer());
-					else
-					{
-						bool pauseRunback = false;
-						// prime runback as the heading or anything can be altered when hailing succeeds
-						if(spawn->IsNPC() && (spawn->HasMovementLoop() || spawn->HasMovementLocations()))
-						{
-							((NPC*)spawn)->StartRunback();
-							pauseRunback = true;
-						}
-
-						if(spawn->GetZone()->CallSpawnScript(spawn, SPAWN_SCRIPT_HAILED, client->GetPlayer()) && pauseRunback)
-							spawn->PauseMovement(rule_manager.GetGlobalRule(R_Spawn, HailMovementPause)->GetInt32());
-						else if(spawn->IsNPC() && pauseRunback)
-							((NPC*)spawn)->ClearRunback();
-					}
-				}
-			}
-			else {
-				string tmp = "Hail";
-				client->GetCurrentZone()->HandleChatMessage(client->GetPlayer(), 0, CHANNEL_SAY, tmp.c_str(), HEAR_SPAWN_DISTANCE, 0, true);
-			}
-			break;
-						  }
-		case COMMAND_SAY:{
-			if (sep && sep->arg[0][0]) {
-				client->GetCurrentZone()->HandleChatMessage(client->GetPlayer(), 0, CHANNEL_SAY, sep->argplus[0], HEAR_SPAWN_DISTANCE);
-				if (cmdTarget && !(cmdTarget->IsPlayer()))
-					client->GetCurrentZone()->CallSpawnScript(cmdTarget, SPAWN_SCRIPT_HEAR_SAY, client->GetPlayer(), sep->argplus[0]);
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /say {message}");
-			break;
-						 }
-		case COMMAND_TELL:{
-			if(sep && sep->arg[0] && sep->argplus[1]){
-				if(!zone_list.HandleGlobalChatMessage(client, sep->arg[0], CHANNEL_PRIVATE_TELL, sep->argplus[1]))
-					client->Message(CHANNEL_COLOR_RED,"Unable to find client %s",sep->arg[0]);
-			}else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /tell {character_name} {message}");
-			break;
-						  }
-		case COMMAND_SHOUT:{
-			if(sep && sep->arg[0][0])
-				client->GetCurrentZone()->HandleChatMessage(client->GetPlayer(), 0, CHANNEL_SHOUT, sep->argplus[0]);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /shout {message}");
-			break;
-						   }
-		case COMMAND_AUCTION:{
-			if(sep && sep->arg[0][0])
-				client->GetCurrentZone()->HandleChatMessage(client->GetPlayer(), 0, CHANNEL_AUCTION, sep->argplus[0]);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /auction {message}");
-			break;
-							 }
-		case COMMAND_OOC:{
-			//For now ooc will be the global chat channel, eventually when we create more channels we will create a global chat channel
-			if(sep && sep->arg[0][0])
-				zone_list.HandleGlobalChatMessage(client, 0, CHANNEL_OUT_OF_CHARACTER, sep->argplus[0]);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /ooc {message}");
-			break;
-						 }
-		case COMMAND_EMOTE:{
-			if(sep && sep->arg[0][0])
-				client->GetCurrentZone()->HandleChatMessage(client->GetPlayer(), 0, CHANNEL_EMOTE, sep->argplus[0]);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /emote {action}");
-			break;
-						   }
-		case COMMAND_RACE:{
-			if(sep && sep->arg[0][0] && sep->IsNumber(0)){
-				if(sep->arg[1][0] && sep->IsNumber(1)){
-					client->GetPlayer()->GetInfoStruct()->set_race(atoi(sep->arg[1]));
-					client->GetPlayer()->SetRace(atoi(sep->arg[1]));
-					client->UpdateTimeStampFlag ( RACE_UPDATE_FLAG );
-					client->GetPlayer()->SetCharSheetChanged(true);
-				}
-				client->GetPlayer()->SetModelType(atoi(sep->arg[0]));
-				//EQ2Packet* outapp = client->GetPlayer()->spawn_update_packet(client->GetPlayer(), client->GetVersion(), client->GetPlayer()->GetFeatures());
-				//client->QueuePacket(outapp);
-			}
-			else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /race {race type id} {race id}");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "{race id} is optional");
-			}
-			break;
-						  }
-		case COMMAND_BANK_DEPOSIT:{
-			if(client->GetBanker() && sep && sep->arg[0]){
-				int64 amount = 0;
-				string deposit = string(sep->arg[0]);
-				amount = atoi64(deposit.c_str());
-				client->BankDeposit(amount);
-			}
-			break;
-								  }
-		case COMMAND_BANK_WITHDRAWAL:{
-			if(client->GetBanker() && sep && sep->arg[0] && sep->IsNumber(0)){
-				int64 amount = 0;
-				string deposit = string(sep->arg[0]);
-				amount = atoi64(deposit.c_str());
-				client->BankWithdrawal(amount);
-			}
-			break;
-									 }
-		case COMMAND_BANK_CANCEL:{
-			Spawn* banker = cmdTarget;
-			client->Bank(banker, true);
-			break;
-								 }
-		case COMMAND_BANK:{
-			LogWrite(PLAYER__DEBUG, 0, "Players", "Open Player Personal Bank...");
-			Spawn* banker = cmdTarget;
-			client->Bank(banker);
-			break;
-						  }
-		case COMMAND_GUILD_BANK:{
-			LogWrite(GUILD__DEBUG, 0, "Guilds", "Open Guild Bank...");
-			//Spawn* banker = client->GetPlayer()->GetTarget();
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "This will eventually open the guild bank!");
-			break;
-						  }
-		case COMMAND_START_MAIL: {
-			client->SetMailTransaction(cmdTarget);
-			client->SendMailList();
-			break;
-								}
-		case COMMAND_CANCEL_MAIL: {
-			client->SetMailTransaction(0);
-			break;
-								  }
-		case COMMAND_GET_MAIL_MESSAGE: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->DisplayMailMessage(atoul(sep->arg[0]));
-			break;
-									   }
-		case COMMAND_ADD_MAIL_PLAT: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->AddMailCoin(0, 0, 0, atoul(sep->arg[0]));
-			break;
-									}
-		case COMMAND_ADD_MAIL_GOLD: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->AddMailCoin(0, 0, atoul(sep->arg[0]));
-			break;
-									}
-		case COMMAND_ADD_MAIL_SILVER: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->AddMailCoin(0, atoul(sep->arg[0]));
-			break;
-									  }
-		case COMMAND_ADD_MAIL_COPPER: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->AddMailCoin(atoul(sep->arg[0]));
-			break;
-									  }
-		case COMMAND_SET_MAIL_ITEM: {
-			if(sep && sep->IsNumber(0) && sep->IsNumber(2))
-			{
-				Item* item = client->GetPlayer()->item_list.GetItemFromIndex(atoul(sep->arg[0]));
-				if(item)
-				{
-					int16 quantity = atoul(sep->arg[1]);
-					if(item->CheckFlag(NO_TRADE) || item->CheckFlag(ATTUNED) || item->CheckFlag(ARTIFACT) || item->CheckFlag2(HEIRLOOM))
-					{
-						return;
-					}
-					if(item->IsBag())
-					{
-						vector<Item*>* bag_items = player->GetPlayerItemList()->GetItemsInBag(item);
-						if(bag_items && bag_items->size() > 0)
-						{
-							client->SimpleMessage(CHANNEL_COLOR_RED,"You cannot mail a bag with items inside it.");
-							safe_delete(bag_items);
-							return;
-						}
-						safe_delete(bag_items);
-					}
-					Item* itemtoadd = item;
-					if(quantity > 0)
-					{
-						if(quantity > item->details.count)
-							return;
-
-						Item* tmpItem = new Item(item);
-						tmpItem->details.count = quantity;
-						itemtoadd = tmpItem;
-					}
-						
-					if(client->AddMailItem(itemtoadd))
-					{
-						client->RemoveItem(item, quantity, true);
-					}
-				}
-			}
-			break;
-							   }
-		case COMMAND_REMOVE_MAIL_PLAT: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->RemoveMailCoin(0, 0, 0, atoul(sep->arg[0]));
-			break;
-									   }
-		case COMMAND_REMOVE_MAIL_GOLD: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->RemoveMailCoin(0, 0, atoul(sep->arg[0]));
-			break;
-									   }
-		case COMMAND_REMOVE_MAIL_SILVER: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->RemoveMailCoin(0, atoul(sep->arg[0]));
-			break;
-										 }
-		case COMMAND_REMOVE_MAIL_COPPER: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->RemoveMailCoin(atoul(sep->arg[0]));
-			break;
-										 }
-		case COMMAND_TAKE_MAIL_ATTACHMENTS: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->TakeMailAttachments(atoul(sep->arg[0]));
-			break;
-											}
-		case COMMAND_CANCEL_SEND_MAIL: {
-			client->ResetSendMail();
-			break;
-									   }
-		case COMMAND_DELETE_MAIL_MESSAGE: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->DeleteMail(atoul(sep->arg[0]), true);
-			break;
-										  }
-		case COMMAND_REPORT_SPAM: {
-			LogWrite(MISC__TODO, 1, "TODO", " received reportspam\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-			if (sep && sep->arg[0]) LogWrite(COMMAND__DEBUG, 0, "Command", "%s\n", sep->argplus[0]);
-			break;
-								  }
-		case COMMAND_KILL:{
-			Spawn* dead = 0;
-			if (sep && sep->arg[0] && strncasecmp(sep->arg[0],"self",4)==0){
-				dead=client->GetPlayer();
-				client->GetPlayer()->SetHP(0);
-				client->GetPlayer()->KillSpawn(dead);
-			}else{
-				dead= cmdTarget;
-				if(dead && dead->IsPlayer() == false){
-					dead->SetHP(0);
-					if(sep && sep->arg[0] && sep->IsNumber(0) && atoi(sep->arg[0]) == 1)
-						client->GetCurrentZone()->RemoveSpawn(dead, true, true, true, true, true);
-					else
-						client->GetPlayer()->KillSpawn(dead);
-				}else{
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /kill (self)");
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Kills currently selected non-player target.");
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Optionally, self may be used to kill yourself");
-				}
-			}
-			break;
-						  }
-		case COMMAND_LEVEL:{
-			if(sep && sep->arg[ndx][0] && sep->IsNumber(0)){
-				int16 new_level = atoi(sep->arg[ndx]);
-				if (!client->GetPlayer()->CheckLevelStatus(new_level))
-					client->SimpleMessage(CHANNEL_COLOR_RED, "You do not have the required status to level up anymore!");
-				else {
-					if (new_level < 1)
-						new_level = 1;
-					
-					if (new_level > 255)
-						new_level = 255;
-
-					client->ChangeLevel(client->GetPlayer()->GetLevel(), new_level);
-				}
-			}else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage: /level {new_level}");
-			break;
-						   }
-		case COMMAND_SIT: {
-			LogWrite(MISC__TODO, 1, "TODO", " Send update packet to all clients\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-			if(client->GetPlayer()->GetHP() > 0){
-				client->QueuePacket(new EQ2Packet(OP_SitMsg, 0, 0));
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"You sit down.");
-				client->GetPlayer()->set_character_flag(CF_IS_SITTING);
-			}
-			break;
-						  }
-		case COMMAND_STAND: {
-			LogWrite(MISC__TODO, 1, "TODO", " Send update packet to all clients\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-			if(client->GetPlayer()->GetHP() > 0){
-				client->QueuePacket(new EQ2Packet(OP_StandMsg, 0, 0));
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"You stand up.");
-				client->GetPlayer()->reset_character_flag(CF_IS_SITTING);
-			}
-			break;
-							}
-		case COMMAND_CLASS:{
-			if(sep && sep->arg[ndx][0]){
-				client->GetPlayer()->SetPlayerAdventureClass(atoi(sep->arg[ndx]));
-				client->UpdateTimeStampFlag ( CLASS_UPDATE_FLAG );
-			}else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /class {class_id}");
-			break;
-						   }
-		case COMMAND_GENDER:{
-			if(sep && sep->arg[ndx][0]){
-				client->GetPlayer()->GetInfoStruct()->set_gender(atoi(sep->arg[ndx]));
-				client->GetPlayer()->SetCharSheetChanged(true);
-				client->UpdateTimeStampFlag ( GENDER_UPDATE_FLAG );
-			}else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage:  /gender {new_gender_id}");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"  Male: 1");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"  Female: 2");
-			}
-			break;
-							}
-		case COMMAND_FLYMODE:{
-			if(sep && sep->arg[0] && sep->IsNumber(0)){
-				PrintSep(sep, "COMMAND_FLYMODE");
-				int8 val = atoi(sep->arg[0]);
-				ClientPacketFunctions::SendFlyMode(client, val);
-			}
-			else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage ON: /flymode 1");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage OFF: /flymode 0");
-			}
-			break;
-							 }
-		case COMMAND_LOOT_LIST:{
-			Spawn* spawn = cmdTarget;
-			if(spawn && spawn->IsEntity()){
-				if (sep && sep->arg[0]) {
-					if (!spawn->GetDatabaseID())
-					{
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Spawn has no database id to assign to loottables.");
-						break;
-					}
-					else if (!spawn->IsNPC())
-					{
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "these /loot list [add/remove/clearall] sub-commands are only designed for an NPC.");
-						break;
-					}
-
-					bool reloadLoot = false;
-					if (!stricmp(sep->arg[0], "remove") && sep->arg[1] && sep->IsNumber(1))
-					{
-						int32 loottable_id = atoul(sep->arg[1]);
-						if (loottable_id > 0 && database.RemoveSpawnLootTable(spawn, loottable_id))
-						{
-							client->Message(CHANNEL_COLOR_YELLOW, "Spawn %u loot table %u removed.", spawn->GetDatabaseID(), loottable_id);
-							reloadLoot = true;
-						}
-						else
-							client->Message(CHANNEL_COLOR_YELLOW, "/loot list remove [loottableid] - could not match any spawn_id entries against loottable_id %u.", loottable_id);
-					}
-					else if (!stricmp(sep->arg[0], "add") && sep->arg[1] && sep->IsNumber(1))
-					{
-
-						int32 loottable_id = atoul(sep->arg[1]);
-						if (loottable_id > 0)
-						{
-							database.AddLootTableToSpawn(spawn, loottable_id);
-							client->Message(CHANNEL_COLOR_YELLOW, "Spawn %u loot table %u added.", spawn->GetDatabaseID(), loottable_id);
-							reloadLoot = true;
-						}
-						else
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/loot list add [loottableid] - cannot add a loottable id of 0.");
-					}
-					else if (!stricmp(sep->arg[0], "clearall"))
-					{
-						if (database.RemoveSpawnLootTable(spawn, 0))
-						{
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Spawn loot tables removed.");
-							reloadLoot = true;
-						}
-						else
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/loot list clearall - could not match any spawn_id entries in loottable_id.");
-					}
-					else
-					{
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/loot list argument not supported.");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/loot list add [loottableid] - add new loottable to spawn");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/loot list remove [loottableid] - remove existing loottable from spawn");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/loot list clearall - remove all loottables from spawn");
-						break;
-					}
-					
-					if (reloadLoot)
-					{
-							database.LoadSpawnLoot(spawn->GetZone(), spawn);
-							if (spawn->IsNPC())
-							{
-								Entity* ent = (Entity*)spawn;
-								ent->SetLootCoins(0);
-								ent->ClearLoot();
-								spawn->GetZone()->AddLoot((NPC*)spawn);
-								client->Message(CHANNEL_COLOR_YELLOW, "Spawn %u active loot purged and reloaded.", spawn->GetDatabaseID());
-							}
-					}
-					break; // nothing further this is the end of these sub commands
-				}
-				else
-				{
-					vector<int32> loot_list = client->GetCurrentZone()->GetSpawnLootList(spawn->GetDatabaseID(), spawn->GetZone()->GetZoneID(), spawn->GetLevel(), race_types_list.GetRaceType(spawn->GetModelType()), spawn);
-					if (loot_list.size() > 0) {
-						client->Message(CHANNEL_COLOR_YELLOW, "%s belongs to the following loot lists: ", spawn->GetName());
-						vector<int32>::iterator list_itr;
-						LootTable* table = 0;
-						for (list_itr = loot_list.begin(); list_itr != loot_list.end(); list_itr++) {
-							table = client->GetCurrentZone()->GetLootTable(*list_itr);
-							if (table)
-								client->Message(CHANNEL_COLOR_YELLOW, "%u - %s", *list_itr, table->name.c_str());
-						}
-					}
-					client->Message(CHANNEL_COLOR_YELLOW, "Coins being carried: %u", spawn->GetLootCoins());
-					vector<Item*>* items = spawn->GetLootItems();
-					if (items) {
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Spawn is carrying the following items: ");
-						vector<Item*>::iterator itr;
-						Item* item = 0;
-						for (itr = items->begin(); itr != items->end(); itr++) {
-							item = *itr;
-							client->Message(CHANNEL_COLOR_YELLOW, "%u - %s", item->details.item_id, item->name.c_str());
-						}
-					}
-					else
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Spawn is not carrying any items.");
-				}
-			}
-			break;
-							   }
-		case COMMAND_LOOT_SETCOIN:{
-			Spawn* spawn = cmdTarget;
-			if(spawn && spawn->IsEntity() && sep && sep->arg[0] && sep->IsNumber(0)){
-				spawn->SetLootCoins(atoul(sep->arg[0]));
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Successfully set coins.");
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /loot setcoin {amount}");
-			break;
-								  }
-		case COMMAND_LOOT_ADDITEM:{
-			Spawn* spawn = cmdTarget;
-			if(spawn && spawn->IsEntity() && sep && sep->arg[0] && sep->IsNumber(0)){
-				int16 charges = 1;
-				if(sep->arg[1] && sep->IsNumber(1))
-					charges = atoi(sep->arg[1]);
-				spawn->AddLootItem(atoul(sep->arg[0]), charges);
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Successfully added item.");
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /loot additem {item_id}");
-			break;
-								  }
-		case COMMAND_LOOT_REMOVEITEM:{
-			Spawn* spawn = cmdTarget;
-			if(spawn && spawn->IsEntity() && sep && sep->arg[0] && sep->IsNumber(0)){
-				Item* item = spawn->LootItem(atoul(sep->arg[0]));
-				safe_delete(item);
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Successfully removed item.");
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /loot removeitem {item_id}");
-			break;
-									 }
-		case COMMAND_LOOT_CORPSE:
-		case COMMAND_DISARM:
-		case COMMAND_LOOT:{
-			if (cmdTarget && ((Entity*)cmdTarget)->IsNPC() && cmdTarget->Alive())
-			{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Your target is not dead.");
-				break;
-			}
-
-			if(cmdTarget && cmdTarget->IsEntity()){
-				if (cmdTarget->GetDistance(client->GetPlayer()) <= rule_manager.GetGlobalRule(R_Loot, LootRadius)->GetFloat()){
-					if (!rule_manager.GetGlobalRule(R_Loot, AutoDisarmChest)->GetBool() && command->handler == COMMAND_DISARM )
-						client->OpenChest(cmdTarget, true);
-					else
-						client->Loot(cmdTarget, rule_manager.GetGlobalRule(R_Loot, AutoDisarmChest)->GetBool());
-					if (!(cmdTarget)->HasLoot()){
-						if (((Entity*)cmdTarget)->IsNPC())
-							client->GetCurrentZone()->RemoveDeadSpawn(cmdTarget);
-					}
-				}
-				else
-					client->Message(CHANNEL_COLOR_YELLOW, "You are too far away to interact with that");
-			}
-			else if(!cmdTarget || cmdTarget->GetHP() > 0)
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Invalid target.");
-			break;
-						  }
-		case COMMAND_RELOADSPAWNSCRIPTS:{
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Spawn Scripts....");
-			if (lua_interface)
-				lua_interface->SetLuaSystemReloading(true);
-			world.ResetSpawnScripts();
-			database.LoadSpawnScriptData();
-			if(lua_interface) {
-				lua_interface->DestroySpawnScripts();
-				lua_interface->SetLuaSystemReloading(false);
-			}
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Success!");
-			break;
-										}
-		case COMMAND_RELOADREGIONSCRIPTS:{
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Region Scripts....");
-			if(lua_interface) {
-				lua_interface->DestroyRegionScripts();
-			}
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Success!");
-			break;
-										}
-		case COMMAND_RELOADLUASYSTEM:{
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Attempting to reload entire LUA system....");
-
-			world.SetReloadingSubsystem("LuaSystem");
-			
-			if(lua_interface) {
-				lua_interface->SetLuaSystemReloading(true);
-			}
-			
-			zone_list.DeleteSpellProcess();
-			master_spell_list.Reload();
-			if (lua_interface)
-				lua_interface->ReloadSpells();
-			zone_list.LoadSpellProcess();
-			if(lua_interface){
-				map<Client*, int32> debug_clients = lua_interface->GetDebugClients();
-				map<Client*, int32>::iterator itr;
-				for(itr = debug_clients.begin(); itr != debug_clients.end(); itr++){
-					if(lua_interface)
-						lua_interface->UpdateDebugClients(itr->first);
-				}
-			}
-
-			world.ResetSpawnScripts();
-			database.LoadSpawnScriptData();
-
-			world.ResetZoneScripts();
-			database.LoadZoneScriptData();
-
-			if(lua_interface) {
-				lua_interface->DestroySpawnScripts();
-				lua_interface->DestroyRegionScripts();
-				lua_interface->DestroyQuests();
-				lua_interface->DestroyItemScripts();
-				lua_interface->DestroyZoneScripts();
-			}
-
-			int32 quest_count = database.LoadQuests();
-
-			int32 spell_count = 0;
-
-			if(lua_interface) {
-				spell_count = database.LoadSpellScriptData();
-				lua_interface->SetLuaSystemReloading(false);
-			}
-
-			world.RemoveReloadingSubSystem("LuaSystem");
-
-			client->Message(CHANNEL_COLOR_YELLOW, "Successfully loaded %u spell(s), %u quest(s).", spell_count, quest_count);
-			break;
-									 }
-		case COMMAND_DECLINE_QUEST:{
-			int32 quest_id = 0;
-			if(sep && sep->arg[0] && sep->IsNumber(0))
-				quest_id = atoul(sep->arg[0]);
-			if(quest_id > 0){
-				Quest* quest = client->GetPendingQuest(quest_id);
-				if(quest){
-					client->RemovePendingQuest(quest);
-					if(lua_interface)
-						lua_interface->CallQuestFunction(quest, "Declined", client->GetPlayer());
-					safe_delete(quest);
-					client->GetCurrentZone()->SendQuestUpdates(client);
-				}
-			}
-			break;
-								   }
-		case COMMAND_DELETE_QUEST:{
-			int32 quest_id = 0;
-			if(sep && sep->arg[0] && sep->IsNumber(0))
-				quest_id = atoul(sep->arg[0]);
-			if(quest_id > 0){
-				if(lua_interface && client->GetPlayer()->player_quests.count(quest_id) > 0) {
-					Quest* quest = client->GetPlayer()->player_quests[quest_id];
-					if (quest)
-						lua_interface->CallQuestFunction(quest, "Deleted", client->GetPlayer());
-				}
-				client->RemovePlayerQuest(quest_id);
-				client->GetCurrentZone()->SendQuestUpdates(client);
-			}
-			break;
-								  }
-		case COMMAND_ACCEPT_QUEST:{
-			int32 quest_id = 0;
-			if(sep && sep->arg[0] && sep->IsNumber(0))
-				quest_id = atoul(sep->arg[0]);
-			if(quest_id > 0){
-				client->AcceptQuest(quest_id);
-			}
-			break;
-								  }
-		case COMMAND_NAME:{
-			if(sep && sep->arg[ndx][0]){
-				client->GetPlayer()->GetInfoStruct()->set_name(std::string(sep->arg[ndx]).substr(0,39));
-				client->GetPlayer()->SetCharSheetChanged(true);
-			}else
-				client->Message(CHANNEL_COLOR_YELLOW,"Usage: /name {new_name}");
-
-			break;
-		}
-		case COMMAND_GROUPSAY:{
-			GroupMemberInfo* gmi = client->GetPlayer()->GetGroupMemberInfo();
-			if(sep && sep->arg[0] && gmi)
-				world.GetGroupManager()->GroupChatMessage(gmi->group_id, client->GetPlayer(), sep->argplus[0]);
-			break;
-		}
-		case COMMAND_GROUPINVITE: {
-			Entity* target = 0;
-			Client* target_client = 0;
-
-			if (client->GetPlayer()->GetGroupMemberInfo() && !client->GetPlayer()->GetGroupMemberInfo()->leader) {
-				client->SimpleMessage(CHANNEL_COMMANDS, "You must be the group leader to invite.");
-				return;
-			}
-
-			// name provided with command so it has to be a player, npc not supported here
-			if (sep && sep->arg[0] && strlen(sep->arg[0]) > 0){
-				target_client = zone_list.GetClientByCharName(sep->arg[0]);
-				if (target_client) {
-					if (!target_client->IsConnected() || !target_client->IsReadyForSpawns())
-						target = 0;
-					else
-						target = target_client->GetPlayer();
-				}
-			}
-
-			// if name was not provided use the players target, npc or player supported here
-			if (!target && client->GetPlayer()->GetTarget() && client->GetPlayer()->GetTarget()->IsEntity()) {
-				target = (Entity*)client->GetPlayer()->GetTarget();
-				if (target->IsPlayer()) {
-					target_client = client->GetCurrentZone()->GetClientBySpawn(target);
-				}
-			}
-
-			int8 result = world.GetGroupManager()->Invite(client->GetPlayer(), target);
-
-			if (result == 0) {
-				client->Message(CHANNEL_COMMANDS, "You invite %s to group with you.", target->GetName());
-				if (target_client) {
-					PacketStruct* packet = configReader.getStruct("WS_ReceiveOffer", target_client->GetVersion());
-					if (packet) {
-						packet->setDataByName("type", 1);
-						packet->setDataByName("name", client->GetPlayer()->GetName());
-						packet->setDataByName("unknown2", 1);
-						target_client->QueuePacket(packet->serialize());
-						safe_delete(packet);
-					}
-				}
-			}
-			else if (result == 1)
-				client->SimpleMessage(CHANNEL_COMMANDS, "That player is already in a group.");
-			else if (result == 2)
-				client->SimpleMessage(CHANNEL_COMMANDS, "That player has been invited to another group.");
-			else if (result == 3)
-				client->SimpleMessage(CHANNEL_COMMANDS, "Your group is already full.");
-			else if (result == 4)
-				client->SimpleMessage(CHANNEL_COMMANDS, "You have a pending invitation, cancel it first.");
-			else if (result == 5)
-				client->SimpleMessage(CHANNEL_COMMANDS, "You cannot invite yourself!");
-			else if (result == 6)
-				client->SimpleMessage(CHANNEL_COMMANDS, "Could not locate the player.");
-			else
-				client->SimpleMessage(CHANNEL_COMMANDS, "Group invite failed, unknown error!");
-
-			break;
-		}
-		case COMMAND_GROUPDISBAND: {
-			GroupMemberInfo* gmi = client->GetPlayer()->GetGroupMemberInfo();
-
-			if (gmi) { // TODO: Leader check
-				// world.GetGroupManager()->SimpleGroupMessage(gmi->group_id, "Your group has been disbanded.");
-				world.GetGroupManager()->RemoveGroup(gmi->group_id);
-			}
-
-			break;
-		}
-		case COMMAND_GROUP_LEAVE: {
-			GroupMemberInfo* gmi = client->GetPlayer()->GetGroupMemberInfo();
-
-			if (gmi) {
-				int32 group_id = gmi->group_id;
-				world.GetGroupManager()->RemoveGroupMember(group_id, client->GetPlayer());
-				if (!world.GetGroupManager()->IsGroupIDValid(group_id)) {
-					// leader->Message(CHANNEL_COLOR_GROUP, "%s has left the group.", client->GetPlayer()->GetName());
-				}
-				else {
-					world.GetGroupManager()->GroupMessage(group_id, "%s has left the group.", client->GetPlayer()->GetName());
-				}
-
-				client->SimpleMessage(CHANNEL_GROUP_CHAT, "You have left the group");
-			}
-
-			break;
-		}
-		case COMMAND_FRIEND_ADD:{
-			string name = "";
-			if(sep && sep->arg[0] && strlen(sep->arg[0]) > 1)
-				name = database.GetPlayerName(sep->arg[0]);
-			else if(cmdTarget && cmdTarget->IsPlayer())
-				name = string(cmdTarget->GetName());
-			if(name.length() > 0){
-				if(strcmp(name.c_str(), client->GetPlayer()->GetName()) != 0){
-					if(client->GetPlayer()->IsIgnored(name.c_str())){
-						client->GetPlayer()->RemoveIgnore(name.c_str());
-						client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "Removed ignore: %s", name.c_str());
-						client->SendChatRelationship(3, name.c_str());
-					}
-					client->GetPlayer()->AddFriend(name.c_str(), true);
-					client->SendChatRelationship(0, name.c_str());
-					client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "Added friend: %s", name.c_str());
-					if(zone_list.GetClientByCharName(name))
-						client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "Friend: %s has logged in.", name.c_str());
-				}
-				else
-					client->SimpleMessage(CHANNEL_COLOR_RED, "You cannot be more friendly towards yourself!");
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_CHAT_RELATIONSHIP, "That character does not exist.");
-			break;
-		}
-		case COMMAND_FRIEND_REMOVE:{
-			string name = "";
-			if(sep && sep->arg[0] && strlen(sep->arg[0]) > 1)
-				name = database.GetPlayerName(sep->arg[0]);
-			else if(cmdTarget && cmdTarget->IsPlayer())
-				name = string(cmdTarget->GetName());
-			if(name.length() > 0){
-				client->GetPlayer()->RemoveFriend(name.c_str());
-				client->SendChatRelationship(1, name.c_str());
-				client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "Removed friend: %s", name.c_str());
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_CHAT_RELATIONSHIP, "That character does not exist.");
-			break;
-		}
-		case COMMAND_FRIENDS:{
-
-			break;
-		}
-	    case COMMAND_IGNORE_ADD:{
-			string name = "";
-			if(sep && sep->arg[0] && strlen(sep->arg[0]) > 1)
-				name = database.GetPlayerName(sep->arg[0]);
-			else if(cmdTarget && cmdTarget->IsPlayer())
-				name = string(cmdTarget->GetName());
-			if(name.length() > 0){
-				if(strcmp(name.c_str(), client->GetPlayer()->GetName()) != 0){
-					if(client->GetPlayer()->IsFriend(name.c_str())){
-						client->GetPlayer()->RemoveFriend(name.c_str());
-						client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "Removed friend: %s", name.c_str());
-						client->SendChatRelationship(1, name.c_str());
-					}
-					client->GetPlayer()->AddIgnore(name.c_str(), true);
-					client->SendChatRelationship(2, name.c_str());
-					client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "Added ignore: %s", name.c_str());
-				}
-				else
-					client->SimpleMessage(CHANNEL_COLOR_RED, "You cannot ignore yourself!");
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_CHAT_RELATIONSHIP, "That character does not exist.");
-			break;
-		}
-		case COMMAND_IGNORE_REMOVE:{
-			string name = "";
-			if(sep && sep->arg[0] && strlen(sep->arg[0]) > 1)
-				name = database.GetPlayerName(sep->arg[0]);
-			else if(cmdTarget && cmdTarget->IsPlayer())
-				name = string(cmdTarget->GetName());
-			if(name.length() > 0){
-				client->GetPlayer()->RemoveIgnore(name.c_str());
-				client->SendChatRelationship(3, name.c_str());
-				client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "Removed ignore: %s", name.c_str());
-			}
-			break;
-		}
-		case COMMAND_IGNORES:{
-
-			break;
-		}
-		case COMMAND_GROUP_KICK:{
-			Entity* kicked = 0;
-			Client* kicked_client = 0;
-			int32 group_id = 0;
-
-			if (!client->GetPlayer()->GetGroupMemberInfo() || !client->GetPlayer()->GetGroupMemberInfo()->leader)
-				return;
-
-			LogWrite(MISC__TODO, 0, "TODO", "Add a check to see if the client using the command (COMMAND_GROUP_KICK) is the group leader");
-
-			if (sep && sep->arg[0]) {
-				kicked_client = zone_list.GetClientByCharName(string(sep->arg[0]));
-				if (kicked_client)
-					kicked = kicked_client->GetPlayer();
-			}
-			else if (cmdTarget && cmdTarget->IsEntity()) {
-				kicked = (Entity*)cmdTarget;
-			}
-
-			group_id = client->GetPlayer()->GetGroupMemberInfo()->group_id;
-
-			bool send_kicked_message = world.GetGroupManager()->GetGroupSize(group_id) > 2;
-			if (kicked)
-				world.GetGroupManager()->RemoveGroupMember(group_id, kicked);
-
-			if(send_kicked_message)
-				world.GetGroupManager()->GroupMessage(group_id, "%s was kicked from the group.", kicked->GetName());
-			else
-				client->Message(CHANNEL_GROUP_CHAT, "You kicked %s from the group", kicked->GetName());
-
-			if (kicked_client)
-				kicked_client->SimpleMessage(CHANNEL_GROUP_CHAT, "You were kicked from the group");
-				
-			break;
-		}
-	    case COMMAND_GROUP_MAKE_LEADER:{
-			
-			if (!client->GetPlayer()->GetGroupMemberInfo() || !client->GetPlayer()->GetGroupMemberInfo()->leader) {
-				client->SimpleMessage(CHANNEL_COMMANDS, "You are not a group leader.");
-				return;
-			}
-
-			if (sep && sep->arg[0] && strlen(sep->arg[0]) > 1) {
-				Client* new_leader = zone_list.GetClientByCharName(sep->arg[0]);
-				if (new_leader) {
-					if (client->GetPlayer()->IsGroupMember(new_leader->GetPlayer())) {
-						world.GetGroupManager()->MakeLeader(client->GetPlayer()->GetGroupMemberInfo()->group_id, new_leader->GetPlayer());
-					}
-				}
-				else
-					client->SimpleMessage(CHANNEL_COMMANDS, "Unable to find the given player.");
-			}
-			else if (cmdTarget && cmdTarget->IsPlayer())
-				world.GetGroupManager()->MakeLeader(client->GetPlayer()->GetGroupMemberInfo()->group_id, (Entity*)cmdTarget);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Unable to change group leader.");
-
-			break;
-		}
-		case COMMAND_GROUP_ACCEPT_INVITE: {
-			if(sep && sep->arg[0] && strcmp(sep->arg[0], "group") == 0) {
-				int8 result = world.GetGroupManager()->AcceptInvite(client->GetPlayer());
-
-				if (result == 0)
-					client->SimpleMessage(CHANNEL_GROUP_CHAT, "You have joined the group.");
-				else if (result == 1)
-					client->SimpleMessage(CHANNEL_GROUP_CHAT, "You do not have a pending invite.");
-				else if (result == 2)
-					client->SimpleMessage(CHANNEL_GROUP_CHAT, "Unable to join group - could not find leader.");
-				else
-					client->SimpleMessage(CHANNEL_GROUP_CHAT, "Unable to join group - unknown error.");
-			}
-			break;
-		}
-		case COMMAND_GROUP_DECLINE_INVITE: {
-			if(sep && sep->arg[0] && strcmp(sep->arg[0], "group") == 0) {
-				world.GetGroupManager()->DeclineInvite(client->GetPlayer()); // TODO: Add message to leader
-			}
-			break;
-		}
-		case COMMAND_SUMMON:{
-			char* search_name = 0;
-			if(sep && sep->arg[0][0])
-				search_name = sep->arg[0];
-
-			if(!search_name && !cmdTarget){
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage: /summon [name]");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Summons a targeted spawn or a spawn by name to you.  If more than one spawn matches name, it will summon closest.");
-			}
-			else{ 
-				if(!client->Summon(search_name))
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "No matches found.");
-			}
-			break;
-							}
-		case COMMAND_GOTO:{
-			const char* search_name = 0;
-			if(sep && sep->arg[0][0])
-				search_name = sep->argplus[0];
-			if(!search_name && !cmdTarget){
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage: /goto [name]");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Moves to targeted spawn or to a spawn by name.  If more than one spawn matches name, you will move to closest.");
-			}
-			else{
-				if(!client->GotoSpawn(search_name))
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "No matches found.");
-			}
-			break;
-						  }
-		case COMMAND_MOVE:{
-			bool success = false;
-			try{
-				if(sep && sep->arg[2][0] && sep->IsNumber(0) && sep->IsNumber(1) && sep->IsNumber(2)){
-					EQ2Packet* app = client->GetPlayer()->Move(atof(sep->arg[0]), atof(sep->arg[1]), atof(sep->arg[2]), client->GetVersion());
-					if(app){
-						client->QueuePacket(app);
-						success = true;
-					}
-				}
-			}
-			catch(...){}
-			if(!success){
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage: /move x y z");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Moves the client to the given coordinates.");
-			}
-			break;
-						  }
-		case COMMAND_SETTIME:{
-			if(sep && sep->arg[0]){
-				
-				world.MWorldTime.writelock(__FUNCTION__, __LINE__);
-				sscanf (sep->arg[0], "%d:%d", &world.GetWorldTimeStruct()->hour, &world.GetWorldTimeStruct()->minute);
-				if(sep->arg[1] && sep->IsNumber(1))
-					world.GetWorldTimeStruct()->month = atoi(sep->arg[1]) - 1; //zero based indexes
-				if(sep->arg[2] && sep->IsNumber(2))
-					world.GetWorldTimeStruct()->day = atoi(sep->arg[2]) - 1; //zero based indexes
-				if(sep->arg[3] && sep->IsNumber(3))
-					world.GetWorldTimeStruct()->year = atoi(sep->arg[3]);
-				world.MWorldTime.releasewritelock(__FUNCTION__, __LINE__);
-				client->GetCurrentZone()->SendTimeUpdateToAllClients();
-			}
-			else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage: /settime [hour:minute] (month) (day) (year)");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Example: /settime 8:30");
-			}
-			break;
-							 }
-		case COMMAND_VERSION:{
-			client->Message(CHANNEL_COLOR_YELLOW,"%s %s", EQ2EMU_MODULE, CURRENT_VERSION);
-			client->Message(CHANNEL_COLOR_YELLOW,"Last Compiled on %s %s", COMPILE_DATE, COMPILE_TIME);
-			break;
-							 }
-		case COMMAND_ZONE:{
-			int32 instanceID = 0;
-			string zone;
-			int32 zone_id = 0;
-			bool listSearch = false;
-			bool isInstance = false;
-			ZoneServer* zsZone = 0;
-			
-			if(sep && sep->arg[0][0])
-			{
-				if(strncasecmp(sep->arg[0], "list", 4) == 0)
-					listSearch = true;
-
-				else if(strncasecmp(sep->arg[0], "active", 6) == 0)
-				{
-					zone_list.SendZoneList(client);
-					break;
-				}
-
-				else if(strncasecmp(sep->arg[0], "instance", 6) == 0)
-				{
-					if(sep->IsNumber(1))
-						instanceID = atol(sep->arg[1]);
-				}
-
-				else if(strncasecmp(sep->arg[0], "lock", 4) == 0)
-				{
-					PrintSep(sep, "ZONE LOCK");
-
-					if(sep->IsNumber(1))
-						zsZone = zone_list.Get(atoul(sep->arg[1]), false);
-					else
-						zsZone = zone_list.Get(sep->arg[1], false);
-
-					if( zsZone )
-					{
-						zsZone->SetZoneLockState(true);
-						client->Message(CHANNEL_COLOR_YELLOW, "Zone %s (%u) is now locked.", zsZone->GetZoneName(), zsZone->GetZoneID());
-					}
-					else
-						client->Message(CHANNEL_COLOR_RED, "Zone %s is not running and cannot be locked.", sep->arg[1]);
-
-					break;
-				}
-				else if(strncasecmp(sep->arg[0], "unlock", 6) == 0)
-				{
-					PrintSep(sep, "ZONE UNLOCK");
-
-					if(sep->IsNumber(1))
-						zsZone = zone_list.Get(atoul(sep->arg[1]), false);
-					else
-						zsZone = zone_list.Get(sep->arg[1], false);
-
-					if( zsZone )
-					{
-						zsZone->SetZoneLockState(false);
-						client->Message(CHANNEL_COLOR_YELLOW, "Zone %s (%u) is now unlocked.", zsZone->GetZoneName(), zsZone->GetZoneID());
-					}
-					else
-						client->Message(CHANNEL_COLOR_RED, "Zone %s is not running and cannot be unlocked.", sep->arg[1]);
-					break;
-				}
-				else
-				{
-					if(sep->IsNumber(0))
-					{
-						zone_id = atoul(sep->arg[0]);
-						string zonename = database.GetZoneName(zone_id);
-
-						if(zonename.length() > 0)
-							zone = zonename;
-					}
-					else
-						zone = sep->arg[0];
-				}
-				if(instanceID > 0)
-				{
-					ZoneServer* zsInstance = zone_list.GetByInstanceID(instanceID);
-
-					if(zsInstance != NULL)
-					{
-						instanceID = zsInstance->GetInstanceID();
-						zone = zsInstance->GetZoneName();
-						zone_id = zsInstance->GetZoneID();
-						isInstance = true;
-					}
-				}
-			}
-
-			if(!listSearch)
-			{
-				if(zone.length() == 0)
-					client->Message(CHANNEL_COLOR_RED, "Error: Invalid Zone");
-				else if(instanceID != client->GetCurrentZone()->GetInstanceID() || 
-					zone_id != client->GetCurrentZone()->GetZoneID())
-				{
-					const char* zonestr = zone.c_str();
-					if(database.VerifyZone(zonestr))
-					{
-						if(client->CheckZoneAccess(zonestr))
-						{
-							client->Message(CHANNEL_COLOR_YELLOW,"Zoning to %s...", zonestr);
-							if(isInstance)
-								client->Zone(instanceID,true,true,false);
-							else
-								client->Zone(zonestr);
-						}
-					}
-					else
-						client->Message(CHANNEL_COLOR_RED, "Error: Zone '%s' not found.  To get a list type /zone list", zonestr);
-				}
-				else
-					client->Message(CHANNEL_COLOR_RED, "Error: You are already in that zone!");
-			}
-			else
-			{
-				const char* name = 0;
-				if(sep && sep->arg[1][0])
-				{
-					map<int32, string>* zone_names;
-					name = sep->argplus[1];
-					sint16 status = client->GetAdminStatus();
-					if( status > 0 )
-					{
-						client->SimpleMessage(CHANNEL_COLOR_RED, "ADMIN MODE");
-						zone_names = database.GetZoneList(name, true);
-					}
-					else
-						zone_names = database.GetZoneList(name);
-
-					if(!zone_names)
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "No zones found.");
-					else
-					{
-						map<int32, string>::iterator itr;
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW," ID   Name: ");
-						for(itr = zone_names->begin(); itr != zone_names->end(); itr++)
-							client->Message(CHANNEL_COLOR_YELLOW,"%03lu %s", itr->first, itr->second.c_str());
-						safe_delete(zone_names);
-					}
-				}
-				else
-				{
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Syntax: /zone [zone name]");
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Syntax: /zone list [partial zone name]");
-				}
-			}
-			break;
-		}
-		case COMMAND_USE: {
-			Spawn* target = cmdTarget;
-			if (target && target->IsWidget())
-				((Widget*)target)->HandleUse(client, "use");
-			break;
-		}
-		case COMMAND_OPEN: {
-			Spawn* target = cmdTarget;
-			if (target && target->IsWidget())
-				((Widget*)target)->HandleUse(client, "Open", WIDGET_TYPE_DOOR);
-			break;
-		}
-		case COMMAND_CASTSPELL: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-			{
-				int8 tier = 1;
-				if (sep->arg[1] && sep->IsNumber(1))
-					tier = atoul(sep->arg[1]);
-
-				int8 self = 1;
-				if (sep->arg[1] && sep->IsNumber(2))
-				{
-					self = atoul(sep->arg[2]);
-					if(self != 1 && !cmdTarget->IsEntity())
-					{
-						client->Message(CHANNEL_COLOR_RED, "Target is not an entity required to cast non-self spell.");
-						self = 1;
-					}
-				}
-
-				int32 spellid = atoul(sep->arg[0]);
-				Spell* spell = master_spell_list.GetSpell(spellid, tier);
-
-				if (spell)
-				{
-					client->Message(CHANNEL_COLOR_RED, "Casting spell %u.", spellid);
-					SpellProcess* spellProcess = 0;
-					// Get the current zones spell process
-					spellProcess = client->GetCurrentZone()->GetSpellProcess();
-
-					spellProcess->CastInstant(spell, (!cmdTarget || self == 1) ? (Entity*)client->GetPlayer() : (Entity*)cmdTarget, (cmdTarget && cmdTarget->IsEntity()) ? (Entity*)cmdTarget : (Entity*)client->GetPlayer());
-				}
-				else
-				{
-					client->Message(CHANNEL_COLOR_RED, "Could not find spell %u.",spellid);
-				}
-			}
-			else if (sep && sep->arg[0])
-			{
-				database.FindSpell(client, (char*)sep->argplus[0]);
-			}
-			else
-			{
-				client->Message(CHANNEL_COLOR_YELLOW, "Syntax: /castspell [spellid] (tier=1) - Cast Spell with specified spell id, tier is optional, default of 1.");
-				client->Message(CHANNEL_COLOR_YELLOW, "Syntax: /castspell [spellname] - Find spells wildcard match with a partial spell name");
-			}
-			break;
-		}
-		case COMMAND_KNOWLEDGEWINDOWSORT: {
-			if (client->GetVersion() <= 546)
-				break;
-
-			if (sep && sep->GetArgNumber() == 4)
-			{
-				int32 book = atoul(sep->arg[0]); // 0 - spells, 1 - combat, 2 - abilities, 3 - tradeskill
-				int32 sort_by = atoul(sep->arg[1]); // 0 - alpha, 1 - level, 2 - category
-				int32 order = atoul(sep->arg[2]); // 0 - ascending, 1 - descending
-				int32 pattern = atoul(sep->arg[3]); // 0 - zigzag, 1 - down, 2 - across
-				int32 maxlvlonly = atoul(sep->arg[4]); // 0 - zigzag, 1 - down, 2 - across
-				client->GetPlayer()->ResortSpellBook(sort_by, order, pattern, maxlvlonly, book);
-				ClientPacketFunctions::SendSkillSlotMappings(client);
-			}
-			else
-			{
-				client->Message(CHANNEL_COLOR_YELLOW, "Syntax: /knowledgewindow_sort [book] [sort_by] [order] [pattern]");
-			}
-			break;
-		}
-		case COMMAND_MOVE_ITEM:
-		{
-			int32 id = 0;
-
-			if (sep && sep->IsNumber(0))
-				id = atoul(sep->arg[0]);
-
-			Spawn* spawn = 0;
-			if (id == 0)
-			{
-				spawn = cmdTarget;
-			}
-			else
-				spawn = client->GetCurrentZone()->GetSpawnFromUniqueItemID(id);
-
-			if (!spawn || !client->HasOwnerOrEditAccess() || !spawn->GetPickupItemID())
-				break;
-
-			client->SendMoveObjectMode(spawn, 0);
-			break;
-		}
-		case COMMAND_PICKUP:
-		{
-			int32 id = 0;
-			if (sep && sep->IsNumber(0))
-				id = atoul(sep->arg[0]);
-
-			Spawn* spawn = 0;
-			if (id == 0)
-			{
-				spawn = cmdTarget;
-			}
-			else
-				spawn = client->GetCurrentZone()->GetSpawnFromUniqueItemID(id);
-
-			if (!spawn || !client->HasOwnerOrEditAccess() || !spawn->GetPickupItemID())
-				break;
-
-			client->AddItem(spawn->GetPickupItemID(), 1);
-
-			Query query;
-			query.RunQuery2(Q_INSERT, "delete from spawn_instance_data where spawn_id = %u and spawn_location_id = %u and pickup_item_id = %u", spawn->GetDatabaseID(), spawn->GetSpawnLocationID(), spawn->GetPickupItemID());
-
-			if (database.RemoveSpawnFromSpawnLocation(spawn)) {
-				client->GetCurrentZone()->RemoveSpawn(spawn, true, true, true, true, true);
-			}
-
-			// we had a UI Window displayed, update the house items
-			if ( id > 0 )
-				client->GetCurrentZone()->SendHouseItems(client);
-
-			break;
-		}
-		case COMMAND_HOUSE_DEPOSIT:
-		{
-			PrintSep(sep, "COMMAND_HOUSE_DEPOSIT");
-			// arg0 = ??? (set to 3)
-			// arg1 = coin (in copper)
-			// arg2 = status? (not implemented yet)
-			PlayerHouse* ph = world.GetPlayerHouseByInstanceID(client->GetCurrentZone()->GetInstanceID());
-			if (ph && sep && sep->IsNumber(1))
-			{
-				int64 outValCoin = strtoull(sep->arg[1], NULL, 0);
-				int32 outValStatus = 0;
-				
-				if(sep->IsNumber(2))
-				{
-					outValStatus = strtoull(sep->arg[2], NULL, 0);
-					if(outValStatus > client->GetPlayer()->GetInfoStruct()->get_status_points())
-						outValStatus = 0; // cheat check
-				}
-				
-				if ((!outValCoin && outValStatus) || client->GetPlayer()->RemoveCoins(outValCoin))
-				{
-					if(outValStatus)
-						client->GetPlayer()->GetInfoStruct()->subtract_status_points(outValStatus);
-					char query[256];
-					map<string,Deposit>::iterator itr = ph->depositsMap.find(string(client->GetPlayer()->GetName()));
-					if (itr != ph->depositsMap.end())
-					{
-						snprintf(query, 256, "update character_house_deposits set timestamp = %u, amount = amount + %I64u, last_amount = %I64u, status = status + %u, last_status = %u where house_id = %u and instance_id = %u and name='%s'", Timer::GetUnixTimeStamp(), outValCoin, outValCoin, outValStatus, outValStatus, ph->house_id, ph->instance_id, client->GetPlayer()->GetName());
-					}
-					else
-						snprintf(query, 256, "insert into character_house_deposits set timestamp = %u, house_id = %u, instance_id = %u, name='%s', amount = %I64u, status = %u", Timer::GetUnixTimeStamp(), ph->house_id, ph->instance_id, client->GetPlayer()->GetName(), outValCoin, outValStatus);
-
-					if (database.RunQuery(query, strnlen(query, 256)))
-					{
-						ph->escrow_coins += outValCoin;
-						ph->escrow_status += outValStatus;
-						database.UpdateHouseEscrow(ph->house_id, ph->instance_id, ph->escrow_coins, ph->escrow_status);
-
-						database.LoadDeposits(ph);
-						client->PlaySound("coin_cha_ching");
-						HouseZone* hz = world.GetHouseZone(ph->house_id);
-						ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, client->GetPlayer()->GetID());
-					}
-					else
-					{
-						if(outValCoin)
-							client->GetPlayer()->AddCoins(outValCoin);
-							
-						if(outValStatus)
-							client->GetPlayer()->GetInfoStruct()->add_status_points(outValStatus);
-						client->SimpleMessage(CHANNEL_COLOR_RED, "Deposit failed!");
-					}
-				}
-			}
-			break;
-		}
-		case COMMAND_HOUSE:
-		{
-			if (sep && sep->IsNumber(0))
-			{
-				int32 unique_id = atoi(sep->arg[0]);
-				PlayerHouse* ph = world.GetPlayerHouseByUniqueID(unique_id);
-				HouseZone* hz = 0;
-					
-				if (ph)
-					hz = world.GetHouseZone(ph->house_id);
-				// there is a arg[1] that is true/false, but not sure what it is for investigate more later
-				ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, client->GetPlayer()->GetID());
-			}
-			else if (client->GetCurrentZone()->GetInstanceType() != 0)
-			{
-				// inside a house or something? Send the access window
-				PlayerHouse* ph = world.GetPlayerHouseByInstanceID(client->GetCurrentZone()->GetInstanceID());
-
-				HouseZone* hz = 0;
-				if ( ph )
-					hz = world.GetHouseZone(ph->house_id);
-
-				ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, client->GetPlayer()->GetID());
-				client->GetCurrentZone()->SendHouseItems(client);
-			}
-			break;
-		}
-		case COMMAND_HOUSE_UI:
-		{
-			if (sep && sep->IsNumber(0) && client->GetCurrentZone()->GetInstanceType() == Instance_Type::NONE)
-			{
-				int32 unique_id = atoi(sep->arg[0]);
-				PlayerHouse* ph = world.GetPlayerHouseByUniqueID(unique_id);
-				HouseZone* hz = 0;
-				if ( ph )
-					hz = world.GetHouseZone(ph->house_id);
-				// there is a arg[1] that is true/false, but not sure what it is for investigate more later
-				ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, 0);
-			}
-			break;
-		}
-		case COMMAND_PLACE_HOUSE_ITEM: {
-			if (sep && sep->IsNumber(0))
-			{
-				int32 uniqueid = atoi(sep->arg[0]);
-
-				Item* item = client->GetPlayer()->item_list.GetItemFromUniqueID(uniqueid);
-				//Item* item = player->GetEquipmentList()->GetItem(slot);
-				if (item && item->IsHouseItem())
-				{
-					if (!client->HasOwnerOrEditAccess())
-					{
-						client->SimpleMessage(CHANNEL_COLOR_RED, "This is not your home!");
-						break;
-					}
-					else if (!item->generic_info.appearance_id)
-					{
-						client->Message(CHANNEL_COLOR_RED, "This item has not been configured in the database, %s (%u) needs an entry where ?? has the model type id, eg. insert into item_appearances set item_id=%u,equip_type=??;", item->name.c_str(), item->details.item_id, item->details.item_id);
-						break;
-					}
-
-					if (client->GetTempPlacementSpawn())
-					{
-						Spawn* tmp = client->GetTempPlacementSpawn();
-						client->GetCurrentZone()->RemoveSpawn(tmp, true, true, true, true, true);
-						client->SetTempPlacementSpawn(nullptr);
-					}
-
-					Object* obj = new Object();
-					Spawn* spawn = (Spawn*)obj;
-					memset(&spawn->appearance, 0, sizeof(spawn->appearance));
-					strcpy(spawn->appearance.name, "temp");
-					spawn->SetX(client->GetPlayer()->GetX());
-					spawn->SetY(client->GetPlayer()->GetY());
-					spawn->SetZ(client->GetPlayer()->GetZ());
-					spawn->appearance.pos.collision_radius = 32;
-					spawn->SetHeading(client->GetPlayer()->GetHeading());
-					spawn->SetSpawnOrigX(spawn->GetX());
-					spawn->SetSpawnOrigY(spawn->GetY());
-					spawn->SetSpawnOrigZ(spawn->GetZ());
-					spawn->SetSpawnOrigHeading(spawn->GetHeading());
-					spawn->appearance.targetable = 1;
-					spawn->appearance.activity_status = ACTIVITY_STATUS_SOLID;
-					spawn->appearance.race = item && item->generic_info.appearance_id ? item->generic_info.appearance_id : 1472;
-					spawn->appearance.pos.grid_id = client->GetPlayer()->appearance.pos.grid_id;
-					spawn->SetModelType(item && item->generic_info.appearance_id ? item->generic_info.appearance_id : 1472);
-					spawn->SetZone(client->GetCurrentZone());
-					client->SetTempPlacementSpawn(spawn);
-					client->SetPlacementUniqueItemID(uniqueid);
-					client->GetCurrentZone()->AddSpawn(spawn);
-				}
-			}
-			break;
-		}
-		case COMMAND_GM:
-		{
-			if (sep && sep->arg[0] && sep->arg[1])
-			{
-				bool onOff = (strcmp(sep->arg[1], "on") == 0);
-				if (strcmp(sep->arg[0], "vision") == 0)
-				{
-					client->GetPlayer()->SetGMVision(onOff);
-					#if defined(__GNUC__)
-						database.insertCharacterProperty(client, CHAR_PROPERTY_GMVISION, (onOff) ? (char*)"1" : (char*)"0");
-					#else
-						database.insertCharacterProperty(client, CHAR_PROPERTY_GMVISION, (onOff) ? "1" : "0");
-					#endif
-					client->GetCurrentZone()->SendAllSpawnsForVisChange(client, false);
-
-					if (onOff)
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "GM Vision Enabled!");
-					else
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "GM Vision Disabled!");
-				}
-				else if (strcmp(sep->arg[0], "tag") == 0)
-				{
-					int32 value = 0;
-					int16 tag_icon = 0;
-					// groundspawn has special exception -1 argument so it needs to be handled here
-					if(sep->arg[2] && sep->arg[3] && ((tag_icon = atoul(sep->arg[3])) > 0) || (strncasecmp(sep->arg[1], "groundspawn", 11) == 0)) {
-						value = atoul(sep->arg[2]);
-						if(strncasecmp(sep->arg[1], "faction", 7) == 0){
-							if(!value) {
-								client->SimpleMessage(CHANNEL_COLOR_RED, "Need to supply a valid faction id.");
-								break;
-							}
-							if(!tag_icon) {
-								client->SimpleMessage(CHANNEL_COLOR_RED, "Need to supply a valid tag icon id.");
-								break;
-							}
-							client->GetPlayer()->AddGMVisualFilter(GMTagFilterType::GMFILTERTYPE_FACTION, value, "", tag_icon);
-							client->GetCurrentZone()->SendAllSpawnsForVisChange(client, false);
-							client->Message(CHANNEL_COLOR_RED, "Adding faction id %u with tag icon %u.", value, tag_icon);
-						}
-						else if(strncasecmp(sep->arg[1], "spawngroup", 10) == 0){
-							if(value>0) {
-								value = 1;
-							}
-							if(!tag_icon) {
-								client->SimpleMessage(CHANNEL_COLOR_RED, "Need to supply a valid tag icon id.");
-								break;
-							}
-							client->GetPlayer()->AddGMVisualFilter(GMTagFilterType::GMFILTERTYPE_SPAWNGROUP, value, "", tag_icon);
-							client->GetCurrentZone()->SendAllSpawnsForVisChange(client, false);
-							client->Message(CHANNEL_COLOR_RED, "Adding spawn group tag \"%s\" with tag icon %u.", (value == 1) ? "on" : "off", tag_icon);
-						}
-						else if(strncasecmp(sep->arg[1], "race", 5) == 0){
-							if(!value) {
-								client->SimpleMessage(CHANNEL_COLOR_RED, "Need to supply a valid race id.");
-								break;
-							}
-							if(!tag_icon) {
-								client->SimpleMessage(CHANNEL_COLOR_RED, "Need to supply a valid tag icon id.");
-								break;
-							}
-							client->GetPlayer()->AddGMVisualFilter(GMTagFilterType::GMFILTERTYPE_RACE, value, "", tag_icon);
-							client->GetCurrentZone()->SendAllSpawnsForVisChange(client, false);
-							client->Message(CHANNEL_COLOR_RED, "Adding race id %u with tag icon %u.", value, tag_icon);
-						}
-						else if(strncasecmp(sep->arg[1], "groundspawn", 11) == 0){
-							// one less argument value field not tag_icon for this one
-							if(!value) {
-								client->SimpleMessage(CHANNEL_COLOR_RED, "Need to supply a valid tag icon id.");
-								break;
-							}
-							client->GetPlayer()->AddGMVisualFilter(GMTagFilterType::GMFILTERTYPE_GROUNDSPAWN, 1, "", value);
-							client->GetCurrentZone()->SendAllSpawnsForVisChange(client, false);
-							client->Message(CHANNEL_COLOR_RED, "Adding groundspawns with tag icon %u.", value);
-						}
-					}
-					else {
-						if(strncasecmp(sep->arg[1], "clear", 5) == 0){
-							client->GetPlayer()->ClearGMVisualFilters();
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW, "GM Tags Cleared!");
-							client->GetCurrentZone()->SendAllSpawnsForVisChange(client, false);
-						}
-						else {
-						client->SimpleMessage(CHANNEL_COLOR_RED, "GM Tagging Missing Arguments:");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/gm tag [type] [value] [visual_icon_display]");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/gm tag clear - Clears all GM visual tags");
-
-						client->SimpleMessage(CHANNEL_COLOR_RED, "Visual Type Options:");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "type: faction, value: faction id of spawn(s)");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "type: spawngroup, value: 1 to show grouped, 0 to show not grouped");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "type: race, value: race id (either against base race or race id in spawn details)");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "type: groundspawn, value: (not used)");
-
-						client->SimpleMessage(CHANNEL_COLOR_RED, "Visual Icon Options:");
-
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, 
-						"1 = skull, 2 = shield half dark blue / half light blue, 3 = purple? star, 4 = yellow sword, 5 = red X, 6 = green flame");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, 
-						"7 = Number \"1\", 8 = Number \"2\", 9 = Number \"3\", 10 = Number \"4\", 11 = Number \"5\", 12 = Number \"6\"");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, 
-						"25 = shield, 26 = green plus, 27 = crossed swords, 28 = bow with arrow in it, 29 = light blue lightning bolt");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, 
-						"30 = bard instrument (hard to see), 31 = writ with shield, 32 = writ with green +, 33 = writ with crossed sword");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, 
-						"34 = writ with bow, 35 = writ with light blue lightning bolt, 36 = same as 30, 37 = party with crossed sword, shield and lightning bolt");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, 
-						"38 = shaking hands green background, 39 = shaking hands dark green background, unlocked keylock");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, 
-						"40 = red aura icon with black shadow of person and big red aura, 41 = green aura icon with black shadow of person big green aura");
-						}
-					}
-				}
-				else if (strcmp(sep->arg[0], "regiondebug") == 0)
-				{
-					client->SetRegionDebug(onOff);
-					#if defined(__GNUC__)
-						database.insertCharacterProperty(client, CHAR_PROPERTY_REGIONDEBUG, (onOff) ? (char*)"1" : (char*)"0");
-					#else
-						database.insertCharacterProperty(client, CHAR_PROPERTY_REGIONDEBUG, (onOff) ? "1" : "0");
-					#endif
-
-					if (onOff)
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Region Debug Enabled!");
-					else
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Region Debug Disabled!");
-				}
-				else if (strcmp(sep->arg[0], "luadebug") == 0)
-				{
-					client->SetLuaDebugClient(onOff);
-#if defined(__GNUC__)
-					database.insertCharacterProperty(client, CHAR_PROPERTY_LUADEBUG, (onOff) ? (char*)"1" : (char*)"0");
-#else
-					database.insertCharacterProperty(client, CHAR_PROPERTY_LUADEBUG, (onOff) ? "1" : "0");
-#endif
-
-					if (onOff)
-					{
-						if (lua_interface)
-							lua_interface->UpdateDebugClients(client);
-
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You will now receive LUA error messages.");
-					}
-					else
-					{
-						if (lua_interface)
-							lua_interface->RemoveDebugClients(client);
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You will no longer receive LUA error messages.");
-					}
-				}
-			}
-			break;
-		}
-		case COMMAND_ATTACK:
-		case COMMAND_AUTO_ATTACK:{
-			int8 type = 1;
-			Player* player = client->GetPlayer();
-			if(!player)
-				break;
-			bool incombat = player->EngagedInCombat();
-			if(sep && sep->arg[0] && sep->IsNumber(0))
-				type = atoi(sep->arg[0]);
-			if(client->GetPlayer()->GetHP() == 0){
-				client->SimpleMessage(CHANNEL_COLOR_RED,"You cannot do that right now.");
-				break;
-			}
-			if(type == 0){
-				if(incombat)
-					client->SimpleMessage(CHANNEL_GENERAL_COMBAT, "You stop fighting.");
-					player->StopCombat(type);
-			}
-			else {
-				if(type == 2){
-					player->InCombat(false);
-					if(incombat && player->GetRangeAttack()){
-						player->StopCombat(type);
-						client->SimpleMessage(CHANNEL_GENERAL_COMBAT, "You stop fighting.");
-					}
-					else{
-						player->SetRangeAttack(true);
-						player->InCombat(true, true);
-						client->SimpleMessage(CHANNEL_GENERAL_COMBAT, "You start fighting.");
-					}
-				}
-				else {
-					player->InCombat(false, true);
-					player->SetRangeAttack(false);
-					player->InCombat(true);
-					if(!incombat)
-						client->SimpleMessage(CHANNEL_GENERAL_COMBAT, "You start fighting.");
-				}
-				/*else
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You cannot attack that!");*/
-			}
-			player->SetCharSheetChanged(true);
-			break;
-								}
-		case COMMAND_DEPOP:{
-			bool allow_respawns = false;
-			if(sep && sep->arg[0] && sep->IsNumber(0)){
-				if(atoi(sep->arg[0]) == 1)
-					allow_respawns = true;
-			}
-			client->GetCurrentZone()->Depop(allow_respawns);
-			break;
-						   }
-		case COMMAND_REPOP:{
-			client->GetCurrentZone()->Depop(false, true);
-			break;
-						   }
-		case COMMAND_BUYBACK:{
-			if(sep && sep->arg[1][0] && sep->IsNumber(0) && sep->IsNumber(1)){
-				// Item ID and Unique ID get combined in this command so we need to get the number as an int64 and break it into 2 int32's
-				int64 id = atoi64(sep->arg[0]);
-				// get the first int32, the item id
-				//int32 item_id = (int32)id;
-				// get the second int32, the unique id
-				int32 unique_id = (int32)(id>>32);
-				int8 quantity = atoi(sep->arg[1]);
-				if(quantity == 255)
-					quantity = 1;
-				client->BuyBack(unique_id, quantity);
-			}
-			break;
-							 }
-		case COMMAND_MERCHANT_BUY:{
-			if(sep && sep->arg[1][0] && sep->IsNumber(0) && sep->IsNumber(1)){
-				int32 item_id = atoul(sep->arg[0]);
-				int8 quantity = atoi(sep->arg[1]);
-				client->BuyItem(item_id, quantity);
-			}
-			else
-				Command_SendMerchantWindow(client, sep);
-			break;
-								  }
-		case COMMAND_MERCHANT_SELL:{
-			if(sep && sep->arg[1][0] && sep->IsNumber(0) && sep->IsNumber(1)){
-				// Item ID and Unique ID get combined in this command so we need to get the number as an int64 and break it into 2 int32's
-				int64 id = atoi64(sep->arg[0]);
-				// get the first int32, the item id
-				int32 item_id = (int32)id;
-				// get the second int32, the unique id
-				int32 unique_id = (int32)(id>>32);
-
-				int8 quantity = atoi(sep->arg[1]);
-				LogWrite(MERCHANT__DEBUG, 0, "Merchant", "Selling Item: Item Id = %ul, unique id = %ul, Quantity = %i", item_id, unique_id, quantity);
-				client->SellItem(item_id, quantity, unique_id);
-			}
-			break;
-								   }
-		case COMMAND_MENDER_REPAIR: {
-			if (sep && sep->arg[0] && sep->IsNumber(0))
-				client->RepairItem(atoul(sep->arg[0]));
-			break;
-									}
-		case COMMAND_MENDER_REPAIR_ALL: {
-			client->RepairAllItems();
-			break;
-										}
-		case COMMAND_CANCEL_MERCHANT:{
-			client->SetMerchantTransaction(0);
-			break;
-									 }
-		case COMMAND_START_MERCHANT:{
-			break;
-									}
-		case COMMAND_INVULNERABLE:{
-			sint8 val = -1;
-			if(sep && sep->arg[0] && sep->IsNumber(0)){
-				val = atoi(sep->arg[0]);
-				
-//devn00b: Fix for linux builds
-#if defined(__GNUC__)
- database.insertCharacterProperty(client, CHAR_PROPERTY_INVUL, (val == 1) ? (char*) "1" : (char*) "0");
-#else
- database.insertCharacterProperty(client, CHAR_PROPERTY_INVUL, (val == 1) ? "1" : "0");
-#endif
-//				database.insertCharacterProperty(client, CHAR_PROPERTY_INVUL, (val == 1) ? "1" : "0");
-
-				client->GetPlayer()->SetInvulnerable(val==1);
-				if(client->GetPlayer()->GetInvulnerable())
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are now invulnerable!");
-				else
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are no longer invulnerable!");
-			}
-			if(val == -1)
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /invulnerable [0/1]");
-			break;
-		}
-		case COMMAND_REPAIR: {
-			Spawn* spawn = cmdTarget;
-			if (spawn && spawn->GetMerchantType() & MERCHANT_TYPE_REPAIR) {
-				client->SendHailCommand(spawn);
-				client->SetMerchantTransaction(spawn);
-				client->SendRepairList();
-			}
-			break;
-							 }
-		case COMMAND_LOTTO: {
-			Spawn* spawn = cmdTarget;
-			if (spawn && spawn->GetMerchantType() & MERCHANT_TYPE_LOTTO) {
-				client->SetMerchantTransaction(spawn);
-				client->ShowLottoWindow();
-			}
-			break;
-							}
-		case COMMAND_ACCEPT_REWARD:{
-			int32 unknown = 0;
-			int32 selectable_item_id = 0;
-			//Quest *quest = 0;
-			Collection *collection = 0;
-			
-			/* no idea what the first argument is for (faction maybe?)
-			   if the reward has a selectable item reward, it's sent as the second argument
-			   if neither of these are included in the reward, there is no sep
-			   since the regular item rewards are manditary to receive, we don't have to know what they are until we accept the collection or quest
-			   only 1 quest or collection reward may be displayed at a time */
-			if (sep && sep->arg[0] && sep->arg[1] && sep->IsNumber(0) && sep->IsNumber(1)) {
-				unknown = atoul(sep->arg[0]);
-				selectable_item_id = atoul(sep->arg[1]);
-			}
-
-			//if ((quest = player->GetPendingQuestReward()))
-			//	client->AcceptQuestRewards(quest, selectable_item_id);
-
-			/* the below needs to go away eventually and be redone */
-			int32 item_id = 0;
-			if(sep && sep->arg[0][0] && sep->IsNumber(0))
-				item_id = atoul(sep->arg[0]);
-			Quest* quest = client->GetPendingQuestAcceptance(item_id);
-			if(quest){
-				client->AcceptQuestReward(quest, item_id);
-				break;
-			}
-			bool collectedItems = false;
-			if (collection = player->GetPendingCollectionReward())
-			{
-				client->AcceptCollectionRewards(collection, selectable_item_id);
-				collectedItems = true;
-			}
-			else if (client->GetPlayer()->HasPendingItemRewards()) {
-				vector<Item*> items = client->GetPlayer()->GetPendingItemRewards();
-				if (items.size() > 0) {
-					collectedItems = true;
-					for (int i = 0; i < items.size(); i++) {
-						client->GetPlayer()->AddItem(new Item(items[i]));
-					}
-					client->GetPlayer()->ClearPendingItemRewards();
-				}
-				map<int32, Item*> selectable_item = client->GetPlayer()->GetPendingSelectableItemReward(item_id);
-				if (selectable_item.size() > 0) {
-					collectedItems = true;
-					map<int32, Item*>::iterator itr;
-					for (itr = selectable_item.begin(); itr != selectable_item.end(); itr++) {
-						client->GetPlayer()->AddItem(new Item(itr->second));
-						client->GetPlayer()->ClearPendingSelectableItemRewards(itr->first);
-					}
-				}
-			}
-			if (collectedItems) {
-				EQ2Packet* outapp = client->GetPlayer()->SendInventoryUpdate(client->GetVersion());
-				if (outapp)
-					client->QueuePacket(outapp);
-			}
-			else
-				LogWrite(COMMAND__ERROR, 0, "Command", "Error in COMMAND_ACCEPT_REWARD. No pending quest or collection reward was found (unknown=%u).", unknown);
-			break;
-		}
-		case COMMAND_BUY_FROM_BROKER:{
-			if(sep && sep->arg[1][0] && sep->IsNumber(0) && sep->IsNumber(1)){
-				int32 item_id = atoul(sep->arg[0]);
-				int16 quantity = atoul(sep->arg[1]);
-				Item* item = master_item_list.GetItem(item_id);
-				if(item && item->generic_info.max_charges > 1)
-					quantity = item->generic_info.max_charges;
-				client->AddItem(item_id, quantity);
-			}
-			break;
-		}
-		case COMMAND_SEARCH_STORES_PAGE:{
-			if(sep && sep->arg[0][0] && sep->IsNumber(0)){
-				int32 page = atoul(sep->arg[0]);
-				client->SearchStore(page);
-			}
-			break;
-		}
-		case COMMAND_SEARCH_STORES:{
-			if(sep && sep->arg[0][0]){
-				const char* values = sep->argplus[0];
-				if(values){
-					LogWrite(ITEM__WARNING, 0, "Item", "SearchStores: %s", values);
-
-					map<string, string> str_values = TranslateBrokerRequest(values);
-					vector<Item*>* items = master_item_list.GetItems(str_values);
-					if(items){
-						client->SetItemSearch(items);
-						client->SearchStore(0);
-					}
-				}
-			}
-			break;
-		}
-		
-		case COMMAND_LUADEBUG:{
-			if(sep && sep->arg[0][0] && strcmp(sep->arg[0], "start") == 0){
-				client->SetLuaDebugClient(true);
-				if(lua_interface)
-					lua_interface->UpdateDebugClients(client);
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You will now receive LUA error messages.");
-			}
-			else if(sep && sep->arg[0][0] && strcmp(sep->arg[0], "stop") == 0){
-				client->SetLuaDebugClient(false);
-				if(lua_interface)
-					lua_interface->RemoveDebugClients(client);
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You will no longer receive LUA error messages.");
-			}
-			else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /luadebug {start | stop}");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "This will allow you to receive lua debug messages normally seen only in the console.");
-			}
-			break;
-		}
-		case COMMAND_SPAWN_GROUP:
-		{
-			Spawn* target = cmdTarget;
-
-			if(target && target->IsPlayer() == false)
-			{
-				if(sep && sep->arg[0][0] && strcmp(sep->arg[0], "create") == 0)
-				{
-					if(target->GetSpawnLocationPlacementID() > 0)
-					{
-						if(sep->arg[1] && !sep->IsNumber(1) && strlen(sep->arg[1]) > 0)
-						{
-							int32 id = database.CreateSpawnGroup(target, sep->arg[1]);
-
-							if(id > 0)
-								client->Message(CHANNEL_COLOR_YELLOW, "Successfully created new spawn group with id: %u", id);
-							else
-								client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Error creating group, check console for details.");
-
-							target->SetSpawnGroupID(id);
-							target->AddSpawnToGroup(target);
-						}
-						else
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Syntax: /spawn group create [name]");
-					}
-					else
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Could not use spawn to create a new group.  Likely cause would be a newly spawned spawn that did not exist when /reload spawns was last used.");
-				}
-				else if(sep && sep->arg[0][0] && strcmp(sep->arg[0], "add") == 0)
-				{
-					if(sep->arg[1] && sep->IsNumber(1))
-					{
-						int32 group_id = atoul(sep->arg[1]);
-						Spawn* leader = client->GetCurrentZone()->GetSpawnGroup(group_id);
-
-						if(leader)
-						{
-							leader->AddSpawnToGroup(target);
-							target->SetSpawnGroupID(group_id);
-
-							if(database.SpawnGroupAddSpawn(target, group_id))
-								client->Message(CHANNEL_COLOR_YELLOW, "Successfully added '%s' to group id: %u", target->GetName(), group_id);
-							else
-								client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Error adding spawn to group, check console for details.");
-						}
-						else
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW, "No spawns found in the current zone for that spawn group, be sure to use '/spawn group create' first!");
-					}
-					else
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Syntax: /spawn group add [group id]");
-				}
-				else if(target->GetSpawnGroupID() == 0)
-				{
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "That spawn is not in a group!");
-				}
-				else if(sep && sep->arg[0][0] && strcmp(sep->arg[0], "remove") == 0)
-				{
-					int32 group_id = target->GetSpawnGroupID();
-					target->RemoveSpawnFromGroup();
-
-					if(database.SpawnGroupRemoveSpawn(target, group_id))
-						client->Message(CHANNEL_COLOR_YELLOW, "Successfully removed '%s' from group id: %u", target->GetName(), group_id);
-					else
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Error removing spawn from group, check console for details.");
-				}
-				else if(sep && sep->arg[0][0] && strcmp(sep->arg[0], "associate") == 0)
-				{
-					int32 group_id = target->GetSpawnGroupID();
-
-					if(sep->arg[1] && sep->IsNumber(1))
-					{
-						if(database.SpawnGroupAddAssociation(group_id, atoul(sep->arg[1])))
-							client->Message(CHANNEL_COLOR_YELLOW, "Successfully associated group id %u with group id %u", group_id, atoul(sep->arg[1]));
-						else
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Error associating groups, check console for details.");
-					}
-					else
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Allows you to spawn only one associated group at once.  Syntax: /spawn group associate [other group id]");
-				}
-				else if(sep && sep->arg[0][0] && strcmp(sep->arg[0], "deassociate") == 0)
-				{
-					int32 group_id = target->GetSpawnGroupID();
-
-					if(sep->arg[1] && sep->IsNumber(1))
-					{
-						if(database.SpawnGroupRemoveAssociation(group_id, atoul(sep->arg[1])))
-							client->Message(CHANNEL_COLOR_YELLOW, "Successfully removed association between group id %u and group id %u", group_id, atoul(sep->arg[1]));
-						else
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Error removing group associations, check console for details.");
-					}
-					else
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Removes previous group associations.  Syntax: /spawn group deassociate [other group id]");
-				}
-				else if(sep && sep->arg[0][0] && strcmp(sep->arg[0], "chance") == 0)
-				{
-					if(sep->arg[1] && sep->IsNumber(1))
-					{
-						if(database.SetGroupSpawnChance(target->GetSpawnGroupID(), atof(sep->arg[1])))
-							client->Message(CHANNEL_COLOR_YELLOW, "Successfully set group spawn chance to %f for group id: %u", atof(sep->arg[1]), target->GetSpawnGroupID());
-						else
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Error setting group spawn chance, check console for details.");
-					}
-					else
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Syntax: /spawn group chance [group's spawn chance percentage]");
-				}
-				else
-				{
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "This command allows you to modify spawn groups.");
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Syntax: /spawn group [create/add/remove/chance/associate/deassociate]");
-				}
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You must select a valid spawn to use this command.");
-			break;
-		}
-		case COMMAND_SPAWN_COMBINE:{
-			Spawn* spawn = cmdTarget;
-			float radius = 0;
-			bool failed = true;
-			if(spawn && !spawn->IsPlayer() && sep && sep->arg[0] && sep->arg[0][0]){
-				failed = false;
-				if(spawn->GetSpawnGroupID() > 0){
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Can not combine this spawn as it is in a spawn group.  Remove it from the group and try again.");
-				}
-				else if(sep->IsNumber(0)){
-					radius = atof(sep->arg[0]);
-					client->CombineSpawns(radius, spawn);
-				}
-				else{
-					if(strncasecmp(sep->arg[0], "add", 3) == 0){
-						client->AddCombineSpawn(spawn);
-					}
-					else if(strncasecmp(sep->arg[0], "remove", 6) == 0){
-						client->RemoveCombineSpawn(spawn);
-					}
-					else if(strncasecmp(sep->arg[0], "save", 4) == 0){
-						const char* name = 0;
-						if(sep->arg[1] && sep->arg[1][0])
-							name = sep->argplus[1];
-						client->SaveCombineSpawns(name);
-					}
-					else
-						failed = true;
-				}
-			}
-			if(failed){
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "This command combines several spawns into a single spawn group.");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Syntax: /spawn combine [radius/add/remove/save]");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Ex: /spawn combine 1, /spawn combine save (spawn group name)");
-			}
-			break;
-								   }
-		case COMMAND_SPAWN_CREATE:{
-			Spawn* spawn = 0;
-			if(sep && sep->arg[4][0] && strncasecmp(sep->arg[0], "object", 6) == 0 && sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)){
-				spawn = new Object();
-				memset(&spawn->appearance, 0, sizeof(spawn->appearance));
-			}
-			else if (sep && sep->arg[4][0] && strncasecmp(sep->arg[0], "groundspawn", 11) == 0 && sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) {
-				spawn = new GroundSpawn();
-				memset(&spawn->appearance, 0, sizeof(spawn->appearance));
-			}
-			else if (sep && sep->arg[4][0] && strncasecmp(sep->arg[0], "sign", 4) == 0 && sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) {
-				spawn = new Sign();
-				memset(&spawn->appearance, 0, sizeof(spawn->appearance));
-			}
-			else if(sep && sep->arg[4][0] && strncasecmp(sep->arg[0], "npc", 3) == 0 && sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)){
-				spawn = new NPC();
-				memset(&spawn->appearance, 0, sizeof(spawn->appearance));
-				spawn->appearance.pos.collision_radius = 32;
-				spawn->secondary_command_list_id = 0;
-				spawn->primary_command_list_id = 0;
-				spawn->appearance.display_name = 1;
-				spawn->appearance.show_level = 1;
-				spawn->appearance.attackable = 1;
-			}
-			else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn create [spawn type] [race type] [class type] [level] [name] (difficulty) (size)");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "All parameters are required except difficulty and size.  Valid types are Object, NPC, Sign, or GroundSpawn");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Ex: /spawn create npc 203 1 50 'Lady Vox' 1 32");
-				break;
-			}
-			spawn->SetID(Spawn::NextID());
-			spawn->SetX(client->GetPlayer()->GetX());
-			spawn->SetY(client->GetPlayer()->GetY());
-			spawn->SetZ(client->GetPlayer()->GetZ());
-			spawn->SetHeading(client->GetPlayer()->GetHeading());
-			spawn->SetSpawnOrigX(spawn->GetX());
-			spawn->SetSpawnOrigY(spawn->GetY());
-			spawn->SetSpawnOrigZ(spawn->GetZ());
-			spawn->SetSpawnOrigHeading(spawn->GetHeading());
-
-			
-			if(spawn->IsSign())
-			{
-				((Sign*)spawn)->SetSignType(SIGN_TYPE_GENERIC);
-				((Sign*)spawn)->SetSignDistance(20.0f);
-				((Sign*)spawn)->SetIncludeLocation(1);
-				((Sign*)spawn)->SetIncludeHeading(1);
-				((Sign*)spawn)->SetInitialState(1);
-				((Sign*)spawn)->SetSignTitle(sep->arg[4]);
-				((Sign*)spawn)->SetActivityStatus(64);
-				spawn->appearance.race = 0;
-				spawn->SetLevel(0);
-				spawn->SetHP(0);
-				spawn->SetTotalHP(0);
-				spawn->SetPower(0);
-				spawn->SetTotalPower(0);
-				spawn->SetEncounterLevel(0);
-				spawn->SetTargetable(0);
-				spawn->SetSogaModelType(0);
-				spawn->SetCollisionRadius(19);
-				((Sign*)spawn)->SetWidgetX(client->GetPlayer()->GetX());
-				((Sign*)spawn)->SetWidgetY(client->GetPlayer()->GetY());
-				((Sign*)spawn)->SetWidgetZ(client->GetPlayer()->GetZ());
-				spawn->appearance.pos.grid_id = client->GetPlayer()->appearance.pos.grid_id;
-				spawn->appearance.model_type = atoul(sep->arg[1]);
-			}
-			else
-			{
-				spawn->appearance.targetable = 1;
-				spawn->appearance.race = 255;
-				spawn->appearance.pos.grid_id = client->GetPlayer()->appearance.pos.grid_id;
-				spawn->SetModelType(atoi(sep->arg[1]));
-				spawn->SetAdventureClass(atoi(sep->arg[2]));
-				spawn->SetLevel(atoi(sep->arg[3]));
-				spawn->SetName(sep->arg[4]);
-				if(sep->arg[5][0] && sep->IsNumber(5))
-					spawn->SetEncounterLevel(atoi(sep->arg[5]));
-				if(sep->arg[6][0] && sep->IsNumber(6))
-					spawn->size = atoi(sep->arg[6]);
-				if(spawn->GetTotalHP() == 0){
-					spawn->SetTotalHP(25*spawn->GetLevel() + 1);
-					spawn->SetHP(25*spawn->GetLevel() + 1);
-				}
-				if(spawn->GetTotalPower() == 0){
-					spawn->SetTotalPower(25*spawn->GetLevel() + 1);
-					spawn->SetPower(25*spawn->GetLevel() + 1);
-				}
-			}
-
-			client->GetCurrentZone()->AddSpawn(spawn);
-			break;
-								  }
-		case COMMAND_SPAWN_EQUIPMENT:{
-			Spawn* spawn = cmdTarget;
-			if(spawn && sep && sep->arg[1][0] && sep->IsNumber(0) && sep->IsNumber(1) && spawn->IsEntity()){
-				int8 slot = atoi(sep->arg[0]);
-				int16 type = atoi(sep->arg[1]);
-				int8 red = 0;
-				int8 green = 0;
-				int8 blue = 0;
-				int8 h_red = 0;
-				int8 h_green = 0;
-				int8 h_blue = 0;
-				if(sep->arg[2])
-					red = atoi(sep->arg[2]);
-				if(sep->arg[3])
-					green = atoi(sep->arg[3]);
-				if(sep->arg[4])
-					blue = atoi(sep->arg[4]);
-				if(sep->arg[5])
-					h_red = atoi(sep->arg[5]);
-				if(sep->arg[6])
-					h_green = atoi(sep->arg[6]);
-				if(sep->arg[7])
-					h_blue = atoi(sep->arg[7]);
-				((Entity*)spawn)->SetEquipment(slot, type, red, green, blue, h_red, h_green, h_blue);
-				database.SaveNPCAppearanceEquipment(spawn->GetDatabaseID() , slot, type, red, green, blue, h_red, h_green, h_blue);
-			}
-			else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn equipment [slot] [appearance id] (red) (green) (blue) (highlight red) (hgreen) (hblue)");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "This will set the given spawn's equipment. ");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Slot is 0-24, Appearance ID from appearances table, Colors are 0-255");
-			}
-			break;
-									 }
-		case COMMAND_SPAWN_DETAILS: {
-			Spawn* spawn = cmdTarget;
-			if (sep && sep->arg[0][0]) {
-				if (cmdTarget)
-				{
-					if (ToLower(string(sep->arg[0])) == "los")
-					{
-						bool hasLOS = client->GetPlayer()->CheckLoS(cmdTarget);
-						if (hasLOS)
-							client->Message(CHANNEL_COLOR_YELLOW, "You have line of sight with %s", spawn->GetName());
-						else
-							client->Message(CHANNEL_COLOR_RED, "You DO NOT have line of sight with %s", spawn->GetName());
-
-						break;
-					}
-					else if (ToLower(string(sep->arg[0])) == "bestz")
-					{
-						glm::vec3 targPos(cmdTarget->GetX(), cmdTarget->GetZ(), cmdTarget->GetY());
-
-						float bestZ = client->GetPlayer()->FindDestGroundZ(targPos, cmdTarget->GetYOffset());
-						client->Message(CHANNEL_COLOR_YELLOW, "Best Z for %s is %f", spawn->GetName(), bestZ);
-						break;
-					}
-					else if (ToLower(string(sep->arg[0])) == "inwater")
-					{
-						if (cmdTarget->GetRegionMap() == nullptr)
-							client->SimpleMessage(CHANNEL_COLOR_RED, "No water map for zone.");
-						else
-						{
-							bool inWater = cmdTarget->InWater();
-							client->Message(CHANNEL_COLOR_YELLOW, "%s is %s.", cmdTarget->GetName(), inWater ? "in water" : "out of water");
-						}
-						break;
-					}
-					else if (ToLower(string(sep->arg[0])) == "inlava")
-					{
-						if (cmdTarget->GetRegionMap() == nullptr)
-							client->SimpleMessage(CHANNEL_COLOR_RED, "No region map for zone.");
-						else
-						{
-							bool inLava = cmdTarget->InLava();
-							client->Message(CHANNEL_COLOR_YELLOW, "%s is %s.", cmdTarget->GetName(), inLava ? "in lava" : "out of lava");
-						}
-						break;
-					}
-					else if (ToLower(string(sep->arg[0])) == "regions")
-					{
-						glm::vec3 targPos(cmdTarget->GetX(), cmdTarget->GetY(), cmdTarget->GetZ());
-
-						if (cmdTarget->GetRegionMap() == nullptr)
-							client->SimpleMessage(CHANNEL_COLOR_RED, "No region map for zone.");
-						else
-						{
-							cmdTarget->GetRegionMap()->IdentifyRegionsInGrid(client, targPos);
-						}
-						break;
-					}
-					else if (ToLower(string(sep->arg[0])) == "behind")
-					{
-						bool isBehind = client->GetPlayer()->BehindTarget(cmdTarget);
-						client->Message(CHANNEL_COLOR_YELLOW, "%s %s.", isBehind ? "YOU are behind" : "YOU are NOT behind", cmdTarget->GetName());
-						break;
-					}
-					else if (ToLower(string(sep->arg[0])) == "infront")
-					{
-						bool isBehind = client->GetPlayer()->InFrontSpawn(cmdTarget, client->GetPlayer()->GetX(), client->GetPlayer()->GetZ());
-						client->Message(CHANNEL_COLOR_YELLOW, "%s %s.", isBehind ? "YOU are infront of" : "YOU are NOT infront of", cmdTarget->GetName());
-						break;
-					}
-					else if (ToLower(string(sep->arg[0])) == "flank")
-					{
-						bool isFlanking = client->GetPlayer()->FlankingTarget(cmdTarget);
-						client->Message(CHANNEL_COLOR_YELLOW, "%s is %s.", isFlanking ? "YOU are flanking" : "YOU are NOT flanking", cmdTarget->GetName());
-						break;
-					}
-				}
-				if (sep->IsNumber(0))
-				{
-					float radius = atof(sep->arg[0]);
-					if (!client->GetCurrentZone()->SendRadiusSpawnInfo(client, radius))
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "No results in the radius were found.");
-					break;
-				}
-			}
-			if (spawn) {
-				const char* type = "NPC";
-				if (spawn->IsObject())
-					type = "Object";
-				else if (spawn->IsSign())
-					type = "Sign";
-				else if (spawn->IsWidget())
-					type = "Widget";
-				else if (spawn->IsGroundSpawn())
-					type = "GroundSpawn";
-				client->Message(CHANNEL_COLOR_YELLOW, "Name: %s, %s ID: %u", spawn->GetName(), type, spawn->GetDatabaseID());
-				client->Message(CHANNEL_COLOR_YELLOW, "Last Name: %s, Sub-Title: %s, Prefix: %s, Suffix: %s", spawn->GetLastName(), spawn->GetSubTitle(), spawn->GetPrefixTitle(), spawn->GetSuffixTitle());
-				client->Message(CHANNEL_COLOR_YELLOW, "Spawn Location ID: %u, Spawn Group ID: %u", spawn->GetSpawnLocationID(), spawn->GetSpawnGroupID());
-				client->Message(CHANNEL_COLOR_YELLOW, "Faction ID: %u, Merchant ID: %u, Transporter ID: %u", spawn->GetFactionID(), spawn->GetMerchantID(), spawn->GetTransporterID());
-				client->Message(CHANNEL_COLOR_YELLOW, "Grid ID: %u", spawn->GetLocation());
-				client->Message(CHANNEL_COLOR_YELLOW, "Race: %i, Class: %i, Gender: %i", spawn->GetRace(), spawn->GetAdventureClass(), spawn->GetGender());
-				client->Message(CHANNEL_COLOR_YELLOW, "Level: %i, HP: %u, Power: %u", spawn->GetLevel(), spawn->GetHP(), spawn->GetPower());
-				client->Message(CHANNEL_COLOR_YELLOW, "Respawn Time: %u (sec), X: %f, Y: %f, Z: %f Heading: %f", spawn->GetRespawnTime(), spawn->GetX(), spawn->GetY(), spawn->GetZ(), spawn->GetHeading());
-				client->Message(CHANNEL_COLOR_YELLOW, "Collision Radius: %i, Size: %i, Difficulty: %i, Heroic: %i", spawn->GetCollisionRadius(), spawn->GetSize(), spawn->GetEncounterLevel(), spawn->GetHeroic());
-				client->Message(CHANNEL_COLOR_YELLOW, "Targetable: %i, Show Name: %i, Attackable: %i, Show Level: %i", spawn->GetTargetable(), spawn->GetShowName(), spawn->GetAttackable(), spawn->GetShowLevel());
-				client->Message(CHANNEL_COLOR_YELLOW, "Show Command Icon: %i, Display Hand Icon: %i", spawn->GetShowCommandIcon(), spawn->GetShowHandIcon());
-				if (spawn->IsEntity()) {
-					client->Message(CHANNEL_COLOR_YELLOW, "Facial Hair Type: %i, Hair Type: %i, Chest Type: %i, Legs Type: %i", ((Entity*)spawn)->GetFacialHairType(), ((Entity*)spawn)->GetHairType(), ((Entity*)spawn)->GetChestType(), ((Entity*)spawn)->GetLegsType());
-					client->Message(CHANNEL_COLOR_YELLOW, "Soga Facial Hair Type: %i, Soga Hair Type: %i, Wing Type: %i", ((Entity*)spawn)->GetSogaFacialHairType(), ((Entity*)spawn)->GetSogaHairType(), ((Entity*)spawn)->GetWingType());
-				}
-				client->Message(CHANNEL_COLOR_YELLOW, "Model Type: %i, Soga Race Type: %i", spawn->GetModelType(), spawn->GetSogaModelType());
-				client->Message(CHANNEL_COLOR_YELLOW, "Primary Command Type: %u, Secondary Command Type: %u", spawn->GetPrimaryCommandListID(), spawn->GetSecondaryCommandListID());
-				client->Message(CHANNEL_COLOR_YELLOW, "Visual State: %i, Action State: %i, Mood State: %i, Initial State: %i, Activity Status: %i", spawn->GetVisualState(), spawn->GetActionState(), spawn->GetMoodState(), spawn->GetInitialState(), spawn->GetActivityStatus());
-				client->Message(CHANNEL_COLOR_YELLOW, "Emote State: %i, Pitch: %f, Roll: %f, Hide Hood: %i", spawn->GetEmoteState(), spawn->GetPitch(), spawn->GetRoll(), spawn->appearance.hide_hood);
-				if (spawn->IsNPC())
-					client->Message(CHANNEL_COLOR_YELLOW, "Randomize: %u", ((NPC*)spawn)->GetRandomize());
-
-				client->Message(CHANNEL_COLOR_YELLOW, "Heat Resist/Base: %u/%u",((NPC*)spawn)->GetHeatResistance(), ((NPC*)spawn)->GetHeatResistanceBase());					
-				client->Message(CHANNEL_COLOR_YELLOW, "Cold Resist/Base: %u/%u",((NPC*)spawn)->GetColdResistance(), ((NPC*)spawn)->GetColdResistanceBase());
-				client->Message(CHANNEL_COLOR_YELLOW, "Magic Resist/Base: %u/%u",((NPC*)spawn)->GetMagicResistance(), ((NPC*)spawn)->GetMagicResistanceBase());
-				client->Message(CHANNEL_COLOR_YELLOW, "Mental Resist/Base: %u/%u",((NPC*)spawn)->GetMentalResistance(), ((NPC*)spawn)->GetMentalResistanceBase());
-				client->Message(CHANNEL_COLOR_YELLOW, "Divine Resist/Base: %u/%u",((NPC*)spawn)->GetDivineResistance(), ((NPC*)spawn)->GetDivineResistanceBase());
-				client->Message(CHANNEL_COLOR_YELLOW, "Disease Resist/Base: %u/%u",((NPC*)spawn)->GetDiseaseResistance(), ((NPC*)spawn)->GetDiseaseResistanceBase());
-				client->Message(CHANNEL_COLOR_YELLOW, "Poison Resist/Base: %u/%u",((NPC*)spawn)->GetPoisonResistance(), ((NPC*)spawn)->GetPoisonResistanceBase());
-
-				string details;
-				details += "\\#0000FFName:	" + string(spawn->GetName()) + "\n";
-				details += "Type:	" + string(type) + "\n";
-				details += "ID:	" + to_string(spawn->GetDatabaseID()) + "\n";
-				details += "Last Name:	" + string(spawn->GetLastName()) + "\n";
-				details += "Sub-Title:	" + string(spawn->GetSubTitle()) + "\n";
-				details += "Prefix:	" + string(spawn->GetPrefixTitle()) + "\n";
-				details += "Suffix:	" + string(spawn->GetSuffixTitle()) + "\n";
-				details += "Race:		" + to_string(spawn->GetRace()) + "\n";
-				details += "Class:		" + to_string(spawn->GetAdventureClass()) + "\n";
-				details += "Gender:		" + to_string(spawn->GetGender()) + "\n";
-				details += "Level:		" + to_string(spawn->GetLevel()) + "\n";
-				details += "HP:		" + to_string(spawn->GetHP()) + "\n";
-				details += "Power:		" + to_string(spawn->GetPower()) + "\n";
-				details += "Difficulty:		" + to_string(spawn->GetEncounterLevel()) + "\n";
-				details += "Heroic:		" + to_string(spawn->GetHeroic()) + "\n";
-				details += "Group ID:		" + to_string(spawn->GetSpawnGroupID()) + "\n";
-				details += "Faction ID:		" + to_string(spawn->GetFactionID()) + "\n";
-				details += "Merchant ID:	" + to_string(spawn->GetMerchantID()) + "\n";
-				details += "Transport ID:	" + to_string(spawn->GetTransporterID()) + "\n";
-				details += "Location ID:	" + to_string(spawn->GetSpawnLocationID()) + "\n";
-				char x[16];
-				sprintf(x, "%.2f", spawn->GetX());
-				char y[16];
-				sprintf(y, "%.2f", spawn->GetY());
-				char z[16];
-				sprintf(z, "%.2f", spawn->GetZ());
-				details += "Location:	" + string(x) + ", " + string(y) + ", " + string(z) + "\n";
-
-				string details2;
-				details2 += "Heading:		" + to_string(spawn->GetHeading()) + "\n";
-				details2 += "Grid ID:		" + to_string(spawn->GetLocation()) + "\n";
-				details2 += "Size:		" + to_string(spawn->GetSize()) + "\n";
-				details2 += "Collision Radius:	" + to_string(spawn->GetCollisionRadius()) + "\n";
-				details2 += "Respawn Time:	" + to_string(spawn->GetRespawnTime()) + "\n";
-				details2 += "Targetable:		" + to_string(spawn->GetTargetable()) + "\n";
-				details2 += "Show Name:	" + to_string(spawn->GetShowName()) + "\n";
-				details2 += "Attackable:		" + to_string(spawn->GetAttackable()) + "\n";
-				details2 += "Show Level:		" + to_string(spawn->GetShowLevel()) + "\n";
-				details2 += "Show Command Icon:	" + to_string(spawn->GetShowCommandIcon()) + "\n";
-				details2 += "Display Hand Icon:	" + to_string(spawn->GetShowHandIcon()) + "\n";
-				details2 += "Model Type:		" + to_string(spawn->GetModelType()) + "\n";
-				details2 += "Soga Race Type:	" + to_string(spawn->GetSogaModelType()) + "\n";
-				details2 += "Primary Command ID:	" + to_string(spawn->GetPrimaryCommandListID()) + "\n";
-				details2 += "Secondary Cmd ID:	" + to_string(spawn->GetSecondaryCommandListID()) + "\n";
-				details2 += "Visual State:		" + to_string(spawn->GetVisualState()) + "\n";
-				details2 += "Action State:	" + to_string(spawn->GetActionState()) + "\n";
-				details2 += "Mood State:		" + to_string(spawn->GetMoodState()) + "\n";
-				details2 += "Initial State:		" + to_string(spawn->GetInitialState()) + "\n";
-				details2 += "Activity Status:	" + to_string(spawn->GetActivityStatus()) + "\n";
-				details2 += "Emote State:		" + to_string(spawn->GetEmoteState()) + "\n";
-
-				string details3;
-				details3 += "Pitch:	" + to_string(spawn->GetPitch()) + "\n";
-				details3 += "Roll:	" + to_string(spawn->GetRoll()) + "\n";
-				details3 += "Hide Hood:	" + to_string(spawn->appearance.hide_hood) + "\n";
-				details3 += "Speed:	" + to_string(spawn->GetSpeed()) + "\n";
-				details3 += "BaseSpeed:	" + to_string(spawn->GetBaseSpeed()) + "\n";
-
-				if(spawn->IsEntity())
-				{
-					Entity* ent = (Entity*)spawn;
-					details3 += "STR / STRBase:	" + to_string(ent->GetInfoStruct()->get_str()) + " / " + to_string(ent->GetInfoStruct()->get_str_base()) + "\n";
-					details3 += "AGI / AGIBase:	" + to_string(ent->GetInfoStruct()->get_agi()) + " / " + to_string(ent->GetInfoStruct()->get_agi_base()) + "\n";
-					details3 += "STA / STABase:	" + to_string(ent->GetInfoStruct()->get_sta()) + " / " + to_string(ent->GetInfoStruct()->get_sta_base()) + "\n";
-					details3 += "INT / INTBase:	" + to_string(ent->GetInfoStruct()->get_intel()) + " / " + to_string(ent->GetInfoStruct()->get_intel_base()) + "\n";
-					details3 += "WIS / WISBase:	" + to_string(ent->GetInfoStruct()->get_wis()) + " / " + to_string(ent->GetInfoStruct()->get_wis_base()) + "\n";
-				}
-
-				string details4;
-				if (spawn->IsEntity()) {
-					details4 += "Facial Hair Type:	" + to_string(((Entity*)spawn)->GetFacialHairType()) + "\n";
-					details4 += "Hair Type:		" + to_string(((Entity*)spawn)->GetHairType()) + "\n";
-					details4 += "Chest Type:		" + to_string(((Entity*)spawn)->GetChestType()) + "\n";
-					details4 += "Legs Type:		" + to_string(((Entity*)spawn)->GetLegsType()) + "\n";
-					details4 += "Soga Facial Hair Type:	" + to_string(((Entity*)spawn)->GetSogaFacialHairType()) + "\n";
-					details4 += "Soga Hair Type:	" + to_string(((Entity*)spawn)->GetSogaHairType()) + "\n";
-					details4 += "Wing Type:		" + to_string(((Entity*)spawn)->GetWingType()) + "\n";
-					if (spawn->IsNPC()) {
-						details4 += "\nRandomize:		" + to_string(((NPC*)spawn)->GetRandomize()) + "\n";
-					}
-
-					const char* spawnScriptMsg = (spawn->GetSpawnScript() && strlen(spawn->GetSpawnScript())>0) ? spawn->GetSpawnScript() : "Not Set";
-
-						details4 += "\nSpawnScript:		" + std::string(spawnScriptMsg) + "\n";
-				}
-
-				string title = string(spawn->GetName()) + "(" + to_string(spawn->GetDatabaseID()) + ")";
-				client->SendShowBook(client->GetPlayer(), title, 4, details, details2, details3, details4);
-			}
-			else {
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn details (radius)");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "This will display information about the currently selected spawn, or in the case of specifying a numerical radius will show minor details about spawns in the players radius.");
-			}
-			break;
-								   }
-		case COMMAND_SPAWN_TARGET:{
-			if(sep && sep->arg[0][0] && sep->IsNumber(0)){
-				int32 spawn_id = atoul(sep->arg[0]);
-				int16 response = client->GetCurrentZone()->SetSpawnTargetable(spawn_id);
-				client->Message(CHANNEL_COLOR_YELLOW, "%i spawn(s) in the current zone were reset to targetable.", response);
-			}
-			else if(sep && sep->arg[0][0] && sep->arg[1][0] && sep->IsNumber(1) && ToLower(string(sep->arg[0])) == "radius"){
-				float distance = atof(sep->arg[1]);
-				int16 response = client->GetCurrentZone()->SetSpawnTargetable(client->GetPlayer(), distance);
-				client->Message(CHANNEL_COLOR_YELLOW, "%i spawn(s) in the current zone were reset to targetable.", response);
-			}
-			else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn target [spawn id]");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "This will set the given spawn as targetable.  Used to change a spawn if it was set to untargetable.");
-			}
-			break;
-								  }
-		case COMMAND_SPAWN_SET:
-			{
-			Spawn* spawn = cmdTarget;
-			sint16 set_type = -1; 
-			string type_str;
-
-			if (spawn)
-			{
-				// check if parameters are (location or list or not player and not a 2nd param), and that there is at least 1 value
-				if(sep && ((sep->arg[0][0] && ToLower(string(sep->arg[0])) == "location") || (sep->arg[0][0] && ToLower(string(sep->arg[0])) == "list") || (spawn && spawn->IsPlayer() == false && sep->arg[1][0])) && spawn_set_values.count(ToLower(string(sep->arg[0]))) == 1)
-				{
-					// set the type, which will be 0 if location or list or invalid
-					set_type = spawn_set_values[ToLower(string(sep->arg[0]))];
-				}
-
-				if(set_type > 0)
-				{
-					// check if spawn set is NOT a char update, or not location, or isn't a number
-					if(!(set_type >= SPAWN_SET_VALUE_PREFIX) && !(set_type <= SPAWN_SET_VALUE_MERCHANT_MAX_LEVEL) && set_type != SPAWN_SET_VALUE_NAME && ((set_type < SPAWN_SET_VALUE_SPAWN_SCRIPT) || (set_type > SPAWN_SET_VALUE_SUB_TITLE)) && set_type != SPAWN_SET_VALUE_LOCATION && sep->IsNumber(1) == false)
-					{
-						client->SimpleMessage(CHANNEL_COLOR_RED, "Invalid value for set command.");
-					}
-					else
-					{
-						string name = string(spawn->GetName());
-						bool customSetSpawn = false;
-						if(set_type >= SPAWN_SET_CHEEK_TYPE && set_type <= SPAWN_SET_SOGA_NOSE_TYPE)
-						{
-							int8 index = sep->IsNumber(2) ? atoul(sep->arg[2]) : 0;
-
-							// override the standard setspawncommand, we pass arguments different!
-							if(SetSpawnCommand(client, spawn, set_type, sep->arg[1], true, false, nullptr, index))
-								customSetSpawn = true;
-						}
-
-						if(customSetSpawn || SetSpawnCommand(client, spawn, set_type, sep->argplus[1]))
-						{
-							if (set_type == SPAWN_SET_VALUE_EXPANSION_FLAG || set_type == SPAWN_SET_VALUE_HOLIDAY_FLAG)
-							{
-								client->SimpleMessage(CHANNEL_COLOR_YELLOW, "A /reload spawns is required to properly update the spawns with the xpack/holiday flag.");
-							}
-							else if (set_type == SPAWN_SET_VALUE_NAME)
-							{
-								client->SimpleMessage(CHANNEL_COLOR_YELLOW, "New name will not be effective until zone reload.");
-							}
-							else if (set_type == SPAWN_SET_SKIN_COLOR || (set_type >= SPAWN_SET_HAIR_COLOR1 && set_type <= SPAWN_SET_SOGA_EYE_COLOR))
-							{
-								client->Message(CHANNEL_COLOR_YELLOW, "Successfully set color field to R G B: %s.", sep->argplus[1]);
-							}
-							else if(set_type == SPAWN_SET_VALUE_LOCATION)
-							{
-								spawn->SetLocation(client->GetPlayer()->GetLocation());
-								client->Message(CHANNEL_COLOR_YELLOW, "Successfully set '%s' to '%u' for spawn '%s'", sep->arg[0], client->GetPlayer()->GetLocation(), name.c_str());
-							}
-							else
-							{
-								client->Message(CHANNEL_COLOR_YELLOW, "Successfully set '%s' to '%s' for spawn '%s'", sep->arg[0], sep->arg[1], name.c_str());
-							}
-
-							switch (set_type)
-							{
-								case SPAWN_SET_VALUE_EXPANSION_FLAG:
-								case SPAWN_SET_VALUE_HOLIDAY_FLAG:
-								case SPAWN_SET_VALUE_FACTION:
-								case SPAWN_SET_AAXP_REWARDS:
-								case SPAWN_SET_CHEEK_TYPE:
-								case SPAWN_SET_CHIN_TYPE:
-								case SPAWN_SET_EAR_TYPE:
-								case SPAWN_SET_EYE_BROW_TYPE:
-								case SPAWN_SET_EYE_TYPE:
-								case SPAWN_SET_LIP_TYPE:
-								case SPAWN_SET_NOSE_TYPE:
-								case SPAWN_SET_BODY_SIZE:
-								case SPAWN_SET_BODY_AGE:
-								case SPAWN_SET_SOGA_CHEEK_TYPE:
-								case SPAWN_SET_SOGA_CHIN_TYPE:
-								case SPAWN_SET_SOGA_EAR_TYPE:
-								case SPAWN_SET_SOGA_EYE_BROW_TYPE:
-								case SPAWN_SET_SOGA_EYE_TYPE:
-								case SPAWN_SET_SOGA_LIP_TYPE:
-								case SPAWN_SET_SOGA_NOSE_TYPE:
-								case SPAWN_SET_SOGA_BODY_SIZE:
-								case SPAWN_SET_SOGA_BODY_AGE:
-								{
-									// not applicable already ran db command
-									break;
-								}
-								default:
-								{
-									client->GetCurrentZone()->ApplySetSpawnCommand(client, spawn, set_type, sep->argplus[1]);
-									break;
-								}
-							}
-						
-							if((set_type >= SPAWN_SET_VALUE_RESPAWN && set_type <=SPAWN_SET_VALUE_LOCATION) || (set_type >= SPAWN_SET_VALUE_EXPIRE && set_type <=SPAWN_SET_VALUE_Z_OFFSET) || (set_type == SPAWN_SET_VALUE_PITCH || set_type == SPAWN_SET_VALUE_ROLL))
-							{
-								if(spawn->GetSpawnLocationID() > 0 && database.UpdateSpawnLocationSpawns(spawn))
-								{
-									client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Successfully saved spawn information.");
-								}
-								else if(spawn->GetSpawnLocationID() > 0)
-								{
-									client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Error saving spawn information, see console window for details.");				
-								}
-							}
-							else
-							{
-								if(spawn->GetDatabaseID() > 0 && database.SaveSpawnInfo(spawn))
-								{
-									client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Successfully saved spawn.");
-								}
-								else if(spawn->GetDatabaseID() > 0)
-								{
-									client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Error saving spawn, see console window for details.");
-								}
-							}
-						}
-					}
-				}
-				else if(set_type == 0)
-				{
-					// /spawn set list - lists all possible attributes that can be changed with this command, 10 per line.
-					map<string, int8>::iterator itr;
-					int i=0;
-					string list;
-					for(itr = spawn_set_values.begin(); itr != spawn_set_values.end(); itr++, i++)
-					{
-						if(i==10)
-						{
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW, list.c_str());
-							i = 0;
-						}
-
-						if(i>0)
-						{
-							list.append(", ").append(itr->first);
-						}
-						else
-						{
-							list = itr->first;
-						}
-					}
-
-					if(list.length() > 0)
-					{
-						// if 1 or more, display in client.
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, list.c_str());
-					}
-				}
-				else
-				{
-					// syntax fail
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn set [type] [value]");
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "This command is used to change various settings for the targeted NPC or Object.");
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "For a list of changeable settings use /spawn set list");
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Note: /spawn set location does not require a value. The client's current location is used.");
-				}
-			}
-			break;
-			}
-		case COMMAND_SPAWN_REMOVE:{
-			Spawn* spawn = cmdTarget;
-			if(spawn && !spawn->IsPlayer()){
-				if(spawn->GetSpawnLocationID() > 0){
-					if(database.RemoveSpawnFromSpawnLocation(spawn)){
-						client->GetCurrentZone()->RemoveSpawn(spawn, true, false, true, true, true);
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Successfully removed spawn from zone");
-					}
-					else
-						client->SimpleMessage(CHANNEL_COLOR_RED, "Error removing spawn, see console window for details.");
-				}
-				else
-					client->SimpleMessage(CHANNEL_COLOR_RED, "This spawn does not have a spawn group associated with it");
-			}
-			else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn remove");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "This command is used for removing the targeted NPC or Object from the zone.");
-			}
-			break;
-								  }
-		case COMMAND_SPAWN_LIST:{
-			if(sep && sep->arg[0][0]){
-				vector<string>* results = database.GetSpawnNameList(sep->argplus[0]);
-				vector<string>::iterator itr;
-				if(results){
-					for(itr=results->begin();itr!=results->end();itr++){
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, (*itr).c_str());
-					}
-					safe_delete(results);
-				}
-				else
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "No matches found. ");
-			}
-			else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn list [name]");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Name can be a partial match.");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Ex: /spawn list Qeynos Guard");
-			}
-			break;
-								}
-		case COMMAND_SPAWN_ADD:{
-			Spawn* spawn = cmdTarget;
-			if(spawn && sep && sep->arg[1][0] && (sep->IsNumber(0) || strncasecmp(sep->arg[0], "new", 3) == 0)){
-				if(spawn->GetSpawnLocationID() > 0){
-					client->Message(CHANNEL_COLOR_RED, "This spawn already has a spawn group id of %u, use /spawn remove to reassign it", spawn->GetSpawnLocationID());
-					break;
-				}
-				if(spawn->GetDatabaseID() == 0){
-					if(database.SaveSpawnInfo(spawn)) {
-						char spawn_type[32];
-						memset(spawn_type, 0, sizeof(spawn_type));
-						if (spawn->IsNPC())
-							strncpy(spawn_type, "NPC", sizeof(spawn_type) - 1);
-						else if (spawn->IsObject())
-							strncpy(spawn_type, "Object", sizeof(spawn_type) - 1);
-						else if (spawn->IsSign())
-							strncpy(spawn_type, "Sign", sizeof(spawn_type) - 1);
-						else if (spawn->IsGroundSpawn())
-							strncpy(spawn_type, "GroundSpawn", sizeof(spawn_type) - 1);
-						else
-							strncpy(spawn_type, "Unknown", sizeof(spawn_type) - 1);
-						client->Message(CHANNEL_COLOR_YELLOW, "Successfully saved spawn information with a %s id of %u", spawn_type, spawn->GetDatabaseID());
-					}
-					else
-						client->SimpleMessage(CHANNEL_COLOR_RED, "Error saving spawn information, see console window for details.");
-				}
-				int32 spawn_group_id = 0;
-				if(strncasecmp(sep->arg[0], "new", 3) == 0)
-					spawn_group_id = database.GetNextSpawnLocation();
-				else
-					spawn_group_id = atol(sep->arg[0]);
-				int8 percent = 100;
-				if(sep->arg[2] && sep->IsNumber(2))
-					percent = atoi(sep->arg[2]);
-				spawn->SetSpawnLocationID(spawn_group_id);
-				float x_offset = database.GetSpawnLocationPlacementOffsetX(spawn->GetSpawnLocationID());
-				float y_offset = database.GetSpawnLocationPlacementOffsetY(spawn->GetSpawnLocationID());
-				float z_offset = database.GetSpawnLocationPlacementOffsetZ(spawn->GetSpawnLocationID());
-				if(database.SaveSpawnEntry(spawn, sep->arg[1], percent, x_offset, y_offset, z_offset))
-					client->Message(CHANNEL_COLOR_YELLOW, "Successfully saved spawn location with a spawn group of %u", spawn->GetSpawnLocationID());
-				else
-					client->SimpleMessage(CHANNEL_COLOR_RED, "Error saving spawn location, see console window for details.");	
-			}
-			else{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn add [spawn group id] [spawn group name] (percentage)");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "This command is used for adding the targeted NPC or Object to the database.");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You can substitute new for [spawn group id] to create a new one.");
-			}
-			break;
-							   }
-		case COMMAND_SPAWN:{
-			int32 id = 0;
-			Spawn* spawn = 0;
-			if(sep && sep->arg[0] && sep->IsNumber(0)){
-				id = atol(sep->arg[0]);
-				spawn = client->GetCurrentZone()->GetSpawn(id);
-			}
-			if(id > 0 && spawn && spawn->appearance.name[0] == 0)
-				id = 0;
-			if(!id || !spawn){
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn [spawn id] (x) (y) (z) (heading) (location)");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "All parameters are optional except the id.  The spawn id must be in the database.");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Ex: /spawn 1 0 0 0 0");
-				safe_delete(sep);
-				return;
-			}
-			if(sep && sep->arg[1][0]){
-				float x = atof(sep->arg[1]);
-				spawn->appearance.pos.X = x;
-			}
-			else
-				spawn->SetX(client->GetPlayer()->GetX(), false);
-			if(sep && sep->arg[2][0]){
-				float y = atof(sep->arg[2]);
-				spawn->appearance.pos.Y = y;
-			}
-			else
-				spawn->SetY(client->GetPlayer()->GetY(), false);
-			if(sep && sep->arg[3][0]){
-				float z = atof(sep->arg[3]);
-				spawn->appearance.pos.Z = z;
-			}
-			else
-				spawn->SetZ(client->GetPlayer()->GetZ(), false);
-			if(sep && sep->arg[4][0]){
-				float heading = atof(sep->arg[4]);
-				spawn->SetHeading(heading);
-			}
-			else
-				spawn->SetHeading(client->GetPlayer()->GetHeading(), false);
-			spawn->SetSpawnOrigX(spawn->GetX());
-			spawn->SetSpawnOrigY(spawn->GetY());
-			spawn->SetSpawnOrigZ(spawn->GetZ());
-			spawn->SetSpawnOrigHeading(spawn->GetHeading());
-			if(sep && sep->arg[5][0])
-				spawn->appearance.pos.grid_id = atol(sep->arg[5]);
-			else
-				spawn->appearance.pos.grid_id = client->GetPlayer()->appearance.pos.grid_id;
-
-			if(spawn->IsNPC() && spawn->GetTotalHP() == 0){
-				spawn->SetTotalHP(spawn->GetLevel() * 15);
-				spawn->SetHP(spawn->GetTotalHP());
-			}
-			if(spawn->GetTotalPower() == 0){
-				spawn->SetTotalPower(spawn->GetLevel() * 15);
-				spawn->SetPower(spawn->GetTotalPower());
-			}
-			const char* script = world.GetSpawnScript(id);
-			if(script && lua_interface && lua_interface->GetSpawnScript(script) != 0)
-				spawn->SetSpawnScript(string(script));
-
-			spawn->GetZone()->CallSpawnScript(spawn, SPAWN_SCRIPT_PRESPAWN);
-
-			client->GetCurrentZone()->AddSpawn(spawn);
-			if(spawn->IsNPC())
-				spawn->GetZone()->AddLoot((NPC*)spawn);
-			spawn->GetZone()->CallSpawnScript(spawn, SPAWN_SCRIPT_SPAWN);
-			LogWrite(COMMAND__INFO, 0, "Command", "Received spawn command - Parms: %s", command_parms->data.c_str());
-			break;
-						   }
-		case COMMAND_ADMINFLAG:
-			{
-				if(sep && sep->arg[0]){
-					sint16 tmp_status = database.GetCharacterAdminStatus(sep->arg[0]);
-					sint16 new_status = atoi(sep->arg[1]);
-					if(tmp_status == -10)
-						client->SimpleMessage(CHANNEL_ERROR,"Unable to flag character.  Reason: Character does not exist.");
-					else if(tmp_status >= client->GetAdminStatus())
-						client->SimpleMessage(CHANNEL_ERROR,"Unable to flag character.  Reason: Character has same or higher level status.");
-					else if (new_status > client->GetAdminStatus())
-						client->SimpleMessage(CHANNEL_ERROR, "Unable to flag character.  Reason: New status is higher then your status.");
-					else{
-						Client* client2 = client->GetCurrentZone()->GetClientByName(sep->arg[0]);
-						if (!client2)
-							client2 = zone_list.GetClientByCharName(sep->arg[0]);
-						
-						if(database.UpdateAdminStatus(sep->arg[0],new_status)) {
-							client->Message(CHANNEL_COLOR_YELLOW,"Character status updated to %i for %s.",new_status,sep->arg[0]);
-							if (client2) {
-								client2->SetAdminStatus(new_status);
-								client2->Message(CHANNEL_COLOR_YELLOW, "%s has set your admin status to %i.", client->GetPlayer()->GetName(), new_status);
-							}
-						}
-						else
-							client->SimpleMessage(CHANNEL_ERROR,"Unable to flag character.  Unknown reason.");
-					}
-				}else{
-					sint16 status = database.GetCharacterAdminStatus(client->GetPlayer()->GetName());
-					if(status != client->GetAdminStatus())
-					{
-						client->Message(CHANNEL_COLOR_YELLOW,"Flag status was changed from %i to %i.",status,client->GetAdminStatus());
-						client->SetAdminStatus(status);
-					}
-					else
-					{
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage: /flag {name} {new_status}");
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW," Standard User: 0");
-						client->Message(CHANNEL_COLOR_YELLOW," Admin User: %i", status);
-					}
-				}
-				break;
-			}
-		case COMMAND_CANNEDEMOTE:{
-				client->GetCurrentZone()->HandleEmote(client, command_parms->data);
-				break;
-		}
-		case COMMAND_BROADCAST: {
-			if (sep && sep->arg[0])
-				zone_list.HandleGlobalBroadcast(sep->argplus[0]);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /broadcast {message}");
-			break;
-								}
-		case COMMAND_ANNOUNCE: {
-			if (sep && sep->arg[0])
-				zone_list.HandleGlobalAnnouncement(sep->argplus[0]);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /announce {message}");
-			break;
-							   }
-		case COMMAND_RELOAD_ITEMS:{
-			LogWrite(COMMAND__INFO, 0, "Command", "Reloading items..");
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Started Reloading items (this might take a few minutes...)");
-			database.ReloadItemList();
-			database.LoadMerchantInformation();
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Finished Reloading items.");
-			break;
-								  }
-		case COMMAND_ENABLE_ABILITY_QUE:{
-			EQ2Packet* app = client->GetPlayer()->GetSpellBookUpdatePacket(client->GetVersion());
-			if(app)
-				client->QueuePacket(app);
-			break;
-										}
-		case COMMAND_ITEMSEARCH:
-		case COMMAND_FROMBROKER:{
-				PacketStruct* packet = configReader.getStruct("WS_StartBroker", client->GetVersion());
-				if (packet) {
-					packet->setDataByName("spawn_id", client->GetPlayer()->GetIDWithPlayerSpawn(client->GetPlayer()));
-					//packet->setDataByName("unknown", 1);
-					packet->setDataByName("unknown2", 5, 0);
-					packet->setDataByName("unknown2", 20, 1);
-					packet->setDataByName("unknown2", 58, 3);
-					packet->setDataByName("unknown2", 40, 4);
-					client->QueuePacket(packet->serialize());
-					PacketStruct* packet2 = configReader.getStruct("WS_BrokerBags", client->GetVersion());
-					if (packet2) {
-						packet2->setDataByName("char_id", client->GetCharacterID());
-						client->QueuePacket(packet2->serialize()); //send this for now, needed to properly clear data
-						safe_delete(packet2);
-					}
-					safe_delete(packet);
-				}
-			break;
-		}
-		case COMMAND_ANIMTEST:{
-			PacketStruct* command_packet = configReader.getStruct("WS_CannedEmote", client->GetVersion());
-			if(command_packet){
-				int32 id = client->GetPlayer()->GetIDWithPlayerSpawn(client->GetPlayer());
-				if (cmdTarget)
-					id = client->GetPlayer()->GetIDWithPlayerSpawn(cmdTarget);
-				command_packet->setDataByName ( "spawn_id" , id);
-
-				int animID = 1;
-
-				if(sep && sep->arg[0] && sep->IsNumber(0))
-					animID = atoi(sep->arg[0]);
-
-				VisualState* vs = NULL;
-				if(animID == 0)
-				{
-					vs = visual_states.FindVisualState(sep->arg[0]);
-				}
-
-
-				char msg[128];
-				sprintf(msg,"Animation Test ID: %i",animID);
-				command_packet->setMediumStringByName ( "emote_msg" , msg );
-
-				if(vs != NULL)
-					command_packet->setDataByName ( "anim_type", vs->GetID ( ) );
-				else
-					command_packet->setDataByName ( "anim_type", animID );
-
-				command_packet->setDataByName ( "unknown0", 0 );
-				EQ2Packet* outapp = command_packet->serialize();
-				client->QueuePacket(outapp);
-				safe_delete(command_packet);
-			}
-			break;
-		}
-		case COMMAND_KICK:
-			{
-				if( sep == 0 || sep->arg[0] == 0)
-				{
-					client->SimpleMessage(CHANNEL_COLOR_RED, "/kick [name]");
-				}
-				else
-				{
-					Client* kickClient = zone_list.GetClientByCharName(string(sep->arg[0]));
-
-					if ( kickClient == client )
-					{
-						client->Message(CHANNEL_COLOR_RED, "You can't kick yourself!");
-						break;
-					}
-					else if(kickClient != NULL)
-					{
-						sint16 maxStatus = database.GetHighestCharacterAdminStatus(kickClient->GetAccountID());
-
-						if ( maxStatus >= client->GetAdminStatus( ) || kickClient->GetAdminStatus() >= client->GetAdminStatus() )
-						{
-							client->Message(CHANNEL_COLOR_RED,"Don't even think about it...");
-							break;
-						}
-
-						client->Message(CHANNEL_COLOR_RED, "Kicking %s...",sep->arg[0]);
-
-						kickClient->Disconnect();
-					}
-					else
-					{
-						client->Message(CHANNEL_COLOR_RED, "Could not find %s.",sep->arg[0]);
-					}
-				}
-
-				break;
-			}
-		case COMMAND_LOCK:
-			{
-				if( sep != NULL && sep->arg[0] != NULL && sep->IsNumber(0)){
-					int worldLocked = atoi(sep->arg[0]);
-					net.world_locked = worldLocked;
-					if ( worldLocked )
-						client->Message(CHANNEL_COLOR_YELLOW,"World server has been locked.");
-					else
-						client->Message(CHANNEL_COLOR_YELLOW,"World server has been unlocked.");
-				}
-				else
-					client->SimpleMessage(CHANNEL_COLOR_RED, "/lock [0/1]");
-
-				break;
-		}
-		case COMMAND_BAN:{
-				if( sep == 0 || sep->arg[0] == 0 || (sep->arg[1][0] != 0 && !sep->IsNumber(1) ) )
-				{
-					client->SimpleMessage(CHANNEL_COLOR_RED, "/ban [name] [permanent:0/1]");
-				}
-				else
-				{
-					Client* kickClient = zone_list.GetClientByCharName(sep->arg[0]);
-
-					if ( kickClient == client )
-					{
-						client->Message(CHANNEL_COLOR_RED, "You can't ban yourself!");
-						break;
-					}
-					else if(kickClient != NULL)
-					{
-						sint16 maxStatus = database.GetHighestCharacterAdminStatus(kickClient->GetAccountID());
-
-						if ( maxStatus > client->GetAdminStatus( ) || 
-							client->GetAdminStatus ( ) > kickClient->GetAdminStatus ( ) )
-						{
-							client->Message(CHANNEL_COLOR_RED,"Don't even think about it...");
-							break;
-						}
-
-						client->Message(CHANNEL_COLOR_RED, "Kicking & Banning %s...",sep->arg[0]);
-
-						int perm = atol(sep->arg[1]);
-						if ( perm == 1 )
-							database.UpdateAdminStatus(sep->arg[0],-2);
-						else
-							database.UpdateAdminStatus(sep->arg[0],-1);
-						kickClient->Disconnect();
-					}
-					else
-					{
-						client->Message(CHANNEL_COLOR_RED, "Could not find %s.",sep->arg[0]);
-					}
-				}
-				break;
-		}
-		case COMMAND_SET_COMBAT_VOICE:{
-			int32 value = 0;
-			if(sep && sep->arg[0] && sep->IsNumber(0))
-				value = atoi(sep->arg[0]);
-			client->GetPlayer()->SetCombatVoice(value);
-			break;
-		}
-		case COMMAND_SET_EMOTE_VOICE:{
-			int32 value = 0;
-			if(sep && sep->arg[0] && sep->IsNumber(0))
-				value = atoi(sep->arg[0]);
-			client->GetPlayer()->SetEmoteVoice(value);
-			break;
-		}
-		case COMMAND_GIVEITEM:{
-
-			if(sep && sep->arg[0][0] && sep->arg[0][1] && sep->IsNumber(1)){
-				Client* itemToClient = zone_list.GetClientByCharName(sep->arg[0]);
-
-				if ( itemToClient == NULL )
-					client->Message(CHANNEL_COLOR_YELLOW,"Could not find %s.",sep->arg[0]);
-				else
-				{
-					int32 item_id = atol(sep->arg[1]);
-					client->Message(CHANNEL_COLOR_YELLOW,"Gave %s item id %i.",sep->arg[0],item_id);
-					itemToClient->AddItem(item_id);
-				}
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage: /giveitem [name] [item_id]");
-
-			break;
-							  }
-
-		case COMMAND_REPORT_BUG			: { Command_ReportBug(client, sep); break; }
-		case COMMAND_INVENTORY			: { Command_Inventory(client, sep, command); break; }
-		case COMMAND_WEAPONSTATS		: { Command_WeaponStats(client); break; }
-		case COMMAND_SKILL				: 
-		case COMMAND_SKILL_ADD			:
-		case COMMAND_SKILL_REMOVE		:
-		case COMMAND_SKILL_LIST			: { Command_Skills(client, sep, command->handler); break; }
-		case COMMAND_ZONE_SET			: { Command_ZoneSet(client, sep); break; }
-		case COMMAND_ZONE_DETAILS		: { Command_ZoneDetails(client, sep); break; }
-		case COMMAND_ENTITYCOMMAND		: 
-		case COMMAND_ENTITYCOMMAND_LIST	: { Command_EntityCommand(client, sep, command->handler); break; }
-		case COMMAND_MERCHANT			: 
-		case COMMAND_MERCHANT_LIST		: { Command_Merchant(client, sep, command->handler); break; }
-		case COMMAND_APPEARANCE			: 
-		case COMMAND_APPEARANCE_LIST	: { Command_Appearance(client, sep, command->handler); break; }
-		case COMMAND_TRACK				: { Command_Track(client); break; }
-		case COMMAND_DISTANCE			: { Command_Distance(client); break; }
-		case COMMAND_INSPECT_PLAYER		: { Command_InspectPlayer(client, sep); break; }
-		case COMMAND_ZONE_SAFE			: { Command_ZoneSafeCoords(client, sep); break; }
-		case COMMAND_GUILDSAY			: { Command_GuildSay(client, sep); break; }
-		case COMMAND_OFFICERSAY			: { Command_OfficerSay(client, sep); break; }
-		case COMMAND_SET_GUILD_MEMBER_NOTE	: { Command_SetGuildMemberNote(client, sep); break; }
-		case COMMAND_SET_GUILD_OFFICER_NOTE	: { Command_SetGuildOfficerNote(client, sep); break; }
-		case COMMAND_GUILD				: { Command_Guild(client, sep); break; }
-		case COMMAND_CREATE_GUILD		: { Command_CreateGuild(client); break; }
-		case COMMAND_GUILDS				: { Command_Guilds(client); break; }
-		case COMMAND_GUILDS_ADD			: { Command_GuildsAdd(client, sep); break; }
-		case COMMAND_GUILDS_CREATE		: { Command_GuildsCreate(client, sep); break; }
-		case COMMAND_GUILDS_DELETE		: { Command_GuildsDelete(client, sep); break; }
-		case COMMAND_GUILDS_LIST		: { Command_GuildsList(client); break; }
-		case COMMAND_GUILDS_REMOVE		: { Command_GuildsRemove(client, sep); break; }
-		case COMMAND_CLAIM				: { Command_Claim(client, sep); break; }
-		case COMMAND_CLEAR_ALL_QUEUED	: { Command_ClearAllQueued(client); break; }
-		case COMMAND_LOCATION			: { Command_Location(client); break; }
-		case COMMAND_LOCATION_ADD		: { Command_LocationAdd(client, sep); break; }
-		case COMMAND_LOCATION_CREATE	: { Command_LocationCreate(client, sep); break; }
-		case COMMAND_LOCATION_DELETE	: { Command_LocationDelete(client, sep); break; }
-		case COMMAND_LOCATION_LIST		: { Command_LocationList(client, sep); break; }
-		case COMMAND_LOCATION_REMOVE	: { Command_LocationRemove(client, sep); break; }
-		case COMMAND_GRID				: { Command_Grid(client); break; }
-		case COMMAND_TRY_ON				: { Command_TryOn(client, sep); break; }
-		case COMMAND_IRC				: { Command_IRC(client, sep); break; }
-		case COMMAND_RANDOMIZE			: { Command_Randomize(client, sep); break; }
-		case COMMAND_AFK				: { Command_AFK(client, sep); break; }
-		case COMMAND_SHOW_CLOAK			: { Command_ShowCloak(client, sep); break; }
-		case COMMAND_SHOW_HELM			: { Command_ShowHelm(client, sep); break; }
-		case COMMAND_SHOW_HOOD			: { Command_ShowHood(client, sep); break; }
-		case COMMAND_SHOW_HOOD_OR_HELM	: { Command_ShowHoodHelm(client, sep); break; }
-		case COMMAND_SHOW_RANGED		: { Command_ShowRanged(client, sep); break; }
-		case COMMAND_STOP_DRINKING		: { Command_StopDrinking(client); break; }
-		case COMMAND_STOP_EATING		: { Command_StopEating(client); break; }
-		case COMMAND_TOGGLE_ANONYMOUS	: { Command_Toggle_Anonymous(client); break; }
-		case COMMAND_TOGGLE_AUTOCONSUME	: { Command_Toggle_AutoConsume(client, sep); break; }
-		case COMMAND_TOGGLE_BONUS_EXP	: { Command_Toggle_BonusXP(client); break; }
-		case COMMAND_TOGGLE_COMBAT_EXP	: { Command_Toggle_CombatXP(client); break; }
-		case COMMAND_TOGGLE_GM_HIDE		: { Command_Toggle_GMHide(client); break; }
-		case COMMAND_TOGGLE_GM_VANISH	: { Command_Toggle_GMVanish(client); break; }
-		case COMMAND_TOGGLE_ILLUSIONS	: { Command_Toggle_Illusions(client, sep); break; }
-		case COMMAND_TOGGLE_LFG			: { Command_Toggle_LFG(client); break; }
-		case COMMAND_TOGGLE_LFW			: { Command_Toggle_LFW(client); break; }
-		case COMMAND_TOGGLE_QUEST_EXP	: { Command_Toggle_QuestXP(client); break; }
-		case COMMAND_TOGGLE_ROLEPLAYING	: { Command_Toggle_Roleplaying(client); break; }
-		case COMMAND_TOGGLE_DUELS		: { Command_Toggle_Duels(client); break; }
-		case COMMAND_TOGGLE_TRADES		: { Command_Toggle_Trades(client); break; }
-		case COMMAND_TOGGLE_GUILDS		: { Command_Toggle_Guilds(client); break; }
-		case COMMAND_TOGGLE_GROUPS		: { Command_Toggle_Groups(client); break; }
-		case COMMAND_TOGGLE_RAIDS		: { Command_Toggle_Raids(client); break; }
-		case COMMAND_TOGGLE_LON			: { Command_Toggle_LON(client); break; }
-		case COMMAND_TOGGLE_VCINVITE	: { Command_Toggle_VoiceChat(client); break; }
-		case COMMAND_CANCEL_MAINTAINED	: { Command_CancelMaintained(client, sep); break; }
-		case COMMAND_MOTD				: { Command_MOTD(client); break; }
-		case COMMAND_RANDOM				: { Command_Random(client, sep); break; }
-		case COMMAND_CREATE				: { Command_Create(client, sep); break; }
-		case COMMAND_CREATEFROMRECIPE	: { Command_CreateFromRecipe(client, sep); break; }
-		case COMMAND_TITLE				: { Command_Title(client); break; }
-		case COMMAND_TITLE_LIST			: { Command_TitleList(client); break; }
-		case COMMAND_TITLE_SETPREFIX	: { Command_TitleSetPrefix(client, sep); break; }
-		case COMMAND_TITLE_SETSUFFIX	: { Command_TitleSetSuffix(client, sep); break; }
-		case COMMAND_TITLE_FIX			: { Command_TitleFix(client, sep); break; }
-		case COMMAND_LANGUAGES			: { Command_Languages(client, sep); break; }
-		case COMMAND_SET_LANGUAGE		: { Command_SetLanguage(client, sep); break; }
-		case COMMAND_FOLLOW				: { Command_Follow(client, sep); break; }
-		case COMMAND_STOP_FOLLOW		: { Command_StopFollow(client, sep); break; }
-		case COMMAND_LASTNAME			: { Command_LastName(client, sep); break; }
-		case COMMAND_CONFIRMLASTNAME	: { Command_ConfirmLastName(client, sep); break; }
-		case COMMAND_PET				: { Command_Pet(client, sep); break; }
-		case COMMAND_PETNAME			: { Command_PetName(client, sep); break; }
-		case COMMAND_NAME_PET			: { Command_NamePet(client, sep); break; }
-		case COMMAND_RENAME				: { Command_Rename(client, sep); break; }
-		case COMMAND_CONFIRMRENAME		: { Command_ConfirmRename(client, sep); break; }
-		case COMMAND_PETOPTIONS			: { Command_PetOptions(client, sep); break; }
-		case COMMAND_START_TRADE		: { Command_TradeStart(client, sep); break; }
-		case COMMAND_ACCEPT_TRADE		: { Command_TradeAccept(client, sep); break; }
-		case COMMAND_REJECT_TRADE		: { Command_TradeReject(client, sep); break; }
-		case COMMAND_CANCEL_TRADE		: { Command_TradeCancel(client, sep); break; }
-		case COMMAND_SET_TRADE_COIN		: { Command_TradeSetCoin(client, sep); break; }
-		case COMMAND_ADD_TRADE_COPPER	: { Command_TradeAddCoin(client, sep, COMMAND_ADD_TRADE_COPPER); break; }
-		case COMMAND_ADD_TRADE_SILVER	: { Command_TradeAddCoin(client, sep, COMMAND_ADD_TRADE_SILVER); break; }
-		case COMMAND_ADD_TRADE_GOLD		: { Command_TradeAddCoin(client, sep, COMMAND_ADD_TRADE_GOLD); break; }
-		case COMMAND_ADD_TRADE_PLAT		: { Command_TradeAddCoin(client, sep, COMMAND_ADD_TRADE_PLAT); break; }
-		case COMMAND_REMOVE_TRADE_COPPER: { Command_TradeRemoveCoin(client, sep, COMMAND_REMOVE_TRADE_COPPER); break; }
-		case COMMAND_REMOVE_TRADE_SILVER: { Command_TradeRemoveCoin(client, sep, COMMAND_REMOVE_TRADE_SILVER); break; }
-		case COMMAND_REMOVE_TRADE_GOLD	: { Command_TradeRemoveCoin(client, sep, COMMAND_REMOVE_TRADE_GOLD); break; }
-		case COMMAND_REMOVE_TRADE_PLAT	: { Command_TradeRemoveCoin(client, sep, COMMAND_REMOVE_TRADE_PLAT); break; }
-		case COMMAND_ADD_TRADE_ITEM		: { Command_TradeAddItem(client, sep); break; }
-		case COMMAND_REMOVE_TRADE_ITEM	: { Command_TradeRemoveItem(client, sep); break; }
-		case COMMAND_ACCEPT_ADVANCEMENT	: { Command_AcceptAdvancement(client, sep); break; }
-		case COMMAND_DUEL				: { Command_Duel(client, sep); break; }
-		case COMMAND_DUELBET			: { Command_DuelBet(client, sep); break; }
-		case COMMAND_DUEL_ACCEPT		: { Command_DuelAccept(client, sep); break; }
-		case COMMAND_DUEL_DECLINE		: { Command_DuelDecline(client, sep); break; }
-		case COMMAND_DUEL_SURRENDER		: { Command_DuelSurrender(client, sep); break; }
-		case COMMAND_DUEL_TOGGLE		: { Command_DuelToggle(client, sep); break; }
-		case COMMAND_SPAWN_TEMPLATE		: { Command_SpawnTemplate(client, sep); break; }
-		//devn00b
-		case COMMAND_MOOD				: { Command_Mood(client, sep); break;}
-
-		case COMMAND_MODIFY				: { Command_Modify(client); break; }
-		case COMMAND_MODIFY_CHARACTER	: { Command_ModifyCharacter(client, sep); break; }
-		case COMMAND_MODIFY_QUEST		: { Command_ModifyQuest(client, sep); break; }
-		case COMMAND_MODIFY_FACTION		: { Command_ModifyFaction(client, sep); break; }
-		case COMMAND_MODIFY_GUILD		: { Command_ModifyGuild(client, sep); break; }
-		case COMMAND_MODIFY_ITEM		: { Command_ModifyItem(client, sep); break; }
-		case COMMAND_MODIFY_SKILL		: { Command_ModifySkill(client, sep); break; }
-		case COMMAND_MODIFY_SPAWN		: { Command_ModifySpawn(client, sep); break; }
-	    case COMMAND_MODIFY_SPELL		: { Command_ModifySpell(client, sep); break; }
-		case COMMAND_MODIFY_ZONE		: { Command_ModifyZone(client, sep); break; }
-
-		case COMMAND_JOIN_CHANNEL		: { Command_JoinChannel(client, sep); break;}
-		case COMMAND_JOIN_CHANNEL_FROM_LOAD: { Command_JoinChannelFromLoad(client, sep); break;}
-		case COMMAND_TELL_CHANNEL		: { Command_TellChannel(client, sep); break;}
-		case COMMAND_LEAVE_CHANNEL		: { Command_LeaveChannel(client, sep); break;}
-		case COMMAND_WHO_CHANNEL		: { Command_WhoChannel(client, sep); break;}
-		case COMMAND_RAIN				: { Command_Rain(client, sep); break; }
-		case COMMAND_WIND				: { Command_Wind(client, sep); break; }
-		case COMMAND_WEATHER			: { Command_Weather(client, sep); break; }
-		case COMMAND_FROM_MERCHANT		: { Command_SendMerchantWindow(client, sep); break; }
-		case COMMAND_TO_MERCHANT		: { Command_SendMerchantWindow(client, sep, true); break; }
-		case COMMAND_SELECT				: { Command_Select(client, sep); break; }
-		case COMMAND_SMP				: { Command_StationMarketPlace(client, sep); break; }
-		case COMMAND_CONSUME_FOOD		: { Command_ConsumeFood(client, sep); break; }
-		case COMMAND_AQUAMAN			: { Command_Aquaman(client, sep); break; }
-		case COMMAND_ATTUNE_INV			: { Command_Attune_Inv(client, sep); break; }
-		case COMMAND_PLAYER				: { Command_Player(client, sep); break; }
-		case COMMAND_PLAYER_COINS		: { Command_Player_Coins(client, sep); break; }
-		case COMMAND_RESET_ZONE_TIMER	: { Command_Reset_Zone_Timer(client, sep); break; }
-		case COMMAND_ACHIEVEMENT_ADD	: { Command_AchievementAdd(client, sep); break; }
-		case COMMAND_EDITOR				: { Command_Editor(client, sep); break; }
-		case COMMAND_ACCEPT_RESURRECTION: { Command_AcceptResurrection(client, sep); break; }
-		case COMMAND_DECLINE_RESURRECTION:{ Command_DeclineResurrection(client, sep); break; }
-		case COMMAND_TEST				: { Command_Test(client, command_parms); break; }
-		case COMMAND_SPEED				: { Command_Speed(client, sep); break; }
-
-		case COMMAND_BOT				: { Command_Bot(client, sep); break; }
-		case COMMAND_BOT_CREATE			: { Command_Bot_Create(client, sep); break; }
-		case COMMAND_BOT_CUSTOMIZE		: { Command_Bot_Customize(client, sep); break; }
-		case COMMAND_BOT_SPAWN			: { Command_Bot_Spawn(client, sep); break; }
-		case COMMAND_BOT_LIST			: { Command_Bot_List(client, sep); break; }
-		case COMMAND_BOT_INV			: { Command_Bot_Inv(client, sep); break; }
-		case COMMAND_BOT_SETTINGS		: { Command_Bot_Settings(client, sep); break; }
-		case COMMAND_BOT_HELP			: { Command_Bot_Help(client, sep); break; }
-		case GET_AA_XML					: { Get_AA_Xml(client, sep); break; }
-		case ADD_AA						: { Add_AA(client, sep); break; }
-		case COMMIT_AA_PROFILE			: { Commit_AA_Profile(client, sep); break; }
-		case BEGIN_AA_PROFILE			: { Begin_AA_Profile(client, sep); break; }
-		case BACK_AA					: { Back_AA(client, sep); break; }
-		case REMOVE_AA					: { Remove_AA(client, sep); break; }
-		case SWITCH_AA_PROFILE			: { Switch_AA_Profile(client, sep); break; }
-		case CANCEL_AA_PROFILE			: { Cancel_AA_Profile(client, sep); break; }
-		case SAVE_AA_PROFILE			: { Save_AA_Profile(client, sep); break; }
-		case COMMAND_TARGETITEM			: { Command_TargetItem(client, sep); break; }
-		case COMMAND_FINDSPAWN: { Command_FindSpawn(client, sep); break; }
-		case COMMAND_MOVECHARACTER: { Command_MoveCharacter(client, sep); break; }
-		case COMMAND_CRAFTITEM: {
-					Item* item = 0;
-					if (sep && sep->IsNumber(0)) {
-						int32 item_id = atol(sep->arg[0]);
-						int32 quantity = 1;
-
-						if (sep->arg[1] && sep->IsNumber(1))
-							quantity = atoi(sep->arg[1]);
-						item = new Item(master_item_list.GetItem(item_id));
-						if (!item) {
-							LogWrite(TRADESKILL__ERROR, 0, "CraftItem", "Item (%u) not found.", item_id);
-						}
-						else {
-							item->details.count = quantity;
-							// use CHANNEL_COLOR_CHAT_RELATIONSHIP as that is the same value (4) as it is in a log for this message
-							client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "You created %s.", item->CreateItemLink(client->GetVersion()).c_str());
-							bool itemDeleted = false;
-							client->AddItem(item, &itemDeleted);
-							//Check for crafting quest updates
-							int8 update_amt = 0;
-							if (!itemDeleted && item->stack_count > 1)
-								update_amt = 1;
-							else
-								update_amt = quantity;
-
-							if(!itemDeleted)
-								client->GetPlayer()->CheckQuestsCraftUpdate(item, update_amt);
-						}
-
-					}
-					
-					else {
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /craftitem {item_id} [quantity] ");
-						}
-					break;
-				}
-		case COMMAND_UNMENTOR:
-		case COMMAND_MENTOR: {
-			client->GetPlayer()->MentorTarget();
-			break;
-		}
-		default: 
-		{
-			LogWrite(COMMAND__WARNING, 0, "Command", "Unhandled command: %s", command->command.data.c_str());
-			break;
-		}
-
-	}
-	safe_delete(sep);
-}
-
-
-/******************** New COMMAND Handler Functions ********************/
-/*
-	Started breaking apart the huge switch() for commands into sepErate 
-	functions so it is easier to locate the blocks of code by command
-	-- JA 2012.03.03
-*/
-
-// sample function header
-/* 
-	Function: 
-	Purpose	: 
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-//void Commands::Command()
-//{
-//}
-
-
-/* 
-	Function: Command_AcceptAdvancement()
-	Purpose	: Player accepts a new advancement option
-	Params	: Spell ID
-	Dev		: Jabantiz
-*/ 
-void Commands::Command_AcceptAdvancement(Client* client, Seperator* sep)
-{
-	 Player *player = client->GetPlayer();
-	 if (sep && sep->IsSet(0)) {
-		 TraitData* trait = master_trait_list.GetTrait(atoul(sep->arg[0]));
-
-		 // Check to see if this is a trait or grandmaster training (traits are always new spells, training is always upgrades)
-		 if (!player->HasSpell(trait->spellID, 0, true))
-		 {
-			 Spell* spell = master_spell_list.GetSpell(trait->spellID, trait->tier);
-			 player->AddSpellBookEntry(trait->spellID, trait->tier, player->GetFreeSpellBookSlot(spell->GetSpellData()->spell_book_type), spell->GetSpellData()->spell_book_type, spell->GetSpellData()->linked_timer, true);
-		 }
-		 else
-		 {
-			 Spell* spell = master_spell_list.GetSpell(trait->spellID, trait->tier);
-			 int8 old_slot = player->GetSpellSlot(spell->GetSpellID());
-			 player->RemoveSpellBookEntry(spell->GetSpellID());
-			 player->AddSpellBookEntry(spell->GetSpellID(), spell->GetSpellTier(), old_slot, spell->GetSpellData()->spell_book_type, spell->GetSpellData()->linked_timer, true);
-			 player->UnlockSpell(spell);
-			 client->SendSpellUpdate(spell);
-		 }
-
-		 // Spell book update
-		 client->QueuePacket(player->GetSpellBookUpdatePacket(client->GetVersion()));
-		 client->QueuePacket(master_trait_list.GetTraitListPacket(client));
-	 }
-}
-
-/* 
-	Function: 
-	Purpose	: 
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_AFK(Client* client, Seperator* sep)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_AFK);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s afk.", client->GetPlayer()->get_character_flag(CF_AFK)?"now":"no longer");
-
-	if (player->get_character_flag(CF_AFK))
-	{
-		LogWrite(MISC__TODO, 1, "TODO", "player->SetActivityStatus(player->GetActivityStatus() + ACTIVITY_STATUS_AFK); <-- need to find this");
-		/*player->SetActivityStatus(player->GetActivityStatus() + ACTIVITY_STATUS_AFK); <-- need to find this */
-
-		if (sep && sep->argplus[0])
-			player->SetAwayMessage("I am away from the keyboard, " + string(sep->argplus[0]));
-		else
-			player->SetAwayMessage("Sorry, I am A.F.K. (Away From Keyboard)");
-
-		string message = string(player->GetName()) + " is going afk.";
-		Spawn* target = player->GetTarget();
-
-		if (target && target != player)
-		{
-			message = string(player->GetName()) + " tells " + string(target->GetName()) + " that ";
-			player->GetGender() == 1 ? message += "he" : message += "she";
-			message += " is going afk.";
-		}
-
-		player->GetZone()->SimpleMessage(CHANNEL_COLOR_YELLOW, message.c_str(), player, 30);
-	}
-	/*else
-		player->SetActivityStatus(player->GetActivityStatus() - ACTIVITY_STATUS_AFK); <-- need to find this */
-}
-
-/* 
-	Function: Command_Appearance()
-	Purpose	: Handles /appearance commands
-	Params	: list
-	Dev		: Scatman
-	Example	: /appearance list
-*/ 
-void Commands::Command_Appearance(Client* client, Seperator* sep, int handler)
-{
-	if( handler == COMMAND_APPEARANCE )
-	{
-		// /appearance command by itself shows help (to be extended)
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /appearance list [appearance name]");
-		return;
-	}
-	else if( handler == COMMAND_APPEARANCE_LIST )
-	{
-		// /appearance list command expects "name" param
-		if (sep && sep->arg[0]) 
-		{
-			const char* appearance_name = sep->argplus[0];
-			client->Message(CHANNEL_COLOR_YELLOW, "Listing appearances like '%s':", appearance_name);
-			vector<int16>* appearances = database.GetAppearanceIDsLikeName(string(appearance_name));
-
-			if (appearances) 
-			{
-				vector<int16>::iterator itr;
-				for (itr = appearances->begin(); itr != appearances->end(); itr++) 
-				{
-					int16 id = *itr;
-					string name = database.GetAppearanceName(id);
-
-					if (ToLower(name).find(ToLower(string(appearance_name))) < 0xFFFFFFFF)
-						client->Message(CHANNEL_COLOR_YELLOW, "%s (%u)", name.c_str(), id);
-				}
-				safe_delete(appearances);
-			}
-		}
-		else // no param
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /appearance list [appearance name]");
-	}
-
-}
-
-/* 
-	Function: Command_Claim()
-	Purpose	: 
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_Claim(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && sep->IsNumber(0)) 
-	{
-		LogWrite(MISC__TODO, 1, "TODO", "On Scatman's TODO list!\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "On Scatman's TODO :)");
-	}
-	else
-		client->ShowClaimWindow();
-}
-
-/* 
-	Function: Command_ClearAllQueued()
-	Purpose	: 
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_ClearAllQueued(Client* client)
-{
-	ZoneServer* zone = client->GetPlayer()->GetZone();
-	if (zone && zone->GetSpellProcess())
-		zone->GetSpellProcess()->RemoveSpellFromQueue(client->GetPlayer());
-}
-
-/* 
-	Function: Command_CancelMaintained()
-	Purpose	: Cancels maintained spells
-	Params	: Maintained Spell Index
-	Dev		: Zcoretri
-	Example	: /cancel_maintained 1 - would cancel the spell in slot 1 of Maintained Spells list
-*/ 
-void Commands::Command_CancelMaintained(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && sep->IsNumber(0)) 
-	{
-		int32 spell_index = atoul(sep->arg[0]);
-		MaintainedEffects mEffects = client->GetPlayer()->GetInfoStruct()->maintained_effects[spell_index];
-		//Spell* spell = master_spell_list.GetSpell(mEffects.spell_id, mEffects.tier);
-
-	//	if (spell && spell->GetSpellData()->friendly_spell)  -- NOTE::You can cancel hostile maintained spells, 
-		                                                     // just not spelleffects/dets - Foof
-		//{
-			if (!client->GetPlayer()->GetZone()->GetSpellProcess()->DeleteCasterSpell(mEffects.spell, "canceled", false, true))
-				client->Message(CHANNEL_COLOR_RED, "The maintained spell could not be cancelled.");
-	//	}
-		//else
-			//client->Message(CHANNEL_COLOR_RED, "You can only cancel friendly spells!");
-	}
-}
-
-/* 
-	Function: Command_Create()
-	Purpose	: Handler for starting Tradeskilling table
-	Params	: 
-	Dev		: Zcoretri
-	Example	: 
-*/ 
-void Commands::Command_Create(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_CREATE");
-	client->SendRecipeList();
-	client->ShowRecipeBook();
-}
-
-void Commands::Command_CreateFromRecipe(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_CREATEFROMRECIPE");
-	if (sep && sep->arg[0] && sep->IsNumber(0))
-		ClientPacketFunctions::SendCreateFromRecipe(client, atoul(sep->arg[0]));
-}
-
-/* 
-	Function: Command_Distance()
-	Purpose	: Displays distance from targeted spawn
-	Params	: 
-	Dev		: Scatman
-	Example	: /distance
-*/ 
-void Commands::Command_Distance(Client* client)
-{
-	Spawn* target = client->GetPlayer()->GetTarget();
-
-	if (target)
-		client->Message(CHANNEL_COLOR_YELLOW, "Your distance from %s is %f", target->GetName(), client->GetPlayer()->GetDistance(target));
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You must have a spawn targeted to use /distance");
-}
-
-/* 
-	Function: Command_Duel()
-	Purpose	: Handle the /duel commands - not yet implemented
-	Params	: unknown
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_Duel(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_DUEL");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Duel Command");
-	client->Message(CHANNEL_COLOR_YELLOW, "You cannot duel other players (Not Implemented)");
-}
-
-/* 
-	Function: Command_DuelBet()
-	Purpose	: Handle the /duel commands - not yet implemented
-	Params	: unknown
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_DuelBet(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_DUELBET");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Duel Bet Command");
-	client->Message(CHANNEL_COLOR_YELLOW, "You cannot duel other players (Not Implemented)");
-}
-
-/* 
-	Function: Command_DuelAccept()
-	Purpose	: Handle the /duel commands - not yet implemented
-	Params	: unknown
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_DuelAccept(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_DUEL_ACCEPT");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Accept Duel Command");
-	client->Message(CHANNEL_COLOR_YELLOW, "You cannot duel other players (Not Implemented)");
-}
-
-/* 
-	Function: Command_DuelDecline()
-	Purpose	: Handle the /duel commands - not yet implemented
-	Params	: unknown
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_DuelDecline(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_DUEL_DECLINE");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Decline Duel Request Command");
-	client->Message(CHANNEL_COLOR_YELLOW, "You cannot duel other players (Not Implemented)");
-}
-
-/* 
-	Function: Command_DuelSurrender()
-	Purpose	: Handle the /duel commands - not yet implemented
-	Params	: unknown
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_DuelSurrender(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_DUEL_SURRENDER");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Surrender Duel Command");
-	client->Message(CHANNEL_COLOR_YELLOW, "You cannot duel other players (Not Implemented)");
-
-	// JA, just messin around ;)
-	char surrender[64];
-	sprintf(surrender, "%s surrendered like a cowardly dog!", client->GetPlayer()->GetName());
-	zone_list.HandleGlobalAnnouncement(surrender);
-}
-
-/* 
-	Function: Command_DuelToggle()
-	Purpose	: Handle the /duel commands - not yet implemented
-	Params	: unknown
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_DuelToggle(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_DUEL");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Duel Commands");
-	client->Message(CHANNEL_COLOR_YELLOW, "You cannot duel other players (Not Implemented)");
-}
-
-/* 
-	Function: 
-	Purpose	: 
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_EntityCommand(Client* client, Seperator* sep, int handler)
-{
-	if( handler == COMMAND_ENTITYCOMMAND )
-	{
-		// /entitycommand command by itself shows help (to be extended)
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /entity_command list [entity command name]");
-		return;
-	}
-	else if( handler == COMMAND_ENTITYCOMMAND_LIST )
-	{
-		// /entitycommand list command expects "name" param
-		if (sep && sep->arg[0]) 
-		{
-			const char* entity_command_name = sep->argplus[0];
-			client->Message(CHANNEL_COLOR_YELLOW, "Listing entity commands like '%s':", entity_command_name);
-			map<int32, vector<EntityCommand*>*>* entity_command_list_all = client->GetCurrentZone()->GetEntityCommandListAll();
-			map<int32, vector<EntityCommand*>*>::iterator itr;
-
-			for (itr = entity_command_list_all->begin(); itr != entity_command_list_all->end(); itr++) 
-			{
-				vector<EntityCommand*>* entity_command_list = itr->second;
-				vector<EntityCommand*>::iterator itr2;
-
-				for (itr2 = entity_command_list->begin(); itr2 != entity_command_list->end(); itr2++) 
-				{
-					EntityCommand* entity_command = *itr2;
-
-					if (ToLower(entity_command->name).find(ToLower(string(entity_command_name))) < 0xFFFFFFFF)
-						client->Message(CHANNEL_COLOR_YELLOW, "Command Text: %s, Command List ID: %u, Distance: %f\n", entity_command->name.c_str(), itr->first, entity_command->distance);
-				}
-			}
-		}
-		else // no command name
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /entity_command list [entity command name]");
-	}
-}
-
-
-/* 
-	Function: Command_Follow()
-	Purpose	: Handle the /follow command - not yet implemented
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_Follow(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_FOLLOW");
-	// flag to toggle if the players target is in the players group
-	bool targetInGroup = false;
-	// get a pointer to the players group
-	GroupMemberInfo* gmi = client->GetPlayer()->GetGroupMemberInfo();
-	// If the player has a group and has a target
-	if (gmi && client->GetPlayer()->GetTarget()) {
-		deque<GroupMemberInfo*>::iterator itr;
-
-		world.GetGroupManager()->GroupLock(__FUNCTION__, __LINE__);
-
-		PlayerGroup* group = world.GetGroupManager()->GetGroup(gmi->group_id);
-		if (group)
-		{
-			group->MGroupMembers.readlock(__FUNCTION__, __LINE__);
-			deque<GroupMemberInfo*>* members = group->GetMembers();
-			// Loop through the group members
-			for (itr = members->begin(); itr != members->end(); itr++) {
-				// If a group member matches a target
-				if ((*itr)->member == client->GetPlayer()->GetTarget()) {
-					// toggle the flag and break the loop
-					targetInGroup = true;
-					break;
-				}
-			}
-			group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
-		}
-
-		world.GetGroupManager()->ReleaseGroupLock(__FUNCTION__, __LINE__);
-	}
-	if (targetInGroup) {
-		// CHANNEL_COLOR_CHAT_RELATIONSHIP = 4, which matches the value in logs
-		client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "You start to follow %s.", client->GetPlayer()->GetTarget()->GetName());
-		client->GetPlayer()->SetFollowTarget(client->GetPlayer()->GetTarget());
-		client->GetPlayer()->info_changed = true;
-		client->GetPlayer()->changed = true;
-	}
-	else
-		client->Message(CHANNEL_NARRATIVE, "You must first select a group member to follow.");
-}
-
-/* 
-	Function: Command_StopFollow()
-	Purpose	: Handle the /stop_follow command - not yet implemented
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_StopFollow(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_STOP_FOLLOW");
-	if (client->GetPlayer()->GetFollowTarget()) {
-		// CHANNEL_COLOR_CHAT_RELATIONSHIP = 4, which matches the value in logs
-		client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "You are no longer following %s", client->GetPlayer()->GetFollowTarget()->GetName());
-		client->GetPlayer()->SetFollowTarget(0);
-		client->GetPlayer()->info_changed = true;
-		client->GetPlayer()->changed = true;
-	}
-}
-
-/* 
-	Function: Command_Grid()
-	Purpose	: Show player's current Grid ID
-	Params	: 
-	Dev		: Scatman
-	Example	: /grid
-*/ 
-void Commands::Command_Grid(Client* client)
-{
-	client->Message(CHANNEL_COLOR_YELLOW, "Your Grid ID is %u", client->GetPlayer()->appearance.pos.grid_id);
-
-	if (client->GetPlayer()->GetMap() != nullptr) {
-			auto loc = glm::vec3(client->GetPlayer()->GetX(), client->GetPlayer()->GetZ(), client->GetPlayer()->GetY());
-			uint32 GridID = 0;
-			float new_z = client->GetPlayer()->GetMap()->FindBestZ(loc, nullptr, &GridID);
-			client->Message(CHANNEL_COLOR_YELLOW, "Grid result is %u, at EQ2 Y coordinate %f", GridID, new_z);
-	}
-}
-
-/* 
-	Function: Command_Guild()
-	Purpose	: Handler for all UI-related guild commands
-	Dev		: Scatman
-*/ 
-void Commands::Command_Guild(Client* client, Seperator* sep)
-{
-	Guild* guild = client->GetPlayer()->GetGuild();
-	if (sep && sep->GetMaxArgNum() > 0 && sep->arg[0])
-	{
-		const char* command = sep->arg[0];
-		int32 length = strlen(command);
-
-		LogWrite(COMMAND__DEBUG, 0, "Command", "Guild Command: %s", command);
-
-		if (strncmp(command, "rank_name", length) == 0 && sep->arg[1] && sep->IsNumber(1) && sep->arg[2] && guild)
-			guild->SetRankName(atoi(sep->arg[1]), sep->argplus[2]);
-		else if (strncmp(command, "rank_permission", length) == 0 && sep->arg[1] && sep->IsNumber(1) && sep->arg[2] && sep->IsNumber(2) && sep->arg[3] && guild)
-			guild->SetPermission(atoi(sep->arg[1]), atoi(sep->arg[2]), strncmp(sep->arg[3], "true", 4) == 0 ? 1 : 0);
-		else if (strncmp(command, "filter_event", length) == 0 && sep->arg[1] && sep->IsNumber(1) && sep->arg[2] && sep->IsNumber(2) && sep->arg[3] && guild)
-			guild->SetEventFilter(atoi(sep->arg[1]), atoi(sep->arg[2]), strncmp(sep->arg[3], "true", 4) == 0 ? 1 : 0);
-		else if (strncmp(command, "kick", length) == 0 && sep->arg[1] && guild)
-			guild->KickGuildMember(client, sep->arg[1]);
-		else if (strncmp(command, "demote", length) == 0 && sep->arg[1] && guild)
-			guild->DemoteGuildMember(client, sep->arg[1]);
-		else if (strncmp(command, "promote", length) == 0 && sep->arg[1] && guild)
-			guild->PromoteGuildMember(client, sep->arg[1]);
-		else if (strncmp(command, "points", length) == 0 && guild)
-		{
-			if (sep->arg[1] && strncmp(sep->arg[1], "add", length) == 0)
-			{
-				if (sep->arg[2] && sep->IsNumber(2) && sep->arg[3])
-				{
-					float points = atof(sep->arg[2]);
-					const char* option = sep->arg[3];
-					const char* comment = sep->argplus[4];
-
-					if (strncmp(option, "all", strlen(option)) == 0)
-						guild->AddPointsToAll(client, points, comment);
-					else if (strncmp(option, "online", strlen(option)) == 0)
-						guild->AddPointsToAllOnline(client, points, comment);
-					else if (strncmp(option, "group", strlen(option)) == 0)
-						guild->AddPointsToGroup(client, points, comment);
-					else if (strncmp(option, "raid", strlen(option)) == 0)
-						guild->AddPointsToRaid(client, points, comment);
-					else
-						guild->AddPointsToGuildMember(client, points, option, comment);
-				}
-			}
-			else if (sep->arg[1] && strncmp(sep->arg[1], "view", strlen(sep->arg[1])) == 0 && sep->arg[2])
-				guild->ViewGuildMemberPoints(client, sep->arg[2]);
-			else
-				LogWrite(COMMAND__ERROR, 0, "Command", "Unhandled guild points command: %s", sep->argplus[0]);
-		}
-		else if (strncmp(command, "motd", length) == 0 && sep->arg[1] && guild)
-			guild->SetMOTD(sep->argplus[1]);
-		else if (strncmp(command, "recruiting", length) == 0 && guild) 
-		{
-			if (sep->arg[1])
-			{
-				const char* option = sep->arg[1];
-
-				if (strncmp(option, "short_text", strlen(option)) == 0 && sep->arg[2])
-					guild->SetRecruitingShortDesc(sep->argplus[2]);
-				else if (strncmp(option, "long_text", strlen(option)) == 0 && sep->arg[2])
-					guild->SetRecruitingFullDesc(sep->argplus[2]);
-				else if (strncmp(option, "flag", strlen(option)) == 0 && sep->arg[2] && sep->IsNumber(2) && sep->arg[3])
-					guild->SetRecruitingFlag(atoi(sep->arg[2]), strncmp(sep->arg[3], "true", 4) == 0 ? 1 : 0);
-				else if (strncmp(option, "min_level", strlen(option)) == 0 && sep->arg[2] && sep->IsNumber(2))
-					guild->SetRecruitingMinLevel(atoi(sep->arg[2]));
-				else if (strncmp(option, "playstyle", strlen(option)) == 0 && sep->arg[2] && sep->IsNumber(2))
-					guild->SetRecruitingPlayStyle(atoi(sep->arg[2]));
-				else if (strncmp(option, "tag", strlen(option)) == 0 && sep->arg[2] && sep->IsNumber(2) && sep->arg[3] && sep->IsNumber(3))
-					guild->SetRecruitingDescTag(atoi(sep->arg[2]), atoi(sep->arg[3]));
-				else if (strncmp(command, "recruiting", strlen(option)) == 0)
-					guild->ChangeMemberFlag(client, GUILD_MEMBER_FLAGS_RECRUITING_FOR_GUILD, strncmp(sep->arg[1], "true", 4) == 0 ? 1 : 0);
-				else
-					LogWrite(COMMAND__ERROR, 0, "Command", "Unhandled guild recruiting command: %s", sep->argplus[0]);
-			}
-			else
-				LogWrite(COMMAND__ERROR, 0, "Command", "Unhandled guild recruiting command: %s", sep->argplus[0]);
-		}
-		else if (strncmp(command, "notify_online", length) == 0 && sep->arg[1] && guild)
-			guild->ChangeMemberFlag(client, GUILD_MEMBER_FLAGS_NOTIFY_LOGINS, strncmp(sep->arg[1], "true", 4) == 0 ? 1 : 0);
-		else if (strncmp(command, "event_privacy", length) == 0 && sep->arg[1] && guild)
-			guild->ChangeMemberFlag(client, GUILD_MEMBER_FLAGS_DONT_GENERATE_EVENTS, strncmp(sep->arg[1], "true", 4) == 0 ? 1 : 0);
-		else if (strncmp(command, "recruiter", length) == 0 && sep->arg[1] && sep->arg[2] && guild)
-			guild->SetGuildRecruiter(client, sep->arg[1], strncmp(sep->arg[2], "true", 4) == 0 ? true : false);
-		else if (strncmp(command, "recruiter_description", length) == 0 && sep->arg[1] && guild)
-			guild->SetGuildRecruiterDescription(client, sep->argplus[1]);
-		else if (strncmp(command, "lock_event", length) == 0 && sep->arg[1] && sep->arg[2] && guild)
-			guild->LockGuildEvent(atoul(sep->arg[1]), strncmp(sep->arg[2], "true", 4) == 0 ? true : false);
-		else if (strncmp(command, "delete_event", length) == 0 && sep->arg[1] && guild)
-			guild->DeleteGuildEvent(atoul(sep->arg[1]));
-		else if (strncmp(command, "invite", length) == 0 && guild) 
-		{
-			if (sep->arg[1] && strlen(sep->arg[1]) > 0)
-				guild->InvitePlayer(client, sep->arg[1]);
-			else 
-			{
-				Spawn* target = client->GetPlayer()->GetTarget();
-				if (target) 
-				{
-					if (target->IsPlayer())
-						guild->InvitePlayer(client, target->GetName());
-					else
-						client->Message(CHANNEL_NARRATIVE, "%s is not a player.", target->GetName());
-				}
-			}
-		}
-		else if (strncmp(command, "accept", length) == 0) 
-		{
-			PendingGuildInvite* pgi = client->GetPendingGuildInvite();
-
-			if (pgi && pgi->guild && pgi->invited_by)
-				pgi->guild->AddNewGuildMember(client, pgi->invited_by->GetName());
-			client->SetPendingGuildInvite(0);
-		}
-		else if (strncmp(command, "decline", length) == 0) 
-		{
-			PendingGuildInvite* pgi = client->GetPendingGuildInvite();
-
-			if (pgi && pgi->guild && pgi->invited_by)
-			{
-				Client* client_inviter = pgi->invited_by->GetZone()->GetClientBySpawn(pgi->invited_by);
-
-				if (client_inviter)
-					client_inviter->Message(CHANNEL_NARRATIVE, "%s has declined your invitation to join %s.", client->GetPlayer()->GetName(), pgi->guild->GetName());
-			}
-			client->SetPendingGuildInvite(0);
-		}
-		else if (strncmp(command, "create", length) == 0 && sep->arg[1]) 
-		{
-			const char* guild_name = sep->argplus[1];
-
-			if (!guild_list.GetGuild(guild_name))
-				world.CreateGuild(guild_name, client, client->GetPlayer()->GetGroupMemberInfo() ? client->GetPlayer()->GetGroupMemberInfo()->group_id : 0);
-			else
-				client->SimpleMessage(CHANNEL_NARRATIVE, "A guild with that name already exists.");
-		}
-		else if (strncmp(command, "search", length) == 0)
-			client->ShowGuildSearchWindow();
-		else if (strncmp(command, "recruiting_details", length) == 0 && sep->arg[1] && sep->IsNumber(1))
-		{
-			Guild* to_guild = guild_list.GetGuild(atoul(sep->arg[1]));
-
-			if (to_guild)
-				to_guild->SendGuildRecruitingDetails(client);
-		}
-		else if (strncmp(command, "recruiting_image", length) == 0 && sep->arg[1] && sep->IsNumber(1)) 
-		{
-			Guild* to_guild = guild_list.GetGuild(atoul(sep->arg[1]));
-
-			if (to_guild)
-				to_guild->SendGuildRecruitingImages(client);
-		}
-		else if (strncmp(command, "recruiter_adventure_class", length) == 0) 
-		{
-			if (sep->arg[1])
-			{
-				const char* option = sep->arg[1];
-
-				if (strncmp(option, "toggle", strlen(option)) == 0)
-					guild->ToggleGuildRecruiterAdventureClass(client);
-			}
-			else
-				LogWrite(COMMAND__ERROR, 0, "Command", "Unhandled guild recruiter_adventure_class command: '%s'", sep->argplus[0]);
-		}
-		else if (strncmp(command, "display_heraldry", length) == 0)
-		{
-			// JA: not sure this is right...
-			client->GetPlayer()->toggle_character_flag(CF_SHOW_GUILD_HERALDRY);
-			client->GetPlayer()->SetCharSheetChanged(true);
-		}
-		else
-			LogWrite(COMMAND__ERROR, 0, "Command", "Unhandled guild command: '%s'", sep->argplus[0]);
-	}
-}
-
-/* 
-	Function: Command_GuildCreate()
-	Purpose	: Display's in-game Guild Creation window
-	Dev		: Scatman
-*/ 
-void Commands::Command_CreateGuild(Client* client)
-{
-	client->SendGuildCreateWindow();
-}
-
-/* 
-	Function: Command_SetGuildOfficerNote()
-	Purpose	: 
-	Dev		: Scatman
-*/ 
-void Commands::Command_SetGuildOfficerNote(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && sep->arg[1]) 
-	{
-		Guild* guild = client->GetPlayer()->GetGuild();
-
-		if (guild)
-			guild->SetGuildOfficerNote(sep->arg[0], sep->argplus[1]);
-	}
-}
-
-/* 
-	Function: Command_SetGuildMemberNote()
-	Purpose	: 
-	Dev		: Scatman
-*/ 
-void Commands::Command_SetGuildMemberNote(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && sep->arg[1]) 
-	{
-		Guild* guild = client->GetPlayer()->GetGuild();
-
-		if (guild)
-			guild->SetGuildMemberNote(sep->arg[0], sep->argplus[1]);
-	}
-}
-
-/* 
-	Function: Command_GuildSay()
-	Purpose	: 
-	Dev		: Scatman
-*/ 
-void Commands::Command_GuildSay(Client* client, Seperator* sep)
-{
-	Guild* guild = client->GetPlayer()->GetGuild();
-
-	if (guild) 
-	{
-		if (sep && sep->arg[0])
-			guild->HandleGuildSay(client, sep->argplus[0]);
-	}
-	else
-		client->SimpleMessage(CHANNEL_NARRATIVE, "You are not a member of a guild");
-}
-
-/* 
-	Function: Command_OfficerSay()
-	Purpose	: 
-	Dev		: Scatman
-*/ 
-void Commands::Command_OfficerSay(Client* client, Seperator* sep)
-{
-	Guild* guild = client->GetPlayer()->GetGuild();
-
-	if (guild) 
-	{
-		if (sep && sep->arg[0])
-			guild->HandleOfficerSay(client, sep->argplus[0]);
-	}
-	else
-		client->SimpleMessage(CHANNEL_NARRATIVE, "You are not a member of a guild");
-}
-
-/* 
-	Function: Command_Guilds()
-	Purpose	: Shows help for /guild command
-	Params	: 
-	Dev		: Scatman
-	Example	: 
-*/ 
-void Commands::Command_Guilds(Client* client)
-{
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /guilds [create|delete|add|remove|list]");
-}
-
-/* 
-	Function: Command_GuildsAdd()
-	Purpose	: Add's players to a guild
-	Params	: guild_name|guild_id, player name
-	Dev		: Scatman
-	Example	: /guilds add 1 Admin  = adds player Admin to guild_id 1
-*/ 
-void Commands::Command_GuildsAdd(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && strlen(sep->arg[0]) > 0) 
-	{
-		Guild* guild = 0;
-		bool found = true;
-
-		if (sep->IsNumber(0)) 
-		{
-			guild = guild_list.GetGuild(atoul(sep->arg[0]));
-
-			if (!guild) 
-			{
-				client->Message(CHANNEL_COLOR_YELLOW, "Guild with ID %u does not exist.", atoul(sep->arg[0]));
-				found = false;
-			}
-		}
-		else 
-		{
-			guild = guild_list.GetGuild(sep->arg[0]);
-
-			if (!guild) 
-			{
-				client->Message(CHANNEL_COLOR_YELLOW, "Guild '%s' does not exist.", sep->arg[0]);
-				found = false;
-			}
-		}
-		if (found) 
-		{
-			Client* to_client = 0;
-
-			if (sep->arg[1] && strlen(sep->arg[1]) > 0)
-				to_client = zone_list.GetClientByCharName(string(sep->arg[1]));
-			else if (client->GetPlayer()->GetTarget() && client->GetPlayer()->GetTarget()->IsPlayer())
-				to_client = client->GetPlayer()->GetTarget()->GetZone()->GetClientBySpawn(client->GetPlayer()->GetTarget());
-
-			if (to_client)
-				guild->InvitePlayer(client, to_client->GetPlayer()->GetName());
-			else
-				client->Message(CHANNEL_COLOR_YELLOW, "Could not find player '%s' to invite to the guild.", sep->arg[1]);
-		}
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /guilds add [guild name|guild id] (player name).");
-}
-
-/* 
-	Function: Command_GuildsCreate()
-	Purpose	: Creates a guild
-	Params	: guild_name, player_name (optional)
-	Dev		: Scatman
-	Example	: /guilds create [guild name] (player name)
-*/ 
-void Commands::Command_GuildsCreate(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0]) 
-	{
-		const char* guild_name = sep->arg[0];
-
-		if (!guild_list.GetGuild(guild_name)) 
-		{
-			bool ret = false;
-
-			if (sep->arg[1] && strlen(sep->arg[1]) > 0) 
-			{
-				Client* to_client = zone_list.GetClientByCharName(string(sep->arg[1]));
-
-				if (to_client) 
-				{
-					world.CreateGuild(guild_name, to_client);
-					ret = true;
-				}
-				else
-					client->Message(CHANNEL_COLOR_YELLOW, "Could not find player with name '%s'", sep->arg[1]);
-			}
-			else if (client->GetPlayer()->GetTarget() && client->GetPlayer()->GetTarget()->IsPlayer()) 
-			{
-				Client* to_client = client->GetPlayer()->GetTarget()->GetZone()->GetClientBySpawn(client->GetPlayer()->GetTarget());
-
-				if (to_client) 
-				{
-					world.CreateGuild(guild_name, to_client);
-					ret = true;
-				}
-			}
-			else 
-			{
-				world.CreateGuild(guild_name);
-				ret = true;
-			}
-
-			if (ret)
-				client->Message(CHANNEL_COLOR_YELLOW, "Guild '%s' was successfully created.", guild_name);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "There was an error creating the guild.");
-		}
-		else
-			client->Message(CHANNEL_COLOR_YELLOW, "Guild '%s' already exists.", guild_name);
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /guilds create [guild name] (player name).  If no player is specified, the player's target will be used.  If the player has no target, a guild with no members will be created.");
-}
-
-/* 
-	Function: Command_GuildsDelete()
-	Purpose	: Delete's a guild
-	Params	: guild name
-	Dev		: Scatman
-	Example	: /guilds delete Test
-*/ 
-void Commands::Command_GuildsDelete(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0]) 
-	{
-		Guild* guild = 0;
-		bool found = true;
-
-		if (sep->IsNumber(0)) 
-		{
-			guild = guild_list.GetGuild(atoul(sep->arg[0]));
-
-			if (!guild) 
-			{
-				client->Message(CHANNEL_COLOR_YELLOW, "Guild with ID %u does not exist.", atoul(sep->arg[0]));
-				found = false;
-			}
-		}
-		else 
-		{
-			guild = guild_list.GetGuild(sep->arg[0]);
-
-			if (!guild) 
-			{
-				client->Message(CHANNEL_COLOR_YELLOW, "Guild '%s' does not exist.", sep->arg[0]);
-				found = false;
-			}
-		}
-
-		if (found) 
-		{
-			guild->RemoveAllGuildMembers();
-			database.DeleteGuild(guild);
-
-			client->Message(CHANNEL_COLOR_YELLOW, "Guild '%s' was successfully deleted.", guild->GetName());
-			guild_list.RemoveGuild(guild, true);
-		}
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /guilds delete [guild name].");
-}
-
-/* 
-	Function: Command_GuildsList()
-	Purpose	: Lists current guilds on server
-	Params	: 
-	Dev		: Scatman
-	Example	: /guilds list
-*/ 
-void Commands::Command_GuildsList(Client* client)
-{
-	MutexMap<int32, Guild*>* guilds = guild_list.GetGuilds();
-	MutexMap<int32, Guild*>::iterator itr = guilds->begin();
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Guild List:");
-	if (guilds->size() == 0)
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "None.");
-	else {
-		while (itr.Next()) {
-			Guild* guild = itr.second;
-			client->Message(CHANNEL_COLOR_YELLOW, "%u) %s", guild->GetID(), guild->GetName());
-		}
-	}
-}
-
-/* 
-	Function: Command_GuildsRemove()
-	Purpose	: Removes a player from a guild
-	Params	: guild name|guild id, player name
-	Dev		: Scatman
-	Example	:  /guilds remove 1 Admin = removes Admin from guild 1
-*/ 
-void Commands::Command_GuildsRemove(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && strlen(sep->arg[0]) > 0) 
-	{
-		Guild* guild = 0;
-		bool found = true;
-
-		if (sep->IsNumber(0)) 
-		{
-			guild = guild_list.GetGuild(atoul(sep->arg[0]));
-
-			if (!guild) 
-			{
-				client->Message(CHANNEL_COLOR_YELLOW, "Guild with ID %u does not exist.", atoul(sep->arg[0]));
-				found = false;
-			}
-		}
-		else 
-		{
-			guild = guild_list.GetGuild(sep->arg[0]);
-
-			if (!guild) 
-			{
-				client->Message(CHANNEL_COLOR_YELLOW, "Guild '%s' does not exist.", sep->arg[0]);
-				found = false;
-			}
-		}
-
-		if (found) 
-		{
-			Client* to_client = 0;
-
-			if (sep->arg[1] && strlen(sep->arg[1]) > 0)
-				to_client = zone_list.GetClientByCharName(string(sep->arg[1]));
-			else if (client->GetPlayer()->GetTarget() && client->GetPlayer()->GetTarget()->IsPlayer())
-				to_client = client->GetPlayer()->GetTarget()->GetZone()->GetClientBySpawn(client->GetPlayer()->GetTarget());
-
-			if (to_client) 
-			{
-				Player* to_player = to_client->GetPlayer();
-				if (to_player->GetGuild())
-				{
-					if (to_player->GetGuild() == guild) 
-					{
-						guild->KickGuildMember(client, to_player->GetName());
-					}
-					else
-						client->Message(CHANNEL_COLOR_YELLOW, "%s is not in the guild '%s'.", to_player->GetName(), guild->GetName());
-				}
-				else
-					client->Message(CHANNEL_COLOR_YELLOW, "%s is not in a guild.", to_player->GetName());
-			}
-			else
-				client->Message(CHANNEL_COLOR_YELLOW, "Could not find player '%s' to invite to the guild.", sep->arg[1]);
-		}
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /guilds remove [guild name|guild id] (player name).");
-}
-
-/* 
-	Function: Command_InspectPlayer()
-	Purpose	: Handle the Inspect functions
-	Params	: Client to inspect
-	Dev		: Scatman
-	Example	: /inspect Scatman
-*/ 
-void Commands::Command_InspectPlayer(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0]) 
-	{
-		Client* inspect_client = zone_list.GetClientByCharName(string(sep->arg[0]));
-
-		if (inspect_client)
-			client->InspectPlayer(inspect_client->GetPlayer());
-	}
-	else 
-	{
-		Spawn* target = client->GetPlayer()->GetTarget();
-
-		if (target && target->IsPlayer())
-			client->InspectPlayer((Player*)target);
-	}
-}
-
-/* 
-	Function: Command_Inventory()
-	Purpose	: Handle changes in player inventory
-	Params	: <TBD>
-	Dev		: All
-	Example	: /inventory delete item_id
-*/ 
-void Commands::Command_Inventory(Client* client, Seperator* sep, EQ2_RemoteCommandString* command)
-{
-
-	PrintSep(sep, "Command_Inventory"); // temp to figure out the params
-
-	Player* player = client->GetPlayer();
-
-	if(sep && sep->arg[0][0])
-	{
-		LogWrite(COMMAND__INFO, 0, "Command", "command: %s", sep->argplus[0]);
-
-		if(client->GetPlayer()->GetHP() == 0)
-			client->SimpleMessage(CHANNEL_COLOR_RED,"You cannot do that right now.");
-		else if(sep->arg[1][0] && strncasecmp("destroy", sep->arg[0], 6) == 0 && sep->IsNumber(1))
-		{
-			int16 index = atoi(sep->arg[1]);
-			Item* item = client->GetPlayer()->item_list.GetItemFromIndex(index);
-
-			if(item)
-			{
-				if(item->details.item_locked)
-				{
-					client->SimpleMessage(CHANNEL_COLOR_RED, "You cannot destroy the item in use.");
-					return;
-				}
-				if(item->GetItemScript() && lua_interface)
-					lua_interface->RunItemScript(item->GetItemScript(), "destroyed", item, client->GetPlayer());
-			
-				//reobtain item make sure it wasn't removed
-				item = player->item_list.GetItemFromIndex(index);
-				int32 bag_id = 0;
-				if(item){
-					bag_id = item->details.inv_slot_id;
-					database.DeleteItem(client->GetCharacterID(), item, 0);
-				}
-				client->GetPlayer()->item_list.DestroyItem(index);
-				client->GetPlayer()->UpdateInventory(bag_id);
-			}
-		}
-		else if(sep->arg[4][0] && strncasecmp("move", sep->arg[0], 4) == 0 && sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3) && sep->IsNumber(4))
-		{
-			int16 from_index = atoi(sep->arg[1]);
-			sint16 to_slot = atoi(sep->arg[2]);
-			sint32 bag_id = atol(sep->arg[3]);
-			int8 charges = atoi(sep->arg[4]);
-			Item* item = client->GetPlayer()->item_list.GetItemFromIndex(from_index);
-			
-			if(!item) {
-				client->SimpleMessage(CHANNEL_COLOR_RED, "You have no item.");
-				return;
-			}
-			
-			if(item->details.item_locked)
-			{
-				client->SimpleMessage(CHANNEL_COLOR_RED, "You cannot move the item in use.");
-				return;
-			}
-			if(bag_id == -4 && !client->GetPlayer()->item_list.SharedBankAddAllowed(item))
-			{
-				client->SimpleMessage(CHANNEL_COLOR_RED, "That item (or an item inside) cannot be shared.");
-				return;
-			}
-
-			sint32 old_inventory_id = 0;
-
-			if(item)
-				old_inventory_id = item->details.inv_slot_id;
-
-			//autobank
-			if (bag_id == -3 && to_slot == -1) 
-			{ 
-				if (player->HasFreeBankSlot())
-					to_slot = player->FindFreeBankSlot();
-				else 
-				{
-					client->SimpleMessage(CHANNEL_COLOR_RED, "You do not have any free bank slots.");
-					return;
-				}
-			}
-
-			//auto inventory
-			if (bag_id == 0 && to_slot == -1) 
-			{
-				if (!player->item_list.GetFirstFreeSlot(&bag_id, &to_slot)) 
-				{
-					client->SimpleMessage(CHANNEL_COLOR_RED, "You do not have any free slots.");
-					return;
-				}
-			}
-
-			bool item_deleted = false;
-			EQ2Packet* outapp = client->GetPlayer()->MoveInventoryItem(bag_id, from_index, (int8)to_slot, charges, 0, &item_deleted, client->GetVersion());
-			client->QueuePacket(outapp);
-
-			if(item_deleted)
-				item = nullptr;
-
-			//removed from bag send update
-			if(old_inventory_id > 0 && item && item->details.inv_slot_id != old_inventory_id)
-			{ 
-				outapp = client->GetPlayer()->SendBagUpdate(old_inventory_id, client->GetVersion());
-				if(outapp)
-					client->QueuePacket(outapp);
-			}
-
-			if(item && item->details.inv_slot_id > 0 && item->details.inv_slot_id != old_inventory_id)
-			{
-				outapp = client->GetPlayer()->SendBagUpdate(item->details.inv_slot_id, client->GetVersion());
-
-				if(outapp)
-					client->QueuePacket(outapp);
-			}
-		}
-		else if(sep->arg[1][0] && strncasecmp("equip", sep->arg[0], 5) == 0 && sep->IsNumber(1))
-		{
-			if(client->GetPlayer()->EngagedInCombat())
-				client->SimpleMessage(CHANNEL_COLOR_RED, "You may not equip items while in combat.");
-			else
-			{
-				int16 index = atoi(sep->arg[1]);
-				int8 slot_id = 255;
-				int8 unk3 = 0;
-				int8 appearance_equip = 0;
-				
-				if(sep->arg[2][0] && sep->IsNumber(2))
-					slot_id = atoi(sep->arg[2]);
-				if(sep->arg[3][0] && sep->IsNumber(3))
-					unk3 = atoul(sep->arg[3]);
-				if(sep->arg[4][0] && sep->IsNumber(4))
-					appearance_equip = atoul(sep->arg[4]);
-
-				vector<EQ2Packet*> packets = client->GetPlayer()->EquipItem(index, client->GetVersion(), appearance_equip, slot_id);
-				EQ2Packet* outapp = 0;
-
-				for(int32 i=0;i<packets.size();i++)
-				{
-					outapp = packets[i];
-					if(outapp)
-						client->QueuePacket(outapp);
-				}
-
-				client->GetPlayer()->ChangePrimaryWeapon();
-				client->GetPlayer()->ChangeSecondaryWeapon();
-				client->GetPlayer()->ChangeRangedWeapon();
-				EQ2Packet* characterSheetPackets = client->GetPlayer()->GetPlayerInfo()->serialize(client->GetVersion());
-				client->QueuePacket(characterSheetPackets);
-			}
-		}
-		else if (sep->arg[1][0] && strncasecmp("unpack", sep->arg[0], 6) == 0 && sep->IsNumber(1))
-		{
-			if (client->GetPlayer()->EngagedInCombat())
-				client->SimpleMessage(CHANNEL_COLOR_RED, "You may not unpack items while in combat.");
-			else {
-				int16 index = atoi(sep->arg[1]);
-				Item* item = client->GetPlayer()->item_list.GetItemFromIndex(index);
-				if (item) {
-					if(item->details.item_locked)
-					{
-						client->SimpleMessage(CHANNEL_COLOR_RED, "You cannot unpack the item in use.");
-						return;
-					}
-					//	client->GetPlayer()->item_list.DestroyItem(index);
-					if (item->item_sets.size() > 0) {
-						for (int32 i = 0; i < item->item_sets.size(); i++) {
-							ItemSet* set = item->item_sets[i];
-							if (set->item_stack_size == 0)
-								set->item_stack_size += 1;
-							client->AddItem(set->item_id, set->item_stack_size);
-						}
-					}
-
-				}
-				client->RemoveItem(item, 1);
-
-			}
-
-		}
-		else if(sep->arg[1][0] && strncasecmp("unequip", sep->arg[0], 7) == 0 && sep->IsNumber(1))
-		{
-			if(client->GetPlayer()->EngagedInCombat())
-				client->SimpleMessage(CHANNEL_COLOR_RED, "You may not unequip items while in combat.");
-			else
-			{
-				int16 index = atoi(sep->arg[1]);
-				sint32 bag_id = -999;
-				int8 to_slot = 255;
-
-				if(sep->arg[3][0])
-				{
-					if(sep->IsNumber(2))
-						bag_id = atol(sep->arg[2]);
-
-					if(sep->IsNumber(3))
-						to_slot = atoi(sep->arg[3]);
-				}
-
-				sint8 unk4 = 0;
-				int8 appearance_equip = 0;
-				if(sep->arg[4][0] && sep->IsNumber(4))
-					unk4 = atoi(sep->arg[4]);
-				if(sep->arg[5][0] && sep->IsNumber(5))
-					appearance_equip = atoul(sep->arg[5]);
-
-				vector<EQ2Packet*> packets = client->GetPlayer()->UnequipItem(index, bag_id, to_slot, client->GetVersion(), appearance_equip);
-				EQ2Packet* outapp = 0;
-
-				for(int32 i=0;i<packets.size();i++)
-				{
-					outapp = packets[i];
-
-					if(outapp)
-						client->QueuePacket(outapp);
-				}
-
-				client->GetPlayer()->ChangePrimaryWeapon();
-				client->GetPlayer()->ChangeSecondaryWeapon();
-				client->GetPlayer()->ChangeRangedWeapon();
-				EQ2Packet* characterSheetPackets = client->GetPlayer()->GetPlayerInfo()->serialize(client->GetVersion());
-				client->QueuePacket(characterSheetPackets);
-			}
-		}
-		else if(sep->arg[2][0] && strncasecmp("swap_equip", sep->arg[0], 10) == 0 && sep->IsNumber(1) && sep->IsNumber(2))
-		{
-			LogWrite(MISC__TODO, 1, "TODO", " fix this, need to get how live does it\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-			int16 index1 = atoi(sep->arg[1]);
-			int16 index2 = atoi(sep->arg[2]);
-			int8 type = 0;
-			if(sep->IsNumber(3))
-				type = atoul(sep->arg[3]); // type 0 is combat, 3 = appearance
-			
-			EQ2Packet* outapp = client->GetPlayer()->SwapEquippedItems(index1, index2, client->GetVersion(), type);
-
-			if(outapp)
-				client->QueuePacket(outapp);
-			else
-			{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Unable to swap items");
-				return;
-			}
-		}
-		else if (sep->arg[2][0] && strncasecmp("pop", sep->arg[0], 3) == 0 && sep->IsNumber(1) && sep->IsNumber(2)) 
-		{
-			sint16 to_slot = atoi(sep->arg[1]);
-			sint32 bag_id = atoi(sep->arg[2]);
-			Item* item = client->GetPlayer()->item_list.GetOverflowItem();
-			if (item) {
-				//auto inventory
-				if (bag_id == 0 && to_slot == -1) 
-				{ 
-					if (!player->item_list.GetFirstFreeSlot(&bag_id, &to_slot)) 
-					{
-						client->SimpleMessage(CHANNEL_ERROR, "You do not have any free slots.");
-						return;
-					}
-					// Set the slot for the item
-					item->details.inv_slot_id = bag_id;
-					item->details.slot_id = to_slot;
-					// Flag the item so it gets saved in its new location
-					item->save_needed = true;
-					
-					// Add the item to its new location
-					if(player->item_list.AddItem(item)) {
-						// Remove the item from the overflow list
-						player->item_list.RemoveOverflowItem(item);
-					}
-
-					// Send the inventory update packet
-					client->QueuePacket(player->item_list.serialize(player, client->GetVersion()));
-					return;
-				}
-				else if (bag_id == -3 && to_slot == -1) {
-					// Auto Bank
-					if (!player->item_list.GetFirstFreeBankSlot(&bag_id, &to_slot)) {
-						client->SimpleMessage(CHANNEL_STATUS, "You do not have any free bank slots.");
-						return;
-					}
-					item->details.inv_slot_id = bag_id;
-					item->details.slot_id = to_slot;
-					item->save_needed = true;
-					if(player->item_list.AddItem(item)) {
-						player->item_list.RemoveOverflowItem(item);
-					}
-					client->QueuePacket(player->item_list.serialize(player, client->GetVersion()));
-				}
-				else if (bag_id == -4) {
-					// Shared Bank
-					if (!player->item_list.SharedBankAddAllowed(item)) {
-						client->SimpleMessage(CHANNEL_STATUS, "That item (or an item inside) cannot be shared.");
-						return;
-					}
-					Item* tmp_item = player->item_list.GetItem(-4, to_slot);
-					if (tmp_item) {
-						client->SimpleMessage(CHANNEL_STATUS, "You can not place an overflow item into an occupied slot");
-						return;
-					}
-					else {
-						item->details.inv_slot_id = bag_id;
-						item->details.slot_id = to_slot;
-						item->save_needed = true;
-						if(player->item_list.AddItem(item)) {
-						player->item_list.RemoveOverflowItem(item);
-						}
-						client->QueuePacket(player->item_list.serialize(player, client->GetVersion()));
-						return;
-					}
-				}
-				else {
-					// Try to get an item from the given bag id and slot id
-					Item* tmp_item = player->item_list.GetItem(bag_id, to_slot);
-					// Check to see if we got an item, if we do send an error,
-					// if we don't put the overflow item into this slot
-					if (tmp_item) {
-						client->SimpleMessage(CHANNEL_STATUS, "You can not place an overflow item into an occupied slot");
-					}
-					else {
-						item->details.inv_slot_id = bag_id;
-						item->details.slot_id = to_slot;
-						item->save_needed = true;
-						if(player->item_list.AddItem(item)) {
-						player->item_list.RemoveOverflowItem(item);
-						}
-						client->QueuePacket(player->item_list.serialize(player, client->GetVersion()));
-						return;
-					}
-				}
-			}
-		}
-		else if(sep->arg[2][0] && strncasecmp("nosale", sep->arg[0], 6) == 0 && sep->IsNumber(1) && sep->IsNumber(2))
-		{
-			sint64 data = strtoull(sep->arg[1], NULL, 0);
-			
-			int32 character_item_id = (int32) (data >> 32);
-			int32 item_id = (int32) (data & 0xffffffffL);
-
-			int8 sale_setting = atoi(sep->arg[2]);
-			Item* item = client->GetPlayer()->item_list.GetItemFromUniqueID(character_item_id);
-			if(item)
-			{
-				item->no_sale = sale_setting;
-				item->save_needed = true;
-				client->SendSellMerchantList();
-			}
-		}
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage: /inventory {destroy|move|equip|unequip|swap_equip|pop} {item_id} [to_slot] [bag_id]");
-
-}
-
-/* 
-	Function: Command_IRC()
-	Purpose	: Handle the IRC functions
-	Params	: IRC Commands
-	Dev		: Scatman
-	Example	: /irc say #Channel Hello World!
-*/ 
-void Commands::Command_IRC(Client* client, Seperator* sep)
-{
-	if (!rule_manager.GetGlobalRule(R_World, IRCEnabled)->GetBool()) {
-		client->SimpleMessage(CHANNEL_STATUS, "IRC is currently disabled on this server");
-		return;
-	}
-
-	if (sep && sep->arg[0][0]) {
-		if (strcasecmp(sep->arg[0], "say") == 0) {
-			if (sep->arg[1][0] && sep->arg[2][0]) {
-				if (sep->IsNumber(sep->arg[1]))
-					irc.Say(client, atoul(sep->arg[1]), sep->argplus[2]);
-				else
-					irc.Say(client, sep->arg[1], sep->argplus[2]);
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /irc say <channel name | channel index> <message>");
-		}
-		else if (strcasecmp(sep->arg[0], "join") == 0) {
-			if (sep->arg[1][0])
-				irc.JoinChannel(client, sep->arg[1]);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /irc join <channel name>");
-		}
-		else if (strcasecmp(sep->arg[0], "leave") == 0) {
-			if (sep->arg[1][0])
-				irc.LeaveChannel(client, sep->arg[1]);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /irc leave <channel name>");
-		}
-		else if (strcasecmp(sep->arg[0], "list") == 0)
-			irc.ListChannels(client);
-		else if (strcasecmp(sep->arg[0], "connect") == 0) {
-			if (sep->arg[1][0] && sep->arg[2][0] && sep->IsNumber(2))
-				irc.ConnectToServer(client, sep->arg[1], atoi(sep->arg[2]), sep->arg[3]);
-			else
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /irc connect <host> <port> (nick)");
-		}
-		else if (strcasecmp(sep->arg[0], "disconnect") == 0)
-			irc.DisconnectFromServer(client);
-		else
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Unknown IRC command.");
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Unknown IRC command.");
-}
-/* 
-	Function: Command_Languages()
-	Purpose	: Show's languages the player knows
-	Params	: 
-	Dev		: Zcoretri
-	Example	: 
-*/ 
-void Commands::Command_Languages(Client* client, Seperator* sep)
-{
-	list<Language*>* languages = client->GetPlayer()->GetPlayerLanguages()->GetAllLanguages();
-	list<Language*>::iterator itr;
-	Language* language;
-	client->Message(CHANNEL_NARRATIVE, "You know the following languages:");
-
-	for(itr = languages->begin(); itr != languages->end(); itr++)
-	{
-		language = *itr;
-		client->Message(CHANNEL_NARRATIVE, "%s", language->GetName());
-	}
-}
-
-/* 
-	Function: Command_SetLanguage()
-	Purpose	: Handles language commands
-	Params	: Language ID
-	Dev		: Zcoretri
-	Example	: 
-*/ 
-void Commands::Command_SetLanguage(Client* client, Seperator* sep)
-{
-	Player* player = client->GetPlayer();
-
-	if (sep && sep->arg[0])
-	{
-		if(!sep->IsNumber(0))
-		{
-			//String passed in
-			const char* value = sep->arg[0];
-
-			if(strncasecmp(value, "Common", strlen(value)) == 0)
-			{
-				database.SaveCharacterCurrentLang(0, client->GetCharacterID(), client);
-				client->SendLanguagesUpdate(0);
-				client->Message(CHANNEL_NARRATIVE, "You are now speaking %s", value);
-			}
-			else
-			{
-				if(player->HasLanguage(value))
-				{
-					Language* language = player->GetPlayerLanguages()->GetLanguageByName(value);
-					database.SaveCharacterCurrentLang(language->GetID(), client->GetCharacterID(), client);
-					client->SendLanguagesUpdate(language->GetID());
-					client->Message(CHANNEL_NARRATIVE, "You are now speaking %s", language->GetName());
-				}
-				else
-					client->Message(CHANNEL_NARRATIVE, "You do not know how to speak %s", value);
-			}
-		}
-		else
-		{
-			//Number passed in
-			int32 id = atoul(sep->arg[0]);
-
-			if(player->HasLanguage(id))
-			{
-				Language* language = player->GetPlayerLanguages()->GetLanguage(id);
-				database.SaveCharacterCurrentLang(id, client->GetCharacterID(), client);
-				client->SendLanguagesUpdate(id);
-				client->Message(CHANNEL_NARRATIVE, "You are now speaking %s", language->GetName());
-			}
-			else
-			{
-				Language* language = master_languages_list.GetLanguage(id);
-				client->Message(CHANNEL_NARRATIVE, "You do not know how to speak %s", language->GetName());
-			}
-		}
-	}
-	else
-	{
-		//No value was passed in
-		int32 id = database.GetCharacterCurrentLang(client->GetCharacterID(), player);
-
-		if(id > 0)
-		{
-			Language* language = player->GetPlayerLanguages()->GetLanguage(id);
-			client->Message(CHANNEL_NARRATIVE, "You are currently speaking %s ", language->GetName());
-		}
-		else
-			client->Message(CHANNEL_NARRATIVE, "You are currently speaking Common");
-	}
-}
-
-/* 
-	Function: Command_LastName()
-	Purpose	: Sets player surname
-	Params	: Name text
-	Dev		: theFoof
-	Example	: 
-*/ 
-void Commands::Command_LastName(Client* client, Seperator* sep)
-{
-	if (!client)
-		return;
-
-	if (sep && sep->arg[0])
-	{
-		if (!client->GetPlayer()->get_character_flag(CF_ENABLE_CHANGE_LASTNAME)){
-			client->Message(CHANNEL_COLOR_YELLOW, "You must be atleast level %i to change your last name.", rule_manager.GetGlobalRule(R_Player, MinLastNameLevel)->GetInt8());
-			return;
-		}
-		client->RemovePendingLastName();
-
-		uchar* checkname = (uchar*)sep->arg[0];
-		bool valid_name = true;
-		for (int32 i = 0; i < strlen(sep->arg[0]); i++) {
-			if (!alpha_check(checkname[i])) {
-				valid_name = false;
-				break;
-			}
-		}
-
-		if (!valid_name) {
-			client->Message(CHANNEL_COLOR_YELLOW, "Your last name can only contain letters.", rule_manager.GetGlobalRule(R_Player, MinLastNameLevel)->GetInt8());
-			return;
-		}
-
-		string last_name = (string)sep->arg[0];
-		int8 max_length = rule_manager.GetGlobalRule(R_Player, MaxLastNameLength)->GetInt8();
-		int8 min_length = rule_manager.GetGlobalRule(R_Player, MinLastNameLength)->GetInt8();
-		if (last_name.length() <= max_length && last_name.length() >= min_length){
-			client->SetPendingLastName(last_name);
-			client->SendLastNameConfirmation();
-		}
-		else
-			client->Message(CHANNEL_COLOR_YELLOW, "Your last name must be between %i and %i characters long.", min_length, max_length);
-	}
-}
-
-/* 
-	Function: Command_ConfirmLastName()
-	Purpose	: Confirms setting of player surname
-	Params	: Name text
-	Dev		: theFoof
-	Example	: 
-*/ 
-void Commands::Command_ConfirmLastName(Client* client, Seperator* sep)
-{
-	if (!client)
-		return;
-
-	string* name = client->GetPendingLastName();
-	if (name){
-		Player* player = client->GetPlayer();
-		player->SetLastName(name->c_str(), false);
-		client->SendTitleUpdate();
-		player->SetCharSheetChanged(true);
-		client->RemovePendingLastName();
-	}
-}
-
-/* 
-	Function: Command_Location()
-	Purpose	: Display's Help for /location commands
-	Params	: 
-	Dev		: Scatman
-	Example	: /location = show's help for command
-*/ 
-void Commands::Command_Location(Client* client)
-{
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Valid /location commands are:");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/location create [name] (include y).  Include y defaults to false");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/location add [location id]");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/location remove [location point id]");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/location delete [location id]");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/location list [locations|points] [location id if points used]");
-}
-
-/* 
-	Function: Command_LocationAdd()
-	Purpose	: Add's a location to an existing location config
-	Params	: location_id
-	Dev		: Scatman
-	Example	: /location add {location_id}
-*/ 
-void Commands::Command_LocationAdd(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && sep->IsNumber(0)) 
-	{
-		int32 location_id = atoul(sep->arg[0]);
-		float x = client->GetPlayer()->GetX();
-		float y = client->GetPlayer()->GetY();
-		float z = client->GetPlayer()->GetZ();
-
-		if (database.AddLocationPoint(location_id, x, y, z))
-			client->Message(CHANNEL_COLOR_YELLOW, "Point (%f, %f, %f) was successfully added to location %u", x, y, z, location_id);
-		else
-			client->Message(CHANNEL_COLOR_YELLOW, "A location with ID %u does not exist.  Use /location create to create one", location_id);
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /location add [location id]");
-}
-
-/* 
-	Function: Command_LocationCreate()
-	Purpose	: Creates a new location config
-	Params	: location name, 0/1 for include_y (optional)
-	Dev		: Scatman 
-	Example	: /location create Test 1 = creates a new location named Test with include_y True
-*/ 
-void Commands::Command_LocationCreate(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && strlen(sep->arg[0]) > 0) 
-	{
-		const char* name = sep->arg[0];
-		bool include_y = false;
-
-		if (sep->arg[1] && sep->IsNumber(1) && atoi(sep->arg[1]) > 0)
-			include_y = true;
-
-		int32 location_id = database.CreateLocation(client->GetPlayer()->GetZone()->GetZoneID(), client->GetPlayer()->appearance.pos.grid_id, name, include_y);
-
-		if (location_id > 0)
-			client->Message(CHANNEL_COLOR_YELLOW, "Location '%s' was successfully created with location id %u", name, location_id);
-		else
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "There was an error creating the requested location");
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /location create [name] (include_y).  Include y defaults to false");
-}
-
-/* 
-	Function: Command_LocationDelete()
-	Purpose	: Delete's a location config and all it's location points
-	Params	: location_id
-	Dev		: Scatman
-	Example	: /location delete {location_id}
-*/ 
-void Commands::Command_LocationDelete(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && sep->IsNumber(0))
-	{
-		int32 location_id = atoul(sep->arg[0]);
-
-		if (database.DeleteLocation(location_id))
-			client->Message(CHANNEL_COLOR_YELLOW, "Location id %u and all its points were successfully deleted", location_id);
-		else
-			client->Message(CHANNEL_COLOR_YELLOW, "A location with ID %u does not exist", location_id);
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /location delete [location id]");
-}
-
-/* 
-	Function: Command_LocationList()
-	Purpose	: Display's a list of location points
-	Params	: location_id
-	Dev		: Scatman
-	Example	: /location list {location_id}
-*/ 
-void Commands::Command_LocationList(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0]) 
-	{
-		const char* option = sep->arg[0];
-
-		if (strncmp(option, "locations", strlen(option)) == 0)
-			database.ListLocations(client);
-		else if (strncmp(option, "points", strlen(option)) == 0 && sep->arg[1] && sep->IsNumber(1)) 
-		{
-			int32 location_id = atoul(sep->arg[1]);
-			database.ListLocationPoints(client, location_id);
-		}
-		else
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Useage: /location list [locations|points] [location ID if points used]");
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Useage: /location list [locations|points] [location ID if points used]");
-}
-
-/* 
-	Function: Command_LocationRemove()
-	Purpose	: Removes a single location point from a location config
-	Params	: location_point_id (gotten from /location list {id})
-	Dev		: Scatman
-	Example	: /location remove 1 = will remove location_point_id 1
-*/ 
-void Commands::Command_LocationRemove(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && sep->IsNumber(0)) 
-	{
-		int32 location_point_id = atoul(sep->arg[0]);
-
-		if (database.DeleteLocationPoint(location_point_id))
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Location point was successfully deleted");
-		else
-			client->Message(CHANNEL_COLOR_YELLOW, "Location point with ID %u does not exist", location_point_id);
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /location remove [location point id]");
-}
-
-/* 
-	Function: Command_Merchant()
-	Purpose	: Handles Merchant commands
-	Params	: list
-	Dev		: Scatman
-	Example	: /merchant list
-*/ 
-void Commands::Command_Merchant(Client* client, Seperator* sep, int handler)
-{
-	if( handler == COMMAND_MERCHANT )
-	{
-		// /merchant command by itself shows help (to be extended)
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /merchant list [merchant description]");
-		return;
-	}
-	else if( handler == COMMAND_MERCHANT_LIST )
-	{
-		// /merchant list command expects "description" param
-		if (sep && sep->arg[0])
-		{
-			const char* merchant_description = sep->argplus[0];
-			client->Message(CHANNEL_COLOR_YELLOW, "Listing merchants like '%s':", merchant_description);
-			map<int32, MerchantInfo*>* merchant_info = world.GetMerchantInfo();
-			map<int32, MerchantInfo*>::iterator itr;
-
-			for (itr = merchant_info->begin(); itr != merchant_info->end(); itr++) 
-			{
-				string description = database.GetMerchantDescription(itr->first);
-
-				if (ToLower(description).find(ToLower(string(merchant_description))) < 0xFFFFFFFF)
-					client->Message(CHANNEL_COLOR_YELLOW, "Merchant ID: %u, Description: %s", itr->first, description.c_str());
-			}
-		}
-		else // no description
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /merchant list [merchant description]");
-	}
-}
-
-/* 
-	Function: Command_Modify()
-	Purpose	: to replace our other "set" commands
-	Params	: System = the system to modify, Action = the action to perform, Target = what to change (target, or index)
-	Dev		: John Adams
-	Example	: /modify spell set name "Aegolism III"
-*/ 
-void Commands::Command_Modify(Client* client)
-{
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /modify [system] [action] [field] [value] {target|id}");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Systems: character, faction, guild, item, skill, spawn, spell, zone");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Actions: set, create, delete, add, remove");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Value  : field name in the table being modified");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Target : modify current target, or specified {system} ID");
-}
-
-
-/* 
-	Function: Command_ModifySpawn()
-	Purpose	: replace "spawn set" commands
-	Params	: Action	: the action to perform (or special handler)
-			: Field		: the DB field to change
-			: Value		: what to set the value to
-			: Target	: what object to change (my target, or spawn_id)
-	Dev		: John Adams
-	Example	: /modify spawn set name "Lady Vox"
-			:
-	Note	: Special Handlers, like "zoneto" for Signs
-			:	/modify spawn zoneto
-			:	Will set a sign's zone x/y/z to my current coords
-*/ 
-void Commands::Command_ModifySpawn(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_MODIFY");
-
-	// need at least 2 args for a valid command
-	if( sep && sep->arg[1] )
-	{
-		// JA: just a quick implementation because I need it :)
-		if (strcmp(sep->arg[0], "zoneto") == 0) 
-		{
-			if( sep->IsNumber(1) )
-			{
-				int32 spawn_id = atoul(sep->arg[1]);
-				float x_coord = client->GetPlayer()->GetX();
-				float y_coord = client->GetPlayer()->GetY();
-				float z_coord = client->GetPlayer()->GetZ();
-				float h_coord = client->GetPlayer()->GetHeading();
-
-				database.SaveSignZoneToCoords(spawn_id, x_coord, y_coord, z_coord, h_coord);
-			}
-			else
-				client->SimpleMessage(CHANNEL_COLOR_RED, "Usage: /modify spawn zoneto spawn_id - sets spawn_id to your coords");
-		}
-	}
-	else
-		Command_Modify(client);
-}
-
-/* 
-	Function: Command_ModifyCharacter()
-	Purpose	: to replace our other "set" commands
-	Params	: Action	: Add, Remove
-			: Field		: copper, silver, gold, plat
-			: Value		: min 1, max unlimited
-			: Target	: Self, Player
-	Dev		: Cynnar
-	Example	: /modify character add gold 50
-			: /modify character remove silver 25
-*/
-void Commands::Command_ModifyCharacter(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_MODIFY");
-
-	int64 value = 0;
-
-	Player* player = client->GetPlayer();
-	if (player->HasTarget() && player->GetTarget()->IsPlayer())
-		player = (Player*)player->GetTarget();
-
-	// need at least 2 args for a valid command
-	if( sep && sep->arg[1] )
-
-	{
-		if (strcmp(sep->arg[0], "add") == 0)
-			
-		{
-			if (strcmp(sep->arg[1], "copper") == 0)
-			{
-				value = atoi64(sep->arg[2]);
-				player->AddCoins(value);
-				if (client->GetPlayer() == player)
-				{
-					client->Message(CHANNEL_COLOR_YELLOW, "You give yourself %llu copper coin%s", value, (value > 1 ? "s" : ""));
-				}
-				else {
-					client->Message(CHANNEL_COLOR_YELLOW, "You give %s %llu copper coin%s", player->GetName(), value, (value > 1 ? "s" : ""));
-					client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s gave you %llu copper coin%s", client->GetPlayer()->GetName(), value, (value > 1 ? "s" : ""));
-				}
-			}
-
-			else if (strcmp(sep->arg[1], "silver") == 0)
-			{
-				value = atoi64(sep->arg[2]) * 100;
-				player->AddCoins(value);
-				if (client->GetPlayer() == player)
-				{
-					client->Message(CHANNEL_COLOR_YELLOW, "You give yourself %llu silver coin%s", value / 100, (value > 1 ? "s" : ""));
-				}
-				else {
-					client->Message(CHANNEL_COLOR_YELLOW, "You give %s %llu silver coin%s", player->GetName(), value / 100, (value > 1 ? "s" : ""));
-					client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s gave you %llu silver coin%s", client->GetPlayer()->GetName(), value / 100, (value > 1 ? "s" : ""));
-				}
-			}
-
-			else if (strcmp(sep->arg[1], "gold") == 0)
-			{
-				value = atoi64(sep->arg[2]) * 10000;
-				player->AddCoins(value);
-				if (client->GetPlayer() == player)
-				{
-					client->Message(CHANNEL_COLOR_YELLOW, "You give yourself %llu gold coin%s", value / 10000, (value > 1 ? "s" : ""));
-				}
-				else {
-					client->Message(CHANNEL_COLOR_YELLOW, "You give %s %llu gold coin%s", player->GetName(), value / 10000, (value > 1 ? "s" : ""));
-					client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s gave you %llu gold coin%s", client->GetPlayer()->GetName(), value / 10000, (value > 1 ? "s" : ""));
-				}
-			}
-
-			else if (strcmp(sep->arg[1], "plat") == 0)
-			{
-				value = atoi64(sep->arg[2]) * 1000000;
-				player->AddCoins(value);
-				if (client->GetPlayer() == player)
-				{
-					client->Message(CHANNEL_COLOR_YELLOW, "You give yourself %llu platinum coin%s", value / 1000000, (value > 1 ? "s" : ""));
-				}
-				else {
-					client->Message(CHANNEL_COLOR_YELLOW, "You give %s %llu platinum coin%s", player->GetName(), value / 1000000, (value > 1 ? "s" : ""));
-					client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s gave you %llu platinum coin%s", client->GetPlayer()->GetName(), value / 1000000, (value > 1 ? "s" : ""));
-				}
-			}
-
-			else
-			{
-				client->SimpleMessage(CHANNEL_COLOR_RED, "Usage: /modify character [action] [field] [value]");
-				client->SimpleMessage(CHANNEL_COLOR_RED, "Actions: add, remove");
-				client->SimpleMessage(CHANNEL_COLOR_RED, "Value  : copper, silver, gold, plat");
-				client->SimpleMessage(CHANNEL_COLOR_RED, "Example: /modify character add copper 20");
-			}
-		}
-
-		else if (strcmp(sep->arg[0], "remove") == 0)
-		{
-			if (strcmp(sep->arg[1], "copper") == 0)
-			{
-				value = atoi64(sep->arg[2]);
-				player->RemoveCoins(value);
-				if (client->GetPlayer() == player)
-				{
-					client->Message(CHANNEL_COLOR_YELLOW, "You take %llu copper coin%s from yourself", value, (value > 1 ? "s" : ""));
-				}
-				else {
-					client->Message(CHANNEL_COLOR_YELLOW, "You take %llu copper coin%s from %s", value, (value > 1 ? "s" : ""), player->GetName());
-					client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s takes %llu copper coin%s from you", client->GetPlayer()->GetName(), value, (value > 1 ? "s" : ""));
-				}
-			}
-
-			else if (strcmp(sep->arg[1], "silver") == 0)
-			{
-				value = atoi64(sep->arg[2]) * 100;
-				player->RemoveCoins(value);
-				if (client->GetPlayer() == player)
-				{
-					client->Message(CHANNEL_COLOR_YELLOW, "You take %llu silver coin%s from yourself", value / 100, (value > 1 ? "s" : ""));
-				}
-				else {
-					client->Message(CHANNEL_COLOR_YELLOW, "You take %llu silver coin%s from %s", value / 100, (value > 1 ? "s" : ""), player->GetName());
-					client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s takes %llu silver coin%s from you", client->GetPlayer()->GetName(), value / 100, (value > 1 ? "s" : ""));
-				}
-			}
-
-			else if (strcmp(sep->arg[1], "gold") == 0)
-			{
-				value = atoi64(sep->arg[2]) * 10000;
-				player->RemoveCoins(value);
-				if (client->GetPlayer() == player)
-				{
-					client->Message(CHANNEL_COLOR_YELLOW, "You take %llu gold coin%s from yourself", value / 10000, (value > 1 ? "s" : ""));
-				}
-				else {
-					client->Message(CHANNEL_COLOR_YELLOW, "You take %llu gold coin%s from %s", value / 10000, (value > 1 ? "s" : ""), player->GetName());
-					client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s takes %llu gold coin%s from you", client->GetPlayer()->GetName(), value / 10000, (value > 1 ? "s" : ""));
-				}
-			}
-
-			else if (strcmp(sep->arg[1], "plat") == 0)
-			{
-				value = atoi64(sep->arg[2]) * 1000000;
-				player->RemoveCoins(value);
-				if (client->GetPlayer() == player)
-				{
-					client->Message(CHANNEL_COLOR_YELLOW, "You take %llu platinum coin%s from yourself", value / 1000000, (value > 1 ? "s" : ""));
-				}
-				else {
-					client->Message(CHANNEL_COLOR_YELLOW, "You take %llu platinum coin%s from %s", value / 1000000, (value > 1 ? "s" : ""), player->GetName());
-					client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s takes %llu platinum coin%s from you", client->GetPlayer()->GetName(), value / 1000000, (value > 1 ? "s" : ""));
-				}
-			}
-
-			else
-			{
-				client->SimpleMessage(CHANNEL_COLOR_RED, "Example: /modify character remove gold 15");
-				
-			}
-		}
-
-		else if (strcmp(sep->arg[0], "set") == 0) {
-
-			if (strcmp(sep->arg[1], "tslevel") == 0) {
-				int8 level = atoi(sep->arg[2]);
-
-				if (level > 0 && level < 256) {
-					if (player) {
-						if (client->GetPlayer() == player)
-							client->ChangeTSLevel(player->GetTSLevel(), level);
-						else
-							player->GetZone()->GetClientBySpawn(player)->ChangeTSLevel(player->GetTSLevel(), level);
-					}
-				}
-				else
-					client->SimpleMessage(CHANNEL_ERROR, "Level must be between 1 - 255");
-			}
-
-			else if (strcmp(sep->arg[1], "tsclass") == 0) {
-				int8 tsclass = atoi(sep->arg[2]);
-
-				player->SetTradeskillClass(tsclass);
-				player->GetInfoStruct()->set_tradeskill_class1(classes.GetTSBaseClass(player->GetTradeskillClass()));
-				player->GetInfoStruct()->set_tradeskill_class2(classes.GetSecondaryTSBaseClass(player->GetTradeskillClass()));
-				player->GetInfoStruct()->set_tradeskill_class3(player->GetTradeskillClass());
-				player->SetCharSheetChanged(true);
-			}
-		}
-	}
-	else
-	{
-		client->SimpleMessage(CHANNEL_COLOR_RED, "Usage: /modify character [action] [field] [value]");
-		client->SimpleMessage(CHANNEL_COLOR_RED, "Actions: add, remove");
-		client->SimpleMessage(CHANNEL_COLOR_RED, "Value  : copper, silver, gold, plat");
-		client->SimpleMessage(CHANNEL_COLOR_RED, "Example: /modify character remove gold 15");
-	}
-		
-}
-
-
-void Commands::Command_ModifyFaction(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_MODIFY");
-
-	// need at least 2 args for a valid command
-	if( sep && sep->arg[1] )
-	{
-	}
-	else
-		Command_Modify(client);
-}
-
-
-void Commands::Command_ModifyGuild(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_MODIFY");
-
-	// need at least 2 args for a valid command
-	if( sep && sep->arg[1] )
-	{
-	}
-	else
-		Command_Modify(client);
-}
-
-
-void Commands::Command_ModifyItem(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_MODIFY");
-
-	// need at least 2 args for a valid command
-	if( sep && sep->arg[1] )
-	{
-	}
-	else
-		Command_Modify(client);
-}
-
-/* 
-	Function: Command_ModifyQuest()
-	Purpose	: to list players quest and completed quests
-	Params	: Action	: list, completed
-			: Target	: Self, Player
-	Dev		: Cynnar
-	Example	: /modify quest list
-			: /modify quest completed
-*/
-
-void Commands::Command_ModifyQuest(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_MODIFY");
-
-	int64 value = 0;
-
-	Player* player = client->GetPlayer();
-	if (player->HasTarget() && player->GetTarget()->IsPlayer())
-		player = (Player*)player->GetTarget();
-
-	// need at least 2 args for a valid command
-
-	if (sep && sep->arg[1])
-	{
-
-		if (strcmp(sep->arg[0], "list") == 0)
-		{
-			map<int32, Quest*>* quests = player->GetPlayerQuests();
-			map<int32, Quest*>::iterator itr;
-			client->Message(CHANNEL_COLOR_YELLOW, "%s's Quest List:.", client->GetPlayer()->GetName());
-			if (quests->size() == 0)
-				client->Message(CHANNEL_COLOR_YELLOW, "%s has no quests.", client->GetPlayer()->GetName());
-			else
-			{
-				for (itr = quests->begin(); itr != quests->end(); itr++)
-				{
-					Quest* quest = itr->second;
-					client->Message(CHANNEL_COLOR_YELLOW, "%u) %s", itr->first, quest->GetName());
-				}
-			}
-
-		}
-
-		else if (strcmp(sep->arg[0], "completed") == 0)
-		{
-
-			map<int32, Quest*>* quests = player->GetCompletedPlayerQuests();
-			map<int32, Quest*>::iterator itr;
-			client->Message(CHANNEL_COLOR_YELLOW, "%s's Completed Quest List:.", client->GetPlayer()->GetName());
-			if (quests->size() == 0)
-				client->Message(CHANNEL_COLOR_YELLOW, "%s has no completed quests.", client->GetPlayer()->GetName());
-			else
-			{
-				for (itr = quests->begin(); itr != quests->end(); itr++)
-				{
-					Quest* quest = itr->second;
-					client->Message(CHANNEL_COLOR_YELLOW, "%u) %s", itr->first, quest->GetName());
-				}
-			}
-
-		}
-		// Add in a progress step, and a LogWrite() for tracking GM Commands.
-		// LogWrite(LUA__DEBUG, 0, "LUA", "Quest: %s, function: %s", quest->GetName(), function);
-		else if (strcmp(sep->arg[0], "remove") == 0)
-		{
-			int32 quest_id = 0;
-
-			if (sep && sep->arg[1] && sep->IsNumber(1))
-				quest_id = atoul(sep->arg[1]);
-
-			if (quest_id > 0)
-			{
-				if (lua_interface && client->GetPlayer()->player_quests.count(quest_id) > 0)
-				{
-					Quest* quest = client->GetPlayer()->player_quests[quest_id];
-					if (quest)
-						if (client->GetPlayer() == player)
-						{
-							client->Message(CHANNEL_COLOR_YELLOW, "The quest %s has been removed from your journal", quest->GetName());
-						}
-						else
-						{
-							client->Message(CHANNEL_COLOR_YELLOW, "You have removed the quest %s from %s's journal", quest->GetName(), player->GetName());
-							client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s has removed the quest %s from your journal", client->GetPlayer()->GetName(), quest->GetName());
-						}
-					LogWrite(COMMAND__INFO, 0, "GM Command", "%s removed the quest %s from %s", client->GetPlayer()->GetName(), quest->GetName(), player->GetName());
-					lua_interface->CallQuestFunction(quest, "Deleted", client->GetPlayer());
-				}
-				client->RemovePlayerQuest(quest_id);
-				client->GetCurrentZone()->SendQuestUpdates(client);
-			}
-		}
-
-		else if (strcmp(sep->arg[0], "advance") == 0)
-		{
-			int32 quest_id = 0;
-			int32 step = 0;
-
-			if (sep && sep->arg[1] && sep->IsNumber(1))
-			{
-				quest_id = atoul(sep->arg[1]);
-				Quest* quest = client->GetPlayer()->player_quests[quest_id];
-
-				if (sep && sep->arg[2] && sep->IsNumber(1))
-				{
-					step = atoul(sep->arg[2]);
-
-					if (quest_id > 0 && step > 0)
-					{
-						if (player && player->IsPlayer() && quest_id > 0 && step > 0 && (player->player_quests.count(quest_id) > 0))
-						{
-							if (client)
-							{
-								client->AddPendingQuestUpdate(quest_id, step);
-								client->Message(CHANNEL_COLOR_YELLOW, "The quest %s has been advanced one step.", quest->GetName());
-								LogWrite(COMMAND__INFO, 0, "GM Command", "%s advanced the quest %s one step", client->GetPlayer()->GetName(), quest->GetName());
-							}
-						}
-					}
-					else
-					{
-						client->Message(CHANNEL_COLOR_RED, "Quest ID and Step Number must be greater than 0!");
-					}
-				}
-				else
-				{
-					client->Message(CHANNEL_COLOR_RED, "Step Number must be a number!");
-				}
-			}
-			else
-			{
-				client->Message(CHANNEL_COLOR_RED, "Quest ID must be a number!");
-			}
-		}
-
-		else
-		{
-			Command_Modify(client);
-		}
-	}
-
-	else
-	{
-		client->SimpleMessage(CHANNEL_COLOR_RED, "Usage: /modify quest [action] [quest id] [step number]");
-		client->SimpleMessage(CHANNEL_COLOR_RED, "Actions: list, completed, remove, advance");
-		client->SimpleMessage(CHANNEL_COLOR_RED, "Example: /modify quest list");
-		client->SimpleMessage(CHANNEL_COLOR_RED, "Example: /modify quest remove 156");
-		client->SimpleMessage(CHANNEL_COLOR_RED, "Example: /modify quest advance 50 1");
-	}
-
-}
-
-
-void Commands::Command_ModifySkill(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_MODIFY");
-
-	// need at least 2 args for a valid command
-	if( sep && sep->arg[1] )
-	{
-		if (strcmp(sep->arg[0], "add") == 0) {
-			const char* skill_name = sep->argplus[1];
-			Skill* skill = master_skill_list.GetSkillByName(skill_name);
-
-			if (skill) {
-				Player* player = 0;
-				Client* to_client = 0;
-
-				if (client->GetPlayer()->GetTarget() && client->GetPlayer()->GetTarget()->IsPlayer()) {
-					player = (Player*)client->GetPlayer()->GetTarget();
-					to_client = client->GetCurrentZone()->GetClientBySpawn(player);
-				}
-				else {
-					player = client->GetPlayer();
-					to_client = client;
-				}
-
-				if (player)
-				{
-					if (!player->GetSkills()->HasSkill(skill->skill_id))
-					{
-						player->AddSkill(skill->skill_id, 1, player->GetLevel() * 5, true);
-						if (to_client == client) {
-							client->Message(CHANNEL_STATUS, "Added skill '%s'.", skill_name);
-						}
-						else {
-							client->Message(CHANNEL_STATUS, "You gave skill '%s' to player '%s'.", skill_name, player->GetName());
-							to_client->Message(CHANNEL_STATUS, "%s gave you skill '%s'.", client->GetPlayer()->GetName(), skill_name);
-						}
-					}
-					else
-						client->Message(CHANNEL_STATUS, "%s already has the skill '%s'.", to_client == client ? "You" : player->GetName(), skill_name);
-				}
-			}
-			else
-				client->Message(CHANNEL_STATUS, "The skill '%s' does not exist.", skill_name);
-		}
-		else if (strcmp(sep->arg[0], "remove") == 0) {
-			const char* skill_name = sep->argplus[1];
-			Skill* skill = master_skill_list.GetSkillByName(skill_name);
-
-			if (skill) {
-				Player* player = 0;
-				Client* to_client = 0;
-
-				if (client->GetPlayer()->GetTarget() && client->GetPlayer()->GetTarget()->IsPlayer()) {
-					player = (Player*)client->GetPlayer()->GetTarget();
-					to_client = client->GetCurrentZone()->GetClientBySpawn(player);
-				}
-				else {
-					player = client->GetPlayer();
-					to_client = client;
-				}
-
-				if (player)
-				{
-					if (player->GetSkills()->HasSkill(skill->skill_id))
-					{
-						player->RemoveSkillFromDB(skill, true);
-						if (client == to_client) {
-							client->Message(CHANNEL_STATUS, "Removed skill '%s'.", skill_name);
-						}
-						else {
-							client->Message(CHANNEL_STATUS, "Removed skill '%s' from player %s.", skill_name, player->GetName());
-							to_client->Message(CHANNEL_STATUS, "%s has removed skill '%s' from you.", client->GetPlayer()->GetName(), skill_name);
-						}
-					}
-					else {
-						if (client == to_client)
-							client->Message(CHANNEL_STATUS, "You do not have the skill '%s'.", skill_name);
-						else
-							client->Message(CHANNEL_STATUS, "Player '%s' does not have the skill '%s'.", player->GetName(), skill_name);
-					}
-				}
-			}
-			else
-				client->Message(CHANNEL_STATUS, "The skill '%s' does not exist.", skill_name);
-		}
-		else if (strcmp(sep->arg[0], "set") == 0) {
-			if (!sep->IsNumber(2)) {
-				client->Message(CHANNEL_STATUS, "The last parameter must be a number.");
-				return;
-			}
-
-			const char* skill_name = sep->arg[1];
-			Skill* skill = master_skill_list.GetSkillByName(skill_name);
-			if (skill) {
-				int16 val = atoi(sep->arg[2]);
-				Player* player = 0;
-				Client* to_client = 0;
-
-				if (client->GetPlayer()->GetTarget() && client->GetPlayer()->GetTarget()->IsPlayer()) {
-					player = (Player*)client->GetPlayer()->GetTarget();
-					to_client = client->GetCurrentZone()->GetClientBySpawn(player);
-				}
-				else {
-					player = client->GetPlayer();
-					to_client = client;
-				}
-
-				if (player)
-				{
-					if (player->GetSkills()->HasSkill(skill->skill_id)) {
-						player->GetSkills()->SetSkill(skill->skill_id, val);
-						if (client != to_client)
-							client->Message(CHANNEL_STATUS, "You set %s's '%s' skill to %i.", player->GetName(), skill_name, val);
-
-						to_client->Message(CHANNEL_STATUS, "Your '%s' skill has been set to %i.", skill_name, val);
-					}
-					else {
-						client->Message(CHANNEL_STATUS, "Target does not have the skill '%s'.", skill_name);
-					}
-				}
-			}
-			else {
-				client->Message(CHANNEL_STATUS, "The skill '%s' does not exist.", skill_name);
-			}
-		}
-		else {
-			client->SimpleMessage(CHANNEL_STATUS, "Usage: /modify skill [action] [skill]");
-			client->SimpleMessage(CHANNEL_STATUS, "Actions: add, remove, set");
-			client->SimpleMessage(CHANNEL_STATUS, "Example: /modify skill add parry");
-		}
-	}
-	else {
-		client->SimpleMessage(CHANNEL_STATUS, "Usage: /modify skill [action] [skill]");
-		client->SimpleMessage(CHANNEL_STATUS, "Actions: add, remove, set");
-		client->SimpleMessage(CHANNEL_STATUS, "Example: /modify skill add parry");
-	}
-}
-
-
-void Commands::Command_ModifySpell(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_MODIFY");
-
-	// need at least 2 args for a valid command
-	if( sep && sep->arg[1] )
-	{
-	}
-	else
-		Command_Modify(client);
-}
-
-
-void Commands::Command_ModifyZone(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_MODIFY");
-
-	// need at least 2 args for a valid command
-	if( sep && sep->arg[1] )
-	{
-	}
-	else
-		Command_Modify(client);
-}
-
-
-/* 
-	Function: Command_MOTD()
-	Purpose	: Displays server MOTD
-	Params	: 
-	Dev		: LethalEncounter
-	Example	: /motd
-*/ 
-void Commands::Command_MOTD(Client* client)
-{
-	if (client)
-		ClientPacketFunctions::SendMOTD(client);
-}
-
-/* 
-	Function: Command_Pet()
-	Purpose	: Handle Pet {Command} commands
-	Params	: attack, backoff, preserve_master, preserve_self, follow, stay, getlost
-	Dev		: 
-	Example	: /pet preserve_master
-*/ 
-void Commands::Command_Pet(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_PET");
-	//LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Pet Commands");
-	//client->Message(CHANNEL_COLOR_YELLOW, "Pets are not yet implemented.");
-
-
-	if (!sep || !sep->arg[0])
-		return; // should have sep->arg[0] filled
-
-	if (strcmp(sep->arg[0], "hide") == 0) {
-		// doing /pet hide will toggle the hide status on all the pets that can be hidden
-		Entity* pet = client->GetPlayer()->GetDeityPet();
-		if (pet) {
-			if (pet->IsPrivateSpawn())
-				client->GetPlayer()->HideDeityPet(false);
-			else
-				client->GetPlayer()->HideDeityPet(true);
-		}
-
-		pet = client->GetPlayer()->GetCosmeticPet();
-		if (pet) {
-			if (pet->IsPrivateSpawn())
-				client->GetPlayer()->HideCosmeticPet(false);
-			else
-				client->GetPlayer()->HideCosmeticPet(true);
-		}
-
-		return;
-	}
-
-	// below is for all combat pets
-	if (!client->GetPlayer()->HasPet()) {
-		client->Message(CHANNEL_COLOR_YELLOW, "You do not have a pet.");
-		return;
-	}
-	
-	if (strcmp(sep->arg[0], "stay") == 0) {
-		client->Message(CHANNEL_COLOR_YELLOW, "You command your pet to stay.");
-		client->GetPlayer()->GetInfoStruct()->set_pet_movement(1);
-		client->GetPlayer()->SetCharSheetChanged(true);
-		if (client->GetPlayer()->GetPet())
-			client->GetPlayer()->GetPet()->following = false;
-		if (client->GetPlayer()->GetCharmedPet())
-			client->GetPlayer()->GetCharmedPet()->following = false;
-	}
-	else if (strcmp(sep->arg[0], "follow") == 0) {
-		client->Message(CHANNEL_COLOR_YELLOW, "You command your pet to follow.");
-		client->GetPlayer()->GetInfoStruct()->set_pet_movement(2);
-		client->GetPlayer()->SetCharSheetChanged(true);
-	}
-	else if (strcmp(sep->arg[0], "preserve_master") == 0) {
-		if (client->GetPlayer()->GetInfoStruct()->get_pet_behavior() & 1) {
-			client->Message(CHANNEL_COLOR_YELLOW, "Your pet will no longer protect you.");
-			client->GetPlayer()->GetInfoStruct()->set_pet_behavior(client->GetPlayer()->GetInfoStruct()->get_pet_behavior()-1);
-		}
-		else {
-			client->Message(CHANNEL_COLOR_YELLOW, "You command your pet to protect you.");
-			client->GetPlayer()->GetInfoStruct()->set_pet_behavior(client->GetPlayer()->GetInfoStruct()->get_pet_behavior()+1);
-		}
-		client->GetPlayer()->SetCharSheetChanged(true);
-	}
-	else if (strcmp(sep->arg[0], "preserve_self") == 0) {
-		if (client->GetPlayer()->GetInfoStruct()->get_pet_behavior() & 2) {
-			client->Message(CHANNEL_COLOR_YELLOW, "Your pet will no longer protect itself.");
-			client->GetPlayer()->GetInfoStruct()->set_pet_behavior(client->GetPlayer()->GetInfoStruct()->get_pet_behavior()-2);
-		}
-		else {
-			client->Message(CHANNEL_COLOR_YELLOW, "You command your pet to protect itself.");
-			client->GetPlayer()->GetInfoStruct()->set_pet_behavior(client->GetPlayer()->GetInfoStruct()->get_pet_behavior()+2);
-		}
-		client->GetPlayer()->SetCharSheetChanged(true);
-	}
-	else if (strcmp(sep->arg[0], "backoff") == 0) {
-		client->Message(CHANNEL_COLOR_YELLOW, "You command your pet to back down.");
-		if (client->GetPlayer()->GetPet())
-			((NPC*)client->GetPlayer()->GetPet())->Brain()->ClearHate();
-		if (client->GetPlayer()->GetCharmedPet())
-			((NPC*)client->GetPlayer()->GetCharmedPet())->Brain()->ClearHate();
-		client->GetPlayer()->GetInfoStruct()->set_pet_behavior(0);
-		client->GetPlayer()->SetCharSheetChanged(true);
-	}
-	else if (strcmp(sep->arg[0], "attack") == 0) {
-		if (client->GetPlayer()->HasTarget() && client->GetPlayer()->GetTarget()->IsEntity()) {
-			if (client->GetPlayer()->AttackAllowed((Entity*)client->GetPlayer()->GetTarget())){
-				client->Message(CHANNEL_COLOR_YELLOW, "You command your pet to attack your target.");
-				if (client->GetPlayer()->GetPet())
-					client->GetPlayer()->GetPet()->AddHate((Entity*)client->GetPlayer()->GetTarget(), 1);
-				if (client->GetPlayer()->GetCharmedPet())
-					client->GetPlayer()->GetCharmedPet()->AddHate((Entity*)client->GetPlayer()->GetTarget(), 1);
-			}
-			else
-				client->Message(CHANNEL_COLOR_YELLOW, "You can not attack that.");
-		}
-		else
-			client->Message(CHANNEL_COLOR_YELLOW, "You do not have a target.");
-
-	}
-	else if (strcmp(sep->arg[0], "getlost") == 0) {
-		client->GetPlayer()->DismissPet((NPC*)client->GetPlayer()->GetPet());
-		client->GetPlayer()->DismissPet((NPC*)client->GetPlayer()->GetCharmedPet());
-
-		client->Message(CHANNEL_COLOR_YELLOW, "You tell your pet to get lost.");
-	}
-	else
-		client->Message(CHANNEL_COLOR_YELLOW, "Unknown pet command.");
-	
-}
-
-/* 
-	Function: Command_PetName()
-	Purpose	: Pet your name (???)
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_PetName(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_PETNAME");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Pet Name Command");
-	client->Message(CHANNEL_COLOR_YELLOW, "Pets are not yet implemented.");
-}
-
-/* 
-	Function: Command_NamePet()
-	Purpose	: Name your pet
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_NamePet(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_NAME_PET");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Name Pet Command");
-	client->Message(CHANNEL_COLOR_YELLOW, "Pets are not yet implemented.");
-}
-
-/* 
-	Function: Command_Rename()
-	Purpose	: Renames existing pet
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_Rename(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_RENAME");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Rename Pet Command");
-	client->Message(CHANNEL_COLOR_YELLOW, "Pets are not yet implemented.");
-}
-
-/* 
-	Function: Command_ConfirmRename()
-	Purpose	: Confirms renaming your pet
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_ConfirmRename(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_CONFIRMRENAME");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Confirm Rename Pet Command");
-	client->Message(CHANNEL_COLOR_YELLOW, "Pets are not yet implemented.");
-}
-
-/* 
-	Function: Command_PetOptions()
-	Purpose	: Sets various pet options
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_PetOptions(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_PETOPTIONS");
-
-	Player* player = client->GetPlayer();
-	Spawn* target = player->GetTarget();
-	if (!target)
-		return;
-
-	if (target == player->GetPet())
-		client->SendPetOptionsWindow(player->GetPet()->GetName());
-	else if (target == player->GetCharmedPet())
-		client->SendPetOptionsWindow(player->GetCharmedPet()->GetName());
-	else if (target == player->GetCosmeticPet())
-		client->SendPetOptionsWindow(player->GetCosmeticPet()->GetName(), 0);
-	else if (target == player->GetDeityPet())
-		client->SendPetOptionsWindow(player->GetDeityPet()->GetName(), 0);
-}
-
-/* 
-	Function: Command_Random()
-	Purpose	: Handles /random dice roll in-game
-	Params	: 1-100
-	Dev		: Scatman
-	Example	: /randon 1 100
-*/ 
-void Commands::Command_Random(Client* client, Seperator* sep)
-{
-	char message[256] = {0};
-
-	if (sep)
-	{
-		if (sep->GetArgNumber() == 0 && sep->IsNumber(0))
-			sprintf(message, "Random: %s rolls 1 to %i on the magic dice...and scores a %i!", client->GetPlayer()->GetName(), atoi(sep->arg[0]), MakeRandomInt(1, atoi(sep->arg[0])));
-		else if (sep->GetArgNumber() > 0 && sep->IsNumber(0) && sep->IsNumber(1))
-			sprintf(message, "Random: %s rolls from %i to %i on the magic dice...and scores a %i!", client->GetPlayer()->GetName(), atoi(sep->arg[0]), atoi(sep->arg[1]), MakeRandomInt(atoi(sep->arg[0]), atoi(sep->arg[1])));
-		else
-			sprintf(message, "Random: %s rolls from 1 to 100 on the magic dice...and scores a %i!", client->GetPlayer()->GetName(), MakeRandomInt(1, 100));
-	}
-	else
-		sprintf(message, "Random: %s rolls from 1 to 100 on the magic dice...and scores a %i!", client->GetPlayer()->GetName(), MakeRandomInt(1, 100));
-			
-	client->GetPlayer()->GetZone()->HandleChatMessage(0, 0, CHANNEL_EMOTE, message);
-}
-
-/* 
-	Function: Command_Randomize()
-	Purpose	: Sets randomize (appearance) values for NPCs
-	Params	: Attrib Name
-	Dev		: Scatman
-	Example	: /randomize gender 1  -- will randomize the NPCs gender (male/female)
-*/ 
-void Commands::Command_Randomize(Client* client, Seperator* sep)
-{
-	NPC* target = (NPC*)client->GetPlayer()->GetTarget();
-	if (target) 
-	{
-		if (target->IsNPC()) 
-		{
-			if (sep && sep->arg[0] && !sep->IsNumber(0)) 
-			{
-				const char* value = sep->arg[0];
-				if (strncasecmp(value, "show", strlen(value)) == 0) 
-				{
-					client->DisplayRandomizeFeatures(target->GetRandomize());
-				}
-				else
-				{
-					if (sep->arg[1] && sep->IsNumber(1)) 
-					{
-						int8 option = atoi(sep->arg[1]);
-						if (option == 0 || option == 1) 
-						{
-							int32 feature = 0;
-							char feature_text[32] = {0};
-							if (strncasecmp(value, "gender", strlen(value)) == 0) {
-								feature = RANDOMIZE_GENDER;
-								strncpy(feature_text, "gender", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "race", strlen(value)) == 0) {
-								feature = RANDOMIZE_RACE;
-								strncpy(feature_text, "race", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "model", strlen(value)) == 0) {
-								feature = RANDOMIZE_MODEL_TYPE;
-								strncpy(feature_text, "model", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "facial_hair", strlen(value)) == 0) {
-								feature = RANDOMIZE_FACIAL_HAIR_TYPE;
-								strncpy(feature_text, "facial hair", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "hair", strlen(value)) == 0) {
-								feature = RANDOMIZE_HAIR_TYPE;
-								strncpy(feature_text, "hair", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "wing", strlen(value)) == 0) {
-								feature = RANDOMIZE_WING_TYPE;
-								strncpy(feature_text, "wings", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "cheek", strlen(value)) == 0) {
-								feature = RANDOMIZE_CHEEK_TYPE;
-								strncpy(feature_text, "cheeks", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "chin", strlen(value)) == 0) {
-								feature = RANDOMIZE_CHIN_TYPE;
-								strncpy(feature_text, "chin", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "ear", strlen(value)) == 0) {
-								feature = RANDOMIZE_EAR_TYPE;
-								strncpy(feature_text, "ears", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "eye_brow", strlen(value)) == 0) {
-								feature = RANDOMIZE_EYE_BROW_TYPE;
-								strncpy(feature_text, "eye brows", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "eye", strlen(value)) == 0) {
-								feature = RANDOMIZE_EYE_TYPE;
-								strncpy(feature_text, "eyes", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "lip", strlen(value)) == 0) {
-								feature = RANDOMIZE_LIP_TYPE;
-								strncpy(feature_text, "lips", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "nose", strlen(value)) == 0) {
-								feature = RANDOMIZE_NOSE_TYPE;
-								strncpy(feature_text, "nose", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "eye_color", strlen(value)) == 0) {
-								feature = RANDOMIZE_EYE_COLOR;
-								strncpy(feature_text, "eye color", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "hair_color", strlen(value)) == 0) {
-								feature = RANDOMIZE_HAIR_TYPE_COLOR;
-								strncpy(feature_text, "hair color", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "hair_color1", strlen(value)) == 0) {
-								feature = RANDOMIZE_HAIR_COLOR1;
-								strncpy(feature_text, "hair color1", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "hair_color2", strlen(value)) == 0) {
-								feature = RANDOMIZE_HAIR_COLOR2;
-								strncpy(feature_text, "hair color2", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "hair_highlight", strlen(value)) == 0) {
-								feature = RANDOMIZE_HAIR_HIGHLIGHT;
-								strncpy(feature_text, "hair highlights", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "facial_hair_color", strlen(value)) == 0) {
-								feature = RANDOMIZE_HAIR_FACE_COLOR;
-								strncpy(feature_text, "facial hair color", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "facial_hair_color_highlight", strlen(value)) == 0) {
-								feature = RANDOMIZE_HAIR_FACE_HIGHLIGHT_COLOR;
-								strncpy(feature_text, "facial hair color highlights", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "hair_color_highlight", strlen(value)) == 0) {
-								feature = RANDOMIZE_HAIR_TYPE_HIGHLIGHT_COLOR;
-								strncpy(feature_text, "hair color highlights", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "skin_color", strlen(value)) == 0) {
-								feature = RANDOMIZE_SKIN_COLOR;
-								strncpy(feature_text, "skin color", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "wing_color1", strlen(value)) == 0) {
-								feature = RANDOMIZE_WING_COLOR1;
-								strncpy(feature_text, "wing color1", sizeof(feature_text) - 1);
-							}
-							else if (strncasecmp(value, "wing_color2", strlen(value)) == 0) {
-								feature = RANDOMIZE_WING_COLOR2;
-								strncpy(feature_text, "wing color2", sizeof(feature_text) - 1);
-							}
-							else {
-								client->Message(CHANNEL_COLOR_YELLOW, "'%s' is not a valid feature to randomize.", value);
-								client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Valid features are: 'gender', 'race', 'model', 'hair', 'facial_hair', 'legs', 'wings', 'cheek', 'chin', 'ear', 'eye', 'eye_brow', 'lip', 'nose', 'eye_color', 'hair_color1', 'hair_color2', 'hair_highlight', 'facial_hair_color', 'facial_hair_color_highlight', 'hair_color', 'hair_color_highlight', 'skin_color', 'wing_color1', 'wing_color2'.");
-							}
-
-							if (feature > 0) {
-								if (option == 1) {
-									if (target->GetRandomize() & feature)
-										client->Message(CHANNEL_COLOR_YELLOW, "'%s' is already set to randomly generate their %s.", target->GetName(), feature_text);
-									else {
-										target->AddRandomize(feature);
-										((NPC*)client->GetCurrentZone()->GetSpawn(target->GetDatabaseID()))->AddRandomize(feature);
-										database.UpdateRandomize(target->GetDatabaseID(), feature);
-										client->Message(CHANNEL_COLOR_YELLOW, "'%s' will now generate their %s randomly.", target->GetName(), feature_text);
-									}
-								}
-								else {
-									if (target->GetRandomize() & feature) {
-										target->AddRandomize(-feature);
-										((NPC*)client->GetCurrentZone()->GetSpawn(target->GetDatabaseID()))->AddRandomize(-feature);
-										database.UpdateRandomize(target->GetDatabaseID(), -feature);
-										client->Message(CHANNEL_COLOR_YELLOW, "'%s' will no longer generate their %s randomly.", target->GetName(), feature_text);
-									}
-									else
-										client->Message(CHANNEL_COLOR_YELLOW, "'%s' already does not randomly generate their %s.", target->GetName(), feature_text);
-								}
-							}
-						}
-						else
-							client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You must specify either a 1(on) or 0(off) as the second parameter.");
-					}
-					else
-						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You must specify either a 1(on) or 0(off) as the second parameter.");
-				}
-			}
-			else {
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /randomize [show | [feature [1|0]]");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "'show' will display current configured features");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Valid features are: 'gender', 'race', 'model', 'hair', 'facial_hair', 'legs', 'wings', 'cheek', 'chin', 'ear', 'eye', 'eye_brow', 'lip', 'nose', 'eye_color', 'hair_color1', 'hair_color2', 'hair_highlight', 'facial_hair_color', 'facial_hair_color_highlight', 'hair_color', 'hair_color_highlight', 'skin_color', 'wing_color1', 'wing_color2'.");
-			}
-		}
-		else
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "The target you wish to randomize must be an NPC.");
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You must select the target you wish to randomize.");
-}
-
-/* 
-	Function: Command_ShowCloak()
-	Purpose	: Character Settings combo box for Show Cloak
-	Params	: true/false
-	Dev		: John Adams
-	Example	: 
-*/ 
-void Commands::Command_ShowCloak(Client* client, Seperator* sep)
-{
-	Player* player = client->GetPlayer();
-
-	if (sep && sep->arg[0])
-	{
-		const char* value = sep->arg[0];
-		if (strncasecmp(value, "true", strlen(value)) == 0) 
-		{
-			player->set_character_flag(CF_SHOW_CLOAK);
-			player->reset_character_flag(CF2_SHOW_RANGED);
-		}
-		else if (strncasecmp(value, "false", strlen(value)) == 0) 
-			player->reset_character_flag(CF_SHOW_CLOAK);
-		else
-		{
-			client->Message(CHANNEL_COLOR_YELLOW, "Not supposed to be here! Please /bug this: Error in %s (%u)", __FUNCTION__, __LINE__);
-			LogWrite(COMMAND__WARNING, 0, "Command", "Not supposed to be here! Please /bug this: Error in %s (%u)", __FUNCTION__, __LINE__);
-		}
-	}
-}
-
-/* 
-	Function: Command_ShowHelm()
-	Purpose	: Character Settings combo box for Show Helm
-	Params	: true/false
-	Dev		: John Adams
-	Example	: 
-*/ 
-void Commands::Command_ShowHelm(Client* client, Seperator* sep)
-{
-	Player* player = client->GetPlayer();
-
-	if (sep && sep->arg[0])
-	{
-		const char* value = sep->arg[0];
-		if (strncasecmp(value, "true", strlen(value)) == 0) 
-		{
-			player->reset_character_flag(CF_HIDE_HELM);
-			player->set_character_flag(CF_HIDE_HOOD);
-		}
-		else if (strncasecmp(value, "false", strlen(value)) == 0) 
-			player->set_character_flag(CF_HIDE_HELM);
-		else
-		{
-			client->Message(CHANNEL_COLOR_YELLOW, "Not supposed to be here! Please /bug this: Error in %s (%u)", __FUNCTION__, __LINE__);
-			LogWrite(COMMAND__WARNING, 0, "Command", "Not supposed to be here! Please /bug this: Error in %s (%u)", __FUNCTION__, __LINE__);
-		}
-	}
-}
-
-/* 
-	Function: Command_ShowHood()
-	Purpose	: Character Settings combo box for Show Hood
-	Params	: true/false
-	Dev		: John Adams
-	Example	: 
-*/ 
-void Commands::Command_ShowHood(Client* client, Seperator* sep)
-{
-	Player* player = client->GetPlayer();
-
-	if (sep && sep->arg[0])
-	{
-		const char* value = sep->arg[0];
-
-		if (strncasecmp(value, "true", strlen(value)) == 0) 
-		{
-			player->reset_character_flag(CF_HIDE_HOOD);
-			player->set_character_flag(CF_HIDE_HELM);
-		}
-		else if (strncasecmp(value, "false", strlen(value)) == 0) 
-			player->set_character_flag(CF_HIDE_HOOD);
-		else
-		{
-			client->Message(CHANNEL_COLOR_YELLOW, "Not supposed to be here! Please /bug this: Error in %s (%u)", __FUNCTION__, __LINE__);
-			LogWrite(COMMAND__WARNING, 0, "Command", "Not supposed to be here! Please /bug this: Error in %s (%u)", __FUNCTION__, __LINE__);
-		}
-	}
-}
-
-/* 
-	Function: Command_ShowHoodHelm()
-	Purpose	: Character Settings combo box for Show Helm or Hood
-	Params	: true/false
-	Dev		: John Adams
-	Example	: 
-*/ 
-void Commands::Command_ShowHoodHelm(Client* client, Seperator* sep)
-{
-	Player* player = client->GetPlayer();
-
-	if (sep && sep->arg[0])
-	{
-		const char* value = sep->arg[0];
-		if (strncasecmp(value, "true", strlen(value)) == 0) 
-		{
-			player->reset_character_flag(CF_HIDE_HOOD);
-			player->reset_character_flag(CF_HIDE_HELM);
-		}
-		else if (strncasecmp(value, "false", strlen(value)) == 0) 
-		{
-			// don't think we ever wind up in here...
-			player->set_character_flag(CF_HIDE_HOOD);
-			player->set_character_flag(CF_HIDE_HELM);
-		}
-		else
-		{
-			client->Message(CHANNEL_COLOR_YELLOW, "Not supposed to be here! Please /bug this: Error in %s (%u)", __FUNCTION__, __LINE__);
-			LogWrite(COMMAND__WARNING, 0, "Command", "Not supposed to be here! Please /bug this: Error in %s (%u)", __FUNCTION__, __LINE__);
-		}
-	}
-}
-
-/* 
-	Function: Command_ShowRanged()
-	Purpose	: Character Settings combo box for Show Ranged weapon
-	Params	: true/false
-	Dev		: John Adams
-	Example	: 
-*/ 
-void Commands::Command_ShowRanged(Client* client, Seperator* sep)
-{
-	Player* player = client->GetPlayer();
-
-	if (sep && sep->arg[0])
-	{
-		const char* value = sep->arg[0];
-		if (strncasecmp(value, "true", strlen(value)) == 0) 
-		{
-			player->set_character_flag(CF2_SHOW_RANGED);
-			player->reset_character_flag(CF_SHOW_CLOAK);
-		}
-		else if (strncasecmp(value, "false", strlen(value)) == 0) 
-			player->reset_character_flag(CF2_SHOW_RANGED);
-		else
-		{
-			client->Message(CHANNEL_COLOR_YELLOW, "Not supposed to be here! Please /bug this: Error in %s (%u)", __FUNCTION__, __LINE__);
-			LogWrite(COMMAND__WARNING, 0, "Command", "Not supposed to be here! Please /bug this: Error in %s (%u)", __FUNCTION__, __LINE__);
-		}
-	}
-}
-
-/* 
-	Function: 
-	Purpose	: 
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_Skills(Client* client, Seperator* sep, int handler)
-{
-	Player* player = 0;
-	Client* to_client = 0;
-
-	if(client->GetPlayer()->GetTarget() && client->GetPlayer()->GetTarget()->IsPlayer())
-		to_client = client->GetPlayer()->GetTarget()->GetZone()->GetClientBySpawn(client->GetPlayer()->GetTarget());
-
-	switch(handler)
-	{
-		case COMMAND_SKILL:
-			{
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /skill [add|remove|list] [skill name]");
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Target player to add/remove skills for that player.");
-				break;
-			}
-		case COMMAND_SKILL_ADD:
-			{
-				if (sep && sep->arg[0]) 
-				{
-					const char* skill_name = sep->argplus[0];
-					Skill* skill = master_skill_list.GetSkillByName(skill_name);
-
-					if (skill && to_client && !(client->GetPlayer() == to_client->GetPlayer())) // add skill to your target, if target is not you
-					{
-						player = to_client->GetPlayer();
-
-						if (player) 
-						{
-							if (!player->GetSkills()->HasSkill(skill->skill_id)) 
-							{
-								player->AddSkill(skill->skill_id, 1, player->GetLevel() * 5, true);
-								client->Message(CHANNEL_COLOR_YELLOW, "You gave skill '%s' to player '%s'.", skill_name, player->GetName());
-								to_client->Message(CHANNEL_COLOR_YELLOW, "%s gave you skill '%s'.", client->GetPlayer()->GetName(), skill_name);
-							}
-							else
-								client->Message(CHANNEL_COLOR_YELLOW, "%s already has the skill '%s'.", player->GetName(), skill_name);
-						}
-					}
-					else if (skill) // add skill to yourself
-					{
-						player = client->GetPlayer();
-
-						if (player) 
-						{
-							if (!player->GetSkills()->HasSkill(skill->skill_id)) 
-							{
-								player->AddSkill(skill->skill_id, 1, player->GetLevel() * 5, true);
-								client->Message(CHANNEL_COLOR_YELLOW, "Added skill '%s'.", skill_name);
-							}
-							else
-								client->Message(CHANNEL_COLOR_YELLOW, "You already have the skill '%s'.", skill_name);
-						}
-					}
-					else
-						client->Message(CHANNEL_COLOR_YELLOW, "The skill '%s' does not exist.", skill_name);
-				}
-				else
-				{
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /skill add [skill name]");
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Target player to give skill to that player.");
-				}
-				break;
-			}
-		case COMMAND_SKILL_REMOVE:
-			{
-				if (sep && sep->arg[0]) 
-				{
-					const char* skill_name = sep->argplus[0];
-					Skill* skill = master_skill_list.GetSkillByName(skill_name);
-
-					if (skill && to_client && !(client->GetPlayer() == to_client->GetPlayer())) // remove skill from your target, if target is not you
-					{
-						player = to_client->GetPlayer();
-
-						if (player)
-						{
-							if (player->GetSkills()->HasSkill(skill->skill_id)) 
-							{
-								player->RemoveSkillFromDB(skill, true);
-								client->Message(CHANNEL_COLOR_YELLOW, "Removed skill '%s' from player %s.", skill_name, player->GetName());
-								to_client->Message(CHANNEL_COLOR_YELLOW, "%s has removed skill '%s' from you.", client->GetPlayer()->GetName(), skill_name);
-							}
-							else
-								client->Message(CHANNEL_COLOR_YELLOW, "Player '%s' does not have the skill '%s'.", player->GetName(), skill_name);
-						}
-					}
-					else if(skill) // remove skill from yourself
-					{
-						Player* player = client->GetPlayer();
-
-						if (player) 
-						{
-							if (player->GetSkills()->HasSkill(skill->skill_id)) 
-							{
-								player->RemoveSkillFromDB(skill, true);
-								client->Message(CHANNEL_COLOR_YELLOW, "Removed skill '%s'.", skill_name);
-							}
-							else
-								client->Message(CHANNEL_COLOR_YELLOW, "You do not have the skill '%s'.", skill_name);
-						}
-					}
-					else
-						client->Message(CHANNEL_COLOR_YELLOW, "The skill '%s' does not exist.", skill_name);
-				}
-				else
-				{
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /skill remove [skill name]");
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Target player to give skill to that player.");
-				}
-				break;
-			}
-		case COMMAND_SKILL_LIST:
-			{
-				if (sep && sep->arg[0]) 
-				{
-					const char* skill_name = sep->argplus[0];
-					client->Message(CHANNEL_COLOR_YELLOW, "Listing skills like '%s':", skill_name);
-					map<int32, Skill*>* skills = master_skill_list.GetAllSkills();
-					map<int32, Skill*>::iterator itr;
-
-					if (skills && skills->size() > 0) 
-					{
-						for (itr = skills->begin(); itr != skills->end(); itr++) 
-						{
-							Skill* skill = itr->second;
-							string current_skill_name = ::ToLower(string(skill->name.data.c_str()));
-
-							if (current_skill_name.find(::ToLower(string(skill_name))) < 0xFFFFFFFF)
-								client->Message(CHANNEL_COLOR_YELLOW, "%s (%u)", skill->name.data.c_str(), skill->skill_id);
-						}
-					}
-				}
-				else
-					client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /skill list [skill name]");
-				break;
-			}
-	}
-}
-
-/* 
-	Function: Command_SpawnTemplate()
-	Purpose	: Create or Use defined Spawn Templates
-	Params	: create, save, rempve, list
-	Dev		: John Adams
-	Example	: /spawn template create "Test"
-*/ 
-void Commands::Command_SpawnTemplate(Client* client, Seperator* sep)
-{
-	if (sep == NULL || sep->arg[0] == NULL) 
-	{
-		client->Message(CHANNEL_COLOR_YELLOW, "Examples:\n/spawn template save Test - saves a template of the targetted spawn as the name Test\n/spawn template list - shows a list of current templates\n/spawn template spawn [id|name] creates a new spawn based on template [id|name] at your current location.");
-		return;
-	} 
-
-	// got params, continue
-	const char * template_cmd = sep->arg[0];
-
-	if (strncasecmp(template_cmd, "list", strlen(template_cmd)) == 0) 
-	{
-		if (!sep->IsSet(1))
-		{
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Usage: /spawn template list [name|location_id]");
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW,"Examples:\n/spawn template list [name] - will show all templates containing [name].\n/spawn template list [location_id] - will show all templates that [location_id] is assigned to.");
-			return;
-		}
-
-		map<int32, string>* template_names = 0;
-		if (sep->IsNumber(1))
-		{
-			int32 location_id = 0;
-			location_id = atoi(sep->arg[1]);
-			template_names = database.GetSpawnTemplateListByID(location_id);
-		}
-		else
-		{
-			const char* name = 0;
-			name = sep->argplus[1];
-			template_names = database.GetSpawnTemplateListByName(name);
-		}
-
-		if(!template_names)
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "No templates found.");
-		else
-		{
-			map<int32, string>::iterator itr;
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW," ID   Name: ");
-			for(itr = template_names->begin(); itr != template_names->end(); itr++)
-				client->Message(CHANNEL_COLOR_YELLOW,"%03lu %s", itr->first, itr->second.c_str());
-			safe_delete(template_names);
-		}
-	}
-
-	else if (strncasecmp(template_cmd, "save", strlen(template_cmd)) == 0) 
-	{
-		NPC* target = (NPC*)client->GetPlayer()->GetTarget();
-		if ( target && (target->IsNPC() || target->IsObject() || target->IsSign() || target->IsWidget() || target->IsGroundSpawn()) ) 
-		{
-			if (sep && sep->arg[1][0] && !sep->IsNumber(1))
-			{
-				// first, lookup to see if template name already exists
-				const char* name = 0;
-				name = sep->argplus[1];
-				map<int32, string>* template_names = database.GetSpawnTemplateListByName(name);
-				if(!template_names)
-				{
-					int32 new_template_id = database.SaveSpawnTemplate(target->GetSpawnLocationID(), name);
-					if( new_template_id > 0 )
-						client->Message(CHANNEL_COLOR_YELLOW, "Spawn template '%s' added for spawn '%s' (%u) as TemplateID: %u", name, target->GetName(), target->GetSpawnLocationID(), new_template_id);
-					else
-						client->Message(CHANNEL_COLOR_RED, "ERROR: Failed to add new template '%s' for spawn '%s' (%u).", name, target->GetName(), target->GetSpawnLocationID());
-				}
-				else
-					client->Message(CHANNEL_COLOR_RED, "ERROR: Failed to add new template '%s' - Already exists!", name);
-			}
-			else
-				client->Message(CHANNEL_COLOR_RED, "ERROR: Saving a new spawn template requires a valid template name!");
-		}
-		else
-			client->Message(CHANNEL_COLOR_RED, "ERROR: You must target the spawn you wish to save as a template!");
-	}
-
-	else if (strncasecmp(template_cmd, "remove", strlen(template_cmd)) == 0) 
-	{
-		if (sep && sep->arg[1][0] && sep->IsNumber(1))
-		{
-			int32 template_id = 0;
-			template_id = atoi(sep->arg[1]);
-			if (database.RemoveSpawnTemplate(template_id))
-				client->Message(CHANNEL_COLOR_YELLOW, "Spawn template ID: %u successfully removed.", template_id);
-			else
-				client->Message(CHANNEL_COLOR_RED, "ERROR: Failed to remove spawn template ID: %u", template_id);
-		}
-		else
-			client->Message(CHANNEL_COLOR_RED, "ERROR: Removing a spawn template requires a valid template ID!");
-	}
-
-	// Renamed create to spawn
-	else if (strncasecmp(template_cmd, "spawn", strlen(template_cmd)) == 0) 
-	{
-		if (sep && sep->arg[1][0]) 
-		{
-			int32 new_location = 0;
-
-			if (sep->IsNumber(1))
-			{
-				int32 template_id = 0;
-				template_id = atoi(sep->arg[1]);
-
-				new_location = database.CreateSpawnFromTemplateByID(client, template_id);
-				if( new_location > 0 )
-					client->Message(CHANNEL_COLOR_YELLOW, "New spawn location %u created from template ID: %u", new_location, template_id);
-				else
-					client->Message(CHANNEL_COLOR_RED, "ERROR: Failed to spawn the new spawn location from template ID: %u", template_id);
-			}
-			else
-			{
-				const char* name = 0;
-				name = sep->argplus[1];
-
-				new_location = database.CreateSpawnFromTemplateByName(client, name);
-				if( new_location > 0 )
-					client->Message(CHANNEL_COLOR_YELLOW, "New spawn location %u created from template: '%s'", new_location, name);
-				else
-					client->Message(CHANNEL_COLOR_RED, "ERROR: Failed to spawn the new spawn location from template: '%s'", name);
-			}
-		}
-		else
-			client->Message(CHANNEL_COLOR_RED, "ERROR: Spawning a new spawn location requires a valid template name or ID!");
-	}
-
-	else
-		client->Message(CHANNEL_COLOR_RED, "ERROR: Unknown /spawn template command.");
-}
-
-void Commands::Command_Speed(Client* client, Seperator* sep) {
-	if(sep && sep->arg[0][0] && sep->IsNumber(0)){
-		float new_speed = atof(sep->arg[0]);
-		if (new_speed > 0.0f)
-		{
-			client->GetPlayer()->SetSpeed(new_speed, true);
-			client->GetPlayer()->SetCharSheetChanged(true);
-			database.insertCharacterProperty(client, CHAR_PROPERTY_SPEED, sep->arg[0]);
-			client->Message(CHANNEL_STATUS, "Setting speed to %.2f.", new_speed);
-		}
-		else
-			client->Message(CHANNEL_STATUS, "Invalid speed provided %s.", sep->arg[0]);
-	}
-	else{
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /speed {new speed value}");
-	}
-
-}
-
-/* 
-	Function: Command_StationMarketPlace()
-	Purpose	: just trying to eat the console spam for now
-	Params	: 
-	Dev		: John
-*/ 
-void Commands::Command_StationMarketPlace(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_SMP");
-	// This will reduce the spam from once every 10 sec to once every 30 sec,
-	// can't seem to reduce it any more get rid of it completely...
-	if (sep && strcmp(sep->arg[0], "gkw") == 0) {
-		PacketStruct* packet = configReader.getStruct("WS_MarketFundsUpdate", client->GetVersion());
-		if (packet) {
-			packet->setDataByName("account_id", client->GetAccountID());
-			packet->setDataByName("character_id", client->GetCharacterID());
-			packet->setDataByName("unknown1", 1, 5);
-			packet->setDataByName("unknown1", 26, 6);
-			packet->setDataByName("unknown2", 0xFFFFFFFF);
-			packet->setDataByName("unknown3", 248, 1);
-			client->QueuePacket(packet->serialize());
-		}
-		safe_delete(packet);
-	}
-}
-
-/* 
-	Function: Command_StopDrinking()
-	Purpose	: Stops player from auto-consuming drink
-	Params	: 
-	Dev		: Zcoretri
-	Example	: /stopdrinking
-*/ 
-void Commands::Command_StopDrinking(Client* client)
-{
-	client->GetPlayer()->reset_character_flag(CF_DRINK_AUTO_CONSUME);
-	client->Message(CHANNEL_COLOR_YELLOW,"You stop drinking your current drink.");
-}
-
-/* 
-	Function: Command_StopEating()
-	Purpose	: Stops player from auto-consuming food
-	Params	: 
-	Dev		: Zcoretri
-	Example	: /stopeating
-*/ 
-void Commands::Command_StopEating(Client* client)
-{
-	client->GetPlayer()->reset_character_flag(CF_FOOD_AUTO_CONSUME);
-	client->Message(CHANNEL_COLOR_YELLOW,"You stop eating your current food.");
-}
-
-/* 
-	Function: Command_Title()
-	Purpose	: Help for /title command
-	Params	: n/a
-	Dev		: Zcoretri
-	Example	: /title
-*/ 
-void Commands::Command_Title(Client* client)
-{
-	client->Message(CHANNEL_COLOR_YELLOW, "Available subcommands: list, setprefix <index>, setsuffix <index>, fix");
-}
-
-/* 
-	Function: Command_TitleList()
-	Purpose	: List available titles for player
-	Params	: n/a
-	Dev		: Zcoretri
-	Example	: /title list
-*/ 
-void Commands::Command_TitleList(Client* client)
-{
-	// must call release read lock before leaving function on GetPlayerTitles
-	vector<Title*>* titles = client->GetPlayer()->GetPlayerTitles()->GetAllTitles();
-	vector<Title*>::iterator itr;
-	Title* title;
-	sint32 i = 0;
-
-	client->Message(CHANNEL_NARRATIVE, "Listing available titles:");
-	for(itr = titles->begin(); itr != titles->end(); itr++)
-	{
-		title = *itr;
-		client->Message(CHANNEL_NARRATIVE, "%i: type=[%s] title=[%s]", i, title->GetPrefix() ? "Prefix":"Suffix", title->GetName());
-		i++;
-	}
-
-	client->GetPlayer()->GetPlayerTitles()->ReleaseReadLock();
-}
-
-/* 
-	Function: Command_TitleSetPrefix()
-	Purpose	: Set Prefix title for player
-	Params	: Title ID
-	Dev		: Zcoretri
-	Example	: /title setprefix 1
-*/ 
-void Commands::Command_TitleSetPrefix(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && sep->IsNumber(0))
-	{
-		sint32 index = atoul(sep->arg[0]);
-
-		if(index > -1)
-		{
-			Title* title = client->GetPlayer()->GetPlayerTitles()->GetTitle(index);
-			if(!title)
-			{
-				client->Message(CHANNEL_COLOR_RED, "Missing index %i to set title", index);
-				return;
-			}
-			else if(!title->GetPrefix())
-			{
-				client->Message(CHANNEL_COLOR_RED, "%s is not a prefix.", title->GetName());
-				return;
-			}
-		}
-		else // make sure client doesn't pass some bogus negative index
-			index = -1;
-
-		database.SaveCharPrefixIndex(index, client->GetCharacterID());
-		client->SendTitleUpdate();
-	}
-}
-
-/* 
-	Function: Command_TitleSetSuffix()
-	Purpose	: Set Suffix title for player
-	Params	: Title ID
-	Dev		: Zcoretri
-	Example	: /title setsuffix 1
-*/ 
-void Commands::Command_TitleSetSuffix(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && sep->IsNumber(0))
-	{
-		sint32 index = atoul(sep->arg[0]);
-		if(index > -1)
-		{
-			Title* title = client->GetPlayer()->GetPlayerTitles()->GetTitle(index);
-			if(!title)
-			{
-				client->Message(CHANNEL_COLOR_RED, "Missing index %i to set title", index);
-				return;
-			}
-			else if(title->GetPrefix())
-			{
-				client->Message(CHANNEL_COLOR_RED, "%s is not a suffix.", title->GetName());
-				return;
-			}
-		}
-		else // make sure client doesn't pass some bogus negative index
-			index = -1;
-
-		database.SaveCharSuffixIndex(index, client->GetCharacterID());
-		client->SendTitleUpdate();
-	}
-}
-
-/* 
-	Function: Command_TitleFix()
-	Purpose	: Fix title for player (???)
-	Params	: 
-	Dev		: Zcoretri
-	Example	: 
-*/ 
-void Commands::Command_TitleFix(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_TITLE_FIX");
-	LogWrite(MISC__TODO, 1, "Titles", "TODO-Command: TITLE_FIX");
-}
-
-
-/* 
-	Function: Command_Toggle_Anonymous()
-	Purpose	: Toggles player Anonymous
-	Params	: 
-	Dev		: paulgh
-	Example	: /anon
-*/ 
-void Commands::Command_Toggle_Anonymous(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_ANONYMOUS);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s anonymous.", player->get_character_flag(CF_ANONYMOUS)?"now":"no longer");
-
-	if (player->get_character_flag(CF_ANONYMOUS))
-		player->SetActivityStatus(player->GetActivityStatus() + ACTIVITY_STATUS_ANONYMOUS);
-	else
-		player->SetActivityStatus(player->GetActivityStatus() - ACTIVITY_STATUS_ANONYMOUS);
-}
-
-/* 
-	Function: Command_Toggle_AutoConsume()
-	Purpose	: Toggles player food/drink auto consume
-	Params	: unknown
-	Dev		: paulgh
-	Example	: /set_auto_consume
-*/ 
-void Commands::Command_Toggle_AutoConsume(Client* client, Seperator* sep)
-{
-	Player* player = client->GetPlayer();
-
-	if (sep && sep->arg[0])
-		PrintSep(sep, "COMMAND_SET_AUTO_CONSUME");
-	if (sep && sep->arg[0] && sep->IsNumber(0))
-	{
-		int8 slot = atoi(sep->arg[0]);
-		int8 flag = atoi(sep->arg[1]);
-		if (client->GetVersion() <= 283) {
-			slot += 4;
-		}
-		else if (client->GetVersion() <= 546) {
-			slot += 2;
-		}
-		if (slot == EQ2_FOOD_SLOT)
-		{
-			player->toggle_character_flag(CF_FOOD_AUTO_CONSUME);
-			player->SetCharSheetChanged(true);
-			client->QueuePacket(player->GetEquipmentList()->serialize(client->GetVersion(), player));
-			if (flag == 1)
-				client->Message(CHANNEL_NARRATIVE, "You decide to eat immediately whenever you become hungry.");
-			else
-			{
-				client->Message(CHANNEL_NARRATIVE, "You decide to ignore the hunger.");
-				return;
-			}
-		}
-		else
-		{
-			player->toggle_character_flag(CF_DRINK_AUTO_CONSUME);
-			player->SetCharSheetChanged(true);
-			client->QueuePacket(player->GetEquipmentList()->serialize(client->GetVersion(), player));
-			if (flag == 1)
-				client->Message(CHANNEL_NARRATIVE, "You decide to drink immediately whenever you become thirsty.");
-			else
-			{
-				client->Message(CHANNEL_NARRATIVE, "You decide to ignore the thirst.");
-				return;
-			}
-		}
-
-
-		if(slot == 22 && player->GetSpellEffectBySpellType(SPELL_TYPE_FOOD))
-			return;
-		else if (player->GetSpellEffectBySpellType(SPELL_TYPE_DRINK))
-			return;
-		Item* item = player->GetEquipmentList()->GetItem(slot);
-		if(item)
-			client->ConsumeFoodDrink(item, slot);
-	}
-}
-
-/* 
-	Function: Command_Toggle_BonusXP()
-	Purpose	: Toggles player Bonus XP
-	Params	: 
-	Dev		: John Adams
-	Example	: /disable_char_bonus_exp
-*/ 
-void Commands::Command_Toggle_BonusXP(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF2_CHARACTER_BONUS_EXPERIENCE_ENABLED);
-	player->SetCharSheetChanged(true);
-}
-
-/* 
-	Function: Command_Toggle_CombatXP()
-	Purpose	: Toggles player Adventure XP
-	Params	: 
-	Dev		: John Adams
-	Example	: /disable_combat_exp
-*/ 
-void Commands::Command_Toggle_CombatXP(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_COMBAT_EXPERIENCE_ENABLED);
-	player->SetCharSheetChanged(true);
-}
-
-/* 
-	Function: Command_Toggle_GMHide()
-	Purpose	: Toggles hiding player GM status
-	Params	: 
-	Dev		: Scatman
-	Example	: /gm_hide
-*/ 
-void Commands::Command_Toggle_GMHide(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_HIDE_STATUS);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s hiding your GM status.", player->get_character_flag(CF_HIDE_STATUS)?"now":"no longer");
-}
-
-/* 
-	Function: Command_Toggle_GMVanish()
-	Purpose	: Toggles hiding GM players from /who searches
-	Params	: 
-	Dev		: Scatman
-	Example	: /gm_vanish
-*/ 
-void Commands::Command_Toggle_GMVanish(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_GM_HIDDEN);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s invisible to who queries.", player->get_character_flag(CF_GM_HIDDEN)?"now":"no longer");
-}
-
-/* 
-	Function: Command_Toggle_Illusions()
-	Purpose	: Toggles player illusion form
-	Params	: not sure sep is needed, testing
-	Dev		: paulgh
-	Example	: /hide_illusions
-*/ 
-void Commands::Command_Toggle_Illusions(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0])
-		PrintSep(sep, "COMMAND_TOGGLE_ILLUSIONS");
-	client->GetPlayer()->toggle_character_flag(CF_SHOW_ILLUSION);
-}
-
-/* 
-	Function: Command_Toggle_LFG()
-	Purpose	: Toggles player LFG Flag
-	Params	: 
-	Dev		: paulgh
-	Example	: /lfg
-*/ 
-void Commands::Command_Toggle_LFG(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_LFG);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s LFG.", player->get_character_flag(CF_LFG)?"now":"no longer");
-
-	if (player->get_character_flag(CF_LFG))
-		player->SetActivityStatus(player->GetActivityStatus() + ACTIVITY_STATUS_LFG);
-	else
-		player->SetActivityStatus(player->GetActivityStatus() - ACTIVITY_STATUS_LFG);
-}
-
-/* 
-	Function: Command_Toggle_LFW()
-	Purpose	: Toggles player LFW Flag
-	Params	: 
-	Dev		: paulgh
-	Example	: /lfw
-*/ 
-void Commands::Command_Toggle_LFW(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_LFW);
-	client->Message(CHANNEL_COLOR_YELLOW,"You %s looking for work.", player->get_character_flag(CF_LFW)?"let others know you are":"stop");
-
-	if (player->get_character_flag(CF_LFW))
-		player->SetActivityStatus(player->GetActivityStatus() + ACTIVITY_STATUS_LFW);
-	else
-		player->SetActivityStatus(player->GetActivityStatus() - ACTIVITY_STATUS_LFW);
-}
-
-/* 
-	Function: Command_Toggle_QuestXP()
-	Purpose	: Toggles player Quest XP
-	Params	: 
-	Dev		: John Adams
-	Example	: /disable_quest_exp
-*/ 
-void Commands::Command_Toggle_QuestXP(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_QUEST_EXPERIENCE_ENABLED);
-	player->SetCharSheetChanged(true);
-}
-
-/* 
-	Function: Command_Toggle_Roleplaying()
-	Purpose	: Toggles player Roleplaying flag
-	Params	: 
-	Dev		: paulgh
-	Example	: /role
-*/ 
-void Commands::Command_Toggle_Roleplaying(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_ROLEPLAYING);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s roleplaying.", player->get_character_flag(CF_ROLEPLAYING)?"now":"no longer");
-
-	if (player->get_character_flag(CF_ROLEPLAYING))
-		player->SetActivityStatus(player->GetActivityStatus() + ACTIVITY_STATUS_ROLEPLAYING);
-	else
-		player->SetActivityStatus(player->GetActivityStatus() - ACTIVITY_STATUS_ROLEPLAYING);
-}
-
-void Commands::Command_Toggle_Duels(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_ALLOW_DUEL_INVITES);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s accepting duel invites.", player->get_character_flag(CF_ALLOW_DUEL_INVITES)?"now":"no longer");
-}
-
-void Commands::Command_Toggle_Trades(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_ALLOW_TRADE_INVITES);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s accepting trade invites.", player->get_character_flag(CF_ALLOW_TRADE_INVITES)?"now":"no longer");
-}
-
-void Commands::Command_Toggle_Guilds(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_ALLOW_GUILD_INVITES);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s accepting guild invites.", player->get_character_flag(CF_ALLOW_GUILD_INVITES)?"now":"no longer");
-}
-
-void Commands::Command_Toggle_Groups(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_ALLOW_GROUP_INVITES);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s accepting group invites.", player->get_character_flag(CF_ALLOW_GROUP_INVITES)?"now":"no longer");
-}
-
-void Commands::Command_Toggle_Raids(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF_ALLOW_RAID_INVITES);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s accepting raid invites.", player->get_character_flag(CF_ALLOW_RAID_INVITES)?"now":"no longer");
-}
-
-void Commands::Command_Toggle_LON(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF2_ALLOW_LON_INVITES);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s accepting LoN invites.", player->get_character_flag(CF2_ALLOW_LON_INVITES)?"now":"no longer");
-}
-
-void Commands::Command_Toggle_VoiceChat(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	player->toggle_character_flag(CF2_ALLOW_VOICE_INVITES);
-	client->Message(CHANNEL_COLOR_YELLOW,"You are %s accepting voice chat invites.", player->get_character_flag(CF2_ALLOW_VOICE_INVITES)?"now":"no longer");
-}
-
-/* 
-	Function: Command_TradeStart()
-	Purpose	: Starts item/coin trade between players
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-#include "../Trade.h"
-void Commands::Command_TradeStart(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_START_TRADE");
-
-	Entity* trader = client->GetPlayer();
-	Entity* trader2 = 0;
-	if (sep && sep->IsSet(0) && sep->IsNumber(0)) {
-		Spawn* spawn = client->GetPlayer()->GetSpawnWithPlayerID(atoi(sep->arg[0]));
-		if (spawn) {
-			if (spawn->IsEntity())
-				trader2 = (Entity*)spawn;
-		}
-	}
-	else if (client->GetPlayer()->GetTarget()) {
-		if (client->GetPlayer()->GetTarget()->IsEntity())
-			trader2 = (Entity*)client->GetPlayer()->GetTarget();
-	}
-
-	// can only trade with player or bots
-	if (trader && trader2) {
-		if (trader == trader2) {
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You can't trade with yourself.");
-		}
-		else if (trader2->IsPlayer() || trader2->IsBot()) {
-			LogWrite(PLAYER__ERROR, 0, "Trade", "creating trade");
-			if (trader->trade)
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are already trading.");
-			else if (trader2->trade)
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Your target is already trading.");
-			else {
-				Trade* trade = new Trade(trader, trader2);
-				trader->trade = trade;
-				trader2->trade = trade;
-			}
-		}
-		else {
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You can only trade with another player or a bot.");
-		}
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Unable to find target");
-}
-
-/* 
-	Function: Command_Track()
-	Purpose	: Starts/Stops Tracking for a player
-	Params	: 
-	Dev		: Scatman
-	Example	: /track
-*/ 
-void Commands::Command_Track(Client* client)
-{
-	if (!client->GetPlayer()->GetIsTracking())
-		client->GetPlayer()->GetZone()->AddPlayerTracking(client->GetPlayer());
-	else
-		client->GetPlayer()->GetZone()->RemovePlayerTracking(client->GetPlayer(), TRACKING_STOP);
-}
-
-/* 
-	Function: Command_TradeAccept()
-	Purpose	: Accepts item/coin trade between players
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_TradeAccept(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_ACCEPT_TRADE");
-	Trade* trade = client->GetPlayer()->trade;
-	if (trade) {
-		bool trade_complete = trade->SetTradeAccepted(client->GetPlayer());
-		if (trade_complete)
-			safe_delete(trade);
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are not currently trading.");
-}
-
-/* 
-	Function: Command_TradeReject()
-	Purpose	: Rejects item/coin trade between players
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_TradeReject(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_REJECT_TRADE");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Reject Player Trading");
-	client->Message(CHANNEL_COLOR_YELLOW, "You cannot trade with other players (Not Implemented)");
-}
-
-/* 
-	Function: Command_TradeCancel()
-	Purpose	: Cancels item/coin trade between players
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_TradeCancel(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_CANCEL_TRADE");
-	Trade* trade = client->GetPlayer()->trade;
-	if (trade) {
-		trade->CancelTrade(client->GetPlayer());
-		safe_delete(trade);
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are not currently trading.");
-}
-
-/* 
-	Function: Command_TradeSetCoin()
-	Purpose	: Sets coin trade between players
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_TradeSetCoin(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_SET_TRADE_COIN");
-	LogWrite(MISC__TODO, 1, "Command", "TODO-Command: Set Trade Coin");
-	client->Message(CHANNEL_COLOR_YELLOW, "You cannot trade with other players (Not Implemented)");
-}
-
-/* 
-	Function: Command_TradeAddCoin()
-	Purpose	: Adds coin to trade between players
-	Params	: Passes "handler" through so we can process copper, silver, gold and plat in the same function
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_TradeAddCoin(Client* client, Seperator* sep, int handler)
-{
-	PrintSep(sep, "COMMAND_ADD_TRADE_{coin type}");
-	Trade* trade = client->GetPlayer()->trade;
-	if (trade) {
-		if (sep && sep->IsSet(0) && sep->IsNumber(0)) {
-			int32 amount = atoi(sep->arg[0]);
-			int64 val = 0;
-			switch (handler) {
-			case COMMAND_ADD_TRADE_COPPER:
-			{
-				val = amount;
-				trade->AddCoinToTrade(client->GetPlayer(), val);
-				break;
-			}
-
-			case COMMAND_ADD_TRADE_SILVER:
-			{
-				val = amount * 100;
-				trade->AddCoinToTrade(client->GetPlayer(), val);
-				break;
-			}
-
-			case COMMAND_ADD_TRADE_GOLD:
-			{
-				val = amount * 10000;
-				trade->AddCoinToTrade(client->GetPlayer(), val);
-				break;
-			}
-
-			case COMMAND_ADD_TRADE_PLAT:
-			{
-				val = amount * 1000000;
-				trade->AddCoinToTrade(client->GetPlayer(), val);
-				break;
-			}
-
-			default:
-			{
-				LogWrite(COMMAND__ERROR, 0, "Command", "No coin type specified in func: '%s', line %u", __FUNCTION__, __LINE__);
-				break;
-			}
-			}
-		}
-		else
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Invalid coin amount.");
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are not currently trading.");
-}
-
-/* 
-	Function: Command_TradeRemoveCoin()
-	Purpose	: Removes coin from trade between players
-	Params	: Passes "handler" through so we can process copper, silver, gold and plat in the same function
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_TradeRemoveCoin(Client* client, Seperator* sep, int handler)
-{
-	PrintSep(sep, "COMMAND_REMOVE_TRADE_{coin type}");
-
-	Trade* trade = client->GetPlayer()->trade;
-	if (trade) {
-		if (sep && sep->IsSet(0) && sep->IsNumber(0)) {
-			int32 amount = atoi(sep->arg[0]);
-			int64 val = 0;
-			switch (handler) {
-			case COMMAND_REMOVE_TRADE_COPPER:
-			{
-				val = amount;
-				trade->RemoveCoinFromTrade(client->GetPlayer(), val);
-				break;
-			}
-
-			case COMMAND_REMOVE_TRADE_SILVER:
-			{
-				val = amount * 100;
-				trade->RemoveCoinFromTrade(client->GetPlayer(), val);
-				break;
-			}
-
-			case COMMAND_REMOVE_TRADE_GOLD:
-			{
-				val = amount * 10000;
-				trade->RemoveCoinFromTrade(client->GetPlayer(), val);
-				break;
-			}
-
-			case COMMAND_REMOVE_TRADE_PLAT:
-			{
-				val = amount * 1000000;
-				trade->RemoveCoinFromTrade(client->GetPlayer(), val);
-				break;
-			}
-
-			default:
-			{
-				LogWrite(COMMAND__ERROR, 0, "Command", "No coin type specified in func: '%s', line %u", __FUNCTION__, __LINE__);
-				break;
-			}
-			}
-		}
-		else
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Invalid coin amount");
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are not currently trading.");
-}
-
-/* 
-	Function: Command_TradeAddItem()
-	Purpose	: Adds item to trade between players
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_TradeAddItem(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_ADD_TRADE_ITEM");
-	/*
-	arg[0] = item index
-	arg[1] = slot
-	arg[2] = quantity
-	*/
-	if (!client->GetPlayer()->trade) {
-		LogWrite(PLAYER__ERROR, 0, "Trade", "Player is not currently trading.");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are not currently trading.");
-		return;
-	}
-
-	if (sep && sep->IsSet(0) && sep->IsNumber(0) && sep->IsSet(1) && sep->IsNumber(1) && sep->IsSet(2) && sep->IsNumber(2)) {
-		Item* item = 0;
-		int32 index = atoi(sep->arg[0]);
-		item = client->GetPlayer()->GetPlayerItemList()->GetItemFromIndex(index);
-		if (item) {
-			int8 result = client->GetPlayer()->trade->AddItemToTrade(client->GetPlayer(), item, atoi(sep->arg[2]), atoi(sep->arg[1]));
-			if (result == 1)
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Item is already being traded.");
-			else if (result == 2)
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You can't trade NO-TRADE items.");
-			else if (result == 3)
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You can't trade HEIRLOOM items.");
-			else if (result == 255)
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Unknown error trying to add the item to the trade...");
-		}
-		else {
-			LogWrite(PLAYER__ERROR, 0, "Trade", "Unable to get an item for the player (%s) from the index (%u)", client->GetPlayer()->GetName(), index);
-			client->Message(CHANNEL_ERROR, "Unable to find item at index %u", index);
-		}
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Invalid item.");
-}
-
-/* 
-	Function: Command_TradeRemoveItem()
-	Purpose	: Removes item from trade between players
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_TradeRemoveItem(Client* client, Seperator* sep)
-{
-	PrintSep(sep, "COMMAND_REMOVE_TRADE_ITEM");
-	/*
-	arg[0] = trade window slot
-	*/
-
-	Trade* trade = client->GetPlayer()->trade;
-	if (trade) {
-		if (sep && sep->IsSet(0) && sep->IsNumber(0)) {
-			trade->RemoveItemFromTrade(client->GetPlayer(), atoi(sep->arg[0]));
-		}
-		else
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Invalid item.");
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are not currently trading.");
-}
-
-void Commands::Command_TryOn(Client* client, Seperator* sep)
-{
-	Item *item = 0;
-	sint32 crc;
-
-	if (sep) {
-		// 1096+ sends more info so need to do a version check so older clients (SF) still work
-		if (client->GetVersion() < 1096) {
-			if (sep->arg[1] && sep->IsNumber(1) && sep->arg[2] && sep->IsNumber(2)) 
-			{
-				item = master_item_list.GetItem(atoul(sep->arg[1]));
-				crc = atol(sep->arg[2]);
-			}
-		}
-		else {
-			// From the broker and links in chat
-			if (strcmp(sep->arg[0], "crc") == 0) {
-				if (sep->IsNumber(2) && sep->IsNumber(3)) {
-					item = master_item_list.GetItem(atoul(sep->arg[2]));
-					crc = atol(sep->arg[3]);
-				}
-			}
-			// From inventory
-			if (strcmp(sep->arg[0], "dbid") == 0) {
-				if (sep->IsNumber(2) && sep->IsNumber(4)) {
-					item = master_item_list.GetItem(atoul(sep->arg[2]));
-					crc = atol(sep->arg[4]);
-				}
-			}
-		}
-		if (item)
-			client->ShowDressingRoom(item, crc);
-	}
-}
-
-void Commands::Command_JoinChannel(Client * client, Seperator *sep) {
-	const char *channel_name, *password = NULL;
-
-	if (sep == NULL || !sep->IsSet(0)) {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /joinchannel <channel name> [password]");
-		return;
-	}
-
-	channel_name = sep->arg[0];
-	if (sep->IsSet(1))
-		password = sep->arg[1];
-
-	if (!chat.ChannelExists(channel_name) && !chat.CreateChannel(channel_name, password)) {
-		client->Message(CHANNEL_COLOR_RED, "Unable to create channel '%s'.", channel_name);
-		return;
-	}
-
-	if (chat.IsInChannel(client, channel_name)) {
-		client->Message(CHANNEL_NARRATIVE, "You are already in '%s'.", channel_name);
-		return;
-	}
-
-	if (chat.HasPassword(channel_name)) {
-		if (password == NULL) {
-			client->Message(CHANNEL_NARRATIVE, "Unable to join '%s': That channel is password protected.", channel_name);
-			return;
-		}
-		if (!chat.PasswordMatches(channel_name, password)) {
-			client->Message(CHANNEL_NARRATIVE, "Unable to join '%s': The password is not correc.t", channel_name);
-			return;
-		}
-	}
-	
-	if (!chat.JoinChannel(client, channel_name))
-		client->Message(CHANNEL_COLOR_RED, "There was an internal error preventing you from joining '%s'.", channel_name);
-}
-
-void Commands::Command_JoinChannelFromLoad(Client * client, Seperator *sep) {
-	printf("ScatDebug: Received 'joinfromchannel', using the same function as 'joinchannel' (not sure what the difference is)\n");
-	Command_JoinChannel(client, sep);
-}
-
-void Commands::Command_TellChannel(Client *client, Seperator *sep) {
-	if (sep == NULL || !sep->IsSet(0) || !sep->IsSet(1)) {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /tellchannel <channel name> <message>");
-		PrintSep(sep, "tellchannel");
-		return;
-	}
-
-	chat.TellChannel(client, sep->arg[0], sep->argplus[1]);
-}
-
-void Commands::Command_Test(Client* client, EQ2_16BitString* command_parms) {
-	Seperator* sep = new Seperator(command_parms->data.c_str(), ' ', 50, 500, true);
-	if (sep->IsSet(0)) {
-		if (atoi(sep->arg[0]) == 1) {
-			PacketStruct* packet2 = configReader.getStruct("WS_SpellGainedMsg", client->GetVersion());
-			if (packet2) {
-				packet2->setDataByName("spell_type", 2);
-				packet2->setDataByName("spell_id", 8308);
-				packet2->setDataByName("spell_name", "Sprint");
-				packet2->setDataByName("add_silently", 0);
-				packet2->setDataByName("tier", 1);
-				packet2->setDataByName("blah1", 1);
-				packet2->setDataByName("blah2", 1);
-				EQ2Packet* outapp = packet2->serialize();
-				DumpPacket(outapp);
-				client->QueuePacket(outapp);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 2) {
-			PacketStruct* packet2 = configReader.getStruct("WS_GuildUpdate", client->GetVersion());
-			if (packet2) {
-				packet2->setDataByName("guild_name", "Test");
-				packet2->setDataByName("guild_motd", "Test MOTD");
-				packet2->setDataByName("guild_id", 1234);
-				packet2->setDataByName("guild_level", 1);
-				packet2->setDataByName("unknown", 2);
-				packet2->setDataByName("unknown2", 3);
-				packet2->setDataByName("exp_current", 1);
-				packet2->setDataByName("exp_to_next_level", 4);
-				EQ2Packet* outapp = packet2->serialize();
-				DumpPacket(outapp);
-				client->QueuePacket(outapp);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 3) {
-			PacketStruct* packet2 = configReader.getStruct("WS_JoinGuildNotify", client->GetVersion());
-			if (packet2) {
-				packet2->setDataByName("guild_id", 1234);
-				packet2->setDataByName("character_id", 1);
-				packet2->setDataByName("account_id", 2);
-				packet2->setDataByName("guild_level", 1);
-				packet2->setDataByName("name", "Test");
-				packet2->setDataByName("unknown2", 0);
-				packet2->setDataByName("unknown3", 1);
-				packet2->setDataByName("adventure_class", 6);
-				packet2->setDataByName("adventure_level", 7);
-				packet2->setDataByName("tradeskill_class", 4);
-				packet2->setDataByName("tradeskill_level", 5);
-				packet2->setDataByName("rank", 0);
-				packet2->setDataByName("member_flags", 2);
-				packet2->setDataByName("join_date", 1591112273);
-				packet2->setDataByName("guild_status", 2);
-				packet2->setDataByName("last_login", 1591132273);
-				packet2->setDataByName("recruiter_id", 1);
-				packet2->setDataByName("points", 2345);
-				packet2->setDataByName("note", "note");
-				packet2->setMediumStringByName("officer_note", "O note");
-				packet2->setMediumStringByName("zone", "Blah");
-
-				EQ2Packet* outapp = packet2->serialize();
-				DumpPacket(outapp);
-				client->QueuePacket(outapp);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 5) {
-			int16 offset = atoi(sep->arg[1]);
-			int32 value1 = atol(sep->arg[2]);
-			EQ2Packet* outapp = client->GetPlayer()->GetPlayerInfo()->serialize(client->GetVersion(), offset, value1);
-			client->QueuePacket(outapp);
-		}
-		else if (atoi(sep->arg[0]) == 6) {
-			Spawn* spawn = client->GetPlayer()->GetTarget();
-			if (!spawn)
-				spawn = client->GetPlayer();
-			else if (spawn->IsEntity())
-				((Entity*)spawn)->SetSpeed(atof(sep->arg[4]));
-			spawn->RunToLocation(atof(sep->arg[1]), atof(sep->arg[2]), atof(sep->arg[3]));
-		}
-		else if (atoi(sep->arg[0]) == 7) {
-			int32 id = 0;
-			Spawn* spawn = client->GetCurrentZone()->GetSpawn(7720001);
-			if (spawn) {
-				spawn->SetX(client->GetPlayer()->GetX() + .5, false);
-				spawn->SetY(client->GetPlayer()->GetY(), false);
-				spawn->SetZ(client->GetPlayer()->GetZ() + .5, false);
-				float heading = client->GetPlayer()->GetHeading() + 180;
-				if (heading > 360)
-					heading -= 360;
-				spawn->SetLevel(5);
-				spawn->SetAdventureClass(4);
-				spawn->SetHeading(heading, false);
-				spawn->SetSpawnOrigX(spawn->GetX());
-				spawn->SetSpawnOrigY(spawn->GetY());
-				spawn->SetSpawnOrigZ(spawn->GetZ());
-				spawn->SetSpawnOrigHeading(spawn->GetHeading());
-				spawn->appearance.pos.grid_id = client->GetPlayer()->appearance.pos.grid_id;
-				spawn->appearance.targetable = 1;
-				if (spawn->IsNPC() && spawn->GetTotalHP() == 0) {
-					spawn->SetTotalHP(spawn->GetLevel() * 15);
-					spawn->SetHP(spawn->GetTotalHP());
-				}
-				if (spawn->GetTotalPower() == 0) {
-					spawn->SetTotalPower(spawn->GetLevel() * 15);
-					spawn->SetPower(spawn->GetTotalPower());
-				}
-				int16 offset = atoi(sep->arg[1]);
-				int32 value1 = atol(sep->arg[2]);
-				sprintf(spawn->appearance.name, "Offset %i", offset);
-				EQ2Packet* ret = spawn->spawn_serialize(client->GetPlayer(), client->GetVersion(), offset, value1);
-				DumpPacket(ret);
-				client->QueuePacket(ret);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 8) {
-			int32 id = atoi(sep->arg[1]);
-			Spawn* spawn = client->GetCurrentZone()->GetSpawn(id);
-			if (spawn) {
-				spawn->SetX(client->GetPlayer()->GetX() + .5, false);
-				spawn->SetY(client->GetPlayer()->GetY(), false);
-				spawn->SetZ(client->GetPlayer()->GetZ() + .5, false);
-				float heading = client->GetPlayer()->GetHeading() + 180;
-				if (heading > 360)
-					heading -= 360;
-				spawn->SetLevel(5);
-				spawn->SetAdventureClass(4);
-				spawn->SetHeading(heading, false);
-				spawn->SetSpawnOrigX(spawn->GetX());
-				spawn->SetSpawnOrigY(spawn->GetY());
-				spawn->SetSpawnOrigZ(spawn->GetZ());
-				spawn->SetSpawnOrigHeading(spawn->GetHeading());
-				spawn->appearance.pos.grid_id = client->GetPlayer()->appearance.pos.grid_id;
-				spawn->appearance.targetable = 1;
-				if (spawn->IsNPC() && spawn->GetTotalHP() == 0) {
-					spawn->SetTotalHP(spawn->GetLevel() * 15);
-					spawn->SetHP(spawn->GetTotalHP());
-				}
-				if (spawn->GetTotalPower() == 0) {
-					spawn->SetTotalPower(spawn->GetLevel() * 15);
-					spawn->SetPower(spawn->GetTotalPower());
-				}
-				int16 offset = atoi(sep->arg[2]);
-				int16 offset2 = atoi(sep->arg[3]);
-				int32 value1 = atol(sep->arg[4]);
-				int16 offset3 = 0;
-				int16 offset4 = 0;
-				int32 value2 = 0;
-				if (sep->IsSet(7)) {
-					offset3 = atoi(sep->arg[5]);
-					offset4 = atoi(sep->arg[6]);
-					value2 = atol(sep->arg[7]);
-				}
-				sprintf(spawn->appearance.name, "Offset %i to %i", offset, offset2);
-				spawn->AddPrimaryEntityCommand("attack", 10000, "attack","", 0, 0);
-				EQ2Packet* ret = spawn->spawn_serialize(client->GetPlayer(), client->GetVersion(), offset, value1, offset2, offset3, offset4, value2);
-				DumpPacket(ret);
-				client->QueuePacket(ret);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 9) {		
-			PacketStruct* packet2 = configReader.getStruct("WS_DeathWindow", client->GetVersion());
-			if (packet2) {
-				packet2->setArrayLengthByName("location_count", 1);
-				packet2->setArrayDataByName("location_ida", 1234);
-				packet2->setArrayDataByName("unknown2a", 3);
-				packet2->setArrayDataByName("zone_name", "Queen's Colony");
-				packet2->setArrayDataByName("location_name", "Myrrin's Tower");
-				packet2->setArrayDataByName("distance", 134);
-				EQ2Packet* app = packet2->serialize();
-				if (sep->IsSet(2)) {
-					int8 offset = atoi(sep->arg[1]);
-					uchar* ptr2 = app->pBuffer;
-					ptr2 += offset;
-					if (sep->IsNumber(2)) {
-						int32 value1 = atol(sep->arg[2]);
-						if (value1 > 0xFFFF)
-							memcpy(ptr2, (uchar*)&value1, 4);
-						else if (value1 > 0xFF)
-							memcpy(ptr2, (uchar*)&value1, 2);
-						else
-							memcpy(ptr2, (uchar*)&value1, 1);
-					}
-					else {
-						int8 len = strlen(sep->arg[2]);
-						memcpy(ptr2, (uchar*)&len, 1);
-						ptr2 += 1;
-						memcpy(ptr2, sep->arg[2], len);
-					}
-				}
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 10) {
-			PacketStruct* packet2 = configReader.getStruct("WS_QuestJournalUpdate", client->GetVersion());
-			if (packet2) {
-				packet2->setArrayLengthByName("num_quests", 1);
-				packet2->setArrayDataByName("active", 1);
-				packet2->setArrayDataByName("name", "Tasks aboard the Far Journey");
-				packet2->setArrayDataByName("quest_type", "Hallmark");
-				packet2->setArrayDataByName("quest_zone", "Hallmark");
-				packet2->setArrayDataByName("journal_updated", 1);
-				packet2->setArrayDataByName("quest_id", 524);
-				packet2->setArrayDataByName("day", 19);
-				packet2->setArrayDataByName("month", 6);
-				packet2->setArrayDataByName("year", 20);
-				packet2->setArrayDataByName("level", 2);
-				packet2->setArrayDataByName("encounter_level", 4);
-				packet2->setArrayDataByName("difficulty", 3);
-				packet2->setArrayDataByName("visible", 1);
-				packet2->setDataByName("visible_quest_id", 524);
-				packet2->setDataByName("player_crc", 2900677088);
-				packet2->setDataByName("player_name", "LethalEncounter");
-				EQ2Packet* app = packet2->serialize();
-				if (sep->IsSet(2)) {
-					int8 offset = atoi(sep->arg[1]);
-					uchar* ptr2 = app->pBuffer;
-					ptr2 += offset;
-					if (sep->IsNumber(2)) {
-						int32 value1 = atol(sep->arg[2]);
-						if (value1 > 0xFFFF)
-							memcpy(ptr2, (uchar*)&value1, 4);
-						else if (value1 > 0xFF)
-							memcpy(ptr2, (uchar*)&value1, 2);
-						else
-							memcpy(ptr2, (uchar*)&value1, 1);
-					}
-					else {
-						int8 len = strlen(sep->arg[2]);
-						memcpy(ptr2, (uchar*)&len, 1);
-						ptr2 += 1;
-						memcpy(ptr2, sep->arg[2], len);
-					}
-				}
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 11) {
-			PacketStruct* packet2 = configReader.getStruct("WS_QuestJournalReply", client->GetVersion());
-			if (packet2) {
-				packet2->setDataByName("quest_id", 524);
-				packet2->setDataByName("player_crc", 2900677088);
-				packet2->setDataByName("name", "Tasks aboard the Far Journey");
-				packet2->setDataByName("description", "I completed all the tasks assigned to me by Captain Varlos aboard the Far Journey");
-				packet2->setDataByName("type", "Hallmark");
-				packet2->setDataByName("complete_header", "To complete this quest, I must do the following tasks:");
-				packet2->setDataByName("day", 19);
-				packet2->setDataByName("month", 6);
-				packet2->setDataByName("year", 20);
-				packet2->setDataByName("level", 1);
-				packet2->setDataByName("encounter_level", 1);
-				packet2->setDataByName("difficulty", 1);
-				packet2->setDataByName("time_obtained", Timer::GetUnixTimeStamp());
-				//packet2->setDataByName("timer_start", Timer::GetUnixTimeStamp());
-				//packet2->setDataByName("timer_duration", 300);
-				//packet2->setDataByName("timer_running", 1);
-				packet2->setArrayLengthByName("task_groups_completed", 9);
-				packet2->setArrayLengthByName("num_task_groups", 10);
-				packet2->setArrayDataByName("task_group", "I spoke to Waulon as Captain Varlos had asked of me.");
-				packet2->setArrayDataByName("task_group", "I found Waulon's hat in one of the boxes.", 1);
-				packet2->setArrayDataByName("task_group", "I returned Waulon's hat.", 2);
-				packet2->setArrayDataByName("task_group", "I have spoken to Ingrid.", 3);
-				packet2->setArrayDataByName("task_group", "I purchased a Shard of Luclin.", 4);
-				packet2->setArrayDataByName("task_group", "I gave the Shard of Luclin to Ingrid.", 5);
-				packet2->setArrayDataByName("task_group", "I have spoken to Captain Varlos.", 6);
-				packet2->setArrayDataByName("task_group", "I killed the rats that Captain Varlos requested.", 7);
-				packet2->setArrayDataByName("task_group", "Captain Varlos has ordered you to kill the escaped goblin.", 8);
-				packet2->setArrayDataByName("task_group", "I killed the escaped goblin.", 9);
-				/*packet2->setSubArrayLengthByName("num_tasks", 1);
-				packet2->setSubArrayDataByName("task", "I need to talk to Garven Tralk");
-				packet2->setSubArrayLengthByName("num_updates", 1);
-				packet2->setSubArrayDataByName("update_currentval", 0);
-				packet2->setSubArrayDataByName("update_maxval", 1);
-				packet2->setSubArrayDataByName("icon", 11);
-				*/
-				packet2->setArrayDataByName("waypoint", 0xFFFFFFFF);
-				packet2->setDataByName("journal_updated", 1);
-				packet2->setDataByName("bullets", 1);
-				EQ2Packet* app = packet2->serialize();
-				if (sep->IsSet(2)) {
-					int16 offset = atoi(sep->arg[1]);
-					uchar* ptr2 = app->pBuffer;
-					ptr2 += offset;
-					if (sep->IsNumber(2)) {
-						int32 value1 = atol(sep->arg[2]);
-						if (value1 > 0xFFFF)
-							memcpy(ptr2, (uchar*)&value1, 4);
-						else if (value1 > 0xFF)
-							memcpy(ptr2, (uchar*)&value1, 2);
-						else
-							memcpy(ptr2, (uchar*)&value1, 1);
-					}
-					else {
-						int16 len = strlen(sep->arg[2]);
-						memcpy(ptr2, (uchar*)&len, 2);
-						ptr2 += 2;
-						memcpy(ptr2, sep->arg[2], len);
-					}
-				}
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 12) {
-			PacketStruct* packet2 = configReader.getStruct("WS_QuestJournalReply", client->GetVersion());
-			if (packet2) {
-				packet2->setDataByName("quest_id", 524);
-				packet2->setDataByName("player_crc", 2900677088);
-				packet2->setDataByName("name", "Archetype Selection");
-				packet2->setDataByName("description", "I have reported my profession to Garven Tralk.");
-				packet2->setDataByName("type", "Hallmark");
-				packet2->setDataByName("complete_header", "To complete this quest, I must do the following tasks:");
-				packet2->setDataByName("day", 19);
-				packet2->setDataByName("month", 6);
-				packet2->setDataByName("year", 20);
-				packet2->setDataByName("level", 2);
-				packet2->setDataByName("encounter_level", 4);
-				packet2->setDataByName("difficulty", 3);
-				packet2->setDataByName("time_obtained", Timer::GetUnixTimeStamp());
-				packet2->setDataByName("timer_start", Timer::GetUnixTimeStamp());
-				packet2->setDataByName("timer_duration", 300);
-				packet2->setDataByName("timer_running", 1);
-				packet2->setArrayLengthByName("task_groups_completed", 0);
-				packet2->setArrayLengthByName("num_task_groups", 1);
-				packet2->setArrayDataByName("task_group", "I need to talk to Garven Tralk");
-				packet2->setSubArrayLengthByName("num_tasks", 1);
-				packet2->setSubArrayDataByName("task", "I need to talk to Garven Tralk");
-				packet2->setSubArrayLengthByName("num_updates", 1);
-				packet2->setSubArrayDataByName("update_currentval", 0);
-				packet2->setSubArrayDataByName("update_maxval", 1);
-				packet2->setSubArrayDataByName("icon", 11);
-
-				packet2->setArrayDataByName("waypoint", 0xFFFFFFFF);
-				packet2->setDataByName("journal_updated", 1);
-				packet2->setSubstructDataByName("reward_data", "unknown1", 255);
-				packet2->setSubstructDataByName("reward_data", "reward", "Quest Reward!");
-				packet2->setSubstructDataByName("reward_data", "unknown2", 0x3f);
-				packet2->setSubstructDataByName("reward_data", "coin", 150);
-				packet2->setSubstructDataByName("reward_data", "status_points", 5);
-				packet2->setSubstructDataByName("reward_data", "exp_bonus", 10);
-				packet2->setSubstructArrayLengthByName("reward_data", "num_rewards", 1);
-				packet2->setSubstructArrayDataByName("reward_data", "reward_id", 123);
-				Item* item = master_item_list.GetItem(152755);
-				packet2->setArrayDataByName("reward_id", item->details.item_id);
-				packet2->setItemArrayDataByName("item", item, client->GetPlayer(), 0, 0, -1);
-				/*packet2->setSubstructDataByName("item", "unique_id", 567);
-				packet2->setSubstructDataByName("item", "broker_item_id", 0xFFFFFFFFFFFFFFFF);
-				packet2->setSubstructDataByName("item", "icon", 0xe7);
-				packet2->setSubstructDataByName("item", "tier", 4);
-				packet2->setSubstructDataByName("item", "flags", 0x60);
-				packet2->setSubstructArrayLengthByName("item", "stat_count", 1);
-				packet2->setSubstructDataByName("item", "stat_type", 1);
-				packet2->setSubstructDataByName("item", "stat_subtype", 2);
-				packet2->setSubstructDataByName("item", "value", 3);
-				packet2->setSubstructDataByName("item", "condition", 100);
-				packet2->setSubstructDataByName("item", "weight", 1);
-				packet2->setSubstructDataByName("item", "skill_req1", 0xacafa99e);
-				packet2->setSubstructDataByName("item", "skill_req2", 0xacafa99e);
-				packet2->setSubstructDataByName("item", "skill_min", 1);
-				packet2->setSubstructArrayLengthByName("item", "class_count", 3);
-				packet2->setSubstructDataByName("item", "adventure_class", 1);
-				packet2->setSubstructDataByName("item", "adventure_class", 11, 0, 1);
-				packet2->setSubstructDataByName("item", "adventure_class", 0x1f, 0, 2);
-				packet2->setSubstructDataByName("item", "tradeskill_class", 255);
-				packet2->setSubstructDataByName("item", "tradeskill_class", 255, 0, 1);
-				packet2->setSubstructDataByName("item", "tradeskill_class", 255, 0, 2);
-				packet2->setSubstructDataByName("item", "level", 0x1e);
-				packet2->setSubstructDataByName("item", "level", 100, 0, 1);
-				packet2->setSubstructDataByName("item", "level", 100, 0, 2);
-				packet2->setSubstructDataByName("item_footer", "name", "Footman Gloves");*/
-				//packet2->PrintPacket();
-				EQ2Packet* app = packet2->serialize();
-				if (sep->IsSet(2)) {
-					int16 offset = atoi(sep->arg[1]);
-					uchar* ptr2 = app->pBuffer;
-					ptr2 += offset;
-					if (sep->IsNumber(2)) {
-						int32 value1 = atol(sep->arg[2]);
-						if (value1 > 0xFFFF)
-							memcpy(ptr2, (uchar*)&value1, 4);
-						else if (value1 > 0xFF)
-							memcpy(ptr2, (uchar*)&value1, 2);
-						else
-							memcpy(ptr2, (uchar*)&value1, 1);
-					}
-					else {
-						int16 len = strlen(sep->arg[2]);
-						memcpy(ptr2, (uchar*)&len, 2);
-						ptr2 += 2;
-						memcpy(ptr2, sep->arg[2], len);
-					}
-				}
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 13) {
-			PacketStruct* packet2 = configReader.getStruct("WS_OnScreenMsg", client->GetVersion());
-			if (packet2 && sep->IsSet(7)) {
-				packet2->setDataByName("unknown", atoi(sep->arg[1]));
-				char blah[128];
-				sprintf(blah, "\\#6EFF6EYou get better at \12\\#C8FFC8%s\\#6EFF6E! (7/15)", sep->arg[2]);
-				packet2->setDataByName("text", blah);
-				packet2->setDataByName("message_type", sep->arg[3]);
-				packet2->setDataByName("size", atof(sep->arg[4]));
-				packet2->setDataByName("red", atoi(sep->arg[5]));
-				packet2->setDataByName("green", atoi(sep->arg[6]));
-				packet2->setDataByName("blue", atoi(sep->arg[7]));
-				EQ2Packet* app = packet2->serialize();
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 14) {
-			PacketStruct* packet2 = configReader.getStruct("WS_InstructionWindow", client->GetVersion());
-			if (packet2 && sep->IsSet(3)) {
-				packet2->setDataByName("open_seconds_min", atof(sep->arg[1]));
-				packet2->setDataByName("open_seconds_max", atof(sep->arg[2]));
-				packet2->setDataByName("voice_sync", atoi(sep->arg[3]));
-				packet2->setDataByName("text", "Welcome to Norrath, the world of EverQuest II. Left click on the help button at any time for more detailed help and information.");
-				packet2->setDataByName("voice", "voiceover/english/narrator/boat_06p_tutorial02/narrator_001_63779ca0.mp3");
-				packet2->setArrayLengthByName("num_goals", 1);
-				//packet2->setArrayDataByName("goal_text", )
-				packet2->setSubArrayLengthByName("num_tasks", 1);
-				packet2->setSubArrayDataByName("task_text", "continue");
-				packet2->setDataByName("complete_sound", "click");
-				packet2->setDataByName("signal", "introduction");
-				packet2->setDataByName("voice_key1", 0xcda65173);
-				packet2->setDataByName("voice_key2", 0x984bfc6d);
-				EQ2Packet* app = packet2->serialize();
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-				packet2 = configReader.getStruct("WS_ShowWindow", client->GetVersion());
-				packet2->setDataByName("window", "MainHUD.StartMenu");
-				packet2->setDataByName("show", 1);
-				app = packet2->serialize();
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-
-				packet2 = configReader.getStruct("WS_FlashWindow", client->GetVersion());
-				packet2->setDataByName("window", "MainHUD.StartMenu.help");
-				packet2->setDataByName("flash_seconds", 10);
-				app = packet2->serialize();
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 15) {
-			PacketStruct* packet2 = configReader.getStruct("WS_UpdateLoot", client->GetVersion());
-			if (packet2) {
-				packet2->setArrayLengthByName("loot_count", 1);
-				packet2->setArrayDataByName("name", "Test");
-				packet2->setArrayDataByName("item_id", 1234);
-				packet2->setArrayDataByName("count", 1);
-				packet2->setArrayDataByName("icon", 258);
-				packet2->setArrayDataByName("ability_id", 0xFFFFFFFF);
-				Spawn* spawn = client->GetPlayer()->GetTarget();
-				if (spawn)
-					packet2->setDataByName("object_id", client->GetPlayer()->GetIDWithPlayerSpawn(spawn));
-				packet2->setDataByName("unknown3", 1);
-				packet2->setDataByName("unknown4", 1);
-				packet2->setDataByName("unknown5", 60);
-				EQ2Packet* app = packet2->serialize();
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 16 && sep->IsNumber(1)) {
-			char blah[32];
-			sprintf(blah, "Testing: %i", atoi(sep->arg[1]));
-			client->SimpleMessage(atoi(sep->arg[1]), blah);
-		}
-		else if (atoi(sep->arg[0]) == 17 && sep->IsNumber(2)) {
-			if (sep->IsSet(2)) {
-				int16 offset = atoi(sep->arg[1]);
-				if (sep->IsNumber(2)) {
-					int32 value1 = atol(sep->arg[2]);
-					client->QueuePacket(client->GetPlayer()->GetPlayerInfo()->serialize(client->GetVersion(), offset, value1));
-					cout << "Sent" << endl;
-				}
-			}
-		}
-		else if (atoi(sep->arg[0]) == 18) {
-			PacketStruct* packet2 = configReader.getStruct("WS_QuestRewardPackMsg", client->GetVersion());
-			if (packet2) {
-				packet2->setSubstructDataByName("reward_data", "unknown1", 255);
-				packet2->setSubstructDataByName("reward_data", "reward", "Quest Reward!");
-				packet2->setSubstructDataByName("reward_data", "coin", 150);
-				packet2->setSubstructDataByName("reward_data", "status_points", 5);
-				packet2->setSubstructDataByName("reward_data", "exp_bonus", 10);
-				packet2->setSubstructArrayLengthByName("reward_data", "num_rewards", 4);
-				Item* item = new Item(master_item_list.GetItem(36212));
-				packet2->setArrayDataByName("reward_id", item->details.item_id);
-				item->stack_count = 20;
-				packet2->setItemArrayDataByName("item", item, client->GetPlayer(), 0, 0, -1);
-				safe_delete(item);
-				item = new Item(master_item_list.GetItem(36685));
-				item->stack_count = 20;
-				packet2->setArrayDataByName("reward_id", item->details.item_id);
-				packet2->setItemArrayDataByName("item", item, client->GetPlayer(), 1, 0, -1);
-				safe_delete(item);
-				item = master_item_list.GetItem(1414);
-				packet2->setArrayDataByName("reward_id", item->details.item_id);
-				packet2->setItemArrayDataByName("item", item, client->GetPlayer(), 2, 0, -1);
-				item = master_item_list.GetItem(75057);
-				packet2->setArrayDataByName("reward_id", item->details.item_id);
-				packet2->setItemArrayDataByName("item", item, client->GetPlayer(), 3, 0, -1);
-				EQ2Packet* app = packet2->serialize();
-				if (sep->IsSet(2)) {
-					int16 offset = atoi(sep->arg[1]);
-					uchar* ptr2 = app->pBuffer;
-					ptr2 += offset;
-					if (sep->IsNumber(2)) {
-						int32 value1 = atol(sep->arg[2]);
-						if (value1 > 0xFFFF)
-							memcpy(ptr2, (uchar*)&value1, 4);
-						else if (value1 > 0xFF)
-							memcpy(ptr2, (uchar*)&value1, 2);
-						else
-							memcpy(ptr2, (uchar*)&value1, 1);
-					}
-					else {
-						int16 len = strlen(sep->arg[2]);
-						memcpy(ptr2, (uchar*)&len, 2);
-						ptr2 += 2;
-						memcpy(ptr2, sep->arg[2], len);
-					}
-				}
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 19) {
-			PacketStruct* packet2 = configReader.getStruct("WS_UpdateLoot", client->GetVersion());
-			Spawn* spawn = client->GetPlayer()->GetTarget();
-			if (packet2 && spawn) {
-				Item* item = master_item_list.GetItem(130053);
-				packet2->setArrayLengthByName("loot_count", 1);
-				packet2->setArrayDataByName("loot_id", item->details.item_id);
-				packet2->setArrayDataByName("unknown2", 1);
-				packet2->setItemArrayDataByName("item", item, client->GetPlayer(), 0, 0, 2, true);
-				packet2->setDataByName("display", 1);
-				packet2->setDataByName("unknown2b", 1);
-				packet2->setDataByName("unknown3", 0x3c);
-				packet2->setDataByName("spawn_id", client->GetPlayer()->GetIDWithPlayerSpawn(spawn));
-				packet2->PrintPacket();
-				EQ2Packet* app = packet2->serialize();
-				if (sep->IsSet(2)) {
-					int16 offset = atoi(sep->arg[1]);
-					int16 offset2 = 0;
-					int32 value1 = 0;
-					if (sep->IsSet(3)) {
-						offset2 = atoi(sep->arg[2]);
-						value1 = atol(sep->arg[3]);
-					}
-					else
-						value1 = atol(sep->arg[2]);
-					int16 offset3 = 0;
-					int16 offset4 = 0;
-					int32 value2 = 0;
-					if (sep->IsSet(6)) {
-						offset3 = atoi(sep->arg[4]);
-						offset4 = atoi(sep->arg[5]);
-						value2 = atol(sep->arg[6]);
-					}
-					offset--;
-					if (offset2 > 0 && offset2 >= offset) {
-						offset2--;
-						uchar* ptr2 = app->pBuffer;
-						ptr2 += offset;
-						for (int i = offset; i <= offset2; i++) {
-							if (value1 > 0xFFFF) {
-								memcpy(ptr2, (uchar*)&value1, 4);
-								i += 3;
-								ptr2 += 3;
-							}
-							else if (value1 > 0xFF) {
-								memcpy(ptr2, (uchar*)&value1, 2);
-								i++;
-								ptr2++;
-							}
-							else
-								memcpy(ptr2, (uchar*)&value1, 1);
-							ptr2++;
-						}
-					}
-					if (offset4 > 0 && offset4 >= offset3) {
-						offset3--;
-						offset4--;
-						uchar* ptr2 = app->pBuffer;
-						ptr2 += offset3;
-						for (int i = offset3; i <= offset4; i++) {
-							if (value2 > 0xFFFF) {
-								memcpy(ptr2, (uchar*)&value2, 4);
-								i += 3;
-								ptr2 += 3;
-							}
-							else if (value2 > 0xFF) {
-								memcpy(ptr2, (uchar*)&value2, 2);
-								i++;
-								ptr2++;
-							}
-							else
-								memcpy(ptr2, (uchar*)&value2, 1);
-							ptr2++;
-						}
-					}
-				}
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 21) {
-			PacketStruct* packet2 = configReader.getStruct("WS_OfferQuest", client->GetVersion());
-			if (packet2) {
-				packet2->setDataByName("unknown0", 255);
-				packet2->setDataByName("reward", "New Quest");
-				packet2->setDataByName("title", "Title");
-				packet2->setDataByName("description", "description");
-				packet2->setDataByName("quest_difficulty", 3);
-				packet2->setDataByName("unknown1", 5);
-				packet2->setDataByName("level", 3);
-				packet2->setDataByName("coin", 150);
-				packet2->setDataByName("status_points", 5);
-				packet2->setDataByName("exp_bonus", 10);
-				packet2->setArrayLengthByName("num_rewards", 1);
-				Item* item = new Item(master_item_list.GetItem(36212));
-				packet2->setArrayDataByName("reward_id", item->details.item_id);
-				item->stack_count = 20;
-				packet2->setItemArrayDataByName("item", item, client->GetPlayer(), 0, 0, -1);
-				safe_delete(item);
-				char accept[35] = { 0 };
-				char decline[35] = { 0 };
-				sprintf(accept, "q_accept_pending_quest %u", 0);
-				sprintf(decline, "q_deny_pending_quest %u", 0);
-				packet2->setDataByName("accept_command", accept);
-				packet2->setDataByName("decline_command", decline);
-				EQ2Packet* app = packet2->serialize();
-				if (sep->IsSet(2)) {
-					int16 offset = atoi(sep->arg[1]);
-					uchar* ptr2 = app->pBuffer;
-					ptr2 += offset;
-					if (sep->IsNumber(2)) {
-						int32 value1 = atol(sep->arg[2]);
-						if (value1 > 0xFFFF)
-							memcpy(ptr2, (uchar*)&value1, 4);
-						else if (value1 > 0xFF)
-							memcpy(ptr2, (uchar*)&value1, 2);
-						else
-							memcpy(ptr2, (uchar*)&value1, 1);
-					}
-					DumpPacket(app);
-					client->QueuePacket(app);
-					safe_delete(packet2);
-				}
-			}
-		}
-		else if (atoi(sep->arg[0]) == 22) { //same as 21, but 8bit string
-			PacketStruct* packet2 = configReader.getStruct("WS_OfferQuest", client->GetVersion());
-			if (packet2) {
-				packet2->setDataByName("unknown0", 255);
-				packet2->setDataByName("reward", "New Quest");
-				packet2->setDataByName("title", "Title");
-				packet2->setDataByName("description", "description");
-				packet2->setDataByName("quest_difficulty", 3);
-				packet2->setDataByName("unknown1", 5);
-				packet2->setDataByName("level", 3);
-				packet2->setDataByName("coin", 150);
-				packet2->setDataByName("status_points", 5);
-				packet2->setDataByName("exp_bonus", 10);
-				packet2->setArrayLengthByName("num_rewards", 1);
-				Item* item = new Item(master_item_list.GetItem(36212));
-				packet2->setArrayDataByName("reward_id", item->details.item_id);
-				item->stack_count = 20;
-				packet2->setItemArrayDataByName("item", item, client->GetPlayer(), 0, 0, -1);
-				safe_delete(item);
-				char accept[35] = { 0 };
-				char decline[35] = { 0 };
-				sprintf(accept, "q_accept_pending_quest %u", 0);
-				sprintf(decline, "q_deny_pending_quest %u", 0);
-				packet2->setDataByName("accept_command", accept);
-				packet2->setDataByName("decline_command", decline);
-				EQ2Packet* app = packet2->serialize();
-				if (sep->IsSet(2)) {
-					int16 offset = atoi(sep->arg[1]);
-					uchar* ptr2 = app->pBuffer;
-					ptr2 += offset;
-					if (sep->IsNumber(2)) {
-						int32 value1 = atol(sep->arg[2]);
-						if (value1 > 0xFFFF)
-							memcpy(ptr2, (uchar*)&value1, 4);
-						else if (value1 > 0xFF)
-							memcpy(ptr2, (uchar*)&value1, 2);
-						else
-							memcpy(ptr2, (uchar*)&value1, 1);
-					}
-					else {
-						int8 len = strlen(sep->arg[2]);
-						memcpy(ptr2, (uchar*)&len, 1);
-						ptr2 += 1;
-						memcpy(ptr2, sep->arg[2], len);
-					}
-				}
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}	
-		else if (atoi(sep->arg[0]) == 23) {
-			if (client->GetPlayer()->GetTarget()) {
-				PacketStruct* packet2 = configReader.getStruct("WS_UpdateMerchant", client->GetVersion());
-				if (packet2) {
-					Spawn* target = client->GetPlayer()->GetTarget();
-					packet2->setDataByName("spawn_id", client->GetPlayer()->GetIDWithPlayerSpawn(target));
-					Item* item = new Item(master_item_list.GetItem(12565));
-					int8 i = 0;
-					packet2->setArrayLengthByName("num_items", 1);
-					packet2->setArrayDataByName("item_name", item->name.c_str(), i);
-					packet2->setArrayDataByName("item_id", item->details.item_id, i);
-					packet2->setArrayDataByName("stack_size", item->stack_count, i);
-					packet2->setArrayDataByName("icon", item->details.icon, i);
-					int8 tmp_level = 0;
-					if (item->generic_info.adventure_default_level > 0)
-						tmp_level = item->generic_info.adventure_default_level;
-					else
-						tmp_level = item->generic_info.tradeskill_default_level;
-					packet2->setArrayDataByName("level", tmp_level, i);
-					packet2->setArrayDataByName("tier", item->details.tier, i);
-					packet2->setArrayDataByName("item_id2", item->details.item_id, i);
-					int8 item_difficulty = client->GetPlayer()->GetArrowColor(tmp_level);
-					if (item_difficulty != ARROW_COLOR_WHITE && item_difficulty != ARROW_COLOR_RED && item_difficulty != ARROW_COLOR_GRAY)
-						item_difficulty = ARROW_COLOR_WHITE;
-					item_difficulty -= 6;
-					if (item_difficulty < 0)
-						item_difficulty *= -1;
-					packet2->setArrayDataByName("item_difficulty", item_difficulty, i);
-					packet2->setArrayDataByName("quantity", 2, i);
-					packet2->setArrayDataByName("unknown5", 255, i);
-					packet2->setArrayDataByName("stack_size2", item->stack_count, i);
-					packet2->setArrayDataByName("description", item->description.c_str(), i);
-					packet2->setDataByName("type", 2);
-					EQ2Packet* app = packet2->serialize();
-					if (sep->IsSet(2)) {
-						int16 offset = atoi(sep->arg[1]);
-						uchar* ptr2 = app->pBuffer;
-						ptr2 += offset;
-						if (sep->IsNumber(2)) {
-							int32 value1 = atol(sep->arg[2]);
-							if (value1 > 0xFFFF)
-								memcpy(ptr2, (uchar*)&value1, 4);
-							else if (value1 > 0xFF)
-								memcpy(ptr2, (uchar*)&value1, 2);
-							else
-								memcpy(ptr2, (uchar*)&value1, 1);
-						}
-						else {
-							int8 len = strlen(sep->arg[2]);
-							memcpy(ptr2, (uchar*)&len, 1);
-							ptr2 += 1;
-							memcpy(ptr2, sep->arg[2], len);
-						}
-					}
-					DumpPacket(app);
-					client->QueuePacket(app);
-					safe_delete(packet2);
-				}
-			}
-		}
-		else if (atoi(sep->arg[0]) == 24) {
-			PacketStruct* packet2 = configReader.getStruct("WS_EnableGameEvent", client->GetVersion());
-			if (packet2) {
-				if (sep->IsSet(2)) {
-					packet2->setDataByName("event_name", sep->arg[1]);
-					packet2->setDataByName("enabled", atoi(sep->arg[2]));					
-					EQ2Packet* app = packet2->serialize();
-					DumpPacket(app);
-					client->QueuePacket(app);
-					safe_delete(packet2);
-				}
-			}
-		}
-		else if (atoi(sep->arg[0]) == 25) {
-			if (sep->IsSet(1)) {
-				Widget* new_spawn = new Widget();
-				int32 id = atoul(sep->arg[1]);
-				new_spawn->SetWidgetID(id);
-				EQ2Packet* ret = new_spawn->serialize(client->GetPlayer(), client->GetVersion());
-				client->QueuePacket(ret);
-				int8 index = client->GetPlayer()->GetIndexForSpawn(new_spawn);
-				PacketStruct* packet2 = configReader.getStruct("WS_DestroyGhostCmd", client->GetVersion());
-				if (packet2) {
-					packet2->setDataByName("spawn_index", index);
-					packet2->setDataByName("delete", 1);
-					EQ2Packet* app = packet2->serialize();
-					client->QueuePacket(app);
-					safe_delete(packet2);
-				}
-			}
-		}
-		else if (atoi(sep->arg[0]) == 26) {
-			if (sep->IsSet(4)) {
-				Widget* new_spawn = new Widget();
-				int32 id = atoul(sep->arg[1]);
-				new_spawn->SetWidgetID(id);
-				float x = atof(sep->arg[2]);
-				float y = atof(sep->arg[3]);
-				float z = atof(sep->arg[4]);
-				new_spawn->appearance.pos.grid_id = client->GetPlayer()->appearance.pos.grid_id;
-				new_spawn->SetWidgetX(x);
-				new_spawn->SetWidgetY(y);
-				new_spawn->SetWidgetZ(z);
-				new_spawn->SetX(x);
-				new_spawn->SetY(y);
-				new_spawn->SetZ(z);
-				EQ2Packet* ret = new_spawn->serialize(client->GetPlayer(), client->GetVersion());
-				client->QueuePacket(ret);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 27) {
-			Spawn* target = client->GetPlayer()->GetTarget();
-			PacketStruct* packet2 = configReader.getStruct("WS_HearSimpleDamage", client->GetVersion());
-			if (packet2 && target && sep->IsSet(2)) {
-				packet2->setSubstructDataByName("header", "defender", client->GetPlayer()->GetIDWithPlayerSpawn(target));
-				packet2->setSubstructDataByName("header", "defender_proxy", client->GetPlayer()->GetIDWithPlayerSpawn(target));
-				packet2->setSubstructDataByName("header", "attacker", client->GetPlayer()->GetIDWithPlayerSpawn(client->GetPlayer()));
-				packet2->setArrayLengthByName("num_dmg", 1);				
-				packet2->setArrayDataByName("damage_type", atoi(sep->arg[1]));
-				packet2->setArrayDataByName("damage", atoi(sep->arg[2]));
-				packet2->setDataByName("spell", 1);
-				packet2->setDataByName("spell_name", "Testing");
-				EQ2Packet* app = packet2->serialize();
-				if (sep->IsSet(4)) {
-					int16 offset = atoi(sep->arg[3]);
-					uchar* ptr2 = app->pBuffer;
-					ptr2 += offset;
-					if (sep->IsNumber(4)) {
-						int32 value1 = atol(sep->arg[4]);
-						if (value1 > 0xFFFF)
-							memcpy(ptr2, (uchar*)&value1, 4);
-						else if (value1 > 0xFF)
-							memcpy(ptr2, (uchar*)&value1, 2);
-						else
-							memcpy(ptr2, (uchar*)&value1, 1);
-					}
-					else {
-						int8 len = strlen(sep->arg[4]);
-						memcpy(ptr2, (uchar*)&len, 1);
-						ptr2 += 1;
-						memcpy(ptr2, sep->arg[4], len);
-					}
-				}
-				if (sep->IsSet(6)) {
-					int16 offset = atoi(sep->arg[5]);
-					uchar* ptr2 = app->pBuffer;
-					ptr2 += offset;
-					if (sep->IsNumber(6)) {
-						int32 value1 = atol(sep->arg[6]);
-						if (value1 > 0xFFFF)
-							memcpy(ptr2, (uchar*)&value1, 4);
-						else if (value1 > 0xFF)
-							memcpy(ptr2, (uchar*)&value1, 2);
-						else
-							memcpy(ptr2, (uchar*)&value1, 1);
-					}
-					else {
-						int8 len = strlen(sep->arg[6]);
-						memcpy(ptr2, (uchar*)&len, 1);
-						ptr2 += 1;
-						memcpy(ptr2, sep->arg[6], len);
-					}
-				}
-				DumpPacket(app);
-				client->QueuePacket(app);
-				safe_delete(packet2);
-			}
-		}
-		else if (atoi(sep->arg[0]) == 28 && sep->IsNumber(1)) {
-			World::newValue = strtoull(sep->arg[1], NULL, 0);
-		}
-	}
-	else {
-			PacketStruct* packet2 = configReader.getStruct("WS_ExamineSpellInfo", client->GetVersion());
-			if (packet2) {
-				packet2->setSubstructDataByName("info_header", "show_name", 1);
-				packet2->setSubstructDataByName("info_header", "unknown", 7);
-				packet2->setSubstructDataByName("info_header", "unknown2", 1);
-				packet2->setSubstructDataByName("info_header", "unknown3", 1);
-				packet2->setSubstructDataByName("info_header", "unknown4", 1);
-				packet2->setSubstructDataByName("info_header", "unknown5", 1);
-				packet2->setSubstructDataByName("info_header", "unknown6", "Testing");
-				packet2->setSubstructDataByName("info_header", "unknown7", "Testing");
-				packet2->setSubstructDataByName("info_header", "unknown8", 66);
-				packet2->setSubstructDataByName("info_header", "title", "Blah Title Blah");
-				packet2->setSubstructDataByName("info_header", "title_text", "Blah Blah");
-				packet2->setSubstructDataByName("info_header", "title_text2", "Blah Blah2");
-				packet2->setSubstructDataByName("info_header", "show_popup", 1);
-				packet2->setSubstructDataByName("info_header", "packettype", 3);
-				packet2->setSubstructDataByName("spell_info", "skill_name", "Testing");
-				packet2->setSubstructDataByName("spell_info", "level", 19);
-				packet2->setSubstructDataByName("spell_info", "tier", 1);
-				packet2->setSubstructDataByName("spell_info", "health_cost", 5);
-				packet2->setSubstructDataByName("spell_info", "min_class_skill_req", 3); 
-				packet2->setSubstructDataByName("spell_info", "mana_cost", 6);
-				packet2->setSubstructDataByName("spell_info", "req_concentration", 7);
-				packet2->setSubstructDataByName("spell_info", "cast_time", 200);
-				packet2->setSubstructDataByName("spell_info", "recovery", 220);
-				packet2->setSubstructDataByName("spell_info", "recast", 280);
-				packet2->setSubstructDataByName("spell_info", "beneficial", 1);
-				packet2->setSubstructDataByName("spell_info", "maintained", 1);
-				packet2->setSubstructDataByName("spell_info", "spell_book_type", 1);
-				packet2->setSubstructDataByName("spell_info", "quality", 3);
-
-				packet2->setSubstructDataByName("spell_info", "test_1a", 1);
-				packet2->setSubstructDataByName("spell_info", "test_1b", 1);
-				packet2->setSubstructDataByName("spell_info", "test_1c", 1);
-				packet2->setSubstructDataByName("spell_info", "test_1d", 1);
-				packet2->setSubstructDataByName("spell_info", "test_2a", 2);
-				packet2->setSubstructDataByName("spell_info", "test_2b", 2);
-				packet2->setSubstructDataByName("spell_info", "test_2c", 2);
-				packet2->setSubstructDataByName("spell_info", "test_2d", 2);
-				packet2->setSubstructDataByName("spell_info", "test_3", 3);
-				packet2->setSubstructDataByName("spell_info", "test_4", 4);
-				packet2->setSubstructDataByName("spell_info", "test_5", 5);
-				packet2->setSubstructDataByName("spell_info", "test_6", 6);
-				packet2->setSubstructDataByName("spell_info", "min_class_skill_req", 1);
-				packet2->setSubstructDataByName("spell_info", "min_class_skill_rec", 30123);
-				packet2->setSubstructDataByName("spell_info", "num_reagents", 1);
-				packet2->setSubstructArrayLengthByName("spell_info", "num_reagents", 1);
-				packet2->setArrayDataByName("reagent", "Alcohol");
-				packet2->setArrayDataByName("consumed", "123");
-				packet2->setSubstructDataByName("spell_info", "class_skill", 52);
-				packet2->setSubstructDataByName("spell_info", "id", 8308);
-				packet2->setSubstructDataByName("spell_info", "icon", 303);
-				packet2->setSubstructDataByName("spell_info", "icon2", 0xFFFF);
-				packet2->setSubstructDataByName("spell_info", "icontype", 317);
-				packet2->setSubstructDataByName("spell_info", "type", 2);
-				packet2->setSubstructDataByName("spell_info", "spell_text_color", 255);
-				packet2->setSubstructDataByName("spell_info", "duration1", 600);
-				packet2->setSubstructDataByName("spell_info", "duration2", 600);
-				packet2->setSubstructDataByName("spell_info", "name", "Sprint");
-				packet2->setSubstructDataByName("spell_info", "description", "Test description");
-				EQ2Packet* outapp = packet2->serialize();
-				DumpPacket(outapp);
-				client->QueuePacket(outapp);
-				safe_delete(packet2);
-			}
-		}
-	return;
-	PacketStruct* p = configReader.getStruct("WS_EqTargetItemCmd", client->GetVersion());
-	if (!p) return;
-
-	//Seperator* sep2 = new Seperator(command_parms->data.c_str(), ' ', 50, 500, true);
-	//client->GetCurrentZone()->SendSpellFailedPacket(client, atoi(sep2->arg[0]));
-		//}
-
-
-
-
-
-
-
-
-
-
-
-
-
-	/*Seperator* sep2 = new Seperator(command_parms->data.c_str(), ' ', 50, 500, true);
-	if (sep2 && sep2->arg[0] && sep2->IsNumber(0)) {
-		client->SetPendingFlightPath(atoi(sep2->arg[0]));
-		PacketStruct* packet = configReader.getStruct("WS_ReadyForTakeOff", client->GetVersion());
-		if (packet) {
-			client->QueuePacket(packet->serialize());
-			safe_delete(packet);
-		}
-	}*/
-
-	/*if (client->GetCurrentZone()->Grid != nullptr) {
-		int32 numFaces = 0;
-		int32 numGrids = client->GetPlayer()->Cell_Info.CurrentCell->FaceList.size();
-		client->Message(CHANNEL_COLOR_YELLOW, "Num grids in cell: %u", numGrids);
-
-		map<int32, vector<Face*> >::iterator itr;
-		for (itr = client->GetPlayer()->Cell_Info.CurrentCell->FaceList.begin(); itr != client->GetPlayer()->Cell_Info.CurrentCell->FaceList.end(); itr++)
-			numFaces += (*itr).second.size();
-
-		client->Message(CHANNEL_COLOR_YELLOW, "Num faces in cell: %u", numFaces);
-	}*/
-
-	//uchar blah[] = {
-		// 1208 - OP_EQUpdateStoreCmd
-		// /*0x00,0x3A,*/0x2B,0x00,0x00,0x00,0xFF,0x78,0x02,0x53,0x2C,0x33,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
-
-		// /*0x58,*/0x47,0x35,0xD3,0x45,0x42,0x42,0x51,0x00,0x40,0xD1,0xE7,0x57,0xB1,0x51,0xB1,0xBB,0xBB,0xB1,0x3B,0xB0,0xBB,0xB0,0x3B,0x59,0x85,0x5B,0x47,0x1D,0x9C,0x3B,0x3A,0x1B,0xB8,0xD9,0x64,0x14,0x85,0x9F,0x4C,0xC8,0x09,0x21,0xA4,0xB3,0x7F,0x45,0x90,0x0B,0x79,0x90,0x0F,0x31,0x28,0x80,0x42,0x28,0x82,0x62,0x28,0x81,0x52,0x28,0x83,0x38,0x94,0x43,0x05,0x54,0x42,0x02,0xAA,0xA0,0x1A,0x6A,0xA0,0x16,0xEA,0xA0,0x1E,0x1A,0xA0,0x11,0x9A,0xA0,0x19,0x5A,0xA0,0x15,0xDA,0xA0,0x1D,0x3A,0xA0,0x13,0xBA,0xA0,0x1B,0x7A,0xA0,0x17,0xFA,0xA0,0x1F,0x06,0x60,0x10,0x86,0x60,0x18,0x46,0x60,0x14,0xC6,0x60,0x1C,0x26,0x20,0x09,0x93,0x30,0x05,0xD3,0x30,0x03,0xB3,0x30,0x07,0xF3,0xB0,0x00,0x8B,0xB0,0x04,0xCB,0xB0,0x02,0xAB,0xB0,0x06,0xEB,0xB0,0x01,0x29,0xD8,0x84,0x2D,0xD8,0x86,0x1D,0xD8,0x85,0x3D,0xD8,0x87,0x03,0x38,0x84,0x23,0x38,0x86,0x13,0x38,0x85,0x33,0x38,0x87,0x0B,0xB8,0x84,0x34,0x5C,0xC1,0x35,0xDC,0xC0,0x2D,0xDC,0xC1,0x3D,0x3C,0xC0,0x23,0x3C,0xC1,0x33,0xBC,0xC0,0x2B,0xBC,0xC1,0x3B,0x7C,0xC0,0x27,0x7C,0xC1,0x37,0x64,0xE0,0xFF,0xD3,0xF0,0x0B,0x29,0x4A,0xD8,0x68
-
-		// 1193 - -- OP_ClientCmdMsg::OP_EqUpdateMerchantCmd --
-		// /*0x00,0x3A,*/0x38,0x00,0x00,0x00,0xFF,0x77,0x02,0xA6,0xAA,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x00,0xA8,0x55,0xEC,0x8F,0x7F,0x70,0x31,0x08,0x40,0x71,0x3A,0x8B,0xB4,0x55,0xEC,0x8F,0x00
-	/*};
-
-	Seperator* sep2 = new Seperator(command_parms->data.c_str(), ' ', 50, 500, true);
-	int8 val = 0;
-	int16 pos = 0;
-	int idx = 0;
-	while(sep2 && sep2->arg[idx+1] && sep2->IsNumber(idx) && sep2->IsNumber(idx+1)){
-		pos = atoi(sep2->arg[idx]);
-		val = atoi(sep2->arg[idx+1]);
-		memset(blah+pos, val, 1);
-		idx+=2;
-	}
-
-	DumpPacket(blah, sizeof(blah));
-	client->QueuePacket(new EQ2Packet(OP_GroupCreatedMsg , blah, sizeof(blah)));*/
-
-	if (client->GetPlayer()->GetTarget()) {
-		PacketStruct* packet = configReader.getStruct("WS_SetControlGhost", client->GetVersion());
-		if (packet) {
-			packet->setDataByName("spawn_id", client->GetPlayer()->GetIDWithPlayerSpawn(client->GetPlayer()->GetTarget()));
-			packet->setDataByName("size", 0);
-			packet->setDataByName("unknown2", 0);
-			EQ2Packet* app = packet->serialize();
-			client->QueuePacket(app);
-			safe_delete(packet);
-		}
-
-		PacketStruct* set_pov = configReader.getStruct("WS_SetPOVGhostCmd", client->GetVersion());
-		if (set_pov) {
-			set_pov->setDataByName("spawn_id", client->GetPlayer()->GetIDWithPlayerSpawn(client->GetPlayer()->GetTarget()));
-			EQ2Packet* app_pov = set_pov->serialize();
-			client->QueuePacket(app_pov);
-			safe_delete(set_pov);
-		}
-	}
-
-	Seperator* sep2 = new Seperator(command_parms->data.c_str(), ' ', 50, 500, true);
-
-	PacketStruct* packet = configReader.getStruct("WS_OpenCharCust", client->GetVersion());
-	if (packet) {
-
-
-		if (sep2 && sep2->arg[0] && sep2->IsNumber(0))
-			packet->setDataByName("Type", atoi(sep2->arg[0]));
-		else
-			packet->setDataByName("Type", 2);
-
-		if (sep2 && sep2->arg[1] && sep2->IsNumber(1))
-			packet->setDataByName("race_id", atoi(sep2->arg[1]));
-		else
-			packet->setDataByName("race_id", 0);
-
-		if (sep2 && sep2->arg[2] && sep2->IsNumber(2))
-			packet->setDataByName("gender", atoi(sep2->arg[2]));
-		else
-			packet->setDataByName("gender", 2);
-
-		if (sep2 && sep2->arg[3] && sep2->IsNumber(3))
-			packet->setDataByName("unknown", atoi(sep2->arg[3]), 0);
-		else
-			packet->setDataByName("unknown", 0, 0);
-
-		if (sep2 && sep2->arg[4] && sep2->IsNumber(4))
-			packet->setDataByName("unknown", atoi(sep2->arg[4]), 1);
-		else
-			packet->setDataByName("unknown", 0, 1);
-
-		if (sep2 && sep2->arg[5] && sep2->IsNumber(5))
-			packet->setDataByName("unknown", atoi(sep2->arg[5]), 2);
-		else
-			packet->setDataByName("unknown", 0, 2);
-
-
-		client->QueuePacket(packet->serialize());
-	}
-	safe_delete(packet);
-	safe_delete(sep2);
-}
-
-void Commands::Command_LeaveChannel(Client *client, Seperator *sep) {
-	const char *channel_name;
-
-	if (sep == NULL || !sep->IsSet(0)) {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /leavechat <channel name>");
-		PrintSep(sep);
-		return;
-	}
-
-	channel_name = sep->arg[0];
-
-	if (!chat.IsInChannel(client, channel_name))
-		client->Message(CHANNEL_NARRATIVE, "Unable to leave '%s': You are not in the channel.", channel_name);
-	else if (!chat.LeaveChannel(client, channel_name))
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "There was an internal error preventing you from leaving that channel MUAHAHA");
-}
-
-/* 
-	Function: 
-	Purpose	: 
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_WeaponStats(Client* client)
-{
-	Player* player = client->GetPlayer();
-
-	Item* primary = player->GetEquipmentList()->GetItem(EQ2_PRIMARY_SLOT);
-	Item* secondary = player->GetEquipmentList()->GetItem(EQ2_SECONDARY_SLOT);
-	Item* ranged = player->GetEquipmentList()->GetItem(EQ2_RANGE_SLOT);
-	client->SimpleMessage(0, "Primary:");
-	if (primary) {
-		client->Message(0, "Name: %s", primary->name.c_str());
-		client->Message(0, "Base Damage: %u - %u", primary->weapon_info->damage_low3, primary->weapon_info->damage_high3);
-		client->Message(0, "Actual Damage: %u - %u", player->GetPrimaryWeaponMinDamage(), player->GetPrimaryWeaponMaxDamage());
-		client->Message(0, "Actual Delay: %u", player->GetPrimaryWeaponDelay());
-		client->Message(0, "Proc Percent: %d%%", 0);
-		client->Message(0, "Procs Per Minute: %d", 0);
-	}
-	else {
-		client->SimpleMessage(0, "Name: fist");
-		client->Message(0, "Base Damage: %u - %u", player->GetPrimaryWeaponMinDamage(), player->GetPrimaryWeaponMaxDamage());
-		client->Message(0, "Actual Damage: %u - %u", player->GetPrimaryWeaponMinDamage(), player->GetPrimaryWeaponMaxDamage());
-		client->Message(0, "Actual Delay: %d", player->GetPrimaryWeaponDelay() * 0.1);
-		client->Message(0, "Proc Percent: %d%%", 0);
-		client->Message(0, "Procs Per Minute: %d", 0);
-	}
-	client->SimpleMessage(0, " ");
-	client->SimpleMessage(0, " ");
-	if (secondary) {
-		client->SimpleMessage(0, "Secondary:");
-		client->Message(0, "Name: %s", secondary->name.c_str());
-		client->Message(0, "Base Damage: %u - %u", secondary->weapon_info->damage_low3, secondary->weapon_info->damage_high3);
-		client->Message(0, "Actual Damage: %u - %u", player->GetSecondaryWeaponMinDamage(), player->GetSecondaryWeaponMaxDamage());
-		client->Message(0, "Actual Delay: %d", player->GetSecondaryWeaponDelay() * 0.1);
-		client->Message(0, "Proc Percent: %d%%", 0);
-		client->Message(0, "Procs Per Minute: %d", 0);
-		client->SimpleMessage(0, " ");
-		client->SimpleMessage(0, " ");
-	}
-	client->SimpleMessage(0, "Ranged:");
-	if (ranged) {
-		client->Message(0, "Name: %s", ranged->name.c_str());
-		client->Message(0, "Base Damage: %u - %u", ranged->ranged_info->weapon_info.damage_low3, ranged->ranged_info->weapon_info.damage_high3);
-		client->Message(0, "Actual Damage: %u - %u", player->GetRangedWeaponMinDamage(), player->GetRangedWeaponMaxDamage());
-		client->Message(0, "Actual Delay: %d", player->GetRangeWeaponDelay() * 0.1);
-		client->Message(0, "Proc Percent: %d%%", 0);
-		client->Message(0, "Procs Per Minute: %d", 0);
-	}
-	else
-		client->SimpleMessage(0, "None");
-
-}
-
-void Commands::Command_WhoChannel(Client *client, Seperator *sep) {
-	const char *channel_name;
-
-	if (sep == NULL || !sep->IsSet(0)) {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /chatwho <channel name>");
-		return;
-	}
-
-	channel_name = sep->arg[0];
-
-	if (!chat.ChannelExists(channel_name))
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "That channel does not exist!");
-	else
-		chat.SendChannelUserList(client, channel_name);
-}
-
-void Commands::Command_ZoneSafeCoords(Client *client, Seperator *sep) 
-{
-	ZoneServer* zone = 0;
-	int32 zone_id = client->GetPlayer()->GetZone()->GetZoneID();
-
-	if (zone_id > 0)
-	{
-		zone = zone_list.Get(zone_id, false);
-		if (zone)
-		{
-			zone->SetSafeX(client->GetPlayer()->GetX());
-			zone->SetSafeY(client->GetPlayer()->GetY());
-			zone->SetSafeZ(client->GetPlayer()->GetZ());
-			zone->SetSafeHeading(client->GetPlayer()->GetHeading());
-			if( database.SaveZoneSafeCoords(zone_id, zone->GetSafeX(), zone->GetSafeY(), zone->GetSafeZ(), zone->GetSafeHeading()) )
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Zone safe coordinates updated!");
-			else
-				client->SimpleMessage(CHANNEL_COLOR_RED, "FAILED to update zone safe coordinates!");
-		}
-	}
-}
-
-/* 
-	Function: 
-	Purpose	: 
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_ZoneDetails(Client* client, Seperator* sep)
-{
-	ZoneInfo* zone_info = new ZoneInfo;
-
-	if (sep && sep->arg[0]) 
-	{
-		if (sep->IsNumber(0))
-			zone_info->id = atoi(sep->arg[0]);
-		else
-			zone_info->id = database.GetZoneID(sep->arg[0]);
-
-		if (zone_info->id > 0) 
-		{
-			database.LoadZoneInfo(zone_info);
-			client->Message(CHANNEL_COLOR_YELLOW, "id: %u, name: %s, file: %s, description: %s", zone_info->id, zone_info->name, zone_info->file, zone_info->description);
-			client->Message(CHANNEL_COLOR_YELLOW, "safe_x: %f, safe_y: %f, safe_z: %f, underworld: %f", zone_info->safe_x, zone_info->safe_y, zone_info->safe_z, zone_info->underworld);
-			client->Message(CHANNEL_COLOR_YELLOW, "min_status: %u, min_level: %u, max_level: %u, xp_modifier: %u", zone_info->min_status, zone_info->min_level, zone_info->max_level, zone_info->xp_modifier);
-			client->Message(CHANNEL_COLOR_YELLOW, "instance_type: %u, shutdown_timer: %u, ruleset_id: %u", zone_info->instance_type, zone_info->shutdown_timer, zone_info->ruleset_id);
-			client->Message(CHANNEL_COLOR_YELLOW, "default_reenter_time: %u, default_reset_time: %u, default_lockout_time: %u", zone_info->default_reenter_time, zone_info->default_reenter_time, zone_info->default_lockout_time);
-			client->Message(CHANNEL_COLOR_YELLOW, "force_group_to_zone: %u, expansion_id: %u, min_version: %u", zone_info->force_group_to_zone, zone_info->expansion_id, zone_info->min_version);
-			client->Message(CHANNEL_COLOR_YELLOW, "always_loaded: %u, city_zone: %u, start_zone: %u, weather_allowed: %u", zone_info->always_loaded, zone_info->city_zone, zone_info->start_zone, zone_info->weather_allowed);
-			client->Message(CHANNEL_COLOR_YELLOW, "zone_type: %s, sky_file: %s", zone_info->zone_type, zone_info->sky_file);
-			client->Message(CHANNEL_COLOR_YELLOW, "lua_script: %s", zone_info->lua_script);
-			client->Message(CHANNEL_COLOR_YELLOW, "zone_motd: %s", zone_info->zone_motd);
-		}
-		else
-			client->Message(CHANNEL_COLOR_YELLOW, "The zone name or ID '%s' does not exist.", sep->arg[0]);
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /zone details [zone id|zone name]");
-
-	safe_delete(zone_info);
-}
-
-/* 
-	Function: 
-	Purpose	: 
-	Params	: 
-	Dev		: 
-	Example	: 
-*/ 
-void Commands::Command_ZoneSet(Client* client, Seperator* sep)
-{
-	if (sep && sep->arg[0] && sep->arg[1] && sep->arg[2]) 
-	{
-		ZoneServer* zone = 0;
-		int32 zone_id = 0;
-
-		if (sep->IsNumber(0) && atoi(sep->arg[0]) > 0) 
-		{
-			zone_id = atoi(sep->arg[0]);
-			zone = zone_list.Get(atoi(sep->arg[0]), false);
-		}
-		else 
-		{
-			zone_id = database.GetZoneID(sep->arg[0]);
-
-			if (zone_id > 0)
-				zone = zone_list.Get(sep->arg[0], false);
-		}
-
-		if (zone_id > 0) 
-		{
-			if (zone_set_values.count(string(sep->arg[1])) > 0)
-				SetZoneCommand(client, zone_id, zone, zone_set_values[sep->arg[1]], sep->arg[2]);
-			else
-				client->Message(CHANNEL_COLOR_YELLOW, "The attribute '%s' is not valid.", sep->arg[1]);
-		}
-		else
-			client->Message(CHANNEL_COLOR_YELLOW, "The zone name or ID '%s' does not exist.", sep->arg[0]);
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /zone set [zone id|zone name] [attribute] [value]");
-}
-
-void Commands::Command_Rain(Client* client, Seperator* sep) {
-	if (sep == NULL || !sep->IsSet(0) || !sep->IsNumber(0)) {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /rain <float>");
-		return;
-	}
-
-	client->Message(CHANNEL_COLOR_YELLOW,"Setting rain to %.2f", atof(sep->arg[0]));
-	client->GetCurrentZone()->SetRain(atof(sep->arg[0]));
-	client->GetCurrentZone()->SetCurrentWeather(atof(sep->arg[0]));
-}
-
-void Commands::Command_Wind(Client* client, Seperator* sep) {
-	if (sep == NULL || !sep->IsSet(0) || !sep->IsNumber(0)) {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /wind <float>");
-		return;
-	}
-
-	client->Message(CHANNEL_COLOR_YELLOW, "Setting wind to %.2f", atof(sep->arg[0]));
-	client->GetCurrentZone()->SetWind(atof(sep->arg[0]));
-}
-
-
-void Commands::Command_SendMerchantWindow(Client* client, Seperator* sep, bool sell) {
-	Spawn* spawn = client->GetPlayer()->GetTarget();
-	if(spawn) {
-		client->SetMerchantTransaction(spawn);
-		if (spawn->GetMerchantID() > 0 && spawn->IsClientInMerchantLevelRange(client)){
-			client->SendHailCommand(spawn);
-			//MerchantFactionMultiplier* multiplier = world.GetMerchantMultiplier(spawn->GetMerchantID());
-			//if(!multiplier || (multiplier && client->GetPlayer()->GetFactions()->GetFactionValue(multiplier->faction_id) >= multiplier->faction_min)){
-			client->SendBuyMerchantList(sell);
-			if(!(spawn->GetMerchantType() & MERCHANT_TYPE_NO_BUY))
-				client->SendSellMerchantList(sell);
-			if(!(spawn->GetMerchantType() & MERCHANT_TYPE_NO_BUY_BACK))
-				client->SendBuyBackList(sell);
-
-			PacketStruct* packet = configReader.getStruct("WS_UpdateMerchant", client->GetVersion());
-			if (packet) {
-				packet->setDataByName("spawn_id", 0xFFFFFFFF);
-				packet->setDataByName("type", 16);
-				EQ2Packet* outapp = packet->serialize();
-				if (outapp)
-					client->QueuePacket(outapp);
-				safe_delete(packet);
-			}
-		}
-		if (spawn->GetMerchantType() & MERCHANT_TYPE_REPAIR)
-			client->SendRepairList();
-	}
-	//	client->SimpleMessage(CHANNEL_COLOR_RED, "Your faction is too low to use this merchant.");
-}
-
-
-void Commands::Command_Weather(Client* client, Seperator* sep) 
-{
-	//PrintSep(sep, "Weather");
-
-	if( sep && sep->arg[0] )
-	{
-		ZoneServer* zsZone = client->GetCurrentZone();
-		const char* value = sep->arg[0];
-
-		// process single-param commands first
-		if( strncasecmp(value, "details", strlen(value)) == 0 ) 
-		{
-			client->Message(CHANNEL_COLOR_YELLOW, "Weather Details for zone %s: ", zsZone->GetZoneName());
-			client->Message(CHANNEL_COLOR_YELLOW, "enabled: %i, allowed: %i, type: %i, frequency: %u", zsZone->isWeatherEnabled(), zsZone->isWeatherAllowed(), zsZone->GetWeatherType(), zsZone->GetWeatherFrequency());
-			client->Message(CHANNEL_COLOR_YELLOW, "severity: %.2f = %.2f, current: %.2f", zsZone->GetWeatherMinSeverity(), zsZone->GetWeatherMaxSeverity(), zsZone->GetCurrentWeather());
-			client->Message(CHANNEL_COLOR_YELLOW, "pattern: %i, chance: %i, amount: %.2f, offset: %.2f", zsZone->GetWeatherPattern(), zsZone->GetWeatherChance(), zsZone->GetWeatherChangeAmount(), zsZone->GetWeatherDynamicOffset());
-		}
-		else if( strncasecmp(value, "process", strlen(value)) == 0 ) 
-		{
-			zsZone->SetWeatherLastChangedTime(Timer::GetUnixTimeStamp() - zsZone->GetWeatherFrequency());
-			zsZone->ProcessWeather();
-		}
-		else if( strncasecmp(value, "reset", strlen(value)) == 0 ) 
-		{
-			zsZone->SetWeatherType(rule_manager.GetGlobalRule(R_Zone, WeatherType)->GetInt8());
-			zsZone->SetWeatherFrequency(rule_manager.GetGlobalRule(R_Zone, WeatherChangeFrequency)->GetInt32());
-			zsZone->SetWeatherMinSeverity(rule_manager.GetGlobalRule(R_Zone, MinWeatherSeverity)->GetFloat());
-			zsZone->SetWeatherMaxSeverity(rule_manager.GetGlobalRule(R_Zone, MaxWeatherSeverity)->GetFloat());
-			zsZone->SetCurrentWeather(zsZone->GetWeatherMinSeverity());
-			zsZone->SetWeatherPattern(1);
-			zsZone->SetWeatherChance(rule_manager.GetGlobalRule(R_Zone, WeatherChangeChance)->GetInt8());
-			zsZone->SetWeatherChangeAmount(rule_manager.GetGlobalRule(R_Zone, WeatherChangePerInterval)->GetFloat());
-			zsZone->SetWeatherDynamicOffset(rule_manager.GetGlobalRule(R_Zone, WeatherDynamicMaxOffset)->GetFloat());
-			zsZone->SetWeatherLastChangedTime(Timer::GetUnixTimeStamp() - zsZone->GetWeatherFrequency());
-			zsZone->ProcessWeather();
-		}
-
-		// process commands with params
-		if( sep->arg[1] )
-		{
-			if( strncasecmp(value, "enable", strlen(value)) == 0 && sep->IsNumber(1) ) 
-				zsZone->SetWeatherEnabled( ( atoi(sep->arg[1]) == 1 ) ? true : false );
-			else if( strncasecmp(value, "type", strlen(value)) == 0 && sep->IsNumber(1) && (atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 3) ) 
-				zsZone->SetWeatherType(atoi(sep->arg[1]));
-			else if( strncasecmp(value, "frequency", strlen(value)) == 0 && sep->IsNumber(1)) 
-				zsZone->SetWeatherFrequency( atoul(sep->arg[1]) );
-			else if( strncasecmp(value, "range", strlen(value)) == 0 && sep->IsNumber(1) && sep->IsNumber(2) ) {
-				zsZone->SetWeatherMinSeverity(atof(sep->arg[1]));
-				zsZone->SetWeatherMaxSeverity(atof(sep->arg[2]));
-				zsZone->SetRain(zsZone->GetWeatherMinSeverity());
-			}
-			else if( strncasecmp(value, "current", strlen(value)) == 0 && sep->IsNumber(1) ) {
-				zsZone->SetCurrentWeather(atof(sep->arg[1]));
-				zsZone->SetRain(zsZone->GetCurrentWeather());
-			}
-			else if( strncasecmp(value, "pattern", strlen(value)) == 0 && sep->IsNumber(1) && (atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 2) )
-				zsZone->SetWeatherPattern( atoi(sep->arg[1]) );
-			else if( strncasecmp(value, "chance", strlen(value)) == 0 && sep->IsNumber(1) && (atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 100) )
-				zsZone->SetWeatherChance( atoi(sep->arg[1]) );
-			else if( strncasecmp(value, "amount", strlen(value)) == 0 && sep->IsNumber(1) && (atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 1) )
-				zsZone->SetWeatherChangeAmount( atof(sep->arg[1]) );
-			else if( strncasecmp(value, "offset", strlen(value)) == 0 && sep->IsNumber(1) && (atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 1) )
-				zsZone->SetWeatherDynamicOffset( atof(sep->arg[1]) );
-		}
-	}
-	else
-	{
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /weather [command] [param]");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Commands: enable (0|1), type (0-3), frequency (sec), range|current (0.0 - 1.0)");
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Commands: details, process, pattern (0|1), chance (%), amount (float), offset (float)");
-		return;
-	}
-
-}
-
-void Commands::Command_Select(Client* client, Seperator* sep) {
-	if (sep && sep->arg[1]) {
-		Spawn* spawn = client->GetPlayer()->GetTarget();
-		if (spawn && strlen(sep->arg[1]) > 0)
-			client->GetCurrentZone()->CallSpawnScript(spawn, SPAWN_SCRIPT_CUSTOM, client->GetPlayer(), sep->arg[1]);
-	}
-}
-
-/* 
-	Function: Command_ConsumeFood()
-	Purpose	: Consume Food/Drink and apply mods
-	Params	: Slot ID - EQ2_FOOD_SLOT 22, EQ2_DRINK_SLOT 23
-	Dev		: Zcoretri
-	Example	: /consume_food 22
-*/ 
-void Commands::Command_ConsumeFood(Client* client, Seperator* sep) {
-	if (sep && sep->arg[0] && sep->IsNumber(0))
-	{
-		Player* player = client->GetPlayer();
-		int8 slot = atoi(sep->arg[0]);
-		Item* item = player->GetEquipmentList()->GetItem(slot);
-		if(slot == 22 && player->GetSpellEffectBySpellType(SPELL_TYPE_FOOD))
-		{
-			client->Message(CHANNEL_NARRATIVE, "If you ate anymore you would explode!");
-			return;
-		}
-		else if (player->GetSpellEffectBySpellType(SPELL_TYPE_DRINK))
-		{
-			client->Message(CHANNEL_NARRATIVE, "If you drank anymore you would explode!");
-			return;
-		}
-		client->ConsumeFoodDrink(item, slot);
-	}
-}
-
-void Commands::Command_Aquaman(Client* client, Seperator* sep) {
-	if (sep && sep->arg[0] && sep->IsNumber(0)) {
-		if (atoi(sep->arg[0]) == 1) {
-			client->GetPlayer()->GetInfoStruct()->set_vision(4);
-			client->GetPlayer()->GetInfoStruct()->set_breathe_underwater(1);
-			client->GetPlayer()->SetCharSheetChanged(true);
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Maybe you ought to stick to the shallow end until you know how to swim.");
-		}
-		else {
-			client->GetPlayer()->GetInfoStruct()->set_vision(0);
-			client->GetPlayer()->GetInfoStruct()->set_breathe_underwater(0);
-			client->GetPlayer()->SetCharSheetChanged(true);
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Aquaman mode turned off.");
-		}
-	}
-	else
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /aquaman [0|1]");
-}
-
-void Commands::Command_ReportBug(Client* client, Seperator* sep) 
-{
-	if(sep)
-	{
-		string data;
-
-		if(sep->arg[0]){
-			data = string(sep->arg[0]);
-		}
-
-		for(int i=1;i<sep->GetMaxArgNum();i++){
-			if(sep->arg[i])
-				data.append(" ").append(sep->arg[i]);
-		}
-
-		const char* target_name = 0;
-		int32 spawn_id = 0;
-
-		if(client->GetPlayer()->GetTarget())
-		{
-			target_name = client->GetPlayer()->GetTarget()->GetName();
-			spawn_id = client->GetPlayer()->GetTarget()->GetDatabaseID();
-		}
-		else
-			target_name = "N/A";
-
-		LogWrite(COMMAND__DEBUG, 1, "Command", "%s", data.c_str());
-
-		if(world.ReportBug(data, client->GetPlayer()->GetName(), client->GetAccountID(), target_name, spawn_id, client->GetCurrentZone()->GetZoneID()))
-			client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Successfully submitted bug.");
-		else
-			client->SimpleMessage(CHANNEL_COLOR_RED, "Error submitting bug.");
-	}
-}
-
-void Commands::Command_Attune_Inv(Client* client, Seperator* sep) {
-	PrintSep(sep, "Command_Attune_Inv");
-	if (sep && sep->arg[0] && sep->IsNumber(0)) {
-		// Get the item index from the first parameter
-		int16 index = atoi(sep->arg[0]);
-		// Check to see if this is a valid item index for the player, if not exit out of the function
-		if (client->GetPlayer()->item_list.indexed_items.count(index) == 0) {
-			LogWrite(ITEM__DEBUG, 0, "Items", "%s has no item with an index of %i", client->GetPlayer()->GetName(), index);
-			return;
-		}
-
-		// Get the item
-		Item* item = client->GetPlayer()->item_list.indexed_items[index];
-		if(item) {
-			// Valid item lets check to make sure this item is attunable, if not return out
-			if (!item->CheckFlag(ATTUNEABLE)) {
-				LogWrite(ITEM__DEBUG, 0, "Items", "attune_inv called for an item that is not attunable (%s)", item->name.c_str());
-				return;
-			}
-
-			// Remove the attunable flag
-			item->generic_info.item_flags -= ATTUNEABLE;
-			// Set the attuned flag
-			item->generic_info.item_flags += ATTUNED;
-			// Flag this item for saving
-			item->save_needed = true;
-
-			client->QueuePacket(item->serialize(client->GetVersion(), false, client->GetPlayer()));
-
-			vector<EQ2Packet*> packets = client->GetPlayer()->EquipItem(index, client->GetVersion(), 0, -1); // appearance type??
-			EQ2Packet* outapp = 0;
-
-			for (int32 i=0;i<packets.size();i++) {
-				outapp = packets[i];
-				if(outapp)
-					client->QueuePacket(outapp);
-			}
-		}
-
-	}
-}
-
-void Commands::Command_Reset_Zone_Timer(Client* client, Seperator* sep) {
-	PrintSep(sep, "Command_Reset_Zone_Timer");
-	/*if (sep && sep->arg[0] && sep->IsNumber(0)) {
-		int32 db_id = atoul(sep->arg[0]);
-		InstanceData* data = client->GetPlayer()->GetCharacterInstances().FindInstanceByDBID(db_id);
-		if (data) {
-			// TODO: add a check to timers to ensure it can be reset
-
-			// Delete the character from the instance
-			database.DeleteCharacterFromInstance(client->GetPlayer()->GetCharacterID(), data->instance_id);
-			data->instance_id = 0;
-
-			// Update the success time and set to 0 so the player can enter it again
-			database.UpdateCharacterInstance(client->GetPlayer()->GetCharacterID(), data->zone_name, 0, 1, 0);
-			data->last_success_timestamp = 0;
-		}
-	}*/
-}
-
-void Commands::Command_Player(Client* client, Seperator* sep) {
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, " -- /player syntax --");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/player coins");
-}
-
-void Commands::Command_Player_Coins(Client* client, Seperator* sep) {
-	// /player coins add 10
-	// /player coins add plat 10
-	Player* player = client->GetPlayer();
-	if (player->HasTarget() && player->GetTarget()->IsPlayer())
-		player = (Player*)player->GetTarget();
-
-
-	if (sep && sep->arg[0] && sep->arg[1]) {
-		const char* action = sep->arg[0];
-		int64 value = 0;
-
-		if (strncasecmp(action, "add", strlen(action)) == 0) {
-			if (sep->IsNumber(1)) {
-				value = atoi64(sep->arg[1]);
-				player->AddCoins(value);
-				
-				if (client->GetPlayer() == player)
-					client->Message(CHANNEL_COLOR_YELLOW, "You give yourself %llu coin%s", value, (value > 1 ? "s" : ""));
-				else {
-					client->Message(CHANNEL_COLOR_YELLOW, "You give %s %llu coin%s", player->GetName(), value, (value > 1 ? "s" : ""));
-					client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s gave you %llu coin%s", client->GetPlayer()->GetName(), value, (value > 1 ? "s" : ""));
-				}
-
-				return;
-			}
-			else if (sep->arg[2] && sep->IsNumber(2)) {
-				const char* type = sep->arg[1];
-				if (strncasecmp(type, "copper", strlen(type)) == 0) {
-					value = atoi64(sep->arg[2]);
-				}
-				else if (strncasecmp(type, "silver", strlen(type)) == 0) {
-					value = atoi64(sep->arg[2]) * 100;
-				}
-				else if (strncasecmp(type, "gold", strlen(type)) == 0) {
-					value = atoi64(sep->arg[2]) * 10000;
-				}
-				else if (strncasecmp(type, "plat", strlen(type)) == 0) {
-					value = atoi64(sep->arg[2]) * 1000000;
-				}
-				player->AddCoins(value);
-				
-				if (client->GetPlayer() == player)
-					client->Message(CHANNEL_COLOR_YELLOW, "You give yourself %llu coin%s", value, (value > 1 ? "s" : ""));
-				else {
-					client->Message(CHANNEL_COLOR_YELLOW, "You give %s %llu coin%s", player->GetName(), value, (value > 1 ? "s" : ""));
-					client->GetCurrentZone()->GetClientBySpawn(player)->Message(CHANNEL_COLOR_YELLOW, "%s gave you %llu coin%s", client->GetPlayer()->GetName(), value, (value > 1 ? "s" : ""));
-				}
-				return;
-			}
-		}
-	}
-
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, " -- /player coins syntax --");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/player coins add [value] - adds the given number of coins to the player");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/player coins add copper [value] - adds the given amount of copper to the player");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/player coins add silver [value] - adds the given amount of silver to the player");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/player coins add gold [value] - adds the given amount of gold to the player");
-	client->SimpleMessage(CHANNEL_COLOR_YELLOW, "/player coins add plat [value] - adds the given amount of platinum to the player");
-}
-
-void Commands::Command_AchievementAdd(Client* client, Seperator* sep) {
-	PrintSep(sep, "ACHIEVEMENT_ADD");
-	if (sep && sep->IsSet(0)) {
-		int32 spell_id = atoul(sep->arg[1]);
-		int8 spell_tier = 0;
-		spell_tier = client->GetPlayer()->GetSpellTier(spell_id);
-		AltAdvanceData* data = master_aa_list.GetAltAdvancement(spell_id);
-		// addspellbookentry here
-		if (spell_tier >= data->maxRank) {
-			return;
-		}
-		if (!spell_tier) {
-			spell_tier = 1;
-		}
-		if (!client->GetPlayer()->HasSpell(spell_id, 0, true))
-		{
-			Spell* spell = master_spell_list.GetSpell(spell_id, spell_tier);
-			client->GetPlayer()->AddSpellBookEntry(spell_id, 1, client->GetPlayer()->GetFreeSpellBookSlot(spell->GetSpellData()->spell_book_type), spell->GetSpellData()->spell_book_type, spell->GetSpellData()->linked_timer, true);
-			client->GetPlayer()->UnlockSpell(spell);
-			client->SendSpellUpdate(spell);
-		}
-		else
-		{
-			Spell* spell = master_spell_list.GetSpell(spell_id, spell_tier + 1);
-			int8 old_slot = client->GetPlayer()->GetSpellSlot(spell->GetSpellID());
-			client->GetPlayer()->RemoveSpellBookEntry(spell->GetSpellID());
-			client->GetPlayer()->AddSpellBookEntry(spell->GetSpellID(), spell->GetSpellTier(), old_slot, spell->GetSpellData()->spell_book_type, spell->GetSpellData()->linked_timer, true);
-			client->GetPlayer()->UnlockSpell(spell);
-			client->SendSpellUpdate(spell);
-		}
-
-
-		// cast spell here
-		if (!spell_tier)
-			spell_tier = 1;
-		Spell* spell = master_spell_list.GetSpell(spell_id, spell_tier);
-		if (spell) {
-			client->GetCurrentZone()->ProcessSpell(spell, client->GetPlayer(), client->GetPlayer());
-		}
-	}
-	else {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage:  /useability {spell_id} [spell_tier]");
-	}
-	master_aa_list.DisplayAA(client, 0, 0);
-}
-
-void Commands::Command_Editor(Client* client, Seperator* sep) {
-	PacketStruct* packet = configReader.getStruct("WS_ChoiceWindow", client->GetVersion());
-	if (packet) {
-		string url = string(rule_manager.GetGlobalRule(R_World, EditorURL)->GetString());
-
-		if (rule_manager.GetGlobalRule(R_World, EditorOfficialServer)->GetBool()) {
-			char command[255];
-			url = "browser " + url;
-			int32 spawn_id = 0;
-			int32 zone_id = 0;
-			string type;
-
-			if (client->GetCurrentZone())
-				zone_id = client->GetCurrentZone()->GetZoneID();
-
-			if (client->GetPlayer()->GetTarget()) {
-				Spawn* target = client->GetPlayer()->GetTarget();
-				if (target->IsWidget())
-					type = "widgets";
-				else if (target->IsSign())
-					type = "signs";
-				else if (target->IsObject())
-					type = "objects";
-				else if (target->IsNPC())
-					type = "npcs";
-				else if (target->IsGroundSpawn())
-					type = "ground";
-				else
-					type = "spawn";
-
-				spawn_id = client->GetPlayer()->GetTarget()->GetDatabaseID();
-			}
-
-			sprintf(command, url.c_str(), zone_id, type.c_str(), spawn_id);
-
-			packet->setDataByName("accept_command", command);
-		}
-		else if (rule_manager.GetGlobalRule(R_World, EditorIncludeID)->GetBool()) {
-			char command[255];
-			url = "browser " + url;
-			if (client->GetPlayer()->GetTarget())
-				sprintf(command, url.c_str(), client->GetPlayer()->GetTarget()->GetDatabaseID());
-
-			packet->setDataByName("accept_command", command);
-		}
-		else {
-			string command = "browser " + url;
-			packet->setDataByName("accept_command", command.c_str());
-		}
-
-		packet->setDataByName("text", "Open the web editor?");
-		packet->setDataByName("accept_text", "Open");
-		
-		packet->setDataByName("cancel_text", "Cancel");
-		// No clue if we even need the following 2 unknowns, just added them so the packet matches what live sends
-		packet->setDataByName("unknown2", 50);
-		packet->setDataByName("unknown4", 1);
-
-		client->QueuePacket(packet->serialize());
-		safe_delete(packet);
-	}
-}
-
-void Commands::Command_AcceptResurrection(Client* client, Seperator* sep) {
-	if(!client || !sep || client->GetPlayer()->GetID() != atoul(sep->arg[0]))
-		return;
-	client->GetResurrectMutex()->writelock(__FUNCTION__, __LINE__);
-	if(client->GetCurrentRez()->active)
-		client->AcceptResurrection();
-	client->GetResurrectMutex()->releasewritelock(__FUNCTION__, __LINE__);
-}
-
-void Commands::Command_DeclineResurrection(Client* client, Seperator* sep) {
-	if(!client || !sep || client->GetPlayer()->GetID() != atoul(sep->arg[0]))
-		return;
-	client->GetResurrectMutex()->writelock(__FUNCTION__, __LINE__);
-	if(client->GetCurrentRez()->active)
-		client->GetCurrentRez()->should_delete = true;
-	client->GetResurrectMutex()->releasewritelock(__FUNCTION__, __LINE__);
-}
-void Commands::Switch_AA_Profile(Client* client, Seperator* sep) {
-	PrintSep(sep, "Switch_AA_Profile");
-		if (sep && sep->IsSet(0)) {
-		string type = sep->arg[0];
-		int8 newtemplate = atoul(sep->arg[1]);
-		master_aa_list.DisplayAA(client, newtemplate, 1);
-	}
-}
-void Commands::Get_AA_Xml(Client* client, Seperator* sep) {
-	PrintSep(sep, "Get_AA_Xml");
-	if (sep && sep->IsSet(0)) {
-		string tabnum = sep->arg[0];
-		string spellid = sep->arg[1];
-
-
-
-	}
-}
-void Commands::Add_AA(Client* client, Seperator* sep) {
-	PrintSep(sep, "Add_AA");
-	if (sep && sep->IsSet(0)) {
-		int32 spell_id = atoul(sep->arg[1]);
-		int8 spell_tier = 0;
-		spell_tier = client->GetPlayer()->GetSpellTier(spell_id);
-		AltAdvanceData* data = master_aa_list.GetAltAdvancement(spell_id);
-		// addspellbookentry here
-		if(!data) {
-		LogWrite(COMMAND__ERROR, 0, "Command", "Error in Add_AA no data for spell_id %u spell_tier %u", spell_id, spell_tier);
-			return;
-		}
-		if (spell_tier >= data->maxRank) {
-		LogWrite(COMMAND__ERROR, 0, "Command", "Error in Add_AA spell_tier %u >= maxRank %u", spell_tier, data->maxRank);
-			return;
-		}
-		if (!spell_tier) {
-			spell_tier = 1;
-		}
-		if (!client->GetPlayer()->HasSpell(spell_id, 0, true))
-		{
-			Spell* spell = master_spell_list.GetSpell(spell_id, spell_tier);
-			if(spell)
-			{
-				client->GetPlayer()->AddSpellBookEntry(spell_id, 1, client->GetPlayer()->GetFreeSpellBookSlot(spell->GetSpellData()->spell_book_type), spell->GetSpellData()->spell_book_type, spell->GetSpellData()->linked_timer, true);
-				client->GetPlayer()->UnlockSpell(spell);
-				client->SendSpellUpdate(spell);
-			}
-		}
-		else
-		{
-			Spell* spell = master_spell_list.GetSpell(spell_id, spell_tier + 1 );
-			if(spell)
-			{
-				int8 old_slot = client->GetPlayer()->GetSpellSlot(spell->GetSpellID());
-				client->GetPlayer()->RemoveSpellBookEntry(spell->GetSpellID());
-				client->GetPlayer()->AddSpellBookEntry(spell->GetSpellID(), spell->GetSpellTier(), old_slot, spell->GetSpellData()->spell_book_type, spell->GetSpellData()->linked_timer, true);
-				client->GetPlayer()->UnlockSpell(spell);
-				client->SendSpellUpdate(spell);
-			}
-		}
-		
-		
-		// cast spell here
-		if (!spell_tier)
-			spell_tier = 1;
-		Spell* spell = master_spell_list.GetSpell(spell_id, spell_tier);
-		if (spell) {
-			client->GetCurrentZone()->ProcessSpell(spell, client->GetPlayer(), client->GetPlayer());
-		}
-	}
-	else {
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage:  /useability {spell_id} [spell_tier]");
-	}
-	master_aa_list.DisplayAA(client, 0, 0);
-}
-void Commands::Commit_AA_Profile(Client* client, Seperator* sep) {
-	PrintSep(sep, "Commit_AA_Profile");
-	if (sep && sep->IsSet(0)) {
-
-
-	}
-}
-void Commands::Begin_AA_Profile(Client* client, Seperator* sep) {
-	PrintSep(sep, "Begin_AA_Profile");
-	if (sep && sep->IsSet(0)) {
-		master_aa_list.DisplayAA(client, 100, 2);
-	}
-}
-void Commands::Back_AA(Client* client, Seperator* sep) {
-	if (sep && sep->IsSet(0)) {
-		PrintSep(sep, "Back_AA");
-
-	}
-}
-void Commands::Remove_AA(Client* client, Seperator* sep) {
-	if (sep && sep->IsSet(0)) {
-		PrintSep(sep, "Remove_AA");
-
-	}
-}
-
-void Commands::Cancel_AA_Profile(Client* client, Seperator* sep) {
-	MasterAAList master_aa_list;
-	PrintSep(sep, "Cancel_AA_Profile");
-	master_aa_list.DisplayAA(client, 0, 0);
-
-}
-void Commands::Save_AA_Profile(Client* client, Seperator* sep) {
-	if (sep && sep->IsSet(0)) {
-		PrintSep(sep, "Save_AA_Profile");
-
-	}
-}
-
-void Commands::Command_TargetItem(Client* client, Seperator* sep) {
-	if (!sep || sep->GetArgNumber() < 1 || !client->GetPlayer()) return;
-
-	if (!sep->IsNumber(0)) return;
-
-	int32 request_id = atoul(sep->arg[0]);
-
-	if (!sep->IsNumber(1)) return;
-
-	sint32 item_id = atoi(sep->arg[1]);
-
-	if (client->IsCurrentTransmuteID(request_id)) {
-		Transmute::HandleItemResponse(client, client->GetPlayer(), request_id, reinterpret_cast<int32&>(item_id));
-	}
-	else if (client->IsCurrentTransmuteID(item_id)) {
-		if (!sep->IsSet(2)) return;
-
-		if (sep->IsNumber(2) && atoi(sep->arg[2]) == 1) {
-			Transmute::HandleConfirmResponse(client, client->GetPlayer(), reinterpret_cast<int32&>(item_id));
-		}
-	}
-}
-
-void Commands::Command_FindSpawn(Client* client, Seperator* sep) {
-	if(sep)
-		client->GetCurrentZone()->FindSpawn(client, (char*)sep->argplus[0]);
-}
-
-void Commands::Command_MoveCharacter(Client* client, Seperator* sep) {
-	if(sep && sep->arg[0][0] && sep->arg[1][0])
-	{
-		char* name = sep->arg[0];
-		char* zoneName = sep->arg[1];
-		
-		char query[256];
-		snprintf(query, 256, "UPDATE characters c, zones z set c.x = z.safe_x, c.y = z.safe_y, c.z = z.safe_z, c.heading = z.safe_heading, c.current_zone_id = z.id where c.name = '%s' and z.name='%s'", name, zoneName);
-		if (database.RunQuery(query, strnlen(query, 256)))
-		{
-			client->Message(CHANNEL_COLOR_YELLOW, "Ran query:%s", query);
-		}
-		else
-			client->Message(CHANNEL_COLOR_RED, "Query FAILED to run: %s", query);
-	}
-}
-
-void Commands::Command_Mood(Client* client, Seperator* sep) {
-Player* player = client->GetPlayer();
-
-	if( sep && sep->arg[0] )
-	{
-		const char* value = sep->arg[0];
-		InfoStruct* info = player->GetInfoStruct();
-		int32 cid = client->GetCharacterID();
-		char* characterName = database.GetCharacterName( cid );
-		char tmp[1024];
-		//char properties vals
-		char* pname = "mood";
-		char* pval; // mood value
-		bool pt;
-
-		//give us some sorta default.
-		sprintf(tmp, "Bogus");	
-		if( strncasecmp(value, "angry", strlen(value)) == 0 ) 
-		{
-			sprintf(tmp, "%s appears angry", characterName);
-			pval = "11852";
-			player->SetMoodState(11852, 1);
-			info->set_mood(11852);
-			pt = database.insertCharacterProperty(client, pname, pval);
-		}
-		else if( strncasecmp(value, "afraid", strlen(value)) == 0 ) 
-		{
-			sprintf(tmp, "%s appears afraid", characterName);
-			pval = "11851";
-			player->SetMoodState(11851, 1);
-			info->set_mood(11851);
-			pt = database.insertCharacterProperty(client, pname, pval);
-		} 
-		else if( strncasecmp(value, "happy", strlen(value)) == 0 ) 
-		{
-			sprintf(tmp, "%s appears happy", characterName);
-			pval = "11854";
-			player->SetMoodState(11854, 1);
-			info->set_mood(11854);
-			pt = database.insertCharacterProperty(client, pname, pval);
-		} 
-		else if( strncasecmp(value, "sad", strlen(value)) == 0 ) {
-			sprintf(tmp, "%s appears sad", characterName);
-			pval = "11856";
-			player->SetMoodState(11856, 1);
-			info->set_mood(11856);
-			pt = database.insertCharacterProperty(client, pname, pval);
-		}
-		else if( strncasecmp(value, "tired", strlen(value)) == 0 ) 
-		{
-			sprintf(tmp, "%s appears tired", characterName);
-			pval = "11857";
-			player->SetMoodState(11857, 1);
-			info->set_mood(11857);
-			pt = database.insertCharacterProperty(client, pname, pval);
-		}
-		else if( strncasecmp(value, "none", strlen(value)) == 0 ) 
-		{
-			//using 11855 mood_idle for none, I assume thats what its for?
-			pval = "11855";
-			player->SetMoodState(11855, 1);
-			info->set_mood(11855);
-			pt = database.insertCharacterProperty(client, pname, pval);
-		}else{
-			client->SimpleMessage(CHANNEL_NARRATIVE, "Listing Available Moods:");
-			client->SimpleMessage(CHANNEL_NARRATIVE, "none");
-			client->SimpleMessage(CHANNEL_NARRATIVE, "afraid");
-			client->SimpleMessage(CHANNEL_NARRATIVE, "angry");
-			client->SimpleMessage(CHANNEL_NARRATIVE, "happy");
-			client->SimpleMessage(CHANNEL_NARRATIVE, "sad");
-			client->SimpleMessage(CHANNEL_NARRATIVE, "tired");
-			return;
-			}
-			
-		client->GetPlayer()->GetZone()->HandleChatMessage(0, 0, CHANNEL_EMOTE, tmp);
-		return;
-	}
-	
-	client->SimpleMessage(CHANNEL_NARRATIVE, "Listing Available Moods:");
-	client->SimpleMessage(CHANNEL_NARRATIVE, "none");
-	client->SimpleMessage(CHANNEL_NARRATIVE, "afraid");
-	client->SimpleMessage(CHANNEL_NARRATIVE, "angry");
-	client->SimpleMessage(CHANNEL_NARRATIVE, "happy");
-	client->SimpleMessage(CHANNEL_NARRATIVE, "sad");
-	client->SimpleMessage(CHANNEL_NARRATIVE, "tired");
-	return;
-}

+ 0 - 3462
EQ2EMu/EQ2/source/WorldServer/Entity.cpp

@@ -1,3462 +0,0 @@
-/*  
-    EQ2Emulator:  Everquest II Server Emulator
-    Copyright (C) 2007  EQ2EMulator Development Team (http://www.eq2emulator.net)
-
-    This file is part of EQ2Emulator.
-
-    EQ2Emulator is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    EQ2Emulator is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with EQ2Emulator.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "Entity.h"
-#include <math.h>
-#include "Items/Items.h"
-#include "zoneserver.h"
-#include "World.h"
-#include "../common/Log.h"
-#include "Spells.h"
-#include "SpellProcess.h"
-#include "classes.h"
-#include "LuaInterface.h"
-#include "ClientPacketFunctions.h"
-#include "Skills.h"
-#include "Rules/Rules.h"
-#include "LuaInterface.h"
-
-extern World world;
-extern MasterItemList master_item_list;
-extern MasterSpellList master_spell_list;
-extern MasterSkillList master_skill_list;
-extern RuleManager rule_manager;
-extern Classes classes;
-extern LuaInterface* lua_interface;
-
-Entity::Entity(){
-	MapInfoStruct();	
-	max_speed = 6;
-	base_speed = 0.0f;
-	last_x = -1;
-	last_y = -1;
-	last_z = -1;
-	last_heading = -1;
-	regen_hp_rate = 0;
-	regen_power_rate = 0;
-	in_combat = false;
-	casting = false;
-	memset(&melee_combat_data, 0, sizeof(CombatData));
-	memset(&ranged_combat_data, 0, sizeof(CombatData));
-	//memset(&info_struct, 0, sizeof(InfoStruct));
-	memset(&features, 0, sizeof(CharFeatures));
-	memset(&equipment, 0, sizeof(EQ2_Equipment));
-	pet = 0;
-	charmedPet = 0;
-	deityPet = 0;
-	cosmeticPet = 0;
-	speed = 0;
-	speed_multiplier = 1.0f;
-	m_threatTransfer = 0;
-	group_member_info = 0;
-	trade = 0;
-	deity = 0;
-	MProcList.SetName("Entity::m_procList");
-	MDetriments.SetName("Entity::MDetriments");
-	MMaintainedSpells.SetName("Entity::MMaintainedSpells");
-	MSpellEffects.SetName("Entity::MSpellEffects");
-	m_procList.clear();
-	control_effects.clear();
-	for (int i = 0; i < CONTROL_MAX_EFFECTS; i++)
-		control_effects[i] = NULL;
-
-	immunities.clear();
-	
-	info_struct.ResetEffects(this);
-
-	MCommandMutex.SetName("Entity::MCommandMutex");
-	hasSeeInvisSpell = false;
-	hasSeeHideSpell = false;
-
-	owner = 0;
-	m_petType = 0;
-	m_petSpellID = 0;
-	m_petSpellTier = 0;
-	m_petDismissing = false;
-}
-
-Entity::~Entity(){
-	MutexList<BonusValues*>::iterator itr2 = bonus_list.begin();
-	while(itr2.Next())
-		safe_delete(itr2.value);
-	ClearProcs();
-	safe_delete(m_threatTransfer);
-	map<int8, MutexList<LuaSpell*>*>::iterator itr3;
-	for (itr3 = control_effects.begin(); itr3 != control_effects.end(); itr3++)
-		safe_delete(itr3->second);
-	control_effects.clear();
-	map<int8, MutexList<LuaSpell*>*>::iterator itr4;
-	for (itr4 = immunities.begin(); itr4 != immunities.end(); itr4++)
-		safe_delete(itr4->second);
-	immunities.clear();
-	if(!IsPlayer())
-		DeleteSpellEffects();
-}
-
-void Entity::DeleteSpellEffects(bool removeClient)
-{
-	map<LuaSpell*,bool> deletedPtrs;
-
-	for(int i=0;i<45;i++){
-		if(i<30){
-			if(GetInfoStruct()->maintained_effects[i].spell_id != 0xFFFFFFFF)
-			{
-				if(deletedPtrs.find(GetInfoStruct()->spell_effects[i].spell) == deletedPtrs.end())
-				{
-					lua_interface->RemoveSpell(GetInfoStruct()->maintained_effects[i].spell, false, removeClient, "", removeClient);
-					if (IsPlayer())
-						GetInfoStruct()->maintained_effects[i].icon = 0xFFFF;
-
-					deletedPtrs[GetInfoStruct()->maintained_effects[i].spell] = true;
-				}
-				
-				GetInfoStruct()->maintained_effects[i].spell_id = 0xFFFFFFFF;
-				GetInfoStruct()->maintained_effects[i].spell = nullptr;
-			}
-		}
-		if(GetInfoStruct()->spell_effects[i].spell_id != 0xFFFFFFFF)
-		{
-			GetInfoStruct()->spell_effects[i].spell_id = 0xFFFFFFFF;
-			GetInfoStruct()->spell_effects[i].spell = nullptr;
-		}
-	}
-}
-
-void Entity::RemoveSpells()
-{
-	
-	for(int i=0;i<45;i++){
-		if(i<30){
-			if(GetInfoStruct()->maintained_effects[i].spell_id != 0xFFFFFFFF)
-			{
-				GetZone()->GetSpellProcess()->AddSpellCancel(GetInfoStruct()->maintained_effects[i].spell);
-			}
-		}
-		if(GetInfoStruct()->spell_effects[i].spell_id != 0xFFFFFFFF)
-		{
-			RemoveSpellEffect(GetInfoStruct()->spell_effects[i].spell);
-		}
-	}
-}
-
-void Entity::MapInfoStruct()
-{
-/** GETS **/
-	get_string_funcs["name"] = l::bind(&InfoStruct::get_name, &info_struct);
-	get_int8_funcs["class1"] = l::bind(&InfoStruct::get_class1, &info_struct);
-	get_int8_funcs["class2"] = l::bind(&InfoStruct::get_class2, &info_struct);
-	get_int8_funcs["class3"] = l::bind(&InfoStruct::get_class3, &info_struct);
-	get_int8_funcs["race"] = l::bind(&InfoStruct::get_race, &info_struct);
-	get_int8_funcs["gender"] = l::bind(&InfoStruct::get_gender, &info_struct);
-	get_int16_funcs["level"] = l::bind(&InfoStruct::get_level, &info_struct);
-	get_int16_funcs["max_level"] = l::bind(&InfoStruct::get_max_level, &info_struct);
-	get_int16_funcs["effective_level"] = l::bind(&InfoStruct::get_effective_level, &info_struct);
-	get_int16_funcs["tradeskill_level"] = l::bind(&InfoStruct::get_tradeskill_level, &info_struct);
-	get_int16_funcs["tradeskill_max_level"] = l::bind(&InfoStruct::get_tradeskill_max_level, &info_struct);
-	get_int8_funcs["cur_concentration"] = l::bind(&InfoStruct::get_cur_concentration, &info_struct);
-	get_int8_funcs["max_concentration"] = l::bind(&InfoStruct::get_max_concentration, &info_struct);
-	get_int16_funcs["cur_attack"] = l::bind(&InfoStruct::get_cur_attack, &info_struct);
-	get_int16_funcs["attack_base"] = l::bind(&InfoStruct::get_attack_base, &info_struct);
-	get_int16_funcs["cur_mitigation"] = l::bind(&InfoStruct::get_cur_mitigation, &info_struct);
-	get_int16_funcs["max_mitigation"] = l::bind(&InfoStruct::get_max_mitigation, &info_struct);
-	get_int16_funcs["mitigation_base"] = l::bind(&InfoStruct::get_mitigation_base, &info_struct);
-	get_int16_funcs["avoidance_display"] = l::bind(&InfoStruct::get_avoidance_display, &info_struct);
-	get_float_funcs["cur_avoidance"] = l::bind(&InfoStruct::get_cur_avoidance, &info_struct);
-	get_int16_funcs["base_avoidance_pct"] = l::bind(&InfoStruct::get_base_avoidance_pct, &info_struct);
-	get_int16_funcs["avoidance_base"] = l::bind(&InfoStruct::get_avoidance_base, &info_struct);
-	get_int16_funcs["max_avoidance"] = l::bind(&InfoStruct::get_max_avoidance, &info_struct);
-	get_float_funcs["parry"] = l::bind(&InfoStruct::get_parry, &info_struct);
-	get_float_funcs["parry_base"] = l::bind(&InfoStruct::get_parry_base, &info_struct);
-	get_float_funcs["deflection"] = l::bind(&InfoStruct::get_deflection, &info_struct);
-	get_int16_funcs["deflection_base"] = l::bind(&InfoStruct::get_deflection_base, &info_struct);
-	get_float_funcs["block"] = l::bind(&InfoStruct::get_block, &info_struct);
-	get_int16_funcs["block_base"] = l::bind(&InfoStruct::get_block_base, &info_struct);
-	get_float_funcs["str"] = l::bind(&InfoStruct::get_str, &info_struct);
-	get_float_funcs["sta"] = l::bind(&InfoStruct::get_sta, &info_struct);
-	get_float_funcs["agi"] = l::bind(&InfoStruct::get_agi, &info_struct);
-	get_float_funcs["wis"] = l::bind(&InfoStruct::get_wis, &info_struct);
-	get_float_funcs["intel"] = l::bind(&InfoStruct::get_intel, &info_struct);
-	get_float_funcs["str_base"] = l::bind(&InfoStruct::get_str_base, &info_struct);
-	get_float_funcs["sta_base"] = l::bind(&InfoStruct::get_sta_base, &info_struct);
-	get_float_funcs["agi_base"] = l::bind(&InfoStruct::get_agi_base, &info_struct);
-	get_float_funcs["wis_base"] = l::bind(&InfoStruct::get_wis_base, &info_struct);
-	get_float_funcs["intel_base"] = l::bind(&InfoStruct::get_intel_base, &info_struct);
-	get_int16_funcs["heat"] = l::bind(&InfoStruct::get_heat, &info_struct);
-	get_int16_funcs["cold"] = l::bind(&InfoStruct::get_cold, &info_struct);
-	get_int16_funcs["magic"] = l::bind(&InfoStruct::get_magic, &info_struct);
-	get_int16_funcs["mental"] = l::bind(&InfoStruct::get_mental, &info_struct);
-	get_int16_funcs["divine"] = l::bind(&InfoStruct::get_divine, &info_struct);
-	get_int16_funcs["disease"] = l::bind(&InfoStruct::get_disease, &info_struct);
-	get_int16_funcs["poison"] = l::bind(&InfoStruct::get_poison, &info_struct);
-	get_int16_funcs["disease_base"] = l::bind(&InfoStruct::get_disease_base, &info_struct);
-	get_int16_funcs["cold_base"] = l::bind(&InfoStruct::get_cold_base, &info_struct);
-	get_int16_funcs["divine_base"] = l::bind(&InfoStruct::get_divine_base, &info_struct);
-	get_int16_funcs["magic_base"] = l::bind(&InfoStruct::get_magic_base, &info_struct);
-	get_int16_funcs["mental_base"] = l::bind(&InfoStruct::get_mental_base, &info_struct);
-	get_int16_funcs["heat_base"] = l::bind(&InfoStruct::get_heat_base, &info_struct);
-	get_int16_funcs["poison_base"] = l::bind(&InfoStruct::get_poison_base, &info_struct);
-	get_int16_funcs["elemental_base"] = l::bind(&InfoStruct::get_elemental_base, &info_struct);
-	get_int16_funcs["noxious_base"] = l::bind(&InfoStruct::get_noxious_base, &info_struct);
-	get_int16_funcs["arcane_base"] = l::bind(&InfoStruct::get_arcane_base, &info_struct);
-	get_int32_funcs["coin_copper"] = l::bind(&InfoStruct::get_coin_copper, &info_struct);
-	get_int32_funcs["coin_silver"] = l::bind(&InfoStruct::get_coin_silver, &info_struct);
-	get_int32_funcs["coin_gold"] = l::bind(&InfoStruct::get_coin_gold, &info_struct);
-	get_int32_funcs["coin_plat"] = l::bind(&InfoStruct::get_coin_plat, &info_struct);
-	get_int32_funcs["bank_coin_copper"] = l::bind(&InfoStruct::get_bank_coin_copper, &info_struct);
-	get_int32_funcs["bank_coin_silver"] = l::bind(&InfoStruct::get_bank_coin_silver, &info_struct);
-	get_int32_funcs["bank_coin_gold"] = l::bind(&InfoStruct::get_bank_coin_gold, &info_struct);
-	get_int32_funcs["bank_coin_plat"] = l::bind(&InfoStruct::get_bank_coin_plat, &info_struct);
-	get_int32_funcs["status_points"] = l::bind(&InfoStruct::get_status_points, &info_struct);
-	get_string_funcs["deity"] = l::bind(&InfoStruct::get_deity, &info_struct);
-	get_int32_funcs["weight"] = l::bind(&InfoStruct::get_weight, &info_struct);
-	get_int32_funcs["max_weight"] = l::bind(&InfoStruct::get_max_weight, &info_struct);
-	get_int8_funcs["tradeskill_class1"] = l::bind(&InfoStruct::get_tradeskill_class1, &info_struct);
-	get_int8_funcs["tradeskill_class2"] = l::bind(&InfoStruct::get_tradeskill_class2, &info_struct);
-	get_int8_funcs["tradeskill_class3"] = l::bind(&InfoStruct::get_tradeskill_class3, &info_struct);
-	get_int16_funcs["account_age_base"] = l::bind(&InfoStruct::get_account_age_base, &info_struct);
-	//	int8			account_age_bonus_[19];
-	get_int16_funcs["absorb"] = l::bind(&InfoStruct::get_absorb, &info_struct);
-	get_int32_funcs["xp"] = l::bind(&InfoStruct::get_xp, &info_struct);
-	get_int32_funcs["xp_needed"] = l::bind(&InfoStruct::get_xp_needed, &info_struct);
-	get_float_funcs["xp_debt"] = l::bind(&InfoStruct::get_xp_debt, &info_struct);
-	get_int16_funcs["xp_yellow"] = l::bind(&InfoStruct::get_xp_yellow, &info_struct);
-	get_int16_funcs["xp_yellow_vitality_bar"] = l::bind(&InfoStruct::get_xp_yellow_vitality_bar, &info_struct);
-	get_int16_funcs["xp_blue_vitality_bar"] = l::bind(&InfoStruct::get_xp_blue_vitality_bar, &info_struct);
-	get_int16_funcs["xp_blue"] = l::bind(&InfoStruct::get_xp_blue, &info_struct);
-	get_int32_funcs["ts_xp"] = l::bind(&InfoStruct::get_ts_xp, &info_struct);
-	get_int32_funcs["ts_xp_needed"] = l::bind(&InfoStruct::get_ts_xp_needed, &info_struct);
-	get_int16_funcs["tradeskill_exp_yellow"] = l::bind(&InfoStruct::get_tradeskill_exp_yellow, &info_struct);
-	get_int16_funcs["tradeskill_exp_blue"] = l::bind(&InfoStruct::get_tradeskill_exp_blue, &info_struct);
-	get_int32_funcs["flags"] = l::bind(&InfoStruct::get_flags, &info_struct);
-	get_int32_funcs["flags2"] = l::bind(&InfoStruct::get_flags2, &info_struct);
-	get_float_funcs["xp_vitality"] = l::bind(&InfoStruct::get_xp_vitality, &info_struct);
-	get_float_funcs["tradeskill_xp_vitality"] = l::bind(&InfoStruct::get_tradeskill_xp_vitality, &info_struct);
-	get_int16_funcs["mitigation_skill1"] = l::bind(&InfoStruct::get_mitigation_skill1, &info_struct);
-	get_int16_funcs["mitigation_skill2"] = l::bind(&InfoStruct::get_mitigation_skill2, &info_struct);
-	get_int16_funcs["mitigation_skill3"] = l::bind(&InfoStruct::get_mitigation_skill3, &info_struct);
-	get_float_funcs["ability_modifier"] = l::bind(&InfoStruct::get_ability_modifier, &info_struct);
-	get_float_funcs["critical_mitigation"] = l::bind(&InfoStruct::get_critical_mitigation, &info_struct);
-	get_float_funcs["block_chance"] = l::bind(&InfoStruct::get_block_chance, &info_struct);
-	get_float_funcs["uncontested_parry"] = l::bind(&InfoStruct::get_uncontested_parry, &info_struct);
-	get_float_funcs["uncontested_block"] = l::bind(&InfoStruct::get_uncontested_block, &info_struct);
-	get_float_funcs["uncontested_dodge"] = l::bind(&InfoStruct::get_uncontested_dodge, &info_struct);
-	get_float_funcs["uncontested_riposte"] = l::bind(&InfoStruct::get_uncontested_riposte, &info_struct);
-	get_float_funcs["crit_chance"] = l::bind(&InfoStruct::get_crit_chance, &info_struct);
-	get_float_funcs["crit_bonus"] = l::bind(&InfoStruct::get_crit_bonus, &info_struct);
-	get_float_funcs["potency"] = l::bind(&InfoStruct::get_potency, &info_struct);
-	get_float_funcs["hate_mod"] = l::bind(&InfoStruct::get_hate_mod, &info_struct);
-	get_float_funcs["reuse_speed"] = l::bind(&InfoStruct::get_reuse_speed, &info_struct);
-	get_float_funcs["casting_speed"] = l::bind(&InfoStruct::get_casting_speed, &info_struct);
-	get_float_funcs["recovery_speed"] = l::bind(&InfoStruct::get_recovery_speed, &info_struct);
-	get_float_funcs["spell_reuse_speed"] = l::bind(&InfoStruct::get_spell_reuse_speed, &info_struct);
-	get_float_funcs["spell_multi_attack"] = l::bind(&InfoStruct::get_spell_multi_attack, &info_struct);
-	get_float_funcs["dps"] = l::bind(&InfoStruct::get_dps, &info_struct);
-	get_float_funcs["dps_multiplier"] = l::bind(&InfoStruct::get_dps_multiplier, &info_struct);
-	get_float_funcs["attackspeed"] = l::bind(&InfoStruct::get_attackspeed, &info_struct);
-	get_float_funcs["haste"] = l::bind(&InfoStruct::get_haste, &info_struct);
-	get_float_funcs["multi_attack"] = l::bind(&InfoStruct::get_multi_attack, &info_struct);
-	get_float_funcs["flurry"] = l::bind(&InfoStruct::get_flurry, &info_struct);
-	get_float_funcs["melee_ae"] = l::bind(&InfoStruct::get_melee_ae, &info_struct);
-	get_float_funcs["strikethrough"] = l::bind(&InfoStruct::get_strikethrough, &info_struct);
-	get_float_funcs["accuracy"] = l::bind(&InfoStruct::get_accuracy, &info_struct);
-	get_float_funcs["offensivespeed"] = l::bind(&InfoStruct::get_offensivespeed, &info_struct);
-	get_float_funcs["rain"] = l::bind(&InfoStruct::get_rain, &info_struct);
-	get_float_funcs["wind"] = l::bind(&InfoStruct::get_wind, &info_struct);
-	get_sint8_funcs["alignment"] = l::bind(&InfoStruct::get_alignment, &info_struct);
-	get_int32_funcs["pet_id"] = l::bind(&InfoStruct::get_pet_id, &info_struct);
-	get_string_funcs["pet_name"] = l::bind(&InfoStruct::get_pet_name, &info_struct);
-	get_float_funcs["pet_health_pct"] = l::bind(&InfoStruct::get_pet_health_pct, &info_struct);
-	get_float_funcs["pet_power_pct"] = l::bind(&InfoStruct::get_pet_power_pct, &info_struct);
-	get_int8_funcs["pet_movement"] = l::bind(&InfoStruct::get_pet_movement, &info_struct);
-	get_int8_funcs["pet_behavior"] = l::bind(&InfoStruct::get_pet_behavior, &info_struct);
-	get_int8_funcs["vision"] = l::bind(&InfoStruct::get_vision, &info_struct);
-	get_int8_funcs["breathe_underwater"] = l::bind(&InfoStruct::get_breathe_underwater, &info_struct);
-	get_string_funcs["biography"] = l::bind(&InfoStruct::get_biography, &info_struct);
-	get_float_funcs["drunk"] = l::bind(&InfoStruct::get_drunk, &info_struct);
-
-	get_sint16_funcs["power_regen"] = l::bind(&InfoStruct::get_power_regen, &info_struct);
-	get_sint16_funcs["hp_regen"] = l::bind(&InfoStruct::get_hp_regen, &info_struct);
-
-	get_int8_funcs["power_regen_override"] = l::bind(&InfoStruct::get_power_regen_override, &info_struct);
-	get_int8_funcs["hp_regen_override"] = l::bind(&InfoStruct::get_hp_regen_override, &info_struct);
-	
-	get_int8_funcs["water_type"] = l::bind(&InfoStruct::get_water_type, &info_struct);
-	get_int8_funcs["flying_type"] = l::bind(&InfoStruct::get_flying_type, &info_struct);
-	
-	get_int8_funcs["no_interrupt"] = l::bind(&InfoStruct::get_no_interrupt, &info_struct);
-
-	get_int8_funcs["interaction_flag"] = l::bind(&InfoStruct::get_interaction_flag, &info_struct);
-	get_int8_funcs["tag1"] = l::bind(&InfoStruct::get_tag1, &info_struct);
-	get_int16_funcs["mood"] = l::bind(&InfoStruct::get_mood, &info_struct);
-
-/** SETS **/
-	set_string_funcs["name"] = l::bind(&InfoStruct::set_name, &info_struct, l::_1);
-	set_int8_funcs["class1"] = l::bind(&InfoStruct::set_class1, &info_struct, l::_1);
-	set_int8_funcs["class2"] = l::bind(&InfoStruct::set_class2, &info_struct, l::_1);
-	set_int8_funcs["class3"] = l::bind(&InfoStruct::set_class3, &info_struct, l::_1);
-	set_int8_funcs["race"] = l::bind(&InfoStruct::set_race, &info_struct, l::_1);
-	set_int8_funcs["gender"] = l::bind(&InfoStruct::set_gender, &info_struct, l::_1);
-	set_int16_funcs["level"] = l::bind(&InfoStruct::set_level, &info_struct, l::_1);
-	set_int16_funcs["max_level"] = l::bind(&InfoStruct::set_max_level, &info_struct, l::_1);
-	set_int16_funcs["effective_level"] = l::bind(&InfoStruct::set_effective_level, &info_struct, l::_1);
-	set_int16_funcs["tradeskill_level"] = l::bind(&InfoStruct::set_tradeskill_level, &info_struct, l::_1);
-	set_int16_funcs["tradeskill_max_level"] = l::bind(&InfoStruct::set_tradeskill_max_level, &info_struct, l::_1);
-	set_int8_funcs["cur_concentration"] = l::bind(&InfoStruct::set_cur_concentration, &info_struct, l::_1);
-	set_int8_funcs["max_concentration"] = l::bind(&InfoStruct::set_max_concentration, &info_struct, l::_1);
-	set_int16_funcs["cur_attack"] = l::bind(&InfoStruct::set_cur_attack, &info_struct, l::_1);
-	set_int16_funcs["attack_base"] = l::bind(&InfoStruct::set_attack_base, &info_struct, l::_1);
-	set_int16_funcs["cur_mitigation"] = l::bind(&InfoStruct::set_cur_mitigation, &info_struct, l::_1);
-	set_int16_funcs["max_mitigation"] = l::bind(&InfoStruct::set_max_mitigation, &info_struct, l::_1);
-	set_int16_funcs["mitigation_base"] = l::bind(&InfoStruct::set_mitigation_base, &info_struct, l::_1);
-	set_int16_funcs["avoidance_display"] = l::bind(&InfoStruct::set_avoidance_display, &info_struct, l::_1);
-	set_float_funcs["cur_avoidance"] = l::bind(&InfoStruct::set_cur_avoidance, &info_struct, l::_1);
-	set_int16_funcs["base_avoidance_pct"] = l::bind(&InfoStruct::set_base_avoidance_pct, &info_struct, l::_1);
-	set_int16_funcs["avoidance_base"] = l::bind(&InfoStruct::set_avoidance_base, &info_struct, l::_1);
-	set_int16_funcs["max_avoidance"] = l::bind(&InfoStruct::set_max_avoidance, &info_struct, l::_1);
-	set_float_funcs["parry"] = l::bind(&InfoStruct::set_parry, &info_struct, l::_1);
-	set_float_funcs["parry_base"] = l::bind(&InfoStruct::set_parry_base, &info_struct, l::_1);
-	set_float_funcs["deflection"] = l::bind(&InfoStruct::set_deflection, &info_struct, l::_1);
-	set_int16_funcs["deflection_base"] = l::bind(&InfoStruct::set_deflection_base, &info_struct, l::_1);
-	set_float_funcs["block"] = l::bind(&InfoStruct::set_block, &info_struct, l::_1);
-	set_int16_funcs["block_base"] = l::bind(&InfoStruct::set_block_base, &info_struct, l::_1);
-	set_float_funcs["str"] = l::bind(&InfoStruct::set_str, &info_struct, l::_1);
-	set_float_funcs["sta"] = l::bind(&InfoStruct::set_sta, &info_struct, l::_1);
-	set_float_funcs["agi"] = l::bind(&InfoStruct::set_agi, &info_struct, l::_1);
-	set_float_funcs["wis"] = l::bind(&InfoStruct::set_wis, &info_struct, l::_1);
-	set_float_funcs["intel"] = l::bind(&InfoStruct::set_intel, &info_struct, l::_1);
-	set_float_funcs["str_base"] = l::bind(&InfoStruct::set_str_base, &info_struct, l::_1);
-	set_float_funcs["sta_base"] = l::bind(&InfoStruct::set_sta_base, &info_struct, l::_1);
-	set_float_funcs["agi_base"] = l::bind(&InfoStruct::set_agi_base, &info_struct, l::_1);
-	set_float_funcs["wis_base"] = l::bind(&InfoStruct::set_wis_base, &info_struct, l::_1);
-	set_float_funcs["intel_base"] = l::bind(&InfoStruct::set_intel_base, &info_struct, l::_1);
-	set_int16_funcs["heat"] = l::bind(&InfoStruct::set_heat, &info_struct, l::_1);
-	set_int16_funcs["cold"] = l::bind(&InfoStruct::set_cold, &info_struct, l::_1);
-	set_int16_funcs["magic"] = l::bind(&InfoStruct::set_magic, &info_struct, l::_1);
-	set_int16_funcs["mental"] = l::bind(&InfoStruct::set_mental, &info_struct, l::_1);
-	set_int16_funcs["divine"] = l::bind(&InfoStruct::set_divine, &info_struct, l::_1);
-	set_int16_funcs["disease"] = l::bind(&InfoStruct::set_disease, &info_struct, l::_1);
-	set_int16_funcs["poison"] = l::bind(&InfoStruct::set_poison, &info_struct, l::_1);
-	set_int16_funcs["disease_base"] = l::bind(&InfoStruct::set_disease_base, &info_struct, l::_1);
-	set_int16_funcs["cold_base"] = l::bind(&InfoStruct::set_cold_base, &info_struct, l::_1);
-	set_int16_funcs["divine_base"] = l::bind(&InfoStruct::set_divine_base, &info_struct, l::_1);
-	set_int16_funcs["magic_base"] = l::bind(&InfoStruct::set_magic_base, &info_struct, l::_1);
-	set_int16_funcs["mental_base"] = l::bind(&InfoStruct::set_mental_base, &info_struct, l::_1);
-	set_int16_funcs["heat_base"] = l::bind(&InfoStruct::set_heat_base, &info_struct, l::_1);
-	set_int16_funcs["poison_base"] = l::bind(&InfoStruct::set_poison_base, &info_struct, l::_1);
-	set_int16_funcs["elemental_base"] = l::bind(&InfoStruct::set_elemental_base, &info_struct, l::_1);
-	set_int16_funcs["noxious_base"] = l::bind(&InfoStruct::set_noxious_base, &info_struct, l::_1);
-	set_int16_funcs["arcane_base"] = l::bind(&InfoStruct::set_arcane_base, &info_struct, l::_1);
-	set_int32_funcs["coin_copper"] = l::bind(&InfoStruct::set_coin_copper, &info_struct, l::_1);
-	set_int32_funcs["coin_silver"] = l::bind(&InfoStruct::set_coin_silver, &info_struct, l::_1);
-	set_int32_funcs["coin_gold"] = l::bind(&InfoStruct::set_coin_gold, &info_struct, l::_1);
-	set_int32_funcs["coin_plat"] = l::bind(&InfoStruct::set_coin_plat, &info_struct, l::_1);
-	set_int32_funcs["bank_coin_copper"] = l::bind(&InfoStruct::set_bank_coin_copper, &info_struct, l::_1);
-	set_int32_funcs["bank_coin_silver"] = l::bind(&InfoStruct::set_bank_coin_silver, &info_struct, l::_1);
-	set_int32_funcs["bank_coin_gold"] = l::bind(&InfoStruct::set_bank_coin_gold, &info_struct, l::_1);
-	set_int32_funcs["bank_coin_plat"] = l::bind(&InfoStruct::set_bank_coin_plat, &info_struct, l::_1);
-	set_int32_funcs["status_points"] = l::bind(&InfoStruct::set_status_points, &info_struct, l::_1);
-	set_string_funcs["deity"] = l::bind(&InfoStruct::set_deity, &info_struct, l::_1);
-	set_int32_funcs["weight"] = l::bind(&InfoStruct::set_weight, &info_struct, l::_1);
-	set_int32_funcs["max_weight"] = l::bind(&InfoStruct::set_max_weight, &info_struct, l::_1);
-	set_int8_funcs["tradeskill_class1"] = l::bind(&InfoStruct::set_tradeskill_class1, &info_struct, l::_1);
-	set_int8_funcs["tradeskill_class2"] = l::bind(&InfoStruct::set_tradeskill_class2, &info_struct, l::_1);
-	set_int8_funcs["tradeskill_class3"] = l::bind(&InfoStruct::set_tradeskill_class3, &info_struct, l::_1);
-	set_int16_funcs["account_age_base"] = l::bind(&InfoStruct::set_account_age_base, &info_struct, l::_1);
-	//	int8			account_age_bonus_[19];
-	set_int16_funcs["absorb"] = l::bind(&InfoStruct::set_absorb, &info_struct, l::_1);
-	set_int32_funcs["xp"] = l::bind(&InfoStruct::set_xp, &info_struct, l::_1);
-	set_int32_funcs["xp_needed"] = l::bind(&InfoStruct::set_xp_needed, &info_struct, l::_1);
-	set_float_funcs["xp_debt"] = l::bind(&InfoStruct::set_xp_debt, &info_struct, l::_1);
-	set_int16_funcs["xp_yellow"] = l::bind(&InfoStruct::set_xp_yellow, &info_struct, l::_1);
-	set_int16_funcs["xp_yellow_vitality_bar"] = l::bind(&InfoStruct::set_xp_yellow_vitality_bar, &info_struct, l::_1);
-	set_int16_funcs["xp_blue_vitality_bar"] = l::bind(&InfoStruct::set_xp_blue_vitality_bar, &info_struct, l::_1);
-	set_int16_funcs["xp_blue"] = l::bind(&InfoStruct::set_xp_blue, &info_struct, l::_1);
-	set_int32_funcs["ts_xp"] = l::bind(&InfoStruct::set_ts_xp, &info_struct, l::_1);
-	set_int32_funcs["ts_xp_needed"] = l::bind(&InfoStruct::set_ts_xp_needed, &info_struct, l::_1);
-	set_int16_funcs["tradeskill_exp_yellow"] = l::bind(&InfoStruct::set_tradeskill_exp_yellow, &info_struct, l::_1);
-	set_int16_funcs["tradeskill_exp_blue"] = l::bind(&InfoStruct::set_tradeskill_exp_blue, &info_struct, l::_1);
-	set_int32_funcs["flags"] = l::bind(&InfoStruct::set_flags, &info_struct, l::_1);
-	set_int32_funcs["flags2"] = l::bind(&InfoStruct::set_flags2, &info_struct, l::_1);
-	set_float_funcs["xp_vitality"] = l::bind(&InfoStruct::set_xp_vitality, &info_struct, l::_1);
-	set_float_funcs["tradeskill_xp_vitality"] = l::bind(&InfoStruct::set_tradeskill_xp_vitality, &info_struct, l::_1);
-	set_int16_funcs["mitigation_skill1"] = l::bind(&InfoStruct::set_mitigation_skill1, &info_struct, l::_1);
-	set_int16_funcs["mitigation_skill2"] = l::bind(&InfoStruct::set_mitigation_skill2, &info_struct, l::_1);
-	set_int16_funcs["mitigation_skill3"] = l::bind(&InfoStruct::set_mitigation_skill3, &info_struct, l::_1);
-	set_float_funcs["ability_modifier"] = l::bind(&InfoStruct::set_ability_modifier, &info_struct, l::_1);
-	set_float_funcs["critical_mitigation"] = l::bind(&InfoStruct::set_critical_mitigation, &info_struct, l::_1);
-	set_float_funcs["block_chance"] = l::bind(&InfoStruct::set_block_chance, &info_struct, l::_1);
-	set_float_funcs["uncontested_parry"] = l::bind(&InfoStruct::set_uncontested_parry, &info_struct, l::_1);
-	set_float_funcs["uncontested_block"] = l::bind(&InfoStruct::set_uncontested_block, &info_struct, l::_1);
-	set_float_funcs["uncontested_dodge"] = l::bind(&InfoStruct::set_uncontested_dodge, &info_struct, l::_1);
-	set_float_funcs["uncontested_riposte"] = l::bind(&InfoStruct::set_uncontested_riposte, &info_struct, l::_1);
-	set_float_funcs["crit_chance"] = l::bind(&InfoStruct::set_crit_chance, &info_struct, l::_1);
-	set_float_funcs["crit_bonus"] = l::bind(&InfoStruct::set_crit_bonus, &info_struct, l::_1);
-	set_float_funcs["potency"] = l::bind(&InfoStruct::set_potency, &info_struct, l::_1);
-	set_float_funcs["hate_mod"] = l::bind(&InfoStruct::set_hate_mod, &info_struct, l::_1);
-	set_float_funcs["reuse_speed"] = l::bind(&InfoStruct::set_reuse_speed, &info_struct, l::_1);
-	set_float_funcs["casting_speed"] = l::bind(&InfoStruct::set_casting_speed, &info_struct, l::_1);
-	set_float_funcs["recovery_speed"] = l::bind(&InfoStruct::set_recovery_speed, &info_struct, l::_1);
-	set_float_funcs["spell_reuse_speed"] = l::bind(&InfoStruct::set_spell_reuse_speed, &info_struct, l::_1);
-	set_float_funcs["spell_multi_attack"] = l::bind(&InfoStruct::set_spell_multi_attack, &info_struct, l::_1);
-	set_float_funcs["dps"] = l::bind(&InfoStruct::set_dps, &info_struct, l::_1);
-	set_float_funcs["dps_multiplier"] = l::bind(&InfoStruct::set_dps_multiplier, &info_struct, l::_1);
-	set_float_funcs["attackspeed"] = l::bind(&InfoStruct::set_attackspeed, &info_struct, l::_1);
-	set_float_funcs["haste"] = l::bind(&InfoStruct::set_haste, &info_struct, l::_1);
-	set_float_funcs["multi_attack"] = l::bind(&InfoStruct::set_multi_attack, &info_struct, l::_1);
-	set_float_funcs["flurry"] = l::bind(&InfoStruct::set_flurry, &info_struct, l::_1);
-	set_float_funcs["melee_ae"] = l::bind(&InfoStruct::set_melee_ae, &info_struct, l::_1);
-	set_float_funcs["strikethrough"] = l::bind(&InfoStruct::set_strikethrough, &info_struct, l::_1);
-	set_float_funcs["accuracy"] = l::bind(&InfoStruct::set_accuracy, &info_struct, l::_1);
-	set_float_funcs["offensivespeed"] = l::bind(&InfoStruct::set_offensivespeed, &info_struct, l::_1);
-	set_float_funcs["rain"] = l::bind(&InfoStruct::set_rain, &info_struct, l::_1);
-	set_float_funcs["wind"] = l::bind(&InfoStruct::set_wind, &info_struct, l::_1);
-	set_sint8_funcs["alignment"] = l::bind(&InfoStruct::set_alignment, &info_struct, l::_1);
-	set_int32_funcs["pet_id"] = l::bind(&InfoStruct::set_pet_id, &info_struct, l::_1);
-	set_string_funcs["pet_name"] = l::bind(&InfoStruct::set_pet_name, &info_struct, l::_1);
-	set_float_funcs["pet_health_pct"] = l::bind(&InfoStruct::set_pet_health_pct, &info_struct, l::_1);
-	set_float_funcs["pet_power_pct"] = l::bind(&InfoStruct::set_pet_power_pct, &info_struct, l::_1);
-	set_int8_funcs["pet_movement"] = l::bind(&InfoStruct::set_pet_movement, &info_struct, l::_1);
-	set_int8_funcs["pet_behavior"] = l::bind(&InfoStruct::set_pet_behavior, &info_struct, l::_1);
-	set_int8_funcs["vision"] = l::bind(&InfoStruct::set_vision, &info_struct, l::_1);
-	set_int8_funcs["breathe_underwater"] = l::bind(&InfoStruct::set_breathe_underwater, &info_struct, l::_1);
-	set_string_funcs["biography"] = l::bind(&InfoStruct::set_biography, &info_struct, l::_1);
-	set_float_funcs["drunk"] = l::bind(&InfoStruct::set_drunk, &info_struct, l::_1);
-
-	set_sint16_funcs["power_regen"] = l::bind(&InfoStruct::set_power_regen, &info_struct, l::_1);
-	set_sint16_funcs["hp_regen"] = l::bind(&InfoStruct::set_hp_regen, &info_struct, l::_1);
-
-	set_int8_funcs["power_regen_override"] = l::bind(&InfoStruct::set_power_regen_override, &info_struct, l::_1);
-	set_int8_funcs["hp_regen_override"] = l::bind(&InfoStruct::set_hp_regen_override, &info_struct, l::_1);
-	
-	set_int8_funcs["water_type"] = l::bind(&InfoStruct::set_water_type, &info_struct, l::_1);
-	set_int8_funcs["flying_type"] = l::bind(&InfoStruct::set_flying_type, &info_struct, l::_1);
-	
-	set_int8_funcs["no_interrupt"] = l::bind(&InfoStruct::set_no_interrupt, &info_struct, l::_1);
-
-	set_int8_funcs["interaction_flag"] = l::bind(&InfoStruct::set_interaction_flag, &info_struct, l::_1);
-	set_int8_funcs["tag1"] = l::bind(&InfoStruct::set_tag1, &info_struct, l::_1);
-	set_int16_funcs["mood"] = l::bind(&InfoStruct::set_mood, &info_struct, l::_1);
-
-}
-
-bool Entity::HasMoved(bool include_heading){
-	if(GetX() == last_x && GetY() == last_y && GetZ() == last_z && ((!include_heading) || (include_heading && GetHeading() == last_heading)))
-		return false;
-	bool ret_val = true;
-	if(last_x == -1 && last_y == -1 && last_z == -1 && last_heading == -1){
-		ret_val = false;
-	}
-	last_x = GetX();
-	last_y = GetY();
-	last_z = GetZ();
-	last_heading = GetHeading();
-	return ret_val;
-}
-
-int16 Entity::GetStr(){
-	return GetInfoStruct()->get_str();
-}
-
-int16 Entity::GetSta(){
-	return GetInfoStruct()->get_sta();
-}
-
-int16 Entity::GetInt(){
-	return GetInfoStruct()->get_intel();
-}
-
-int16 Entity::GetWis(){
-	return GetInfoStruct()->get_wis();
-}
-
-int16 Entity::GetAgi(){
-	return GetInfoStruct()->get_agi();
-}
-
-int16 Entity::GetPrimaryStat(){
-	int8 base_class = classes.GetBaseClass(GetAdventureClass());
-	if (base_class == FIGHTER) 
-		return GetInfoStruct()->get_str();	
-	else if (base_class == PRIEST) 
-		return GetInfoStruct()->get_wis();
-	else if (base_class == MAGE) 
-		return GetInfoStruct()->get_intel();
-	else
-		return GetInfoStruct()->get_agi();
-}
-
-int16 Entity::GetHeatResistance(){
-	return GetInfoStruct()->get_heat();
-}
-
-int16 Entity::GetColdResistance(){
-	return GetInfoStruct()->get_cold();
-}
-
-int16 Entity::GetMagicResistance(){
-	return GetInfoStruct()->get_magic();
-}
-
-int16 Entity::GetMentalResistance(){
-	return GetInfoStruct()->get_mental();
-}
-
-int16 Entity::GetDivineResistance(){
-	return GetInfoStruct()->get_divine();
-}
-
-int16 Entity::GetDiseaseResistance(){
-	return GetInfoStruct()->get_disease();
-}
-
-int16 Entity::GetPoisonResistance(){
-	return GetInfoStruct()->get_poison();
-}
-
-int8 Entity::GetConcentrationCurrent() {
-	return GetInfoStruct()->get_cur_concentration();
-}
-
-int8 Entity::GetConcentrationMax() {
-	return GetInfoStruct()->get_max_concentration();
-}
-
-int16 Entity::GetStrBase(){
-	return GetInfoStruct()->get_str_base();
-}
-
-int16 Entity::GetStaBase(){
-	return GetInfoStruct()->get_sta_base();
-}
-
-int16 Entity::GetIntBase(){
-	return GetInfoStruct()->get_intel_base();
-}
-
-int16 Entity::GetWisBase(){
-	return GetInfoStruct()->get_wis_base();
-}
-
-int16 Entity::GetAgiBase(){
-	return GetInfoStruct()->get_agi_base();
-}
-
-int16 Entity::GetHeatResistanceBase(){
-	return GetInfoStruct()->get_heat_base();
-}
-
-int16 Entity::GetColdResistanceBase(){
-	return GetInfoStruct()->get_cold_base();
-}
-
-int16 Entity::GetMagicResistanceBase(){
-	return GetInfoStruct()->get_magic_base();
-}
-
-int16 Entity::GetMentalResistanceBase(){
-	return GetInfoStruct()->get_mental_base();
-}
-
-int16 Entity::GetDivineResistanceBase(){
-	return GetInfoStruct()->get_divine_base();
-}
-
-int16 Entity::GetDiseaseResistanceBase(){
-	return GetInfoStruct()->get_disease_base();
-}
-
-int16 Entity::GetPoisonResistanceBase(){
-	return GetInfoStruct()->get_poison_base();
-}
-
-sint8 Entity::GetAlignment(){
-	return GetInfoStruct()->get_alignment();
-}
-
-bool Entity::IsCasting(){
-	return casting;
-}
-
-void Entity::IsCasting(bool val){
-	casting = val;
-}
-
-int32 Entity::GetRangeLastAttackTime(){
-	return ranged_combat_data.range_last_attack_time;
-}
-
-void Entity::SetRangeLastAttackTime(int32 time){
-	ranged_combat_data.range_last_attack_time = time;
-}
-
-int16 Entity::GetRangeAttackDelay(){
-	return ranged_combat_data.ranged_attack_delay;
-//	if(IsPlayer()){
-//		Item* item = ((Player*)this)->GetEquipmentList()->GetItem(EQ2_RANGE_SLOT);
-//		if(item && item->IsRanged())
-//			return item->ranged_info->weapon_info.delay*100;
-//	}
-//	return 3000;
-}
-
-int32 Entity::GetPrimaryLastAttackTime(){
-	return melee_combat_data.primary_last_attack_time;
-}
-
-int16 Entity::GetPrimaryAttackDelay(){
-	return melee_combat_data.primary_attack_delay;
-}
-
-void Entity::SetPrimaryAttackDelay(int16 new_delay){
-	melee_combat_data.primary_attack_delay = new_delay;
-}
-
-void Entity::SetPrimaryLastAttackTime(int32 new_time){
-	melee_combat_data.primary_last_attack_time = new_time;
-}
-
-int32 Entity::GetSecondaryLastAttackTime(){
-	return melee_combat_data.secondary_last_attack_time;
-}
-
-int16 Entity::GetSecondaryAttackDelay(){
-	return melee_combat_data.secondary_attack_delay;
-}
-
-void Entity::SetSecondaryAttackDelay(int16 new_delay){
-	melee_combat_data.secondary_attack_delay = new_delay;
-}
-
-void Entity::SetSecondaryLastAttackTime(int32 new_time){
-	melee_combat_data.secondary_last_attack_time = new_time;
-}
-
-void Entity::ChangePrimaryWeapon(){
-	Item* item = equipment_list.GetItem(EQ2_PRIMARY_SLOT);
-	if(item && item->details.item_id > 0 && item->IsWeapon()){
-		melee_combat_data.primary_weapon_delay = item->weapon_info->delay * 100;
-		melee_combat_data.primary_weapon_damage_low = item->weapon_info->damage_low3;
-		melee_combat_data.primary_weapon_damage_high = item->weapon_info->damage_high3;
-		melee_combat_data.primary_weapon_type = item->GetWeaponType();
-		melee_combat_data.wield_type = item->weapon_info->wield_type;
-	}
-	else{
-		int16 effective_level = GetInfoStruct()->get_effective_level();
-		if ( !effective_level )
-			effective_level = GetLevel();
-
-		melee_combat_data.primary_weapon_delay = 2000;
-		melee_combat_data.primary_weapon_damage_low = (int32)(1 + effective_level * .2);
-		melee_combat_data.primary_weapon_damage_high = (int32)(5 + effective_level * (effective_level/5));
-		if(IsNPC())
-			melee_combat_data.primary_weapon_type = ((NPC*)this)->GetAttackType();
-		else
-			melee_combat_data.primary_weapon_type = 1;
-		melee_combat_data.wield_type = 2;
-	}
-	if(IsNPC())
-		melee_combat_data.primary_weapon_damage_high += (int32)(GetInfoStruct()->get_str() / 10);
-	else
-		melee_combat_data.primary_weapon_damage_high += (int32)(GetInfoStruct()->get_str() / 25);
-}
-
-void Entity::ChangeSecondaryWeapon(){
-	Item* item = equipment_list.GetItem(EQ2_SECONDARY_SLOT);
-	if(item && item->details.item_id > 0 && item->IsWeapon()){
-		melee_combat_data.secondary_weapon_delay = item->weapon_info->delay * 100;
-		melee_combat_data.secondary_weapon_damage_low = item->weapon_info->damage_low3;
-		melee_combat_data.secondary_weapon_damage_high = item->weapon_info->damage_high3;
-		melee_combat_data.secondary_weapon_type = item->GetWeaponType();
-	}
-	else{
-		int16 effective_level = GetInfoStruct()->get_effective_level();
-		if ( !effective_level )
-			effective_level = GetLevel();
-
-		melee_combat_data.secondary_weapon_delay = 2000;
-		melee_combat_data.secondary_weapon_damage_low = (int32)(1 + effective_level * .2);
-		melee_combat_data.secondary_weapon_damage_high = (int32)(5 + effective_level * (effective_level/6));
-		melee_combat_data.secondary_weapon_type = 1;
-	}
-	if(IsNPC())
-		melee_combat_data.secondary_weapon_damage_high += (int32)(GetInfoStruct()->get_str() / 10);
-	else
-		melee_combat_data.secondary_weapon_damage_high += (int32)(GetInfoStruct()->get_str() / 25);
-}
-
-void Entity::ChangeRangedWeapon(){
-	Item* item = equipment_list.GetItem(EQ2_RANGE_SLOT);
-	if(item && item->details.item_id > 0 && item->IsRanged()){
-		ranged_combat_data.ranged_weapon_delay = item->ranged_info->weapon_info.delay*100;
-		ranged_combat_data.ranged_weapon_damage_low = item->ranged_info->weapon_info.damage_low3;
-		ranged_combat_data.ranged_weapon_damage_high = item->ranged_info->weapon_info.damage_high3;
-		ranged_combat_data.ranged_weapon_type = item->GetWeaponType();
-	}
-}
-
-int32 Entity::GetPrimaryWeaponMinDamage(){
-	return melee_combat_data.primary_weapon_damage_low;
-}
-
-int32 Entity::GetPrimaryWeaponMaxDamage(){
-	return melee_combat_data.primary_weapon_damage_high;
-}
-
-int32 Entity::GetSecondaryWeaponMinDamage(){
-	return melee_combat_data.secondary_weapon_damage_low;
-}
-
-int32 Entity::GetSecondaryWeaponMaxDamage(){
-	return melee_combat_data.secondary_weapon_damage_high;
-}
-
-int8 Entity::GetPrimaryWeaponType(){
-	return melee_combat_data.primary_weapon_type;
-}
-
-int8 Entity::GetSecondaryWeaponType(){
-	return melee_combat_data.secondary_weapon_type;
-}
-
-int32 Entity::GetRangedWeaponMinDamage(){
-	return ranged_combat_data.ranged_weapon_damage_low;
-}
-
-int32 Entity::GetRangedWeaponMaxDamage(){
-	return ranged_combat_data.ranged_weapon_damage_high;
-}
-
-int8 Entity::GetRangedWeaponType(){
-	return ranged_combat_data.ranged_weapon_type;
-}
-
-bool Entity::IsDualWield(){
-	return melee_combat_data.wield_type == 1;
-}
-
-int8 Entity::GetWieldType(){
-	return melee_combat_data.wield_type;
-}
-
-bool Entity::BehindTarget(Spawn* target){
-	return BehindSpawn(target, GetX(), GetZ());
-}
-
-bool Entity::FlankingTarget(Spawn* target) {
-	return IsFlankingSpawn(target, GetX(), GetZ());
-}
-
-float Entity::GetDodgeChance(){
-	float ret = 0;
-	
-	return ret;
-}
-
-bool Entity::EngagedInCombat(){
-	return in_combat;
-}
-
-void Entity::InCombat(bool val){
-	bool changeCombatState = false;
-	if((in_combat && !val) || (!in_combat && val))
-		changeCombatState = true;
-
-	in_combat = val;
-
-	if(changeCombatState)
-		SetRegenValues(GetInfoStruct()->get_effective_level());
-}
-
-void Entity::DoRegenUpdate(){
-	if(GetHP() == 0)//dead
-		return;
-	sint32 hp = GetHP();
-	sint32 power = GetPower();
-
-	if(hp < GetTotalHP()){
-		sint16 temp = GetInfoStruct()->get_hp_regen();
-
-		if((hp + temp) > GetTotalHP())
-			SetHP(GetTotalHP());
-		else
-			SetHP(hp + temp);
-	}
-	if(GetPower() < GetTotalPower()){
-		sint16 temp = GetInfoStruct()->get_power_regen();
-		
-		if((power + temp) > GetTotalPower())
-			SetPower(GetTotalPower());
-		else
-			SetPower(power + temp);
-	}
-}
-
-void Entity::AddMaintainedSpell(LuaSpell* luaspell){
-	if (!luaspell)
-		return;
-
-	Spell* spell = luaspell->spell;
-	MaintainedEffects* effect = GetFreeMaintainedSpellSlot();
-
-	if (effect){
-		MMaintainedSpells.writelock(__FUNCTION__, __LINE__);
-		effect->spell = luaspell;
-		effect->spell_id = spell->GetSpellData()->id;
-		LogWrite(NPC__SPELLS, 5, "NPC", "AddMaintainedSpell Spell ID: %u, Concentration: %u", spell->GetSpellData()->id, spell->GetSpellData()->req_concentration);
-		effect->conc_used = spell->GetSpellData()->req_concentration;
-		effect->total_time = spell->GetSpellDuration() / 10;
-		effect->tier = spell->GetSpellData()->tier;
-		if (spell->GetSpellData()->duration_until_cancel)
-			effect->expire_timestamp = 0xFFFFFFFF;
-		else
-			effect->expire_timestamp = Timer::GetCurrentTime2() + (spell->GetSpellDuration() * 100);
-		MMaintainedSpells.releasewritelock(__FUNCTION__, __LINE__);
-	}
-}
-
-void Entity::AddSpellEffect(LuaSpell* luaspell, int32 override_expire_time){
-	if (!luaspell || !luaspell->caster)
-		return;
-
-	Spell* spell = luaspell->spell;
-	SpellEffects* old_effect = GetSpellEffect(spell->GetSpellID(), luaspell->caster);
-	SpellEffects* effect = 0;
-	if (old_effect){
-		GetZone()->RemoveTargetFromSpell(old_effect->spell, this);
-		RemoveSpellEffect(old_effect->spell);
-	}
-	
-	LogWrite(SPELL__DEBUG, 0, "Spell", "%s AddSpellEffect %s (%u).", spell->GetName(), GetName(), GetID());
-	
-	if(!effect)
-		effect = GetFreeSpellEffectSlot();
-
-	if(effect){
-		MSpellEffects.writelock(__FUNCTION__, __LINE__);
-		effect->spell = luaspell;
-		effect->spell_id = spell->GetSpellData()->id;
-		effect->caster = luaspell->caster;
-		effect->total_time = spell->GetSpellDuration()/10;
-		if (spell->GetSpellData()->duration_until_cancel)
-			effect->expire_timestamp = 0xFFFFFFFF;
-		else if(override_expire_time)
-			effect->expire_timestamp = Timer::GetCurrentTime2() + override_expire_time;
-		else
-			effect->expire_timestamp = Timer::GetCurrentTime2() + (spell->GetSpellDuration()*100);
-		effect->icon = spell->GetSpellData()->icon;
-		effect->icon_backdrop = spell->GetSpellData()->icon_backdrop;
-		effect->tier = spell->GetSpellTier();
-		MSpellEffects.releasewritelock(__FUNCTION__, __LINE__);
-		changed = true;
-		info_changed = true;
-		AddChangedZoneSpawn();
-
-		if(luaspell->caster && luaspell->caster->IsPlayer() && luaspell->caster != this)
-			((Player*)luaspell->caster)->GetClient()->TriggerSpellSave();
-	}
-}
-
-void Entity::RemoveMaintainedSpell(LuaSpell* luaspell){
-	if (!luaspell)
-		return;
-
-	bool found = false;
-	MMaintainedSpells.writelock(__FUNCTION__, __LINE__);
-	for (int i = 0; i<30; i++){
-		// If we already found the spell then we are bumping all other up one so there are no gaps
-		// This check needs to be first so found can never be true on the first iteration (i = 0)
-		if (found) {
-			GetInfoStruct()->maintained_effects[i].slot_pos = i - 1;
-			GetInfoStruct()->maintained_effects[i - 1] = GetInfoStruct()->maintained_effects[i];
-
-		}
-		// Compare spells, if we found a match set the found flag
-		if (GetInfoStruct()->maintained_effects[i].spell == luaspell)
-			found = true;
-
-	}
-	// if we found the spell in the array then we need to set the last element to empty
-	if (found) {
-		memset(&GetInfoStruct()->maintained_effects[29], 0, sizeof(MaintainedEffects));
-		GetInfoStruct()->maintained_effects[29].spell_id = 0xFFFFFFFF;
-		GetInfoStruct()->maintained_effects[29].icon = 0xFFFF;
-		GetInfoStruct()->maintained_effects[29].spell = nullptr;
-	}
-	MMaintainedSpells.releasewritelock(__FUNCTION__, __LINE__);
-}
-
-void Entity::RemoveSpellEffect(LuaSpell* spell) {
-	bool found = false;
-	MSpellEffects.writelock(__FUNCTION__, __LINE__);
-	for(int i=0;i<45;i++) {
-		if (found) {
-			GetInfoStruct()->spell_effects[i-1] = GetInfoStruct()->spell_effects[i];
-		}
-		if (GetInfoStruct()->spell_effects[i].spell == spell)
-			found = true;
-	}
-	if (found) {
-		LogWrite(SPELL__DEBUG, 0, "Spell", "%s RemoveSpellEffect %s (%u).", spell->spell->GetName(), GetName(), GetID());
-		GetZone()->GetSpellProcess()->RemoveTargetFromSpell(spell, this);
-		memset(&GetInfoStruct()->spell_effects[44], 0, sizeof(SpellEffects));
-		GetInfoStruct()->spell_effects[44].spell_id = 0xFFFFFFFF;
-		changed = true;
-		info_changed = true;
-		AddChangedZoneSpawn();
-	}
-	MSpellEffects.releasewritelock(__FUNCTION__, __LINE__);
-}
-
-bool Entity::HasActiveMaintainedSpell(Spell* spell, Spawn* target){
-	LogWrite(MISC__TODO, 1, "TODO", "This does nothing... yet...\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-	return false;
-}
-
-bool Entity::HasActiveSpellEffect(Spell* spell, Spawn* target){
-	LogWrite(MISC__TODO, 1, "TODO", "This does nothing... yet...\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-	return false;
-}
-
-MaintainedEffects* Entity::GetFreeMaintainedSpellSlot(){
-	MaintainedEffects* ret = 0;
-	InfoStruct* info = GetInfoStruct();
-	MMaintainedSpells.readlock(__FUNCTION__, __LINE__);
-	for (int i = 0; i<NUM_MAINTAINED_EFFECTS; i++){
-		if (info->maintained_effects[i].spell_id == 0xFFFFFFFF){
-			ret = &info->maintained_effects[i];
-			ret->spell_id = 0;
-			ret->slot_pos = i;
-			break;
-		}
-	}
-	MMaintainedSpells.releasereadlock(__FUNCTION__, __LINE__);
-	return ret;
-}
-
-MaintainedEffects* Entity::GetMaintainedSpell(int32 spell_id){
-	MaintainedEffects* ret = 0;
-	InfoStruct* info = GetInfoStruct();
-	MMaintainedSpells.readlock(__FUNCTION__, __LINE__);
-	for (int i = 0; i<NUM_MAINTAINED_EFFECTS; i++){
-		if (info->maintained_effects[i].spell_id == spell_id){
-			ret = &info->maintained_effects[i];
-			break;
-		}
-	}
-	MMaintainedSpells.releasereadlock(__FUNCTION__, __LINE__);
-	return ret;
-}
-
-SpellEffects* Entity::GetFreeSpellEffectSlot(){
-	SpellEffects* ret = 0;
-	InfoStruct* info = GetInfoStruct();
-	MSpellEffects.readlock(__FUNCTION__, __LINE__);
-	for(int i=0;i<45;i++){
-		if(info->spell_effects[i].spell_id == 0xFFFFFFFF){
-			ret = &info->spell_effects[i];
-			ret->spell_id = 0;
-			break;
-		}
-	}
-	MSpellEffects.releasereadlock(__FUNCTION__, __LINE__);
-	return ret;
-}
-
-SpellEffects* Entity::GetSpellEffect(int32 id, Entity* caster) {
-	SpellEffects* ret = 0;
-	InfoStruct* info = GetInfoStruct();
-	MSpellEffects.readlock(__FUNCTION__, __LINE__);
-	for(int i = 0; i < 45; i++) {
-		if(info->spell_effects[i].spell_id == id) {
-			if (!caster || info->spell_effects[i].caster == caster){
-				ret = &info->spell_effects[i];
-				break;
-			}
-		}
-	}
-	MSpellEffects.releasereadlock(__FUNCTION__, __LINE__);
-	return ret;
-}
-
-SpellEffects* Entity::GetSpellEffectBySpellType(int8 spell_type) {
-	SpellEffects* ret = 0;
-	InfoStruct* info = GetInfoStruct();
-	MSpellEffects.readlock(__FUNCTION__, __LINE__);
-	for(int i = 0; i < 45; i++) {
-		if(info->spell_effects[i].spell_id != 0xFFFFFFFF && info->spell_effects[i].spell->spell->GetSpellData()->spell_type == spell_type) {
-			ret = &info->spell_effects[i];
-			break;
-		}
-	}
-	MSpellEffects.releasereadlock(__FUNCTION__, __LINE__);
-	return ret;
-}
-
-SpellEffects* Entity::GetSpellEffectWithLinkedTimer(int32 id, int32 linked_timer, sint32 type_group_spell_id, Entity* caster) {
-	SpellEffects* ret = 0;
-	InfoStruct* info = GetInfoStruct();
-	MSpellEffects.readlock(__FUNCTION__, __LINE__);
-	for(int i = 0; i < 45; i++) {
-		if(info->spell_effects[i].spell_id != 0xFFFFFFFF)
-		{
-			if(  (info->spell_effects[i].spell_id == id && linked_timer == 0 && type_group_spell_id == 0) ||
-				 (linked_timer > 0 && info->spell_effects[i].spell->spell->GetSpellData()->linked_timer == linked_timer) ||
-				(type_group_spell_id > 0 && info->spell_effects[i].spell->spell->GetSpellData()->type_group_spell_id == type_group_spell_id))
-			{
-				if (type_group_spell_id >= -1 && (!caster || info->spell_effects[i].caster == caster)){
-					ret = &info->spell_effects[i];
-					break;
-				}
-			}
-		}
-	}
-	MSpellEffects.releasereadlock(__FUNCTION__, __LINE__);
-	return ret;
-}
-
-LuaSpell* Entity::HasLinkedTimerID(LuaSpell* spell, Spawn* target, bool stackWithOtherPlayers) {
-	if(!spell->spell->GetSpellData()->linked_timer && !spell->spell->GetSpellData()->type_group_spell_id)
-		return nullptr;
-	LuaSpell* ret = nullptr;
-	InfoStruct* info = GetInfoStruct();
-	MSpellEffects.readlock(__FUNCTION__, __LINE__);
-	//this for loop primarily handles self checks and 'friendly' checks
-	for(int i = 0; i < NUM_MAINTAINED_EFFECTS; i++) {
-			if(info->maintained_effects[i].spell_id != 0xFFFFFFFF)
-			{
-				if( ((info->maintained_effects[i].spell_id == spell->spell->GetSpellID() && spell->spell->GetSpellData()->type_group_spell_id >= 0) ||
-					(info->maintained_effects[i].spell->spell->GetSpellData()->linked_timer > 0 && info->maintained_effects[i].spell->spell->GetSpellData()->linked_timer == spell->spell->GetSpellData()->linked_timer) || 
-					(spell->spell->GetSpellData()->type_group_spell_id > 0 && spell->spell->GetSpellData()->type_group_spell_id == info->maintained_effects[i].spell->spell->GetSpellData()->type_group_spell_id)) && 
-					((spell->spell->GetSpellData()->friendly_spell) || 
-					(!spell->spell->GetSpellData()->friendly_spell && spell->spell->GetSpellData()->type_group_spell_id >= -1 && spell->caster == info->maintained_effects[i].spell->caster) ) &&
-					(target == nullptr || info->maintained_effects[i].spell->initial_target == target->GetID())) {
-					ret = info->maintained_effects[i].spell;
-					break;
-				}
-			}
-	}
-	MSpellEffects.releasereadlock(__FUNCTION__, __LINE__);
-
-	if(!ret && !stackWithOtherPlayers && target && target->IsEntity())
-	{
-		SpellEffects* effect = ((Entity*)target)->GetSpellEffectWithLinkedTimer(spell->spell->GetSpellID(), spell->spell->GetSpellData()->linked_timer, spell->spell->GetSpellData()->type_group_spell_id, nullptr);
-		if(effect)
-			ret = effect->spell;
-	}
-	
-	return ret;
-}
-
-InfoStruct* Entity::GetInfoStruct(){ 
-	return &info_struct; 
-}
-
-Skill* Entity::GetSkillByName(const char* name, bool check_update){
-	LogWrite(MISC__TODO, 1, "TODO", "This does nothing... yet...\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-	return 0;
-}
-
-Skill* Entity::GetSkillByID(int32 id, bool check_update){
-	LogWrite(MISC__TODO, 1, "TODO", "This does nothing... yet...\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-	return 0;
-}
-
-float Entity::GetMaxSpeed(){
-	return max_speed;
-}
-
-void Entity::SetMaxSpeed(float val){
-	max_speed = val;
-}
-
-float Entity::CalculateSkillStatChance(char* skillName, int16 item_stat, float max_cap, float modifier, bool add_to_skill)
-{
-	float skillAndItemsChance = 0.0f;
-
-	Skill* skill = GetSkillByName(skillName, false);
-	if(skill){
-		MStats.lock();
-		float item_chance_or_skill = stats[item_stat];
-		MStats.unlock();
-		if(add_to_skill)
-		{
-			skillAndItemsChance = (((float)skill->current_val+item_chance_or_skill)/10.0f); // do we know 25 is accurate?  10 gives more 'skill' space, most cap at 70% with items
-		}
-		else
-		{
-			skillAndItemsChance = ((float)skill->current_val/10.0f); // do we know 25 is accurate?  10 gives more 'skill' space, most cap at 70% with items
-
-			// take chance percentage and add the item stats % (+1 = 1% or .01f)
-			skillAndItemsChance += (skillAndItemsChance*((item_chance_or_skill + modifier)/100.0f));
-		}
-	}
-
-	if ( max_cap > 0.0f && skillAndItemsChance > max_cap )
-		skillAndItemsChance = max_cap;
-
-	return skillAndItemsChance;
-}
-
-void Entity::CalculateBonuses(){
-	if(lua_interface->IsLuaSystemReloading())
-		return;
-
-	InfoStruct* info = &info_struct;
-
-	int16 effective_level = info->get_effective_level() != 0 ? info->get_effective_level() : GetLevel();
-
-	info->set_block(info->get_block_base());
-	
-	info->set_cur_attack(info->get_attack_base());
-	info->set_cur_mitigation(info->get_mitigation_base());
-	info->set_base_avoidance_pct(info->get_avoidance_base());
-
-	info->set_disease(info->get_disease_base());
-	info->set_divine(info->get_divine_base());
-	info->set_heat(info->get_heat_base());
-	info->set_magic(info->get_magic_base());
-	info->set_mental(info->get_mental_base());
-	info->set_cold(info->get_cold_base());
-	info->set_poison(info->get_poison_base());
-	info->set_elemental_base(info->get_heat());
-	info->set_noxious_base(info->get_poison());
-	info->set_arcane_base(info->get_magic());
-
-	info->set_sta(info->get_sta_base());
-	info->set_agi(info->get_agi_base());
-	info->set_str(info->get_str_base());
-	info->set_wis(info->get_wis_base());
-	info->set_intel(info->get_intel_base());
-	info->set_ability_modifier(0);
-	info->set_critical_mitigation(0);
-
-	info->set_block_chance(0);
-	info->set_crit_chance(0);
-	info->set_crit_bonus(0);
-	info->set_potency(0);
-	info->set_hate_mod(0);
-	info->set_reuse_speed(0);
-	info->set_casting_speed(0);
-	info->set_recovery_speed(0);
-	info->set_spell_reuse_speed(0);
-	info->set_spell_multi_attack(0);
-	info->set_dps(0);
-	info->set_dps_multiplier(0);
-	info->set_haste(0);
-	info->set_attackspeed(0);
-	info->set_multi_attack(0);
-	info->set_flurry(0);
-	info->set_melee_ae(0);
-
-	info->set_strikethrough(0);
-
-	info->set_accuracy(0);
-
-	info->set_offensivespeed(0);
-
-	MStats.lock();
-	stats.clear();
-	MStats.unlock();
-
-	ItemStatsValues* values = equipment_list.CalculateEquipmentBonuses(this);
-	CalculateSpellBonuses(values);
-	info->add_sta((float)values->sta);
-	info->add_str((float)values->str);
-	info->add_agi((float)values->agi);
-	info->add_wis((float)values->wis);
-	info->add_intel((float)values->int_);
-
-	info->add_disease(values->vs_disease);
-	info->add_divine(values->vs_divine);
-	info->add_heat(values->vs_heat);
-	info->add_magic(values->vs_magic);
-	int32 sta_hp_bonus = 0.0;
-	int32 prim_power_bonus = 0.0;
-	float bonus_mod = 0.0;
-	if (IsPlayer()) {
-		bonus_mod = CalculateBonusMod(); 
-		sta_hp_bonus = info->get_sta() * bonus_mod;
-		prim_power_bonus = GetPrimaryStat() * bonus_mod;
-	}
-	prim_power_bonus = floor(float(prim_power_bonus));
-	sta_hp_bonus = floor(float(sta_hp_bonus));
-	SetTotalHP(GetTotalHPBase() + values->health + sta_hp_bonus);
-	SetTotalPower(GetTotalPowerBase() + values->power + prim_power_bonus);
-	if(GetHP() > GetTotalHP())
-		SetHP(GetTotalHP());
-	if(GetPower() > GetTotalPower())
-		SetPower(GetTotalPower());
-
-	info->add_mental(values->vs_mental);
-
-	info->add_poison(values->vs_poison);
-
-	info->add_max_concentration(values->concentration);
-
-	info->add_cold(values->vs_cold);
-
-	info->add_mitigation_skill1(values->vs_slash);
-	info->add_mitigation_skill2(values->vs_pierce);
-	info->add_mitigation_skill3(values->vs_crush);
-	info->add_ability_modifier(values->ability_modifier);
-	info->add_critical_mitigation(values->criticalmitigation);
-	info->add_block_chance(values->extrashieldblockchance);
-	info->add_crit_chance(values->beneficialcritchance);
-	info->add_crit_bonus(values->critbonus);
-	info->add_potency(values->potency);
-	info->add_hate_mod(values->hategainmod);
-	info->add_reuse_speed(values->abilityreusespeed);
-	info->add_casting_speed(values->abilitycastingspeed);
-	info->add_recovery_speed(values->abilityrecoveryspeed);
-	info->add_spell_reuse_speed(values->spellreusespeed);
-	info->add_spell_multi_attack(values->spellmultiattackchance);
-	info->add_dps(values->dps);
-	info->add_dps_multiplier(CalculateDPSMultiplier());
-	info->add_haste(values->attackspeed);
-	info->add_multi_attack(values->multiattackchance);
-	info->add_flurry(values->flurry);
-	info->add_melee_ae(values->aeautoattackchance);
-	info->add_strikethrough(values->strikethrough);
-	info->add_accuracy(values->accuracy);
-	info->add_offensivespeed(values->offensivespeed);
-	info->add_uncontested_block(values->uncontested_block);
-	info->add_uncontested_parry(values->uncontested_parry);
-	info->add_uncontested_dodge(values->uncontested_dodge);
-	info->add_uncontested_riposte(values->uncontested_riposte);
-
-	info->set_ability_modifier(values->ability_modifier);
-	
-	float full_pct_hit = 100.0f;
-
-	//info->cur_concentration = 0;
-	MStats.lock();
-	float parryStat = stats[ITEM_STAT_PARRY];
-	MStats.unlock();
-	float parry_pct = CalculateSkillStatChance("Parry", ITEM_STAT_PARRYCHANCE, 70.0f, parryStat);
-	parry_pct += parry_pct * (info->get_cur_avoidance()/100.0f);
-	if(parry_pct > 70.0f)
-		parry_pct = 70.0f;
-
-	info->set_parry(parry_pct);
-
-	full_pct_hit -= parry_pct;
-	
-	float block_pct = 0.0f;
-
-	if(GetAdventureClass() != BRAWLER)
-	{
-		Item* item = equipment_list.GetItem(EQ2_SECONDARY_SLOT);
-		if(item && item->details.item_id > 0 && item->IsShield()){
-			// if high is set and greater than low use high, otherwise use low
-			int16 mitigation = item->armor_info->mitigation_high > item->armor_info->mitigation_low ? item->armor_info->mitigation_high : item->armor_info->mitigation_low;
-			// we frankly don't know the formula for Block, only that it uses the 'Protection' of the shield, which is the mitigation_low/mitigation_high in the armor_info
-			if(mitigation)
-			{
-				/*DOF Prima Guide: Shields now have the following base chances
-				to block: Tower (10%), Kite (10%), Round
-				(5%), Buckler (3%). Your chances to block
-				scale up or down based on the con of your
-				opponent.*/
-				Skill* skill = master_skill_list.GetSkill(item->generic_info.skill_req1);
-				float baseBlock = 0.0f;
-				if(skill)
-				{
-					if(skill->short_name.data == "towershield" || skill->short_name.data == "kiteshield")
-						baseBlock = 10.0f;
-					else if (skill->short_name.data == "roundshield")
-						baseBlock = 5.0f;
-					else if (skill->short_name.data == "buckler") 
-						baseBlock = 3.0f;
-				}
-				if(GetLevel() > mitigation)
-					block_pct = log10f((float)mitigation/((float)GetLevel()*10.0f));
-				else
-					block_pct = log10f(((float)GetLevel()/(float)mitigation)) * log10f(GetLevel()) * 2.0f;
-				
-				if(block_pct < 0.0f)
-					block_pct *= -1.0f;
-
-				block_pct += baseBlock;
-
-				block_pct += block_pct * (info->get_cur_avoidance()/100.0f);
-				if(block_pct > 70.0f)
-					block_pct = 70.0f;
-			}
-		}
-	}
-	else
-	{
-		//info->cur_concentration = 0;
-		MStats.lock();
-		float deflectionStat = stats[ITEM_STAT_DEFLECTION];
-		MStats.unlock();
-		block_pct = CalculateSkillStatChance("Deflection", ITEM_STAT_MINIMUMDEFLECTIONCHANCE, 70.0f, deflectionStat+1.0f);
-		block_pct += block_pct * (info->get_cur_avoidance()/100.0f);
-	}
-
-	float block_actual = 0.0f;
-	if(full_pct_hit > 0.0f)
-		block_actual = block_pct * (full_pct_hit / 100.0f);
-
-	info->set_block(block_actual);
-	full_pct_hit -= block_actual;
-
-
-	//info->cur_concentration = 0;
-	MStats.lock();
-	float defenseStat = stats[ITEM_STAT_DEFENSE];
-	MStats.unlock();
-	
-	float dodge_pct = CalculateSkillStatChance("Defense", ITEM_STAT_DODGECHANCE, 100.0f, defenseStat);
-	dodge_pct += dodge_pct * (info->get_cur_avoidance()/100.0f);
-
-	float dodge_actual = 0.0f;
-	if(full_pct_hit > 0.0f)
-		dodge_actual = dodge_pct * (full_pct_hit / 100.0f) + (log10f(GetLevel() * GetAgi()) / 100.0f);
-
-	info->set_avoidance_base(dodge_actual);
-
-	float total_avoidance = parry_pct + block_actual + dodge_actual;
-	info->set_avoidance_display(total_avoidance);
-
-	SetRegenValues(effective_level);
-
-	safe_delete(values);
-}
-
-void Entity::SetRegenValues(int16 effective_level)
-{
-	bool classicRegen = rule_manager.GetGlobalRule(R_Spawn, ClassicRegen)->GetBool();
-	if(!GetInfoStruct()->get_hp_regen_override())
-	{
-		sint16 regen_hp_rate = 0;
-		sint16 temp = 0;
-
-		MStats.lock();
-		if(!IsAggroed())
-		{
-			if(classicRegen)
-			{
-				// classic regen only gives OUT OF COMBAT, doesn't combine in+out of combat
-				regen_hp_rate = (int)(effective_level*.75)+1;
-				temp = regen_hp_rate + stats[ITEM_STAT_HPREGEN];
-				temp += stats[ITEM_STAT_HPREGENPPT];
-			}
-			else
-			{
-				regen_hp_rate = (int)(effective_level*.75)+(int)(effective_level/10) + 1;
-				temp = regen_hp_rate + stats[ITEM_STAT_HPREGEN];
-				temp += stats[ITEM_STAT_HPREGENPPT] + stats[ITEM_STAT_COMBATHPREGENPPT];
-			}
-		}
-		else
-		{
-			regen_hp_rate = (sint16)(effective_level / 10) + 1;
-			temp = regen_hp_rate + stats[ITEM_STAT_COMBATHPREGENPPT];
-		}
-		MStats.unlock();
-
-		GetInfoStruct()->set_hp_regen(temp);
-	}
-
-	if(!GetInfoStruct()->get_power_regen_override())
-	{
-		sint16 regen_power_rate = 0;
-		sint16 temp = 0;
-
-		MStats.lock();
-		if(!IsAggroed())
-		{
-			if(classicRegen)
-			{				
-				regen_power_rate = effective_level + 1;
-				temp = regen_power_rate + stats[ITEM_STAT_MANAREGEN];
-				temp += stats[ITEM_STAT_MPREGENPPT];
-			}
-			else
-			{
-				regen_power_rate = effective_level + (int)(effective_level/10) + 1;
-				temp = regen_power_rate + stats[ITEM_STAT_MANAREGEN];
-				temp += stats[ITEM_STAT_MPREGENPPT] + stats[ITEM_STAT_COMBATMPREGENPPT];
-			}
-		}
-		else
-		{
-			regen_power_rate = (sint16)(effective_level / 10) + 1;
-			temp = regen_power_rate + stats[ITEM_STAT_COMBATMPREGENPPT];
-		}
-		MStats.unlock();
-
-		GetInfoStruct()->set_power_regen(temp);
-	}
-}
-
-EquipmentItemList* Entity::GetEquipmentList(){
-	return &equipment_list;
-}
-
-EquipmentItemList* Entity::GetAppearanceEquipmentList(){
-	return &appearance_equipment_list;
-}
-
-void Entity::SetEquipment(Item* item, int8 slot){
-	std::lock_guard<std::mutex> lk(MEquipment);
-	if(!item && slot < NUM_SLOTS){
-		SetInfo(&equipment.equip_id[slot], 0);
-		SetInfo(&equipment.color[slot].red, 0);
-		SetInfo(&equipment.color[slot].green, 0);
-		SetInfo(&equipment.color[slot].blue, 0);
-		SetInfo(&equipment.highlight[slot].red, 0);
-		SetInfo(&equipment.highlight[slot].green, 0);
-		SetInfo(&equipment.highlight[slot].blue, 0);
-	}
-	else{
-		if ( slot >= NUM_SLOTS ) 
-			slot = item->details.slot_id;
-
-		if( slot >= NUM_SLOTS )
-			return;
-		
-		SetInfo(&equipment.equip_id[slot], item->generic_info.appearance_id);
-		SetInfo(&equipment.color[slot].red, item->generic_info.appearance_red);
-		SetInfo(&equipment.color[slot].green, item->generic_info.appearance_green);
-		SetInfo(&equipment.color[slot].blue, item->generic_info.appearance_blue);
-		SetInfo(&equipment.highlight[slot].red, item->generic_info.appearance_highlight_red);
-		SetInfo(&equipment.highlight[slot].green, item->generic_info.appearance_highlight_green);
-		SetInfo(&equipment.highlight[slot].blue, item->generic_info.appearance_highlight_blue);
-	}
-}
-
-bool Entity::CheckSpellBonusRemoval(LuaSpell* spell, int16 type){
-	MutexList<BonusValues*>::iterator itr = bonus_list.begin();
-	while(itr.Next()){
-		if(itr.value->luaspell == spell && itr.value->type == type){
-			bonus_list.Remove(itr.value, true);
-			return true;
-		}
-	}
-	return false;
-}
-
-void Entity::AddSpellBonus(LuaSpell* spell, int16 type, float value, int64 class_req, vector<int16> race_req, vector<int16> faction_req){
-	CheckSpellBonusRemoval(spell, type); 
-	BonusValues* bonus = new BonusValues;
-	bonus->spell_id = spell->spell->GetSpellID();
-	bonus->luaspell = spell;
-	bonus->type = type;
-	bonus->value = value;
-	bonus->class_req = class_req;
-	bonus->race_req = race_req;
-	bonus->faction_req = faction_req;
-	bonus->tier = spell ? spell->spell->GetSpellTier() : 0;
-	bonus_list.Add(bonus);
-
-	if(IsNPC())
-		CalculateBonuses();
-}
-
-BonusValues* Entity::GetSpellBonus(int32 spell_id) {
-	BonusValues *ret = 0;
-	MutexList<BonusValues*>::iterator itr = bonus_list.begin();
-	while (itr.Next()) {
-		if (itr.value->spell_id == spell_id) {
-			ret = itr.value;
-			break;
-		}
-	}
-
-	return ret;
-}
-
-vector<BonusValues*>* Entity::GetAllSpellBonuses(LuaSpell* spell) {
-	vector<BonusValues*>* list = new vector<BonusValues*>;
-	MutexList<BonusValues*>::iterator itr = bonus_list.begin();
-	while (itr.Next()) {
-		if (itr.value->luaspell == spell)
-			list->push_back(itr.value);
-	}
-	return list;
-}
-
-void Entity::RemoveSpellBonus(const LuaSpell* spell, bool remove_all){
-	// spell can be null!
-	MutexList<BonusValues*>::iterator itr = bonus_list.begin();
-	while(itr.Next()){
-		if(itr.value->luaspell == spell || remove_all)
-		bonus_list.Remove(itr.value, true);
-	}
-	
-	if(IsNPC())
-		CalculateBonuses();
-}
-
-void Entity::CalculateSpellBonuses(ItemStatsValues* stats){
-	if(stats){
-		MutexList<BonusValues*>::iterator itr = bonus_list.begin();
-		vector<BonusValues*> bv;
-		//First check if we meet the requirement for each bonus
-		bool race_match = false;
-		while(itr.Next()) {
-			if (itr.value->race_req.size() > 0) {
-				for (int8 i = 0; i < itr.value->race_req.size(); i++) {
-					if (GetRace() == itr.value->race_req[i]) {
-						race_match = true;
-					}
-				}
-			}
-			else
-				race_match = true; // if the race_req.size = 0 then there is no race requirement and the race_match will be true
-			int64 const class1 = pow(2.0, (GetAdventureClass() - 1));
-			int64 const class2 = pow(2.0, (classes.GetSecondaryBaseClass(GetAdventureClass()) - 1));
-			int64 const class3 = pow(2.0, (classes.GetBaseClass(GetAdventureClass()) - 1));
-			if (itr.value->class_req == 0 || (itr.value->class_req & class1) == class1 || (itr.value->class_req & class2) == class2 || (itr.value->class_req & class3) == class3 && race_match )
-				bv.push_back(itr.value);
-		}
-		//Sort the bonuses by spell id and luaspell
-		BonusValues* bonus = nullptr;
-		map <int32, map<LuaSpell*, vector<BonusValues*> > > sort;
-		for (int8 i = 0; i < bv.size(); i++){
-			bonus = bv.at(i);
-			sort[bonus->spell_id][bonus->luaspell].push_back(bonus);
-		}
-		//Now check for the highest tier of each spell id and apply those bonuses
-		map<LuaSpell*, vector<BonusValues*> >::iterator tier_itr;
-		map <int32, map<LuaSpell*, vector<BonusValues*> > >::iterator sort_itr;
-		for (sort_itr = sort.begin(); sort_itr != sort.end(); sort_itr++){
-			LuaSpell* key = nullptr;
-			sint8 highest_tier = -1;
-			//Find the highest tier for this spell id
-			for (tier_itr = sort_itr->second.begin(); tier_itr != sort_itr->second.end(); tier_itr++){
-				LuaSpell* current_spell = tier_itr->first;
-				sint8 current_tier = 0;
-				if (current_spell && ((current_tier = current_spell->spell->GetSpellTier()) > highest_tier)) {
-					highest_tier = current_tier;
-					key = current_spell;
-				}
-			}
-			//We've found the highest tier for this spell id, so add the bonuses
-			vector<BonusValues*>* final_bonuses = &sort_itr->second[key];
-			for (int8 i = 0; i < final_bonuses->size(); i++)
-				world.AddBonuses(nullptr, stats, final_bonuses->at(i)->type, final_bonuses->at(i)->value, this);
-		}
-	}
-}
-
-void Entity::AddMezSpell(LuaSpell* spell) {
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_MEZ])
-		control_effects[CONTROL_EFFECT_TYPE_MEZ] = new MutexList<LuaSpell*>;
-
-	MutexList<LuaSpell*>* mez_spells = control_effects[CONTROL_EFFECT_TYPE_MEZ];
-
-	if (IsPlayer() && !IsStunned() && !IsMezImmune() && mez_spells->size(true) == 0){
-		((Player*)this)->SetPlayerControlFlag(1, 16, true);
-		if (!IsRooted())
-			((Player*)this)->SetPlayerControlFlag(1, 8, true);
-		if (!IsStifled() && !IsFeared())
-			GetZone()->LockAllSpells((Player*)this);
-	}
-
-	if (IsNPC() && !IsMezImmune())
-	{
-		HaltMovement();
-	}
-
-	mez_spells->Add(spell);
-}
-
-void Entity::RemoveMezSpell(LuaSpell* spell) {
-	MutexList<LuaSpell*>* mez_spells = control_effects[CONTROL_EFFECT_TYPE_MEZ];
-	if (!mez_spells || mez_spells->size(true) == 0)
-		return;
-
-	mez_spells->Remove(spell);
-	if (mez_spells->size(true) == 0){
-		if (IsPlayer() && !IsMezImmune() && !IsStunned()){
-			if (!IsStifled() && !IsFeared())
-				GetZone()->UnlockAllSpells((Player*)this);
-			((Player*)this)->SetPlayerControlFlag(1, 16, false);
-			if (!IsRooted())
-				((Player*)this)->SetPlayerControlFlag(1, 8, false);
-		}
-	}
-}
-
-void Entity::RemoveAllMezSpells() {
-	MutexList<LuaSpell*>* mez_spells = control_effects[CONTROL_EFFECT_TYPE_MEZ];
-	if (!mez_spells)
-		return;
-
-	MutexList<LuaSpell*>::iterator itr = mez_spells->begin();
-	while (itr.Next()){
-		LuaSpell* spell = itr.value;
-		if (!spell)
-			continue;
-		GetZone()->RemoveTargetFromSpell(spell, this);
-		RemoveDetrimentalSpell(spell);
-		RemoveSpellEffect(spell);
-		if (IsPlayer())
-			((Player*)this)->RemoveSkillBonus(spell->spell->GetSpellID());
-	}
-
-	mez_spells->clear();
-	if (IsPlayer() && !IsMezImmune() && !IsStunned()){
-		if (!IsStifled() && !IsFeared())
-			GetZone()->UnlockAllSpells((Player*)this);
-		((Player*)this)->SetPlayerControlFlag(1, 16, false);
-		if (!IsRooted())
-			((Player*)this)->SetPlayerControlFlag(1, 8, false);
-	}
-}
-
-void Entity::AddStifleSpell(LuaSpell* spell) {
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_STIFLE])
-		control_effects[CONTROL_EFFECT_TYPE_STIFLE] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && control_effects[CONTROL_EFFECT_TYPE_STIFLE]->size(true) == 0 && !IsStifleImmune() && !IsMezzedOrStunned())
-		GetZone()->LockAllSpells((Player*)this);
-
-	control_effects[CONTROL_EFFECT_TYPE_STIFLE]->Add(spell);
-}
-
-void Entity::RemoveStifleSpell(LuaSpell* spell) {
-	MutexList<LuaSpell*>* stifle_list = control_effects[CONTROL_EFFECT_TYPE_STIFLE];
-	if (!stifle_list || stifle_list->size(true) == 0)
-		return;
-
-	stifle_list->Remove(spell);
-
-	if (IsPlayer() && stifle_list->size(true) == 0 && !IsStifleImmune() && !IsMezzedOrStunned())
-		GetZone()->UnlockAllSpells((Player*)this);
-}
-
-void Entity::AddDazeSpell(LuaSpell* spell) {
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_DAZE])
-		control_effects[CONTROL_EFFECT_TYPE_DAZE] = new MutexList<LuaSpell*>;
-
-	control_effects[CONTROL_EFFECT_TYPE_DAZE]->Add(spell);
-}
-
-void Entity::RemoveDazeSpell(LuaSpell* spell) {
-	MutexList<LuaSpell*>* daze_list = control_effects[CONTROL_EFFECT_TYPE_DAZE];
-	if (!daze_list || daze_list->size(true) == 0)
-		return;
-
-	daze_list->Remove(spell);
-}
-
-void Entity::AddStunSpell(LuaSpell* spell) {
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_STUN])
-		control_effects[CONTROL_EFFECT_TYPE_STUN] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && control_effects[CONTROL_EFFECT_TYPE_STUN]->size(true) == 0 && !IsStunImmune()){
-		if (!IsMezzed()){
-			((Player*)this)->SetPlayerControlFlag(1, 16, true);
-			if (!IsRooted())
-				((Player*)this)->SetPlayerControlFlag(1, 8, true);
-			if (!IsStifled() && !IsFeared())
-				GetZone()->LockAllSpells((Player*)this);
-		}
-	}
-
-	control_effects[CONTROL_EFFECT_TYPE_STUN]->Add(spell);
-}
-
-void Entity::RemoveStunSpell(LuaSpell* spell) {
-	MutexList<LuaSpell*>* stun_list = control_effects[CONTROL_EFFECT_TYPE_STUN];
-	if (!stun_list || stun_list->size(true) == 0)
-		return;
-
-	stun_list->Remove(spell);
-	if (stun_list->size(true) == 0){
-		if (IsPlayer() && !IsMezzed() && !IsStunImmune()){
-			((Player*)this)->SetPlayerControlFlag(1, 16, false);
-			if (!IsRooted())
-				((Player*)this)->SetPlayerControlFlag(1, 8, false);
-			if (!IsStifled() && !IsFeared())
-				GetZone()->UnlockAllSpells((Player*)this);
-		}
-	}
-}
-
-void Entity::HideDeityPet(bool val) {
-	if (!deityPet)
-		return;
-
-	if (val) {
-		deityPet->AddAllowAccessSpawn(deityPet);
-		GetZone()->HidePrivateSpawn(deityPet);
-	}
-	else
-		deityPet->MakeSpawnPublic();
-}
-
-void Entity::HideCosmeticPet(bool val) {
-	if (!cosmeticPet)
-		return;
-
-	if (val) {
-		cosmeticPet->AddAllowAccessSpawn(cosmeticPet);
-		GetZone()->HidePrivateSpawn(cosmeticPet);
-	}
-	else
-		cosmeticPet->MakeSpawnPublic();
-}
-
-void Entity::DismissAllPets(bool from_death, bool spawnListLocked)
-{
-	DismissPet(GetPet(), from_death, spawnListLocked);
-	DismissPet(GetCharmedPet(), from_death, spawnListLocked);
-	DismissPet(GetDeityPet(), from_death, spawnListLocked);
-	DismissPet(GetCosmeticPet(), from_death, spawnListLocked);
-}
-
-void Entity::DismissPet(Entity* pet, bool from_death, bool spawnListLocked) {
-	if (!pet)
-		return;
-
-	Entity* PetOwner = pet->GetOwner();
-
-	if(pet->IsNPC())
-	{
-		((NPC*)pet)->SetDismissing(true);
-
-		// Remove the spell maintained spell
-		Spell* spell = master_spell_list.GetSpell(pet->GetPetSpellID(), pet->GetPetSpellTier());
-		if (spell)
-			GetZone()->GetSpellProcess()->DeleteCasterSpell(this, spell, from_death == true ? (string)"pet_death" : (string)"canceled");
-	}
-
-	if (pet->GetPetType() == PET_TYPE_CHARMED) {
-		if(PetOwner)
-			PetOwner->SetCharmedPet(0);
-
-		if (!from_death) {
-			// set the pet flag to false, owner to 0, and give the mob its old brain back
-			pet->SetPet(false);
-			pet->SetOwner(0);
-			if(pet->IsNPC())
-				((NPC*)pet)->SetBrain(new Brain((NPC*)pet));
-
-			pet->SetDismissing(false);
-		}
-	}
-	else if (PetOwner && pet->GetPetType() == PET_TYPE_COMBAT)
-		PetOwner->SetCombatPet(0);
-	else if (PetOwner && pet->GetPetType() == PET_TYPE_DEITY)
-		PetOwner->SetDeityPet(0);
-	else if (PetOwner && pet->GetPetType() == PET_TYPE_COSMETIC)
-		PetOwner->SetCosmeticPet(0);
-
-	// if owner is player and no combat pets left reset the pet info
-	if (PetOwner && PetOwner->IsPlayer()) {
-		if (!PetOwner->GetPet() && !PetOwner->GetCharmedPet())
-			((Player*)PetOwner)->ResetPetInfo();
-	}
-
-	// remove the spawn from the world
-	if (!from_death && pet->GetPetType() != PET_TYPE_CHARMED)
-		GetZone()->RemoveSpawn(pet);
-}
-
-float Entity::CalculateBonusMod() {
-	int8 level = GetLevel();
-	if (level <= 20)
-		return 3.0;
-	else if (level >= 90)
-		return 10.0;
-	else
-		return (level - 20) * .1 + 3.0;
-}
-
-float Entity::CalculateDPSMultiplier(){
-	float dps = GetInfoStruct()->get_dps();
-
-	if (dps > 0){
-		if (dps <= 100)
-			return (dps / 100 + 1);
-		else if (dps <= 200)
-			return (((dps - 100) * .25 + 100) / 100 + 1);
-		else if (dps <= 300)
-			return (((dps - 200) * .1 + 125) / 100 + 1);
-		else if (dps <= 900)
-			return (((dps - 300) * .05 + 135) / 100 + 1);
-		else
-			return (((dps - 900) * .01 + 165) / 100 + 1);
-	}
-	return 1;
-}	
-
-void Entity::AddWard(int32 spellID, WardInfo* ward) {
-	if (m_wardList.count(spellID) == 0) {
-		m_wardList[spellID] = ward;
-	}
-}
-
-WardInfo* Entity::GetWard(int32 spellID) {
-	WardInfo* ret = 0;
-
-	if (m_wardList.count(spellID) > 0)
-		ret = m_wardList[spellID];
-
-	return ret;
-}
-
-void Entity::RemoveWard(int32 spellID) {
-	if (m_wardList.count(spellID) > 0) {
-		// Delete the ward info
-		safe_delete(m_wardList[spellID]);
-		// Remove from the ward list
-		m_wardList.erase(spellID);
-	}
-}
-
-int32 Entity::CheckWards(Entity* attacker, int32 damage, int8 damage_type) {
-	map<int32, WardInfo*>::iterator itr;
-	WardInfo* ward = 0;
-	LuaSpell* spell = 0;
-
-	while (m_wardList.size() > 0 && damage > 0) {
-		// Get the ward with the lowest base damage
-		for (itr = m_wardList.begin(); itr != m_wardList.end(); itr++) {
-			if (!ward || itr->second->BaseDamage < ward->BaseDamage) {
-				if ((itr->second->AbsorbAllDamage || itr->second->DamageLeft > 0) &&
-					(itr->second->WardType == WARD_TYPE_ALL ||
-					(itr->second->WardType == WARD_TYPE_PHYSICAL && damage_type >= DAMAGE_PACKET_DAMAGE_TYPE_SLASH && damage_type <= DAMAGE_PACKET_DAMAGE_TYPE_PIERCE) ||
-					(itr->second->WardType == WARD_TYPE_MAGICAL && ((itr->second->DamageType == 0 && damage_type >= DAMAGE_PACKET_DAMAGE_TYPE_PIERCE) || (damage_type >= DAMAGE_PACKET_DAMAGE_TYPE_PIERCE && itr->second->DamageType == damage_type)))))
-					ward = itr->second;
-			}
-		}
-
-		if (!ward)
-			break;
-
-		spell = ward->Spell;
-
-		// damage to redirect at the source (like intercept)
-		int32 redirectDamage = 0;
-		if (ward->RedirectDamagePercent)
-			redirectDamage = (int32)(double)damage * ((double)ward->RedirectDamagePercent / 100.0);
-
-		// percentage the spell absorbs of all possible damage
-		int32 damageToAbsorb = 0;
-		if (ward->DamageAbsorptionPercentage > 0)
-			damageToAbsorb = (int32)(double)damage * ((double)ward->DamageAbsorptionPercentage/100.0);
-		else
-			damageToAbsorb = damage;
-
-		int32 maxDamageAbsorptionAllowed = 0;
-
-		// spells like Divine Aura have caps on health, eg. anything more than 50% damage is not absorbed
-		if (ward->DamageAbsorptionMaxHealthPercent > 0)
-			maxDamageAbsorptionAllowed = (int32)(double)GetTotalHP() * ((double)ward->DamageAbsorptionMaxHealthPercent / 100.0);
-
-		if (maxDamageAbsorptionAllowed > 0 && damageToAbsorb >= maxDamageAbsorptionAllowed)
-			damageToAbsorb = 0; // its over or equal to 50% of the total hp allowed, thus this damage is not absorbed
-
-		int32 baseDamageRemaining = damage - damageToAbsorb;
-
-		bool hasSpellBeenRemoved = false;
-		if (ward->AbsorbAllDamage)
-		{
-			ward->LastAbsorbedDamage = ward->DamageLeft;
-
-			if (!redirectDamage)
-				GetZone()->SendHealPacket(ward->Spell->caster, this, HEAL_PACKET_TYPE_ABSORB, damage, spell->spell->GetName());
-
-			damage = 0;
-		}
-		else if (damageToAbsorb >= ward->DamageLeft) {
-			// Damage is greater than or equal to the amount left on the ward
-
-			ward->LastAbsorbedDamage = ward->DamageLeft;
-			// remove what damage we can absorb 
-			damageToAbsorb -= ward->DamageLeft;
-
-			// move back what couldn't be absorbed to the base dmg and apply to the overall damage
-			baseDamageRemaining += damageToAbsorb;
-			damage = baseDamageRemaining;
-			ward->DamageLeft = 0;
-			spell->damage_remaining = 0;
-
-			if(!redirectDamage)
-				GetZone()->SendHealPacket(spell->caster, this, HEAL_PACKET_TYPE_ABSORB, ward->DamageLeft, spell->spell->GetName());
-
-			if (!ward->keepWard) {
-				hasSpellBeenRemoved = true;
-				RemoveWard(spell->spell->GetSpellID());
-				GetZone()->GetSpellProcess()->DeleteCasterSpell(spell, "purged");
-			}
-		}
-		else {
-			ward->LastAbsorbedDamage = damageToAbsorb;
-			// Damage is less then the amount left on the ward
-			ward->DamageLeft -= damageToAbsorb;
-
-			spell->damage_remaining = ward->DamageLeft;
-			if (spell->caster->IsPlayer())
-				ClientPacketFunctions::SendMaintainedExamineUpdate(GetZone()->GetClientBySpawn(spell->caster), spell->slot_pos, ward->DamageLeft, 1);
-
-			if (!redirectDamage)
-				GetZone()->SendHealPacket(ward->Spell->caster, this, HEAL_PACKET_TYPE_ABSORB, damage, spell->spell->GetName());
-
-			// remaining damage not absorbed by percentage must be set
-			damage = baseDamageRemaining;
-		}
-
-		if (redirectDamage)
-		{
-			ward->LastRedirectDamage = redirectDamage;
-			if (this->IsPlayer())
-			{
-				Client* client = GetZone()->GetClientBySpawn(this);
-				client->Message(CHANNEL_COMBAT, "%s intercepted some of the damage intended for you!", spell->caster->GetName());
-			}
-			if (spell->caster && spell->caster->IsPlayer())
-			{
-				Client* client = GetZone()->GetClientBySpawn(spell->caster);
-				client->Message(CHANNEL_COMBAT, "YOU intercept some of the damage intended for %s!", this->GetName());
-			}
-
-			if (attacker && spell->caster)
-				attacker->DamageSpawn(spell->caster, DAMAGE_PACKET_TYPE_SPELL_DAMAGE, damage_type, redirectDamage, redirectDamage, 0, 0, false, false, false, spell);
-		}
-
-		bool shouldRemoveSpell = false;
-		ward->HitCount++; // increment hit count
-
-		if (ward->MaxHitCount && spell->num_triggers)
-		{
-			spell->num_triggers--;
-			ClientPacketFunctions::SendMaintainedExamineUpdate(spell->caster->GetZone()->GetClientBySpawn(spell->caster), spell->slot_pos, spell->num_triggers, 0);
-		}
-		
-		if (ward->HitCount >= ward->MaxHitCount) // there isn't a max hit requirement with the hit count, so just go based on hit count
-			shouldRemoveSpell = true;
-
-		if (shouldRemoveSpell && !hasSpellBeenRemoved)
-		{
-			RemoveWard(spell->spell->GetSpellID());
-			GetZone()->GetSpellProcess()->DeleteCasterSpell(spell, "purged");
-		}
-
-		// Reset ward pointer
-		ward = 0;
-	}
-
-	return damage;
-}
-
-float Entity::CalculateCastingSpeedMod() {
-	float cast_speed = info_struct.get_casting_speed();
-	
-	if(cast_speed > 0)
-		return 100 * max((float) 0.5, (float) (1 + (1 - (1 / (1 + (cast_speed * .01))))));
-	else if (cast_speed < 0)
-		return 100 * min((float) 1.5, (float) (1 + (1 - (1 / (1 + (cast_speed * -.01))))));
-	return 0;
-}
-
-float Entity::GetSpeed() {
-	float ret = speed > GetBaseSpeed() ? speed : GetBaseSpeed();
-
-	if (EngagedInCombat() && GetMaxSpeed() > 0.0f)
-		ret = GetMaxSpeed();
-
-	MStats.lock();
-	if ((IsStealthed() || IsInvis()) && stats.count(ITEM_STAT_STEALTHINVISSPEEDMOD))
-		ret += stats[ITEM_STAT_STEALTHINVISSPEEDMOD];
-	else if (EngagedInCombat() && stats.count(ITEM_STAT_OFFENSIVESPEED))
-		ret += stats[ITEM_STAT_OFFENSIVESPEED];
-	else if (stats.count(ITEM_STAT_SPEED) && stats.count(ITEM_STAT_MOUNTSPEED))
-		ret += max(stats[ITEM_STAT_SPEED], stats[ITEM_STAT_MOUNTSPEED]);
-	else if (stats.count(ITEM_STAT_SPEED))
-		ret += stats[ITEM_STAT_SPEED];
-	else if (stats.count(ITEM_STAT_MOUNTSPEED))
-		ret += stats[ITEM_STAT_MOUNTSPEED];
-	MStats.unlock();
-	
-	ret *= speed_multiplier;
-	
-	return ret;
-}
-
-float Entity::GetAirSpeed() {
-	float ret = speed;
-
-	if (!EngagedInCombat())
-		ret += stats[ITEM_STAT_MOUNTAIRSPEED];
-
-	ret *= speed_multiplier;
-	return ret;
-}
-
-int8 Entity::GetTraumaCount() {
-	return det_count_list[DET_TYPE_TRAUMA];
-}
-
-int8 Entity::GetArcaneCount() {
-	return det_count_list[DET_TYPE_ARCANE];
-}
-
-int8 Entity::GetNoxiousCount() {
-	return det_count_list[DET_TYPE_NOXIOUS];
-}
-
-int8 Entity::GetElementalCount() {
-	return det_count_list[DET_TYPE_ELEMENTAL];
-}
-
-int8 Entity::GetCurseCount() {
-	return det_count_list[DET_TYPE_CURSE];
-}
-
-Mutex* Entity::GetDetrimentMutex() {
-	return &MDetriments;
-}
-
-Mutex* Entity::GetMaintainedMutex() {
-	return &MMaintainedSpells;
-}
-
-Mutex* Entity::GetSpellEffectMutex() {
-	return &MSpellEffects;
-}
-
-bool Entity::HasCurableDetrimentType(int8 det_type) {
-	DetrimentalEffects* det;
-	bool ret = false;
-	MDetriments.readlock(__FUNCTION__, __LINE__);
-	for (int32 i = 0; i < detrimental_spell_effects.size(); i++){
-		det = &detrimental_spell_effects.at(i);
-		if(det && det->det_type == det_type && !det->incurable){
-			ret = true;
-			break;
-		}
-	}
-	MDetriments.releasereadlock(__FUNCTION__, __LINE__);
-	return ret;
-}
-
-void Entity::ClearAllDetriments() {
-	MDetriments.writelock(__FUNCTION__, __LINE__);
-	detrimental_spell_effects.clear();
-	det_count_list.clear();
-	MDetriments.releasewritelock(__FUNCTION__, __LINE__);
-}
-
-void Entity::CureDetrimentByType(int8 cure_count, int8 det_type, string cure_name, Entity* caster, int8 cure_level) {
-	if (cure_count <= 0 || GetDetTypeCount(det_type) <= 0)
-		return;
-
-	vector<DetrimentalEffects>* det_list = &detrimental_spell_effects;
-	DetrimentalEffects* det;
-	vector<LuaSpell*> remove_list;
-	LuaSpell* spell = 0;
-	vector<LevelArray*>* levels;
-	int8 caster_class1 = 0;
-	int8 caster_class2 = 0;
-	int8 caster_class3 = 0;
-	int8 level_class = 0;
-	InfoStruct* info_struct = 0;
-	bool pass_level_check = false;
-
-	MDetriments.readlock(__FUNCTION__, __LINE__);
-	for (int32 i = 0; i<det_list->size(); i++){
-		det = &det_list->at(i);
-		if (det && det->det_type == det_type && !det->incurable){
-			levels = det->spell->spell->GetSpellLevels();
-			info_struct = det->caster->GetInfoStruct();
-			caster_class1 = info_struct->get_class1();
-			caster_class2 = info_struct->get_class2();
-			caster_class3 = info_struct->get_class3();
-			pass_level_check = false;
-			for (int32 x = 0; x < levels->size(); x++){
-				level_class = levels->at(x)->adventure_class;
-				if (!cure_level || ((caster_class1 == level_class || caster_class2 == level_class || caster_class3 == level_class)
-					&& cure_level >= (levels->at(x)->spell_level / 10))){
-					pass_level_check = true;
-					break;
-				}
-			}
-			if (pass_level_check){
-				remove_list.push_back(det->spell);
-				cure_count--;
-				if (cure_count == 0)
-					break;
-			}
-		}
-	}
-	MDetriments.releasereadlock(__FUNCTION__, __LINE__);
-
-	for (int32 i = 0; i<remove_list.size(); i++){
-		spell = remove_list.at(i);
-		GetZone()->SendDispellPacket(caster, this, cure_name, (string)remove_list.at(i)->spell->GetName(), DISPELL_TYPE_CURE);
-		if (GetZone())
-			GetZone()->RemoveTargetFromSpell(spell, this);
-		RemoveSpellEffect(spell);
-		RemoveDetrimentalSpell(spell);
-	}
-	remove_list.clear();
-}
-
-void Entity::CureDetrimentByControlEffect(int8 cure_count, int8 control_type, string cure_name, Entity* caster, int8 cure_level) {
-	if (cure_count <= 0 || GetDetCount() <= 0)
-		return;
-
-	vector<DetrimentalEffects>* det_list = &detrimental_spell_effects;
-	DetrimentalEffects* det;
-	vector<LuaSpell*> remove_list;
-	LuaSpell* spell = 0;
-	vector<LevelArray*>* levels;
-	int8 caster_class1 = 0;
-	int8 caster_class2 = 0;
-	int8 caster_class3 = 0;
-	int8 level_class = 0;
-	InfoStruct* info_struct = 0;
-	bool pass_level_check = false;
-
-	MDetriments.readlock(__FUNCTION__, __LINE__);
-	for (int32 i = 0; i<det_list->size(); i++){
-		det = &det_list->at(i);
-		if (det && det->control_effect == control_type && !det->incurable){
-			levels = det->spell->spell->GetSpellLevels();
-			info_struct = det->caster->GetInfoStruct();
-			caster_class1 = info_struct->get_class1();
-			caster_class2 = info_struct->get_class2();
-			caster_class3 = info_struct->get_class3();
-			pass_level_check = false;
-			for (int32 x = 0; x < levels->size(); x++){
-				level_class = levels->at(x)->adventure_class;
-				if (!cure_level || ((caster_class1 == level_class || caster_class2 == level_class || caster_class3 == level_class)
-					&& cure_level >= (levels->at(x)->spell_level / 10))){
-					pass_level_check = true;
-					break;
-				}
-			}
-			if (pass_level_check){
-				remove_list.push_back(det->spell);
-				cure_count--;
-				if (cure_count == 0)
-					break;
-			}
-		}
-	}
-	MDetriments.releasereadlock(__FUNCTION__, __LINE__);
-
-	for (int32 i = 0; i<remove_list.size(); i++){
-		spell = remove_list.at(i);
-		GetZone()->SendDispellPacket(caster, this, cure_name, (string)remove_list.at(i)->spell->GetName(), DISPELL_TYPE_CURE);
-		if (GetZone())
-			GetZone()->RemoveTargetFromSpell(spell, this);
-		RemoveSpellEffect(spell);
-		RemoveDetrimentalSpell(spell);
-	}
-	remove_list.clear();
-}
-
-void Entity::RemoveDetrimentalSpell(LuaSpell* spell) {
-	if(!spell || spell->spell->GetSpellData()->det_type == 0)
-		return;
-	MDetriments.writelock(__FUNCTION__, __LINE__);
-	vector<DetrimentalEffects>* det_list = &detrimental_spell_effects;
-	vector<DetrimentalEffects>::iterator itr;
-	for(itr = det_list->begin(); itr != det_list->end(); itr++){
-		if((*itr).spell == spell){
-			det_count_list[(*itr).det_type]--;
-			det_list->erase(itr);
-			if(IsPlayer())
-				((Player*)this)->SetCharSheetChanged(true);
-			break;
-		}
-	}
-	MDetriments.releasewritelock(__FUNCTION__, __LINE__);
-}
-
-int8 Entity::GetDetTypeCount(int8 det_type){
-	return det_count_list[det_type];
-}
-
-int8 Entity::GetDetCount() {
-	int8 det_count = 0;
-	map<int8, int8>::iterator itr;
-
-	for(itr=det_count_list.begin(); itr != det_count_list.end(); itr++)
-		det_count += (*itr).second;
-	
-	return det_count;
-}
-
-vector<DetrimentalEffects>* Entity::GetDetrimentalSpellEffects() {
-	return &detrimental_spell_effects;
-}
-
-void Entity::AddDetrimentalSpell(LuaSpell* luaspell, int32 override_expire_timestamp){
-	if(!luaspell || !luaspell->caster)
-		return;
-	
-	Spell* spell = luaspell->spell;
-	DetrimentalEffects* det = GetDetrimentalEffect(spell->GetSpellID(), luaspell->caster);
-	DetrimentalEffects new_det;
-	if(det)
-		RemoveDetrimentalSpell(det->spell);
-
-	SpellData* data = spell->GetSpellData();
-	if(!data)
-		return;
-
-	new_det.caster = luaspell->caster;
-	new_det.spell = luaspell;
-	if (spell->GetSpellData()->duration_until_cancel)
-		new_det.expire_timestamp = 0xFFFFFFFF;
-	else if(override_expire_timestamp)
-		new_det.expire_timestamp = override_expire_timestamp;
-	else
-		new_det.expire_timestamp = Timer::GetCurrentTime2() + (spell->GetSpellDuration()*100);
-	new_det.icon = data->icon;
-	new_det.icon_backdrop = data->icon_backdrop;
-	new_det.tier = data->tier;
-	new_det.det_type = data->det_type;
-	new_det.incurable = data->incurable;
-	new_det.spell_id = spell->GetSpellID();
-	new_det.control_effect = data->control_effect_type;
-	new_det.total_time = spell->GetSpellDuration()/10;
-
-	MDetriments.writelock(__FUNCTION__, __LINE__);
-	detrimental_spell_effects.push_back(new_det);
-	det_count_list[new_det.det_type]++;
-	MDetriments.releasewritelock(__FUNCTION__, __LINE__);
-}
-
-DetrimentalEffects* Entity::GetDetrimentalEffect(int32 spell_id, Entity* caster){
-	vector<DetrimentalEffects>* det_list = &detrimental_spell_effects;
-	DetrimentalEffects* ret = 0;
-	MDetriments.readlock(__FUNCTION__, __LINE__);
-	for(int32 i=0; i<det_list->size(); i++){
-		if (det_list->at(i).spell_id == spell_id && det_list->at(i).caster == caster)
-			ret = &det_list->at(i);
-	}
-	MDetriments.releasereadlock(__FUNCTION__, __LINE__);
-	
-	return ret;
-}
-
-void Entity::CancelAllStealth() {
-	bool did_change = false;
-	MutexList<LuaSpell*>* stealth_list = control_effects[CONTROL_EFFECT_TYPE_STEALTH];
-	if (stealth_list){
-		MutexList<LuaSpell*>::iterator itr = stealth_list->begin();
-		while (itr.Next()){
-			if (itr.value->caster == this)
-				GetZone()->GetSpellProcess()->AddSpellCancel(itr.value);
-			else{
-				GetZone()->RemoveTargetFromSpell(itr.value, this);
-				RemoveSpellEffect(itr.value);
-			}
-			did_change = true;
-		}
-	}
-	MutexList<LuaSpell*>* invis_list = control_effects[CONTROL_EFFECT_TYPE_INVIS];
-	if (invis_list){
-		MutexList<LuaSpell*>::iterator invis_itr = invis_list->begin();
-		while (invis_itr.Next()){
-			if (invis_itr.value->caster == this)
-				GetZone()->GetSpellProcess()->AddSpellCancel(invis_itr.value);
-			else{
-				GetZone()->RemoveTargetFromSpell(invis_itr.value, this);
-				RemoveSpellEffect(invis_itr.value);
-			}
-			did_change = true;
-		}
-	}
-
-	if (did_change){
-		info_changed = true;
-		changed = true;
-		AddChangedZoneSpawn();
-		if (IsPlayer())
-			((Player*)this)->SetCharSheetChanged(true);
-	}
-}
-
-bool Entity::IsStealthed(){
-	MutexList<LuaSpell*>* stealth_list = control_effects[CONTROL_EFFECT_TYPE_STEALTH];
-	return  (!stealth_list || stealth_list->size(true) == 0) == false;
-}
-
-bool Entity::CanSeeInvis(Entity* target) {
-	if (!target)
-		return true;
-
-	if (!target->IsStealthed() && !target->IsInvis())
-		return true;
-	if (target->IsStealthed() && HasSeeHideSpell())
-		return true;
-	else if (target->IsInvis() && HasSeeInvisSpell())
-		return true;
-
-	return false;
-}
-
-bool Entity::IsInvis(){
-	MutexList<LuaSpell*>* invis_list = control_effects[CONTROL_EFFECT_TYPE_INVIS];
-	return  (!invis_list || invis_list->size(true) == 0) == false;
-}
-
-void Entity::AddStealthSpell(LuaSpell* spell) {
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_STEALTH])
-		control_effects[CONTROL_EFFECT_TYPE_STEALTH] = new MutexList<LuaSpell*>;
-
-	control_effects[CONTROL_EFFECT_TYPE_STEALTH]->Add(spell);
-	if (control_effects[CONTROL_EFFECT_TYPE_STEALTH]->size(true) == 1){
-		info_changed = true;
-		changed = true;
-		AddChangedZoneSpawn();
-		if (IsPlayer())
-		{
-			((Player*)this)->SetCharSheetChanged(true);
-			GetZone()->SendAllSpawnsForVisChange(GetZone()->GetClientBySpawn(this));
-		}
-	}
-}
-
-void Entity::AddInvisSpell(LuaSpell* spell) {
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_INVIS])
-		control_effects[CONTROL_EFFECT_TYPE_INVIS] = new MutexList<LuaSpell*>;
-
-	control_effects[CONTROL_EFFECT_TYPE_INVIS]->Add(spell);
-	if (control_effects[CONTROL_EFFECT_TYPE_INVIS]->size(true) == 1){
-		info_changed = true;
-		changed = true;
-		AddChangedZoneSpawn();
-		if (IsPlayer())
-		{
-			((Player*)this)->SetCharSheetChanged(true);
-			GetZone()->SendAllSpawnsForVisChange(GetZone()->GetClientBySpawn(this));
-		}
-	}
-}
-
-void Entity::RemoveInvisSpell(LuaSpell* spell) {
-	MutexList<LuaSpell*>* invis_list = control_effects[CONTROL_EFFECT_TYPE_INVIS];
-	if (!invis_list || invis_list->size(true) == 0)
-		return;
-
-	invis_list->Remove(spell);
-	RemoveSpellEffect(spell);
-	if (invis_list->size(true) == 0){
-		info_changed = true;
-		changed = true;
-		AddChangedZoneSpawn();
-		if (IsPlayer())
-		{
-			((Player*)this)->SetCharSheetChanged(true);
-			GetZone()->SendAllSpawnsForVisChange(GetZone()->GetClientBySpawn(this));
-		}
-	}
-}
-
-void Entity::RemoveStealthSpell(LuaSpell* spell) {
-	MutexList<LuaSpell*>* stealth_list = control_effects[CONTROL_EFFECT_TYPE_STEALTH];
-	if (!stealth_list || stealth_list->size(true) == 0)
-		return;
-
-	stealth_list->Remove(spell);
-	RemoveSpellEffect(spell);
-	if (stealth_list->size() == 0){
-		info_changed = true;
-		changed = true;
-		AddChangedZoneSpawn();
-		if (IsPlayer())
-		{
-			((Player*)this)->SetCharSheetChanged(true);
-			GetZone()->SendAllSpawnsForVisChange(GetZone()->GetClientBySpawn(this));
-		}
-	}
-}
-
-void Entity::AddRootSpell(LuaSpell* spell) {
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_ROOT])
-		control_effects[CONTROL_EFFECT_TYPE_ROOT] = new MutexList<LuaSpell*>;
-
-	if (control_effects[CONTROL_EFFECT_TYPE_ROOT]->size(true) == 0 && !IsRootImmune()) {
-		if (IsPlayer()){
-			if (!IsMezzedOrStunned())
-				((Player*)this)->SetPlayerControlFlag(1, 8, true); // heading movement only
-		}
-		else
-			SetSpeedMultiplier(0.0f);
-	}
-
-	control_effects[CONTROL_EFFECT_TYPE_ROOT]->Add(spell);
-}
-
-void Entity::RemoveRootSpell(LuaSpell* spell) {
-	MutexList<LuaSpell*>* root_list = control_effects[CONTROL_EFFECT_TYPE_ROOT];
-	if (!root_list || root_list->size(true) == 0)
-		return;
-
-	root_list->Remove(spell);
-	if (root_list->size(true) == 0 && !IsRootImmune()) {
-		if (IsPlayer()){
-			if (!IsMezzedOrStunned())
-				((Player*)this)->SetPlayerControlFlag(1, 8, false); // heading movement only
-		}
-		else {
-			// GetHighestSnare() will return 1.0f if no snares returning the spawn to full speed
-			SetSpeedMultiplier(GetHighestSnare());
-		}
-	}
-}
-
-void Entity::AddFearSpell(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_FEAR])
-		control_effects[CONTROL_EFFECT_TYPE_FEAR] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && control_effects[CONTROL_EFFECT_TYPE_FEAR]->size(true) == 0 && !IsFearImmune()){
-		((Player*)this)->SetPlayerControlFlag(4, 4, true); // feared
-		if (!IsMezzedOrStunned() && !IsStifled())
-			GetZone()->LockAllSpells((Player*)this);
-	}
-
-	if (!IsFearImmune() && IsNPC())
-	{
-		HaltMovement();
-	}
-
-	control_effects[CONTROL_EFFECT_TYPE_FEAR]->Add(spell);
-}
-
-void Entity::RemoveFearSpell(LuaSpell* spell){
-	MutexList<LuaSpell*>* fear_list = control_effects[CONTROL_EFFECT_TYPE_FEAR];
-	if (!fear_list || fear_list->size(true) == 0)
-		return;
-
-	fear_list->Remove(spell);
-
-	if (IsPlayer() && fear_list->size(true) == 0 && !IsFearImmune()){
-		((Player*)this)->SetPlayerControlFlag(4, 4, false); // feared disabled
-		if (!IsMezzedOrStunned() && !IsStifled())
-			GetZone()->LockAllSpells((Player*)this);
-	}
-
-	if (IsNPC())
-	{
-		HaltMovement();
-	}
-}
-
-void Entity::AddSnareSpell(LuaSpell* spell) {
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_SNARE])
-		control_effects[CONTROL_EFFECT_TYPE_SNARE] = new MutexList<LuaSpell*>;
-
-	control_effects[CONTROL_EFFECT_TYPE_SNARE]->Add(spell);
-
-	// Don't set speed multiplier if there is a root or no snare values
-	MutexList<LuaSpell*>* roots = control_effects[CONTROL_EFFECT_TYPE_ROOT];
-	if ((!roots || roots->size(true) == 0) && snare_values.size() > 0)
-		SetSpeedMultiplier(GetHighestSnare());
-}
-
-void Entity::RemoveSnareSpell(LuaSpell* spell) {
-	MutexList<LuaSpell*>* snare_list = control_effects[CONTROL_EFFECT_TYPE_SNARE];
-	if (!snare_list || snare_list->size(true) == 0)
-		return;
-
-	snare_list->Remove(spell);
-	snare_values.erase(spell);
-
-	//LogWrite(PLAYER__ERROR, 0, "Debug", "snare_values.size() = %u", snare_values.size());
-
-	// only change speeds if there are no roots
-	MutexList<LuaSpell*>* roots = control_effects[CONTROL_EFFECT_TYPE_ROOT];
-	if (!roots || roots->size(true) == 0) {
-		float multiplier = GetHighestSnare();
-		//LogWrite(PLAYER__ERROR, 0, "Debug", "GetHighestSnare() = %f", multiplier);
-		SetSpeedMultiplier(multiplier);
-	}
-}
-
-void Entity::SetSnareValue(LuaSpell* spell, float snare_val) {
-	if (!spell)
-		return;
-
-	snare_values[spell] = snare_val;
-}
-
-float Entity::GetHighestSnare() {
-	// For simplicity this will return the highest snare value, which is actually the lowest value
-	float ret = 1.0f;
-
-	if (snare_values.size() == 0)
-		return ret;
-
-	map<LuaSpell*, float>::iterator itr;
-	for (itr = snare_values.begin(); itr != snare_values.end(); itr++) {
-		if (itr->second < ret)
-			ret = itr->second;
-	}
-
-	return ret;
-}
-
-bool Entity::IsSnared() {
-	if (control_effects.size() < 1 || !control_effects[CONTROL_EFFECT_TYPE_SNARE])
-		return false;
-
-	MutexList<LuaSpell*>* snare_list = control_effects[CONTROL_EFFECT_TYPE_SNARE];
-	return (!snare_list || snare_list->size(true) == 0) == false;
-}
-
-bool Entity::IsMezzed(){
-	if (control_effects.size() < 1 || !control_effects[CONTROL_EFFECT_TYPE_MEZ])
-		return false;
-
-	MutexList<LuaSpell*>* mez_spells = control_effects[CONTROL_EFFECT_TYPE_MEZ];
-	return  (!mez_spells || mez_spells->size(true) == 0 || IsMezImmune()) == false;
-}
-
-bool Entity::IsStifled(){
-	if (!control_effects[CONTROL_EFFECT_TYPE_STIFLE])
-		return false;
-
-	MutexList<LuaSpell*>* stifle_list = control_effects[CONTROL_EFFECT_TYPE_STIFLE];
-	return  (!stifle_list || stifle_list->size(true) == 0 || IsStifleImmune()) == false;
-}
-
-bool Entity::IsDazed(){
-	if (control_effects.size() < 1 || !control_effects[CONTROL_EFFECT_TYPE_DAZE])
-		return false;
-
-	MutexList<LuaSpell*>* daze_list = control_effects[CONTROL_EFFECT_TYPE_DAZE];
-	return  (!daze_list || daze_list->size(true) == 0 || IsDazeImmune()) == false;
-}
-
-bool Entity::IsStunned(){
-	if (!control_effects[CONTROL_EFFECT_TYPE_STUN])
-		return false;
-
-	MutexList<LuaSpell*>* stun_list = control_effects[CONTROL_EFFECT_TYPE_STUN];
-	return (!stun_list || stun_list->size(true) == 0 || IsStunImmune()) == false;
-}
-
-bool Entity::IsRooted(){
-	if (control_effects.size() < 1 || !control_effects[CONTROL_EFFECT_TYPE_ROOT])
-		return false;
-
-	MutexList<LuaSpell*>* root_list = control_effects[CONTROL_EFFECT_TYPE_ROOT];
-	return (!root_list || root_list->size(true) == 0 || IsRootImmune()) == false;
-}
-
-bool Entity::IsFeared(){
-	if (control_effects.size() < 1 || !control_effects[CONTROL_EFFECT_TYPE_FEAR])
-		return false;
-
-	MutexList<LuaSpell*>* fear_list = control_effects[CONTROL_EFFECT_TYPE_FEAR];
-	return (!fear_list || fear_list->size(true) == 0 || IsFearImmune()) == false;
-}
-
-void Entity::AddWaterwalkSpell(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_WALKUNDERWATER])
-		control_effects[CONTROL_EFFECT_TYPE_WALKUNDERWATER] = new MutexList<LuaSpell*>;
-
-	control_effects[CONTROL_EFFECT_TYPE_WALKUNDERWATER]->Add(spell);
-	if (control_effects[CONTROL_EFFECT_TYPE_WALKUNDERWATER]->size(true) == 1 && IsPlayer())
-		((Player*)this)->SetPlayerControlFlag(3, 128, true); // enable walking underwater
-}
-
-void Entity::RemoveWaterwalkSpell(LuaSpell* spell){
-	MutexList<LuaSpell*>* waterwalk_list = control_effects[CONTROL_EFFECT_TYPE_WALKUNDERWATER];
-	if (!waterwalk_list || waterwalk_list->size(true) == 0)
-		return;
-
-	waterwalk_list->Remove(spell);
-	if (waterwalk_list->size(true) == 0 && IsPlayer())
-		((Player*)this)->SetPlayerControlFlag(3, 128, false); // disable walking underwater
-}
-
-void Entity::AddWaterjumpSpell(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_JUMPUNDERWATER])
-		control_effects[CONTROL_EFFECT_TYPE_JUMPUNDERWATER] = new MutexList<LuaSpell*>;
-
-	control_effects[CONTROL_EFFECT_TYPE_JUMPUNDERWATER]->Add(spell);
-	if (control_effects[CONTROL_EFFECT_TYPE_JUMPUNDERWATER]->size(true) == 1 && IsPlayer())
-		((Player*)this)->SetPlayerControlFlag(4, 1, true); // enable moonjumps underwater
-}
-
-void Entity::RemoveWaterjumpSpell(LuaSpell* spell){
-	MutexList<LuaSpell*>* waterjump_list = control_effects[CONTROL_EFFECT_TYPE_JUMPUNDERWATER];
-	if (!waterjump_list || waterjump_list->size(true) == 0)
-		return;
-
-	waterjump_list->Remove(spell);
-	if (waterjump_list->size(true) == 0 && IsPlayer())
-		((Player*)this)->SetPlayerControlFlag(4, 1, false); // disable moonjumps underwater
-}
-
-void Entity::AddAOEImmunity(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!immunities[IMMUNITY_TYPE_AOE])
-		immunities[IMMUNITY_TYPE_AOE] = new MutexList<LuaSpell*>;
-
-	immunities[IMMUNITY_TYPE_AOE]->Add(spell);
-}
-
-void Entity::RemoveAOEImmunity(LuaSpell* spell){
-	MutexList<LuaSpell*>* aoe_list = immunities[IMMUNITY_TYPE_AOE];
-	if (!aoe_list || aoe_list->size(true) == 0)
-		return;
-	aoe_list->Remove(spell);
-}
-
-bool Entity::IsAOEImmune(){
-	return (immunities[IMMUNITY_TYPE_AOE] && immunities[IMMUNITY_TYPE_AOE]->size(true));
-}
-
-void Entity::AddStunImmunity(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!immunities[IMMUNITY_TYPE_STUN])
-		immunities[IMMUNITY_TYPE_STUN] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && IsStunned() && !IsMezzed()){
-		((Player*)this)->SetPlayerControlFlag(4, 64, false);
-		if (!IsFeared() && !IsStifled())
-			((Player*)this)->UnlockAllSpells();
-	}
-
-	immunities[IMMUNITY_TYPE_STUN]->Add(spell);
-}
-
-void Entity::RemoveStunImmunity(LuaSpell* spell){
-	MutexList<LuaSpell*>* stun_list = immunities[IMMUNITY_TYPE_STUN];
-	if (!stun_list || stun_list->size(true) == 0)
-		return;
-
-	stun_list->Remove(spell);
-
-	if (IsPlayer() && IsStunned() && !IsMezzed()){
-		((Player*)this)->SetPlayerControlFlag(4, 64, true);
-		if (!IsFeared() && !IsStifled())
-			((Player*)this)->UnlockAllSpells();
-	}
-}
-
-bool Entity::IsStunImmune(){
-	return (immunities[IMMUNITY_TYPE_STUN] && immunities[IMMUNITY_TYPE_STUN]->size(true) > 0);
-}
-
-void Entity::AddStifleImmunity(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!immunities[IMMUNITY_TYPE_STIFLE])
-		immunities[IMMUNITY_TYPE_STIFLE] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && immunities[IMMUNITY_TYPE_STIFLE]->size(true) == 0){
-		if (IsStifled() && !IsMezzedOrStunned() && !IsFeared())
-			((Player*)this)->UnlockAllSpells();
-	}
-
-	immunities[IMMUNITY_TYPE_STIFLE]->Add(spell);
-}
-
-void Entity::RemoveStifleImmunity(LuaSpell* spell){
-	MutexList<LuaSpell*>* stifle_list = immunities[IMMUNITY_TYPE_STIFLE];
-	if (!stifle_list || stifle_list->size(true) == 0)
-		return;
-
-	stifle_list->Remove(spell);
-
-	if (IsPlayer() && IsStifled() && !IsMezzedOrStunned() && !IsFeared())
-		((Player*)this)->UnlockAllSpells();
-}
-
-bool Entity::IsStifleImmune(){
-	return (immunities[IMMUNITY_TYPE_STIFLE] && immunities[IMMUNITY_TYPE_STIFLE]->size(true) > 0);
-}
-
-void Entity::AddMezImmunity(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!immunities[IMMUNITY_TYPE_MEZ])
-		immunities[IMMUNITY_TYPE_MEZ] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && IsMezzed() && !IsStunned()){
-		((Player*)this)->SetPlayerControlFlag(4, 64, false);
-		if (!IsFeared() && !IsStifled())
-			((Player*)this)->UnlockAllSpells();
-	}
-
-	immunities[IMMUNITY_TYPE_MEZ]->Add(spell);
-}
-
-void Entity::RemoveMezImmunity(LuaSpell* spell){
-	MutexList<LuaSpell*>* mez_list = immunities[IMMUNITY_TYPE_MEZ];
-	if (!mez_list || mez_list->size(true) == 0)
-		return;
-
-	mez_list->Remove(spell);
-
-	if (IsPlayer() && IsMezzed() && !IsStunned()){
-		((Player*)this)->SetPlayerControlFlag(4, 64, true);
-		if (!IsFeared() && !IsStifled())
-			((Player*)this)->LockAllSpells();
-	}
-}
-
-bool Entity::IsMezImmune(){
-	return (immunities[IMMUNITY_TYPE_MEZ] && immunities[IMMUNITY_TYPE_MEZ]->size(true) > 0);
-}
-
-void Entity::AddRootImmunity(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!immunities[IMMUNITY_TYPE_ROOT])
-		immunities[IMMUNITY_TYPE_ROOT] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && IsRooted())
-		((Player*)this)->SetPlayerControlFlag(1, 8, false);
-
-	immunities[IMMUNITY_TYPE_ROOT]->Add(spell);
-}
-
-void Entity::RemoveRootImmunity(LuaSpell* spell){
-	MutexList<LuaSpell*>* root_list = immunities[IMMUNITY_TYPE_ROOT];
-	if (!root_list || root_list->size(true) == 0)
-		return;
-
-	root_list->Remove(spell);
-
-	if (IsPlayer() && IsRooted())
-		((Player*)this)->SetPlayerControlFlag(1, 8, true);
-}
-
-bool Entity::IsRootImmune(){
-	return (immunities[IMMUNITY_TYPE_ROOT] && immunities[IMMUNITY_TYPE_ROOT]->size(true) > 0);
-}
-
-void Entity::AddFearImmunity(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!immunities[IMMUNITY_TYPE_FEAR])
-		immunities[IMMUNITY_TYPE_FEAR] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && IsFeared()){
-		if (!IsMezzedOrStunned() && !IsStifled())
-			((Player*)this)->UnlockAllSpells();
-		((Player*)this)->SetPlayerControlFlag(4, 4, false);
-	}
-
-	immunities[IMMUNITY_TYPE_FEAR]->Add(spell);
-}
-
-void Entity::RemoveFearImmunity(LuaSpell* spell){
-	MutexList<LuaSpell*>* fear_list = immunities[IMMUNITY_TYPE_FEAR];
-	if (!fear_list || fear_list->size(true) == 0)
-		return;
-
-	fear_list->Remove(spell);
-
-	if (IsPlayer() && IsFeared()){
-		if (!IsMezzedOrStunned() && !IsStifled())
-			((Player*)this)->LockAllSpells();
-		((Player*)this)->SetPlayerControlFlag(4, 4, true);
-	}
-}
-
-bool Entity::IsFearImmune(){
-	return (immunities[IMMUNITY_TYPE_FEAR] && immunities[IMMUNITY_TYPE_FEAR]->size(true) > 0);
-}
-
-void Entity::AddDazeImmunity(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!immunities[IMMUNITY_TYPE_DAZE])
-		immunities[IMMUNITY_TYPE_DAZE] = new MutexList<LuaSpell*>;
-
-	immunities[IMMUNITY_TYPE_DAZE]->Add(spell);
-}
-
-void Entity::RemoveDazeImmunity(LuaSpell* spell){
-	MutexList<LuaSpell*>* daze_list = immunities[IMMUNITY_TYPE_DAZE];
-	if (!daze_list || daze_list->size(true) == 0)
-		return;
-
-	daze_list->Remove(spell);
-}
-
-bool Entity::IsDazeImmune(){
-	return (immunities[IMMUNITY_TYPE_DAZE] && immunities[IMMUNITY_TYPE_DAZE]->size(true) > 0);
-}
-
-void Entity::AddImmunity(LuaSpell* spell, int16 type){
-	if (!spell)
-		return;
-
-	if (!immunities[type])
-		immunities[type] = new MutexList<LuaSpell*>;
-
-	immunities[type]->Add(spell);
-}
-
-void Entity::RemoveImmunity(LuaSpell* spell, int16 type){
-	MutexList<LuaSpell*>* list = immunities[type];
-	if (!list || list->size(true) == 0)
-		return;
-
-	list->Remove(spell);
-}
-
-bool Entity::IsImmune(int16 type){
-	return (immunities[type] && immunities[type]->size(true) > 0);
-}
-
-void Entity::RemoveEffectsFromLuaSpell(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	//Attempt to remove all applied effects from this spell when spell has been removed from just this target. Should improve performance/easier maitenance
-	int32 effect_bitmask = spell->effect_bitmask;
-	if (effect_bitmask == 0)
-		return;
-
-	if (effect_bitmask & EFFECT_FLAG_STUN)
-		RemoveStunSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_ROOT)
-		RemoveRootSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_MEZ)
-		RemoveMezSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_STIFLE)
-		RemoveStifleSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_DAZE)
-		RemoveDazeSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_FEAR)
-		RemoveFearSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_SPELLBONUS)
-		RemoveSpellBonus(spell);
-	if (effect_bitmask & EFFECT_FLAG_SKILLBONUS)
-		RemoveSkillBonus(spell->spell->GetSpellID());
-	if (effect_bitmask & EFFECT_FLAG_STEALTH)
-		RemoveStealthSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_INVIS)
-		RemoveInvisSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_SNARE)
-		RemoveSnareSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_WATERWALK)
-		RemoveWaterwalkSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_WATERJUMP)
-		RemoveWaterjumpSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_FLIGHT)
-		RemoveFlightSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_GLIDE)
-		RemoveGlideSpell(spell);
-	if (effect_bitmask & EFFECT_FLAG_AOE_IMMUNE)
-		RemoveAOEImmunity(spell);
-	if (effect_bitmask & EFFECT_FLAG_STUN_IMMUNE)
-		RemoveStunImmunity(spell);
-	if (effect_bitmask & EFFECT_FLAG_MEZ_IMMUNE)
-		RemoveMezImmunity(spell);
-	if (effect_bitmask & EFFECT_FLAG_DAZE_IMMUNE)
-		RemoveDazeImmunity(spell);
-	if (effect_bitmask & EFFECT_FLAG_ROOT_IMMUNE)
-		RemoveRootImmunity(spell);
-	if (effect_bitmask & EFFECT_FLAG_STIFLE_IMMUNE)
-		RemoveStifleImmunity(spell);
-	if (effect_bitmask & EFFECT_FLAG_FEAR_IMMUNE)
-		RemoveFearImmunity(spell);
-	if (effect_bitmask & EFFECT_FLAG_SAFEFALL)
-		RemoveSafefallSpell(spell);
-}
-
-void Entity::RemoveSkillBonus(int32 spell_id){
-	//This is a virtual, just making it so we don't have to do extra checks for player/npcs
-	return;
-}
-
-void Entity::AddFlightSpell(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_FLIGHT])
-		control_effects[CONTROL_EFFECT_TYPE_FLIGHT] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && control_effects[CONTROL_EFFECT_TYPE_FLIGHT]->size(true) == 0)
-		((Player*)this)->SetPlayerControlFlag(5, 32, true);
-
-	control_effects[CONTROL_EFFECT_TYPE_FLIGHT]->Add(spell);
-}
-
-void Entity::RemoveFlightSpell(LuaSpell* spell){
-	MutexList<LuaSpell*>* flight_list = control_effects[CONTROL_EFFECT_TYPE_FLIGHT];
-	if (!flight_list || flight_list->size(true) == 0)
-		return;
-
-	flight_list->Remove(spell);
-	if (IsPlayer() && flight_list->size(true) == 0)
-		((Player*)this)->SetPlayerControlFlag(5, 32, false);
-}
-
-void Entity::AddGlideSpell(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_GLIDE])
-		control_effects[CONTROL_EFFECT_TYPE_GLIDE] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && control_effects[CONTROL_EFFECT_TYPE_GLIDE]->size(true) == 0)
-		((Player*)this)->SetPlayerControlFlag(4, 16, true);
-
-	control_effects[CONTROL_EFFECT_TYPE_GLIDE]->Add(spell);
-}
-
-void Entity::RemoveGlideSpell(LuaSpell* spell){
-	MutexList<LuaSpell*>* glide_list = control_effects[CONTROL_EFFECT_TYPE_GLIDE];
-	if (!glide_list || glide_list->size(true) == 0)
-		return;
-
-	glide_list->Remove(spell);
-	if (IsPlayer() && glide_list->size(true) == 0)
-		((Player*)this)->SetPlayerControlFlag(4, 16, false);
-}
-
-void Entity::AddSafefallSpell(LuaSpell* spell){
-	if (!spell)
-		return;
-
-	if (!control_effects[CONTROL_EFFECT_TYPE_SAFEFALL])
-		control_effects[CONTROL_EFFECT_TYPE_SAFEFALL] = new MutexList<LuaSpell*>;
-
-	if (IsPlayer() && control_effects[CONTROL_EFFECT_TYPE_SAFEFALL]->size(true) == 0)
-		((Player*)this)->SetPlayerControlFlag(4, 32, true);
-
-	control_effects[CONTROL_EFFECT_TYPE_SAFEFALL]->Add(spell);
-}
-
-void Entity::RemoveSafefallSpell(LuaSpell* spell){
-	MutexList<LuaSpell*>* safe_list = control_effects[CONTROL_EFFECT_TYPE_SAFEFALL];
-	if (!safe_list || safe_list->size(true) == 0)
-		return;
-
-	safe_list->Remove(spell);
-	if (IsPlayer() && safe_list->size(true) == 0)
-		((Player*)this)->SetPlayerControlFlag(4, 32, false);
-}
-
-void Entity::UpdateGroupMemberInfo(bool inGroupMgrLock, bool groupMembersLocked) {
-	if (!group_member_info || group_id == 0)
-		return;
-
-	if(!inGroupMgrLock)
-		world.GetGroupManager()->GroupLock(__FUNCTION__, __LINE__);
-
-	PlayerGroup* group = world.GetGroupManager()->GetGroup(group_id);
-
-	if (group)
-		group->UpdateGroupMemberInfo(this, groupMembersLocked);
-
-	if(!inGroupMgrLock)
-		world.GetGroupManager()->ReleaseGroupLock(__FUNCTION__, __LINE__);
-}
-
-#include "WorldDatabase.h"
-extern WorldDatabase database;
-void Entity::CustomizeAppearance(PacketStruct* packet) {
-
-	bool		is_soga						= packet->getType_int8_ByName("is_soga") == 1 ? true : false;
-	int16		model_id					= database.GetAppearanceID(packet->getType_EQ2_16BitString_ByName("race_file").data);
-	EQ2_Color	skin_color					= packet->getType_EQ2_Color_ByName("skin_color");
-	EQ2_Color	skin_color2					= packet->getType_EQ2_Color_ByName("skin_color2");
-	EQ2_Color	eye_color					= packet->getType_EQ2_Color_ByName("eye_color");
-	EQ2_Color	hair_color1					= packet->getType_EQ2_Color_ByName("hair_color1");
-	EQ2_Color	hair_color2					= packet->getType_EQ2_Color_ByName("hair_color2");
-	EQ2_Color	hair_highlight				= packet->getType_EQ2_Color_ByName("hair_highlight");
-	int16		hair_id						= database.GetAppearanceID(packet->getType_EQ2_16BitString_ByName("hair_file").data);
-	EQ2_Color	hair_type_color				= packet->getType_EQ2_Color_ByName("hair_type_color");
-	EQ2_Color	hair_type_highlight_color	= packet->getType_EQ2_Color_ByName("hair_type_highlight_color");
-	int16		face_id						= database.GetAppearanceID(packet->getType_EQ2_16BitString_ByName("face_file").data);
-	EQ2_Color	hair_face_color				= packet->getType_EQ2_Color_ByName("hair_face_color");
-	EQ2_Color	hair_face_highlight_color	= packet->getType_EQ2_Color_ByName("hair_face_highlight_color");
-	int16		wing_id						= database.GetAppearanceID(packet->getType_EQ2_16BitString_ByName("wing_file").data);
-	EQ2_Color	wing_color1					= packet->getType_EQ2_Color_ByName("wing_color1");
-	EQ2_Color	wing_color2					= packet->getType_EQ2_Color_ByName("wing_color2");
-	int16		chest_id					= database.GetAppearanceID(packet->getType_EQ2_16BitString_ByName("chest_file").data);
-	EQ2_Color	shirt_color					= packet->getType_EQ2_Color_ByName("shirt_color");
-	EQ2_Color	unknown_chest_color			= packet->getType_EQ2_Color_ByName("unknown_chest_color");
-	int16		legs_id						= database.GetAppearanceID(packet->getType_EQ2_16BitString_ByName("legs_file").data);
-	EQ2_Color	pants_color					= packet->getType_EQ2_Color_ByName("pants_color");
-	EQ2_Color	unknown_legs_color			= packet->getType_EQ2_Color_ByName("unknown_legs_color");
-	EQ2_Color	unknown2					= packet->getType_EQ2_Color_ByName("unknown2");
-
-	float eyes2[3];
-	eyes2[0] = packet->getType_float_ByName("eyes2", 0) * 100;
-	eyes2[1] = packet->getType_float_ByName("eyes2", 1) * 100;
-	eyes2[2] = packet->getType_float_ByName("eyes2", 2) * 100;
-
-	float ears[3];
-	ears[0] = packet->getType_float_ByName("ears", 0) * 100;
-	ears[1] = packet->getType_float_ByName("ears", 1) * 100;
-	ears[2] = packet->getType_float_ByName("ears", 2) * 100;
-
-	float eye_brows[3];
-	eye_brows[0] = packet->getType_float_ByName("eye_brows", 0) * 100;
-	eye_brows[1] = packet->getType_float_ByName("eye_brows", 1) * 100;
-	eye_brows[2] = packet->getType_float_ByName("eye_brows", 2) * 100;
-
-	float cheeks[3];
-	cheeks[0] = packet->getType_float_ByName("cheeks", 0) * 100;
-	cheeks[1] = packet->getType_float_ByName("cheeks", 1) * 100;
-	cheeks[2] = packet->getType_float_ByName("cheeks", 2) * 100;
-
-	float lips[3];
-	lips[0] = packet->getType_float_ByName("lips", 0) * 100;
-	lips[1] = packet->getType_float_ByName("lips", 1) * 100;
-	lips[2] = packet->getType_float_ByName("lips", 2) * 100;
-
-	float chin[3];
-	chin[0] = packet->getType_float_ByName("chin", 0) * 100;
-	chin[1] = packet->getType_float_ByName("chin", 1) * 100;
-	chin[2] = packet->getType_float_ByName("chin", 2) * 100;
-
-	float nose[3];
-	nose[0] = packet->getType_float_ByName("nose", 0) * 100;
-	nose[1] = packet->getType_float_ByName("nose", 1) * 100;
-	nose[2] = packet->getType_float_ByName("nose", 2) * 100;
-
-	sint8 body_size = (sint8)(packet->getType_float_ByName("body_size") * 100);
-	sint8 body_age = (sint8)(packet->getType_float_ByName("body_age") * 100);
-
-	if (is_soga) {
-		appearance.soga_model_type = model_id;
-		features.soga_skin_color = skin_color;
-		features.soga_eye_color = eye_color;
-		features.soga_hair_color1 = hair_color1;
-		features.soga_hair_color2 = hair_color2;
-		features.soga_hair_highlight_color = hair_highlight;
-		features.soga_hair_type = hair_id;
-		features.soga_hair_type_color = hair_type_color;
-		features.soga_hair_type_highlight_color = hair_type_highlight_color;
-		features.soga_hair_face_type = face_id;
-		features.soga_hair_face_color = hair_face_color;
-		features.soga_hair_face_highlight_color = hair_face_highlight_color;
-		features.wing_type = wing_id;
-		features.wing_color1 = wing_color1;
-		features.wing_color2 = wing_color2;
-		features.soga_chest_type = chest_id;
-		features.shirt_color = shirt_color;
-		features.soga_legs_type = legs_id;
-		features.pants_color = pants_color;
-		features.soga_eye_type[0] = eyes2[0];
-		features.soga_eye_type[1] = eyes2[1];
-		features.soga_eye_type[2] = eyes2[2];
-		features.soga_ear_type[0] = ears[0];
-		features.soga_ear_type[0] = ears[1];
-		features.soga_ear_type[0] = ears[2];
-		features.soga_eye_brow_type[0] = eye_brows[0];
-		features.soga_eye_brow_type[1] = eye_brows[1];
-		features.soga_eye_brow_type[2] = eye_brows[2];
-		features.soga_cheek_type[0] = cheeks[0];
-		features.soga_cheek_type[1] = cheeks[1];
-		features.soga_cheek_type[2] = cheeks[2];
-		features.soga_lip_type[0] = lips[0];
-		features.soga_lip_type[1] = lips[1];
-		features.soga_lip_type[2] = lips[2];
-		features.soga_chin_type[0] = chin[0];
-		features.soga_chin_type[1] = chin[1];
-		features.soga_chin_type[2] = chin[2];
-		features.soga_nose_type[0] = nose[0];
-		features.soga_nose_type[1] = nose[1];
-		features.soga_nose_type[2] = nose[2];
-	}
-	else {
-		appearance.model_type = model_id;
-		features.skin_color = skin_color;
-		features.eye_color = eye_color;
-		features.hair_color1 = hair_color1;
-		features.hair_color2 = hair_color2;
-		features.hair_highlight_color = hair_highlight;
-		features.hair_type = hair_id;
-		features.hair_type_color = hair_type_color;
-		features.hair_type_highlight_color = hair_type_highlight_color;
-		features.hair_face_type = face_id;
-		features.hair_face_color = hair_face_color;
-		features.hair_face_highlight_color = hair_face_highlight_color;
-		features.wing_type = wing_id;
-		features.wing_color1 = wing_color1;
-		features.wing_color2 = wing_color2;
-		features.chest_type = chest_id;
-		features.shirt_color = shirt_color;
-		features.legs_type = legs_id;
-		features.pants_color = pants_color;
-		features.eye_type[0] = eyes2[0];
-		features.eye_type[1] = eyes2[1];
-		features.eye_type[2] = eyes2[2];
-		features.ear_type[0] = ears[0];
-		features.ear_type[0] = ears[1];
-		features.ear_type[0] = ears[2];
-		features.eye_brow_type[0] = eye_brows[0];
-		features.eye_brow_type[1] = eye_brows[1];
-		features.eye_brow_type[2] = eye_brows[2];
-		features.cheek_type[0] = cheeks[0];
-		features.cheek_type[1] = cheeks[1];
-		features.cheek_type[2] = cheeks[2];
-		features.lip_type[0] = lips[0];
-		features.lip_type[1] = lips[1];
-		features.lip_type[2] = lips[2];
-		features.chin_type[0] = chin[0];
-		features.chin_type[1] = chin[1];
-		features.chin_type[2] = chin[2];
-		features.nose_type[0] = nose[0];
-		features.nose_type[1] = nose[1];
-		features.nose_type[2] = nose[2];
-	}
-
-	features.body_size = body_size;
-	features.body_age = body_age;
-	features.soga_body_size = body_size;
-	features.soga_body_age = body_age;
-	info_changed = true;
-	changed = true;
-}
-
-void Entity::AddSkillBonus(int32 spell_id, int32 skill_id, float value) {
-	// handled in npc or player
-	return;
-}
-
-bool Entity::HasControlEffect(int8 type)
-{
-	if (type >= CONTROL_MAX_EFFECTS)
-		return false;
-
-	MutexList<LuaSpell*>* spell_list = control_effects[type];
-	if (!spell_list || spell_list->size(true) == 0)
-		return false;
-
-	return true;
-}
-
-void Entity::HaltMovement()
-{
-	this->ClearRunningLocations();
-
-	if (GetZone())
-		GetZone()->movementMgr->StopNavigation(this);
-
-	RunToLocation(GetX(), GetY(), GetZ());
-}	
-
-std::string Entity::GetInfoStructString(std::string field)
-{
-		map<string, boost::function<std::string()>>::const_iterator itr = get_string_funcs.find(field);
-		if(itr != get_string_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-	return std::string("");
-}
-
-int8 Entity::GetInfoStructInt8(std::string field)
-{
-		map<string, boost::function<int8()>>::const_iterator itr = get_int8_funcs.find(field);
-		if(itr != get_int8_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-	return 0;
-}
-
-int16 Entity::GetInfoStructInt16(std::string field)
-{
-		map<string, boost::function<int16()>>::const_iterator itr = get_int16_funcs.find(field);
-		if(itr != get_int16_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-	return 0;
-}
-
-int32 Entity::GetInfoStructInt32(std::string field)
-{
-		map<string, boost::function<int32()>>::const_iterator itr = get_int32_funcs.find(field);
-		if(itr != get_int32_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-	return 0;
-}
-
-int64 Entity::GetInfoStructInt64(std::string field)
-{
-		map<string, boost::function<int64()>>::const_iterator itr = get_int64_funcs.find(field);
-		if(itr != get_int64_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-	return 0;
-}
-
-sint8 Entity::GetInfoStructSInt8(std::string field)
-{
-		map<string, boost::function<sint8()>>::const_iterator itr = get_sint8_funcs.find(field);
-		if(itr != get_sint8_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-	return 0;
-}
-
-sint16 Entity::GetInfoStructSInt16(std::string field)
-{
-		map<string, boost::function<sint16()>>::const_iterator itr = get_sint16_funcs.find(field);
-		if(itr != get_sint16_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-	return 0;
-}
-
-sint32 Entity::GetInfoStructSInt32(std::string field)
-{
-		map<string, boost::function<sint32()>>::const_iterator itr = get_sint32_funcs.find(field);
-		if(itr != get_sint32_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-	return 0;
-}
-
-sint64 Entity::GetInfoStructSInt64(std::string field)
-{
-		map<string, boost::function<sint64()>>::const_iterator itr = get_sint64_funcs.find(field);
-		if(itr != get_sint64_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-	return 0;
-}
-
-float Entity::GetInfoStructFloat(std::string field)
-{
-		map<string, boost::function<float()>>::const_iterator itr = get_float_funcs.find(field);
-		if(itr != get_float_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-	return 0.0f;
-}
-
-int64 Entity::GetInfoStructUInt(std::string field)
-{
-		map<string, boost::function<int8()>>::const_iterator itr = get_int8_funcs.find(field);
-		if(itr != get_int8_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-		map<string, boost::function<int16()>>::const_iterator itr2 = get_int16_funcs.find(field);
-		if(itr2 != get_int16_funcs.end())
-		{
-			auto func = (itr2->second)();
-			return func;
-		}
-		map<string, boost::function<int32()>>::const_iterator itr3 = get_int32_funcs.find(field);
-		if(itr3 != get_int32_funcs.end())
-		{
-			auto func = (itr3->second)();
-			return func;
-		}
-		map<string, boost::function<int64()>>::const_iterator itr4 = get_int64_funcs.find(field);
-		if(itr4 != get_int64_funcs.end())
-		{
-			auto func = (itr4->second)();
-			return func;
-		}
-	return 0;
-}
-
-sint64 Entity::GetInfoStructSInt(std::string field)
-{
-		map<string, boost::function<sint8()>>::const_iterator itr = get_sint8_funcs.find(field);
-		if(itr != get_sint8_funcs.end())
-		{
-			auto func = (itr->second)();
-			return func;
-		}
-		map<string, boost::function<sint16()>>::const_iterator itr2 = get_sint16_funcs.find(field);
-		if(itr2 != get_sint16_funcs.end())
-		{
-			auto func = (itr2->second)();
-			return func;
-		}
-		map<string, boost::function<sint32()>>::const_iterator itr3 = get_sint32_funcs.find(field);
-		if(itr3 != get_sint32_funcs.end())
-		{
-			auto func = (itr3->second)();
-			return func;
-		}
-		map<string, boost::function<sint64()>>::const_iterator itr4 = get_sint64_funcs.find(field);
-		if(itr4 != get_sint64_funcs.end())
-		{
-			auto func = (itr4->second)();
-			return func;
-		}
-	return 0;
-}
-
-
-bool Entity::SetInfoStructString(std::string field, std::string value)
-{
-		map<string, boost::function<void(std::string)>>::const_iterator itr = set_string_funcs.find(field);
-		if(itr != set_string_funcs.end())
-		{
-			(itr->second)(value);
-			return true;
-		}
-	return false;
-}
-
-
-bool Entity::SetInfoStructUInt(std::string field, int64 value)
-{
-		map<string, boost::function<void(int8)>>::const_iterator itr = set_int8_funcs.find(field);
-		if(itr != set_int8_funcs.end())
-		{
-			(itr->second)((int8)value);
-			return true;
-		}
-		map<string, boost::function<void(int16)>>::const_iterator itr2 = set_int16_funcs.find(field);
-		if(itr2 != set_int16_funcs.end())
-		{
-			(itr2->second)((int16)value);
-			return true;
-		}
-		map<string, boost::function<void(int32)>>::const_iterator itr3 = set_int32_funcs.find(field);
-		if(itr3 != set_int32_funcs.end())
-		{
-			(itr3->second)((int32)value);
-			return true;
-		}
-		map<string, boost::function<void(int64)>>::const_iterator itr4 = set_int64_funcs.find(field);
-		if(itr4 != set_int64_funcs.end())
-		{
-			(itr4->second)(value);
-			return true;
-		}
-	return false;
-}
-
-bool Entity::SetInfoStructSInt(std::string field, sint64 value)
-{
-		map<string, boost::function<void(sint8)>>::const_iterator itr = set_sint8_funcs.find(field);
-		if(itr != set_sint8_funcs.end())
-		{
-			(itr->second)((sint8)value);
-			return true;
-		}
-		map<string, boost::function<void(sint16)>>::const_iterator itr2 = set_sint16_funcs.find(field);
-		if(itr2 != set_sint16_funcs.end())
-		{
-			(itr2->second)((sint16)value);
-			return true;
-		}
-		map<string, boost::function<void(sint32)>>::const_iterator itr3 = set_sint32_funcs.find(field);
-		if(itr3 != set_sint32_funcs.end())
-		{
-			(itr3->second)((sint32)value);
-			return true;
-		}
-		map<string, boost::function<void(sint64)>>::const_iterator itr4 = set_sint64_funcs.find(field);
-		if(itr4 != set_sint64_funcs.end())
-		{
-			(itr4->second)(value);
-			return true;
-		}
-	return false;
-}
-
-bool Entity::SetInfoStructFloat(std::string field, float value)
-{
-		map<string, boost::function<void(float)>>::const_iterator itr = set_float_funcs.find(field);
-		if(itr != set_float_funcs.end())
-		{
-			(itr->second)(value);
-			return true;
-		}
-	return false;
-}
-
-Entity*	Entity::GetOwner() {
-	Entity* ent = nullptr;
-
-	Spawn* spawn = GetZone()->GetSpawnByID(owner);
-	if ( spawn && spawn->IsEntity() )
-		ent = (Entity*)spawn;
-
-	return ent;
-}

+ 0 - 1786
EQ2EMu/EQ2/source/WorldServer/Entity.h

@@ -1,1786 +0,0 @@
-/*  
-    EQ2Emulator:  Everquest II Server Emulator
-    Copyright (C) 2007  EQ2EMulator Development Team (http://www.eq2emulator.net)
-
-    This file is part of EQ2Emulator.
-
-    EQ2Emulator is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    EQ2Emulator is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with EQ2Emulator.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef __EQ2_ENTITY__
-#define __EQ2_ENTITY__
-#include "Spawn.h"
-#include "../common/Mutex.h"
-#include "Skills.h"
-#include "MutexList.h"
-#include "MutexVector.h"
-#include <set>
-#include <mutex>
-#include <vector>
-#include <boost/function.hpp>
-#include <boost/lambda/bind.hpp>
-
-namespace l = boost::lambda;
-
-class Entity;
-class NPC;
-class Trade;
-struct LuaSpell;
-struct GroupMemberInfo;
-
-struct BonusValues{
-	int32	spell_id;
-	int8    tier;
-	int16	type;
-	sint32	value;
-	int64	class_req;
-	vector<int16>	race_req;
-	vector<int16>	faction_req;
-	LuaSpell* luaspell;
-};
-
-struct MaintainedEffects{
-	char	name[60]; //name of the spell
-	int32	target;
-	int8	target_type;
-	int32	spell_id; 
-	int32	slot_pos; 
-	int16	icon;
-	int16	icon_backdrop;
-	int8	conc_used;
-	int8	tier;
-	float	total_time;
-	int32	expire_timestamp;
-	LuaSpell* spell;
-};
-
-struct SpellEffects{
-	int32	spell_id; 
-	Entity*	caster;
-	float	total_time;
-	int32	expire_timestamp;
-	int16	icon;
-	int16	icon_backdrop;
-	int8	tier;
-	LuaSpell* spell;
-};
-
-struct DetrimentalEffects {
-	int32	spell_id; 
-	Entity*	caster;
-	int32	expire_timestamp;
-	int16	icon;
-	int16	icon_backdrop;
-	int8	tier;
-	int8    det_type;
-	bool    incurable;
-	LuaSpell*  spell;
-	int8    control_effect;
-	float   total_time;
-};
-
-struct CombatData{
-	int32			range_last_attack_time;
-	int32			primary_last_attack_time;
-	int32			secondary_last_attack_time;
-	int16			primary_attack_delay;
-	int16			secondary_attack_delay;
-	int16			ranged_attack_delay;
-	int8			primary_weapon_type;
-	int8			secondary_weapon_type;
-	int8			ranged_weapon_type;
-	int32			primary_weapon_damage_low;
-	int32			primary_weapon_damage_high;
-	int32			secondary_weapon_damage_low;
-	int32			secondary_weapon_damage_high;
-	int32			ranged_weapon_damage_low;
-	int32			ranged_weapon_damage_high;
-	int8			wield_type;
-	int16           primary_weapon_delay;
-	int16           secondary_weapon_delay;
-	int16           ranged_weapon_delay;
-};
-
-struct InfoStruct{
-	InfoStruct()
-	{
-		name_ = std::string("");
-		class1_ = 0;
-		class2_ = 0;
-		class3_ = 0;
-		race_ = 0;
-		gender_ = 0;
-		level_ = 0;
-		max_level_ = 0;
-		effective_level_ = 0;
-		tradeskill_level_ = 0;
-		tradeskill_max_level_ = 0;
-		cur_concentration_ = 0;
-		max_concentration_ = 0;
-		cur_attack_ = 0;
-		attack_base_ = 0;
-		cur_mitigation_ = 0;
-		max_mitigation_ = 0;
-		mitigation_base_ = 0;
-		avoidance_display_ = 0;
-		cur_avoidance_ = 0.0f;
-		base_avoidance_pct_ = 0;
-		avoidance_base_ = 0;
-		max_avoidance_ = 0;
-		parry_ = 0.0f;
-		parry_base_ = 0.0f;
-		deflection_ = 0;
-		deflection_base_ = 0;
-		block_ = 0;
-		block_base_ = 0;
-		str_ = 0.0f;
-		sta_ = 0.0f;
-		agi_ = 0.0f;
-		wis_ = 0.0f;
-		intel_ = 0.0f;
-		str_base_ = 0.0f;
-		sta_base_ = 0.0f;
-		agi_base_ = 0.0f;
-		wis_base_ = 0.0f;
-		intel_base_ = 0.0f;
-		heat_ = 0;
-		cold_ = 0;
-		magic_ = 0;
-		mental_ = 0;
-		divine_ = 0;
-		disease_ = 0;
-		poison_ = 0;
-		disease_base_ = 0;
-		cold_base_ = 0;
-		divine_base_ = 0;
-		magic_base_ = 0;
-		mental_base_ = 0;
-		heat_base_ = 0;
-		poison_base_ = 0;
-		elemental_base_ = 0;
-		noxious_base_ = 0;
-		arcane_base_ = 0;
-		coin_copper_ = 0;
-		coin_silver_ = 0;
-		coin_gold_ = 0;
-		coin_plat_ = 0;
-		bank_coin_copper_ = 0;
-		bank_coin_silver_ = 0;
-		bank_coin_gold_ = 0;
-		bank_coin_plat_ = 0;
-		status_points_ = 0;
-		deity_ = std::string("");
-		weight_ = 0;
-		max_weight_ = 0;
-		tradeskill_class1_ = 0;
-		tradeskill_class2_ = 0;
-		tradeskill_class3_ = 0;
-		account_age_base_ = 0;
-
-		memset(account_age_bonus_,0,19);
-		absorb_ = 0;
-		xp_ = 0;
-		xp_needed_ = 0;
-		xp_debt_ = 0.0f;
-		xp_yellow_ = 0;
-		xp_yellow_vitality_bar_ = 0;
-		xp_blue_vitality_bar_ = 0;
-		xp_blue_ = 0;
-		ts_xp_ = 0;
-		ts_xp_needed_ = 0;
-		tradeskill_exp_yellow_ = 0;
-		tradeskill_exp_blue_ = 0;
-		flags_ = 0;
-		flags2_ = 0;
-		xp_vitality_ = 0;
-		tradeskill_xp_vitality_ = 0;
-		mitigation_skill1_ = 0;
-		mitigation_skill2_ = 0;
-		mitigation_skill3_ = 0;
-		ability_modifier_ = 0;
-		critical_mitigation_ = 0;
-		block_chance_ = 0;
-		uncontested_parry_ = 0;
-		uncontested_block_ = 0;
-		uncontested_dodge_ = 0;
-		uncontested_riposte_ = 0;
-		crit_chance_ = 0;
-		crit_bonus_ = 0;
-		potency_ = 0;
-		hate_mod_ = 0;
-		reuse_speed_ = 0;
-		casting_speed_ = 0;
-		recovery_speed_ = 0;
-		spell_reuse_speed_ = 0;
-		spell_multi_attack_ = 0;
-		dps_ = 0;
-		dps_multiplier_ = 0;
-		attackspeed_ = 0;
-		haste_ = 0;
-		multi_attack_ = 0;
-		flurry_ = 0;
-		melee_ae_ = 0;
-		strikethrough_ = 0;
-		accuracy_ = 0;
-		offensivespeed_ = 0;
-		rain_ = 0;
-		wind_ = 0;
-		alignment_ = 0;
-		pet_id_ = 0;
-		pet_name_ = std::string("");
-		pet_health_pct_ = 0;
-		pet_power_pct_ = 0;
-		pet_movement_ = 0;
-		pet_behavior_ = 0;
-		vision_ = 0;
-		breathe_underwater_ = 0;
-		biography_ = std::string("");
-		drunk_ = 0;
-		power_regen_ = 0;
-		hp_regen_ = 0;
-
-		power_regen_override_ = 0;
-		hp_regen_override_ = 0;
-
-		water_type_ = 0;
-		flying_type_ = 0;
-
-		no_interrupt_ = 0;
-
-		interaction_flag_ = 0;
-		tag1_ = 0;
-		mood_ = 0;
-	}
-
-
-	void SetInfoStruct(InfoStruct* oldStruct)
-	{
-		if(!oldStruct)
-			return;
-		std::lock_guard<std::mutex> lk(classMutex);
-
-		name_ = std::string(oldStruct->get_name());
-		class1_ = oldStruct->get_class1();
-		class2_ = oldStruct->get_class2();
-		class3_ = oldStruct->get_class3();
-		race_ = oldStruct->get_race();
-		gender_ = oldStruct->get_gender();
-		level_ = oldStruct->get_level();
-		max_level_ = oldStruct->get_max_level();
-		effective_level_ = oldStruct->get_effective_level();
-		tradeskill_level_ = oldStruct->get_tradeskill_level();
-		tradeskill_max_level_ = oldStruct->get_tradeskill_max_level();
-		cur_concentration_ = oldStruct->get_cur_concentration();
-		max_concentration_ = oldStruct->get_max_concentration();
-		cur_attack_ = oldStruct->get_cur_attack();
-		attack_base_ = oldStruct->get_attack_base();
-		cur_mitigation_ = oldStruct->get_cur_mitigation();
-		max_mitigation_ = oldStruct->get_max_mitigation();
-		mitigation_base_ = oldStruct->get_mitigation_base();
-		avoidance_display_ = oldStruct->get_avoidance_display();
-		cur_avoidance_ = oldStruct->get_cur_avoidance();
-		base_avoidance_pct_ = oldStruct->get_base_avoidance_pct();
-		avoidance_base_ = oldStruct->get_avoidance_base();
-		max_avoidance_ = oldStruct->get_max_avoidance();
-		parry_ = oldStruct->get_parry();
-		parry_base_ = oldStruct->get_parry_base();
-		deflection_ = oldStruct->get_deflection();
-		deflection_base_ = oldStruct->get_deflection_base();
-		block_ = oldStruct->get_block();
-		block_base_ = oldStruct->get_block_base();
-		str_ = oldStruct->get_str();
-		sta_ = oldStruct->get_sta();
-		agi_ = oldStruct->get_agi();
-		wis_ = oldStruct->get_wis();
-		intel_ = oldStruct->get_intel();
-		str_base_ = oldStruct->get_str_base();
-		sta_base_ = oldStruct->get_sta_base();
-		agi_base_ = oldStruct->get_agi_base();
-		wis_base_ = oldStruct->get_wis_base();
-		intel_base_ = oldStruct->get_intel_base();
-		heat_ = oldStruct->get_heat();
-		cold_ = oldStruct->get_cold();
-		magic_ = oldStruct->get_magic();
-		mental_ = oldStruct->get_mental();
-		divine_ = oldStruct->get_divine();
-		disease_ = oldStruct->get_disease();
-		poison_ = oldStruct->get_poison();
-		disease_base_ = oldStruct->get_disease_base();
-		cold_base_ = oldStruct->get_cold_base();
-		divine_base_ = oldStruct->get_divine_base();
-		magic_base_ = oldStruct->get_magic_base();
-		mental_base_ = oldStruct->get_mental_base();
-		heat_base_ = oldStruct->get_heat_base();
-		poison_base_ = oldStruct->get_poison_base();
-		elemental_base_ = oldStruct->get_elemental_base();
-		noxious_base_ = oldStruct->get_noxious_base();
-		arcane_base_ = oldStruct->get_arcane_base();
-		coin_copper_ = oldStruct->get_coin_copper();
-		coin_silver_ = oldStruct->get_coin_silver();
-		coin_gold_ = oldStruct->get_coin_gold();
-		coin_plat_ = oldStruct->get_coin_plat();
-		bank_coin_copper_ = oldStruct->get_bank_coin_copper();
-		bank_coin_silver_ = oldStruct->get_bank_coin_silver();
-		bank_coin_gold_ = oldStruct->get_bank_coin_gold();
-		bank_coin_plat_ = oldStruct->get_bank_coin_plat();
-		status_points_ = oldStruct->get_status_points();
-		deity_ = std::string("");
-		weight_ = oldStruct->get_weight();
-		max_weight_ = oldStruct->get_max_weight();
-		tradeskill_class1_ = oldStruct->get_tradeskill_class1();
-		tradeskill_class2_ = oldStruct->get_tradeskill_class2();
-		tradeskill_class3_ = oldStruct->get_tradeskill_class3();
-		account_age_base_ = oldStruct->get_account_age_base();
-
-		memset(account_age_bonus_,0,19);
-		absorb_ = oldStruct->get_absorb();
-		xp_ = oldStruct->get_xp();
-		xp_needed_ = oldStruct->get_xp_needed();
-		xp_debt_ = oldStruct->get_xp_debt();
-		xp_yellow_ = oldStruct->get_xp_yellow();
-		xp_yellow_vitality_bar_ = oldStruct->get_xp_yellow_vitality_bar();
-		xp_blue_vitality_bar_ = oldStruct->get_xp_blue_vitality_bar();
-		xp_blue_ = oldStruct->get_xp_blue();
-		ts_xp_ = oldStruct->get_ts_xp();
-		ts_xp_needed_ = oldStruct->get_ts_xp_needed();
-		tradeskill_exp_yellow_ = oldStruct->get_tradeskill_exp_yellow();
-		tradeskill_exp_blue_ = oldStruct->get_tradeskill_exp_blue();
-		flags_ = oldStruct->get_flags();
-		flags2_ = oldStruct->get_flags2();
-		xp_vitality_ = oldStruct->get_xp_vitality();
-		tradeskill_xp_vitality_ = oldStruct->get_tradeskill_xp_vitality();
-		mitigation_skill1_ = oldStruct->get_mitigation_skill1();
-		mitigation_skill2_ = oldStruct->get_mitigation_skill2();
-		mitigation_skill3_ = oldStruct->get_mitigation_skill3();
-		ability_modifier_ = oldStruct->get_ability_modifier();
-		critical_mitigation_ = oldStruct->get_critical_mitigation();
-		block_chance_ = oldStruct->get_block_chance();
-		uncontested_parry_ = oldStruct->get_uncontested_parry();
-		uncontested_block_ = oldStruct->get_uncontested_block();
-		uncontested_dodge_ = oldStruct->get_uncontested_dodge();
-		uncontested_riposte_ = oldStruct->get_uncontested_riposte();
-		crit_chance_ = oldStruct->get_crit_chance();
-		crit_bonus_ = oldStruct->get_crit_bonus();
-		potency_ = oldStruct->get_potency();
-		hate_mod_ = oldStruct->get_hate_mod();
-		reuse_speed_ = oldStruct->get_reuse_speed();
-		casting_speed_ = oldStruct->get_casting_speed();
-		recovery_speed_ = oldStruct->get_recovery_speed();
-		spell_reuse_speed_ = oldStruct->get_spell_reuse_speed();
-		spell_multi_attack_ = oldStruct->get_spell_multi_attack();
-		dps_ = oldStruct->get_dps();
-		dps_multiplier_ = oldStruct->get_dps_multiplier();
-		attackspeed_ = oldStruct->get_attackspeed();
-		haste_ = oldStruct->get_haste();
-		multi_attack_ = oldStruct->get_multi_attack();
-		flurry_ = oldStruct->get_flurry();
-		melee_ae_ = oldStruct->get_melee_ae();
-		strikethrough_ = oldStruct->get_strikethrough();
-		accuracy_ = oldStruct->get_accuracy();
-		offensivespeed_ = oldStruct->get_offensivespeed();
-		rain_ = oldStruct->get_rain();
-		wind_ = oldStruct->get_wind();
-		alignment_ = oldStruct->get_alignment();
-		pet_id_ = oldStruct->get_pet_id();
-		pet_name_ = std::string(oldStruct->get_pet_name());
-		pet_health_pct_ = oldStruct->get_pet_health_pct();
-		pet_power_pct_ = oldStruct->get_pet_power_pct();
-		pet_movement_ = oldStruct->get_pet_movement();
-		pet_behavior_ = oldStruct->get_pet_behavior();
-		vision_ = oldStruct->get_vision();
-		breathe_underwater_ = oldStruct->get_breathe_underwater();
-		biography_ = std::string(oldStruct->get_biography());
-		drunk_ = oldStruct->get_drunk();
-		power_regen_ = oldStruct->get_power_regen();
-		hp_regen_ = oldStruct->get_hp_regen();
-
-		power_regen_override_ = oldStruct->get_power_regen_override();
-		hp_regen_override_ = oldStruct->get_hp_regen_override();
-
-		water_type_ = oldStruct->get_water_type();
-		flying_type_ = oldStruct->get_flying_type();
-
-		no_interrupt_ = oldStruct->get_no_interrupt();
-
-		interaction_flag_ = oldStruct->get_interaction_flag();
-		tag1_ = oldStruct->get_tag1();
-		mood_ = oldStruct->get_mood();
-	}
-
-	//mutable std::shared_mutex mutex_;
-    std::string get_name() { std::lock_guard<std::mutex> lk(classMutex); return name_; }
-	int8	 get_class1() { std::lock_guard<std::mutex> lk(classMutex); return class1_; }
-	int8	 get_class2() { std::lock_guard<std::mutex> lk(classMutex); return class2_; }
-	int8	 get_class3() { std::lock_guard<std::mutex> lk(classMutex); return class3_; }
-	int8	 get_race() { std::lock_guard<std::mutex> lk(classMutex); return race_; }
-	int8	 get_gender() { std::lock_guard<std::mutex> lk(classMutex); return gender_; }
-	int16 	 get_level() { std::lock_guard<std::mutex> lk(classMutex); return level_; }
-	int16	 get_max_level() { std::lock_guard<std::mutex> lk(classMutex); return max_level_; }
-	int16	 get_effective_level() { std::lock_guard<std::mutex> lk(classMutex); return effective_level_; } 
-	int16	 get_tradeskill_level() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_level_; }
-	int16	 get_tradeskill_max_level() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_max_level_; }
-
-	int8	 get_cur_concentration() { std::lock_guard<std::mutex> lk(classMutex); return cur_concentration_; }
-	int8	 get_max_concentration() { std::lock_guard<std::mutex> lk(classMutex); return max_concentration_; }
-	int16	 get_cur_attack() { std::lock_guard<std::mutex> lk(classMutex); return cur_attack_; }
-	int16	 get_attack_base() { std::lock_guard<std::mutex> lk(classMutex); return attack_base_; }
-	int16	 get_cur_mitigation() { std::lock_guard<std::mutex> lk(classMutex); return cur_mitigation_; }
-	int16	 get_max_mitigation() { std::lock_guard<std::mutex> lk(classMutex); return max_mitigation_; }
-
-	int16	 get_mitigation_base() { std::lock_guard<std::mutex> lk(classMutex); return mitigation_base_; }
-	int16	 get_avoidance_display() { std::lock_guard<std::mutex> lk(classMutex); return avoidance_display_; }
-	float	 get_cur_avoidance() { std::lock_guard<std::mutex> lk(classMutex); return cur_avoidance_; }
-	int16	 get_base_avoidance_pct() { std::lock_guard<std::mutex> lk(classMutex); return base_avoidance_pct_; }
-	int16	 get_avoidance_base() { std::lock_guard<std::mutex> lk(classMutex); return avoidance_base_; }
-
-	float	 get_parry() { std::lock_guard<std::mutex> lk(classMutex); return parry_; }
-	float	 get_parry_base() { std::lock_guard<std::mutex> lk(classMutex); return parry_base_; }
-	
-	int16	 get_max_avoidance() { std::lock_guard<std::mutex> lk(classMutex); return max_avoidance_; }
-
-	float	 get_deflection() { std::lock_guard<std::mutex> lk(classMutex); return deflection_; }
-	int16	 get_deflection_base() { std::lock_guard<std::mutex> lk(classMutex); return deflection_base_; }
-
-	float	 get_block() { std::lock_guard<std::mutex> lk(classMutex); return block_; }
-	int16	 get_block_base() { std::lock_guard<std::mutex> lk(classMutex); return block_base_; }
-
-	float	 get_str() { std::lock_guard<std::mutex> lk(classMutex); return str_; }
-	float	 get_sta() { std::lock_guard<std::mutex> lk(classMutex); return sta_; }
-	float	 get_agi() { std::lock_guard<std::mutex> lk(classMutex); return agi_; }
-	float	 get_wis() { std::lock_guard<std::mutex> lk(classMutex); return wis_; }
-	float	 get_intel() { std::lock_guard<std::mutex> lk(classMutex); return intel_; }
-	float	 get_str_base() { std::lock_guard<std::mutex> lk(classMutex); return str_base_; }
-	float	 get_sta_base() { std::lock_guard<std::mutex> lk(classMutex); return sta_base_; }
-	float	 get_agi_base() { std::lock_guard<std::mutex> lk(classMutex); return agi_base_; }
-	float	 get_wis_base() { std::lock_guard<std::mutex> lk(classMutex); return wis_base_; }
-	float	 get_intel_base() { std::lock_guard<std::mutex> lk(classMutex); return intel_base_; }
-	int16	 get_heat() { std::lock_guard<std::mutex> lk(classMutex); return heat_; }
-	int16	 get_cold() { std::lock_guard<std::mutex> lk(classMutex); return cold_; }
-	int16	 get_magic() { std::lock_guard<std::mutex> lk(classMutex); return magic_; }
-	int16	 get_mental() { std::lock_guard<std::mutex> lk(classMutex); return mental_; }
-	int16	 get_divine() { std::lock_guard<std::mutex> lk(classMutex); return divine_; }
-	int16	 get_disease() { std::lock_guard<std::mutex> lk(classMutex); return disease_; }
-	int16	 get_poison() { std::lock_guard<std::mutex> lk(classMutex); return poison_; }
-	int16	 get_disease_base() { std::lock_guard<std::mutex> lk(classMutex); return disease_base_; }
-	int16	 get_cold_base() { std::lock_guard<std::mutex> lk(classMutex); return cold_base_; }
-	int16	 get_divine_base() { std::lock_guard<std::mutex> lk(classMutex); return divine_base_; }
-	int16	 get_magic_base() { std::lock_guard<std::mutex> lk(classMutex); return magic_base_; }
-	int16	 get_mental_base() { std::lock_guard<std::mutex> lk(classMutex); return mental_base_; }
-	int16	 get_heat_base() { std::lock_guard<std::mutex> lk(classMutex); return heat_base_; }
-	int16	 get_poison_base() { std::lock_guard<std::mutex> lk(classMutex); return poison_base_; }
-	int16	 get_elemental_base() { std::lock_guard<std::mutex> lk(classMutex); return elemental_base_; }
-	int16	 get_noxious_base() { std::lock_guard<std::mutex> lk(classMutex); return noxious_base_; }
-	int16	 get_arcane_base() { std::lock_guard<std::mutex> lk(classMutex); return arcane_base_; }
-	int32	 get_coin_copper() { std::lock_guard<std::mutex> lk(classMutex); return coin_copper_; }
-	int32	 get_coin_silver() { std::lock_guard<std::mutex> lk(classMutex); return coin_silver_; }
-	int32	 get_coin_gold() { std::lock_guard<std::mutex> lk(classMutex); return coin_gold_; }
-	int32	 get_coin_plat() { std::lock_guard<std::mutex> lk(classMutex); return coin_plat_; }
-	int32	 get_bank_coin_copper() { std::lock_guard<std::mutex> lk(classMutex); return bank_coin_copper_; }
-	int32	 get_bank_coin_silver() { std::lock_guard<std::mutex> lk(classMutex); return bank_coin_silver_; }
-	int32	 get_bank_coin_gold() { std::lock_guard<std::mutex> lk(classMutex); return bank_coin_gold_; }
-	int32	 get_bank_coin_plat() { std::lock_guard<std::mutex> lk(classMutex); return bank_coin_plat_; }
-	int32	 get_status_points() { std::lock_guard<std::mutex> lk(classMutex); return status_points_; }
-	std::string get_deity() { std::lock_guard<std::mutex> lk(classMutex); return deity_; }
-	int32	 get_weight() { std::lock_guard<std::mutex> lk(classMutex); return weight_; }
-	int32	 get_max_weight() { std::lock_guard<std::mutex> lk(classMutex); return max_weight_; }
-
-		
-	//SpellEffects* & get_spell_effects() { std::lock_guard<std::mutex> lk(classMutex); return spell_effects_; }
-	//MaintainedEffects* & get_maintained_effects() { std::lock_guard<std::mutex> lk(classMutex); return maintained_effects_; }
-	int8	 get_tradeskill_class1() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_class1_; }
-	int8	 get_tradeskill_class2() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_class2_; }
-	int8	 get_tradeskill_class3() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_class3_; }
-
-	int16	 get_account_age_base() { std::lock_guard<std::mutex> lk(classMutex); return account_age_base_; }
-
-	int8	 get_account_age_bonus(int8 field) { std::lock_guard<std::mutex> lk(classMutex); return account_age_bonus_[field]; }
-	int16	 get_absorb() { std::lock_guard<std::mutex> lk(classMutex); return absorb_; }
-	int32	 get_xp() { std::lock_guard<std::mutex> lk(classMutex); return xp_; }
-	int32	 get_xp_needed() { std::lock_guard<std::mutex> lk(classMutex); return xp_needed_; }
-	float	 get_xp_debt() { std::lock_guard<std::mutex> lk(classMutex); return xp_debt_; }
-	int16	 get_xp_yellow() { std::lock_guard<std::mutex> lk(classMutex); return xp_yellow_; }
-	int16	 get_xp_yellow_vitality_bar() { std::lock_guard<std::mutex> lk(classMutex); return xp_yellow_vitality_bar_; }
-	int16	 get_xp_blue_vitality_bar() { std::lock_guard<std::mutex> lk(classMutex); return xp_blue_vitality_bar_; }
-	int16	 get_xp_blue() { std::lock_guard<std::mutex> lk(classMutex); return xp_blue_; }
-	int32	 get_ts_xp() { std::lock_guard<std::mutex> lk(classMutex); return ts_xp_; }
-	int32	 get_ts_xp_needed() { std::lock_guard<std::mutex> lk(classMutex); return ts_xp_needed_; }
-	int16	 get_tradeskill_exp_yellow() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_exp_yellow_; }
-	int16	 get_tradeskill_exp_blue() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_exp_blue_; }
-	int32	 get_flags() { std::lock_guard<std::mutex> lk(classMutex); return flags_; }
-	int32	 get_flags2() { std::lock_guard<std::mutex> lk(classMutex); return flags2_; }
-	float	 get_xp_vitality() { std::lock_guard<std::mutex> lk(classMutex); return xp_vitality_; }
-	float	 get_tradeskill_xp_vitality() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_xp_vitality_; }
-
-	int16	 get_mitigation_skill1() { std::lock_guard<std::mutex> lk(classMutex); return mitigation_skill1_; }
-	int16	 get_mitigation_skill2() { std::lock_guard<std::mutex> lk(classMutex); return mitigation_skill2_; }
-	int16	 get_mitigation_skill3() { std::lock_guard<std::mutex> lk(classMutex); return mitigation_skill3_; }
-
-	float	 get_ability_modifier() { std::lock_guard<std::mutex> lk(classMutex); return ability_modifier_; }
-	float	 get_critical_mitigation() { std::lock_guard<std::mutex> lk(classMutex); return critical_mitigation_; }
-	float	 get_block_chance() { std::lock_guard<std::mutex> lk(classMutex); return block_chance_; }
-	float	 get_uncontested_parry() { std::lock_guard<std::mutex> lk(classMutex); return uncontested_parry_; }
-	float	 get_uncontested_block() { std::lock_guard<std::mutex> lk(classMutex); return uncontested_block_; }
-	float	 get_uncontested_dodge() { std::lock_guard<std::mutex> lk(classMutex); return uncontested_dodge_; }
-	float	 get_uncontested_riposte() { std::lock_guard<std::mutex> lk(classMutex); return uncontested_riposte_; }
-	float	 get_crit_chance() { std::lock_guard<std::mutex> lk(classMutex); return crit_chance_; }
-	float	 get_crit_bonus() { std::lock_guard<std::mutex> lk(classMutex); return crit_bonus_; }
-	float	 get_potency() { std::lock_guard<std::mutex> lk(classMutex); return potency_; }
-	float	 get_hate_mod() { std::lock_guard<std::mutex> lk(classMutex); return hate_mod_; }
-	float	 get_reuse_speed() { std::lock_guard<std::mutex> lk(classMutex); return reuse_speed_; }
-	float	 get_casting_speed() { std::lock_guard<std::mutex> lk(classMutex); return casting_speed_; }
-	float	 get_recovery_speed() { std::lock_guard<std::mutex> lk(classMutex); return recovery_speed_; }
-	float	 get_spell_reuse_speed() { std::lock_guard<std::mutex> lk(classMutex); return spell_reuse_speed_; }
-	float	 get_spell_multi_attack() { std::lock_guard<std::mutex> lk(classMutex); return spell_multi_attack_; }
-	float	 get_dps() { std::lock_guard<std::mutex> lk(classMutex); return dps_; }
-	float	 get_dps_multiplier() { std::lock_guard<std::mutex> lk(classMutex); return dps_multiplier_; }
-	float	 get_attackspeed() { std::lock_guard<std::mutex> lk(classMutex); return attackspeed_; }
-	float	 get_haste() { std::lock_guard<std::mutex> lk(classMutex); return haste_; }
-	float	 get_multi_attack() { std::lock_guard<std::mutex> lk(classMutex); return multi_attack_; }
-	float	 get_flurry() { std::lock_guard<std::mutex> lk(classMutex); return flurry_; }
-	float	 get_melee_ae() { std::lock_guard<std::mutex> lk(classMutex); return melee_ae_; }
-	float	 get_strikethrough() { std::lock_guard<std::mutex> lk(classMutex); return strikethrough_; }
-	float	 get_accuracy() { std::lock_guard<std::mutex> lk(classMutex); return accuracy_; }
-	float	 get_offensivespeed() { std::lock_guard<std::mutex> lk(classMutex); return offensivespeed_; }
-	float	 get_rain() { std::lock_guard<std::mutex> lk(classMutex); return rain_; }
-	float	 get_wind() { std::lock_guard<std::mutex> lk(classMutex); return wind_; }
-	sint8	 get_alignment() { std::lock_guard<std::mutex> lk(classMutex); return alignment_; }
-	int32	 get_pet_id() { std::lock_guard<std::mutex> lk(classMutex); return pet_id_; }
-
-	std::string get_pet_name() { std::lock_guard<std::mutex> lk(classMutex); return pet_name_; }
-	float	get_pet_health_pct() { std::lock_guard<std::mutex> lk(classMutex); return pet_health_pct_; }
-	float	get_pet_power_pct() { std::lock_guard<std::mutex> lk(classMutex); return pet_power_pct_; }
-	int8	get_pet_movement() { std::lock_guard<std::mutex> lk(classMutex); return pet_movement_; }
-	int8	get_pet_behavior() { std::lock_guard<std::mutex> lk(classMutex); return pet_behavior_; }
-	int8	get_vision() { std::lock_guard<std::mutex> lk(classMutex); return vision_; }
-	int8	get_breathe_underwater() { std::lock_guard<std::mutex> lk(classMutex); return breathe_underwater_; }
-	std::string get_biography() { std::lock_guard<std::mutex> lk(classMutex); return biography_; }
-	float	get_drunk() { std::lock_guard<std::mutex> lk(classMutex); return drunk_; }
-
-	sint16	get_power_regen() { std::lock_guard<std::mutex> lk(classMutex); return power_regen_; }
-	sint16	get_hp_regen() { std::lock_guard<std::mutex> lk(classMutex); return hp_regen_; }
-
-	int8	get_power_regen_override() { std::lock_guard<std::mutex> lk(classMutex); return power_regen_override_; }
-	int8	get_hp_regen_override() { std::lock_guard<std::mutex> lk(classMutex); return hp_regen_override_; }
-
-	int8	get_water_type() { std::lock_guard<std::mutex> lk(classMutex); return water_type_; }
-	int8	get_flying_type() { std::lock_guard<std::mutex> lk(classMutex); return flying_type_; }
-
-	int8	get_no_interrupt() { std::lock_guard<std::mutex> lk(classMutex); return no_interrupt_; }
-
-	int8	get_interaction_flag() { std::lock_guard<std::mutex> lk(classMutex); return interaction_flag_; }
-	int8	get_tag1() { std::lock_guard<std::mutex> lk(classMutex); return tag1_; }
-	int16	get_mood() { std::lock_guard<std::mutex> lk(classMutex); return mood_; }
-
-	void	set_name(std::string value) { std::lock_guard<std::mutex> lk(classMutex); name_ = value; }
-	
-	void	set_deity(std::string value) { std::lock_guard<std::mutex> lk(classMutex); deity_ = value; }
-
-	void	set_class1(int8 value) { std::lock_guard<std::mutex> lk(classMutex); class1_ = value; }
-	void	set_class2(int8 value) { std::lock_guard<std::mutex> lk(classMutex); class2_ = value; }
-	void	set_class3(int8 value) { std::lock_guard<std::mutex> lk(classMutex); class3_ = value; }
-
-	void	set_race(int8 value) { std::lock_guard<std::mutex> lk(classMutex); race_ = value; }
-	void	set_gender(int8 value) { std::lock_guard<std::mutex> lk(classMutex); gender_ = value; }
-	void	set_level(int16 value) { std::lock_guard<std::mutex> lk(classMutex); level_ = value; }
-	void	set_max_level(int16 value) { std::lock_guard<std::mutex> lk(classMutex); max_level_ = value; }
-	void	set_effective_level(int16 value) { std::lock_guard<std::mutex> lk(classMutex); effective_level_ = value; }
-
-	void	set_cur_concentration(int8 value) { std::lock_guard<std::mutex> lk(classMutex); cur_concentration_ = value; }
-	void	set_max_concentration(int8 value) { std::lock_guard<std::mutex> lk(classMutex); max_concentration_ = value; }
-
-	void	add_cur_concentration(int8 value) { std::lock_guard<std::mutex> lk(classMutex); cur_concentration_ += value; }
-	void	add_max_concentration(int8 value) { std::lock_guard<std::mutex> lk(classMutex); max_concentration_ += value; }
-
-	void	set_cur_attack(int16 value) { std::lock_guard<std::mutex> lk(classMutex); cur_attack_ = value; }
-	void	set_attack_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); attack_base_ = value; }
-	void	set_cur_mitigation(int16 value) { std::lock_guard<std::mutex> lk(classMutex); cur_mitigation_ = value; }
-	void	set_max_mitigation(int16 value) { std::lock_guard<std::mutex> lk(classMutex); max_mitigation_ = value; }
-	void	set_mitigation_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_base_ = value; }
-	void	add_mitigation_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_base_ += value; }
-
-	void	set_avoidance_display(int16 value) { std::lock_guard<std::mutex> lk(classMutex); avoidance_display_ = value; }
-	void	set_cur_avoidance(float value) { std::lock_guard<std::mutex> lk(classMutex); cur_avoidance_ = value; }
-	void	set_base_avoidance_pct(int16 value) { std::lock_guard<std::mutex> lk(classMutex); base_avoidance_pct_ = value; }
-	void	set_avoidance_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); avoidance_base_ = value; }
-	void	set_max_avoidance(int16 value) { std::lock_guard<std::mutex> lk(classMutex); max_avoidance_ = value; }
-	void	set_parry(float value) { std::lock_guard<std::mutex> lk(classMutex); parry_ = value; }
-	void	set_parry_base(float value) { std::lock_guard<std::mutex> lk(classMutex); parry_base_ = value; }
-	void	set_deflection(int16 value) { std::lock_guard<std::mutex> lk(classMutex); deflection_ = value; }
-	void	set_deflection_base(float value) { std::lock_guard<std::mutex> lk(classMutex); deflection_base_ = value; }
-	void	set_block(float value) { std::lock_guard<std::mutex> lk(classMutex); block_ = value; }
-	void	set_block_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); block_base_ = value; }
-
-	void	set_str(float value) { std::lock_guard<std::mutex> lk(classMutex); str_ = value; }
-	void	set_sta(float value) { std::lock_guard<std::mutex> lk(classMutex); sta_ = value; }
-	void	set_agi(float value) { std::lock_guard<std::mutex> lk(classMutex); agi_ = value; }
-	void	set_wis(float value) { std::lock_guard<std::mutex> lk(classMutex); wis_ = value; }
-	void	set_intel(float value) { std::lock_guard<std::mutex> lk(classMutex); intel_ = value; }
-
-	void	add_str(float value) { std::lock_guard<std::mutex> lk(classMutex); str_ += value; }
-	void	add_sta(float value) { std::lock_guard<std::mutex> lk(classMutex); sta_ += value; }
-	void	add_agi(float value) { std::lock_guard<std::mutex> lk(classMutex); agi_ += value; }
-	void	add_wis(float value) { std::lock_guard<std::mutex> lk(classMutex); wis_ += value; }
-	void	add_intel(float value) { std::lock_guard<std::mutex> lk(classMutex); intel_ += value; }
-
-	void	set_str_base(float value) { std::lock_guard<std::mutex> lk(classMutex); str_base_ = value; }
-	void	set_sta_base(float value) { std::lock_guard<std::mutex> lk(classMutex); sta_base_ = value; }
-	void	set_agi_base(float value) { std::lock_guard<std::mutex> lk(classMutex); agi_base_ = value; }
-	void	set_wis_base(float value) { std::lock_guard<std::mutex> lk(classMutex); wis_base_ = value; }
-	void	set_intel_base(float value) { std::lock_guard<std::mutex> lk(classMutex); intel_base_ = value; }
-
-	void	set_heat(int16 value) { std::lock_guard<std::mutex> lk(classMutex); heat_ = value; }
-	void	set_cold(int16 value) { std::lock_guard<std::mutex> lk(classMutex); cold_ = value; }
-	void	set_magic(int16 value) { std::lock_guard<std::mutex> lk(classMutex); magic_ = value; }
-	void	set_mental(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mental_ = value; }
-	void	set_divine(int16 value) { std::lock_guard<std::mutex> lk(classMutex); divine_ = value; }
-	void	set_disease(int16 value) { std::lock_guard<std::mutex> lk(classMutex); disease_ = value; }
-	void	set_poison(int16 value) { std::lock_guard<std::mutex> lk(classMutex); poison_ = value; }
-
-	void	add_heat(int16 value) { std::lock_guard<std::mutex> lk(classMutex); heat_ += value; }
-	void	add_cold(int16 value) { std::lock_guard<std::mutex> lk(classMutex); cold_ += value; }
-	void	add_magic(int16 value) { std::lock_guard<std::mutex> lk(classMutex); magic_ += value; }
-	void	add_mental(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mental_ += value; }
-	void	add_divine(int16 value) { std::lock_guard<std::mutex> lk(classMutex); divine_ += value; }
-	void	add_disease(int16 value) { std::lock_guard<std::mutex> lk(classMutex); disease_ += value; }
-	void	add_poison(int16 value) { std::lock_guard<std::mutex> lk(classMutex); poison_ += value; }
-
-	void	set_disease_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); disease_base_ = value; }
-	void	set_cold_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); cold_base_ = value; }
-	void	set_divine_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); divine_base_ = value; }
-	void	set_magic_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); magic_base_ = value; }
-	void	set_mental_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mental_base_ = value; }
-	void	set_heat_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); heat_base_ = value; }
-	void	set_poison_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); poison_base_ = value; }
-	void	set_elemental_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); elemental_base_ = value; }
-	void	set_noxious_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); noxious_base_ = value; }
-	void	set_arcane_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); arcane_base_ = value; }
-
-	void	set_tradeskill_level(int16 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_level_ = value; }
-	void	set_tradeskill_max_level(int16 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_max_level_ = value; }
-
-	void	set_tradeskill_class1(int8 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_class1_ = value; }
-	void	set_tradeskill_class2(int8 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_class2_ = value; }
-	void	set_tradeskill_class3(int8 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_class3_ = value; }
-
-	void	set_account_age_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); account_age_base_ = value; }
-
-	void	set_xp_vitality(float value) { std::lock_guard<std::mutex> lk(classMutex); xp_vitality_ = value; }
-
-	void	add_xp_vitality(float value) { std::lock_guard<std::mutex> lk(classMutex); xp_vitality_ += value; }
-
-	void	set_tradeskill_xp_vitality(float value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_xp_vitality_ = value; }
-
-	void	set_absorb(int16 value) { std::lock_guard<std::mutex> lk(classMutex); absorb_ = value; }
-
-	void	set_xp(int32 value) { std::lock_guard<std::mutex> lk(classMutex); xp_ = value; }
-	void	set_xp_needed(int32 value) { std::lock_guard<std::mutex> lk(classMutex); xp_needed_ = value; }
-
-	void	set_xp_debt(float value) { std::lock_guard<std::mutex> lk(classMutex); xp_debt_ = value; }
-
-	void	set_xp_yellow(int16 value) { std::lock_guard<std::mutex> lk(classMutex); xp_yellow_ = value; }
-	void	set_xp_blue(int16 value) { std::lock_guard<std::mutex> lk(classMutex); xp_blue_ = value; }
-
-	void	set_xp_yellow_vitality_bar(int16 value) { std::lock_guard<std::mutex> lk(classMutex); xp_yellow_vitality_bar_ = value; }
-	void	set_xp_blue_vitality_bar(int16 value) { std::lock_guard<std::mutex> lk(classMutex); xp_blue_vitality_bar_ = value; }
-
-	void	set_ts_xp(int32 value) { std::lock_guard<std::mutex> lk(classMutex); ts_xp_ = value; }
-	void	set_ts_xp_needed(int32 value) { std::lock_guard<std::mutex> lk(classMutex); ts_xp_needed_ = value; }
-
-	void	set_tradeskill_exp_yellow(int16 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_exp_yellow_ = value; }
-	void	set_tradeskill_exp_blue(int16 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_exp_blue_ = value; }
-
-	void	set_flags(int32 value) { std::lock_guard<std::mutex> lk(classMutex); flags_ = value; }
-	void	set_flags2(int32 value) { std::lock_guard<std::mutex> lk(classMutex); flags2_ = value; }
-
-	void	set_coin_plat(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_plat_ = value; }
-	void	set_coin_gold(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_gold_ = value; }
-	void	set_coin_silver(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_silver_ = value; }
-	void	set_coin_copper(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_copper_ = value; }
-
-	void	add_coin_plat(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_plat_ += value; }
-	void	add_coin_gold(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_gold_ += value; }
-	void	add_coin_silver(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_silver_ += value; }
-	void	add_coin_copper(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_copper_ += value; }
-
-	void	set_bank_coin_plat(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_plat_ = value; }
-	void	set_bank_coin_gold(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_gold_ = value; }
-	void	set_bank_coin_silver(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_silver_ = value; }
-	void	set_bank_coin_copper(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_copper_ = value; }
-
-	void	add_bank_coin_plat(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_plat_ += value; }
-	void	add_bank_coin_gold(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_gold_ += value; }
-	void	add_bank_coin_silver(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_silver_ += value; }
-	void	add_bank_coin_copper(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_copper_ += value; }
-
-	void	set_status_points(int32 value) { std::lock_guard<std::mutex> lk(classMutex); status_points_ = value; }
-	void	add_status_points(int32 value) { std::lock_guard<std::mutex> lk(classMutex); status_points_ += value; }
-	bool	subtract_status_points(int32 value) { std::lock_guard<std::mutex> lk(classMutex); if(value > status_points_) return false; status_points_ -= value; return true; }
-	
-	void	set_mitigation_skill1(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill1_ = value; }
-	void	set_mitigation_skill2(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill2_ = value; }
-	void	set_mitigation_skill3(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill3_ = value; }
-
-	void	add_mitigation_skill1(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill1_ += value; }
-	void	add_mitigation_skill2(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill2_ += value; }
-	void	add_mitigation_skill3(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill3_ += value; }
-
-	void	set_ability_modifier(float value) { std::lock_guard<std::mutex> lk(classMutex); ability_modifier_ = value; }
-
-	void	add_ability_modifier(float value) { std::lock_guard<std::mutex> lk(classMutex); ability_modifier_ += value; }
-
-	void	set_critical_mitigation(float value) { std::lock_guard<std::mutex> lk(classMutex); critical_mitigation_ = value; }
-
-	void	add_critical_mitigation(float value) { std::lock_guard<std::mutex> lk(classMutex); critical_mitigation_ += value; }
-
-	void	set_block_chance(float value) { std::lock_guard<std::mutex> lk(classMutex); block_chance_ = value; }
-	void	set_uncontested_parry(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_parry_ = value; }
-	void	set_uncontested_block(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_block_ = value; }
-	void	set_uncontested_dodge(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_dodge_ = value; }
-	void	set_uncontested_riposte(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_riposte_ = value; }
-	void	set_crit_chance(float value) { std::lock_guard<std::mutex> lk(classMutex); crit_chance_ = value; }
-	void	set_crit_bonus(float value) { std::lock_guard<std::mutex> lk(classMutex); crit_bonus_ = value; }
-	void	set_potency(float value) { std::lock_guard<std::mutex> lk(classMutex); potency_ = value; }
-	void	set_hate_mod(float value) { std::lock_guard<std::mutex> lk(classMutex); hate_mod_ = value; }
-	void	set_reuse_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); reuse_speed_ = value; }
-	void	set_casting_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); casting_speed_ = value; }
-	void	set_recovery_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); recovery_speed_ = value; }
-	void	set_spell_reuse_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); spell_reuse_speed_ = value; }
-	void	set_spell_multi_attack(float value) { std::lock_guard<std::mutex> lk(classMutex); spell_multi_attack_ = value; }
-	void	set_dps(float value) { std::lock_guard<std::mutex> lk(classMutex); dps_ = value; }
-	void	set_dps_multiplier(float value) { std::lock_guard<std::mutex> lk(classMutex); dps_multiplier_ = value; }
-	void	set_attackspeed(float value) { std::lock_guard<std::mutex> lk(classMutex); attackspeed_ = value; }
-	void	set_haste(float value) { std::lock_guard<std::mutex> lk(classMutex); haste_ = value; }
-	void	set_multi_attack(float value) { std::lock_guard<std::mutex> lk(classMutex); multi_attack_ = value; }
-	void	set_flurry(float value) { std::lock_guard<std::mutex> lk(classMutex); flurry_ = value; }
-	void	set_melee_ae(float value) { std::lock_guard<std::mutex> lk(classMutex); melee_ae_ = value; }
-	void	set_strikethrough(float value) { std::lock_guard<std::mutex> lk(classMutex); strikethrough_ = value; }
-	void	set_accuracy(float value) { std::lock_guard<std::mutex> lk(classMutex); accuracy_ = value; }
-	void	set_offensivespeed(float value) { std::lock_guard<std::mutex> lk(classMutex); offensivespeed_ = value; }
-	void	set_rain(float value) { std::lock_guard<std::mutex> lk(classMutex); rain_ = value; }
-	void	set_wind(float value) { std::lock_guard<std::mutex> lk(classMutex); wind_ = value; }
-
-	void	add_block_chance(float value) { std::lock_guard<std::mutex> lk(classMutex); block_chance_ += value; }
-	void	add_uncontested_parry(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_parry_ += value; }
-	void	add_uncontested_block(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_block_ += value; }
-	void	add_uncontested_dodge(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_dodge_ += value; }
-	void	add_uncontested_riposte(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_riposte_ += value; }
-	void	add_crit_chance(float value) { std::lock_guard<std::mutex> lk(classMutex); crit_chance_ += value; }
-	void	add_crit_bonus(float value) { std::lock_guard<std::mutex> lk(classMutex); crit_bonus_ += value; }
-	void	add_potency(float value) { std::lock_guard<std::mutex> lk(classMutex); potency_ += value; }
-	void	add_hate_mod(float value) { std::lock_guard<std::mutex> lk(classMutex); hate_mod_ += value; }
-	void	add_reuse_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); reuse_speed_ += value; }
-	void	add_casting_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); casting_speed_ += value; }
-	void	add_recovery_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); recovery_speed_ += value; }
-	void	add_spell_reuse_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); spell_reuse_speed_ += value; }
-	void	add_spell_multi_attack(float value) { std::lock_guard<std::mutex> lk(classMutex); spell_multi_attack_ += value; }
-	void	add_dps(float value) { std::lock_guard<std::mutex> lk(classMutex); dps_ += value; }
-	void	add_dps_multiplier(float value) { std::lock_guard<std::mutex> lk(classMutex); dps_multiplier_ += value; }
-	void	add_attackspeed(float value) { std::lock_guard<std::mutex> lk(classMutex); attackspeed_ += value; }
-	void	add_haste(float value) { std::lock_guard<std::mutex> lk(classMutex); haste_ += value; }
-	void	add_multi_attack(float value) { std::lock_guard<std::mutex> lk(classMutex); multi_attack_ += value; }
-	void	add_flurry(float value) { std::lock_guard<std::mutex> lk(classMutex); flurry_ += value; }
-	void	add_melee_ae(float value) { std::lock_guard<std::mutex> lk(classMutex); melee_ae_ += value; }
-	void	add_strikethrough(float value) { std::lock_guard<std::mutex> lk(classMutex); strikethrough_ += value; }
-	void	add_accuracy(float value) { std::lock_guard<std::mutex> lk(classMutex); accuracy_ += value; }
-	void	add_offensivespeed(float value) { std::lock_guard<std::mutex> lk(classMutex); offensivespeed_ += value; }
-	void	add_rain(float value) { std::lock_guard<std::mutex> lk(classMutex); rain_ += value; }
-	void	add_wind(float value) { std::lock_guard<std::mutex> lk(classMutex); wind_ += value; }
-
-	void	set_alignment(int8 value) { std::lock_guard<std::mutex> lk(classMutex); alignment_ = value; }
-
-	void	set_pet_id(int32 value) { std::lock_guard<std::mutex> lk(classMutex); pet_id_ = value; }
-	void	set_pet_name(std::string value) { std::lock_guard<std::mutex> lk(classMutex); pet_name_ = value; }
-
-	void	set_pet_movement(int8 value) { std::lock_guard<std::mutex> lk(classMutex); pet_movement_ = value; }
-	void	set_pet_behavior(int8 value) { std::lock_guard<std::mutex> lk(classMutex); pet_behavior_ = value; }
-	void	set_pet_health_pct(float value) { std::lock_guard<std::mutex> lk(classMutex); pet_health_pct_ = value; }
-	void	set_pet_power_pct(float value) { std::lock_guard<std::mutex> lk(classMutex); pet_power_pct_ = value; }
-
-	void	set_weight(int32 value) { std::lock_guard<std::mutex> lk(classMutex); weight_ = value; }
-	void	set_max_weight(int32 value) { std::lock_guard<std::mutex> lk(classMutex); max_weight_ = value; }
-
-	void	set_vision(int8 value) { std::lock_guard<std::mutex> lk(classMutex); vision_ = value; }
-	void	set_breathe_underwater(int8 value) { std::lock_guard<std::mutex> lk(classMutex); breathe_underwater_ = value; }
-	void	set_drunk(float value) { std::lock_guard<std::mutex> lk(classMutex); drunk_ = value; }
-
-	void	set_biography(std::string value) { std::lock_guard<std::mutex> lk(classMutex); biography_ = value; }
-
-	void	set_power_regen(sint16 value) { std::lock_guard<std::mutex> lk(classMutex); power_regen_ = value; }
-	void	set_hp_regen(sint16 value) { std::lock_guard<std::mutex> lk(classMutex); hp_regen_ = value; }
-
-	void	set_power_regen_override(int8 value) { std::lock_guard<std::mutex> lk(classMutex); power_regen_override_ = value; }
-	void	set_hp_regen_override(int8 value) { std::lock_guard<std::mutex> lk(classMutex); hp_regen_override_ = value; }
-
-	void	set_water_type(int8 value) { std::lock_guard<std::mutex> lk(classMutex); water_type_ = value; }
-	void	set_flying_type(int8 value) { std::lock_guard<std::mutex> lk(classMutex); flying_type_ = value; }
-
-	void	set_no_interrupt(int8 value) { std::lock_guard<std::mutex> lk(classMutex); no_interrupt_ = value; }
-
-	void	set_interaction_flag(int8 value) { std::lock_guard<std::mutex> lk(classMutex); interaction_flag_ = value; }
-	void	set_tag1(int8 value) { std::lock_guard<std::mutex> lk(classMutex); tag1_ = value; }
-	void	set_mood(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mood_ = value; }
-
-	void	ResetEffects(Spawn* spawn)
-	{
-		for(int i=0;i<45;i++){
-			if(i<30){
-				maintained_effects[i].spell_id = 0xFFFFFFFF;
-				if (spawn->IsPlayer())
-					maintained_effects[i].icon = 0xFFFF;
-
-				maintained_effects[i].spell = nullptr;
-			}
-			spell_effects[i].spell_id = 0xFFFFFFFF;	
-			spell_effects[i].spell = nullptr;
-		}
-	}
-	// maintained via their own mutex
-	SpellEffects	spell_effects[45];
-	MaintainedEffects maintained_effects[30];
-private:
-	std::string		name_;
-	int8			class1_;
-	int8			class2_;
-	int8			class3_;
-	int8			race_;
-	int8			gender_;
-	int16			level_;
-	int16			max_level_;
-	int16			effective_level_;
-	int16			tradeskill_level_;
-	int16			tradeskill_max_level_;
-	
-	int8			cur_concentration_;
-	int8			max_concentration_;
-	int16			cur_attack_;
-	int16			attack_base_;
-	int16			cur_mitigation_;
-	int16			max_mitigation_;
-	int16			mitigation_base_;
-	int16			avoidance_display_;
-	float			cur_avoidance_;
-	int16			base_avoidance_pct_;
-	int16			avoidance_base_;
-	int16			max_avoidance_;
-	float			parry_;
-	float			parry_base_;
-	float			deflection_;
-	int16			deflection_base_;
-	float			block_;
-	int16			block_base_;
-	float			riposte_;
-	float			riposte_base_;
-	float			str_; //int16
-	float			sta_; //int16
-	float			agi_;//int16
-	float			wis_;//int16
-	float			intel_;//int16
-	float			str_base_;//int16
-	float			sta_base_;//int16
-	float			agi_base_;//int16
-	float			wis_base_;//int16
-	float			intel_base_;//int16
-	int16			heat_;
-	int16			cold_;
-	int16			magic_;
-	int16			mental_;
-	int16			divine_;
-	int16			disease_;
-	int16			poison_;
-	int16			disease_base_;
-	int16			cold_base_;
-	int16			divine_base_;
-	int16			magic_base_;
-	int16			mental_base_;
-	int16			heat_base_;
-	int16			poison_base_;
-	int16			elemental_base_;
-	int16			noxious_base_;
-	int16			arcane_base_;
-	int32			coin_copper_;
-	int32			coin_silver_;
-	int32			coin_gold_;
-	int32			coin_plat_;
-	int32			bank_coin_copper_;
-	int32			bank_coin_silver_;
-	int32			bank_coin_gold_;
-	int32			bank_coin_plat_;
-	
-	int32			status_points_;
-	std::string		deity_;
-	int32			weight_;
-	int32			max_weight_;
-	int8			tradeskill_class1_;
-	int8			tradeskill_class2_;
-	int8			tradeskill_class3_;
-	int16			account_age_base_;
-	int8			account_age_bonus_[19];
-	int16			absorb_;
-	int32			xp_;
-	int32			xp_needed_;
-	float			xp_debt_;
-	int16			xp_yellow_;
-	int16			xp_yellow_vitality_bar_;
-	int16			xp_blue_vitality_bar_;
-	int16			xp_blue_;
-	int32			ts_xp_;
-	int32			ts_xp_needed_;
-	int16			tradeskill_exp_yellow_;
-	int16			tradeskill_exp_blue_;
-	int32			flags_;
-	int32			flags2_;
-	float			xp_vitality_;
-	float			tradeskill_xp_vitality_;
-	int16			mitigation_skill1_;
-	int16			mitigation_skill2_;
-	int16			mitigation_skill3_;
-	float			ability_modifier_;
-	float			critical_mitigation_;
-	float			block_chance_;
-	float			uncontested_parry_;
-	float			uncontested_block_;
-	float			uncontested_dodge_;
-	float			uncontested_riposte_;
-
-	float			crit_chance_;
-	float			crit_bonus_;
-	float			potency_;
-	float			hate_mod_;
-	float			reuse_speed_;
-	float			casting_speed_;
-	float			recovery_speed_;
-	float			spell_reuse_speed_;
-	float			spell_multi_attack_;
-	float			dps_;
-	float           dps_multiplier_;
-	float			attackspeed_;
-	float			haste_;
-	float			multi_attack_;
-	float			flurry_;
-	float			melee_ae_;
-	float			strikethrough_;
-	float			accuracy_;
-	float			offensivespeed_;
-	float			rain_;
-	float			wind_;
-	sint8			alignment_;
-
-	int32			pet_id_;
-	std::string		pet_name_;
-	float			pet_health_pct_;
-	float			pet_power_pct_;
-	int8			pet_movement_;
-	int8			pet_behavior_;
-
-	int8          	vision_;
-	int8			breathe_underwater_;
-	std::string		biography_;
-	float			drunk_;
-
-	sint16			power_regen_;
-	sint16			hp_regen_;
-
-	int8			power_regen_override_;
-	int8			hp_regen_override_;
-
-	int8			water_type_;
-	int8			flying_type_;
-
-	int8			no_interrupt_;
-
-	int8			interaction_flag_;
-	int8			tag1_;
-	int16			mood_;
-	// when PacketStruct is fixed for C++17 this should become a shared_mutex and handle read/write lock
-	std::mutex		classMutex;
-};
-
-struct WardInfo {
-	LuaSpell*	Spell;
-	int32		BaseDamage;
-	int32		DamageLeft;
-	int8		WardType;
-	int8		DamageType;
-	bool		keepWard;
-	int32		DamageAbsorptionPercentage;
-	int32		DamageAbsorptionMaxHealthPercent;
-	int32		RedirectDamagePercent;
-	
-	int32		LastRedirectDamage;
-	int32		LastAbsorbedDamage;
-
-	int32		HitCount;
-	int32		MaxHitCount;
-
-	bool		AbsorbAllDamage; // damage is always absorbed, usually spells based on hits, when we pass damage in AddWard as 0 this will be set to true
-};
-
-#define WARD_TYPE_ALL 0
-#define WARD_TYPE_PHYSICAL 1
-#define WARD_TYPE_MAGICAL 2
-
-struct Proc {
-	LuaSpell*	spell;
-	Item*		item;
-	float		chance;
-	int32		spellid;
-};
-
-#define PROC_TYPE_OFFENSIVE				1
-#define PROC_TYPE_DEFENSIVE				2
-#define PROC_TYPE_PHYSICAL_OFFENSIVE	3
-#define PROC_TYPE_PHYSICAL_DEFENSIVE	4
-#define PROC_TYPE_MAGICAL_OFFENSIVE		5
-#define PROC_TYPE_MAGICAL_DEFENSIVE		6
-#define PROC_TYPE_BLOCK					7
-#define PROC_TYPE_PARRY					8
-#define PROC_TYPE_RIPOSTE				9
-#define PROC_TYPE_EVADE					10
-#define PROC_TYPE_HEALING				11
-#define PROC_TYPE_BENEFICIAL			12
-#define PROC_TYPE_DEATH                 13
-#define PROC_TYPE_KILL                  14
-#define PROC_TYPE_DAMAGED               15
-#define PROC_TYPE_DAMAGED_MELEE         16
-#define PROC_TYPE_DAMAGED_MAGIC         17
-#define PROC_TYPE_RANGED_ATTACK			18
-#define PROC_TYPE_RANGED_DEFENSE		19
-
-struct ThreatTransfer {
-	int32		Target;
-	float		Amount;
-	LuaSpell*	Spell;
-};
-
-#define DET_TYPE_TRAUMA      1
-#define DET_TYPE_ARCANE      2
-#define DET_TYPE_NOXIOUS     3
-#define DET_TYPE_ELEMENTAL   4
-#define DET_TYPE_CURSE       5
-
-#define DISPELL_TYPE_CURE    0
-#define DISPELL_TYPE_DISPELL 1
-
-#define CONTROL_EFFECT_TYPE_MEZ 1
-#define CONTROL_EFFECT_TYPE_STIFLE 2
-#define CONTROL_EFFECT_TYPE_DAZE 3
-#define CONTROL_EFFECT_TYPE_STUN 4
-#define CONTROL_EFFECT_TYPE_ROOT 5
-#define CONTROL_EFFECT_TYPE_FEAR 6
-#define CONTROL_EFFECT_TYPE_WALKUNDERWATER 7
-#define CONTROL_EFFECT_TYPE_JUMPUNDERWATER 8
-#define CONTROL_EFFECT_TYPE_INVIS 9
-#define CONTROL_EFFECT_TYPE_STEALTH 10
-#define CONTROL_EFFECT_TYPE_SNARE 11
-#define CONTROL_EFFECT_TYPE_FLIGHT 12
-#define CONTROL_EFFECT_TYPE_GLIDE 13
-#define CONTROL_EFFECT_TYPE_SAFEFALL 14
-#define CONTROL_MAX_EFFECTS 15 // always +1 to highest control effect
-
-#define IMMUNITY_TYPE_MEZ 1
-#define IMMUNITY_TYPE_STIFLE 2
-#define IMMUNITY_TYPE_DAZE 3
-#define IMMUNITY_TYPE_STUN 4
-#define IMMUNITY_TYPE_ROOT 5
-#define IMMUNITY_TYPE_FEAR 6
-#define IMMUNITY_TYPE_AOE 7
-#define IMMUNITY_TYPE_TAUNT 8
-#define IMMUNITY_TYPE_RIPOSTE 9
-
-//class Spell;
-//class ZoneServer;
-
-//The entity class is for NPCs and Players, spawns which are able to fight
-class Entity : public Spawn{
-public:
-	Entity();
-	virtual ~Entity();
-
-	void DeleteSpellEffects(bool removeClient = false);
-	void RemoveSpells();
-	void MapInfoStruct();
-	virtual float GetDodgeChance();
-	virtual void AddMaintainedSpell(LuaSpell* spell);
-	virtual void AddSpellEffect(LuaSpell* spell, int32 override_expire_time = 0);
-	virtual void RemoveMaintainedSpell(LuaSpell* spell);
-	virtual void RemoveSpellEffect(LuaSpell* spell);
-	virtual bool HasActiveMaintainedSpell(Spell* spell, Spawn* target);
-	virtual bool HasActiveSpellEffect(Spell* spell, Spawn* target);
-	virtual void AddSkillBonus(int32 spell_id, int32 skill_id, float value);
-	void AddDetrimentalSpell(LuaSpell* spell, int32 override_expire_timestamp = 0);
-	DetrimentalEffects* GetDetrimentalEffect(int32 spell_id, Entity* caster);
-	virtual MaintainedEffects* GetMaintainedSpell(int32 spell_id);
-	void RemoveDetrimentalSpell(LuaSpell* spell);
-	void	SetDeity(int8 new_deity){
-			deity = new_deity;
-	}
-	int8	GetDeity(){ return deity; }
-	EquipmentItemList* GetEquipmentList();
-	EquipmentItemList* GetAppearanceEquipmentList();
-
-	bool IsEntity(){ return true; }
-	float CalculateSkillStatChance(char* skill, int16 item_stat, float max_cap = 0.0f, float modifier = 0.0f, bool add_to_skill = false);
-	void CalculateBonuses();
-	void SetRegenValues(int16 effective_level);
-	float CalculateBonusMod();
-	float CalculateDPSMultiplier();
-	float CalculateCastingSpeedMod();
-
-	InfoStruct* GetInfoStruct();
-
-	int16	GetStr();
-	int16	GetSta();
-	int16	GetInt();
-	int16	GetWis();
-	int16	GetAgi();
-	int16   GetPrimaryStat();
-
-	int16	GetHeatResistance();
-	int16	GetColdResistance();
-	int16	GetMagicResistance();
-	int16	GetMentalResistance();
-	int16	GetDivineResistance();
-	int16	GetDiseaseResistance();
-	int16	GetPoisonResistance();
-
-	int16	GetStrBase();
-	int16	GetStaBase();
-	int16	GetIntBase();
-	int16	GetWisBase();
-	int16	GetAgiBase();
-
-	int16	GetHeatResistanceBase();
-	int16	GetColdResistanceBase();
-	int16	GetMagicResistanceBase();
-	int16	GetMentalResistanceBase();
-	int16	GetDivineResistanceBase();
-	int16	GetDiseaseResistanceBase();
-	int16	GetPoisonResistanceBase();
-
-	int8	GetConcentrationCurrent();
-	int8	GetConcentrationMax();
-
-	sint8	GetAlignment();
-	void	SetAlignment(sint8 new_value);
-
-	bool	HasMoved(bool include_heading);
-	void	SetHPRegen(int16 new_val);
-	int16	GetHPRegen();
-	void	DoRegenUpdate();
-	MaintainedEffects* GetFreeMaintainedSpellSlot();
-	SpellEffects* GetFreeSpellEffectSlot();
-	SpellEffects* GetSpellEffect(int32 id, Entity* caster = 0);
-	SpellEffects* GetSpellEffectBySpellType(int8 spell_type);
-	SpellEffects* GetSpellEffectWithLinkedTimer(int32 id, int32 linked_timer = 0, sint32 type_group_spell_id = 0, Entity* caster = 0);
-	LuaSpell* HasLinkedTimerID(LuaSpell* spell, Spawn* target = nullptr,  bool stackWithOtherPlayers = true);
-
-	//flags
-	int32 GetFlags() { return info_struct.get_flags(); }
-	int32	GetFlags2() { return info_struct.get_flags2(); }
-	bool query_flags(int flag) {
-			if (flag > 63) return false;
-			if (flag < 32) return ((info_struct.get_flags() & (1 << flag))?true:false);
-			return ((info_struct.get_flags2() & (1 << (flag - 32)))?true:false);
-	}
-	float	GetMaxSpeed();
-	void	SetMaxSpeed(float val);
-	//combat stuff:
-	int32	GetRangeLastAttackTime();
-	void	SetRangeLastAttackTime(int32 time);
-	int16	GetRangeAttackDelay();
-	int16   GetRangeWeaponDelay() {return ranged_combat_data.ranged_weapon_delay;}
-	void    SetRangeWeaponDelay(int16 new_delay) {ranged_combat_data.ranged_weapon_delay = new_delay * 100;}
-	void    SetRangeAttackDelay(int16 new_delay) {ranged_combat_data.ranged_attack_delay = new_delay;}
-	int32	GetPrimaryLastAttackTime();
-	int16	GetPrimaryAttackDelay();
-	void	SetPrimaryAttackDelay(int16 new_delay);
-	void	SetPrimaryLastAttackTime(int32 new_time);
-	void    SetPrimaryWeaponDelay(int16 new_delay) {melee_combat_data.primary_weapon_delay = new_delay * 100;}
-	int32	GetSecondaryLastAttackTime();
-	int16	GetSecondaryAttackDelay();
-	void	SetSecondaryAttackDelay(int16 new_delay);
-	void	SetSecondaryLastAttackTime(int32 new_time);
-	void    SetSecondaryWeaponDelay(int16 new_delay) {melee_combat_data.primary_weapon_delay = new_delay * 100;}
-	int32	GetPrimaryWeaponMinDamage();
-	int32	GetPrimaryWeaponMaxDamage();
-	int32	GetSecondaryWeaponMinDamage();
-	int32	GetSecondaryWeaponMaxDamage();
-	int32	GetRangedWeaponMinDamage();
-	int32	GetRangedWeaponMaxDamage();
-	int8	GetPrimaryWeaponType();
-	int8	GetSecondaryWeaponType();
-	int8	GetRangedWeaponType();
-	int8	GetWieldType();
-	int16   GetPrimaryWeaponDelay() {return melee_combat_data.primary_weapon_delay;}
-	int16   GetSecondaryWeaponDelay() {return melee_combat_data.secondary_weapon_delay;}
-	bool	IsDualWield();
-	bool	BehindTarget(Spawn* target);
-	bool	FlankingTarget(Spawn* target);
-	void	ChangePrimaryWeapon();
-	void	ChangeSecondaryWeapon();
-	void	ChangeRangedWeapon();
-	virtual Skill*	GetSkillByName(const char* name, bool check_update = false);
-	virtual Skill*	GetSkillByID(int32 id, bool check_update = false);
-	bool			AttackAllowed(Entity* target, float distance = 0, bool range_attack = false);
-	bool			PrimaryWeaponReady();
-	bool			SecondaryWeaponReady();
-	bool			RangeWeaponReady();
-	void			MeleeAttack(Spawn* victim, float distance, bool primary, bool multi_attack = false);
-	void			RangeAttack(Spawn* victim, float distance, Item* weapon, Item* ammo, bool multi_attack = false);
-	bool			SpellAttack(Spawn* victim, float distance, LuaSpell* luaspell, int8 damage_type, int32 low_damage, int32 high_damage, int8 crit_mod = 0, bool no_calcs = false);
-	bool			ProcAttack(Spawn* victim, int8 damage_type, int32 low_damage, int32 high_damage, string name, string success_msg, string effect_msg);
-	bool            SpellHeal(Spawn* target, float distance, LuaSpell* luaspell, string heal_type, int32 low_heal, int32 high_heal, int8 crit_mod = 0, bool no_calcs = false, string custom_spell_name="");
-	int8			DetermineHit(Spawn* victim, int8 damage_type, float ToHitBonus, bool spell);
-	float			GetDamageTypeResistPercentage(int8 damage_type);
-	Skill*			GetSkillByWeaponType(int8 type, bool update);
-	bool			DamageSpawn(Entity* victim, int8 type, int8 damage_type, int32 low_damage, int32 high_damage, const char* spell_name, int8 crit_mod = 0, bool is_tick = false, bool no_damage_calcs = false, bool ignore_attacker = false, LuaSpell* spell = 0);
-	void			AddHate(Entity* attacker, sint32 hate);
-	bool			CheckInterruptSpell(Entity* attacker);
-	bool			CheckFizzleSpell(LuaSpell* spell);
-	void			KillSpawn(Spawn* dead, int8 damage_type = 0, int16 kill_blow_type = 0);
-	void			HandleDeathExperienceDebt(Spawn* killer);
-	void            SetAttackDelay(bool primary = false, bool ranged = false);
-	float           CalculateAttackSpeedMod();
-	virtual void	ProcessCombat();
-
-	bool	EngagedInCombat();
-	virtual void	InCombat(bool val);
-
-	bool	IsCasting();
-	void	IsCasting(bool val);
-	void SetMount(int16 mount_id, int8 red = 0xFF, int8 green = 0xFF, int8 blue = 0xFF, bool setUpdateFlags = true)
-	{
-		if (mount_id == 0) {
-			EQ2_Color color;
-			color.red = 0;
-			color.green = 0;
-			color.blue = 0;
-			SetMountColor(&color);
-			SetMountSaddleColor(&color);
-		}
-		else
-		{
-			EQ2_Color color;
-			color.red = red;
-			color.green = green;
-			color.blue = blue;
-			SetMountColor(&color);
-			SetMountSaddleColor(&color);
-		}
-		SetInfo(&features.mount_model_type, mount_id, setUpdateFlags);
-	}
-
-	void SetEquipment(Item* item, int8 slot = 255);
-	void SetEquipment(int8 slot, int16 type, int8 red, int8 green, int8 blue, int8 h_r, int8 h_g, int8 h_b){
-		std::lock_guard<std::mutex> lk(MEquipment);
-		if(slot >= NUM_SLOTS)
-			return;
-		
-		SetInfo(&equipment.equip_id[slot], type);
-		SetInfo(&equipment.color[slot].red, red);
-		SetInfo(&equipment.color[slot].green, green);
-		SetInfo(&equipment.color[slot].blue, blue);
-		SetInfo(&equipment.highlight[slot].red, h_r);
-		SetInfo(&equipment.highlight[slot].green, h_g);
-		SetInfo(&equipment.highlight[slot].blue, h_b);
-	}
-	void SetHairType(int16 new_val, bool setUpdateFlags = true){
-		SetInfo(&features.hair_type, new_val, setUpdateFlags);
-	}
-	void SetHairColor1(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.hair_color1, new_val, setUpdateFlags);
-	}
-	void SetHairColor2(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.hair_color2, new_val, setUpdateFlags);
-	}
-	void SetSogaHairColor1(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_hair_color1, new_val, setUpdateFlags);
-	}
-	void SetSogaHairColor2(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_hair_color2, new_val, setUpdateFlags);
-	}
-	void SetHairHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.hair_highlight_color, new_val, setUpdateFlags);
-	}
-	void SetSogaHairHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_hair_highlight_color, new_val, setUpdateFlags);
-	}
-	void SetHairColor(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.hair_type_color, new_val, setUpdateFlags);
-	}
-	void SetSogaHairColor(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_hair_type_color, new_val, setUpdateFlags);
-	}
-	void SetHairTypeHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.hair_type_highlight_color, new_val, setUpdateFlags);
-	}
-	void SetSogaHairTypeHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_hair_type_highlight_color, new_val, setUpdateFlags);
-	}
-	void SetFacialHairType(int16 new_val, bool setUpdateFlags = true){
-		SetInfo(&features.hair_face_type, new_val, setUpdateFlags);
-	}
-	void SetFacialHairColor(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.hair_face_color, new_val, setUpdateFlags);
-	}
-	void SetSogaFacialHairColor(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_hair_face_color, new_val, setUpdateFlags);
-	}
-	void SetFacialHairHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.hair_face_highlight_color, new_val, setUpdateFlags);
-	}
-	void SetSogaFacialHairHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_hair_face_highlight_color, new_val, setUpdateFlags);
-	}
-	void SetWingType(int16 new_val, bool setUpdateFlags = true){
-		SetInfo(&features.wing_type, new_val, setUpdateFlags);
-	}
-	void SetWingColor1(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.wing_color1, new_val, setUpdateFlags);
-	}
-	void SetWingColor2(EQ2_Color new_val, bool setUpdateFlags = true){
-		SetInfo(&features.wing_color2, new_val, setUpdateFlags);
-	}
-	void SetChestType(int16 new_val, bool setUpdateFlags = true){
-		SetInfo(&features.chest_type, new_val, setUpdateFlags);
-	}
-	void SetLegsType(int16 new_val, bool setUpdateFlags = true){
-		SetInfo(&features.legs_type, new_val, setUpdateFlags);
-	}
-	void SetSogaHairType(int16 new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_hair_type, new_val, setUpdateFlags);
-	}	
-	void SetSogaFacialHairType(int16 new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_hair_face_type, new_val, setUpdateFlags);
-	}	
-	void SetSogaChestType(int16 new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_chest_type, new_val, setUpdateFlags);
-	}	
-	void SetSogaLegType(int16 new_val, bool setUpdateFlags = true){
-		SetInfo(&features.soga_legs_type, new_val, setUpdateFlags);
-	}	
-	void SetSkinColor(EQ2_Color color){
-		SetInfo(&features.skin_color, color);
-	}
-	void SetSogaSkinColor(EQ2_Color color){
-		SetInfo(&features.soga_skin_color, color);
-	}
-	void SetModelColor(EQ2_Color color){
-		SetInfo(&features.model_color, color);
-	}
-	void SetSogaModelColor(EQ2_Color color){
-		SetInfo(&features.soga_model_color, color);
-	}
-	void SetCombatVoice(int16 val, bool setUpdateFlags = true) { 
-		SetInfo(&features.combat_voice, val, setUpdateFlags); 
-	}
-	void SetEmoteVoice(int16 val, bool setUpdateFlags = true) { 
-		SetInfo(&features.emote_voice, val, setUpdateFlags); 
-	}
-	int16 GetCombatVoice(){ return features.combat_voice; }
-	int16 GetEmoteVoice(){ return features.emote_voice; }
-	int16 GetMount(){ return features.mount_model_type; }
-	void SetMountSaddleColor(EQ2_Color* color){
-		SetInfo(&features.mount_saddle_color, *color);
-	}
-	void SetMountColor(EQ2_Color* color){
-		SetInfo(&features.mount_color, *color);
-	}
-	void SetEyeColor(EQ2_Color eye_color){
-		SetInfo(&features.eye_color, eye_color);
-	}
-	void SetSogaEyeColor(EQ2_Color eye_color){
-		SetInfo(&features.soga_eye_color, eye_color);
-	}
-	int16 GetHairType(){
-		return features.hair_type;
-	}
-	int16 GetFacialHairType(){
-		return features.hair_face_type;
-	}
-	int16 GetWingType(){
-		return features.wing_type;
-	}
-	int16 GetChestType(){
-		return features.chest_type;
-	}
-	int16 GetLegsType(){
-		return features.legs_type;
-	}
-	int16 GetSogaHairType(){
-		return features.soga_hair_type;
-	}
-	int16 GetSogaFacialHairType(){
-		return features.soga_hair_face_type;
-	}
-	int16 GetSogaChestType(){
-		return features.soga_chest_type;
-	}
-	int16 GetSogaLegType(){
-		return features.soga_legs_type;
-	}
-	EQ2_Color* GetSkinColor(){
-		return &features.skin_color;
-	}
-	EQ2_Color* GetModelColor(){
-		return &features.model_color;
-	}
-	EQ2_Color* GetSogaModelColor(){
-		return &features.soga_model_color;
-	}
-	EQ2_Color* GetEyeColor(){
-		return &features.eye_color;
-	}
-	EQ2_Color* GetMountSaddleColor(){
-		return &features.mount_saddle_color;
-	}
-	EQ2_Color* GetMountColor(){
-		return &features.mount_color;
-	}	
-	// should only be accessed through MEquipment mutex
-	EQ2_Equipment	equipment;
-	CharFeatures	features;	
-
-	void AddSpellBonus(LuaSpell* spell, int16 type, float value, int64 class_req =0, vector<int16> race_req = vector<int16>(), vector<int16> faction_req = vector<int16>());
-	BonusValues* GetSpellBonus(int32 spell_id);
-	vector<BonusValues*>* GetAllSpellBonuses(LuaSpell* spell);
-	bool CheckSpellBonusRemoval(LuaSpell* spell, int16 type);
-	void RemoveSpellBonus(const LuaSpell* spell, bool remove_all = false);
-	void RemoveAllSpellBonuses();
-	void CalculateSpellBonuses(ItemStatsValues* stats);
-	void AddMezSpell(LuaSpell* spell);
-	void RemoveMezSpell(LuaSpell* spell);
-	void RemoveAllMezSpells();
-	bool IsMezzed();
-	void AddStifleSpell(LuaSpell* spell);
-	void RemoveStifleSpell(LuaSpell* spell);
-	bool IsStifled();
-	void AddDazeSpell(LuaSpell* spell);
-	void RemoveDazeSpell(LuaSpell* spell);
-	bool IsDazed();
-	void AddStunSpell(LuaSpell* spell);
-	void RemoveStunSpell(LuaSpell* spell);
-	bool IsStunned();
-	bool IsMezzedOrStunned() {return IsMezzed() || IsStunned();}
-	void AddRootSpell(LuaSpell* spell);
-	void RemoveRootSpell(LuaSpell* spell);
-	bool IsRooted();
-	void AddFearSpell(LuaSpell* spell);
-	void RemoveFearSpell(LuaSpell* spell);
-	bool IsFeared();
-	void AddSnareSpell(LuaSpell* spell);
-	void RemoveSnareSpell(LuaSpell* spell);
-	void SetSnareValue(LuaSpell* spell, float snare_val);
-	bool IsSnared();
-	float GetHighestSnare();
-
-	bool HasControlEffect(int8 type);
-
-	void HaltMovement();
-
-
-	void SetCombatPet(Entity* pet) { this->pet = pet; }
-	void SetCharmedPet(Entity* pet) { charmedPet = pet; }
-	void SetDeityPet(Entity* pet) { deityPet = pet; }
-	void SetCosmeticPet(Entity* pet) { cosmeticPet = pet; }
-	Entity* GetPet() { return pet; }
-	Entity* GetCharmedPet() { return charmedPet; }
-	Entity* GetDeityPet() { return deityPet; }
-	Entity* GetCosmeticPet() { return cosmeticPet; }
-	/// <summary>Check to see if the entity has a combat pet</summary>
-	/// <returns>True if the entity has a combat pet</returns>
-	bool HasPet() { return (pet || charmedPet) ? true : false; }
-
-	void HideDeityPet(bool val);
-	void HideCosmeticPet(bool val);
-	void DismissPet(Entity* pet, bool from_death = false, bool spawnListLocked = false);
-	void DismissAllPets(bool from_death = false, bool spawnListLocked = false);
-
-	void	SetOwner(Entity* owner) { if (owner) { this->owner = owner->GetID(); } else { owner = 0; } }
-	Entity*	GetOwner();
-	int8	GetPetType() { return m_petType; }
-	void	SetPetType(int8 val) { m_petType = val; }
-	void	SetPetSpellID(int32 val) { m_petSpellID = val; }
-	int32	GetPetSpellID() { return m_petSpellID; }
-	void	SetPetSpellTier(int8 val) { m_petSpellTier = val; }
-	int8	GetPetSpellTier() { return m_petSpellTier; }
-	bool IsDismissing() { return m_petDismissing; }
-	void SetDismissing(bool val) { m_petDismissing = val; }
-
-	/// <summary>Creates a loot chest to drop in the world</summary>
-	/// <returns>Pointer to the chest</returns>
-	NPC* DropChest();
-
-	/// <summary>Add a ward to the entities ward list</summary>
-	/// <param name='spellID'>Spell id of the ward to add</param>
-	/// <param name='ward'>WardInfo* of the ward we are adding</parma>
-	void AddWard(int32 spellID, WardInfo* ward);
-
-	/// <summary>Gets ward info for the given spell id</summary>
-	/// <param name='spellID'>The spell id of the ward we want to get</param>
-	/// <returns>WardInfo for the given spell id</returns>
-	WardInfo* GetWard(int32 spellID);
-
-	/// <summary>Removes the ward with the given spell id</summary>
-	/// <param name='spellID'>The spell id of the ward to remove</param>
-	void RemoveWard(int32 spellID);
-
-	/// <summary>Subtracts the given damage from the wards</summary>
-	/// <param name='damage'>The damage to subtract from the wards</param>
-	/// <returns>The amount of damage left after wards</returns>
-	int32 CheckWards(Entity* attacker, int32 damage, int8 damage_type);
-
-	map<int16, float> stats;
-
-	/// <summary>Adds a proc to the list of current procs</summary>
-	/// <param name='type'>The type of proc to add</param>
-	/// <param name='chance'>The percent chance the proc has to go off</param>
-	/// <param name='item'>The item the proc is coming from if any</param>
-	/// <param name='spell'>The spell the proc is coming from if any</param>
-	void AddProc(int8 type, float chance, Item* item = 0, LuaSpell* spell = 0);
-
-	/// <summary>Removes a proc from the list of current procs</summary>
-	/// <param name='item'>Item the proc is from</param>
-	/// <param name='spell'>Spell the proc is from</param>
-	void RemoveProc(Item* item = 0, LuaSpell* spell = 0);
-
-	/// <summary>Cycles through the proc list and executes them if they can go off</summary>
-	/// <param name='type'>The proc type to check</param>
-	/// <param name='target'>The target of the proc if it goes off</param>
-	void CheckProcs(int8 type, Spawn* target);
-
-	/// <summary>Clears the entire proc list</summary>
-	void ClearProcs();
-
-	float GetSpeed();
-	float GetAirSpeed();
-	float GetBaseSpeed() { return base_speed; }
-	void SetSpeed(float val, bool override_ = false) { if ((base_speed == 0.0f && val > 0.0f) || override_) base_speed = val;  speed = val; }
-	void SetSpeedMultiplier(float val) { speed_multiplier = val; }
-
-	void SetThreatTransfer(ThreatTransfer* transfer) { m_threatTransfer = transfer; }
-	ThreatTransfer* GetThreatTransfer() { return m_threatTransfer; }
-	int8 GetTraumaCount();
-	int8 GetArcaneCount();
-	int8 GetNoxiousCount();
-	int8 GetElementalCount();
-	int8 GetCurseCount();
-	int8 GetDetTypeCount(int8 det_type);
-	int8 GetDetCount();
-	bool HasCurableDetrimentType(int8 det_type);
-	Mutex* GetDetrimentMutex();
-	Mutex* GetMaintainedMutex();
-	Mutex* GetSpellEffectMutex();
-	void ClearAllDetriments();
-	void CureDetrimentByType(int8 cure_count, int8 det_type, string cure_name, Entity* caster, int8 cure_level = 0);
-	void CureDetrimentByControlEffect(int8 cure_count, int8 det_type, string cure_name, Entity* caster, int8 cure_level = 0);
-	vector<DetrimentalEffects>* GetDetrimentalSpellEffects();
-	void RemoveEffectsFromLuaSpell(LuaSpell* spell);
-	virtual void RemoveSkillBonus(int32 spell_id);
-
-	virtual bool CanSeeInvis(Entity* target);
-	void CancelAllStealth();
-	bool IsStealthed();
-	bool IsInvis();
-	void AddInvisSpell(LuaSpell* spell);
-	void AddStealthSpell(LuaSpell* spell);
-	void RemoveStealthSpell(LuaSpell* spell);
-	void RemoveInvisSpell(LuaSpell* spell);
-	void AddWaterwalkSpell(LuaSpell* spell);
-	void AddWaterjumpSpell(LuaSpell* spell);
-	void RemoveWaterwalkSpell(LuaSpell* spell);
-	void RemoveWaterjumpSpell(LuaSpell* spell);
-	void AddAOEImmunity(LuaSpell* spell);
-	bool IsAOEImmune();
-	void RemoveAOEImmunity(LuaSpell* spell);
-	void AddStunImmunity(LuaSpell* spell);
-	void RemoveStunImmunity(LuaSpell* spell);
-	bool IsStunImmune();
-	void AddStifleImmunity(LuaSpell* spell);
-	void RemoveStifleImmunity(LuaSpell* spell);
-	bool IsStifleImmune();
-	void AddMezImmunity(LuaSpell* spell);
-	void RemoveMezImmunity(LuaSpell* spell);
-	bool IsMezImmune();
-	void AddRootImmunity(LuaSpell* spell);
-	void RemoveRootImmunity(LuaSpell* spell);
-	bool IsRootImmune();
-	void AddFearImmunity(LuaSpell* spell);
-	void RemoveFearImmunity(LuaSpell* spell);
-	bool IsFearImmune();
-	void AddDazeImmunity(LuaSpell* spell);
-	void RemoveDazeImmunity(LuaSpell* spell);
-	bool IsDazeImmune();
-	void AddImmunity(LuaSpell* spell, int16 type);
-	void RemoveImmunity(LuaSpell* spell, int16 type);
-	bool IsImmune(int16 type);
-	void AddFlightSpell(LuaSpell* spell);
-	void RemoveFlightSpell(LuaSpell* spell);
-	void AddSafefallSpell(LuaSpell* spell);
-	void RemoveSafefallSpell(LuaSpell* spell);
-	void AddGlideSpell(LuaSpell* spell);
-	void RemoveGlideSpell(LuaSpell* spell);
-
-	GroupMemberInfo* GetGroupMemberInfo() { return group_member_info; }
-	void SetGroupMemberInfo(GroupMemberInfo* info) { group_member_info = info; }
-	void UpdateGroupMemberInfo(bool inGroupMgrLock=false, bool groupMembersLocked=false);
-
-	void CustomizeAppearance(PacketStruct* packet);
-
-	Trade* trade;
-
-	// Keep track of entities that hate this spawn.
-	set<int32> HatedBy;
-	std::mutex MHatedBy;
-
-	bool IsAggroed() { 
-			int32 size = 0;
-
-			MHatedBy.lock();
-			size = HatedBy.size();
-			MHatedBy.unlock();
-
-			return size > 0;
-		}
-
-	Mutex	MCommandMutex;
-
-	bool HasSeeInvisSpell() { return hasSeeInvisSpell; }
-	void SetSeeInvisSpell(bool val) { hasSeeInvisSpell = val; }
-
-	bool HasSeeHideSpell() { return hasSeeHideSpell; }
-	void SetSeeHideSpell(bool val) { hasSeeHideSpell = val; }
-
-	void SetInfoStruct(InfoStruct* struct_) { info_struct.SetInfoStruct(struct_); }
-
-	std::string GetInfoStructString(std::string field);
-	int8 GetInfoStructInt8(std::string field);
-	int16 GetInfoStructInt16(std::string field);
-	int32 GetInfoStructInt32(std::string field);
-	int64 GetInfoStructInt64(std::string field);
-	sint8 GetInfoStructSInt8(std::string field);
-	sint16 GetInfoStructSInt16(std::string field);
-	sint32 GetInfoStructSInt32(std::string field);
-	sint64 GetInfoStructSInt64(std::string field);
-	int64 GetInfoStructUInt(std::string field);
-	sint64 GetInfoStructSInt(std::string field);
-	float GetInfoStructFloat(std::string field);
-
-
-	bool SetInfoStructString(std::string field, std::string value);
-	bool SetInfoStructUInt(std::string field, int64 value);
-	bool SetInfoStructSInt(std::string field, sint64 value);
-	bool SetInfoStructFloat(std::string field, float value);
-
-	sint32 CalculateHateAmount(Spawn* target, sint32 amt);
-	sint32 CalculateHealAmount(Spawn* target, sint32 amt, int8 crit_mod, bool* crit, bool skip_crit_mod = false);
-	sint32 CalculateDamageAmount(Spawn* target, sint32 damage, int8 base_type, int8 damage_type, LuaSpell* spell);
-	sint32 CalculateDamageAmount(Spawn* target, sint32 damage, int8 base_type, int8 damage_type, int8 spell_target_type);
-	sint32 CalculateFormulaByStat(sint32 value, int16 stat);
-	int32 CalculateFormulaByStat(int32 value, int16 stat);
-	int32 CalculateFormulaBonus(int32 value, float percent_bonus);
-	// when PacketStruct is fixed for C++17 this should become a shared_mutex and handle read/write lock
-	std::mutex		MEquipment;
-	std::mutex		MStats;
-
-	Mutex   MMaintainedSpells;
-	Mutex   MSpellEffects;
-protected:
-	bool	in_combat;
-	int8	m_petType;
-	int32	owner;
-	// m_petSpellID holds the spell id used to create/control this pet
-	int32	m_petSpellID;
-	int8	m_petSpellTier;
-	bool	m_petDismissing;
-private:
-	MutexList<BonusValues*> bonus_list;
-	map<int8, MutexList<LuaSpell*>*> control_effects;
-	map<int8, MutexList<LuaSpell*>*> immunities;
-	float	max_speed;
-	int8	deity;
-	sint16	regen_hp_rate;
-	sint16	regen_power_rate;
-	float	last_x;
-	float	last_y;
-	float	last_z;
-	float	last_heading;
-	bool	casting;
-	InfoStruct		info_struct;
-	CombatData melee_combat_data;
-	CombatData ranged_combat_data;
-	map<int8, int8> det_count_list;
-	Mutex MDetriments;
-	vector<DetrimentalEffects> detrimental_spell_effects;
-	// Pointers for the 4 types of pets (Summon, Charm, Deity, Cosmetic)
-	Entity*	pet;
-	Entity* charmedPet;
-	Entity* deityPet;
-	Entity* cosmeticPet;
-
-	// int32 = spell id, WardInfo* = pointer to ward info
-	map<int32, WardInfo*> m_wardList;
-
-	// int8 = type, vector<Proc*> = list of pointers to proc info
-	map <int8, vector<Proc*> > m_procList;
-	Mutex MProcList;
-
-	/// <summary>Actually calls the lua script to cast the proc</summary>
-	/// <param name='proc'>Proc to be cast</param>
-	/// <param name='type'>Type of proc going off</type>
-	/// <param name='target'>Target of the proc</param>
-	bool CastProc(Proc* proc, int8 type, Spawn* target);
-
-	float base_speed;
-	float speed;
-	float speed_multiplier;
-
-	map<LuaSpell*, float> snare_values;
-
-	ThreatTransfer* m_threatTransfer;
-
-	GroupMemberInfo* group_member_info;
-
-	bool hasSeeInvisSpell;
-	bool hasSeeHideSpell;
-
-	// GETs
-	map<string, boost::function<float()> > get_float_funcs;
-	map<string, boost::function<int64()> > get_int64_funcs;
-	map<string, boost::function<int32()> > get_int32_funcs;
-	map<string, boost::function<int16()> > get_int16_funcs;
-	map<string, boost::function<int8()> > get_int8_funcs;
-
-	map<string, boost::function<sint64()> > get_sint64_funcs;
-	map<string, boost::function<sint32()> > get_sint32_funcs;
-	map<string, boost::function<sint16()> > get_sint16_funcs;
-	map<string, boost::function<sint8()> > get_sint8_funcs;
-	
-	map<string, boost::function<std::string()> > get_string_funcs;
-
-	// SETs
-	map<string, boost::function<void(float)> > set_float_funcs;
-	map<string, boost::function<void(int64)> > set_int64_funcs;
-	map<string, boost::function<void(int32)> > set_int32_funcs;
-	map<string, boost::function<void(int16)> > set_int16_funcs;
-	map<string, boost::function<void(int8)> > set_int8_funcs;
-
-	map<string, boost::function<void(sint64)> > set_sint64_funcs;
-	map<string, boost::function<void(sint32)> > set_sint32_funcs;
-	map<string, boost::function<void(sint16)> > set_sint16_funcs;
-	map<string, boost::function<void(sint8)> > set_sint8_funcs;
-	
-	map<string, boost::function<void(std::string)> > set_string_funcs;
-};
-
-#endif

+ 0 - 8020
EQ2EMu/EQ2/source/WorldServer/WorldDatabase.cpp

@@ -1,8020 +0,0 @@
-/*  
-EQ2Emulator:  Everquest II Server Emulator
-Copyright (C) 2007  EQ2EMulator Development Team (http://www.eq2emulator.net)
-
-This file is part of EQ2Emulator.
-
-EQ2Emulator is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-EQ2Emulator is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with EQ2Emulator.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <math.h>
-#include <iostream>
-#include <sstream>
-#include <iomanip>
-#include <ios>
-#include <assert.h>
-#include "WorldDatabase.h"
-#include "../common/debug.h"
-#include "../common/packet_dump.h"
-#include "../common/GlobalHeaders.h"
-#include "Items/Items.h"
-#include "Factions.h"
-#include "World.h"
-#include "Variables.h"
-#include "VisualStates.h"
-#include "Appearances.h"
-#include "Skills.h"
-#include "Quests.h"
-#include "LuaInterface.h"
-#include "classes.h"
-#include "../common/Log.h"
-#include "Rules/Rules.h"
-#include "Titles.h"
-#include "Languages.h"
-#include "Traits/Traits.h"
-#include "ClientPacketFunctions.h"
-#include "Zone/ChestTrap.h"
-#include "../common/version.h"
-#include "SpellProcess.h"
-
-extern Classes classes;
-extern Commands commands;
-extern MasterTitlesList master_titles_list;
-extern MasterItemList master_item_list;
-extern MasterSpellList master_spell_list;
-extern MasterTraitList master_trait_list;
-extern MasterFactionList master_faction_list;
-extern World world;
-extern Variables variables;
-extern VisualStates visual_states;
-extern Appearances master_appearance_list;
-extern MasterSkillList master_skill_list;
-extern MasterQuestList master_quest_list;
-extern LuaInterface* lua_interface;
-extern ZoneList zone_list;
-extern GuildList guild_list;
-extern MasterCollectionList master_collection_list;
-extern RuleManager rule_manager;
-extern MasterLanguagesList master_languages_list;
-extern ChestTrapList chest_trap_list;
-
-//devn00b: Fix for linux builds since we dont use stricmp we use strcasecmp
-#if defined(__GNUC__)
-#define stricmp strcasecmp
-#define strnicmp strncasecmp
-#include <sys/stat.h>
-#endif
-
-WorldDatabase::WorldDatabase(){
-}
-
-WorldDatabase::~WorldDatabase(){
-}
-
-bool WorldDatabase::ConnectNewDatabase() {
-	/*
-	TESTS
-
-	database_new.Connect();
-	DatabaseResult result;
-	database_new.Select(&result, "select name from characters where id=1");
-	if (result.Next()) {
-		printf("'%s'\n", result.GetStringStr("name"));
-		printf("'%s'\n", result.GetStringStr("nameBAD"));
-		printf("'%s'\n", result.GetString(3));
-	}
-	return true;
-	*/
-
-	return database_new.Connect();
-}
-
-void WorldDatabase::PingNewDB()
-{
-	database_new.PingNewDB();
-}
-
-void WorldDatabase::DeleteBuyBack(int32 char_id, int32 item_id, int16 quantity, int32 price) {
-	LogWrite(MERCHANT__DEBUG, 0, "Merchant", "Deleting Buyback - Player: %u, Item ID: %u, Qty: %i, Price: %u", char_id, item_id, quantity, price);
-
-	Query query;
-	query.RunQuery2(Q_DELETE, "DELETE FROM character_buyback WHERE char_id = %u AND item_id = %u AND quantity = %i AND price = %u", char_id, item_id, quantity, price);
-}
-
-void WorldDatabase::LoadBuyBacks(Client* client) {
-	LogWrite(MERCHANT__DEBUG, 0, "Merchant", "Loading Buyback - Player: %u", client->GetCharacterID());
-
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, item_id, quantity, price FROM character_buyback where char_id = %u ORDER BY id desc limit 10", client->GetCharacterID());
-	int8 count = 0;
-	int32 last_id = 0;
-	if(result)
-	{
-		while(result && (row = mysql_fetch_row(result)))
-		{
-			LogWrite(MERCHANT__DEBUG, 5, "Merchant", "AddBuyBack: item: %u, qty: %i, price: %u", atoul(row[1]), atoi(row[2]), atoul(row[3]));
-			last_id = atoul(row[0]);
-			client->AddBuyBack(last_id, atoul(row[1]), atoi(row[2]), atoul(row[3]), false);
-			count++;
-		}
-		if(count >= 10)
-		{
-			LogWrite(MERCHANT__DEBUG, 0, "Merchant", "Deleting excess Buyback from Player: %u", client->GetCharacterID());
-			Query query2;
-			query2.RunQuery2(Q_DELETE, "DELETE FROM character_buyback WHERE char_id = %u AND id < %u", client->GetCharacterID(), last_id);
-		}
-	}
-}
-
-void WorldDatabase::SaveBuyBacks(Client* client) 
-{
-	LogWrite(MERCHANT__DEBUG, 3, "Merchant", "Saving Buybacks - Player: %u", client->GetCharacterID());
-
-	deque<BuyBackItem*>* buybacks = client->GetBuyBacks();
-
-	if(buybacks && buybacks->size() > 0)
-	{
-		BuyBackItem* item = 0;
-		deque<BuyBackItem*>::iterator itr;
-
-		for(itr = buybacks->begin(); itr != buybacks->end(); itr++)
-		{
-			item = *itr;
-
-			if(item && item->save_needed)
-			{
-				LogWrite(MERCHANT__DEBUG, 5, "Merchant", "SaveBuyBack: char: %u, item: %u, qty: %i, price: %u", client->GetCharacterID(), item->item_id, item->quantity, item->price);
-				SaveBuyBack(client->GetCharacterID(), item->item_id, item->quantity, item->price);
-				item->save_needed = false;
-			}
-		}
-	}
-}
-
-void WorldDatabase::SaveBuyBack(int32 char_id, int32 item_id, int16 quantity, int32 price) 
-{
-	LogWrite(MERCHANT__DEBUG, 3, "Merchant", "Saving Buyback - Player: %u, Item ID: %u, Qty: %i, Price: %u", char_id, item_id, quantity, price);
-
-	Query query;
-	string insert = string("INSERT INTO character_buyback (char_id, item_id, quantity, price) VALUES (%u, %u, %i, %u) ");
-	query.AddQueryAsync(char_id, this, Q_INSERT, insert.c_str(), char_id, item_id, quantity, price);
-}
-
-int32 WorldDatabase::LoadCharacterSpells(int32 char_id, Player* player)
-{
-	LogWrite(SPELL__DEBUG, 0, "Spells", "Loading Character Spells for player %s...", player->GetName());
-
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT spell_id, tier, knowledge_slot, spell_book_type, linked_timer_id  FROM character_spells, spells where character_spells.spell_id = spells.id and character_spells.char_id = %u ORDER BY spell_id, tier desc", char_id);
-	int32 old_spell_id = 0;
-	int32 new_spell_id = 0;
-	int32 count = 0;
-
-	if(result && mysql_num_rows(result) >0)
-	{
-		while(result && (row = mysql_fetch_row(result)))
-		{
-			count++;
-			new_spell_id = atoul(row[0]);
-
-			if(new_spell_id == old_spell_id)
-				continue;
-
-			old_spell_id = new_spell_id;
-
-			LogWrite(SPELL__DEBUG, 5, "Spells", "\tLoading SpellID: %u, tier: %i, slot: %i, type: %u linked_timer_id: %u", new_spell_id, atoi(row[1]), atoi(row[2]), atoul(row[3]), atoul(row[4]));
-
-			int8 tier = atoi(row[1]);
-
-			if (player->HasSpell(new_spell_id, tier, true))
-				continue;
-
-			player->AddSpellBookEntry(new_spell_id, tier, atoi(row[2]), atoul(row[3]), atoul(row[4]));
-		}
-	}
-
-	return count;
-}
-
-void WorldDatabase::SavePlayerSpells(Client* client)
-{
-	if(!client || client->GetCharacterID() < 1)
-		return;
-
-	LogWrite(SPELL__DEBUG, 3, "Spells", "Saving Spell(s) for Player: '%s'", client->GetPlayer()->GetName());
-	vector<SpellBookEntry*>* spells = client->GetPlayer()->GetSpellsSaveNeeded();
-
-	if(spells)
-	{
-		vector<SpellBookEntry*>::iterator itr;
-		SpellBookEntry* spell = 0;
-
-		for(itr = spells->begin(); itr != spells->end(); itr++)
-		{
-			spell = *itr;
-			Query query;
-			LogWrite(SPELL__DEBUG, 5, "Spells", "\tSaving SpellID: %u, tier: %i, slot: %i", spell->spell_id, spell->tier, spell->slot);
-			query.AddQueryAsync(client->GetCharacterID(), this, Q_INSERT, "INSERT INTO character_spells (char_id, spell_id, tier) SELECT %u, %u, %i ON DUPLICATE KEY UPDATE tier = %i",
-				client->GetPlayer()->GetCharacterID(), spell->spell_id, spell->tier, spell->tier);
-			spell->save_needed = false;
-		}
-		safe_delete(spells);
-	}
-}
-
-int32 WorldDatabase::LoadCharacterSkills(int32 char_id, Player* player)
-{
-	Query query;
-	MYSQL_ROW row;
-	int32 count = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT skill_id, current_val, max_val FROM character_skills, skills where character_skills.skill_id = skills.id and character_skills.char_id = %u", char_id);
-
-	if(result && mysql_num_rows(result) >0)
-	{
-		while(result && (row = mysql_fetch_row(result)))
-		{
-			count++;
-			LogWrite(SKILL__DEBUG, 5, "Skills", "Loading SkillID: %u, cur_val: %i, max_val: %l", strtoul(row[0], NULL, 0), atoi(row[1]), atoi(row[2]));
-			player->AddSkill(strtoul(row[0], NULL, 0), atoi(row[1]), atoi(row[2]));
-		}
-	}
-	return count;
-}
-
-void WorldDatabase::DeleteCharacterSkill(int32 char_id, Skill* skill) 
-{
-	if (char_id > 0 && skill) 
-	{
-		LogWrite(SKILL__DEBUG, 0, "Skills", "Deleting Skill '%s' (%u) from char_id: %u", skill->name.data.c_str(), skill->skill_id, char_id);
-		Query query;
-		query.RunQuery2(Q_DELETE, "DELETE FROM `character_skills` WHERE `char_id`=%u AND `skill_id`=%u", char_id, skill->skill_id);
-	}
-}
-
-int32 WorldDatabase::LoadSkills() 
-{
-	int32 total = 0;
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, short_name, name, description, skill_type, display FROM skills");
-
-	if(result)
-	{
-		if (mysql_num_rows(result) >0)
-		{
-			Skill* skill = 0;
-
-			while(result && (row = mysql_fetch_row(result)))
-			{
-				skill = new Skill();
-				skill->skill_id = strtoul(row[0], NULL, 0);
-				skill->short_name.data = string(row[1]);
-				skill->short_name.size = skill->short_name.data.length();
-				skill->name.data = string(row[2]);
-				skill->name.size = skill->name.data.length();
-				skill->description.data = string(row[3]);
-				skill->description.size = skill->description.data.length();
-				skill->skill_type = strtoul(row[4], NULL, 0);
-				//these two need to be converted to the correct numbers
-				if(skill->skill_type == 13)
-					skill->skill_type = SKILL_TYPE_LANGUAGE;
-				else if(skill->skill_type == 12)
-					skill->skill_type = SKILL_TYPE_GENERAL;
-
-				skill->display = atoi(row[5]);
-				master_skill_list.AddSkill(skill);
-				total++;
-				LogWrite(SKILL__DEBUG, 5, "Skill", "---Loading Skill: %s (%u)", skill->name.data.c_str(), skill->skill_id);
-				LogWrite(SKILL__DEBUG, 7, "Skill", "---short_name: %s, type: %i, display: %i", skill->short_name.data.c_str(), skill->skill_type, skill->display);
-			}
-		}
-	}
-	LogWrite(SKILL__DEBUG, 3, "Skill", "--Loaded %u Skill(s)", total);
-	return total;
-}
-
-map<int8, vector<MacroData*> >*	WorldDatabase::LoadCharacterMacros(int32 char_id)
-{
-	Query query;
-	MYSQL_ROW row;
-	int32 total = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT macro_number, macro_name, macro_icon, macro_text FROM character_macros where char_id = %u ORDER BY macro_number, id", char_id);
-
-	if(result && mysql_num_rows(result) >0)
-	{
-		map<int8, vector<MacroData*> >* macros = new map<int8, vector<MacroData*> >;
-
-		while(result && (row = mysql_fetch_row(result)))
-		{
-			MacroData* data = new MacroData;
-			data->name = row[1];
-			data->icon = atoi(row[2]);
-			data->text = row[3];
-			(*macros)[atoi(row[0])].push_back(data);
-			total++;
-			LogWrite(PLAYER__DEBUG, 5, "Player", "\tLoading macro: %i. %s for player: %u", atoi(row[0]), row[1], char_id);
-		}
-		LogWrite(PLAYER__DEBUG, 0, "Player", "\tLoaded %u macro%s", total, total == 1 ? "" : "s");
-		return macros;
-	}
-	return 0;
-}
-
-void WorldDatabase::UpdateCharacterMacro(int32 char_id, int8 number, const char* name, int16 icon, vector<string>* updates)
-{
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Update player id %u macro: %i", char_id, number);
-
-	Query query;
-	Query query2;
-	query.RunQuery2(Q_DELETE, "delete FROM character_macros where char_id = %u and macro_number = %i", char_id, number);
-
-	if(name && updates && updates->size() > 0)
-	{
-		for(int8 i=0;i<updates->size();i++)
-		{
-			query2.RunQuery2(Q_INSERT, "insert into character_macros (char_id, macro_number, macro_name, macro_icon, macro_text) values(%u, %i, '%s', %i, '%s')", char_id, number, getSafeEscapeString(name).c_str(), icon, getSafeEscapeString(updates->at(i).c_str()).c_str());
-			LogWrite(PLAYER__DEBUG, 5, "Player", "\tAdding macro: %s, %s (Player: %u)", name, updates->at(i).c_str(), char_id);
-		}
-	}
-}
-
-//we use our timestamp just in case db is on another server, otherwise times might be off
-void WorldDatabase::UpdateVitality(int32 timestamp, float amount){ 
-	Query query;
-
-	LogWrite(PLAYER__DEBUG, 3, "Player", "Reset Vitality > 100: %f", amount);
-	query.RunQuery2(Q_UPDATE, "update character_details set xp_vitality=100 where (xp_vitality + %f) > 100", amount);
-
-	LogWrite(PLAYER__DEBUG, 3, "Player", "Update Vitality <= 100: %f", amount);
-	query.RunQuery2(Q_UPDATE, "update character_details set xp_vitality=(xp_vitality+%f) where (xp_vitality + %f) <= 100", amount, amount);
-
-	LogWrite(PLAYER__DEBUG, 3, "Player", "Update Vitality Timer: %u", timestamp);
-	query.RunQuery2(Q_UPDATE, "update variables set variable_value=%u where variable_name='vitalitytimer'", timestamp);
-}
-
-void WorldDatabase::SaveVariable(const char* name, const char* value, const char* comment){
-
-	LogWrite(WORLD__DEBUG, 0, "Variables", "Saving Variable: %s = %s", name, value);
-	Query query;
-	if(comment){
-		query.RunQuery2(Q_REPLACE, "replace into variables (variable_name, variable_value, comment) values('%s', '%s', '%s')", 
-			getSafeEscapeString(name).c_str(), getSafeEscapeString(value).c_str(), getSafeEscapeString(comment).c_str());
-	}
-	else{
-		query.RunQuery2(Q_REPLACE, "replace into variables (variable_name, variable_value) values('%s', '%s')", 
-			getSafeEscapeString(name).c_str(), getSafeEscapeString(value).c_str());
-	}
-}
-
-void WorldDatabase::LoadGlobalVariables(){
-	variables.ClearVariables ( );
-	int32 total = 0;
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT variable_name, variable_value, comment FROM variables");
-
-	while(result && (row = mysql_fetch_row(result)))
-	{
-		Variable* newVar = new Variable(row[0], row[1], row[2]);
-		variables.AddVariable(newVar);
-		total++;
-		LogWrite(WORLD__DEBUG, 5, "World", "---Loading variable: '%s' = '%s'", row[0], row[1]);
-	}
-	LogWrite(WORLD__DEBUG, 3, "World", "--Loaded %u variables", total);
-}
-
-
-void WorldDatabase::LoadAppearanceMasterList()
-{
-	DatabaseResult result;
-	int32 total = 0;
-	int32	appearance_id;
-	int16	appearance_version;
-
-	master_appearance_list.ClearAppearances();
-
-	database_new.Select(&result, "SELECT appearance_id, `name`, min_client_version FROM appearances ORDER BY appearance_id");
-
-	while( result.Next() )
-	{
-		appearance_id				= result.GetInt32Str("appearance_id");
-		const char *appearance_name	= result.GetStringStr("name");
-		appearance_version			= result.GetInt16Str("min_client_version");
-		Appearance* a				= new Appearance(appearance_id, appearance_name, appearance_version);
-
-		master_appearance_list.InsertAppearance(a);
-
-		total++;
-		LogWrite(WORLD__DEBUG, 5, "World", "---Loading appearances: '%s' (%i)", appearance_name, appearance_id);
-	}
-	LogWrite(WORLD__DEBUG, 3, "World", "--Loaded %u appearances", total);
-}
-
-
-void WorldDatabase::LoadVisualStates()
-{
-	visual_states.Reset();
-	int32 total = 0;
-	Query query;
-	Query query2;
-	MYSQL_ROW row;
-
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT visual_state_id, name FROM visual_states");
-	while(result && (row = mysql_fetch_row(result)))
-	{
-		VisualState* vs = new VisualState(atoi(row[0]), row[1]);
-		visual_states.InsertVisualState(vs);
-		total++;
-		LogWrite(WORLD__DEBUG, 5, "World", "---Loading visual state: '%s' (%i)", row[1], atoi(row[0]));
-	}
-	LogWrite(WORLD__DEBUG, 3, "World", "--Loaded %u visual states", total);
-
-	total = 0;
-	result = query2.RunQuery2(Q_SELECT, "SELECT name, visual_state_id, message, targeted_message, min_version_range, max_version_range FROM emotes");
-	while(result && (row = mysql_fetch_row(result)))
-	{
-		EmoteVersionRange* range = 0;
-		if ((range = visual_states.FindEmoteRange(string(row[0]))) == NULL)
-		{
-			range = new EmoteVersionRange(row[0]);
-			visual_states.InsertEmoteRange(range);
-		}
-		
-		range->AddVersionRange(atoul(row[4]),atoul(row[5]), row[0], atoi(row[1]), row[2], row[3]);
-		total++;
-		LogWrite(WORLD__DEBUG, 5, "World", "---Loading emote state: '%s' (%i)", row[1], atoi(row[0]));
-	}
-	LogWrite(WORLD__DEBUG, 3, "World", "--Loaded %u emote state(s)", total);
-}
-
-void WorldDatabase::LoadSubCommandList() 
-{
-	int32 total = 0;
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT command, subcommand, handler, required_status FROM commands where length(subcommand) > 0 ORDER BY handler asc");
-	while(result && (row = mysql_fetch_row(result)))
-	{
-		commands.GetRemoteCommands()->CheckAddSubCommand(string(row[0]), EQ2_RemoteCommandString(row[1], (int32)strtoul(row[2], NULL, 0), atoi(row[3])));
-		total++;
-		LogWrite(COMMAND__DEBUG, 5, "Command", "---Loading Command: '%s', sub '%s', handler, %u status %i", row[0], row[1], atoul(row[2]), atoi(row[3]));
-	}
-	LogWrite(COMMAND__DEBUG, 3, "Command", "--Loaded %i Subcommand(s)", total);
-}
-
-void WorldDatabase::LoadCommandList() 
-{
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT command, handler, required_status FROM commands where length(subcommand) = 0 ORDER BY handler asc");
-	int16 index = 0;
-
-	while(result && (row = mysql_fetch_row(result)))
-	{
-		int32 handler = strtoul(row[1], NULL, 0);
-		while(handler>index && handler != 999)
-		{
-			LogWrite(COMMAND__DEBUG, 5, "Command", "---Loading Remote Commands: handler %u, index %u", handler, index);
-			commands.GetRemoteCommands()->addZero();
-			index++;
-		}
-		LogWrite(COMMAND__DEBUG, 5, "Command", "---Loading Commands: handler %u, index %u", handler, index);
-		commands.GetRemoteCommands()->addCommand(EQ2_RemoteCommandString(row[0], handler, atoi(row[2])));
-		index++;
-	}
-	LogWrite(COMMAND__DEBUG, 3, "Command", "--Loaded %i Command%s", index, index > 0 ? "s" : "");
-	LoadSubCommandList();
-}
-
-int32 WorldDatabase::LoadNPCSpells(ZoneServer* zone){
-	Query query;
-	MYSQL_ROW row;
-	int32 count = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT spell_list_id, spell_id, spell_tier FROM spawn_npc_spells where spell_list_id > 0");
-	while(result && (row = mysql_fetch_row(result))){
-		zone->AddNPCSpell(atoul(row[0]), atoul(row[1]), atoi(row[2]));
-		count++;
-
-		LogWrite(NPC__DEBUG, 5, "NPC", "---Loading NPC Spell List: %u, spell id: %u, tier: %i", atoul(row[0]), atoul(row[1]), atoi(row[2]));
-
-	}
-	return count;
-}
-
-int32 WorldDatabase::LoadNPCSkills(ZoneServer* zone){
-	Query query;
-	MYSQL_ROW row;
-	int32 count = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT skill_list_id, skill_id, starting_value FROM spawn_npc_skills");
-	while(result && (row = mysql_fetch_row(result))){
-		zone->AddNPCSkill(atoul(row[0]), atoul(row[1]), atoi(row[2]));
-		count++;
-
-		LogWrite(NPC__DEBUG, 5, "NPC", "---Loading NPC Skill List: %u, skill id: %u, value: %i", atoul(row[0]), atoul(row[1]), atoi(row[2]));
-
-	}
-	return count;
-}
-
-int32 WorldDatabase::LoadNPCEquipment(ZoneServer* zone){
-	Query query;
-	MYSQL_ROW row;
-	int32 count = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT equipment_list_id, item_id FROM spawn_npc_equipment");
-	while(result && (row = mysql_fetch_row(result))){
-		zone->AddNPCEquipment(atoul(row[0]), atoul(row[1]));
-		count++;
-
-		LogWrite(NPC__DEBUG, 5, "NPC", "---Loading NPC Equipment List: %u, item: %u", atoul(row[0]), atoul(row[1]));
-
-	}
-	return count;
-}
-
-int8 WorldDatabase::GetAppearanceType(string type){
-	int8 ret = 255;
-	if (type == "soga_hair_face_highlight_color")
-		ret = APPEARANCE_SOGA_HFHC;
-	else if (type == "soga_hair_type_highlight_color")
-		ret = APPEARANCE_SOGA_HTHC;
-	else if (type == "soga_hair_face_color")
-		ret = APPEARANCE_SOGA_HFC;
-	else if (type == "soga_hair_type_color")
-		ret = APPEARANCE_SOGA_HTC;
-	else if (type == "soga_hair_highlight")
-		ret = APPEARANCE_SOGA_HH;
-	else if (type == "soga_hair_color1")
-		ret = APPEARANCE_SOGA_HC1;
-	else if (type == "soga_hair_color2")
-		ret = APPEARANCE_SOGA_HC2;
-	else if (type == "hair_type_color")
-		ret = APPEARANCE_HTC;
-	else if (type == "soga_skin_color")
-		ret = APPEARANCE_SOGA_SC;
-	else if (type == "soga_eye_color")
-		ret = APPEARANCE_SOGA_EC;
-	else if (type == "hair_type_highlight_color")
-		ret = APPEARANCE_HTHC;
-	else if (type == "hair_face_highlight_color")
-		ret = APPEARANCE_HFHC;
-	else if (type == "hair_face_color")
-		ret = APPEARANCE_HFC;
-	else if (type == "hair_highlight")
-		ret = APPEARANCE_HH;
-	else if (type == "hair_color1")
-		ret = APPEARANCE_HC1;
-	else if (type == "wing_color1")
-		ret = APPEARANCE_WC1;
-	else if (type == "hair_color2")
-		ret = APPEARANCE_HC2;
-	else if (type == "wing_color2")
-		ret = APPEARANCE_WC2;
-	else if (type == "skin_color")
-		ret = APPEARANCE_SC;
-	else if (type == "eye_color")
-		ret = APPEARANCE_EC;
-	else if (type == "soga_eye_brow_type")
-		ret = APPEARANCE_SOGA_EBT;
-	else if (type == "soga_cheek_type")
-		ret = APPEARANCE_SOGA_CHEEKT;
-	else if (type == "soga_nose_type")
-		ret = APPEARANCE_SOGA_NT;
-	else if (type == "soga_chin_type")
-		ret = APPEARANCE_SOGA_CHINT;
-	else if (type == "soga_lip_type")
-		ret = APPEARANCE_SOGA_LT;
-	else if (type == "eye_brow_type")
-		ret = APPEARANCE_EBT;
-	else if (type == "soga_ear_type")
-		ret = APPEARANCE_SOGA_EART;
-	else if (type == "soga_eye_type")
-		ret = APPEARANCE_SOGA_EYET;
-	else if (type == "cheek_type")
-		ret = APPEARANCE_CHEEKT;
-	else if (type == "nose_type")
-		ret = APPEARANCE_NT;
-	else if (type == "chin_type")
-		ret = APPEARANCE_CHINT;
-	else if (type == "ear_type")
-		ret = APPEARANCE_EART;
-	else if (type == "eye_type")
-		ret = APPEARANCE_EYET;
-	else if (type == "lip_type")
-		ret = APPEARANCE_LT;
-	else if (type == "shirt_color")
-		ret = APPEARANCE_SHIRT;
-	else if (type == "unknown_chest_color")
-		ret = APPEARANCE_UCC;
-	else if (type == "pants_color")
-		ret = APPEARANCE_PANTS;
-	else if (type == "unknown_legs_color")
-		ret = APPEARANCE_ULC;
-	else if (type == "unknown9")
-		ret = APPEARANCE_U9;
-	else if (type == "body_size")
-		ret = APPEARANCE_BODY_SIZE;
-	else if (type == "soga_wing_color1")
-		ret = APPEARANCE_SOGA_WC1;
-	else if (type == "soga_wing_color2")
-		ret = APPEARANCE_SOGA_WC2;
-	else if (type == "soga_shirt_color")
-		ret = APPEARANCE_SOGA_SHIRT;
-	else if (type == "soga_unknown_chest_color")
-		ret = APPEARANCE_SOGA_UCC;
-	else if (type == "soga_pants_color")
-		ret = APPEARANCE_SOGA_PANTS;
-	else if (type == "soga_unknown_legs_color")
-		ret = APPEARANCE_SOGA_ULC;
-	else if (type == "soga_unknown13")
-		ret = APPEARANCE_SOGA_U13;
-	else if (type == "body_age")
-		ret = APPEARANCE_BODY_AGE;
-	else if (type == "model_color")
-		ret = APPEARANCE_MC;
-	else if (type == "soga_model_color")
-		ret = APPEARANCE_SMC;
-	else if (type == "soga_body_size")
-		ret = APPEARANCE_SBS;
-	else if (type == "soga_body_age")
-		ret = APPEARANCE_SBA;
-	return ret;
-}
-
-int32 WorldDatabase::LoadAppearances(ZoneServer* zone, Client* client){
-	Query query, query2;
-	MYSQL_ROW row;
-	int32 count = 0, spawn_id = 0, new_spawn_id = 0;
-	Entity* entity = 0;
-	if(client)
-		entity = client->GetPlayer();
-	map<string, int8> appearance_types;
-	map<int32, map<int8, EQ2_Color> > appearance_colors;
-	EQ2_Color color;
-	color.red = 0;
-	color.green = 0;
-	color.blue = 0;
-	string type;
-	MYSQL_RES* result = 0;
-	if(!client)
-		result = query.RunQuery2(Q_SELECT, "SELECT distinct `type` FROM npc_appearance where length(type) > 0");
-	else
-		result = query.RunQuery2(Q_SELECT, "SELECT distinct `type` FROM char_colors where length(type) > 0 and char_id=%u", client->GetCharacterID());
-	while(result && (row = mysql_fetch_row(result))){
-		type = string(row[0]);
-		appearance_types[type] = GetAppearanceType(type);
-		if(appearance_types[type] == 255)
-			LogWrite(WORLD__ERROR, 0, "Appearance", "Unknown appearance type '%s' in LoadAppearances.", type.c_str());
-	}
-
-	MYSQL_RES* result2 = 0;
-	if(!client)
-		result2 = query2.RunQuery2(Q_SELECT, "SELECT `type`, spawn_id, signed_value, red, green, blue FROM npc_appearance where length(type) > 0 ORDER BY spawn_id");
-	else
-		result2 = query2.RunQuery2(Q_SELECT, "SELECT `type`, char_id, signed_value, red, green, blue FROM char_colors where length(type) > 0 and char_id=%u", client->GetCharacterID());
-	while(result2 && (row = mysql_fetch_row(result2))){
-		if(!client){
-			new_spawn_id = atoul(row[1]);
-			if(spawn_id != new_spawn_id){
-				entity = zone->GetNPC(new_spawn_id, true);
-				if(!entity)
-					continue;
-				if(spawn_id > 0)
-					count++;
-				spawn_id = new_spawn_id;
-			}
-		}
-		if(appearance_types[row[0]] < APPEARANCE_SOGA_EBT){ 
-			color.red = atoi(row[3]);
-			color.green = atoi(row[4]);
-			color.blue = atoi(row[5]);
-		}
-		switch(appearance_types[row[0]]){
-			case APPEARANCE_SOGA_HFHC:{
-				entity->features.soga_hair_face_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HTHC:{
-				entity->features.soga_hair_type_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HFC:{
-				entity->features.soga_hair_face_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HTC:{
-				entity->features.soga_hair_type_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HH:{
-				entity->features.soga_hair_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HC1:{
-				entity->features.soga_hair_color1 = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HC2:{
-				entity->features.soga_hair_color2 = color;
-				break;
-			}
-			case APPEARANCE_SOGA_SC:{
-				entity->features.soga_skin_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_EC:{
-				entity->features.soga_eye_color = color;
-				break;
-			}
-			case APPEARANCE_HTHC:{
-				entity->features.hair_type_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_HFHC:{
-				entity->features.hair_face_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_HTC:{
-				entity->features.hair_type_color = color;
-				break;
-				}
-			case APPEARANCE_HFC:{
-				entity->features.hair_face_color = color;
-				break;
-				}
-			case APPEARANCE_HH:{
-				entity->features.hair_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_HC1:{
-				entity->features.hair_color1 = color;
-				break;
-				}
-			case APPEARANCE_HC2:{
-				entity->features.hair_color2 = color;
-				break;
-				}
-			case APPEARANCE_WC1:{
-				entity->features.wing_color1 = color;
-				break;
-				}
-			case APPEARANCE_WC2:{
-				entity->features.wing_color2 = color;
-				break;
-				}
-			case APPEARANCE_SC:{
-				entity->features.skin_color = color;
-				break;
-			}
-			case APPEARANCE_EC:{
-				entity->features.eye_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_EBT:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_eye_brow_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_SOGA_CHEEKT:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_cheek_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_SOGA_NT:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_nose_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_SOGA_CHINT:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_chin_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_SOGA_LT:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_lip_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_SOGA_EART:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_ear_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_SOGA_EYET:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_eye_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_EBT:{
-				for(int i=0;i<3;i++)
-					entity->features.eye_brow_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_CHEEKT:{
-				for(int i=0;i<3;i++)
-					entity->features.cheek_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_NT:{
-				for(int i=0;i<3;i++)
-					entity->features.nose_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_CHINT:{
-				for(int i=0;i<3;i++)
-					entity->features.chin_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_EART:{
-				for(int i=0;i<3;i++)
-					entity->features.ear_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_EYET:{
-				for(int i=0;i<3;i++)
-					entity->features.eye_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_LT:{
-				for(int i=0;i<3;i++)
-					entity->features.lip_type[i] = atoi(row[3+i]);
-				break;
-			}
-			case APPEARANCE_SHIRT:{
-				entity->features.shirt_color = color;
-				break;
-			}
-			case APPEARANCE_UCC:{
-				break;
-			}
-			case APPEARANCE_PANTS:{
-				entity->features.pants_color = color;
-				break;
-			}
-			case APPEARANCE_ULC:{
-				break;
-			}
-			case APPEARANCE_U9:{
-				break;
-			}
-			case APPEARANCE_BODY_SIZE:{
-				entity->features.body_size = color.red;
-				break;
-			}
-			case APPEARANCE_SOGA_WC1:{
-				break;
-			}
-			case APPEARANCE_SOGA_WC2:{
-				break;
-			}
-			case APPEARANCE_SOGA_SHIRT:{				
-				break;
-			}
-			case APPEARANCE_SOGA_UCC:{
-				break;
-			}
-			case APPEARANCE_SOGA_PANTS:{
-				break;
-			}
-			case APPEARANCE_SOGA_ULC:{
-				break;
-			}
-			case APPEARANCE_SOGA_U13:{
-				break;
-			}
-			case APPEARANCE_BODY_AGE: {
-				entity->features.body_age = color.red;
-				break;
-			}
-			case APPEARANCE_MC:{
-				entity->features.model_color = color;
-				break;
-			}
-			case APPEARANCE_SMC:{
-				entity->features.soga_model_color = color;
-				break;
-			}
-			case APPEARANCE_SBS: {
-				entity->features.soga_body_size = color.red;
-				break;
-			}
-			case APPEARANCE_SBA: {
-				entity->features.soga_body_age = color.red;
-				break;
-			}
-		}
-		entity->info_changed = true;
-	}
-	return count;
-}
-
-void WorldDatabase::LoadNPCs(ZoneServer* zone){
-	Query query;
-	MYSQL_ROW row;
-	NPC* npc = 0;
-	int32 id = 0;
-	int32 total = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT,"SELECT npc.spawn_id, s.name, npc.min_level, npc.max_level, npc.enc_level, s.race, s.model_type, npc.class_, npc.gender, s.command_primary, s.command_secondary, s.show_name, npc.min_group_size, npc.max_group_size, npc.hair_type_id, npc.facial_hair_type_id, npc.wing_type_id, npc.chest_type_id, npc.legs_type_id, npc.soga_hair_type_id, npc.soga_facial_hair_type_id, s.attackable, s.show_level, s.targetable, s.show_command_icon, s.display_hand_icon, s.hp, s.power, s.size, s.collision_radius, npc.action_state, s.visual_state, npc.mood_state, npc.initial_state, npc.activity_status, s.faction_id, s.sub_title, s.merchant_id, s.merchant_type, s.size_offset, npc.attack_type, npc.ai_strategy+0, npc.spell_list_id, npc.secondary_spell_list_id, npc.skill_list_id, npc.secondary_skill_list_id, npc.equipment_list_id, npc.str, npc.sta, npc.wis, npc.intel, npc.agi, npc.heat, npc.cold, npc.magic, npc.mental, npc.divine, npc.disease, npc.poison, npc.aggro_radius, npc.cast_percentage, npc.randomize, npc.soga_model_type, npc.heroic_flag, npc.alignment, npc.elemental, npc.arcane, npc.noxious, s.savagery, s.dissonance, npc.hide_hood, npc.emote_state, s.prefix, s.suffix, s.last_name, s.expansion_flag, s.holiday_flag, s.disable_sounds, s.merchant_min_level, s.merchant_max_level, s.aaxp_rewards, npc.water_type, npc.flying_type, s.loot_tier\n"
-													"FROM spawn s\n"
-													"INNER JOIN spawn_npcs npc\n"
-													"ON s.id = npc.spawn_id\n"
-													"INNER JOIN spawn_location_entry le\n"
-													"ON npc.spawn_id = le.spawn_id\n"
-													"INNER JOIN spawn_location_placement lp\n"
-													"ON le.spawn_location_id = lp.spawn_location_id\n"
-													"WHERE lp.zone_id = %u and (lp.instance_id = 0 or lp.instance_id = %u)\n"
-													"GROUP BY s.id",
-													zone->GetZoneID(), zone->GetInstanceID());
-	while(result && (row = mysql_fetch_row(result))){
-		/*npc->SetAppearanceID(atoi(row[12]));
-		AppearanceData* appearance = world.GetNPCAppearance(npc->GetAppearanceID());
-		if(appearance)
-		memcpy(&npc->appearance, appearance, sizeof(AppearanceData));
-		*/
-		int32 npcXpackFlag = atoul(row[75]);
-		int32 npcHolidayFlag = atoul(row[76]);
-
-		id = atoul(row[0]);
-		if(zone->GetNPC(id, true))
-			continue;
-		npc = new NPC();
-		
-		if (!CheckExpansionFlags(zone, npcXpackFlag) || !CheckHolidayFlags(zone, npcHolidayFlag))
-			npc->SetOmittedByDBFlag(true);
-
-		npc->SetDatabaseID(id);
-		strcpy(npc->appearance.name, row[1]);
-		vector<EntityCommand*>* primary_command_list = zone->GetEntityCommandList(atoul(row[9]));
-		vector<EntityCommand*>* secondary_command_list = zone->GetEntityCommandList(atoul(row[10]));
-		if(primary_command_list){
-			npc->SetPrimaryCommands(primary_command_list);
-			npc->primary_command_list_id = atoul(row[9]);
-		}
-		if(secondary_command_list){
-			npc->SetSecondaryCommands(secondary_command_list);
-			npc->secondary_command_list_id = atoul(row[10]);
-		}
-		npc->appearance.min_level = atoi(row[2]);
-		npc->appearance.max_level = atoi(row[3]);
-		npc->appearance.level =		atoi(row[2]);
-		npc->appearance.encounter_level = atoi(row[4]);
-		npc->appearance.race = atoi(row[5]);
-		//npc->appearance.lua_race_id = atoi(row[75]);
-		//devn00b: this never gets used..and is set correctly below...removing.
-		/*if (atoi(row[74]) > 0) {
-			int16 xxx = atoi(row[75]);
-			int8 yyy = 0;
-		}*/
-		npc->appearance.model_type = atoi(row[6]);
-		npc->appearance.soga_model_type = atoi(row[62]);
-		npc->appearance.adventure_class = atoi(row[7]);
-		npc->appearance.gender = atoi(row[8]);
-		npc->appearance.display_name = atoi(row[11]);
-		npc->features.hair_type = atoi(row[14]);
-		npc->features.hair_face_type = atoi(row[15]);
-		npc->features.wing_type = atoi(row[16]);
-		npc->features.chest_type = atoi(row[17]);
-		npc->features.legs_type = atoi(row[18]);
-		npc->features.soga_hair_type = atoi(row[19]);
-		npc->features.soga_hair_face_type = atoi(row[20]);
-		npc->appearance.attackable = atoi(row[21]);
-		npc->appearance.show_level = atoi(row[22]);
-		npc->appearance.targetable = atoi(row[23]);
-		npc->appearance.show_command_icon = atoi(row[24]);
-		npc->appearance.display_hand_icon = atoi(row[25]);
-		npc->appearance.hide_hood = atoi(row[70]);
-		npc->appearance.randomize = atoi(row[61]);
-		npc->SetTotalHP(atoul(row[26]));
-		npc->SetTotalPower(atoul(row[27]));
-		npc->SetHP(npc->GetTotalHP());
-		npc->SetPower(npc->GetTotalPower());
-		if(npc->GetTotalHP() == 0){
-			npc->SetTotalHP(15*npc->GetLevel() + 1);
-			npc->SetHP(15*npc->GetLevel() + 1);
-		}
-		if(npc->GetTotalPower() == 0){
-			npc->SetTotalPower(15*npc->GetLevel() + 1);
-			npc->SetPower(15*npc->GetLevel() + 1);
-		}
-		npc->size = atoi(row[28]);
-		npc->appearance.pos.collision_radius = atoi(row[29]);
-		npc->appearance.action_state = atoi(row[30]);
-		npc->appearance.visual_state = atoi(row[31]);
-		npc->appearance.mood_state = atoi(row[32]);
-		npc->appearance.emote_state = atoi(row[71]);
-		npc->appearance.pos.state = atoi(row[33]);
-		npc->appearance.activity_status = atoi(row[34]);
-		npc->faction_id = atoul(row[35]);
-		if(row[36]){
-			std::string sub_title = std::string(row[36]);
-			if(strncmp(row[36],"<Collector>", 11) == 0) {
-				npc->SetCollector(true);
-			}
-			if(strlen(row[36]) < sizeof(npc->appearance.sub_title))
-				strcpy(npc->appearance.sub_title, row[36]);
-			else
-				strncpy(npc->appearance.sub_title, row[36], sizeof(npc->appearance.sub_title));
-		}
-		npc->SetMerchantID(atoul(row[37]));
-		npc->SetMerchantType(atoi(row[38]));
-		npc->SetSizeOffset(atoi(row[39]));
-		npc->SetAttackType(atoi(row[40]));
-		npc->SetAIStrategy(atoi(row[41]));
-		npc->SetPrimarySpellList(atoul(row[42]));
-		npc->SetSecondarySpellList(atoul(row[43]));
-		npc->SetPrimarySkillList(atoul(row[44]));
-		npc->SetSecondarySkillList(atoul(row[45]));
-		npc->SetEquipmentListID(atoul(row[46]));
-
-		InfoStruct* info = npc->GetInfoStruct();
-		info->set_str_base(atoi(row[47]));
-		info->set_sta_base(atoi(row[48]));
-		info->set_wis_base(atoi(row[49]));		
-		info->set_intel_base(atoi(row[50]));
-		info->set_agi_base(atoi(row[51]));
-		info->set_heat_base(atoi(row[52]));
-		info->set_cold_base(atoi(row[53]));
-		info->set_magic_base(atoi(row[54]));
-		info->set_mental_base(atoi(row[55]));
-		info->set_divine_base(atoi(row[56]));
-		info->set_disease_base(atoi(row[57]));
-		info->set_poison_base(atoi(row[58]));
-		info->set_alignment(atoi(row[64]));
-
-		npc->SetAggroRadius(atof(row[59]));
-		npc->SetCastPercentage(atoi(row[60]));
-		npc->appearance.heroic_flag = atoi(row[63]);
-
-		info->set_elemental_base(atoi(row[65]));
-		info->set_arcane_base(atoi(row[66]));
-		info->set_noxious_base(atoi(row[67]));
-		npc->SetTotalSavagery(atoul(row[68]));
-		npc->SetTotalDissonance(atoul(row[69]));
-		npc->SetSavagery(npc->GetTotalSavagery());
-		npc->SetDissonance(npc->GetTotalDissonance());
-		if(npc->GetTotalSavagery() == 0){
-			npc->SetTotalSavagery(15*npc->GetLevel() + 1);
-			npc->SetSavagery(15*npc->GetLevel() + 1);
-		}
-		if(npc->GetTotalDissonance() == 0){
-			npc->SetTotalDissonance(15*npc->GetLevel() + 1);
-			npc->SetDissonance(15*npc->GetLevel() + 1);
-		}
-		npc->SetPrefixTitle(row[72]);
-		npc->SetSuffixTitle(row[73]);
-		npc->SetLastName(row[74]);
-
-		// xpack+holiday value handled at top at position 75+76
-
-		int8 disableSounds = atoul(row[77]);
-		npc->SetSoundsDisabled(disableSounds);
-
-		npc->SetMerchantLevelRange(atoul(row[78]), atoul(row[79]));
-		
-		npc->SetAAXPRewards(atoul(row[80]));
-
-		info->set_water_type(atoul(row[81]));
-		info->set_flying_type(atoul(row[82]));
-
-		npc->SetLootTier(atoul(row[83]));
-		
-		zone->AddNPC(id, npc);
-		total++;
-		LogWrite(NPC__DEBUG, 5, "NPC", "---Loading NPC: '%s' (%u)", npc->appearance.name, id);
-	}
-	LogWrite(NPC__INFO, 0, "NPC", "--Loaded %i NPC(s).", total);
-	LogWrite(NPC__INFO, 0, "NPC", "--Loaded %i NPC Spell(s).", LoadNPCSpells(zone));
-	LogWrite(NPC__INFO, 0, "NPC", "--Loaded %i NPC Skill(s).", LoadNPCSkills(zone));
-	LogWrite(NPC__INFO, 0, "NPC", "--Loaded %i NPC Equipment Piece(s).", LoadNPCEquipment(zone));
-	LogWrite(NPC__INFO, 0, "NPC", "--Loaded %i NPC Appearance(s).", LoadAppearances(zone));	
-	LogWrite(NPC__INFO, 0, "NPC", "--Loaded %i NPC Equipment Appearance(s).", LoadNPCAppearanceEquipmentData(zone));	
-}
-
-
-void WorldDatabase::LoadSpiritShards(ZoneServer* zone){
-	Query query;
-	MYSQL_ROW row;
-	int32 id = 0;
-	int32 total = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT,"SELECT timestamp, name, level, race, gender, adventure_class, model_type, soga_model_type, hair_type, hair_face_type, wing_type, chest_type, legs_type, soga_hair_type, soga_hair_face_type, hide_hood, size, collision_radius, action_state, visual_state, mood_state, emote_state, pos_state, activity_status, sub_title, prefix_title, suffix_title, lastname, x, y, z, heading, gridid, id, charid\n"
-													"FROM character_spirit_shards\n"
-													"WHERE zoneid = %u and (instanceid = 0 or instanceid = %u)",
-													zone->GetZoneID(), zone->GetInstanceID());
-	while(result && (row = mysql_fetch_row(result))){
-		/*npc->SetAppearanceID(atoi(row[12]));
-		AppearanceData* appearance = world.GetNPCAppearance(npc->GetAppearanceID());
-		if(appearance)
-		memcpy(&npc->appearance, appearance, sizeof(AppearanceData));
-		*/
-		sint64 timestamp = 0;
-#ifdef WIN32
-			timestamp = _strtoui64(row[0], NULL, 10);
-#else
-			timestamp = strtoull(row[0], 0, 10);
-#endif
-		
-		if(!row[1])
-			continue;
-
-		NPC* shard = new NPC();
-		
-		shard->SetShardCreatedTimestamp(timestamp);
-		strcpy(shard->appearance.name, row[1]);
-
-		shard->appearance.level =	atoul(row[2]);
-		shard->appearance.race = atoul(row[3]);
-		shard->appearance.gender = atoul(row[4]);
-		shard->appearance.adventure_class = atoul(row[5]);
-		 
-		//shard->appearance.lua_race_id = result.GetInt16(74);
-		shard->appearance.model_type = atoul(row[6]);
-		shard->appearance.soga_model_type = atoul(row[7]);
-		shard->appearance.display_name = 1;
-		shard->features.hair_type = atoul(row[8]);
-		shard->features.hair_face_type = atoul(row[9]);
-		shard->features.wing_type = atoul(row[10]);
-		shard->features.chest_type = atoul(row[11]);
-		shard->features.legs_type = atoul(row[12]);
-		shard->features.soga_hair_type = atoul(row[13]);
-		shard->features.soga_hair_face_type = atoul(row[14]);
-		shard->appearance.attackable = 0;
-		shard->appearance.show_level = 1;
-		shard->appearance.targetable = 1;
-		shard->appearance.show_command_icon = 1;
-		shard->appearance.display_hand_icon = 0;
-		shard->appearance.hide_hood = atoul(row[15]);
-		shard->size = atoul(row[16]);
-		shard->appearance.pos.collision_radius = atoul(row[17]);
-		shard->appearance.action_state = atoul(row[18]);
-		shard->appearance.visual_state = atoul(row[19]); // ghostly look
-		shard->appearance.mood_state = atoul(row[20]);
-		shard->appearance.emote_state = atoul(row[21]);
-		shard->appearance.pos.state = atoul(row[22]);
-		shard->appearance.activity_status = atoul(row[23]);
-
-		if(row[24])
-			strncpy(shard->appearance.sub_title, row[24], sizeof(shard->appearance.sub_title));
-
-		if(row[25])
-			shard->SetPrefixTitle(row[25]);
-
-		if(row[26])
-			shard->SetSuffixTitle(row[26]);
-
-		if(row[27])
-			shard->SetLastName(row[27]);
-
-		shard->SetX(atof(row[28]));
-		shard->SetY(atof(row[29]));
-		shard->SetZ(atof(row[30]));
-		shard->SetHeading(atof(row[31]));
-		shard->SetSpawnOrigX(shard->GetX());
-		shard->SetSpawnOrigY(shard->GetY());
-		shard->SetSpawnOrigZ(shard->GetZ());
-		shard->SetSpawnOrigHeading(shard->GetHeading());
-		shard->appearance.pos.grid_id = atoul(row[32]);
-		shard->SetShardID(atoul(row[33]));
-		shard->SetShardCharID(atoul(row[34]));
-
-		const char* script = rule_manager.GetGlobalRule(R_Combat, SpiritShardSpawnScript)->GetString();
-
-		if(script)
-		{
-			shard->SetSpawnScript(script);
-			zone->CallSpawnScript(shard, SPAWN_SCRIPT_PRESPAWN);
-		}
-		
-		zone->AddSpawn(shard);
-
-		if(script)
-			zone->CallSpawnScript(shard, SPAWN_SCRIPT_SPAWN);
-		
-		total++;
-		LogWrite(NPC__DEBUG, 5, "NPC", "---Loading Player Spirit Shard: '%s' (%u)", shard->appearance.name, id);
-	}
-	LogWrite(NPC__INFO, 0, "NPC", "--Loaded %i Spirit Shard(s).", total);
-}
-
-void WorldDatabase::LoadSigns(ZoneServer* zone){
-	Query query;
-	MYSQL_ROW row;
-	Sign* sign = 0;
-	int32 id = 0;
-	int32 total = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT ss.spawn_id, s.name, s.model_type, s.size, s.show_command_icon, ss.widget_id, ss.widget_x, ss.widget_y, ss.widget_z, s.command_primary, s.command_secondary, s.collision_radius, ss.icon, ss.type, ss.title, ss.description, ss.sign_distance, ss.zone_id, ss.zone_x, ss.zone_y, ss.zone_z, ss.zone_heading, ss.include_heading, ss.include_location, s.transport_id, s.size_offset, s.display_hand_icon, s.visual_state, s.expansion_flag, s.holiday_flag, s.disable_sounds, s.merchant_min_level, s.merchant_max_level, s.aaxp_rewards, s.loot_tier\n"
-												  "FROM spawn s\n"
-												  "INNER JOIN spawn_signs ss\n"
-												  "ON s.id = ss.spawn_id\n"
-												  "INNER JOIN spawn_location_entry le\n"
-												  "ON ss.spawn_id = le.spawn_id\n"
-												  "INNER JOIN spawn_location_placement lp\n"
-												  "ON le.spawn_location_id = lp.spawn_location_id\n"
-												  "WHERE lp.zone_id = %u\n"
-												  "GROUP BY s.id",
-												  zone->GetZoneID());
-
-	while(result && (row = mysql_fetch_row(result))){
-		int32 signXpackFlag = atoul(row[28]);
-		int32 signHolidayFlag = atoul(row[29]);
-
-		id = atoul(row[0]);
-		if(zone->GetSign(id, true))
-			continue;
-		sign = new Sign();
-		
-		if (!CheckExpansionFlags(zone, signXpackFlag) || !CheckHolidayFlags(zone, signHolidayFlag))
-			sign->SetOmittedByDBFlag(true);
-
-		sign->SetDatabaseID(id);
-		strcpy(sign->appearance.name, row[1]);
-		sign->appearance.model_type = atoi(row[2]);
-		sign->SetSize(atoi(row[3]));
-		sign->appearance.show_command_icon = atoi(row[4]);
-		sign->SetWidgetID(atoul(row[5]));
-		sign->SetWidgetX(atof(row[6]));
-		sign->SetWidgetY(atof(row[7]));
-		sign->SetWidgetZ(atof(row[8]));
-		vector<EntityCommand*>* primary_command_list = zone->GetEntityCommandList(atoul(row[9]));
-		if(primary_command_list){
-			sign->SetPrimaryCommands(primary_command_list);
-			sign->primary_command_list_id = atoul(row[9]);
-		}
-
-		vector<EntityCommand*>* secondary_command_list = zone->GetEntityCommandList(atoul(row[10]));
-		if (secondary_command_list){
-			sign->SetSecondaryCommands(secondary_command_list);
-			sign->secondary_command_list_id = atoul(row[10]);
-		}
-
-		sign->appearance.pos.collision_radius = atoi(row[11]);
-		sign->SetSignIcon(atoi(row[12]));
-		if(strncasecmp(row[13],"Generic", 7) == 0)
-			sign->SetSignType(SIGN_TYPE_GENERIC);
-		else if(strncasecmp(row[13],"Zone", 4) == 0)
-			sign->SetSignType(SIGN_TYPE_ZONE);
-		sign->SetSignTitle(row[14]);
-		sign->SetSignDescription(row[15]);
-		sign->SetSignDistance(atof(row[16]));
-		sign->SetSignZoneID(atoul(row[17]));
-		sign->SetSignZoneX(atof(row[18]));
-		sign->SetSignZoneY(atof(row[19]));
-		sign->SetSignZoneZ(atof(row[20]));
-		sign->SetSignZoneHeading(atof(row[21]));
-		sign->SetIncludeHeading(atoi(row[22]) == 1);
-		sign->SetIncludeLocation(atoi(row[23]) == 1);
-		sign->SetTransporterID(atoul(row[24]));
-		sign->SetSizeOffset(atoi(row[25]));
-		sign->appearance.display_hand_icon = atoi(row[26]);
-		sign->SetVisualState(atoi(row[27]));
-
-		// xpack+holiday value handled at top at position 28+29
-
-		int8 disableSounds = atoul(row[30]);
-		sign->SetSoundsDisabled(disableSounds);
-
-		sign->SetMerchantLevelRange(atoul(row[31]), atoul(row[32]));
-		
-		sign->SetAAXPRewards(atoul(row[33]));
-
-		sign->SetLootTier(atoul(row[34]));
-
-		zone->AddSign(id, sign);
-		total++;
-
-		LogWrite(SIGN__DEBUG, 5, "Sign", "---Loading Sign: '%s' (%u).", sign->appearance.name, id);
-
-	}
-	LogWrite(SIGN__DEBUG, 0, "Sign", "--Loaded %i Sign(s)", total);
-}
-
-void WorldDatabase::LoadWidgets(ZoneServer* zone){
-	Query query;
-	MYSQL_ROW row;
-	Widget* widget = 0;
-	int32 id = 0;
-	int32 total = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT sw.spawn_id, s.name, s.model_type, s.size, s.show_command_icon, sw.widget_id, sw.widget_x, sw.widget_y, sw.widget_z, s.command_primary, s.command_secondary, s.collision_radius, sw.include_heading, sw.include_location, sw.icon, sw.type, sw.open_heading, sw.open_y, sw.action_spawn_id, sw.open_sound_file, sw.close_sound_file, sw.open_duration, sw.closed_heading, sw.linked_spawn_id, sw.close_y, s.transport_id, s.size_offset, sw.house_id, sw.open_x, sw.open_z, sw.close_x, sw.close_z, s.display_hand_icon, s.expansion_flag, s.holiday_flag, s.disable_sounds, s.merchant_min_level, s.merchant_max_level, s.aaxp_rewards, s.loot_tier\n"
-												  "FROM spawn s\n"
-												  "INNER JOIN spawn_widgets sw\n"
-												  "ON s.id = sw.spawn_id\n"
-												  "INNER JOIN spawn_location_entry le\n"
-												  "ON sw.spawn_id = le.spawn_id\n"
-												  "INNER JOIN spawn_location_placement lp\n"
-												  "ON le.spawn_location_id = lp.spawn_location_id\n"
-												  "WHERE lp.zone_id = %u\n"
-												  "GROUP BY s.id",
-												  zone->GetZoneID());
-	while(result && (row = mysql_fetch_row(result))){
-		int32 widgetXpackFlag = atoul(row[33]);
-		int32 widgetHolidayFlag = atoul(row[34]);
-
-		id = atoul(row[0]);
-		if(zone->GetWidget(id, true))
-			continue;
-		widget = new Widget();
-
-		if (!CheckExpansionFlags(zone, widgetXpackFlag) || !CheckHolidayFlags(zone, widgetHolidayFlag))
-			widget->SetOmittedByDBFlag(true);
-
-		widget->SetDatabaseID(id);
-		strcpy(widget->appearance.name, row[1]);
-		widget->appearance.model_type = atoi(row[2]);
-		widget->SetSize(atoi(row[3]));
-		widget->appearance.show_command_icon = atoi(row[4]);
-
-		if (row[5] == NULL)
-			widget->SetWidgetID(0xFFFFFFFF);
-		else
-			widget->SetWidgetID(atoul(row[5]));
-
-		widget->SetWidgetX(atof(row[6]));
-		widget->SetWidgetY(atof(row[7]));
-		widget->SetWidgetZ(atof(row[8]));
-		vector<EntityCommand*>* primary_command_list = zone->GetEntityCommandList(atoul(row[9]));
-		if(primary_command_list){
-			widget->SetPrimaryCommands(primary_command_list);
-			widget->primary_command_list_id = atoul(row[9]);
-		}
-
-		vector<EntityCommand*>* secondary_command_list = zone->GetEntityCommandList(atoul(row[10]));
-		if (secondary_command_list) {
-			widget->SetSecondaryCommands(secondary_command_list);
-			widget->secondary_command_list_id = atoul(row[10]);
-		}
-
-		widget->appearance.pos.collision_radius = atoi(row[11]);
-		widget->SetIncludeHeading(atoi(row[12]) == 1);
-		widget->SetIncludeLocation(atoi(row[13]) == 1);
-		widget->SetWidgetIcon(atoi(row[14]));
-		if (strncasecmp(row[15], "Generic", 7) == 0)
-			widget->SetWidgetType(WIDGET_TYPE_GENERIC);
-		else if (strncasecmp(row[15], "Door", 4) == 0)
-			widget->SetWidgetType(WIDGET_TYPE_DOOR);
-		else if (strncasecmp(row[15], "Lift", 4) == 0)
-			widget->SetWidgetType(WIDGET_TYPE_LIFT);
-
-		widget->SetOpenHeading(atof(row[16]));
-		widget->SetOpenY(atof(row[17]));
-		widget->SetActionSpawnID(atoul(row[18]));
-		if(row[19] && strlen(row[19]) > 5)
-			widget->SetOpenSound(row[19]);
-		if(row[20] && strlen(row[20]) > 5)
-			widget->SetCloseSound(row[20]);
-		widget->SetOpenDuration(atoi(row[21]));
-		widget->SetClosedHeading(atof(row[22]));
-		widget->SetLinkedSpawnID(atoul(row[23]));
-		widget->SetCloseY(atof(row[24]));
-		widget->SetTransporterID(atoul(row[25]));
-		widget->SetSizeOffset(atoi(row[26]));
-		widget->SetHouseID(atoul(row[27]));
-		widget->SetOpenX(atof(row[28]));
-		widget->SetOpenZ(atof(row[29]));
-		widget->SetCloseX(atof(row[30]));
-		widget->SetCloseZ(atof(row[31]));
-		widget->appearance.display_hand_icon = atoi(row[32]);
-
-		// xpack+holiday value handled at top at position 33+34
-
-		int8 disableSounds = atoul(row[35]);
-		widget->SetSoundsDisabled(disableSounds);
-
-		widget->SetMerchantLevelRange(atoul(row[36]), atoul(row[37]));
-		
-		widget->SetAAXPRewards(atoul(row[38]));
-
-		widget->SetLootTier(atoul(row[39]));
-
-		zone->AddWidget(id, widget);
-		total++;
-
-		LogWrite(WIDGET__DEBUG, 5, "Widget", "---Loading Widget: '%s' (%u).", widget->appearance.name, id);
-
-	}
-	LogWrite(WIDGET__DEBUG, 0, "Widget", "--Loaded %i Widget(s)", total);
-}
-
-void WorldDatabase::LoadObjects(ZoneServer* zone){
-	Query query;
-	MYSQL_ROW row;
-	Object* object = 0;
-	int32 id = 0;
-	int32 total = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT so.spawn_id, s.name, s.race, s.model_type, s.command_primary, s.command_secondary, s.targetable, s.size, s.show_name, s.visual_state, s.attackable, s.show_level, s.show_command_icon, s.display_hand_icon, s.faction_id, s.collision_radius, s.transport_id, s.size_offset, so.device_id, s.expansion_flag, s.holiday_flag, s.disable_sounds, s.merchant_min_level, s.merchant_max_level, s.aaxp_rewards, s.loot_tier\n"
-												  "FROM spawn s\n"
-												  "INNER JOIN spawn_objects so\n"
-												  "ON s.id = so.spawn_id\n"
-												  "INNER JOIN spawn_location_entry le\n"
-												  "ON so.spawn_id = le.spawn_id\n"
-												  "INNER JOIN spawn_location_placement lp\n"
-												  "ON le.spawn_location_id = lp.spawn_location_id\n"
-												  "WHERE lp.zone_id = %u and (lp.instance_id = 0 or lp.instance_id = %u)\n"
-												  "GROUP BY s.id",
-												  zone->GetZoneID(), zone->GetInstanceID());
-
-	while(result && (row = mysql_fetch_row(result))){
-
-		int32 objXpackFlag = atoul(row[19]);
-		int32 objHolidayFlag = atoul(row[20]);
-
-		id = atoul(row[0]);
-		if(zone->GetObject(id, true))
-			continue;
-		object = new Object();
-		
-		if (!CheckExpansionFlags(zone, objXpackFlag) || !CheckHolidayFlags(zone, objHolidayFlag))
-			object->SetOmittedByDBFlag(true);
-
-		object->SetDatabaseID(id);
-		strcpy(object->appearance.name, row[1]);
-		vector<EntityCommand*>* primary_command_list = zone->GetEntityCommandList(atoul(row[4]));
-		vector<EntityCommand*>* secondary_command_list = zone->GetEntityCommandList(atoul(row[5]));
-		if(primary_command_list){
-			object->SetPrimaryCommands(primary_command_list);
-			object->primary_command_list_id = atoul(row[4]);
-		}
-		if(secondary_command_list){
-			object->SetSecondaryCommands(secondary_command_list);
-			object->secondary_command_list_id = atoul(row[5]);
-		}
-		object->appearance.race = atoi(row[2]);
-		object->appearance.model_type = atoi(row[3]);
-		object->appearance.targetable = atoi(row[6]);
-		object->size = atoi(row[7]);
-		object->appearance.display_name = atoi(row[8]);
-		object->appearance.visual_state = atoi(row[9]);
-		object->appearance.attackable = atoi(row[10]);
-		object->appearance.show_level = atoi(row[11]);
-		object->appearance.show_command_icon = atoi(row[12]);
-		object->appearance.display_hand_icon = atoi(row[13]);
-		object->faction_id = atoul(row[14]);
-		object->appearance.pos.collision_radius = atoi(row[15]);
-		object->SetTransporterID(atoul(row[16]));
-		object->SetSizeOffset(atoi(row[17]));
-		object->SetDeviceID(atoi(row[18]));
-
-		// xpack value handled at top at position 19
-
-		int8 disableSounds = atoul(row[21]);
-		object->SetSoundsDisabled(disableSounds);
-
-		object->SetMerchantLevelRange(atoul(row[22]), atoul(row[23]));
-
-		object->SetAAXPRewards(atoul(row[24]));
-
-		object->SetLootTier(atoul(row[25]));
-
-		zone->AddObject(id, object);
-		total++;
-
-		LogWrite(OBJECT__DEBUG, 5, "Object", "---Loading Object: '%s' (%u)", object->appearance.name, id);
-
-	}
-	LogWrite(OBJECT__DEBUG, 0, "Object", "--Loaded %i Object(s)", total);
-}
-
-void WorldDatabase::LoadGroundSpawns(ZoneServer* zone){
-	Query query;
-	MYSQL_ROW row;
-	GroundSpawn* spawn = 0;
-	int32 id = 0;
-	int32 total = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT sg.spawn_id, s.name, s.race, s.model_type, s.command_primary, s.command_secondary, s.targetable, s.size, s.show_name, s.visual_state, s.attackable, s.show_level, s.show_command_icon, s.display_hand_icon, s.faction_id, s.collision_radius, sg.number_harvests, sg.num_attempts_per_harvest, sg.groundspawn_id, sg.collection_skill, s.size_offset, s.expansion_flag, s.holiday_flag, s.disable_sounds, s.aaxp_rewards, s.loot_tier\n"
-												  "FROM spawn s\n"
-												  "INNER JOIN spawn_ground sg\n"
-												  "ON s.id = sg.spawn_id\n"
-												  "INNER JOIN spawn_location_entry le\n"
-												  "ON sg.spawn_id = le.spawn_id\n"
-												  "INNER JOIN spawn_location_placement lp\n"
-												  "ON le.spawn_location_id = lp.spawn_location_id\n"
-												  "WHERE lp.zone_id = %u\n"
-												  "GROUP BY s.id",
-												  zone->GetZoneID());
-	while(result && (row = mysql_fetch_row(result))){
-
-		int32 gsXpackFlag = atoul(row[21]);
-		int32 gsHolidayFlag = atoul(row[22]);
-
-		id = atoul(row[0]);
-		if(zone->GetGroundSpawn(id, true))
-			continue;
-		spawn = new GroundSpawn();
-		
-		if (!CheckExpansionFlags(zone, gsXpackFlag) || !CheckHolidayFlags(zone, gsHolidayFlag))
-			spawn->SetOmittedByDBFlag(true);
-
-		spawn->SetDatabaseID(id);
-		spawn->forceMapCheck = true;
-
-		strcpy(spawn->appearance.name, row[1]);
-		vector<EntityCommand*>* primary_command_list = zone->GetEntityCommandList(atoul(row[4]));
-		vector<EntityCommand*>* secondary_command_list = zone->GetEntityCommandList(atoul(row[5]));
-		if(primary_command_list){
-			spawn->SetPrimaryCommands(primary_command_list);
-			spawn->primary_command_list_id = atoul(row[4]);
-		}
-		if(secondary_command_list){
-			spawn->SetSecondaryCommands(secondary_command_list);
-			spawn->secondary_command_list_id = atoul(row[5]);
-		}
-		spawn->appearance.race = atoi(row[2]);
-		spawn->appearance.model_type = atoi(row[3]);
-		spawn->appearance.targetable = atoi(row[6]);
-		spawn->size = atoi(row[7]);
-		spawn->appearance.display_name = atoi(row[8]);
-		spawn->appearance.visual_state = atoi(row[9]);
-		spawn->appearance.attackable = atoi(row[10]);
-		spawn->appearance.show_level = atoi(row[11]);
-		spawn->appearance.show_command_icon = atoi(row[12]);
-		spawn->appearance.display_hand_icon = atoi(row[13]);
-		spawn->faction_id = atoul(row[14]);
-		spawn->appearance.pos.collision_radius = atoi(row[15]);
-		spawn->SetNumberHarvests(atoi(row[16]));
-		spawn->SetAttemptsPerHarvest(atoi(row[17]));
-		spawn->SetGroundSpawnEntryID(atoul(row[18]));
-		spawn->SetCollectionSkill(row[19]);
-		spawn->SetSizeOffset(atoi(row[20]));
-
-		// xpack+holiday value handled at top at position 21+22
-
-		int8 disableSounds = atoul(row[23]);
-		spawn->SetSoundsDisabled(disableSounds);
-
-		spawn->SetAAXPRewards(atoul(row[24]));
-
-		spawn->SetLootTier(atoul(row[25]));
-
-		zone->AddGroundSpawn(id, spawn);
-		total++;
-		LogWrite(GROUNDSPAWN__DEBUG, 5, "GSpawn", "---Loading GroundSpawn: '%s' (%u)", spawn->appearance.name, id);
-	}
-	LogWrite(GROUNDSPAWN__DEBUG, 0, "GSpawn", "--Loaded %i GroundSpawn(s)", total);
-}
-
-void WorldDatabase::LoadGroundSpawnItems(ZoneServer* zone) {
- 	Query query;
- 	MYSQL_ROW row;
- 	int32 total = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT groundspawn_id, item_id, is_rare, grid_id FROM groundspawn_items;");
-	while(result && (row = mysql_fetch_row(result)))
-	{
-		zone->AddGroundSpawnItem(atoul(row[0]), atoul(row[1]), atoi(row[2]), atoul(row[3]));
-		LogWrite(GROUNDSPAWN__DEBUG, 5, "GSpawn", "---Loading GroundSpawn Items: ID: %u\n", atoul(row[0]));
-		LogWrite(GROUNDSPAWN__DEBUG, 5, "GSpawn", "---item: %ul, rare: %i, grid: %ul", atoul(row[1]), atoi(row[2]), atoul(row[3]));
- 		total++;
- 	}
-	LogWrite(GROUNDSPAWN__DEBUG, 0, "GSpawn", "--Loaded %i GroundSpawn Item%s.", total, total == 1 ? "" : "s");
-}
-
-void WorldDatabase::LoadGroundSpawnEntries(ZoneServer* zone) {
- 	Query query;
- 	MYSQL_ROW row;
- 	int32 total = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT groundspawn_id, min_skill_level, min_adventure_level, bonus_table, harvest1, harvest3, harvest5, harvest_imbue, harvest_rare, harvest10, harvest_coin FROM groundspawns WHERE enabled = 1;");
-	while(result && (row = mysql_fetch_row(result)))
-	{
-		// this is getting ridonkulous...
-		LogWrite(GROUNDSPAWN__DEBUG, 5, "GSpawn", "---Loading GroundSpawn ID: %u\n" \
-			"---min_skill_level: %i, min_adventure_level: %i, bonus_table: %i\n" \
-			"---harvest1: %.2f, harvest3: %.2f, harvest5: %.2f\n" \
-			"---harvest_imbue: %.2f, harvest_rare: %.2f, harvest10: %.2f\n" \
-			"---harvest_coin: %u", atoul(row[0]), atoi(row[1]), atoi(row[2]), atoi(row[3]), atof(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), atof(row[8]), atof(row[9]), atoul(row[10]));
-
-		zone->AddGroundSpawnEntry(atoul(row[0]), atoi(row[1]), atoi(row[2]), atoi(row[3]), atof(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), atof(row[8]), atof(row[9]), atoul(row[10]));
- 		total++;
- 	}
-	LogWrite(GROUNDSPAWN__DEBUG, 0, "GSpawn", "--Loaded %i GroundSpawn Entr%s.", total, total == 1 ? "y" : "ies");
-	LoadGroundSpawnItems(zone);
-}
-
-bool WorldDatabase::LoadCharacterStats(int32 id, int32 account_id, Client* client)
-{
-	DatabaseResult result;
-
-	if( database_new.Select(&result, "SELECT * FROM character_details WHERE char_id = %i LIMIT 0, 1", id) )
-	{
-		LogWrite(PLAYER__DEBUG, 0, "Player", "Loading character_details for '%s' (char_id: %u)", client->GetPlayer()->GetName(), id);
-
-		while( result.Next() )
-		{
-			InfoStruct* info = client->GetPlayer()->GetInfoStruct();
-
-			client->GetPlayer()->SetHP(result.GetSInt32Str("hp"));
-			client->GetPlayer()->SetPower(result.GetSInt32Str("power"));
-			info->set_max_concentration(result.GetInt8Str("max_concentration"));
-			
-			if (info->get_max_concentration() == 0)
-				info->set_max_concentration(5);
-
-			info->set_attack_base(result.GetInt16Str("attack"));
-			info->set_mitigation_base(result.GetInt16Str("mitigation"));
-			info->set_avoidance_base(result.GetInt16Str("avoidance"));
-			info->set_parry_base(result.GetInt16Str("parry"));
-			info->set_deflection_base(result.GetInt16Str("deflection"));
-			info->set_block_base(result.GetInt16Str("block"));
-			info->set_str_base(result.GetInt16Str("str"));
-			info->set_sta_base(result.GetInt16Str("sta"));
-			info->set_agi_base(result.GetInt16Str("agi"));
-			info->set_wis_base(result.GetInt16Str("wis"));
-			info->set_intel_base(result.GetInt16Str("intel"));
-
-			// old resist types
-			info->set_heat_base(result.GetInt16Str("heat"));
-			info->set_cold_base(result.GetInt16Str("cold"));
-			info->set_magic_base(result.GetInt16Str("magic"));
-			info->set_mental_base(result.GetInt16Str("mental"));
-			info->set_divine_base(result.GetInt16Str("divine"));
-			info->set_disease_base(result.GetInt16Str("disease"));
-			info->set_poison_base(result.GetInt16Str("poison"));
-
-			//
-
-			info->set_coin_copper(result.GetInt32Str("coin_copper"));
-			info->set_coin_silver(result.GetInt32Str("coin_silver"));
-			info->set_coin_gold(result.GetInt32Str("coin_gold"));
-			info->set_coin_plat(result.GetInt32Str("coin_plat"));
-			info->set_pet_name(result.GetStringStr("pet_name") ? std::string(result.GetStringStr("pet_name")) : std::string(""));
-			const char* bio = result.GetStringStr("biography");
-			if(bio && strlen(bio) > 0)
-				info->set_biography(std::string(bio));
-			info->set_status_points(result.GetInt32Str("status_points"));
-			client->GetPlayer()->GetPlayerInfo()->SetBindZone(result.GetInt32Str("bind_zone_id"));
-			client->GetPlayer()->GetPlayerInfo()->SetBindX(result.GetFloatStr("bind_x"));
-			client->GetPlayer()->GetPlayerInfo()->SetBindY(result.GetFloatStr("bind_y"));
-			client->GetPlayer()->GetPlayerInfo()->SetBindZ(result.GetFloatStr("bind_z"));
-			client->GetPlayer()->GetPlayerInfo()->SetBindHeading(result.GetFloatStr("bind_heading"));
-			client->GetPlayer()->GetPlayerInfo()->SetHouseZone(result.GetInt32Str("house_zone_id"));
-			client->GetPlayer()->SetTotalHP(result.GetSInt32Str("max_hp"));
-			client->GetPlayer()->SetTotalPower(result.GetSInt32Str("max_power"));
-			client->GetPlayer()->SetAssignedAA(result.GetInt16Str("assigned_aa"));
-			client->GetPlayer()->SetUnassignedAA(result.GetInt16Str("unassigned_aa"));
-			client->GetPlayer()->SetTradeskillAA(result.GetInt16Str("tradeskill_aa"));
-			client->GetPlayer()->SetUnassignedTradeskillAA(result.GetInt16Str("unassigned_tradeskill_aa"));
-			client->GetPlayer()->SetPrestigeAA(result.GetInt16Str("prestige_aa"));
-			client->GetPlayer()->SetUnassignedPrestigeAA(result.GetInt16Str("unassigned_prestige_aa"));
-			client->GetPlayer()->SetTradeskillPrestigeAA(result.GetInt16Str("tradeskill_prestige_aa"));
-			client->GetPlayer()->SetUnassignedTradeskillPrestigeAA(result.GetInt16Str("unassigned_tradeskill_prestige_aa"));
-			info->set_xp(result.GetInt32Str("xp"));
-
-			info->set_xp_needed(result.GetInt32Str("xp_needed"));
-
-			if(info->get_xp_needed()== 0)
-				client->GetPlayer()->SetNeededXP();
-
-			info->set_xp_debt(result.GetFloatStr("xp_debt"));
-			info->set_xp_vitality(result.GetFloatStr("xp_vitality"));
-			info->set_ts_xp(result.GetInt32Str("tradeskill_xp"));
-			info->set_ts_xp_needed(result.GetInt32Str("tradeskill_xp_needed"));
-
-			if (info->get_ts_xp_needed() == 0)
-				client->GetPlayer()->SetNeededTSXP();
-
-			info->set_tradeskill_xp_vitality(result.GetFloatStr("tradeskill_xp_vitality"));
-			client->GetPlayer()->SetTotalHPBase(client->GetPlayer()->GetTotalHP());
-			client->GetPlayer()->SetTotalPowerBase(client->GetPlayer()->GetTotalPower());
-			info->set_bank_coin_copper(result.GetInt32Str("bank_copper"));
-			info->set_bank_coin_silver(result.GetInt32Str("bank_silver"));
-			info->set_bank_coin_gold(result.GetInt32Str("bank_gold"));
-			info->set_bank_coin_plat(result.GetInt32Str("bank_plat"));
-
-			client->GetPlayer()->SetCombatVoice(result.GetInt16Str("combat_voice"));
-			client->GetPlayer()->SetEmoteVoice(result.GetInt16Str("emote_voice"));
-			client->GetPlayer()->SetBiography(result.GetStringStr("biography"));
-			client->GetPlayer()->GetInfoStruct()->set_flags(result.GetInt32Str("flags"));
-			client->GetPlayer()->GetInfoStruct()->set_flags2(result.GetInt32Str("flags2"));
-			client->GetPlayer()->SetLastName(result.GetStringStr("last_name"));
-
-			// new resist types
-			info->set_elemental_base(result.GetInt16Str("elemental"));
-			info->set_arcane_base(result.GetInt16Str("arcane"));
-			info->set_noxious_base(result.GetInt16Str("noxious"));
-			// new savagery and dissonance
-			client->GetPlayer()->SetSavagery(result.GetSInt16Str("savagery"));
-			client->GetPlayer()->SetDissonance(result.GetSInt16Str("dissonance"));
-			client->GetPlayer()->SetTotalSavageryBase(client->GetPlayer()->GetTotalSavagery());
-			client->GetPlayer()->SetTotalDissonanceBase(client->GetPlayer()->GetTotalDissonance());
-		}
-
-		return true;
-	}
-	else
-	{
-		LogWrite(PLAYER__ERROR, 0, "Player", "Error loading character_details for '%s' (char_id: %u)", client->GetPlayer()->GetName(), id);
-		return false;
-	}
-}
-
-bool WorldDatabase::loadCharacter(const char* ch_name, int32 account_id, Client* client){
-	Query query, query4;
-	MYSQL_ROW row, row4;
-	int32 id = 0;
-	query.escaped_name = getEscapeString(ch_name);
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, current_zone_id, x, y, z, heading, admin_status, race, model_type, class, deity, level, gender, tradeskill_class, tradeskill_level, wing_type, hair_type, chest_type, legs_type, soga_wing_type, soga_hair_type, soga_chest_type, soga_legs_type, 0xFFFFFFFF - crc32(name), facial_hair_type, soga_facial_hair_type, instance_id, group_id, last_saved, DATEDIFF(curdate(), created_date) as accage FROM characters where name='%s' and account_id=%i AND deleted = 0", query.escaped_name, account_id);
-	// no character found
-	if ( result == NULL ) {
-		LogWrite(PLAYER__ERROR, 0, "Player", "Error loading character for '%s'", ch_name);
-		return false;
-	}
-
-	if (mysql_num_rows(result) == 1){
-		row = mysql_fetch_row(result);
-
-		id = strtoul(row[0], NULL, 0);
-		LogWrite(PLAYER__DEBUG, 0, "Player", "Loading character for '%s' (char_id: %u)", ch_name, id);
-
-		client->SetCharacterID(id);
-		client->GetPlayer()->SetCharacterID(id);
-		client->SetAccountID(account_id);
-		client->GetPlayer()->SetName(ch_name);
-		client->GetPlayer()->SetX(atof(row[2]));
-		client->GetPlayer()->SetY(atof(row[3]));
-		client->GetPlayer()->SetZ(atof(row[4]));
-		client->GetPlayer()->SetHeading(atof(row[5]));
-		client->SetAdminStatus(atoi(row[6]));
-		client->GetPlayer()->SetRace(atoi(row[7]));
-		client->GetPlayer()->SetModelType(atoi(row[8]));
-		client->GetPlayer()->SetAdventureClass(atoi(row[9]));
-		client->GetPlayer()->SetDeity(atoi(row[10]));
-		client->GetPlayer()->SetLevel(atoi(row[11]));
-		client->GetPlayer()->SetGender(atoi(row[12]));
-		client->GetPlayer()->SetTradeskillClass(atoi(row[13]));
-		client->GetPlayer()->SetTSLevel(atoi(row[14]));
-
-		LogWrite(MISC__TODO, 1, "TODO", "Fix client->GetPlayer()->SetArtLevel(atoi(row[14]));\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-
-		client->GetPlayer()->features.wing_type = atoi(row[15]);
-		client->GetPlayer()->features.hair_type = atoi(row[16]);
-		client->GetPlayer()->features.chest_type = atoi(row[17]);
-		client->GetPlayer()->features.legs_type = atoi(row[18]);
-
-		LogWrite(MISC__TODO, 1, "TODO", "Fix SOGA appearances here\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
-
-		client->GetPlayer()->features.wing_type = atoi(row[19]);
-		client->GetPlayer()->features.soga_hair_type = atoi(row[20]);
-		client->GetPlayer()->features.soga_chest_type = atoi(row[21]);
-		client->GetPlayer()->features.soga_legs_type = atoi(row[22]);
-		client->SetNameCRC(atoul(row[23]));
-		client->GetPlayer()->features.hair_face_type = atoi(row[24]);
-		client->GetPlayer()->features.soga_hair_face_type = atoi(row[25]);
-		int32 instanceid = atoi(row[26]);
-
-		int32 groupid = atoi(row[27]);
-		client->SetRejoinGroupID(groupid);
-
-		int32 zoneid = atoul(row[1]);
-/*
-JA Notes on SOGA: I think there are many more settings to add than were commented out here,
-because I can load a SOGA model player, but some features are missing (Barbarian WOAD, Skin tons, etc)
-SOGA chars looked ok in LoginServer screen tho... odd.
-*/
-
-		// load character instances here
-		if ( LoadCharacterInstances(client) )
-			client->UpdateCharacterInstances();
-
-		if ( instanceid > 0 )
-			client->SetCurrentZoneByInstanceID(instanceid, zoneid);
-		else
-			client->SetCurrentZone(zoneid);
-
-
-
-		int32 lastsavedtime = atoi(row[28]);
-		client->SetLastSavedTimeStamp(lastsavedtime);
-
-		if (row[29])
-			client->GetPlayer()->GetPlayerInfo()->SetAccountAge(atoi(row[29]));
-
-		LoadCharacterFriendsIgnoreList(client->GetPlayer());
-		MYSQL_RES* result4 = query4.RunQuery2(Q_SELECT, "SELECT `guild_id` FROM `guild_members` WHERE `char_id`=%u", id);
-		if (result4 && (row4 = mysql_fetch_row(result4))) {
-			Guild* guild = guild_list.GetGuild(atoul(row4[0]));
-			if (guild) {
-				client->GetPlayer()->SetGuild(guild);
-				string subtitle;
-				subtitle.append("<").append(guild->GetName()).append(">");
-				client->GetPlayer()->SetSubTitle(subtitle.c_str());
-			}
-		}
-
-		LoadCharacterHistory(id, client->GetPlayer());
-		LoadCharacterLUAHistory(id, client->GetPlayer());
-		LoadPlayerStatistics(client->GetPlayer(), id);
-		LoadPlayerCollections(client->GetPlayer());
-		LoadPlayerRecipes(client->GetPlayer());
-		//LoadPlayerAchievements(client->GetPlayer());
-		LoadPlayerAchievementsUpdates(client->GetPlayer());
-		LoadAppearances(client->GetCurrentZone(), client);
-		return LoadCharacterStats(id, account_id, client);
-	}
-
-	// should not be here...
-	LogWrite(PLAYER__ERROR, 0, "Player", "Error loading character for '%s'", ch_name);
-	return false;
-}
-
-bool WorldDatabase::InsertCharacterStats(int32 character_id, int8 class_id, int8 race_id){
-	Query query1;
-	Query query2;
-	Query query3;
-	Query query4;
-	Query query5;
-
-	/* Blank record */
-	query1.RunQuery2(Q_INSERT, "INSERT INTO `character_details` (`char_id`) VALUES (%u)", character_id);
-
-	/* Using the class id and race id */
-	query2.RunQuery2(Q_UPDATE, "UPDATE character_details c, starting_details s SET c.max_hp = s.max_hp, c.hp = s.max_hp, c.max_power = s.max_power, c.power = s.max_power, c.str = s.str, c.sta = s.sta, c.agi = s.agi, c.wis = s.wis, c.intel = s.intel,c.heat = s.heat, c.cold = s.cold, c.magic = s.magic, c.mental = s.mental, c.divine = s.divine, c.disease = s.disease, c.poison = s.poison, c.coin_copper = s.coin_copper, c.coin_silver = s.coin_silver, c.coin_gold = s.coin_gold, c.coin_plat = s.coin_plat, c.status_points = s.status_points WHERE s.race_id = %d AND class_id = %d AND char_id = %u", race_id, class_id, character_id);
-	if (query2.GetAffectedRows() > 0)
-		return true;
-
-	/* Using the class id and race id = 255 */
-	query3.RunQuery2(Q_UPDATE, "UPDATE character_details c, starting_details s SET c.max_hp = s.max_hp, c.hp = s.max_hp, c.max_power = s.max_power, c.power = s.max_power, c.str = s.str, c.sta = s.sta, c.agi = s.agi, c.wis = s.wis, c.intel = s.intel,c.heat = s.heat, c.cold = s.cold, c.magic = s.magic, c.mental = s.mental, c.divine = s.divine, c.disease = s.disease, c.poison = s.poison, c.coin_copper = s.coin_copper, c.coin_silver = s.coin_silver, c.coin_gold = s.coin_gold, c.coin_plat = s.coin_plat, c.status_points = s.status_points WHERE s.race_id = 255 AND class_id = %d AND char_id = %u", class_id, character_id);
-	if (query3.GetAffectedRows() > 0)
-		return true;
-
-	/* Using class id = 255 and the race id */
-	query4.RunQuery2(Q_UPDATE, "UPDATE character_details c, starting_details s SET c.max_hp = s.max_hp, c.hp = s.max_hp, c.max_power = s.max_power, c.power = s.max_power, c.str = s.str, c.sta = s.sta, c.agi = s.agi, c.wis = s.wis, c.intel = s.intel,c.heat = s.heat, c.cold = s.cold, c.magic = s.magic, c.mental = s.mental, c.divine = s.divine, c.disease = s.disease, c.poison = s.poison, c.coin_copper = s.coin_copper, c.coin_silver = s.coin_silver, c.coin_gold = s.coin_gold, c.coin_plat = s.coin_plat, c.status_points = s.status_points WHERE s.race_id = %d AND class_id = 255 AND char_id = %u", race_id, character_id);
-	if (query4.GetAffectedRows() > 0)
-		return true;
-
-	/* Using class id = 255 and race id = 255 */
-	query5.RunQuery2(Q_UPDATE, "UPDATE character_details c, starting_details s SET c.max_hp = s.max_hp, c.hp = s.max_hp, c.max_power = s.max_power, c.power = s.max_power, c.str = s.str, c.sta = s.sta, c.agi = s.agi, c.wis = s.wis, c.intel = s.intel,c.heat = s.heat, c.cold = s.cold, c.magic = s.magic, c.mental = s.mental, c.divine = s.divine, c.disease = s.disease, c.poison = s.poison, c.coin_copper = s.coin_copper, c.coin_silver = s.coin_silver, c.coin_gold = s.coin_gold, c.coin_plat = s.coin_plat, c.status_points = s.status_points WHERE s.race_id = 255 AND class_id = 255 AND char_id = %u", character_id);
-	if (query5.GetAffectedRows() > 0)
-		return true;
-
-	return false;
-}
-
-int32 WorldDatabase::GetCharacterTimeStamp(int32 character_id, int32 account_id,bool* char_exists){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT unix_timestamp FROM characters where id=%i and account_id=%i",character_id,account_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		*char_exists = true;
-		return atoi(row[0]); // Return timestamp
-	}
-	else
-		LogWrite(WORLD__ERROR, 0, "World", "Error in GetCharacterTimeStamp query '%s': %s", query.GetQuery(), query.GetError());
-
-	*char_exists = false;
-	return 0;
-}
-
-int32 WorldDatabase::GetCharacterTimeStamp(int32 character_id) {
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES *result = query.RunQuery2(Q_SELECT, "SELECT unix_timestamp FROM characters WHERE id=%u", character_id);
-	int32 ret = 0;
-
-	if (result && (row = mysql_fetch_row(result)))
-		ret = atoul(row[0]);
-
-	return ret;
-}
-
-bool WorldDatabase::UpdateCharacterTimeStamp(int32 account_id, int32 character_id, int32 timestamp_update){
-	Query query;
-	string update_charts = string("update characters set unix_timestamp=%i where id=%i and account_id=%i");
-	query.RunQuery2(Q_UPDATE, update_charts.c_str(),timestamp_update,character_id,account_id);
-	if(!query.GetAffectedRows())
-	{
-		LogWrite(WORLD__ERROR, 0, "World", "Error in UpdateCharacterTimeStamp query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-
-	return true;
-}
-
-bool WorldDatabase::insertCharacterProperty(Client* client, char* propName, char* propValue) {
-	Query query;
-
-	string update_status = string("update character_properties set propvalue='%s' where charid=%i and propname='%s'");
-	query.RunQuery2(Q_UPDATE, update_status.c_str(), propValue, client->GetCharacterID(), propName);
-	if (!query.GetAffectedRows())
-	{
-		query.RunQuery2(Q_UPDATE, "insert into character_properties (charid, propname, propvalue) values(%i, '%s', '%s')", client->GetCharacterID(), propName, propValue);
-		if (query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF) {
-			LogWrite(WORLD__ERROR, 0, "World", "Error in insertCharacterProperty query '%s': %s", query.GetQuery(), query.GetError());
-			return false;
-		}
-	}
-	return true;
-}
-
-bool WorldDatabase::loadCharacterProperties(Client* client) {
-	Query query;
-	MYSQL_ROW row;
-	int32 id = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT propname, propvalue FROM character_properties where charid = %i", client->GetCharacterID());
-	// no character found
-	if (result == NULL) {
-		LogWrite(PLAYER__ERROR, 0, "Player", "Error loading character properties for '%s'", client->GetPlayer()->GetName());
-		return false;
-	}
-
-	while (result && (row = mysql_fetch_row(result))) {
-		char* prop_name = row[0];
-		char* prop_value = row[1];
-
-		if (!prop_name || !prop_value)
-			continue;
-
-		if (!stricmp(prop_name, CHAR_PROPERTY_SPEED))
-		{
-			float new_speed = atof(prop_value);
-			client->GetPlayer()->SetSpeed(new_speed,true);
-			client->GetPlayer()->SetCharSheetChanged(true);
-		}
-		else if (!stricmp(prop_name, CHAR_PROPERTY_FLYMODE))
-		{
-			int8 flymode = atoi(prop_value);
-			if (flymode) // avoid fly mode notification unless enabled
-				ClientPacketFunctions::SendFlyMode(client, flymode, false);
-		}
-		else if (!stricmp(prop_name, CHAR_PROPERTY_INVUL))
-		{
-			int8 invul = atoi(prop_value);
-			client->GetPlayer()->SetInvulnerable(invul == 1);
-			if (client->GetPlayer()->GetInvulnerable())
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are now invulnerable!");
-		}
-		else if (!stricmp(prop_name, CHAR_PROPERTY_GMVISION))
-		{
-			int8 val = atoi(prop_value);
-			client->GetPlayer()->SetGMVision(val == 1);
-			client->GetCurrentZone()->SendAllSpawnsForVisChange(client, false);
-			if (val)
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "GM Vision Enabled!");
-		}
-		else if (!stricmp(prop_name, CHAR_PROPERTY_REGIONDEBUG))
-		{
-			int8 val = atoi(prop_value);
-			
-			client->SetRegionDebug(val == 1);
-			if (val)
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Region Debug Enabled!");
-		}
-		else if (!stricmp(prop_name, CHAR_PROPERTY_LUADEBUG))
-		{
-			int8 val = atoi(prop_value);
-			if (val)
-			{
-				client->SetLuaDebugClient(true);
-				if (lua_interface)
-					lua_interface->UpdateDebugClients(client);
-
-				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You will now receive LUA error messages.");
-			}
-		}
-		else if (!stricmp(prop_name, "mood"))
-		{
-			int16 val = atoi(prop_value);
-			if(val)
-			{
-			Player* player = client->GetPlayer();
-			InfoStruct* info = player->GetInfoStruct();
-			
-			info->set_mood(val);
-			player->SetMoodState(val, 1);
-			}
-		}
-	}
-
-	return true;
-}
-
-//gets the name FROM the db with the right letters in caps
-string WorldDatabase::GetPlayerName(char* name){
-	Query query;
-	string ret = "";
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT name FROM characters where name='%s'", getSafeEscapeString(name).c_str());
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		if(row[0])
-			ret = string(row[0]);
-	}
-	return ret;
-}
-
-int32 WorldDatabase::GetCharacterID(const char* name) {
-	int32 id = 0;
-	Query query;
-	if (name) {
-		MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `id` FROM `characters` WHERE `name`='%s'", name);
-		if (result && mysql_num_rows(result) > 0) {
-			MYSQL_ROW row;
-			row = mysql_fetch_row(result);
-			id = atoul(row[0]);
-		}
-	}
-	return id;
-}
-
-int32 WorldDatabase::GetCharacterCurrentZoneID(int32 character_id) {
-	int32 id = 0;
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `current_zone_id` FROM `characters` WHERE `id`=%u", character_id);
-	if (result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		id = atoul(row[0]);
-	}
-	return id;
-}
-
-int32 WorldDatabase::GetCharacterAccountID(int32 character_id) {
-	int32 id = 0;
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `account_id` FROM `characters` WHERE `id`=%u", character_id);
-	if (result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		id = atoul(row[0]);
-	}
-	return id;
-}
-
-sint16 WorldDatabase::GetHighestCharacterAdminStatus(int32 account_id){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT max(admin_status) FROM characters where account_id=%i ",account_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		if ( row[0] != NULL )
-			return atoi(row[0]); // Return characters status
-		else
-			return 0;
-	}
-
-	return 0;
-}
-
-sint16 WorldDatabase::GetLowestCharacterAdminStatus(int32 account_id){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT min(admin_status) FROM characters where account_id=%i ",account_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		if ( row[0] != NULL )
-			return atoi(row[0]); // Return characters status
-		else
-			return 0;
-	}
-
-	return 0;
-}
-
-sint16 WorldDatabase::GetCharacterAdminStatus(char* character_name){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT admin_status FROM characters where name='%s'", getSafeEscapeString(character_name).c_str());
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		return atoi(row[0]); // Return characters level
-	}
-	else
-		LogWrite(WORLD__ERROR, 0, "World", "Error in GetCharacterAdminStatus query '%s': %s", query.GetQuery(), query.GetError());
-
-	return -10;
-}
-
-sint16 WorldDatabase::GetCharacterAdminStatus(int32 account_id , int32 char_id){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT admin_status FROM characters where account_id=%i and id=%i",account_id,char_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		return atoi(row[0]); // Return characters status
-	}
-	else{
-		Query query2;
-		result = query2.RunQuery2(Q_SELECT, "SELECT count(id) FROM characters where account_id=%i and id=%i",account_id,char_id);
-		if(result && mysql_num_rows(result) > 0) {
-			MYSQL_ROW row;
-			row = mysql_fetch_row(result);
-			if(atoi(row[0]) == 0) //old character, needs to be deleted FROM login server
-				return -10;
-			return -8;
-		}
-		else
-			LogWrite(WORLD__ERROR, 0, "World", "Error in GetCharacterAdminStatus query '%s': %s", query.GetQuery(), query.GetError());
-	}
-	return PLAY_ERROR_PROBLEM;
-}
-
-bool WorldDatabase::UpdateAdminStatus(char* character_name, sint16 flag){
-	Query query;
-	string update_status = string("update characters set admin_status=%i where name='%s'");
-	query.RunQuery2(Q_UPDATE, update_status.c_str(),flag,character_name);
-	if(!query.GetAffectedRows())
-	{
-		LogWrite(WORLD__ERROR, 0, "World", "Error in UpdateAdminStatus query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-
-	return true;
-}
-
-void WorldDatabase::SaveCharacterFloats(int32 char_id, const char* type, float float1, float float2, float float3){
-	Query query;
-	string create_char = string("insert into char_colors (char_id, type, red, green, blue, signed_value) values(%i,'%s',%i,%i,%i, 1)");
-	query.RunQuery2(Q_INSERT, create_char.c_str(), char_id, type, (sint8)(float1*100), (sint8)(float2*100), (sint8)(float3*100));
-	if(query.GetError() && strlen(query.GetError()) > 0){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SaveCharacterFloats query '%s': %s", query.GetQuery(), query.GetError());
-	}
-}
-
-void WorldDatabase::SaveCharacterColors(int32 char_id, const char* type, EQ2_Color color){
-	Query query;
-	string create_char = string("insert into char_colors (char_id, type, red, green, blue) values(%i,'%s',%i,%i,%i)");
-	query.RunQuery2(Q_INSERT, create_char.c_str(), char_id, type, color.red, color.green, color.blue);
-	if(query.GetError() && strlen(query.GetError()) > 0){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SaveCharacterColors query '%s': %s", query.GetQuery(), query.GetError());
-	}
-}
-
-void WorldDatabase::SaveNPCAppearanceEquipment(int32 spawn_id, int8 slot_id, int16 type, int8 red, int8 green, int8 blue, int8 hred, int8 hgreen, int8 hblue){
-	Query query;
-	string appearance = string("INSERT INTO npc_appearance_equip (spawn_id, slot_id, equip_type, red, green, blue, highlight_red, highlight_green, highlight_blue) values (%i, %i, %i, %i, %i, %i, %i, %i, %i) ON DUPLICATE KEY UPDATE equip_type=%i, red=%i, green=%i, blue=%i, highlight_red=%i, highlight_green=%i, highlight_blue=%i");
-	query.RunQuery2(Q_INSERT, appearance.c_str(), spawn_id, slot_id, type, red, green, blue, hred, hgreen, hblue, type, red, green, blue, hred, hgreen, hblue);
-	if(query.GetError() && strlen(query.GetError()) > 0){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SaveNPCAppearanceEquipment query '%s': %s", query.GetQuery(), query.GetError());
-	}
-}
-
-int32 WorldDatabase::LoadNPCAppearanceEquipmentData(ZoneServer* zone){
-	Query query;
-	MYSQL_ROW row;
-
-	int32 spawn_id = 0, new_spawn_id = 0, count = 0;
-	NPC* npc = 0;
-	int8 slot = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT spawn_id, slot_id, equip_type, red, green, blue, highlight_red, highlight_green, highlight_blue FROM npc_appearance_equip ORDER BY spawn_id");
-	while(result && (row = mysql_fetch_row(result))){
-		new_spawn_id = atoul(row[0]);
-		if(new_spawn_id != spawn_id){
-			npc = zone->GetNPC(new_spawn_id, true);
-			if(!npc)
-				continue;
-			if(spawn_id > 0)
-				count++;
-			spawn_id = new_spawn_id;
-		}
-		slot = atoul(row[1]);
-		if(slot < NUM_SLOTS){
-			npc->SetEquipment(slot, atoul(row[2]), atoul(row[3]), atoul(row[4]), atoul(row[5]), atoul(row[6]), atoul(row[7]), atoul(row[8]));
-		}
-	}
-	if(query.GetError() && strlen(query.GetError()) > 0)
-		LogWrite(WORLD__ERROR, 0, "World", "Error in LoadNPCAppearanceEquipmentData query '%s': %s", query.GetQuery(), query.GetError());
-	return count;
-}
-
-int16 WorldDatabase::GetAppearanceID(string name){
-	int32 id = 0;
-	Query query;
-	MYSQL_ROW row;
-	query.escaped_name = getEscapeString(name.c_str());
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT appearance_id FROM appearances where name='%s'", query.escaped_name);
-	if(result && mysql_num_rows(result) == 1){
-		row = mysql_fetch_row(result);
-		id = atoi(row[0]);
-	}
-	return id;
-}
-
-vector<int16>* WorldDatabase::GetAppearanceIDsLikeName(string name, bool filtered) {
-	vector<int16>* ids = 0;
-	Query query;
-	MYSQL_ROW row;
-	query.escaped_name = getEscapeString(name.c_str());
-	MYSQL_RES* result;
-	if (filtered)
-		result = query.RunQuery2(Q_SELECT, "SELECT `appearance_id` FROM `appearances` WHERE `name` RLIKE '%s' AND `name` NOT RLIKE 'ghost' AND `name` NOT RLIKE 'headless' AND `name` NOT RLIKE 'elemental' AND `name` NOT RLIKE 'test' AND `name` NOT RLIKE 'zombie' AND `name` NOT RLIKE 'vampire'", query.escaped_name);
-	else
-		result = query.RunQuery2(Q_SELECT, "SELECT `appearance_id` FROM `appearances` WHERE `name` RLIKE '%s' AND `name` NOT RLIKE 'ghost' AND `name`", query.escaped_name);
-	while (result && (row = mysql_fetch_row(result))) {
-		if (!ids)
-			ids = new vector<int16>;
-		ids->push_back(atoi(row[0]));
-	}
-	return ids;
-}
-
-string WorldDatabase::GetAppearanceName(int16 appearance_id) {
-	Query query;
-	MYSQL_ROW row;
-	string name;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `name` FROM `appearances` WHERE `appearance_id`=%u", appearance_id);
-	if (result && (row = mysql_fetch_row(result)))
-		name = string(row[0]);
-	return name;
-}
-
-void WorldDatabase::UpdateRandomize(int32 spawn_id, sint32 value) {
-	Query query;
-	query.RunQuery2(Q_UPDATE, "UPDATE `spawn_npcs` SET `randomize`=`randomize` + %i WHERE `spawn_id`=%u", value, spawn_id);
-}
-
-int32 WorldDatabase::SaveCharacter(PacketStruct* create, int32 loginID){
-	Query query;
-	int8 race_id = create->getType_int8_ByName("race");
-	int8 orig_class_id = create->getType_int8_ByName("class");//Normal server
-	int8 class_id = orig_class_id;
-	if ( create->GetVersion() <= 546 ) {
-		class_id = 0; //Classic Server Only
-	}
-	
-	int8 gender_id = create->getType_int8_ByName("gender");
-	sint16 auto_admin_status = 0;
-
-	// fetch rules related to setting auto-admin status for server
-	bool auto_admin_players = rule_manager.GetGlobalRule(R_World, AutoAdminPlayers)->GetBool();
-	bool auto_admin_gm = rule_manager.GetGlobalRule(R_World, AutoAdminGMs)->GetBool();
-	
-	/* 
-		The way I think this is supposed to work :) is if any of your chars are already GM, and AutoAdminGMs rule is true,
-		set the new character's admin_status to your highest status for any character active on your loginID.
-			- If status > 0, new character > 0
-			- If status = 0, new character = 0
-			- If status < 0, new character < 0, too... even if auto_admin_gm is true
-
-		If we're not a GM (status = 0) but AutoAdminPlayers rule is true,
-		set the new character's admin_status to the default set in AutoAdminStatusValue rule.
-
-		Else, if both rules are False, set everyone to 0 like normal.
-
-	*/
-
-	auto_admin_status = GetHighestCharacterAdminStatus(loginID);
-
-	if( auto_admin_status > 0 && auto_admin_gm ) {
-		LogWrite(WORLD__WARNING, 0, "World", "New character '%s' granted GM status (%i) from accountID: %i", create->getType_EQ2_16BitString_ByName("name").data.c_str(), auto_admin_status, loginID);
-	}
-	else if( auto_admin_players )
-	{
-		auto_admin_status = rule_manager.GetGlobalRule(R_World, AutoAdminStatusValue)->GetSInt16();
-		LogWrite(WORLD__DEBUG, 0, "World", "New character '%s' granted AutoAdminPlayer status: %i", create->getType_EQ2_16BitString_ByName("name").data.c_str(), auto_admin_status);
-	}
-	else {
-		auto_admin_status = 0;
-	}
-
-	string create_char = string("Insert into characters (account_id, server_id, name, race, class, gender, deity, body_size, body_age, soga_wing_type, soga_chest_type, soga_legs_type, soga_hair_type, soga_model_type, legs_type, chest_type, wing_type, hair_type, model_type, facial_hair_type, soga_facial_hair_type, created_date, last_saved, admin_status) values(%i, %i, '%s', %i, %i, %i, %i, %f, %f, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, now(), unix_timestamp(), %i)");
-
-	query.RunQuery2(Q_INSERT, create_char.c_str(), 
-						loginID, 
-						create->getType_int32_ByName("server_id"), 
-						create->getType_EQ2_16BitString_ByName("name").data.c_str(), 
-						race_id, 
-						class_id,
-						gender_id, 
-						create->getType_int8_ByName("deity"), 
-						create->getType_float_ByName("body_size"), 
-						create->getType_float_ByName("body_age"), 
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("soga_wing_file").data),
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("soga_chest_file").data), 
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("soga_legs_file").data), 
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("soga_hair_file").data),
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("soga_race_file").data), 
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("legs_file").data), 
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("chest_file").data),
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("wing_file").data), 
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("hair_file").data), 
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("race_file").data), 
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("face_file").data), 
-						GetAppearanceID(create->getType_EQ2_16BitString_ByName("soga_face_file").data),
-						auto_admin_status);
-
-	if(query.GetError() && strlen(query.GetError()) > 0)
-	{
-		LogWrite(PLAYER__ERROR, 0, "Player", "Error in SaveCharacter query '%s': %s", query.GetQuery(), query.GetError());
-		return 0;
-	}
-
-	int32 last_insert_id = query.GetLastInsertedID();
-	int32 char_id = last_insert_id;
-	UpdateStartingFactions(char_id, create->getType_int8_ByName("starting_zone"));
-	UpdateStartingZone(char_id, class_id, race_id, create);
-	UpdateStartingItems(char_id, class_id, race_id);
-	UpdateStartingSkills(char_id, class_id, race_id);
-	UpdateStartingSpells(char_id, class_id, race_id);
-	UpdateStartingSkillbar(char_id, class_id, race_id);
-	UpdateStartingTitles(char_id, class_id, race_id, gender_id);
-	InsertCharacterStats(char_id, class_id, race_id);
-	UpdateStartingLanguage(char_id, race_id, create->getType_int8_ByName("starting_zone"));
-
-
-	AddNewPlayerToServerGuild(loginID, char_id);
-
-	SaveCharacterColors(char_id,"skin_color", create->getType_EQ2_Color_ByName("skin_color"));
-	SaveCharacterColors(char_id,"model_color", create->getType_EQ2_Color_ByName("model_color"));
-	SaveCharacterColors(char_id,"eye_color", create->getType_EQ2_Color_ByName("eye_color"));
-	SaveCharacterColors(char_id,"hair_color1", create->getType_EQ2_Color_ByName("hair_color1"));
-	SaveCharacterColors(char_id,"hair_color2", create->getType_EQ2_Color_ByName("hair_color2"));
-	SaveCharacterColors(char_id,"hair_highlight", create->getType_EQ2_Color_ByName("hair_highlight"));
-	SaveCharacterColors(char_id,"hair_type_color", create->getType_EQ2_Color_ByName("hair_type_color"));
-	SaveCharacterColors(char_id,"hair_type_highlight_color", create->getType_EQ2_Color_ByName("hair_type_highlight_color"));
-	SaveCharacterColors(char_id,"hair_face_color", create->getType_EQ2_Color_ByName("hair_face_color"));
-	SaveCharacterColors(char_id,"hair_face_highlight_color", create->getType_EQ2_Color_ByName("hair_face_highlight_color"));
-	SaveCharacterColors(char_id,"wing_color1", create->getType_EQ2_Color_ByName("wing_color1"));
-	SaveCharacterColors(char_id,"wing_color2", create->getType_EQ2_Color_ByName("wing_color2"));
-	SaveCharacterColors(char_id,"shirt_color", create->getType_EQ2_Color_ByName("shirt_color"));
-	SaveCharacterColors(char_id,"unknown_chest_color", create->getType_EQ2_Color_ByName("unknown_chest_color"));
-	SaveCharacterColors(char_id,"pants_color", create->getType_EQ2_Color_ByName("pants_color"));
-	SaveCharacterColors(char_id,"unknown_legs_color", create->getType_EQ2_Color_ByName("unknown_legs_color"));
-	SaveCharacterColors(char_id,"unknown9", create->getType_EQ2_Color_ByName("unknown9"));
-	SaveCharacterFloats(char_id,"eye_type", create->getType_float_ByName("eyes2",0), create->getType_float_ByName("eyes2",1), create->getType_float_ByName("eyes2",2));
-	SaveCharacterFloats(char_id,"ear_type", create->getType_float_ByName("ears",0), create->getType_float_ByName("ears",1), create->getType_float_ByName("ears",2));
-	SaveCharacterFloats(char_id,"eye_brow_type", create->getType_float_ByName("eye_brows",0), create->getType_float_ByName("eye_brows",1), create->getType_float_ByName("eye_brows",2));
-	SaveCharacterFloats(char_id,"cheek_type", create->getType_float_ByName("cheeks",0), create->getType_float_ByName("cheeks",1), create->getType_float_ByName("cheeks",2));
-	SaveCharacterFloats(char_id,"lip_type", create->getType_float_ByName("lips",0), create->getType_float_ByName("lips",1), create->getType_float_ByName("lips",2));
-	SaveCharacterFloats(char_id,"chin_type", create->getType_float_ByName("chin",0), create->getType_float_ByName("chin",1), create->getType_float_ByName("chin",2));
-	SaveCharacterFloats(char_id,"nose_type", create->getType_float_ByName("nose",0), create->getType_float_ByName("nose",1), create->getType_float_ByName("nose",2));
-	SaveCharacterFloats(char_id,"body_size", create->getType_float_ByName("body_size",0), 0, 0);
-
-	SaveCharacterColors(char_id,"soga_skin_color", create->getType_EQ2_Color_ByName("soga_skin_color"));
-	SaveCharacterColors(char_id,"soga_model_color", create->getType_EQ2_Color_ByName("soga_model_color"));
-	SaveCharacterColors(char_id,"soga_eye_color", create->getType_EQ2_Color_ByName("soga_eye_color"));
-	SaveCharacterColors(char_id,"soga_hair_color1", create->getType_EQ2_Color_ByName("soga_hair_color1"));
-	SaveCharacterColors(char_id,"soga_hair_color2", create->getType_EQ2_Color_ByName("soga_hair_color2"));
-	SaveCharacterColors(char_id,"soga_hair_highlight", create->getType_EQ2_Color_ByName("soga_hair_highlight"));
-	SaveCharacterColors(char_id,"soga_hair_type_color", create->getType_EQ2_Color_ByName("soga_hair_type_color"));
-	SaveCharacterColors(char_id,"soga_hair_type_highlight_color", create->getType_EQ2_Color_ByName("soga_hair_type_highlight_color"));
-	SaveCharacterColors(char_id,"soga_hair_face_color", create->getType_EQ2_Color_ByName("soga_hair_face_color"));
-	SaveCharacterColors(char_id,"soga_hair_face_highlight_color", create->getType_EQ2_Color_ByName("soga_hair_face_highlight_color"));
-	SaveCharacterColors(char_id,"soga_wing_color1", create->getType_EQ2_Color_ByName("soga_wing_color1"));
-	SaveCharacterColors(char_id,"soga_wing_color2", create->getType_EQ2_Color_ByName("soga_wing_color2"));
-	SaveCharacterColors(char_id,"soga_shirt_color", create->getType_EQ2_Color_ByName("soga_shirt_color"));
-	SaveCharacterColors(char_id,"soga_unknown_chest_color", create->getType_EQ2_Color_ByName("soga_unknown_chest_color"));
-	SaveCharacterColors(char_id,"soga_pants_color", create->getType_EQ2_Color_ByName("soga_pants_color"));
-	SaveCharacterColors(char_id,"soga_unknown_legs_color", create->getType_EQ2_Color_ByName("soga_unknown_legs_color"));
-	SaveCharacterColors(char_id,"soga_unknown13", create->getType_EQ2_Color_ByName("soga_unknown13"));
-	SaveCharacterFloats(char_id,"soga_eye_type", create->getType_float_ByName("soga_eyes2",0), create->getType_float_ByName("soga_eyes2",1), create->getType_float_ByName("soga_eyes2",2));
-	SaveCharacterFloats(char_id,"soga_ear_type", create->getType_float_ByName("soga_ears",0), create->getType_float_ByName("soga_ears",1), create->getType_float_ByName("soga_ears",2));
-	SaveCharacterFloats(char_id,"soga_eye_brow_type", create->getType_float_ByName("soga_eye_brows",0), create->getType_float_ByName("soga_eye_brows",1), create->getType_float_ByName("soga_eye_brows",2));
-	SaveCharacterFloats(char_id,"soga_cheek_type", create->getType_float_ByName("soga_cheeks",0), create->getType_float_ByName("soga_cheeks",1), create->getType_float_ByName("soga_cheeks",2));
-	SaveCharacterFloats(char_id,"soga_lip_type", create->getType_float_ByName("soga_lips",0), create->getType_float_ByName("soga_lips",1), create->getType_float_ByName("soga_lips",2));
-	SaveCharacterFloats(char_id,"soga_chin_type", create->getType_float_ByName("soga_chin",0), create->getType_float_ByName("soga_chin",1), create->getType_float_ByName("soga_chin",2));
-	SaveCharacterFloats(char_id,"soga_nose_type", create->getType_float_ByName("soga_nose",0), create->getType_float_ByName("soga_nose",1), create->getType_float_ByName("soga_nose",2));
-
-	return char_id;
-}
-
-int8 WorldDatabase::CheckNameFilter(const char* name) {
-	// the minimum 4 is enforced by the client too
-	if(!name || strlen(name) < 4 || strlen(name) > 15) // Even 20 char length is long...
-		return BADNAMELENGTH_REPLY;
-	uchar* checkname = (uchar*)name;
-	for (int32 i = 0; i < strlen(name); i++)
-	{
-		if(!alpha_check(checkname[i]))
-			return NAMEINVALID_REPLY;
-	}
-	Query query;
-	LogWrite(WORLD__DEBUG, 0, "World", "Name check on: %s", name);
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT count(*) FROM characters WHERE name='%s'",name);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		if(row[0] != 0 && atoi(row[0]) > 0)
-			return NAMETAKEN_REPLY;
-	}
-	else
-		LogWrite(WORLD__ERROR, 0, "World", "Error in CheckNameFilter (name exist check) (Name query '%s': %s", query.GetQuery(), query.GetError());
-
-	Query query3;
-	LogWrite(WORLD__DEBUG, 0, "World", "Name check on: %s (Bots table)", name);
-	MYSQL_RES* result3 = query3.RunQuery2(Q_SELECT, "SELECT count(*) FROM bots WHERE name='%s'", name);
-	if (result3 && mysql_num_rows(result3) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result3);
-		if (row[0] != 0 && atoi(row[0]) > 0)
-			return NAMETAKEN_REPLY;
-	}
-	else
-		LogWrite(WORLD__ERROR, 0, "World", "Error in CheckNameFilter (name exist check, bot table) (Name query '%s': %s", query3.GetQuery(), query3.GetError());
-
-
-
-	Query query2;
-	MYSQL_RES* result2 = query2.RunQuery2(Q_SELECT, "SELECT count(*) FROM name_filter WHERE '%s' like name",name);
-	if(result2 && mysql_num_rows(result2) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result2);
-		if(row[0] != 0 && atoi(row[0]) > 0)
-			return NAMEFILTER_REPLY;
-		else if(row[0] != 0 && atoi(row[0]) == 0)
-			return CREATESUCCESS_REPLY;
-	}
-	else
-		LogWrite(WORLD__ERROR, 0, "World", "Error in CheckNameFilter (name_filter check) query '%s': %s", query.GetQuery(), query.GetError());
-
-	return UNKNOWNERROR_REPLY;
-}
-
-char* WorldDatabase::GetCharacterName(int32 character_id){
-
-	LogWrite(WORLD__TRACE, 9, "World", "Enter: %s", __FUNCTION__);
-
-	Query query;
-	char* name = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT name FROM characters where id=%u",character_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		if(row[0] && strlen(row[0]) > 0)
-		{
-			name = new char[strlen(row[0])+1];
-			memset(name,0, strlen(row[0])+1);
-			strcpy(name, row[0]);
-		}
-	}
-	else
-		LogWrite(WORLD__ERROR, 0, "World", "Error in GetCharacterName query '%s': %s", query.GetQuery(), query.GetError());
-
-	LogWrite(WORLD__TRACE, 9, "World", "Exit: %s", __FUNCTION__);
-	return name;
-}
-
-int8 WorldDatabase::GetCharacterLevel(int32 character_id){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT level FROM characters where id=%u",character_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		return atoi(row[0]); // Return characters level
-	}
-	else
-		LogWrite(WORLD__ERROR, 0, "World", "Error in GetCharacterLevel query '%s': %s", query.GetQuery(), query.GetError());
-
-	return 0;
-}
-
-int16 WorldDatabase::GetCharacterModelType(int32 character_id){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT model_type FROM characters where id=%u",character_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		return atoi(row[0]); // Return characters race
-	}
-	else
-		LogWrite(WORLD__ERROR, 0, "World", "Error in GetCharacterModelType query '%s': %s", query.GetQuery(), query.GetError());
-
-	return 0;
-}
-
-int8 WorldDatabase::GetCharacterClass(int32 character_id){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT class FROM characters where id=%u",character_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		return atoi(row[0]); // Return characters class
-	}
-	else
-		LogWrite(WORLD__ERROR, 0, "World", "Error in GetCharacterClass query '%s': %s", query.GetQuery(), query.GetError());
-
-	return 0;
-}
-
-int8 WorldDatabase::GetCharacterGender(int32 character_id){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT gender FROM characters where id=%u",character_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		return atoi(row[0]); // Return characters gender
-	}
-	else
-		LogWrite(WORLD__ERROR, 0, "World", "Error in GetCharacterGender query '%s': %s", query.GetQuery(), query.GetError());
-
-	return 0;
-}
-
-void WorldDatabase::DeleteCharacterQuest(int32 quest_id, int32 char_id, bool repeated_quest) {
-	if (repeated_quest) {
-		if (!database_new.Query("UPDATE `character_quests` SET `given_date` = `completed_date` WHERE `char_id` = %u AND `quest_id` = %u", char_id, quest_id))
-			LogWrite(DATABASE__ERROR, 0, "DBNew", "Error (%u) in DeleteCharacterQuest query:\n%s", database_new.GetError(), database_new.GetErrorMsg());
-	}
-	else {
-		if (!database_new.Query("DELETE FROM `character_quests` WHERE `char_id` = %u AND `quest_id` = %u", char_id, quest_id))
-			LogWrite(DATABASE__ERROR, 0, "DBNew", "Error (%u) in DeleteCharacterQuest query:\n%s", database_new.GetError(), database_new.GetErrorMsg());
-	}
-
-	if (!database_new.Query("DELETE FROM `character_quest_progress` WHERE `char_id` = %u AND `quest_id` = %u", char_id, quest_id))
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "Error (%u) in DeleteCharacterQuest query:\n%s", database_new.GetError(), database_new.GetErrorMsg());
-}
-
-void WorldDatabase::SaveCharacterSkills(Client* client){
-	vector<Skill*>* skills = client->GetPlayer()->GetSkills()->GetSaveNeededSkills();
-	if(skills){
-		Query query;
-		if(skills->size() > 0){
-			Skill* skill = 0;
-			for(int32 i=0;i<skills->size();i++){
-				skill = skills->at(i);
-				query.AddQueryAsync(client->GetCharacterID(),this,Q_REPLACE, "replace into character_skills (char_id, skill_id, current_val, max_val) values(%u, %u, %i, %i)", client->GetCharacterID(), skill->skill_id, skill->current_val, skill->max_val);
-			}
-			if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-				LogWrite(WORLD__ERROR, 0, "World", "Error in SaveCharacterSkills query '%s': %s", query.GetQuery(), query.GetError());
-		}
-		safe_delete(skills);
-	}
-}
-
-void WorldDatabase::SaveCharacterQuests(Client* client){
-	Query query;
-	map<int32, Quest*>::iterator itr;
-	master_quest_list.LockQuests(); //prevent reloading until we are done
-	client->GetPlayer()->MPlayerQuests.writelock(__FUNCTION__, __LINE__); //prevent all quest modifications until we are done
-	map<int32, Quest*>* quests = client->GetPlayer()->GetPlayerQuests();
-	for(itr = quests->begin(); itr != quests->end(); itr++){
-		if(client->GetCurrentQuestID() == itr->first){
-			query.AddQueryAsync(client->GetCharacterID(),this,Q_UPDATE, "update character_quests set current_quest = 0 where char_id = %u", client->GetCharacterID());
-			query.AddQueryAsync(client->GetCharacterID(), this,Q_UPDATE, "update character_quests set current_quest = 1 where char_id = %u and quest_id = %u", client->GetCharacterID(), itr->first);
-		}
-		if(itr->second->GetSaveNeeded()){
-			query.AddQueryAsync(client->GetCharacterID(), this,Q_INSERT, "insert ignore into character_quests (char_id, quest_id, given_date, quest_giver) values(%u, %u, now(), %u)", client->GetCharacterID(), itr->first, itr->second->GetQuestGiver());
-			query.AddQueryAsync(client->GetCharacterID(), this,Q_UPDATE, "update character_quests set tracked = %i, quest_flags = %u, hidden = %i, complete_count = %u where char_id = %u and quest_id = %u", itr->second->IsTracked() ? 1 : 0, itr->second->GetQuestFlags(), itr->second->IsHidden() ? 1 : 0, itr->second->GetCompleteCount(), client->GetCharacterID(), itr->first);
-			SaveCharacterQuestProgress(client, itr->second);
-			itr->second->SetSaveNeeded(false);
-		}
-	}
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SaveCharacterQuests query '%s': %s", query.GetQuery(), query.GetError());
-	quests = client->GetPlayer()->GetCompletedPlayerQuests();
-	for(itr = quests->begin(); itr != quests->end(); itr++){
-		if(itr->second->GetSaveNeeded()){
-			query.AddQueryAsync(client->GetCharacterID(), this,Q_DELETE, "delete FROM character_quest_progress where char_id = %u and quest_id = %u", client->GetCharacterID(), itr->first);
-
-			/* incase the quest is completed before the quest could be inserted in the PlayerQuests loop, we first try to insert it.  If it already exists then we can just update
-			 * the completed_date */
-			query.AddQueryAsync(client->GetCharacterID(), this,Q_INSERT, "INSERT INTO character_quests (char_id, quest_id, quest_giver, current_quest, given_date, completed_date, complete_count) values (%u,%u,%u,0, now(),now(), %u) ON DUPLICATE KEY UPDATE completed_date = now(), complete_count = %u, current_quest = 0", client->GetCharacterID(), itr->first, itr->second->GetQuestGiver(), itr->second->GetCompleteCount(), itr->second->GetCompleteCount());
-			itr->second->SetSaveNeeded(false);
-		}
-	}
-	client->GetPlayer()->MPlayerQuests.releasewritelock(__FUNCTION__, __LINE__);
-	master_quest_list.UnlockQuests();
-
-}
-
-void WorldDatabase::SaveCharRepeatableQuest(Client* client, int32 quest_id, int16 quest_complete_count) {
-	if (!database_new.Query("UPDATE `character_quests` SET `given_date` = now(), complete_count = %u WHERE `char_id` = %u AND `quest_id` = %u", quest_complete_count, client->GetCharacterID(), quest_id))
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "DB Error %u\n%s", database_new.GetError(), database_new.GetErrorMsg());
-}
-
-void WorldDatabase::SaveCharacterQuestProgress(Client* client, Quest* quest){
-	Query query;
-	vector<QuestStep*>* steps = quest->GetQuestSteps();
-	vector<QuestStep*>::iterator itr;
-	QuestStep* step = 0;
-	if(steps){
-		for(itr = steps->begin(); itr != steps->end(); itr++){
-			step = *itr;
-			if(step && step->GetQuestCurrentQuantity() > 0)
-				query.RunQuery2(Q_REPLACE, "replace into character_quest_progress (char_id, quest_id, step_id, progress) values(%u, %u, %u, %i)", client->GetCharacterID(), quest->GetQuestID(), step->GetStepID(), step->GetQuestCurrentQuantity());
-		}
-	}
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SaveCharacterQuestProgress query '%s': %s", query.GetQuery(), query.GetError());
-}
-
-void WorldDatabase::LoadCharacterQuestProgress(Client* client){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT character_quest_progress.quest_id, step_id, progress FROM character_quest_progress, character_quests where character_quest_progress.char_id=%u and character_quest_progress.quest_id = character_quests.quest_id and character_quest_progress.char_id = character_quests.char_id ORDER BY character_quest_progress.quest_id",client->GetCharacterID());
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		Quest* quest = 0;
-		int32 quest_id = 0;
-		map<int32, int32>* progress_map = new map<int32, int32>();
-		while(result && (row = mysql_fetch_row(result))){
-			if(quest_id != atoul(row[0])){
-				if(quest_id > 0){
-					quest = client->GetPlayer()->GetQuest(quest_id);
-					if(quest)
-						client->SetPlayerQuest(quest, progress_map);
-				}
-				quest_id = atoul(row[0]);
-				progress_map->clear();
-			}
-			(*progress_map)[atoul(row[1])] = atoul(row[2]);
-		}
-		if(progress_map->size() > 0){
-			quest = client->GetPlayer()->GetQuest(quest_id);
-			if(quest)
-				client->SetPlayerQuest(quest, progress_map);
-		}
-		safe_delete(progress_map);
-	}
-	else if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-		LogWrite(WORLD__ERROR, 0, "World", "Error in LoadCharacterQuestProgress query '%s': %s", query.GetQuery(), query.GetError());
-}
-
-void WorldDatabase::LoadCharacterQuests(Client* client){
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Loading Character Quests...");
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT quest_id, DAY(given_date), MONTH(given_date), YEAR(given_date), DAY(completed_date), MONTH(completed_date), YEAR(completed_date), quest_giver, tracked, quest_flags, hidden, UNIX_TIMESTAMP(given_date), UNIX_TIMESTAMP(completed_date), complete_count FROM character_quests WHERE char_id=%u ORDER BY current_quest", client->GetCharacterID());
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		Quest* quest = 0;
-		while(result && (row = mysql_fetch_row(result))){
-			quest = master_quest_list.GetQuest(atoul(row[0]));
-			if(quest) {
-
-				LogWrite(PLAYER__DEBUG, 5, "Player", "\tLoading quest_id: %u", atoul(row[0]));
-				bool addQuest = true;
-
-				if(row[4] && atoi(row[4]) > 0){
-					quest->SetTurnedIn(true);
-					if(row[4])
-						quest->SetDay(atoi(row[4]));
-					if(row[5])
-						quest->SetMonth(atoi(row[5]));
-					if(row[6] && atoi(row[6]) > 2000)
-						quest->SetYear(atoi(row[6]) - 2000);
-					client->GetPlayer()->AddCompletedQuest(quest);
-
-					// Added timestamps to quickly compare given and completed dates
-					int32 given_timestamp = atoul(row[11]);
-					int32 completed_timestamp = atoul(row[12]);
-
-					// If given timestamp is greater then completed then this is a repeatable quest we are working on
-					// so get a fresh quest object to add as an active quest
-					if (given_timestamp > completed_timestamp)
-					{
-						safe_delete(quest);
-						quest = master_quest_list.GetQuest(atoul(row[0]));
-					}
-					else
-						addQuest = false;
-
-					quest->SetCompleteCount(atoi(row[13]));
-				}
-
-				if (addQuest) {
-					if(row[1])
-						quest->SetDay(atoi(row[1]));
-					if(row[2])
-						quest->SetMonth(atoi(row[2]));
-					if(row[3] && atoi(row[3]) > 2000)
-						quest->SetYear(atoi(row[3]) - 2000);
-					quest->SetQuestGiver(atoul(row[7]));
-					quest->SetTracked(atoi(row[8]) == 1 ? true : false);
-					quest->SetQuestFlags(atoul(row[9]));
-					quest->SetHidden(atoi(row[10]) == 1 ? true : false);
-					client->AddPlayerQuest(quest, false, false);
-				}
-				quest->SetSaveNeeded(false);
-
-				// Changed this to call reload with step = 0 for all quests and not
-				// just quests with quest flags to allow customized set up if needed
-				if (lua_interface)
-					lua_interface->CallQuestFunction(quest, "Reload", client->GetPlayer(), 0);
-			}
-		}
-		LoadCharacterQuestProgress(client);
-	}
-}
-
-void WorldDatabase::LoadCharacterFriendsIgnoreList(Player* player) {
-	if (player) {
-		Query query;
-		MYSQL_ROW row;
-		MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `name`, `type` FROM `character_social` WHERE `char_id`=%u", player->GetCharacterID());
-		while (result && (row = mysql_fetch_row(result))) {
-			if (strncmp(row[1], "FRIEND", 6) == 0)
-				player->AddFriend(row[0], false);
-			else
-				player->AddIgnore(row[0], false);
-		}
-	}
-}
-
-void WorldDatabase::LoadZoneInfo(ZoneServer* zone){
-	Query query;
-	int32 ruleset_id;
-	char* escaped = getEscapeString(zone->GetZoneName());
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, file, description, underworld, safe_x, safe_y, safe_z, min_status, min_level, max_level, instance_type+0, shutdown_timer, zone_motd, default_reenter_time, default_reset_time, default_lockout_time, force_group_to_zone, safe_heading, xp_modifier, ruleset_id, expansion_id, weather_allowed, sky_file FROM zones where name='%s'",escaped);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		zone->SetZoneName(escaped);
-		zone->SetZoneID(strtoul(row[0], NULL, 0));
-		zone->SetZoneFile(row[1]);
-		zone->SetZoneDescription(row[2]);
-		zone->SetUnderWorld(atof(row[3]));
-		zone->SetSafeX(atof(row[4]));
-		zone->SetSafeY(atof(row[5]));
-		zone->SetSafeZ(atof(row[6]));
-		zone->SetMinimumStatus(atoi(row[7]));
-		zone->SetMinimumLevel(atoi(row[8]));
-		zone->SetMaximumLevel(atoi(row[9]));
-		int8 type = (atoi(row[10]) == 0) ? 0 : atoi(row[10]) - 1;
-		zone->SetInstanceType(type);
-		zone->SetShutdownTimer(atoul(row[11]));
-
-		char* zone_motd = row[12];
-		if (zone_motd && strlen(zone_motd) > 0)
-			zone->SetZoneMOTD(string(zone_motd));
-
-		zone->SetDefaultReenterTime(atoi(row[13]));
-		zone->SetDefaultResetTime(atoi(row[14]));
-		zone->SetDefaultLockoutTime(atoi(row[15]));
-		zone->SetForceGroupZoneOption(atoi(row[16]));
-		zone->SetSafeHeading(atof(row[17]));
-		zone->SetXPModifier(atof(row[18]));
-
-		if ((ruleset_id = atoul(row[19])) > 0 && !rule_manager.SetZoneRuleSet(zone->GetZoneID(), ruleset_id))
-			LogWrite(ZONE__ERROR, 0, "Zones", "Error setting rule set for zone '%s' (%u). A rule set with ID %u does not exist.", zone->GetZoneName(), zone->GetZoneID(), ruleset_id);
-
-		// check data_version to see if client has proper expansion to enter a zone
-		zone->SetMinimumVersion(GetMinimumClientVersion(atoi(row[20])));
-		zone->SetWeatherAllowed(atoi(row[21]) == 0 ? false : true);
-
-		zone->SetZoneSkyFile(row[22]);
-
-		if (zone->IsInstanceZone())
-		{
-			if ( zone->GetInstanceID() < 1 )
-				zone->SetupInstance(CreateNewInstance(zone->GetZoneID()));
-			else
-				zone->SetupInstance(zone->GetInstanceID());
-		}
-	}
-	safe_delete_array(escaped);
-}
-
-void WorldDatabase::LoadZoneInfo(ZoneInfo* zone_info) {
-	Query query;
-	int32 ruleset_id;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT name, file, description, underworld, safe_x, safe_y, safe_z, min_status, min_level, max_level, instance_type, shutdown_timer, zone_motd, default_reenter_time, default_reset_time, default_lockout_time, force_group_to_zone, lua_script, xp_modifier, ruleset_id, expansion_id, always_loaded, city_zone, start_zone, zone_type, weather_allowed, sky_file FROM zones WHERE id = %u", zone_info->id);
-	if (result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		strncpy(zone_info->name, row[0], sizeof(zone_info->name));
-		strncpy(zone_info->file, row[1], sizeof(zone_info->file));
-		strncpy(zone_info->description, row[2], sizeof(zone_info->description));
-		zone_info->underworld = atof(row[3]);
-		zone_info->safe_x = atof(row[4]);
-		zone_info->safe_y = atof(row[5]);
-		zone_info->safe_z = atof(row[6]);
-		zone_info->min_status = atoi(row[7]);
-		zone_info->min_level = atoi(row[8]);
-		zone_info->max_level = atoi(row[9]);
-		zone_info->instance_type = (atoi(row[10]) == 0) ? 0 : atoi(row[10]) - 1;
-		zone_info->shutdown_timer = atoul(row[11]);
-		row[12] == NULL ? strncpy(zone_info->zone_motd, "", sizeof(zone_info->zone_motd)) : strncpy(zone_info->zone_motd, row[12], sizeof(zone_info->zone_motd));
-		zone_info->default_reenter_time = atoi(row[13]);
-		zone_info->default_reset_time = atoi(row[14]);
-		zone_info->default_lockout_time = atoi(row[15]);
-		zone_info->force_group_to_zone = atoi(row[16]);
-		row[17] == NULL ? strncpy(zone_info->lua_script, "", sizeof(zone_info->lua_script)) : strncpy(zone_info->lua_script, row[17], sizeof(zone_info->lua_script));
-		zone_info->xp_modifier = atof(row[18]);
-		zone_info->ruleset_id = atoul(row[19]);
-		if ((ruleset_id = atoul(row[19])) > 0 && !rule_manager.SetZoneRuleSet(zone_info->id, ruleset_id))
-			LogWrite(ZONE__ERROR, 0, "Zones", "Error setting rule set for zone '%s' (%u). A rule set with ID %u does not exist.", zone_info->name, zone_info->id, ruleset_id);
-
-		zone_info->expansion_id = atoi(row[20]);
-		zone_info->min_version = GetMinimumClientVersion(zone_info->expansion_id);
-		zone_info->always_loaded	= atoi(row[21]);
-		zone_info->city_zone		= atoi(row[22]);
-		zone_info->start_zone		= atoi(row[23]);
-		row[24] == NULL ? strncpy(zone_info->zone_type, "", sizeof(zone_info->zone_type)) : strncpy(zone_info->zone_type, row[24], sizeof(zone_info->zone_type));
-		zone_info->weather_allowed	= atoi(row[25]);
-
-		strncpy(zone_info->sky_file, row[26], sizeof(zone_info->sky_file));
-	}
-}
-
-void WorldDatabase::SaveZoneInfo(int32 zone_id, const char* field, sint32 value) {
-	Query query;
-	query.RunQuery2(Q_UPDATE, "UPDATE `zones` SET `%s`=%i WHERE `id`=%u", field, value, zone_id);
-}
-
-void WorldDatabase::SaveZoneInfo(int32 zone_id, const char* field, float value) {
-	Query query;
-	query.RunQuery2(Q_UPDATE, "UPDATE `zones` SET `%s`=%f WHERE `id`=%u", field, value, zone_id);
-}
-
-void WorldDatabase::SaveZoneInfo(int32 zone_id, const char* field, const char* value) {
-	Query query;
-	query.RunQuery2(Q_UPDATE, "UPDATE `zones` SET `%s`='%s' WHERE `id`=%u", field, const_cast<char*>(getEscapeString(value)), zone_id);
-}
-
-int32 WorldDatabase::GetZoneID(const char* name) {
-	int32 zone_id = 0;
-	Query query;
-	char* escaped = getEscapeString(name);
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `id` FROM zones WHERE `name`=\"%s\"", escaped);
-	if (result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		zone_id = atoi(row[0]);
-	}
-	safe_delete_array(escaped);
-	return zone_id;
-}
-
-bool WorldDatabase::GetZoneRequirements(const char* zoneName, sint16* minStatus, int16* minLevel, int16* maxLevel, int16* minVersion) {	
-	Query query;
-	char* escaped = getEscapeString(zoneName);
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT min_status, min_level, max_level, expansion_id FROM zones where name='%s'",escaped);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		sint16 status = (sint16)atoi(row[0]);
-		int16 levelMin = (int16)atoi(row[1]);
-		int16 levelMax = (int16)atoi(row[2]);
-		int8 expansion_id = (int8)atoi(row[3]);
-
-		*minStatus = status;
-		*minLevel = levelMin;
-		*maxLevel = levelMax;
-
-		if( expansion_id >= 40 ) // lowest client we support is RoK - exp04
-			*minVersion = GetMinimumClientVersion(expansion_id);
-		else
-			*minVersion = 0;
-
-		safe_delete_array(escaped);
-		return true;
-	}
-	safe_delete_array(escaped);
-
-	return false;
-}
-
-int16 WorldDatabase::GetMinimumClientVersion(int8 expansion_id)
-{
-	/*
-	1	n/a		Classic	Expansion
-	2	adv01	Bloodline Chronicles
-	3	adv02	Splitpaw Saga
-	10	exp01	Desert of Flames
-	20	exp02	Kingdom of Sky
-	21	adv04	Fallen Dynasty
-	30	exp03	Echoes of Faydwer
-	40	exp04	Rise of Kunark
-	50	exp05	The Shadow Odyssey
-	60	exp06	Sentinel's Fate
-	61	halas	Halas Reborn
-	70	exp07	Destiny of Velious
-	80	exp08	Age of Discovery
-	*/
-
-	int16 minVer = 0;
-
-	// TODO: eventually replace this with reading values from eq2expansions table
-	switch(expansion_id)
-	{
-		case 40: // ROK
-			{
-				minVer = 843;
-				break;
-			}
-		case 50: // TSO
-			{
-				minVer = 908;
-				break;
-			}
-		case 60: // SF
-			{
-				minVer = 1008;
-				break;
-			}
-		case 61: // Halas
-			{
-				minVer = 1045;
-				break;
-			}
-		case 70: // DoV
-			{
-				minVer = 1096;
-				break;
-			}
-		case 80: // AoD
-			{
-				minVer = 1144;
-				break;
-			}
-		case 90: // CoE
-			{
-				minVer = 1188;
-				break;
-			}
-	}
-
-	return minVer;
-}
-
-// returns Expansion Name depending on the connected client's data version
-string WorldDatabase::GetExpansionIDByVersion(int16 version)
-{
-	/*
-	0		n/a		Classic	Expansion
-	0		adv01	Bloodline Chronicles
-	0		adv02	Splitpaw Saga
-	0		exp01	Desert of Flames
-	0		exp02	Kingdom of Sky
-	0		adv04	Fallen Dynasty
-	0		exp03	Echoes of Faydwer
-	843		exp04	Rise of Kunark
-	908		exp05	The Shadow Odyssey
-	1008	exp06	Sentinel's Fate
-	1045	halas	Halas Reborn
-	1096	exp07	Destiny of Velious
-	1142	exp08	Age of Discovery
-	1188	exp09	Chains of Eternity 
-	9999	(and beyond)
-	*/
-	string ret = "";
-
-	if( version >= 9999 )
-		ret = "Unknown";
-	else if( version >= 1188 )
-		ret = "Chains of Eternity";
-	else if( version >= 1142 )
-		ret = "Age of Discovery";
-	else if( version >= 1096 )
-		ret = "Destiny of Velious";
-	else if( version >= 1045 )
-		ret = "Halas Reborn";
-	else if( version >= 1008 )
-		ret = "Sentinel's Fate";
-	else if( version >= 908 )
-		ret = "The Shadow Odyssey";
-	else if( version >= 843 )
-		ret = "Rise of Kunark";
-	else
-		ret = "Any";
-
-	return ret;
-}
-
-
-void WorldDatabase::LoadSpecialZones(){
-	Query query;
-	ZoneServer* zone = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, name, always_loaded, city_zone FROM zones where always_loaded = 1 or city_zone = 1");
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		while(result && (row = mysql_fetch_row(result))){
-			zone = new ZoneServer(row[1]);
-			LoadZoneInfo(zone);
-			zone->Init();
-
-			zone->SetAlwaysLoaded(atoi(row[2]) == 1);
-			zone->SetCityZone(atoi(row[3]) == 1);
-		}
-	}
-}
-
-bool WorldDatabase::SpawnGroupRemoveAssociation(int32 group1, int32 group2){
-	Query query;
-	query.RunQuery2(Q_DELETE, "delete FROM spawn_location_group_associations where (group_id1 = %u and group_id2 = %u) or (group_id1 = %u and group_id2 = %u)", group1, group2, group2, group1);
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SpawnGroupRemoveSpawn query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-bool WorldDatabase::SpawnGroupAddAssociation(int32 group1, int32 group2){
-	Query query;
-	query.RunQuery2(Q_INSERT, "insert ignore into spawn_location_group_associations (group_id1, group_id2) values(%u, %u)", group1, group2);
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SpawnGroupAddAssociation query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-bool WorldDatabase::SpawnGroupAddSpawn(Spawn* spawn, int32 group_id){
-	Query query;
-	query.RunQuery2(Q_INSERT, "insert ignore into spawn_location_group (group_id, placement_id) values(%u, %u)", group_id, spawn->GetSpawnLocationPlacementID());
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SpawnGroupAddSpawn query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-bool WorldDatabase::SpawnGroupRemoveSpawn(Spawn* spawn, int32 group_id){
-	Query query;
-	query.RunQuery2(Q_DELETE, "delete FROM spawn_location_group where group_id = %u and placement_id = %u", group_id, spawn->GetSpawnLocationPlacementID());
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SpawnGroupRemoveSpawn query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT count(group_id) FROM spawn_location_group where group_id = %u", group_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		if((row = mysql_fetch_row(result))){
-			if(atoul(row[0]) == 0)
-				DeleteSpawnGroup(group_id);
-		}
-	}
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SpawnGroupRemoveSpawn query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-int32 WorldDatabase::CreateSpawnGroup(Spawn* spawn, string name)
-{
-	int32 group_id = 0;
-	Query query;
-
-	// JA: As of 0.7.1, DB Milestone 2, Content Team needs to use group_id's from Raw Data, so start any manual group_id's > 100,000
-	query.RunQuery2(Q_INSERT, "INSERT INTO spawn_location_group (group_id, placement_id, name) SELECT IF(ISNULL(MAX(group_id))=1, 100000, MAX(group_id)+1), %u, '%s' FROM spawn_location_group", spawn->GetSpawnLocationPlacementID(), getSafeEscapeString(name.c_str()).c_str());
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-		return 0;
-	
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT max(group_id) FROM spawn_location_group");
-	if(result && mysql_num_rows(result) > 0)
-	{
-		MYSQL_ROW row;
-
-		if((row = mysql_fetch_row(result)))
-		{
-			if(row[0])
-				group_id = atoul(row[0]);
-		}
-	}
-
-	return group_id;
-}
-
-void WorldDatabase::DeleteSpawnGroup(int32 id){
-	Query query;
-	query.RunQuery2(Q_DELETE, "delete FROM spawn_location_group where group_id = %u", id);
-}
-
-bool WorldDatabase::SetGroupSpawnChance(int32 id, float chance){
-	Query query;
-	query.RunQuery2(Q_UPDATE, "replace into spawn_location_group_chances (group_id, percentage) values(%u, %f)", id, chance);
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in SetGroupSpawnChance query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-int32 WorldDatabase::LoadSpawnGroupChances(ZoneServer* zone){
-	Query query;
-	int32 count = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT slgc.group_id, slgc.percentage FROM spawn_location_group_chances slgc, spawn_location_group slg, spawn_location_placement slp where slgc.group_id = slg.group_id and slg.placement_id = slp.id and slp.zone_id = %u", zone->GetZoneID());
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		int32 group_id = 0;
-		float percent = 0;
-		while(result && (row = mysql_fetch_row(result))){
-			group_id = atoul(row[0]);
-			percent = atof(row[1]);
-			zone->AddSpawnGroupChance(group_id, percent);
-			count++;
-		}
-	}
-	return count;
-}
-
-int32 WorldDatabase::LoadSpawnLocationGroupAssociations(ZoneServer* zone){
-	Query query;
-	int32 count = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT distinct slga.group_id1, slga.group_id2 FROM spawn_location_group_associations slga, spawn_location_group slg, spawn_location_placement slp where (slg.group_id = slga.group_id1 or slg.group_id = slga.group_id2) and slg.placement_id = slp.id and slp.zone_id = %u", zone->GetZoneID());
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		while(result && (row = mysql_fetch_row(result))){
-			zone->AddSpawnGroupAssociation(atoul(row[0]), atoul(row[1]));
-			count++;
-		}
-	}
-	return count;
-}
-
-int32 WorldDatabase::LoadSpawnLocationGroups(ZoneServer* zone){
-	Query query;
-	int32 count = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT slg.group_id, slg.placement_id, slp.spawn_location_id FROM spawn_location_group slg, spawn_location_placement slp WHERE slg.placement_id = slp.id and slp.zone_id = %u", zone->GetZoneID());
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		int32 placement_id = 0;
-		int32 group_id = 0;
-		int32 spawn_location_id = 0;
-		while(result && (row = mysql_fetch_row(result))){
-			group_id = atoul(row[0]);
-			placement_id = atoul(row[1]);
-			spawn_location_id = atoul(row[2]);
-			zone->AddSpawnGroupLocation(group_id, placement_id, spawn_location_id);
-			count++;
-		}
-	}
-	return count;
-}
-
-int32 WorldDatabase::ProcessSpawnLocations(ZoneServer* zone, const char* sql_query, int8 type){
-	int32 number = 0;
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, sql_query, zone->GetZoneID());
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		int32 spawn_location_id = 0xFFFFFFFF;
-		SpawnLocation* spawn_location = 0;
-		while(result && (row = mysql_fetch_row(result))){
-			if((spawn_location_id == 0xFFFFFFFF) || atoul(row[0]) != spawn_location_id){
-				if(spawn_location){
-					zone->AddSpawnLocation(spawn_location_id, spawn_location);
-					number++;
-				}
-				spawn_location = new SpawnLocation();
-			}
-			SpawnEntry* entry = new SpawnEntry;
-
-			spawn_location_id = atoul(row[0]);
-			entry->spawn_location_id = spawn_location_id;
-			entry->spawn_entry_id = atoul(row[1]);
-			entry->spawn_type = type;
-			entry->spawn_id = atoul(row[9]);
-			entry->spawn_percentage = atof(row[10]);
-			entry->respawn = atoul(row[11]);
-			entry->expire_time = atoul(row[14]);
-			entry->expire_offset = atoul(row[15]);
-			//devn00b add stat overrides. Just a slight increase in size. Used in ZoneServer::AddNPCSpawn.
-			entry->lvl_override = atoul(row[19]);
-			entry->hp_override = atoul(row[20]);
-			entry->mp_override = atoul(row[21]);
-			entry->str_override = atoul(row[22]);
-			entry->sta_override = atoul(row[23]);
-			entry->wis_override = atoul(row[24]);
-			entry->int_override = atoul(row[25]);
-			entry->agi_override = atoul(row[26]);
-			entry->heat_override = atoul(row[27]);
-			entry->cold_override = atoul(row[28]);
-			entry->magic_override = atoul(row[29]);
-			entry->mental_override = atoul(row[30]);
-			entry->divine_override = atoul(row[31]);
-			entry->disease_override = atoul(row[32]);
-			entry->poison_override = atoul(row[33]);
-			entry->difficulty_override = atoul(row[34]);
-			spawn_location->x = atof(row[2]);
-			spawn_location->y = atof(row[3]);
-			spawn_location->z = atof(row[4]);
-			spawn_location->x_offset = atof(row[5]);
-			spawn_location->y_offset = atof(row[6]);
-			spawn_location->z_offset = atof(row[7]);
-			spawn_location->heading = atof(row[8]);
-			spawn_location->pitch = atof(row[16]);
-			spawn_location->roll = atof(row[17]);
-			spawn_location->conditional = atoi(row[18]);
-			spawn_location->total_percentage += entry->spawn_percentage;
-			spawn_location->grid_id = strtoul(row[12], NULL, 0);
-			spawn_location->placement_id = strtoul(row[13], NULL, 0);
-			spawn_location->AddSpawn(entry);
-
-		}
-		if(spawn_location){
-			zone->AddSpawnLocation(spawn_location_id, spawn_location);
-			number++;
-		}
-	}
-	return number;
-}
-
-void WorldDatabase::ResetDatabase(){
-	Query query;
-	query.RunQuery2("delete FROM table_versions where name != 'table_versions'", Q_DELETE);
-}
-
-void WorldDatabase::EnableConstraints(){
-	Query query;
-	query.RunQuery2("/*!40101 SET SQL_MODE=@OLD_SQL_MODE */", Q_DBMS);
-	query.RunQuery2("/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */", Q_DBMS);
-}
-
-void WorldDatabase::DisableConstraints(){
-	Query query;
-	query.RunQuery2("/*!40101 SET NAMES utf8 */", Q_DBMS);
-	query.RunQuery2("/*!40101 SET SQL_MODE=''*/", Q_DBMS);
-	query.RunQuery2("/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */", Q_DBMS);
-	query.RunQuery2("/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */", Q_DBMS);
-}
-
-void WorldDatabase::LoadSpawns(ZoneServer* zone)
-{
-	Query query;
-	int32 npcs = 0, objects = 0, widgets = 0, signs = 0, ground_spawns = 0, spawn_groups = 0, spawn_group_associations = 0, spawn_group_chances = 0;
-
-	LogWrite(SPAWN__TRACE, 0, "Spawn", "Enter LoadSpawns");
-
-	npcs = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override, slp.str_override, slp.sta_override, slp.wis_override, slp.int_override, slp.agi_override, slp.heat_override, slp.cold_override, slp.magic_override, slp.mental_override, slp.divine_override, slp.disease_override, slp.poison_override, difficulty_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_npcs sn where sn.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_NPC);
-	objects = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override, slp.str_override, slp.sta_override, slp.wis_override, slp.int_override, slp.agi_override, slp.heat_override, slp.cold_override, slp.magic_override, slp.mental_override, slp.divine_override, slp.disease_override, slp.poison_override, difficulty_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_objects so where so.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_OBJECT);
-	widgets = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override, slp.str_override, slp.sta_override, slp.wis_override, slp.int_override, slp.agi_override, slp.heat_override, slp.cold_override, slp.magic_override, slp.mental_override, slp.divine_override, slp.disease_override, slp.poison_override, difficulty_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_widgets sw where sw.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_WIDGET);
-	signs = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override, slp.str_override, slp.sta_override, slp.wis_override, slp.int_override, slp.agi_override, slp.heat_override, slp.cold_override, slp.magic_override, slp.mental_override, slp.divine_override, slp.disease_override, slp.poison_override, difficulty_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_signs ss where ss.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_SIGN);
-	ground_spawns = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override, slp.str_override, slp.sta_override, slp.wis_override, slp.int_override, slp.agi_override, slp.heat_override, slp.cold_override, slp.magic_override, slp.mental_override, slp.divine_override, slp.disease_override, slp.poison_override, difficulty_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_ground sg where sg.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_GROUNDSPAWN);
-	spawn_groups = LoadSpawnLocationGroups(zone);
-	spawn_group_associations = LoadSpawnLocationGroupAssociations(zone);
-	spawn_group_chances = LoadSpawnGroupChances(zone);
-	LogWrite(SPAWN__INFO, 0, "Spawn", "Loaded for zone '%s' (%u):\n\t%u NPC(s), %u Object(s), %u Widget(s)\n\t%u Sign(s), %u Ground Spawn(s), %u Spawn Group(s)\n\t%u Spawn Group Association(s), %u Spawn Group Chance(s)", zone->GetZoneName(), zone->GetZoneID(), npcs, objects, widgets, signs, ground_spawns, spawn_groups, spawn_group_associations, spawn_group_chances);
-
-	LogWrite(SPAWN__TRACE, 0, "Spawn", "Exit LoadSpawns");
-
-}
-
-bool WorldDatabase::UpdateSpawnLocationSpawns(Spawn* spawn) {
-	Query query;
-	query.RunQuery2(Q_UPDATE, "update spawn_location_placement set x=%f, y=%f, z=%f, heading=%f, x_offset=%f, y_offset=%f, z_offset=%f, respawn=%u, expire_timer=%u, expire_offset=%u, grid_id=%u, pitch=%f, roll=%f where id = %u",
-		spawn->GetX(), spawn->GetY(), spawn->GetZ(), spawn->GetHeading(), spawn->GetXOffset(), spawn->GetYOffset(), spawn->GetZOffset(), spawn->GetRespawnTime(), spawn->GetExpireTime(), spawn->GetExpireOffsetTime(), spawn->appearance.pos.grid_id, spawn->GetPitch(), spawn->GetRoll(), spawn->GetSpawnLocationPlacementID());
-	if (query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF) {
-		LogWrite(WORLD__ERROR, 0, "World", "Error in UpdateSpawnLocationSpawns query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-bool WorldDatabase::UpdateSpawnWidget(int32 widget_id, char* queryString) {
-	Query query;
-	query.RunQuery2(Q_UPDATE, "update spawn_widgets set %s where widget_id = %u",
-		queryString, widget_id);
-	if (query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF) {
-		LogWrite(WORLD__ERROR, 0, "World", "Error in UpdateSpawnWidget query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-vector<string>* WorldDatabase::GetSpawnNameList(const char* in_name){
-	Query query;
-	string names = "";
-	vector<string>* ret = 0;
-	string name = getSafeEscapeString(in_name);
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT concat(spawn.id, ', ', name) FROM spawn where name like '%%%s%%'", name.c_str());
-	if(result && mysql_num_rows(result) > 0){
-		ret = new vector<string>;
-		MYSQL_ROW row;
-		int8 num = 0;
-		while(result && (row = mysql_fetch_row(result))){
-			if(num >= 10)
-				break;
-			ret->push_back(string(row[0]));
-			num++;
-		}
-		char total[60] = {0};
-		if(mysql_num_rows(result) > 10)
-			sprintf(total, "Total number of results: %u (Limited to 10)", (int32)mysql_num_rows(result));
-		else
-			sprintf(total, "Total number of results: %u", (int32)mysql_num_rows(result));
-		ret->push_back(string(total));
-	}
-	return ret;
-}
-string WorldDatabase::GetZoneName(char* zone_description){
-	string ret;
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT name FROM zones where description = '%s'", getSafeEscapeString(zone_description).c_str());
-	if(result && mysql_num_rows(result) > 0){
-		MYSQL_ROW row = mysql_fetch_row(result);
-		ret = string(row[0]);
-	}
-	return ret;
-}
-
-void WorldDatabase::LoadRevivePoints(vector<RevivePoint*>* revive_points, int32 zone_id){
-	if(revive_points && revive_points->size() > 0){
-		LogWrite(WORLD__ERROR, 0, "World", "Revive points have already been loaded for this zone!");
-		return;
-	}
-	else if(!revive_points || zone_id == 0){
-		LogWrite(WORLD__ERROR, 0, "World", "LoadRevivePoints called with null variables!");
-		return;
-	}
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT respawn_zone_id, location_name, safe_x, safe_y, safe_z, heading FROM revive_points where zone_id=%u ORDER BY id asc", zone_id);
-	if(revive_points && result && mysql_num_rows(result) > 0){
-		MYSQL_ROW row;
-		int32 id = 0;
-		RevivePoint* point = 0;
-		while(result && (row=mysql_fetch_row(result))){
-			point = new RevivePoint;
-			point->id = id;
-			point->zone_id = atoul(row[0]);
-			point->location_name = string(row[1]);
-			point->x = atof(row[2]);
-			point->y = atof(row[3]);
-			point->z = atof(row[4]);
-			point->heading = atof(row[5]);
-			revive_points->push_back(point);
-			id++;
-		}
-	}
-}
-
-int32 WorldDatabase::GetNextSpawnIDInZone(int32 zone_id)
-{
-	Query query;
-	int32 ret = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT MAX(id) FROM spawn where id LIKE '%i____'", zone_id);
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		if(row[0])
-			ret = atoi(row[0]) + 1;
-	}
-	if( ret == 0 )
-		ret = zone_id * 10000; // there are no spawns for that zone yet, to start with the first ID
-
-	LogWrite(WORLD__DEBUG, 0, "World", "Next Spawn ID for Zone %i: %u", zone_id, ret);
-	return ret;
-
-}
-
-
-bool WorldDatabase::SaveSpawnInfo(Spawn* spawn){
-	Query query;
-	string name = getSafeEscapeString(spawn->GetName());
-	string suffix = getSafeEscapeString(spawn->GetSuffixTitle());
-	string prefix = getSafeEscapeString(spawn->GetPrefixTitle());
-	string last_name = getSafeEscapeString(spawn->GetLastName());
-	if(spawn->GetDatabaseID() == 0){
-
-		int8 isInstanceType = (spawn->GetZone()->GetInstanceType() == Instance_Type::PERSONAL_HOUSE_INSTANCE);
-
-		int32 new_spawn_id = GetNextSpawnIDInZone(spawn->GetZone()->GetZoneID());
-
-		query.RunQuery2(Q_INSERT, "insert into spawn (id, name, race, model_type, size, targetable, show_name, command_primary, command_secondary, visual_state, attackable, show_level, show_command_icon, display_hand_icon, faction_id, collision_radius, hp, power, prefix, suffix, last_name, is_instanced_spawn, merchant_min_level, merchant_max_level) values(%u, '%s', %i, %i, %i, %i, %i, %u, %u, %i, %i, %i, %i, %i, %u, %i, %u, %u, '%s', '%s', '%s', %u, %u, %u)",
-			new_spawn_id, name.c_str(), spawn->GetRace(), spawn->GetModelType(), spawn->GetSize(), spawn->appearance.targetable, spawn->appearance.display_name, spawn->GetPrimaryCommandListID(), spawn->GetSecondaryCommandListID(), spawn->GetVisualState(), spawn->appearance.attackable, spawn->appearance.show_level, spawn->appearance.show_command_icon, spawn->appearance.display_hand_icon, 0, spawn->appearance.pos.collision_radius, spawn->GetTotalHP(), spawn->GetTotalPower(), prefix.c_str(), suffix.c_str(), last_name.c_str(), isInstanceType, spawn->GetMerchantMinLevel(), spawn->GetMerchantMaxLevel());
-
-		if( new_spawn_id > 0 )
-			spawn->SetDatabaseID(new_spawn_id); // use the new zone_id range
-		else if( query.GetLastInsertedID() > 0 )
-			spawn->SetDatabaseID(query.GetLastInsertedID()); // else fall back to last_inserted_id
-		else
-			return false; // else, hang your head in shame as you are an utter failure
-
-		if(spawn->IsNPC()){
-			query.RunQuery2(Q_INSERT, "insert into spawn_npcs (spawn_id, min_level, max_level, enc_level, class_, gender, min_group_size, max_group_size, hair_type_id, facial_hair_type_id, wing_type_id, chest_type_id, legs_type_id, soga_hair_type_id, soga_facial_hair_type_id, soga_model_type, heroic_flag, action_state, mood_state, initial_state, activity_status, hide_hood, emote_state) values(%u, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)",
-				spawn->GetDatabaseID(), spawn->GetLevel(), spawn->GetLevel(), spawn->appearance.encounter_level, spawn->GetAdventureClass(), spawn->GetGender(), 0, 0, ((NPC*)spawn)->features.hair_type, ((NPC*)spawn)->features.hair_face_type, 
-				((NPC*)spawn)->features.wing_type, ((NPC*)spawn)->features.chest_type, ((NPC*)spawn)->features.legs_type, ((NPC*)spawn)->features.soga_hair_type, ((NPC*)spawn)->features.soga_hair_face_type, spawn->appearance.soga_model_type, spawn->appearance.heroic_flag, spawn->GetActionState(), spawn->GetMoodState(), spawn->GetInitialState(), spawn->GetActivityStatus(), spawn->appearance.hide_hood, spawn->appearance.emote_state);
-		}
-		else if(spawn->IsObject()){
-			query.RunQuery2(Q_INSERT, "insert into spawn_objects (spawn_id) values(%u)", spawn->GetDatabaseID());
-		}
-		else if(spawn->IsWidget()){
-			Widget* widget = (Widget*)spawn;
-			query.RunQuery2(Q_INSERT, "insert into spawn_widgets (spawn_id, widget_id) values(%u, %u)", spawn->GetDatabaseID(), widget->GetWidgetID());
-		}
-		else if(spawn->IsSign()){
-			query.RunQuery2(Q_INSERT, "insert into spawn_signs (spawn_id, description) values(%u, 'change me')", spawn->GetDatabaseID());
-
-		}
-		else if (spawn->IsGroundSpawn()) {
-			query.RunQuery2(Q_INSERT, "insert into spawn_ground (spawn_id) values(%u)", spawn->GetDatabaseID());
-		}
-	}
-	else{
-		if(spawn->IsNPC()){
-			query.RunQuery2(Q_UPDATE, "update spawn_npcs, spawn set name='%s', min_level=%i, max_level=%i, enc_level=%i, race=%i, model_type=%i, class_=%i, gender=%i, show_name=%i, attackable=%i, show_level=%i, targetable=%i, show_command_icon=%i, display_hand_icon=%i, hair_type_id=%i, facial_hair_type_id=%i, wing_type_id=%i, chest_type_id=%i, legs_type_id=%i, soga_hair_type_id=%i, soga_facial_hair_type_id=%i, soga_model_type=%i, size=%i, hp=%u, heroic_flag=%i, power=%u, collision_radius=%i, command_primary=%u, command_secondary=%u, visual_state=%i, action_state=%i, mood_state=%i, initial_state=%i, activity_status=%i, alignment=%i, faction_id=%u, hide_hood=%i, emote_state=%i, suffix ='%s', prefix='%s', last_name='%s', merchant_min_level = %u, merchant_max_level = %u where spawn_npcs.spawn_id = spawn.id and spawn.id = %u",
-				name.c_str(), spawn->GetLevel(), spawn->GetLevel(), spawn->appearance.encounter_level, spawn->GetRace(), spawn->GetModelType(),
-				spawn->GetAdventureClass(), spawn->GetGender(), spawn->appearance.display_name, spawn->appearance.attackable, spawn->appearance.show_level, spawn->appearance.targetable, spawn->appearance.show_command_icon, spawn->appearance.display_hand_icon, ((NPC*)spawn)->features.hair_type, 
-				((NPC*)spawn)->features.hair_face_type, ((NPC*)spawn)->features.wing_type, ((NPC*)spawn)->features.chest_type, ((NPC*)spawn)->features.legs_type, ((NPC*)spawn)->features.soga_hair_type, ((NPC*)spawn)->features.soga_hair_face_type, spawn->appearance.soga_model_type, spawn->GetSize(), 
-				spawn->GetTotalHP(), spawn->appearance.heroic_flag, spawn->GetTotalPower(), spawn->GetCollisionRadius(), spawn->GetPrimaryCommandListID(), 
-				spawn->GetSecondaryCommandListID(), spawn->GetVisualState(), spawn->GetActionState(), spawn->GetMoodState(), spawn->GetInitialState(), 
-				spawn->GetActivityStatus(), ((NPC*)spawn)->GetAlignment(), spawn->GetFactionID(), spawn->appearance.hide_hood, spawn->appearance.emote_state, 
-				suffix.c_str(), prefix.c_str(), last_name.c_str(), spawn->GetMerchantMinLevel(), spawn->GetMerchantMaxLevel(), spawn->GetDatabaseID());
-		}
-		else if(spawn->IsObject()){
-			query.RunQuery2(Q_UPDATE, "update spawn_objects, spawn set name='%s', model_type=%i, show_name=%i, targetable=%i, size=%i, command_primary=%u, command_secondary=%u, visual_state=%i, attackable=%i, show_level=%i, show_command_icon=%i, display_hand_icon=%i, collision_radius=%i, hp = %u, power = %u, device_id = %i, merchant_min_level = %u, merchant_max_level = %u where spawn_objects.spawn_id = spawn.id and spawn.id = %u",
-				name.c_str(), spawn->GetModelType(), spawn->appearance.display_name, spawn->appearance.targetable, spawn->GetSize(), spawn->GetPrimaryCommandListID(), spawn->GetSecondaryCommandListID(), spawn->GetVisualState(), spawn->appearance.attackable, spawn->appearance.show_level, spawn->appearance.show_command_icon, spawn->appearance.display_hand_icon,
-				spawn->GetCollisionRadius(), spawn->GetTotalHP(), spawn->GetTotalPower(), ((Object*)spawn)->GetDeviceID(), spawn->GetMerchantMinLevel(), spawn->GetMerchantMaxLevel(), spawn->GetDatabaseID());
-		}
-		else if(spawn->IsWidget()){
-			Widget* widget = (Widget*)spawn;
-			char* openSound = 0;
-			char* closeSound = 0;
-			if (widget->GetOpenSound() != NULL) openSound = (char*)widget->GetOpenSound(); else openSound = (char*)string("0").c_str();
-			if (widget->GetCloseSound() != NULL) closeSound = (char*)widget->GetCloseSound(); else closeSound = (char*)string("0").c_str();
-			query.RunQuery2(Q_UPDATE, "update spawn_widgets, spawn set name='%s', race=%i, model_type=%i, show_name=%i, attackable=%i, show_level=%i, show_command_icon=%i, display_hand_icon=%i, size=%i, hp=%u, power=%u, collision_radius=%i, command_primary=%u, command_secondary=%u, visual_state=%i, faction_id=%u, suffix ='%s', prefix='%s', last_name='%s',widget_id = %u,widget_x = %f,widget_y = %f,widget_z = %f,include_heading = %u,include_location = %u,icon = %u,type='%s',open_heading = %f,closed_heading = %f,open_x = %f,open_y = %f,open_z = %f,action_spawn_id = %u,open_sound_file='%s',close_sound_file='%s',open_duration = %u,close_x = %f,close_y=%f,close_z=%f,linked_spawn_id = %u,house_id = %u, merchant_min_level = %u, merchant_max_level = %u where spawn_widgets.spawn_id = spawn.id and spawn.id = %u",
-				name.c_str(), spawn->GetRace(), spawn->GetModelType(), spawn->appearance.display_name, spawn->appearance.attackable, spawn->appearance.show_level, spawn->appearance.show_command_icon, spawn->appearance.display_hand_icon, spawn->GetSize(),
-				spawn->GetTotalHP(), spawn->GetTotalPower(), spawn->GetCollisionRadius(), spawn->GetPrimaryCommandListID(), spawn->GetSecondaryCommandListID(), spawn->GetVisualState(), spawn->GetFactionID(), 
-				suffix.c_str(), prefix.c_str(), last_name.c_str(), widget->GetWidgetID(), widget->GetX(), widget->GetY(), widget->GetZ(), widget->GetIncludeHeading(), widget->GetIncludeLocation(), widget->GetIconValue(), Widget::GetWidgetTypeNameByTypeID(widget->GetWidgetType()).c_str(),
-				widget->GetOpenHeading(), widget->GetClosedHeading(), widget->GetOpenX(), widget->GetOpenY(), widget->GetOpenZ(), 
-				widget->GetActionSpawnID(), openSound, closeSound,widget->GetOpenDuration(),
-				widget->GetCloseX(),widget->GetCloseY(),widget->GetCloseZ(),widget->GetLinkedSpawnID(),widget->GetHouseID(),
-				spawn->GetMerchantMinLevel(), spawn->GetMerchantMaxLevel(), spawn->GetDatabaseID());
-		}
-		else if(spawn->IsSign()){
-			Sign* sign = (Sign*)spawn;
-			query.RunQuery2(Q_UPDATE, "update spawn_signs, spawn set name='%s', race=%i, model_type=%i, show_name=%i, attackable=%i, show_level=%i, show_command_icon=%i, display_hand_icon=%i, size=%i, hp=%u, power=%u, collision_radius=%i, command_primary=%u, command_secondary=%u, visual_state=%i, faction_id=%u, suffix ='%s', prefix='%s', last_name='%s', type='%s', zone_id = %u, widget_id = %u, title='%s', widget_x = %f, widget_y = %f, widget_z = %f, icon = %u, description='%s', sign_distance = %f, zone_x = %f, zone_y = %f, zone_z = %f, zone_heading = %f, include_heading = %u, include_location = %u, merchant_min_level = %u, merchant_max_level = %u where spawn_signs.spawn_id = spawn.id and spawn.id = %u",
-				name.c_str(), spawn->GetRace(), spawn->GetModelType(), spawn->appearance.display_name, spawn->appearance.attackable, spawn->appearance.show_level, spawn->appearance.show_command_icon, spawn->appearance.display_hand_icon, spawn->GetSize(),
-				spawn->GetTotalHP(), spawn->GetTotalPower(), spawn->GetCollisionRadius(), spawn->GetPrimaryCommandListID(), spawn->GetSecondaryCommandListID(), spawn->GetVisualState(), spawn->GetFactionID(),
-				suffix.c_str(), prefix.c_str(), last_name.c_str(), sign->GetSignType(), sign->GetSignZoneID(), 
-				sign->GetWidgetID(), sign->GetSignTitle(), sign->GetWidgetX(), sign->GetWidgetY(), sign->GetWidgetZ(), 
-				sign->GetIconValue(), sign->GetSignDescription(), sign->GetSignDistance(), sign->GetSignZoneX(), 
-				sign->GetSignZoneY(), sign->GetSignZoneZ(), sign->GetSignZoneHeading(), sign->GetIncludeHeading(), 
-				sign->GetIncludeLocation(), spawn->GetMerchantMinLevel(), spawn->GetMerchantMaxLevel(), spawn->GetDatabaseID());
-		}
-	}
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(SPAWN__ERROR, 0, "Spawn", "Error in SaveSpawnInfo query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-int32 WorldDatabase::SaveCombinedSpawnLocation(ZoneServer* zone, Spawn* in_spawn, const char* name){
-	vector<Spawn*>* spawns = in_spawn->GetSpawnGroup();
-	uint32 spawnLocationID = 0;
-	if(spawns && spawns->size() > 0){
-		vector<Spawn*>::iterator itr;
-		map<Spawn*, int32>::iterator freq_itr;
-		Spawn* spawn = 0;
-		map<Spawn*, int32> database_spawns;
-		int32 total = 0;
-		float x_offset = GetSpawnLocationPlacementOffsetX(in_spawn->GetSpawnLocationID());
-		float y_offset = GetSpawnLocationPlacementOffsetY(in_spawn->GetSpawnLocationID());
-		float z_offset = GetSpawnLocationPlacementOffsetZ(in_spawn->GetSpawnLocationID());
-		int32 spawn_location_id = GetNextSpawnLocation();
-		spawnLocationID = spawn_location_id;
-		if(!name)
-			name = "Combine SpawnGroup Generated";
-		if(!CreateNewSpawnLocation(spawn_location_id, name)){
-			safe_delete(spawns);
-			return 0;
-		}
-		for(itr = spawns->begin();itr!=spawns->end();itr++){
-			spawn = *itr;
-			if (spawn) {
-				RemoveSpawnFromSpawnLocation(spawn);
-				spawn->SetSpawnLocationID(spawn_location_id);
-				bool add = true;
-				for (freq_itr = database_spawns.begin(); freq_itr != database_spawns.end(); freq_itr++) {
-					if (spawn->GetDatabaseID() == freq_itr->first->GetDatabaseID()) {
-						freq_itr->second++;
-						total++;
-						add = false;
-					}
-				}
-				if (add) {
-					database_spawns[spawn] = 1;
-					total++;
-				}
-			}
-		}
-		for(freq_itr = database_spawns.begin(); freq_itr != database_spawns.end(); freq_itr++){
-			int8 percent = (freq_itr->second*100)/total;
-			if(!SaveSpawnEntry(freq_itr->first, name, percent, x_offset, y_offset, z_offset, freq_itr->first == in_spawn, false)){
-				safe_delete(spawns);
-				return 0;
-			}
-		}
-		for(itr=spawns->begin();itr!=spawns->end();itr++){
-			spawn = *itr;
-			zone->RemoveSpawn(spawn, true, true, true, true, true);
-		}
-		safe_delete(spawns);
-	}
-	else{
-		safe_delete(spawns);
-		return 0;
-	}
-	return spawnLocationID;
-}
-
-bool WorldDatabase::SaveSpawnEntry(Spawn* spawn, const char* spawn_location_name, int8 percent, float x_offset, float y_offset, float z_offset, bool save_zonespawn, bool create_spawnlocation){
-	Query query;
-	Query query2;
-	int32 count = 0;
-	if(create_spawnlocation){
-		count = GetSpawnLocationCount(spawn->GetSpawnLocationID());
-		if(count == 0){
-			if(!CreateNewSpawnLocation(spawn->GetSpawnLocationID(), spawn_location_name))
-				return false;
-		}
-	}
-	query.RunQuery2(Q_INSERT, "insert into spawn_location_entry (spawn_id, spawn_location_id, spawnpercentage) values(%u, %u, %i)", spawn->GetDatabaseID(), spawn->GetSpawnLocationID(), percent);
-
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(SPAWN__ERROR, 0, "Spawn", "Error in SaveSpawnEntry query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	if(save_zonespawn){
-		query2.RunQuery2(Q_INSERT, "insert into spawn_location_placement (zone_id, instance_id, spawn_location_id, x, y, z, x_offset, y_offset, z_offset, heading, grid_id) values(%u, %u, %u, %f, %f, %f, %f, %f, %f, %f, %u)", spawn->GetZone()->GetZoneID(), spawn->GetZone()->GetInstanceID(), spawn->GetSpawnLocationID(), spawn->GetX(), spawn->GetY(), spawn->GetZ(),x_offset, y_offset, z_offset, spawn->GetHeading(), spawn->appearance.pos.grid_id);
-		if(query2.GetErrorNumber() && query2.GetError() && query2.GetErrorNumber() < 0xFFFFFFFF){
-			LogWrite(SPAWN__ERROR, 0, "Spawn", "Error in SaveSpawnEntry query '%s': %s", query2.GetQuery(), query2.GetError());
-			return false;
-		}
-		spawn->SetSpawnLocationPlacementID(query2.GetLastInsertedID());
-	}
-	return true;
-}
-
-float WorldDatabase::GetSpawnLocationPlacementOffsetX(int32 location_id) {
-	Query query;
-	MYSQL_ROW row;
-	float ret = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `x_offset` FROM `spawn_location_placement` WHERE `spawn_location_id`=%u", location_id);
-	if (result && (row = mysql_fetch_row(result))) {
-		if (row[0])
-			ret = atof(row[0]);
-	}
-	return ret;
-}
-
-float WorldDatabase::GetSpawnLocationPlacementOffsetY(int32 location_id) {
-	Query query;
-	MYSQL_ROW row;
-	float ret = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `y_offset` FROM `spawn_location_placement` WHERE `spawn_location_id`=%u", location_id);
-	if (result && (row = mysql_fetch_row(result))) {
-		if (row[0])
-			ret = atof(row[0]);
-	}
-	return ret;
-}
-
-float WorldDatabase::GetSpawnLocationPlacementOffsetZ(int32 location_id) {
-	Query query;
-	MYSQL_ROW row;
-	float ret = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `z_offset` FROM `spawn_location_placement` WHERE `spawn_location_id`=%u", location_id);
-	if (result && (row = mysql_fetch_row(result))) {
-		if (row[0])
-			ret = atof(row[0]);
-	}
-	return ret;
-}
-
-bool WorldDatabase::CreateNewSpawnLocation(int32 id, const char* name){
-	Query query;
-	if(!name)
-		name = "Unknown Spawn Location Name";
-	string str_name = getSafeEscapeString(name);
-	query.RunQuery2(Q_INSERT, "insert into spawn_location_name (id, name) values(%u, '%s')", id, str_name.c_str());
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(SPAWN__ERROR, 0, "Spawn", "Error in CreateNewSpawnLocation query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-int32 WorldDatabase::GetSpawnLocationCount(int32 location, Spawn* spawn){
-	Query query;
-	int32 ret = 0;
-	MYSQL_RES* result = 0;
-	if(spawn)
-		result = query.RunQuery2(Q_SELECT, "SELECT count(id) FROM spawn_location_entry where spawn_location_id=%u and spawn_id=%u", location, spawn->GetDatabaseID());
-	else
-		result = query.RunQuery2(Q_SELECT, "SELECT count(id) FROM spawn_location_entry where spawn_location_id=%u", location);
-	if(result && mysql_num_rows(result) > 0){
-		MYSQL_ROW row;
-		while(result && (row = mysql_fetch_row(result)) && row[0]){
-			ret = strtoul(row[0], NULL, 0);
-		}
-	}
-	return ret;
-}
-
-int32 WorldDatabase::GetNextSpawnLocation(){
-	Query query;
-	int32 ret = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT max(id) FROM spawn_location_name");
-	if(result && mysql_num_rows(result) > 0){
-		MYSQL_ROW row;
-		while(result && (row = mysql_fetch_row(result)) && row[0]){
-			ret = strtoul(row[0], NULL, 0);
-		}
-	}
-	ret++;
-	return ret;
-}
-
-bool WorldDatabase::RemoveSpawnFromSpawnLocation(Spawn* spawn){
-	Query query;
-	Query query2;
-	int32 count = GetSpawnLocationCount(spawn->GetSpawnLocationID(), spawn);
-
-	query.RunQuery2(Q_DELETE, "delete FROM spawn_location_placement where spawn_location_id=%u", spawn->GetSpawnLocationID());
-	if(count == 1)
-		query.RunQuery2(Q_DELETE, "delete FROM spawn_location_name where id=%u", spawn->GetSpawnLocationID());
-
-	query2.RunQuery2(Q_DELETE, "delete FROM spawn_location_entry where spawn_id=%u and spawn_location_id = %u", spawn->GetDatabaseID(), spawn->GetSpawnLocationID());
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in RemoveSpawnFromSpawnLocation query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	else if(query2.GetErrorNumber() && query2.GetError() && query2.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(SPAWN__ERROR, 0, "Spawn", "Error in RemoveSpawnFromSpawnLocation query '%s': %s", query2.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-map<int32, string>* WorldDatabase::GetZoneList(const char* name, bool is_admin)
-{
-	Query query;
-	map<int32, string>* ret = 0;
-	string zone_name = getSafeEscapeString(name);
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `id`, `name` FROM zones WHERE `name` RLIKE '%s' %s", zone_name.c_str(), (is_admin)?"":" LIMIT 0,10");
-	if(result && mysql_num_rows(result) > 0)
-	{
-		ret = new map<int32, string>;
-		MYSQL_ROW row;
-		while(result && (row = mysql_fetch_row(result)))
-		{
-			zone_name = row[1];
-			(*ret)[atoi(row[0])] = zone_name;
-		}
-	}
-
-	return ret;
-}
-
-void WorldDatabase::UpdateStartingFactions(int32 char_id, int8 choice){
-	Query query;
-	query.RunQuery2(Q_INSERT, "insert into character_factions (char_id, faction_id, faction_level) select %u, faction_id, value FROM starting_factions where starting_city=%i", char_id, choice);
-}
-
-string WorldDatabase::GetStartingZoneName(int8 choice){
-	Query query;
-	string zone_name = "";
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT name FROM zones where start_zone = %u", choice);
-	if(result && mysql_num_rows(result) > 0){
-		MYSQL_ROW row;
-		while(result && (row = mysql_fetch_row(result))){
-			zone_name = string(row[0]);
-		}	
-	}
-	return zone_name;
-}
-
-void WorldDatabase::UpdateStartingZone(int32 char_id, int8 class_id, int8 race_id, PacketStruct* create)
-{
-	Query query,query2;
-
-	int32 packetVersion = create->GetVersion();
-	int8 choice = create->getType_int8_ByName("starting_zone"); // 0 = far journey, 1 = isle of refuge
-	int8 deity = create->getType_int8_ByName("deity"); // aka 'alignment' for early DOF, 0 = evil, 1 = good
-	int32 startingZoneRuleFlag = rule_manager.GetGlobalRule(R_World, StartingZoneRuleFlag)->GetInt32();
-	
-	if((startingZoneRuleFlag == 1 || startingZoneRuleFlag == 2) && packetVersion > 546)
-	{
-		LogWrite(PLAYER__INFO, 0, "Player", "Starting zone rule flag %u override choice %u to deity value of 0", startingZoneRuleFlag, choice);
-		choice = 0;
-	}
-	
-	LogWrite(PLAYER__INFO, 0, "Player", "Adding default zone for race: %i, class: %i for char_id: %u (choice: %i), deity(alignment): %u, version: %u.", race_id, class_id, char_id, choice, deity, packetVersion);
-
-	// first, check to see if there is a starting_zones record for this race/class/choice combo (now using extended Archetype/BaseClass/Class combos
-	MYSQL_RES* result = 0;
-	
-	string whereRuleFlag("");
-	if(startingZoneRuleFlag > 0)
-		whereRuleFlag = string(" AND ruleflag & " + std::to_string(startingZoneRuleFlag));
-	
-	string syntaxSelect("SELECT z.name, sz.zone_id, z.safe_x, z.safe_y, z.safe_z, sz.x, sz.y, sz.z, sz.heading, sz.is_instance, z.city_zone FROM");
-	if ( class_id == 0 )
-		result = query.RunQuery2(Q_SELECT, "%s starting_zones sz, zones z WHERE sz.zone_id = z.id AND class_id = 255 AND race_id IN (%i, 255) AND deity IN (%i, 255) AND choice = %u AND (min_version = 0 or min_version <= %u) AND (max_version = 0 or max_version >= %u)%s",
-			syntaxSelect.c_str(), race_id, deity, choice, packetVersion, packetVersion, whereRuleFlag.c_str());
-		else
-			result = query.RunQuery2(Q_SELECT, "%s starting_zones sz, zones z WHERE sz.zone_id = z.id AND class_id IN (%i, %i, %i, 255) AND race_id IN (%i, 255) AND deity IN (%i, 255) AND choice IN (%i, 255) AND (min_version = 0 or min_version <= %u) AND (max_version = 0 or max_version >= %u)%s",
-		syntaxSelect.c_str(), classes.GetBaseClass(class_id), classes.GetSecondaryBaseClass(class_id), class_id, race_id, deity, choice, packetVersion, packetVersion, whereRuleFlag.c_str());
-
-	// TODO: verify client version so clients do not crash trying to enter zones they do not own (paks)
-	if(result && mysql_num_rows(result) > 0)
-	{
-		string zone_name = "ERROR";
-		MYSQL_ROW row;
-
-		bool zoneSet = false;
-
-		float safeX = 0.0f, safeY = 0.0f, safeZ = 0.0f, x = 0.0f, y = 0.0f, z = 0.0f, heading = 0.0f;
-		int8 is_instance = 0;
-		int32 zone_id = 0;
-		int32 instance_id = 0;
-		int8 starting_city = 0;
-
-		if( result && (row = mysql_fetch_row(result)) )
-		{
-			int8 i=0;
-
-			zoneSet = true;
-
-			zone_name = string(row[i++]);
-
-			zone_id = atoul(row[i++]);
-
-			safeX = atof(row[i++]);
-			safeY = atof(row[i++]);
-			safeZ = atof(row[i++]);
-
-			x = atof(row[i++]);
-			y = atof(row[i++]);
-			z = atof(row[i++]);
-
-			if ( x == -999999.0f && y == -999999.0f && z == -999999.0f)
-			{
-				x = safeX;
-				y = safeY;
-				z = safeZ;
-			}
-
-			heading = atof(row[i++]);
-
-			if(heading == -999999.0f )
-				heading = 0.0f;
-			
-			is_instance = atoul(row[i++]);
-
-			starting_city = atoul(row[i++]);
-		}
-
-		if(is_instance) // should only be true if we get a result
-		{
-			// this will force a pre-load
-			ZoneServer* instance_zone = zone_list.GetByInstanceID(0, zone_id);
-			if (instance_zone) {
-				instance_id = CreateNewInstance(zone_id);
-				AddCharacterInstance(char_id, instance_id, string(instance_zone->GetZoneName()), instance_zone->GetInstanceType(), Timer::GetUnixTimeStamp(), 0, instance_zone->GetDefaultLockoutTime(), instance_zone->GetDefaultReenterTime());
-				// make sure we inherit the instance id setup in the AddCharacterInstance
-				instance_zone->SetupInstance(instance_id);
-			}
-		}
-		
-		query2.RunQuery2(Q_UPDATE, "UPDATE characters SET current_zone_id = %u, x = %f, y = %f, z = %f, heading = %f, starting_city = %i, instance_id = %u WHERE id = %u", 
-			zone_id, x, y, z, heading, starting_city, instance_id, char_id);
-
-		if(query2.GetErrorNumber() && query2.GetError() && query2.GetErrorNumber() < 0xFFFFFFFF){
-			LogWrite(PLAYER__ERROR, 0, "Player", "Error in UpdateStartingZone custom starting_zones, query: '%s': %s", query2.GetQuery(), query2.GetError());
-			return;
-		}
-
-		if(query2.GetAffectedRows() > 0)
-		{
-			LogWrite(PLAYER__INFO, 0, "Player", "Setting New Character Starting Zone to '%s' with location %f, %f, %f and heading %f FROM starting_zones table.", zone_name.c_str(), x, y, z, heading);
-			return;
-		}
-	}
-	else
-	{
-		// there was no matching starting_zone value, so use default 'choice' starting city
-		query2.RunQuery2(Q_UPDATE, "UPDATE characters c, zones z SET c.current_zone_id = z.id, c.x = z.safe_x, c.y = z.safe_y, c.z = z.safe_z, c.starting_city = %i WHERE z.start_zone = %i and c.id = %u", 
-			choice, choice, char_id);
-
-		if(query2.GetErrorNumber() && query2.GetError() && query2.GetErrorNumber() < 0xFFFFFFFF)
-		{
-			LogWrite(PLAYER__ERROR, 0, "Player", "Error in UpdateStartingZone player choice, query: '%s': %s", query2.GetQuery(), query2.GetError());
-			return;
-		}
-
-		if(query2.GetAffectedRows() > 0)
-		{
-			LogWrite(PLAYER__DEBUG, 0, "Player", "Setting New Character Starting Zone to '%s' FROM player choice.", GetStartingZoneName(choice).c_str());
-			return;
-		}
-	}
-
-	// if we are here, it's a bad thing. zone tables have no start_city values to match client 'choice', so throw the player into zone according to R_World::DefaultStartingZoneID rule.
-	// shout a few warnings so the admin fixes this asap!
-	int16 default_zone_id = rule_manager.GetGlobalRule(R_World, DefaultStartingZoneID)->GetInt16();
-
-	LogWrite(WORLD__WARNING, 0, "World", "No Starting City defined for player choice: %i! BAD! BAD! BAD! Defaulting player to zone %i.", choice, default_zone_id);
-
-	query.RunQuery2(Q_UPDATE, "UPDATE characters c, zones z SET c.current_zone_id = z.id, c.x = z.safe_x, c.y = z.safe_y, c.z = z.safe_z, c.heading = z.safe_heading, c.starting_city = 1 WHERE z.id = %i and c.id = %u", default_zone_id, char_id);
-
- 	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-	{
-		LogWrite(PLAYER__ERROR, 0, "Player", "Error in UpdateStartingZone default zone %i, query: '%s': %s", default_zone_id, query.GetQuery(), query.GetError());
-		return;
- 	}
-
-	if (query.GetAffectedRows() > 0) {
-		string zone_name = GetZoneName(1);
-		if(zone_name.length() > 0)
-			LogWrite(PLAYER__DEBUG, 0, "Player", "Setting New Character Starting Zone to '%s' due to no valid options!", zone_name.c_str());
-		else
-			LogWrite(PLAYER__DEBUG, 0, "Player", "Unable to set New Character Starting Zone due to no valid options!");
-	}
-
-	return;
-}
-
-void WorldDatabase::UpdateStartingItems(int32 char_id, int8 class_id, int8 race_id, bool base_class){
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Adding default items for race: %i, class: %i for char_id: %u", race_id, class_id, char_id);
-	Query query;
-	Query query2;
-	vector<Item*> items;
-	vector<Item*> bags;
-	map<int32, int8> total_slots;
-	map<int32, int8> slots_left;
-	map<int8, bool> equip_slots;
-	map<Item*, StartingItem> item_list;
-	int32 item_id = 0;
-	Item* item = 0;
-	StartingItem* starting_item = 0;
-	//first get a list of the starting items for the character
-	MYSQL_RES* result = 0;
-	/*if(!base_class)
-		result = query2.RunQuery2(Q_SELECT, "SELECT `type`, item_id, creator, condition_, attuned, count FROM starting_items where (class_id=%i and race_id=%i) or (class_id=%i and race_id=255) or (class_id=255 and race_id=%i) or (class_id=255 and race_id=255) ORDER BY id", class_id, race_id, class_id, race_id);
-	else
-		result = query2.RunQuery2(Q_SELECT, "SELECT `type`, item_id, creator, condition_, attuned, count FROM starting_items where (class_id=%i and race_id=%i) or (class_id=%i and race_id=255) ORDER BY id", class_id, race_id, class_id);*/
-	result = query2.RunQuery2(Q_SELECT, "SELECT `type`, item_id, creator, condition_, attuned, count FROM starting_items WHERE class_id IN (%i, %i, %i, 255) AND race_id IN (%i, 255) ORDER BY id", classes.GetBaseClass(class_id), classes.GetSecondaryBaseClass(class_id), class_id, race_id);
-	if(result && mysql_num_rows(result) > 0){
-		MYSQL_ROW row;
-		while(result && (row = mysql_fetch_row(result))){
-			item_id = atoul(row[1]);
-			item = master_item_list.GetItem(item_id);
-			if(item){
-				starting_item = &(item_list[item]);
-				starting_item->type = (row[0]) ? string(row[0]) : "";
-				starting_item->item_id = atoul(row[1]);
-				starting_item->creator = (row[2]) ? string(row[2]) : "";
-				starting_item->condition = atoi(row[3]);
-				starting_item->attuned = atoi(row[4]);
-				starting_item->count = atoi(row[5]);
-				item = master_item_list.GetItem(starting_item->item_id);
-				if(item){
-					if(bags.size() < NUM_INV_SLOTS && item->IsBag() && item->details.num_slots > 0)
-						bags.push_back(item);
-					else
-						items.push_back(item);
-				}
-			}
-		}
-	}
-	slots_left[0] = NUM_INV_SLOTS;
-	//next create the bags in the inventory
-	for(int8 i=0;i<bags.size();i++){
-		item = bags[i];
-		query.RunQuery2(Q_INSERT, "insert into character_items (char_id, type, slot, item_id, creator, condition_, attuned, bag_id, count) values(%u, '%s', %i, %u, '%s', %i, %i, %u, %i)",
-			char_id, item_list[item].type.c_str(), i, item_list[item].item_id, getSafeEscapeString(item_list[item].creator.c_str()).c_str(), item_list[item].condition, item_list[item].attuned, 0, item_list[item].count);
-		slots_left[query.GetLastInsertedID()] = item->details.num_slots;
-		total_slots[query.GetLastInsertedID()] = item->details.num_slots;
-		slots_left[0]--;
-	}
-	map<int32, int8>::iterator itr;
-	int32 inv_slot = 0;
-	int8  slot = 0;
-	//finally process the rest of the items, placing them in the first available slot
-	for(int32 x=0;x<items.size();x++){
-		item = items[x];
-		if(item_list[item].type.find("NOT") < 0xFFFFFFFF){ // NOT-EQUIPPED Items
-			for(itr = slots_left.begin(); itr != slots_left.end(); itr++){
-				if(itr->second > 0){
-					if(itr->first == 0 && slots_left.size() > 1) //we want items to go into bags first, then inventory after bags are full
-						continue;
-					inv_slot = itr->first;
-					slot = total_slots[itr->first] - itr->second;
-					itr->second--;
-					if(itr->second == 0)
-						slots_left.erase(itr);
-					break;
-				}
-			}
-			query.RunQuery2(Q_INSERT, "insert into character_items (char_id, type, slot, item_id, creator, condition_, attuned, bag_id, count) values(%u, '%s', %i, %u, '%s', %i, %i, %u, %i)",
-				char_id, item_list[item].type.c_str(), slot, item_list[item].item_id, getSafeEscapeString(item_list[item].creator.c_str()).c_str(), item_list[item].condition, item_list[item].attuned, inv_slot, item_list[item].count);		
-		}
-		else{ //EQUIPPED Items
-			for(int8 i=0;i<item->slot_data.size();i++){
-				if(equip_slots.count(item->slot_data[i]) == 0){
-					equip_slots[item->slot_data[i]] = true;
-					query.RunQuery2(Q_INSERT, "insert into character_items (char_id, type, slot, item_id, creator, condition_, attuned, bag_id, count) values(%u, '%s', %i, %u, '%s', %i, %i, %u, %i)",
-						char_id, item_list[item].type.c_str(), item->slot_data[i], item_list[item].item_id, getSafeEscapeString(item_list[item].creator.c_str()).c_str(), item_list[item].condition, item_list[item].attuned, 0, item_list[item].count);
-					break;
-				}
-			}
-		}
-	}
-}
-
-void WorldDatabase::UpdateStartingSkills(int32 char_id, int8 class_id, int8 race_id)
-{
-	Query query;
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Adding default skills for race: %i, class: %i for char_id: %u", race_id, class_id, char_id);
-	query.RunQuery2(Q_INSERT, "INSERT IGNORE INTO character_skills (char_id, skill_id, current_val, max_val) SELECT %u, skill_id, current_val, max_val FROM starting_skills WHERE class_id IN (%i, %i, %i, 255) AND race_id IN (%i, 255)", 
-		char_id, classes.GetBaseClass(class_id), classes.GetSecondaryBaseClass(class_id), class_id, race_id);
-}
-
-void WorldDatabase::UpdateStartingSpells(int32 char_id, int8 class_id, int8 race_id){
-	Query query;
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Adding default spells for race: %i, class: %i for char_id: %u", race_id, class_id, char_id);
-	query.RunQuery2(Q_INSERT, "INSERT IGNORE INTO character_spells (char_id, spell_id, tier, knowledge_slot) SELECT %u, spell_id, tier, knowledge_slot FROM starting_spells WHERE class_id IN (%i, %i, %i, 255) AND race_id IN (%i, 255)", 
-		char_id, classes.GetBaseClass(class_id), classes.GetSecondaryBaseClass(class_id), class_id, race_id);
-}
-
-void WorldDatabase::UpdateStartingSkillbar(int32 char_id, int8 class_id, int8 race_id){
-	Query query;
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Adding default skillbar for race: %i, class: %i for char_id: %u", race_id, class_id, char_id);
-	query.RunQuery2(Q_INSERT, "INSERT IGNORE INTO character_skillbar (char_id, type, hotbar, spell_id, slot, text_val) SELECT %u, type, hotbar, spell_id, slot, text_val FROM starting_skillbar WHERE class_id IN (%i, %i, %i, 255) AND race_id IN (%i, 255)", 
-		char_id, classes.GetBaseClass(class_id), classes.GetSecondaryBaseClass(class_id), class_id, race_id);
-}
-
-void WorldDatabase::UpdateStartingTitles(int32 char_id, int8 class_id, int8 race_id, int8 gender_id) {
-	Query query;
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Adding default titles for race: %i, class: %i, gender: %i for char_id: %u", race_id, class_id, gender_id, char_id);
-	query.RunQuery2(Q_INSERT, "INSERT IGNORE INTO character_titles (char_id, title_id) SELECT %u, title_id FROM  starting_titles WHERE class_id IN (%i, %i, %i, 255) AND race_id IN (%i, 255) and gender_id IN (%i, 255)", 
-		char_id, classes.GetBaseClass(class_id), classes.GetSecondaryBaseClass(class_id), class_id, race_id, gender_id);
-}
-
-string WorldDatabase::GetZoneDescription(int32 id){
-	Query query;
-	string ret = "";
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT description FROM zones where id = %u", id);
-	if(result && mysql_num_rows(result) > 0){
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		ret = string(row[0]);
-	}
-	return ret;
-}
-
-string WorldDatabase::GetZoneName(int32 id){
-	if (zone_names.count(id) > 0){
-		return zone_names[id];
-	}
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `name` FROM zones where `id` = %u", id);
-	if(result && mysql_num_rows(result) > 0){
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		zone_names[id] = row[0];
-		return zone_names[id];
-	}
-	return string("");
-}
-
-bool WorldDatabase::VerifyZone(const char* name){
-	Query query;
-	char* escaped = getEscapeString(name);
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT name FROM zones where name='%s'",escaped);
-	safe_delete_array(escaped);
-	if(result && mysql_num_rows(result) > 0)
-		return true;
-	else
-		return false;
-}
-
-int8 WorldDatabase::GetInstanceTypeByZoneID(int32 zoneID)
-{
-
-	std::map<int32, int8>::iterator itr = zone_instance_types.find(zoneID);
-	if(itr != zone_instance_types.end())
-		return itr->second;
-	
-	DatabaseResult result;
-	int8 ret = 0;
-
-	LogWrite(INSTANCE__DEBUG, 0, "Instance", "Getting instances for zone_id %u", zoneID);
-
-	if( !database_new.Select(&result, "SELECT instance_type+0 FROM zones WHERE id = %u", zoneID) )
-	{
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in GetInstanceTypeByZoneID() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-		return ret;
-	}
-
-	if( result.GetNumRows() > 0 )
-	{
-		result.Next();
-		ret = (result.GetInt8Str("instance_type+0") == 0) ? 0 : result.GetInt8Str("instance_type+0") - 1;
-		zone_instance_types.insert(make_pair(zoneID, ret));
-		LogWrite(INSTANCE__DEBUG, 0, "Instance", "Found instance type %i for zone_id %u", ret, zoneID);
-	}
-	else
-		LogWrite(INSTANCE__DEBUG, 0, "Instance", "No instances found for zone_id %u", zoneID);
-
-	return ret;
-}
-
-void WorldDatabase::Save(Client* client){
-	Query query;
-	Player* player = client->GetPlayer();
-	if(!player->CheckPlayerInfo())
-		return;
-
-	int32 instance_id = 0;
-	if ( client->GetCurrentZone ( ) != NULL )
-		instance_id = client->GetCurrentZone()->GetInstanceID();
-
-	int32 zone_id = 0;
-	if(client->GetCurrentZone())
-		zone_id = client->GetCurrentZone()->GetZoneID();
-	query.AddQueryAsync(client->GetCharacterID(), this, Q_UPDATE, "update characters set current_zone_id=%u, x=%f, y=%f, z=%f, heading=%f, level=%i,instance_id=%i,last_saved=%i, `class`=%i, `tradeskill_level`=%i, `tradeskill_class`=%i, `group_id`=%u where id = %u", zone_id, player->GetX(), player->GetY(), player->GetZ(), player->GetHeading(), player->GetLevel(), instance_id, client->GetLastSavedTimeStamp(), client->GetPlayer()->GetAdventureClass(), client->GetPlayer()->GetTSLevel(), client->GetPlayer()->GetTradeskillClass(), client->GetPlayer()->GetGroupMemberInfo() ? client->GetPlayer()->GetGroupMemberInfo()->group_id : client->GetRejoinGroupID(), client->GetCharacterID());
-	query.AddQueryAsync(client->GetCharacterID(), this, Q_UPDATE, "update character_details set hp=%u, power=%u, str=%i, sta=%i, agi=%i, wis=%i, intel=%i, heat=%i, cold=%i, magic=%i, mental=%i, divine=%i, disease=%i, poison=%i, coin_copper=%u, coin_silver=%u, coin_gold=%u, coin_plat=%u, max_hp = %u, max_power=%u, xp = %u, xp_needed = %u, xp_debt = %f, xp_vitality = %f, tradeskill_xp = %u, tradeskill_xp_needed = %u, tradeskill_xp_vitality = %f, bank_copper = %u, bank_silver = %u, bank_gold = %u, bank_plat = %u, status_points = %u, bind_zone_id=%u, bind_x = %f, bind_y = %f, bind_z = %f, bind_heading = %f, house_zone_id=%u, combat_voice = %i, emote_voice = %i, biography='%s', flags=%u, flags2=%u, last_name='%s', assigned_aa = %i, unassigned_aa = %i, tradeskill_aa = %i, unassigned_tradeskill_aa = %i, prestige_aa = %i, unassigned_prestige_aa = %i, tradeskill_prestige_aa = %i, unassigned_tradeskill_prestige_aa = %i where char_id = %u",
-		player->GetHP(), player->GetPower(), player->GetStrBase(), player->GetStaBase(), player->GetAgiBase(), player->GetWisBase(), player->GetIntBase(), player->GetHeatResistanceBase(), player->GetColdResistanceBase(), player->GetMagicResistanceBase(),
-		player->GetMentalResistanceBase(), player->GetDivineResistanceBase(), player->GetDiseaseResistanceBase(), player->GetPoisonResistanceBase(), player->GetCoinsCopper(), player->GetCoinsSilver(), player->GetCoinsGold(), player->GetCoinsPlat(), player->GetTotalHPBase(), player->GetTotalPowerBase(), player->GetXP(), player->GetNeededXP(), player->GetXPDebt(), player->GetXPVitality(), player->GetTSXP(), player->GetNeededTSXP(), player->GetTSXPVitality(), player->GetBankCoinsCopper(),
-		player->GetBankCoinsSilver(), player->GetBankCoinsGold(), player->GetBankCoinsPlat(), player->GetStatusPoints(), client->GetPlayer()->GetPlayerInfo()->GetBindZoneID(), client->GetPlayer()->GetPlayerInfo()->GetBindZoneX(), client->GetPlayer()->GetPlayerInfo()->GetBindZoneY(), client->GetPlayer()->GetPlayerInfo()->GetBindZoneZ(), client->GetPlayer()->GetPlayerInfo()->GetBindZoneHeading(), client->GetPlayer()->GetPlayerInfo()->GetHouseZoneID(), 
-		client->GetPlayer()->GetCombatVoice(), client->GetPlayer()->GetEmoteVoice(), getSafeEscapeString(client->GetPlayer()->GetBiography().c_str()).c_str(), player->GetFlags(), player->GetFlags2(), client->GetPlayer()->GetLastName(), 
-		client->GetPlayer()->GetAssignedAA(), client->GetPlayer()->GetUnassignedAA(), client->GetPlayer()->GetTradeskillAA(), client->GetPlayer()->GetUnassignedTradeskillAA(), client->GetPlayer()->GetPrestigeAA(), 
-		client->GetPlayer()->GetUnassignedPretigeAA(), client->GetPlayer()->GetTradeskillPrestigeAA(), client->GetPlayer()->GetUnassignedTradeskillPrestigeAA(), client->GetCharacterID());
-	map<string, int8>::iterator itr;
-	map<string, int8>* friends = player->GetFriends();
-	if(friends && friends->size() > 0){
-		for(itr = friends->begin(); itr != friends->end(); itr++){
-			if(itr->second == 1){
-				query.AddQueryAsync(client->GetCharacterID(), this, Q_INSERT, "insert ignore into character_social (char_id, name, type) values(%u, '%s', 'FRIEND')", client->GetCharacterID(), getSafeEscapeString(itr->first.c_str()).c_str());
-				itr->second = 0;
-			}
-			else if(itr->second == 2){
-				query.AddQueryAsync(client->GetCharacterID(), this, Q_DELETE, "delete FROM character_social where char_id = %u and name = '%s'", client->GetCharacterID(), getSafeEscapeString(itr->first.c_str()).c_str());
-				itr->second = 3;
-			}
-		}
-	}
-	map<string, int8>* ignored = player->GetIgnoredPlayers();
-	if(ignored && ignored->size() > 0){
-		for(itr = ignored->begin(); itr != ignored->end(); itr++){
-			if(itr->second == 1){
-				query.AddQueryAsync(client->GetCharacterID(), this, Q_INSERT, "insert ignore into character_social (char_id, name, type) values(%u, '%s', 'IGNORE')", client->GetCharacterID(), getSafeEscapeString(itr->first.c_str()).c_str());
-				itr->second = 0;
-			}
-			else if(itr->second == 2){
-				query.AddQueryAsync(client->GetCharacterID(), this, Q_DELETE, "delete FROM character_social where char_id = %u and name = '%s'", client->GetCharacterID(), getSafeEscapeString(itr->first.c_str()).c_str());
-				itr->second = 3;
-			}
-		}
-	}
-	SavePlayerFactions(client);
-	SaveCharacterQuests(client);
-	SaveCharacterSkills(client);
-	SavePlayerSpells(client);
-	SavePlayerMail(client);
-	SavePlayerCollections(client);
-
-	LogWrite(PLAYER__INFO, 3, "Player", "Player '%s' (%u) data saved.", player->GetName(), player->GetCharacterID());
-}
-
-void WorldDatabase::LoadEntityCommands(ZoneServer* zone) {
-	int32 total = 0;
-	int32 id = 0;
-	EntityCommand* command = 0;
-
-	DatabaseResult result;
-	if (!database_new.Select(&result, "SELECT `command_list_id`, `command_text`, `distance`, `command`, `error_text`, `cast_time`, `spell_visual` FROM `entity_commands` ORDER BY `id`")) {
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "MySQL Error %u: %s", database_new.GetError(), database_new.GetErrorMsg());
-		return;
-	}
-
-	while (result.Next()) {
-		command = new EntityCommand;
-
-		id = result.GetInt32(0);
-		command->name = result.GetString(1);
-		command->distance = result.GetFloat(2);
-		command->command = result.GetString(3);
-		command->error_text = result.GetString(4);
-		command->cast_time = result.GetInt16(5);
-		command->spell_visual = result.GetInt32(6);
-		command->default_allow_list = true;
-
-		zone->SetEntityCommandList(id, command);
-		LogWrite(COMMAND__DEBUG, 5, "Command", "---Loading Command: '%s' (%s)", command->name.c_str(), command->command.c_str());
-
-		total++;
-	}
-	LogWrite(COMMAND__DEBUG, 0, "Command", "--Loaded %i entity command(s)", total);
-}
-
-void WorldDatabase::LoadFactionAlliances() 
-{
-	LogWrite(FACTION__DEBUG, 1, "Faction", "-Loading faction alliances...");
-	int32 total = 0;
-	int32 fTotal = 0;
-	int32 hTotal = 0;
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT faction_id, friend_faction, hostile_faction FROM faction_alliances");
-
-	if(result && mysql_num_rows(result) > 0) 
-	{
-		MYSQL_ROW row;
-		int32 faction_id = 0;
-		int32 friendly_id = 0;
-		int32 hostile_id = 0;
-
-		while(result && (row = mysql_fetch_row(result)))
-		{
-			faction_id = atoul(row[0]);
-			friendly_id = atoul(row[1]);
-			hostile_id = atoul(row[2]);
-
-			if(friendly_id > 0) 
-			{
-				master_faction_list.AddFriendlyFaction(faction_id, friendly_id);
-				fTotal++;
-				LogWrite(FACTION__DEBUG, 5, "Faction", "---Faction %i is friendly towards %i", faction_id, friendly_id);
-			}
-			if(hostile_id > 0) 
-			{
-				master_faction_list.AddHostileFaction(faction_id, hostile_id);
-				hTotal++;
-				LogWrite(FACTION__DEBUG, 5, "Faction", "---Faction %i is hostile towards %i", faction_id, hostile_id);
-			}
-			total++;
-		}
-	}
-	LogWrite(FACTION__DEBUG, 3, "Faction", "--Loaded %u Alliances: %i friendly, %i hostile", total, fTotal, hTotal);
-}
-
-bool WorldDatabase::UpdateSpawnScriptData(int32 spawn_id, int32 spawn_location_id, int32 spawnentry_id, const char* name){
-	bool ret = false;
-	if((spawn_id > 0 || spawn_location_id > 0 || spawnentry_id > 0) && name){
-		Query query;
-		int32 row_id = 0;
-		if(spawn_id > 0){
-			query.RunQuery2(Q_DELETE, "DELETE FROM spawn_scripts where spawn_id=%u", spawn_id);
-			query.RunQuery2(Q_INSERT, "INSERT into spawn_scripts (spawn_id, lua_script) values(%u, '%s')", spawn_id, getSafeEscapeString(name).c_str());
-			if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-				LogWrite(LUA__ERROR, 0, "LUA", "Error in UpdateSpawnScriptData, Query: %s, Error: %s", query.GetQuery(), query.GetError());
-			else{
-				row_id = query.GetLastInsertedID();
-				if(row_id > 0)
-					world.AddSpawnScript(row_id, name);
-				ret = true;
-			}
-		}
-		else if(spawn_location_id > 0){
-			query.RunQuery2(Q_DELETE, "DELETE FROM spawn_scripts where spawn_location_id=%u", spawn_location_id);
-			query.RunQuery2(Q_INSERT, "INSERT into spawn_scripts (spawn_location_id, lua_script) values(%u, '%s')", spawn_location_id, getSafeEscapeString(name).c_str());
-			if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-				LogWrite(LUA__ERROR, 0, "LUA", "Error in UpdateSpawnScriptData, Query: %s, Error: %s", query.GetQuery(), query.GetError());
-			else{
-				row_id = query.GetLastInsertedID();
-				if(row_id > 0)
-					world.AddSpawnLocationScript(row_id, name);
-				ret = true;
-			}
-		}
-		else if(spawnentry_id > 0){
-			query.RunQuery2(Q_DELETE, "DELETE FROM spawn_scripts where spawnentry_id=%u", spawnentry_id);
-			query.RunQuery2(Q_INSERT, "INSERT into spawn_scripts (spawnentry_id, lua_script) values(%u, '%s')", spawnentry_id, getSafeEscapeString(name).c_str());
-			if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-				LogWrite(LUA__ERROR, 0, "LUA", "Error in UpdateSpawnScriptData, Query: %s, Error: %s", query.GetQuery(), query.GetError());
-			else{
-				row_id = query.GetLastInsertedID();
-				if(row_id > 0)
-					world.AddSpawnEntryScript(row_id, name);
-				ret = true;
-			}
-		}
-	}
-	return ret;
-}
-
-void WorldDatabase::LoadSpawnScriptData() {
-	int32 total = 0;
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT spawn_id, spawnentry_id, spawn_location_id, lua_script FROM spawn_scripts");
-	if(result && mysql_num_rows(result) > 0) 
-	{
-		MYSQL_ROW row;
-		int32 spawn_id = 0;
-		int32 spawnentry_id = 0;
-		int32 spawn_location_id = 0;
-
-		while(result && (row = mysql_fetch_row(result))) 
-		{
-			spawn_id = atoul(row[0]);
-			spawnentry_id = atoul(row[1]);
-			spawn_location_id = atoul(row[2]);
-			string spawn_script = string(row[3]);
-
-			if(spawnentry_id > 0) 
-			{
-				world.AddSpawnEntryScript(spawnentry_id, row[3]);
-				total++;
-			}
-			else if(spawn_location_id > 0) 
-			{
-				world.AddSpawnLocationScript(spawn_location_id, row[3]);
-				total++;
-			}
-			else if(spawn_id > 0) 
-			{
-				world.AddSpawnScript(spawn_id, row[3]);
-				total++;
-			}
-			else {
-				if(row[3])
-					LogWrite(LUA__ERROR, 0, "LUA", "Invalid Entry in spawn_scripts table for lua_script '%s' (spawn_id, spawnentry_id and spawn_location_id are all 0)", row[3]);
-				else
-					LogWrite(LUA__ERROR, 0, "LUA", "Invalid Entry in spawn_scripts table.");
-			}
-
-			spawn_id = 0;
-			spawnentry_id = 0;
-			spawn_location_id = 0;
-		}
-	}
-	LogWrite(LUA__DEBUG, 0, "LUA", "\tLoaded %u SpawnScript%s", total, total == 1 ? "" : "s");
-}
-
-void WorldDatabase::LoadZoneScriptData() {
-	Query query;
-	int32 total = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `id`, `lua_script` FROM `zones`");
-	if (result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		while(result && (row = mysql_fetch_row(result))) {
-			if (row[1]) {
-				int32 zone_id = atoul(row[0]);
-				string zone_script = string(row[1]);
-				if (zone_id > 0 && zone_script.length() > 0) {
-
-					LogWrite(LUA__DEBUG, 5, "LUA", "ZoneScript: %s loaded.", zone_script.c_str());
-
-					world.AddZoneScript(zone_id, zone_script.c_str());
-					total++;
-				}
-				else if (zone_id > 0) {
-					
-					string tmpScript;
-					tmpScript.append("ZoneScripts/");
-					string zonename = GetZoneName(zone_id);
-					tmpScript.append(zonename);
-					tmpScript.append(".lua");
-					struct stat buffer;
-					bool fileExists = (stat(tmpScript.c_str(), &buffer) == 0);
-					if (fileExists)
-					{
-						LogWrite(LUA__INFO, 0, "LUA", "No zonescript file described in the database, overriding with ZoneScript %s for Zone ID %u", (char*)tmpScript.c_str(), zone_id);
-						world.AddZoneScript(zone_id, tmpScript.c_str());
-					}
-				}
-			}
-		}
-	}
-	LogWrite(LUA__DEBUG, 0, "LUA", "\tLoaded %u ZoneScript%s", total, total == 1 ? "" : "s");
-}
-
-int32 WorldDatabase::LoadSpellScriptData() {
-	Query query;
-	MYSQL_ROW row;
-	int32 count;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `lua_script` FROM `spells`"); //  WHERE is_active = 1
-
-	while (result && (row = mysql_fetch_row(result))) {
-		if (row[0] && strlen(row[0]) > 0) {
-			if (lua_interface->LoadLuaSpell(row[0]))
-				LogWrite(SPELL__DEBUG, 5, "Spells", "SpellScript: %s loaded.", row[0]);
-		}
-	}
-
-	count = mysql_num_rows(result);
-	LogWrite(SPELL__DEBUG, 0, "Spells", "\tLoaded %i SpellScript%s", count, count == 1 ? "" : "s");
-
-	return count;
-}
-
-void WorldDatabase::LoadFactionList() {
-	int32 total = 0;
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, name, type, description, default_level, negative_change, positive_change FROM factions");
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		Faction* faction = 0;
-		while(result && (row = mysql_fetch_row(result))){
-			faction = new Faction;
-			faction->id = atoul(row[0]);
-			faction->name = string(row[1]);
-			faction->type = string(row[2]);
-			faction->description = string(row[3]);
-			faction->default_value = atoi(row[4]);
-			faction->negative_change = atoi(row[5]);
-			faction->positive_change = atoi(row[6]);
-			master_faction_list.AddFaction(faction);
-			total++;
-			LogWrite(FACTION__DEBUG, 5, "Faction", "---Loading Faction '%s' (%u)", faction->name.c_str(), faction->id);
-		}
-	}
-	LogWrite(FACTION__DEBUG, 3, "Faction", "--Loaded %u Faction%s", total, total == 1 ? "" : "s");
-	LoadFactionAlliances();
-}
-
-void WorldDatabase::SavePlayerFactions(Client* client){
-	LogWrite(PLAYER__DEBUG, 3, "Player", "Saving Player Factions...");
-	
-	Query query;
-	map<int32, sint32>* factions = client->GetPlayer()->GetFactions()->GetFactionValues();
-	map<int32, sint32>::iterator itr;
-	for(itr = factions->begin(); itr != factions->end(); itr++)
-		query.AddQueryAsync(client->GetCharacterID(), this,Q_INSERT, "insert into character_factions (char_id, faction_id, faction_level) values(%u, %u, %i) ON DUPLICATE KEY UPDATE faction_level=%i", client->GetCharacterID(), itr->first, itr->second, itr->second);
-}
-
-bool WorldDatabase::LoadPlayerFactions(Client* client) {
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Loading Player Factions...");
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT faction_id, faction_level FROM character_factions where char_id=%i", client->GetCharacterID());
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		while(result && (row = mysql_fetch_row(result))){
-			client->GetPlayer()->GetFactions()->SetFactionValue(atoul(row[0]), atol(row[1]));
-		}
-	}
-	if(query.GetErrorNumber())
-		return false;
-
-	return true;
-}
-
-void WorldDatabase::SavePlayerMail(Mail* mail) {
-	Query query_update;
-	Query query_insert;
-	if (mail) {
-		if(mail->mail_id > 0)
-			query_update.RunQuery2(Q_UPDATE, "UPDATE `character_mail` SET `already_read`=%u, `coin_copper`=%u, `coin_silver`=%u, `coin_gold`=%u, `coin_plat`=%u, `char_item_id`=%u, `stack`=%u WHERE `id`=%u", mail->already_read, mail->coin_copper, mail->coin_silver, mail->coin_gold, mail->coin_plat, mail->char_item_id, mail->stack, mail->mail_id);
-		else if (mail->mail_id == 0 || query_update.GetAffectedRows() == 0)
-		{
-			query_insert.RunQuery2(Q_INSERT, "INSERT INTO `character_mail` (`player_to_id`, `player_from`, `subject`, `mail_body`, `already_read`, `mail_type`, `coin_copper`, `coin_silver`, `coin_gold`, `coin_plat`, `stack`, `postage_cost`, `attachment_cost`, `char_item_id`, `time_sent`, `expire_time`) VALUES (%u, '%s', '%s', '%s', %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u)", mail->player_to_id, mail->player_from.c_str(), getSafeEscapeString(mail->subject.c_str()).c_str(), getSafeEscapeString(mail->mail_body.c_str()).c_str(), mail->already_read, mail->mail_type, mail->coin_copper, mail->coin_silver, mail->coin_gold, mail->coin_plat, mail->stack, mail->postage_cost, mail->attachment_cost, mail->char_item_id, mail->time_sent, mail->expire_time);
-			
-			if(!mail->mail_id)
-				mail->mail_id = query_insert.GetLastInsertedID();
-		}
-		mail->save_needed = false;
-	}
-}
-
-void WorldDatabase::SavePlayerMail(Client* client) {
-	if (client) {
-		MutexMap<int32, Mail*>* mail_list = client->GetPlayer()->GetMail();
-		MutexMap<int32, Mail*>::iterator itr = mail_list->begin();
-		while (itr.Next()) {
-			Mail* mail = itr->second;
-			if (mail->save_needed)
-				SavePlayerMail(mail);
-		}
-	}
-}
-
-void WorldDatabase::LoadPlayerMail(Client* client, bool new_only) {
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Loading Player Mail...");
-	if (client) {
-		Query query;
-		MYSQL_RES* result;
-		if (new_only)
-			result = query.RunQuery2(Q_SELECT, "SELECT `id`, `player_to_id`, `player_from`, `subject`, `mail_body`, `already_read`, `mail_type`, `coin_copper`, `coin_silver`, `coin_gold`, `coin_plat`, `stack`, `postage_cost`, `attachment_cost`, `char_item_id`, `time_sent`, `expire_time` FROM `character_mail` WHERE `player_to_id`=%u AND `unread`=1", client->GetCharacterID());
-		else
-			result = query.RunQuery2(Q_SELECT, "SELECT `id`, `player_to_id`, `player_from`, `subject`, `mail_body`, `already_read`, `mail_type`, `coin_copper`, `coin_silver`, `coin_gold`, `coin_plat`, `stack`, `postage_cost`, `attachment_cost`, `char_item_id`, `time_sent`, `expire_time` FROM `character_mail` WHERE `player_to_id`=%u", client->GetCharacterID());
-		if (result && mysql_num_rows(result) > 0) {
-			MYSQL_ROW row;
-			bool hasMail = false;
-			while (result && (row = mysql_fetch_row(result))) {
-
-				int32 time_sent = atoul(row[15]);
-				if ( time_sent > Timer::GetUnixTimeStamp() )
-					continue; // should have not been received yet
-
-
-				hasMail = true;
-				Mail* mail = new Mail;
-				mail->mail_id = atoul(row[0]);
-				mail->player_to_id = atoul(row[1]);
-				mail->player_from = string(row[2]);
-				mail->subject = string(row[3]);
-				if (row[4])
-					mail->mail_body = string(row[4]);
-				mail->already_read = atoi(row[5]);
-				mail->mail_type = atoi(row[6]);
-				mail->coin_copper = atoul(row[7]);
-				mail->coin_silver = atoul(row[8]);
-				mail->coin_gold = atoul(row[9]);
-				mail->coin_plat = atoul(row[10]);
-				mail->stack = atoi(row[11]);
-				mail->postage_cost = atoul(row[12]);
-				mail->attachment_cost = atoul(row[13]);
-				mail->char_item_id = atoul(row[14]);
-				mail->time_sent = time_sent;
-				mail->expire_time = atoul(row[16]);
-				mail->save_needed = false;
-				client->GetPlayer()->AddMail(mail);
-
-				LogWrite(PLAYER__DEBUG, 5, "Player", "Loaded Mail ID %i, to: %i, from: %s", atoul(row[0]), atoul(row[1]), string(row[2]).c_str());
-
-			}
-			
-			if(hasMail)
-				client->SimpleMessage(CHANNEL_NARRATIVE, "You've got mail! :)");
-		}
-	}
-}
-
-void WorldDatabase::DeletePlayerMail(Mail* mail) {
-	Query query;
-	if (mail)
-		query.RunQuery2(Q_DELETE, "DELETE FROM `character_mail` WHERE `id`=%u", mail->mail_id);
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Delete Player Mail...");
-}
-
-vector<int32>* WorldDatabase::GetAllPlayerIDs() {
-	Query query;
-	vector<int32>* ids = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `id` FROM `characters`");
-	MYSQL_ROW row;
-	while (result && (row = mysql_fetch_row(result))) {
-		if (ids == 0)
-			ids = new vector<int32>;
-		ids->push_back(atoul(row[0]));
-	}
-	return ids;
-}
-
-void WorldDatabase::GetPetNames(ZoneServer* zone) 
-{
-	DatabaseResult result;
-	int32 total = 0;
-
-	if( database_new.Select(&result, "SELECT pet_name FROM spawn_pet_names") )
-	{
-		while(result.Next())
-		{
-			zone->pet_names.push_back(result.GetStringStr("pet_name"));
-			total++;
-			LogWrite(PET__DEBUG, 5, "Pet", "---Loading Pet Name: '%s'", result.GetStringStr("pet_name"));
-		}
-		LogWrite(PET__DEBUG, 0, "Pet", "--Loaded %u Pet Names", total);
-	}
-}
-
-int32 WorldDatabase::CheckTableVersions(char* tablename) {
-	Query query;
-	char* escaped_name = getEscapeString(tablename);
-	LogWrite(INIT__PATCHER_DEBUG, 1, "Patcher", "\tChecking current version for table: %s", tablename);
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT version FROM table_versions WHERE name='%s';", escaped_name);
-	int32 ret_version = 0;
-	if(result && mysql_num_rows(result) > 0)
-	{
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		ret_version = atoul(row[0]);
-	}
-	safe_delete_array(escaped_name);
-	return ret_version;
-}
-
-bool WorldDatabase::RunDatabaseQueries(TableQuery* queries, bool output_result, bool data){
-	for(int16 i=0;i<queries->num_queries;i++){
-		Query query;
-		if(string(queries->GetQuery(i)).length() > 5)
-			query.RunQuery2(string(queries->GetQuery(i)), Q_UPDATE);
-		if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-		{
-			if(output_result)
-				LogWrite(INIT__PATCHER_ERROR, 0, "Patcher", "FAILED!");
-			LogWrite(INIT__PATCHER_ERROR, 0, "Patcher", "Error in updating tables query '%s': %s", query.GetQuery(), query.GetError());
-			return false;
-		}
-	}
-	if(output_result)
-		LogWrite(INIT__PATCHER_DEBUG, 0, "Patcher", "SUCCESS!");
-	if(data)
-		UpdateDataTableVersion(queries->tablename, queries->latest_version);
-	else
-		UpdateTableVersion(queries->tablename, queries->latest_version);
-	return true;
-}
-
-void WorldDatabase::UpdateDataTableVersion(char* name, int32 version){
-	Query query;
-	char* escaped_name = getEscapeString(name);
-	query.RunQuery2(Q_UPDATE, "update table_versions set download_version=%u where name='%s'", version, escaped_name);
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-	{
-		LogWrite(INIT__PATCHER_ERROR, 0, "Patcher", "Error in updating version table query '%s': %s", query.GetQuery(), query.GetError());
-	}
-	safe_delete_array(escaped_name);
-}
-
-void WorldDatabase::UpdateTableVersion(char* name, int32 version){
-	Query query;
-	char* escaped_name = getEscapeString(name);
-	query.RunQuery2(Q_UPDATE, "INSERT into table_versions (name, version) values('%s', %u) ON DUPLICATE KEY UPDATE version=%u", escaped_name, version, version);
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF)
-	{
-		LogWrite(WORLD__ERROR, 0, "Patcher", "Error in updating version table query '%s': %s", query.GetQuery(), query.GetError());
-	}
-	safe_delete_array(escaped_name);
-}
-
-bool WorldDatabase::CheckVersionTable() {
-	Query query;
-
-	// todo: suppress SQL errors while this command is running, because ERROR is normal on a new DB creation (Zcoretri)
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SHOW COLUMNS FROM table_versions");
-	if(result && mysql_num_rows(result) > 0) {
-		LogWrite(INIT__PATCHER_DEBUG, 0, "Patcher", "--DB Schema exists! Checking for updates...");
-		return true;
-	}
-	else {
-		LogWrite(INIT__PATCHER_ERROR, 0, "Patcher", "Version Table NOT Found! Creating...");
-		Query query2;
-		query2.RunQuery2(Q_UPDATE, "CREATE TABLE `table_versions` (`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(64) NOT NULL DEFAULT '',`version` INT(10) UNSIGNED NOT NULL DEFAULT '0',`download_version` INT(10) UNSIGNED NOT NULL DEFAULT '0',PRIMARY KEY  (`id`),UNIQUE KEY `UniqueName` (`name`)) ENGINE=INNODB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;");
-
-		LogWrite(INIT__PATCHER_DEBUG, 0, "Patcher", "--Setting table_version = 1...");
-		Query query3;
-		query3.RunQuery2(Q_INSERT, "INSERT INTO table_versions (name, version) VALUES ('table_versions', 1)");
-	}
-	return false;
-}
-
-sint32 WorldDatabase::GetLatestDataTableVersion(char* name){
-	Query query;
-	char* escaped_name = getEscapeString(name);
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT download_version FROM table_versions where name='%s'", escaped_name);
-	sint32 ret_version = 0;
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		ret_version = atol(row[0]);
-	}
-	safe_delete_array(escaped_name);
-	return ret_version;
-}
-
-int32 WorldDatabase::GetMaxHotBarID(){
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT max(id) FROM character_skillbar");
-	int32 ret = 0;
-	if(result && mysql_num_rows(result) > 0) {
-		MYSQL_ROW row;
-		row = mysql_fetch_row(result);
-		if(row && row[0])
-			ret = strtoul(row[0], NULL, 0);
-	}
-	return ret;
-}
-
-void WorldDatabase::SaveQuickBar(int32 char_id, vector<QuickBarItem*>* quickbar_items){
-	vector<QuickBarItem*>::iterator itr;
-	QuickBarItem* qbi = 0;
-	for(itr = quickbar_items->begin(); itr != quickbar_items->end(); itr++){
-		qbi = *itr;
-		if(!qbi)
-			continue;
-		if(qbi->deleted == false){
-			Query query;
-			if(qbi->text.size > 0){
-				query.AddQueryAsync(char_id, this, Q_REPLACE, "replace into character_skillbar (id, hotbar, slot, char_id, spell_id, type, text_val, tier) values(%u, %u, %u, %u, %u, %i, '%s', %i)", 
-					qbi->unique_id, qbi->hotbar, qbi->slot, char_id, qbi->id, qbi->type, getSafeEscapeString(qbi->text.data.c_str()).c_str(), qbi->tier);
-			}
-			else{
-				query.AddQueryAsync(char_id, this, Q_REPLACE, "replace into character_skillbar (id, hotbar, slot, char_id, spell_id, type, text_val, tier) values(%u, %u, %u, %u, %u, %i, 'Unused', %i)",
-					qbi->unique_id, qbi->hotbar, qbi->slot, char_id, qbi->id, qbi->type, qbi->tier);
-			}
-		}
-		else{
-			Query query;
-			query.AddQueryAsync(char_id, this, Q_DELETE, "delete FROM character_skillbar where hotbar=%u and slot=%u and char_id=%u", qbi->hotbar, qbi->slot, char_id);
-		}
-	}
-}
-
-map<int32, vector<LevelArray*> >* WorldDatabase::LoadSpellClasses(){
-	map<int32, vector<LevelArray*> >* ret = new map<int32, vector<LevelArray*> >();
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT spell_id, adventure_class_id, tradeskill_class_id, level FROM spell_classes");
-	MYSQL_ROW row;
-	LevelArray* level = 0;
-	while(result && (row = mysql_fetch_row(result))){
-		level = new LevelArray();
-		level->adventure_class = atoi(row[1]);
-		level->tradeskill_class = atoi(row[2]);
-		level->spell_level = atoi(row[3]);
-		(*ret)[atoul(row[0])].push_back(level);
-	}
-	return ret;
-}
-
-void WorldDatabase::LoadTraits(){
-	Query query;
-	MYSQL_ROW row;
-	TraitData* trait;
-
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `spell_id`, `level`, `class_req`, `race_req`, `isTrait`,`isInate`, `isFocusEffect`, `isTraining`,`tier`, `group` FROM spell_traits");
-	while (result && (row = mysql_fetch_row(result))){
-		trait = new TraitData;
-		int8 i = 0;
-		trait->spellID = strtoul(row[0], NULL, 0);
-		trait->level = atoi(row[(++i)]);
-		trait->classReq = atoi(row[(++i)]);
-		trait->raceReq = atoi(row[(++i)]);
-		trait->isTrait = (atoi(row[(++i)]) == 0) ? false : true;
-		trait->isInate = (atoi(row[(++i)]) == 0) ? false : true;
-		trait->isFocusEffect = (atoi(row[(++i)]) == 0) ? false : true;
-		trait->isTraining = (atoi(row[(++i)]) == 0) ? false : true;
-		trait->tier = atoi(row[(++i)]);
-		trait->group = atoi(row[(++i)]);
-
-		master_trait_list.AddTrait(trait);
-	}
-
-	LogWrite(SPELL__INFO, 0, "Traits", "Loaded %u Trait(s)", master_trait_list.Size());
-}
-
-void WorldDatabase::LoadSpells()
-{
-	DatabaseResult result;
-	Spell *spell;
-	SpellData *data;
-	int32 t_now = Timer::GetUnixTimeStamp();
-	int32 total = 0;
-	map<int32, vector<LevelArray*> >* level_data = LoadSpellClasses();
-
-	if( !database_new.Select(&result, "SELECT s.`id`, ts.spell_id, ts.index, `name`, `description`, `type`, `class_skill`, `min_class_skill_req`, `mastery_skill`, `tier`, `is_aa`,`hp_req`, `power_req`,`power_by_level`, `cast_time`, `recast`, `radius`, `max_aoe_targets`, `req_concentration`, `range`, `duration1`, `duration2`, `resistibility`, `hp_upkeep`, `power_upkeep`, `duration_until_cancel`, `target_type`, `recovery`, `power_req_percent`, `hp_req_percent`, `icon`, `icon_heroic_op`, `icon_backdrop`, `success_message`, `fade_message`, `fade_message_others`, `cast_type`, `lua_script`, `call_frequency`, `interruptable`, `spell_visual`, `effect_message`, `min_range`, `can_effect_raid`, `affect_only_group_members`, `hit_bonus`, `display_spell_tier`, `friendly_spell`, `group_spell`, `spell_book_type`, spell_type+0, s.is_active, savagery_req, savagery_req_percent, savagery_upkeep, dissonance_req, dissonance_req_percent, dissonance_upkeep, linked_timer_id, det_type, incurable, control_effect_type, cast_while_moving, casting_flags, persist_through_death, not_maintained, savage_bar, savage_bar_slot, soe_spell_crc, 0xffffffff-CRC32(s.`name`) as 'spell_name_crc', type_group_spell_id, can_fizzle "
-									"FROM (spells s, spell_tiers st) "
-									"LEFT JOIN spell_ts_ability_index ts "
-									"ON s.`id` = ts.spell_id "
-									"WHERE s.id = st.spell_id AND s.is_active = 1 "
-									"ORDER BY s.`id`, `tier`") )
-	{
-		// error
-	}
-	else
-	{
-		while( result.Next() )
-		{
-			data = new SpellData;
-			int32 spell_id		= result.GetInt32Str("id");
-			string spell_name	= result.GetStringStr("name");
-
-			/* General Spell info */
-			data->id						= spell_id;
-			data->soe_spell_crc				= result.GetInt32Str("soe_spell_crc");
-			data->tier						= result.GetInt8Str("tier");
-			data->ts_loc_index				= result.GetInt8Str("index");
-			data->name.data					= spell_name.c_str();
-			data->name.size					= data->name.data.length();
-			data->description.data			= result.GetStringStr("description");
-			data->description.size			= data->description.data.length();
-			data->icon						= result.GetSInt16Str("icon");
-			data->icon_heroic_op			= result.GetInt16Str("icon_heroic_op");
-			data->icon_backdrop				= result.GetInt16Str("icon_backdrop");
-			data->spell_visual				= result.GetInt32Str("spell_visual");
-			data->type						= result.GetInt16Str("type");
-			data->target_type				= result.GetInt8Str("target_type");
-			data->cast_type					= result.GetInt8Str("cast_type");
-			data->spell_book_type			= result.GetInt32Str("spell_book_type");
-			data->det_type                  = result.GetInt8Str("det_type");
-			data->incurable                 = (result.GetInt8Str("incurable") == 1);
-			data->control_effect_type       = result.GetInt8Str("control_effect_type");
-			data->casting_flags             = result.GetInt32Str("casting_flags");
-			data->savage_bar				= result.GetInt8Str("savage_bar");
-			data->savage_bar_slot			= result.GetInt8Str("savage_bar_slot");
-			data->spell_type				= result.IsNullStr("spell_type+0") ? 0 : result.GetInt8Str("spell_type+0");
-
-
-			/* Toggles */
-			data->interruptable				= ( result.GetInt8Str("interruptable") == 1);
-			data->duration_until_cancel		= ( result.GetInt8Str("duration_until_cancel") == 1);
-			data->can_effect_raid			= result.GetInt8Str("can_effect_raid");
-			data->affect_only_group_members = result.GetInt8Str("affect_only_group_members");
-			data->display_spell_tier		= result.GetInt8Str("display_spell_tier");
-			data->friendly_spell			= result.GetInt8Str("friendly_spell");
-			data->group_spell				= result.GetInt8Str("group_spell");
-			data->is_active					= result.GetInt8Str("is_active");
-			data->persist_through_death      = ( result.GetInt8Str("persist_through_death") == 1);
-			data->cast_while_moving         = ( result.GetInt8Str("cast_while_moving") == 1);
-			data->not_maintained            = ( result.GetInt8Str("not_maintained") == 1);
-			data->is_aa						= (result.GetInt8Str("is_aa") == 1);
-
-			/* Skill Requirements */
-			data->class_skill				= result.GetInt32Str("class_skill");
-			data->min_class_skill_req		= result.GetInt16Str("min_class_skill_req");
-			data->mastery_skill				= result.GetInt32Str("mastery_skill");
-
-			/* Cost  */
-			data->req_concentration			= result.GetInt16Str("req_concentration");
-			data->hp_req					= result.GetInt16Str("hp_req");
-			data->hp_upkeep					= result.GetInt16Str("hp_upkeep");
-			data->hp_req_percent			= result.GetInt8Str("hp_req_percent");
-			data->power_req					= result.GetFloatStr("power_req");
-
-
-			
-
-
-			data->power_by_level			= ( result.GetInt8Str("power_by_level") == 0)? false : true;
-			data->power_upkeep				= result.GetInt16Str("power_upkeep");
-			data->power_req_percent			= result.GetInt8Str("power_req_percent");
-			data->savagery_req				= result.GetInt16Str("savagery_req");
-			data->savagery_upkeep			= result.GetInt16Str("savagery_upkeep");
-			data->savagery_req_percent		= result.GetInt8Str("savagery_req_percent");
-			data->dissonance_req			= result.GetInt16Str("dissonance_req");
-			data->dissonance_upkeep			= result.GetInt16Str("dissonance_upkeep");
-			data->dissonance_req_percent	= result.GetInt8Str("dissonance_req_percent");
-
-			/* Spell Parameters */
-			data->call_frequency			= result.GetInt32Str("call_frequency");
-			data->cast_time					= result.GetInt16Str("cast_time");
-			data->duration1					= result.GetInt32Str("duration1");
-			data->duration2					= result.GetInt32Str("duration2");
-			data->hit_bonus					= result.GetFloatStr("hit_bonus");
-			data->max_aoe_targets			= result.GetInt16Str("max_aoe_targets");
-			data->min_range					= result.GetFloatStr("min_range");
-			data->radius					= result.GetFloatStr("radius");
-			data->range						= result.GetFloatStr("range");
-			data->recast					= result.GetFloatStr("recast");
-			data->recovery					= result.GetFloatStr("recovery");
-			data->resistibility				= result.GetFloatStr("resistibility");
-			data->linked_timer				= result.GetInt32Str("linked_timer_id");
-			data->spell_name_crc			= result.GetInt32Str("spell_name_crc");
-			data->type_group_spell_id		= result.GetSInt32Str("type_group_spell_id");
-			data->can_fizzle				= ( result.GetInt8Str("can_fizzle") == 1);
-
-			/* Cast Messaging */
-			string message					= result.GetStringStr("success_message");
-			if( message.length() > 0 )
-				data->success_message = message;
-
-			message							= result.GetStringStr("fade_message");
-			if( message.length() > 0 )
-				data->fade_message = string(message);
-
-			message = result.GetStringStr("fade_message_others");
-			if (message.length() > 0)
-				data->fade_message_others = string(message);
-
-			message							= result.GetStringStr("effect_message");
-			if( message.length() > 0 )
-				data->effect_message = string(message);
-
-			string lua_script				= result.GetStringStr("lua_script");
-			if( lua_script.length() > 0 )
-				data->lua_script = string(lua_script);
-
-
-			/* Load spell level data */
-			spell = new Spell(data);
-
-			if(level_data && level_data->count(data->id) > 0)
-			{
-				vector<LevelArray*>* level_array = &((*level_data)[data->id]);
-
-				for(int8 i=0; i<level_array->size(); i++)
-				{
-					spell->AddSpellLevel(level_array->at(i)->adventure_class, level_array->at(i)->tradeskill_class, level_array->at(i)->spell_level*10);
-				}
-			}
-
-
-			/* Add spell to master list */
-			master_spell_list.AddSpell(data->id, data->tier, spell);
-			total++;
-
-			if( lua_script.length() > 0 )
-				LogWrite(SPELL__DEBUG, 5, "Spells", "\t%i. %s (Tier: %i) - '%s'", spell_id, spell_name.c_str(), data->tier, lua_script.c_str()); 		
-			else if(data->is_active)
-				LogWrite(SPELL__WARNING, 1, "Spells", "\tSpell %s (%u, Tier: %i) set 'Active', but missing LUAScript", spell_name.c_str(), spell_id, data->tier);
-
-		} // end while
-	} // end else
-	
-	LogWrite(SPELL__DEBUG, 0, "Spells", "Loading Spell Effects...");
-	LoadSpellEffects();
-
-	LogWrite(SPELL__DEBUG, 0, "Spells", "Loading Spell LUA Data...");
-	LoadSpellLuaData();
-	
-	if(lua_interface) 
-	{
-		LogWrite(SPELL__DEBUG, 0, "Spells", "Loading Spells Scripts...");
-		LoadSpellScriptData();
-	}
-
-	if (level_data) {
-		map<int32, vector<LevelArray*> >::iterator map_itr;
-		vector<LevelArray*>::iterator level_itr;
-
-		for(map_itr = level_data->begin(); map_itr != level_data->end(); map_itr++)
-		{
-			for(level_itr = map_itr->second.begin(); level_itr != map_itr->second.end(); level_itr++)
-			{
-				safe_delete(*level_itr);
-			}
-		}
-	}
-
-	safe_delete(level_data);
-
-	LogWrite(SPELL__INFO, 0, "Spells", "Loaded %u Spell%s (took %u seconds)", total, total == 1 ? "" : "s", Timer::GetUnixTimeStamp() - t_now);
-}
-
-void WorldDatabase::LoadSpellLuaData(){
-	Spell *spell;
-	Query query;
-	MYSQL_ROW row;
-	int32 total = 0;
-	MYSQL_RES *result = query.RunQuery2(Q_SELECT, "SELECT `spell_id`,`tier`,`value_type`,`value`,`value2`,`dynamic_helper` "
-												  "FROM `spell_data` "
-												  "ORDER BY `index_field`");
-
-	while (result && (row = mysql_fetch_row(result))) {
-		if ((spell = master_spell_list.GetSpell(atoul(row[0]), atoi(row[1]))) && row[2] && row[3] && row[4] && row[4]) {
-
-			LogWrite(SPELL__DEBUG, 5, "Spells", "\tLoading Spell LUA Data for spell_id: %u", atoul(row[0]));
-
-			if (!strcmp(row[2], "INT"))
-				spell->AddSpellLuaDataInt(atoi(row[3]), atoi(row[4]), string(row[5]));
-			else if (!strcmp(row[2], "FLOAT"))
-				spell->AddSpellLuaDataFloat(atof(row[3]), atof(row[4]),string(row[5]));
-			else if (!strcmp(row[2], "BOOL"))
-				spell->AddSpellLuaDataBool(!(strncasecmp(row[3], "true", 4)), string(row[5]));
-			else if (!strcmp(row[2], "STRING"))
-				spell->AddSpellLuaDataString(string(row[3]), string(row[4]), string(row[5]));
-			else
-				LogWrite(SPELL__ERROR, 0, "Spells", "Invalid Lua Spell data '%s' for Spell ID: %u", row[2], spell->GetSpellID());
-			total++;
-		}
-	}
-	LogWrite(SPELL__DEBUG, 0, "Spells", "\tLoaded %i Spell LUA Data entr%s.", total, total == 1 ? "y" : "ies");
-}
-
-void WorldDatabase::LoadSpellEffects() {
-	Spell *spell;
-	Query query;
-	MYSQL_ROW row;
-	int32 total = 0;
-	MYSQL_RES *result = query.RunQuery2(Q_SELECT, "SELECT `spell_id`,`tier`,`percentage`,`bullet`,`description` "
-												  "FROM `spell_display_effects` "
-												  "ORDER BY `spell_id`,`id` ASC");
-
-	while (result && (row = mysql_fetch_row(result))) {
-		if ((spell = master_spell_list.GetSpell(atoul(row[0]), atoi(row[1]))) && row[4]) {
-
-			LogWrite(SPELL__DEBUG, 5, "Spells", "\tLoading Spell Effects for spell_id: %u", atoul(row[0]));
-
-			spell->AddSpellEffect(atoi(row[2]), atoi(row[3]), row[4]);
-			total++;
-		}
-	}
-	LogWrite(SPELL__DEBUG, 0, "Spells", "\tLoaded %u Spell Effect%s.", total, total == 1 ? "" : "s");
-}
-
-int32 WorldDatabase::LoadPlayerSkillbar(Client* client){
-	client->GetPlayer()->ClearQuickbarItems();
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, type, spell_id, slot, text_val, hotbar, tier FROM character_skillbar where char_id = %u", client->GetCharacterID());
-	MYSQL_ROW row;
-	int32 count = 0;
-	while(result && (row = mysql_fetch_row(result))){
-		count++;
-		int8 tier = atoi(row[6]);
-		Spell* spell = master_spell_list.GetSpell(atoul(row[2]), tier);
-		if(spell)
-			client->GetPlayer()->AddQuickbarItem(atoul(row[5]), atoul(row[3]), atoul(row[1]), spell->GetSpellIcon(), spell->GetSpellIconBackdrop(), spell->GetSpellID(), spell->GetSpellTier(), atoul(row[0]), row[4], false);
-		else if(atoul(row[1]) == QUICKBAR_MACRO)
-			client->GetPlayer()->AddQuickbarItem(atoul(row[5]), atoul(row[3]), atoul(row[1]), client->GetPlayer()->macro_icons[atoul(row[2])], 0xFFFF, atoul(row[2]), 0, atoul(row[0]), row[4], false);
-		else
-			client->GetPlayer()->AddQuickbarItem(atoul(row[5]), atoul(row[3]), atoul(row[1]), 0, 0, atoul(row[2]), 0, atoul(row[0]), row[4], false);
-	}
-	return count;	
-}
-
-bool WorldDatabase::DeleteCharacter(int32 account_id, int32 character_id){
-	Guild *guild;
-
-	if((guild = guild_list.GetGuild(GetGuildIDByCharacterID(character_id))))
-		guild->RemoveGuildMember(character_id);
-
-	Query query;
-	Query query2;
-	query.RunQuery2(Q_DELETE, "DELETE FROM characters WHERE id=%u AND account_id=%u", character_id, account_id);
-	//delete languages
-	query2.RunQuery2(Q_DELETE, "DELETE FROM character_languages WHERE char_id=%u", character_id);
-
-	if(!query.GetAffectedRows())
-	{
-		//No error just in case ppl try doing stupid stuff
-		return false;
-	}
-	else{ //successfull, so the character did exist with that character_id and account_id
-		// new DB constraints should handle all these deletes, and more... commenting out for now
-		/*query.RunQuery2(Q_DELETE, "delete FROM character_details where char_id=%u", character_id);
-		query.RunQuery2(Q_DELETE, "delete FROM character_factions where char_id=%u", character_id);
-		query.RunQuery2(Q_DELETE, "delete FROM character_items where char_id=%u", character_id);
-		query.RunQuery2(Q_DELETE, "delete FROM character_skillbar where char_id=%u", character_id);
-		query.RunQuery2(Q_DELETE, "delete FROM character_skills where char_id=%u", character_id);
-		query.RunQuery2(Q_DELETE, "delete FROM character_spells where char_id=%u", character_id);
-		query.RunQuery2(Q_DELETE, "delete FROM char_colors where char_id=%u", character_id);*/
-	}
-	return true;
-}
-
-void WorldDatabase::DeleteCharacterSpell(int32 character_id, int32 spell_id) {
-	if (character_id > 0 && spell_id > 0) {
-		Query query;
-		query.RunQuery2(Q_DELETE, "DELETE FROM character_spells WHERE char_id=%u AND spell_id=%u", character_id, spell_id);
-	}
-}
-
-bool WorldDatabase::GetItemResultsToClient (Client* client, const char* varSearch, int maxResults) {
-	Query query;
-	MYSQL_ROW row;
-	int results = 0;
-
-	if( maxResults > 10 && client->GetAdminStatus ( ) < 100 )
-		maxResults = 10;
-	else if( maxResults > 20 )
-		maxResults = 20;
-
-	client->Message(CHANNEL_COLOR_YELLOW, "Item Search Results");
-	client->Message(CHANNEL_COLOR_YELLOW, "ResultNum) [ItemID] ItemName");
-	string itemsearch_query = string("SELECT id, name FROM items where name like '%%%s%%' limit %i");
-
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, itemsearch_query.c_str(),getSafeEscapeString(varSearch).c_str(),maxResults);
-	while(result && (row = mysql_fetch_row(result))){
-		results++;
-		client->Message(CHANNEL_COLOR_YELLOW, "%i) [%s] %s",results,row[0],row[1]);
-	}
-
-	if(results == 0)
-	{
-		client->Message(CHANNEL_COLOR_YELLOW, "No Items Found.");
-		return false;
-	}
-
-	client->Message(CHANNEL_COLOR_YELLOW, "%i Items Found.",results);
-	return true;
-}
-
-void WorldDatabase::SaveWorldTime(WorldTime* time){
-	Query query;
-	query.RunQuery2(Q_REPLACE, "replace into variables (variable_name, variable_value) values('gametime', '%i/%i/%i %i:%i')", time->month, time->day, time->year, time->hour, time->minute);
-}
-
-void WorldDatabase::SaveBugReport(const char* category, const char* subcategory, const char* causes_crash, const char* reproducible, const char* summary, const char* description, const char* version, const char* player, int32 account_id, const char* spawn_name, int32 spawn_id, int32 zone_id){
-	Query query;
-
-	int32 dbVersion = rule_manager.GetGlobalRule(R_World, DatabaseVersion)->GetInt32();
-
-	string bug_report = string("insert into bugs (category, subcategory, causes_crash, reproducible, summary, description, version, player, account_id, spawn_name, spawn_id, zone_id, dbversion, worldversion) values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %u, '%s', %u, %u, %u, '%s')");
-	query.RunQuery2(Q_INSERT, bug_report.c_str(), getSafeEscapeString(category).c_str(), getSafeEscapeString(subcategory).c_str(),
-		getSafeEscapeString(causes_crash).c_str(), getSafeEscapeString(reproducible).c_str(), getSafeEscapeString(summary).c_str(),
-		getSafeEscapeString(description).c_str(), getSafeEscapeString(version).c_str(), getSafeEscapeString(player).c_str(), account_id,
-		getSafeEscapeString(spawn_name).c_str(), spawn_id, zone_id, dbVersion, CURRENT_VERSION);
-	FixBugReport();
-	FixBugReport();
-	FixBugReport();
-}
-
-void WorldDatabase::FixBugReport(){
-	Query query;
-	string bug_report = string("update bugs set description = REPLACE(description,SUBSTRING(description,INSTR(description,'%'), 3),char(CONV(SUBSTRING(description,INSTR(description,'%')+1, 2), 16, 10))), summary = REPLACE(summary,SUBSTRING(summary,INSTR(summary,'%'), 3),char(CONV(SUBSTRING(summary,INSTR(summary,'%')+1, 2), 16, 10)))");
-	query.RunQuery2(bug_report.c_str(), Q_UPDATE);
-}
-
-int32 WorldDatabase::LoadQuests(){
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `quest_id`, `name`, `type`, `zone`, `level`, `enc_level`, `description`, `lua_script`, `completed_text`, `spawn_id` FROM `quests`");
-	Quest* quest = 0;
-	char* name = 0;
-	char* type = 0;
-	char* zone = 0;
-	int8 level = 0;
-	int8 enc_level = 0;
-	char* description = 0;
-	char* script = 0;
-	int32 total = 0;
-	int32 id = 0;
-	char* completed_description = 0;
-	int32 return_npc_id = 0;
-	if(result){
-		while(result && (row = mysql_fetch_row(result))){
-			id = atoul(row[0]);
-			name = row[1];
-			type = row[2];
-			zone = row[3];
-			level = atoul(row[4]);
-			enc_level = atoul(row[5]);
-			description = row[6];
-			script = row[7];
-			completed_description = row[8];
-			return_npc_id = atoi(row[9]);
-			if(lua_interface) {
-				quest = lua_interface->LoadQuest(id, name, type, zone, level, description, script);
-			}
-			if(quest){
-
-				LogWrite(QUEST__DEBUG, 5, "Quests", "\tLoading Quest: '%s' (%u)", name, id);
-
-				LoadQuestDetails(quest);
-				string compDescription;
-				if (completed_description == NULL)
-				{
-					compDescription = string("Missing! Notify Developer");
-					LogWrite(QUEST__WARNING, 5, "Quests", "\tLoading Quest MISSING completed_text in quests table for: '%s' (%u)", name, id);
-				}
-				else
-					compDescription = string(completed_description);
-
-				quest->SetCompletedDescription(string(compDescription));
-				quest->SetQuestReturnNPC(return_npc_id);
-				quest->SetEncounterLevel(enc_level);
-				total++;
-				master_quest_list.AddQuest(id, quest);
-			}
-			else
-			{
-				LogWrite(QUEST__ERROR, 5, "Quests", "\tFAILED LOADING QUEST: '%s' (%u), check that script file exists/permissions correct: %s", name, id, (script && strlen(script)) ? script : "Not Set, Missing!");
-			}
-		}
-	}
-	LogWrite(QUEST__DEBUG, 0, "Quest", "\tLoaded %i Quest(s)", total);
-	return total;
-}
-
-void WorldDatabase::LoadQuestDetails(Quest* quest) {
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `type`, `subtype`, `value`, `faction_id`, `quantity` FROM `quest_details` WHERE `quest_id`=%u", quest->GetQuestID());
-	string type;
-	string subtype;
-	sint64 value;
-	int32 faction_id;
-	int32 quantity;
-	while (result && (row = mysql_fetch_row(result))) {
-		type = string(row[0]);
-		subtype = string(row[1]);
-		value = atoi(row[2]);
-		faction_id = atoi(row[3]);
-		quantity = atoi(row[4]);
-
-
-		LogWrite(QUEST__DEBUG, 5, "Quests", "\t- Type: %s, SubType: %s, Val: %u, Faction: %u, Qty: %u", type.c_str(), subtype.c_str(), value, faction_id, quantity);
-
-
-		if (type == "Prereq") {
-			if (subtype == "Class")
-				quest->AddPrereqClass(value);
-			else if (subtype == "Faction")
-				quest->AddPrereqFaction(faction_id, value);
-			else if (subtype == "Item") {
-				Item* master_item = master_item_list.GetItem(value);
-				if (master_item) {
-					Item* item = new Item(master_item);
-					quest->AddPrereqItem(item);
-				}
-			}
-			else if (subtype == "AdvLevel")
-				quest->SetPrereqLevel(value);
-			else if (subtype == "Quest")
-				quest->AddPrereqQuest(value);
-			else if (subtype == "Race")
-				quest->AddPrereqRace(value);
-			else if (subtype == "TSClass")
-				quest->AddPrereqTradeskillClass(value);
-			else if (subtype == "TSLevel")
-				quest->SetPrereqTSLevel(value);
-			else if (subtype == "MaxTSLevel")
-				quest->SetPrereqMaxTSLevel(value);
-			else if (subtype == "MaxAdvLevel")
-				quest->SetPrereqMaxLevel(value);
-		}
-		else if (type == "Reward") {
-			if (subtype == "Item") {
-				Item* master_item = master_item_list.GetItem(value);
-				if (master_item) {
-					Item* item = new Item(master_item);
-					item->details.count = quantity;
-					quest->AddRewardItem(item);
-				}
-			}
-			else if (subtype == "Selectable") {
-				Item* master_item = master_item_list.GetItem(value);
-				if (master_item) {
-					Item* item = new Item(master_item);
-					item->details.count = quantity;
-					quest->AddSelectableRewardItem(item);
-				}
-			}
-			else if (subtype == "Coin") {
-				int32 copper = 0;
-				int32 silver = 0;
-				int32 gold = 0;
-				int32 plat = 0;
-				if (value >= 1000000) {
-					plat = value / 1000000;
-					value -= 1000000 * plat;
-				}
-				if (value >= 10000) {
-					gold = value / 10000;
-					value -= 10000 * gold;
-				}
-				if (value >= 100) {
-					silver = value / 100;
-					value -= 100 * silver;
-				}
-				if (value > 0)
-					copper = value;
-				quest->AddRewardCoins(copper, silver, gold, plat);
-			}
-			else if (subtype == "MaxCoin") {
-				quest->AddRewardCoinsMax(value);
-			}
-			else if (subtype == "Faction")
-				quest->AddRewardFaction(faction_id, value);
-			else if (subtype == "Experience")
-				quest->SetRewardXP(value);
-			else if (subtype == "TSExperience")
-				quest->SetRewardTSXP(value);
-		}
-	}
-}
-
-void WorldDatabase::LoadMerchantInformation() {
-	LogWrite(MERCHANT__DEBUG, 0, "Merchant", "\tClearing Merchant Inventory...");
-	world.DeleteMerchantItems();
-
-	LogWrite(MERCHANT__DEBUG, 0, "Merchant", "\tLoading Merchant Inventory...");
-	LoadMerchantInventory();
-
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT merchant_id, inventory_id FROM merchants ORDER BY merchant_id");
-	int32 total = 0;
-	int32 last_merchant_id = 0;
-	int32 id = 0;
-	MerchantInfo* merchant = 0;
-	if(result) {
-		while(result && (row = mysql_fetch_row(result))) {
-			id = atoul(row[0]);
-
-			LogWrite(MERCHANT__DEBUG, 5, "Merchant", "\tMerchantID: %u, InventoryID: %u", id, atoul(row[1]));
-
-			if(id != last_merchant_id) {
-				if(merchant)
-					world.AddMerchantInfo(last_merchant_id, merchant);
-				merchant = new MerchantInfo;
-				last_merchant_id = id;
-				total++;
-			}
-			merchant->inventory_ids.push_back(atoul(row[1]));
-		}
-		if(merchant)
-			world.AddMerchantInfo(last_merchant_id, merchant);
-	}
-	LogWrite(MERCHANT__DEBUG, 0, "Merchant", "\tLoaded %i Merchant List(s)", total);
-}
-
-void WorldDatabase::LoadMerchantInventory(){
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT inventory_id, item_id, quantity, price_item_id, price_item_qty, price_item2_id, price_item2_qty, price_status, price_coins, price_stationcash FROM merchant_inventory ORDER BY inventory_id");
-	int32 total = 0;
-	int32 id;
-
-	if(result) {
-		while(result && (row = mysql_fetch_row(result))) {
-			MerchantItemInfo ItemInfo;
-			id = atoul(row[0]);
-			ItemInfo.item_id = atoul(row[1]);
-			ItemInfo.quantity = atoi(row[2]);
-			ItemInfo.price_item_id = atoul(row[3]);
-			ItemInfo.price_item_qty = atoi(row[4]);
-			ItemInfo.price_item2_id = atoul(row[5]);
-			ItemInfo.price_item2_qty = atoi(row[6]);
-			ItemInfo.price_status = atoul(row[7]);
-			ItemInfo.price_coins = atoul(row[8]);
-			ItemInfo.price_stationcash = atoul(row[9]);
-			LogWrite(MERCHANT__DEBUG, 5, "Merchant", "\tInventoryID: %u, ItemID: %u, Qty: %u", id, ItemInfo.item_id, ItemInfo.quantity);
-			world.AddMerchantItem(id, ItemInfo);
-			total++;
-		}
-	}
-	LogWrite(MERCHANT__DEBUG, 0, "Merchant", "\tLoaded %i Merchant Inventory Item(s)", total);
-}
-
-string WorldDatabase::GetMerchantDescription(int32 merchant_id) {
-	Query query;
-	MYSQL_ROW row;
-	string description;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `description` FROM `merchants` WHERE `merchant_id`=%u", merchant_id);
-	if (result && (row = mysql_fetch_row(result)))
-		description = string(row[0]);
-	return description;
-}
-
-void WorldDatabase::LoadTransporters(ZoneServer* zone){
-	int32 total = 0;
-	zone->DeleteGlobalTransporters();
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT transport_id, transport_type, display_name, message, destination_zone_id, destination_x, destination_y, destination_z, destination_heading, trigger_location_zone_id, trigger_location_x, trigger_location_y, trigger_location_z, trigger_radius, cost, id, min_level, max_level, quest_req, quest_step_req, quest_completed, map_x, map_y, expansion_flag, holiday_flag, min_client_version, max_client_version, flight_path_id, mount_id, mount_red_color, mount_green_color, mount_blue_color FROM transporters ORDER BY transport_id");
-	if(result){
-		while(result && (row = mysql_fetch_row(result))){
-			LogWrite(TRANSPORT__DEBUG, 5, "Transport", "---Loading Transporter ID: %u, transport_type: %s", row[0], row[1]);
-			LogWrite(TRANSPORT__DEBUG, 7, "Transport", "---display_name: %s, message: %s", row[2], row[3]);
-			LogWrite(TRANSPORT__DEBUG, 7, "Transport", "---destination_zone_id: %s", row[4]);
-			LogWrite(TRANSPORT__DEBUG, 7, "Transport", "---destination_x: %s, destination_y: %s, destination_z: %s, destination_heading: %s", row[5], row[6], row[7], row[8]);
-			LogWrite(TRANSPORT__DEBUG, 7, "Transport", "---trigger_location_zone_id: %s", row[9]);
-			LogWrite(TRANSPORT__DEBUG, 7, "Transport", "---trigger_location_x: %s, trigger_location_y: %s, trigger_location_z: %s", row[10], row[11], row[12], row[13]);
-			LogWrite(TRANSPORT__DEBUG, 7, "Transport", "---trigger_radius: %s, cost: %s, id: %s", row[14], row[15]); 
-			string name = "";
-			if(row[2])
-				name = string(row[2]);
-			string message = "";
-			if(row[3])
-				message = string(row[3]);
-
-			if(row[1] && strcmp(row[1], "Zone") == 0)
-				zone->AddTransporter(atoul(row[0]), TRANSPORT_TYPE_ZONE, name, message, atoul(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), atof(row[8]), atoul(row[14]), atoul(row[15]), atoi(row[16]), atoi(row[17]), atoul(row[18]), atoi(row[19]), atoul(row[20]), atoul(row[21]), atoul(row[22]), atoul(row[23]), atoul(row[24]), atoul(row[25]), atoul(row[26]), atoul(row[27]), atoul(row[28]), atoul(row[29]), atoul(row[30]), atoul(row[31]));
-			else if (row[1] && strcmp(row[1], "Flight") == 0)
-				zone->AddTransporter(atoul(row[0]), TRANSPORT_TYPE_FLIGHT, name, message, atoul(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), atof(row[8]), atoul(row[14]), atoul(row[15]), atoi(row[16]), atoi(row[17]), atoul(row[18]), atoi(row[19]), atoul(row[20]), atoul(row[21]), atoul(row[22]), atoul(row[23]), atoul(row[24]), atoul(row[25]), atoul(row[26]), atoul(row[27]), atoul(row[28]), atoul(row[29]), atoul(row[30]), atoul(row[31]));
-			else if(row[1] && strcmp(row[1], "Location") == 0)
-				zone->AddLocationTransporter(atoul(row[9]), message, atof(row[10]), atof(row[11]), atof(row[12]), atof(row[13]), atoul(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), atof(row[8]), atoul(row[14]), atoul(row[15]));
-			else
-				zone->AddTransporter(atoul(row[0]), TRANSPORT_TYPE_GENERIC, "", message, atoul(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), atof(row[8]), atoul(row[14]), atoul(row[15]), atoi(row[16]), atoi(row[17]), atoul(row[18]), atoi(row[19]), atoul(row[20]), atoul(row[21]), atoul(row[22]), atoul(row[23]), atoul(row[24]), atoul(row[25]), atoul(row[26]), atoul(row[27]), atoul(row[28]), atoul(row[29]), atoul(row[30]), atoul(row[31]));
-			total++;
-		}
-	}
-	LogWrite(TRANSPORT__DEBUG, 0, "Transport", "--Loaded %i Transporter(s)", total);
-	LoadTransportMaps(zone);
-}
-
-void WorldDatabase::LoadFogInit(string zone, PacketStruct* packet)
-{
-	LogWrite(WORLD__TRACE, 9, "World", "Enter: %s", __FUNCTION__);
-
-	if(!packet || zone.length() == 0)
-		return;
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT highest, lowest, zone_name, explored_map_name, unexplored_map_name, bounds1_x, bounds1_z, bounds2_x, bounds2_z, bounds3_x, bounds3_z, bounds4_x, bounds4_z, explored_key, unexplored_key, map_id FROM map_data where zone_name like '%s%%'", getSafeEscapeString(&zone).c_str());
-	if(result){
-		int count = mysql_num_rows(result);
-		int i=0;
-		int64 explored_key;
-		int64 unexplored_key;
-		packet->setArrayLengthByName("num_maps", count);
-		while(result && (row = mysql_fetch_row(result))){
-			packet->setDataByName("highest_z", atof(row[0]));		
-			packet->setDataByName("lowest_z", atof(row[1]));
-			packet->setDataByName("map_id", atoul(row[15]));
-			packet->setArrayDataByName("unknown7", 1600, i);
-			packet->setArrayDataByName("unknown8", 1200, i);
-			packet->setArrayDataByName("zone_name", row[2], i);
-			packet->setArrayDataByName("explored_map_name", row[3], i);
-			packet->setArrayDataByName("unexplored_map_name", row[4], i);
-			packet->setArrayDataByName("map_bounds1_x", atof(row[5]), i);
-			packet->setArrayDataByName("map_bounds1_z", atof(row[6]), i);
-			packet->setArrayDataByName("map_bounds2_x", atof(row[7]), i);
-			packet->setArrayDataByName("map_bounds2_z", atof(row[8]), i);
-			packet->setArrayDataByName("map_bounds3_x", atof(row[9]), i);
-			packet->setArrayDataByName("map_bounds3_z", atof(row[10]), i);
-			packet->setArrayDataByName("map_bounds4_x", atof(row[11]), i);
-			packet->setArrayDataByName("map_bounds4_z", atof(row[12]), i);
-#ifdef WIN32
-			explored_key = _strtoui64(row[13], NULL, 10);
-			unexplored_key = _strtoui64(row[14], NULL, 10);
-#else
-			explored_key = strtoull(row[13], 0, 10);
-			unexplored_key = strtoull(row[14], 0, 10);
-#endif
-			packet->setArrayDataByName("explored_key", explored_key, i);
-			packet->setArrayDataByName("unexplored_key", unexplored_key, i);
-			i++;
-		}
-	}
-	LogWrite(WORLD__TRACE, 9, "World", "Exit: %s", __FUNCTION__);
-}
-
-string WorldDatabase::GetColumnNames(char* name){
-	Query query;
-	MYSQL_ROW row;
-	string columns = "";
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "show columns FROM %s", name);
-	if(result && mysql_num_rows(result) > 0){
-		int16 i = 0;
-		while((row = mysql_fetch_row(result))){
-			if(strcmp(row[0], "table_data_version") != 0){
-				if(i>0)
-					columns.append(",");
-				columns.append(row[0]);
-				i++;
-			}
-		}
-	}
-	columns.append("");
-	return columns;
-}
-
-void WorldDatabase::ToggleCharacterOnline() {
-	Query query;
-	query.RunQuery2(Q_UPDATE, "UPDATE characters SET is_online = 0;");
-}
-
-void WorldDatabase::ToggleCharacterOnline(Client* client, int8 toggle) {
-	if (client) {
-		Query query;
-		Player* player = client->GetPlayer();
-		//if(!player->CheckPlayerInfo())
-		//	return;
-		if (player) 
-		{
-			LogWrite(PLAYER__DEBUG, 0, "Player", "Toggling Character %s", toggle ? "ONLINE!" : "OFFLINE!");
-			query.RunQuery2(Q_UPDATE, "UPDATE characters SET is_online=%i WHERE id = %u;", toggle, client->GetCharacterID());
-		}
-	}
-}
-
-void WorldDatabase::LoadPlayerStatistics(Player* player, int32 char_id) {
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT stat_id, stat_value, stat_date FROM statistics WHERE char_id=%i", char_id);
-	while (result && (row = mysql_fetch_row(result))) {
-		int32 stat_id = atoi(row[0]);
-		sint32 stat_value = atoi(row[1]);
-		int32 stat_date = atoi(row[2]);
-		player->AddPlayerStatistic(stat_id, stat_value, stat_date);
-	}
-}
-
-void WorldDatabase::WritePlayerStatistic(Player *player, Statistic* stat) {
-	if (player && player->GetCharacterID() > 0 && stat) {
-		Query query;
-		query.RunQuery2(Q_INSERT, "INSERT INTO statistics (char_id, guild_id, stat_id, stat_value, stat_date) VALUES(%i, %i, %i, %i, %i) ON DUPLICATE KEY UPDATE stat_value = %i, stat_date = %i;",
-			player->GetCharacterID(), 0, stat->stat_id, stat->stat_value, stat->stat_date,
-			stat->stat_value, stat->stat_date);
-	}
-}
-
-void WorldDatabase::LoadServerStatistics() 
-{
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT stat_id, stat_value, stat_date FROM statistics WHERE char_id=0 AND guild_id=0");
-	while (result && (row = mysql_fetch_row(result))) {
-		int32 stat_id = atoi(row[0]);
-		sint32 stat_value = atoi(row[1]);
-		int32 stat_date = atoi(row[2]);
-		world.AddServerStatistic(stat_id, stat_value, stat_date);
-		LogWrite(INIT__DEBUG, 5, "Stats", "Loading Stat ID %i, value: %i", stat_id, stat_value);
-	}
-}
-
-void WorldDatabase::WriteServerStatistic(Statistic* stat) {
-	if (stat) {
-		Query query;
-		query.RunQuery2(Q_INSERT, "INSERT INTO statistics (char_id, guild_id, stat_id, stat_value, stat_date) VALUES(0, 0, %i, %i, %i) ON DUPLICATE KEY UPDATE stat_value = %i, stat_date = %i;", 
-			stat->stat_id, stat->stat_value, stat->stat_date, 
-			stat->stat_value, stat->stat_date);
-	}
-}
-
-void WorldDatabase::WriteServerStatistic(int32 stat_id, sint32 stat_value) {
-	Query query;
-	query.RunQuery2(Q_INSERT, "INSERT INTO statistics (char_id, guild_id, stat_id, stat_value, stat_date) VALUES(0, 0, %i, %i, %i) ON DUPLICATE KEY UPDATE stat_value = %i, stat_date = %i;", 
-		stat_id, stat_value, Timer::GetUnixTimeStamp(),
-		stat_value, Timer::GetUnixTimeStamp());
-}
-
-void WorldDatabase::WriteServerStatisticsNeededQueries() {
-	Query query1, query2, query3;
-	MYSQL_ROW row1, row2, row3;
-
-	// Number of unique accounts
-	MYSQL_RES* result1 = query1.RunQuery2(Q_SELECT, "SELECT COUNT(DISTINCT account_id) FROM characters");
-	if (result1 && (row1 = mysql_fetch_row(result1)) && row1[0] != NULL)
-		WriteServerStatistic(STAT_SERVER_NUM_ACCOUNTS, atoi(row1[0]));
-	else
-		WriteServerStatistic(STAT_SERVER_NUM_ACCOUNTS, 0);
-
-	// Number of characters
-	MYSQL_RES* result2 = query2.RunQuery2(Q_SELECT, "SELECT COUNT(id) FROM characters");
-	if (result2 && (row2 = mysql_fetch_row(result2)) && row2[0] != NULL)
-		WriteServerStatistic(STAT_SERVER_NUM_CHARACTERS, atoi(row2[0]));
-	else
-		WriteServerStatistic(STAT_SERVER_NUM_CHARACTERS, 0);
-
-	// Average character level
-	MYSQL_RES* result3 = query3.RunQuery2(Q_SELECT, "SELECT ROUND(AVG(level)) FROM characters");
-	if (result3 && (row3 = mysql_fetch_row(result3)) && row3[0] != NULL)
-		WriteServerStatistic(STAT_SERVER_AVG_CHAR_LEVEL, atoi(row3[0]));
-	else
-		WriteServerStatistic(STAT_SERVER_AVG_CHAR_LEVEL, 0);
-}
-
-map<int32,int32>* WorldDatabase::GetInstanceRemovedSpawns(int32 instance_id, int8 type)
-{
-	DatabaseResult result;
-	map<int32,int32>* ret = NULL;
-
-	LogWrite(SPAWN__TRACE, 1, "Spawn", "Enter %s", __FUNCTION__);
-
-	LogWrite(INSTANCE__DEBUG, 0, "Instance", "Loading removed spawns for instance_id: %u, spawn_type: %i", instance_id, type);
-
-	if( !database_new.Select(&result, "SELECT spawn_location_entry_id, respawn_time FROM instance_spawns_removed WHERE instance_id = %i AND spawn_type = %i", instance_id, type) )
-	{
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in GetInstanceRemovedSpawns() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-		return ret;
-	}
-	else
-	{
-		if( result.GetNumRows() > 0 )
-		{
-			ret = new map<int32,int32>;
-
-			while( result.Next() )
-			{
-				int32 spawn_location_entry_id = result.GetInt32Str("spawn_location_entry_id");
-				/* 
-					respawnTime == 0 - never respawn
-					respawnTime = 1 - spawn now
-					respawnTime > 1 (continue timer) 
-				*/
-				int32 respawntime = result.GetInt32Str("respawn_time"); 
-
-				LogWrite(INSTANCE__DEBUG, 5, "Instance", "Found spawn point: %u, respawn time: %i", spawn_location_entry_id, respawntime);
-
-				ret->insert(make_pair(spawn_location_entry_id, respawntime));
-			}
-		}
-		else
-			LogWrite(INSTANCE__DEBUG, 0, "Instance", "No removed spawns found for instance_id: %u, spawn_type: %i", instance_id, type);
-
-	}
-
-	LogWrite(SPAWN__TRACE, 1, "Spawn", "Exit %s", __FUNCTION__);
-
-	return ret;
-}
-
-bool WorldDatabase::CheckVectorForValue(vector<int32>* vector, int32 value) {
-	if ( vector != NULL )
-	{
-		for(int32 i=0;i<vector->size();i++)
-		{
-			int32 compare = vector->at(i);
-			if ( compare == value )
-				return true;
-		}
-	}
-
-	return false;
-}
-
-int32 WorldDatabase::CheckSpawnRemoveInfo(map<int32,int32>* inmap, int32 spawn_location_entry_id) 
-{
-	LogWrite(SPAWN__TRACE, 0, "Spawn", "Enter %s", __FUNCTION__);
-
-	map<int32, int32>::iterator iter;
-
-	if ( inmap != NULL )
-	{
-		for(iter=inmap->begin();iter!=inmap->end();iter++)
-		{
-			if ( iter->first == spawn_location_entry_id )
-				return (int32)iter->second;
-		}
-	}
-
-	return 1;
-}
-
-int32 WorldDatabase::AddCharacterInstance(int32 char_id, int32 instance_id, string zone_name, int8 instance_type, int32 last_success, int32 last_failure, int32 success_lockout, int32 failure_lockout)
-{
-	int32 ret = 0;
-	if( !database_new.Query("INSERT INTO character_instances (char_id, instance_id, instance_zone_name, instance_type, last_success_timestamp, last_failure_timestamp, success_lockout_time, failure_lockout_time) VALUES (%u, %u, '%s', %i, %u, %u, %u, %u) ", char_id, instance_id, database_new.EscapeStr(zone_name).c_str(), instance_type, last_success, last_failure, success_lockout, failure_lockout) )
-	{
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in AddCharacterInstance() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-		return 0;
-	}
-	ret = database_new.LastInsertID();
-
-	LogWrite(INSTANCE__DEBUG, 0, "Instance", "Adding character %u to instance: %u", char_id, instance_id);
-	//LogWrite(INSTANCE__DEBUG, 1, "Instance", "-- Reenter: %u, Reset: %u, Lockout: %u", grant_reenter_time_left, grant_reset_time_left, lockout_time);
-
-	return ret;
-}
-
-bool WorldDatabase::UpdateCharacterInstanceTimers(int32 char_id, int32 instance_id, int32 lockout_time, int32 reset_time, int32 reenter_time )
-{
-	if ( lockout_time > 0 && reset_time > 0  && reenter_time > 0 )
-		database_new.Query("UPDATE character_instances SET lockout_time = %i, grant_reset_time_left = %i, grant_reenter_time_left = %i WHERE char_id = %i AND instance_id = %i", lockout_time, reset_time, reenter_time, char_id, instance_id);
-	else if ( lockout_time > 0 && reset_time > 0 )
-		database_new.Query("UPDATE character_instances SET lockout_time = %i, grant_reset_time_left = %i WHERE char_id = %i AND instance_id = %i", lockout_time, reset_time, char_id, instance_id);
-	else if ( reset_time > 0  && reenter_time > 0 )
-		database_new.Query("UPDATE character_instances SET grant_reset_time_left = %i, grant_reenter_time_left = %i WHERE char_id = %i AND instance_id = %i",reset_time, reenter_time, char_id, instance_id);
-	else if ( lockout_time > 0  && reenter_time > 0 )
-		database_new.Query("UPDATE character_instances SET lockout_time = %i, grant_reenter_time_left = %i WHERE char_id = %i AND instance_id = %i", lockout_time, reenter_time, char_id, instance_id);
-	else if ( lockout_time > 0 )
-		database_new.Query("UPDATE character_instances SET lockout_time = %i WHERE char_id = %i AND instance_id = %i", lockout_time, char_id, instance_id);
-	else if ( reset_time > 0 )
-		database_new.Query("UPDATE character_instances SET grant_reset_time_left = %i WHERE char_id = %i AND instance_id = %i", reset_time, char_id, instance_id);
-	else if ( reenter_time > 0 )
-		database_new.Query("UPDATE character_instances SET grant_reenter_time_left = %i WHERE char_id = %i AND instance_id = %i", reenter_time, char_id, instance_id);
-
-	if( database_new.GetError() ) 
-	{
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in UpdateCharacterInstanceTimers() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-		return false;
-	}
-	else
-	{
-		if ( database_new.AffectedRows() > 0 )
-		{
-			LogWrite(INSTANCE__DEBUG, 0, "Instance", "Updating instance timers for character %u to instance: %u", char_id, instance_id);
-			LogWrite(INSTANCE__DEBUG, 1, "Instance", "-- Reenter: %u, Reset: %u, Lockout: %u", reenter_time, reset_time, lockout_time);
-			return true;
-		}
-		else
-			return false;
-	}
-}
-
-bool WorldDatabase::UpdateCharacterInstance(int32 char_id, string zone_name, int32 instance_id, int8 type, int32 timestamp) {
-	// type = 1 = success timestamp
-	// type = 2 = failure timestamp
-	if (instance_id > 0) {
-		if (type == 1) {
-			database_new.Query("UPDATE character_instances SET instance_id = %u, last_success_timestamp = %u WHERE char_id = %u AND instance_zone_name = '%s'", instance_id, timestamp, char_id, database_new.EscapeStr(zone_name).c_str());
-		}
-		else if (type == 2) {
-			database_new.Query("UPDATE character_instances SET instance_id = %u, last_failure_timestamp = %u WHERE char_id = %u AND instance_zone_name = '%s'", instance_id, timestamp, char_id, database_new.EscapeStr(zone_name).c_str());
-		}
-		else {
-			database_new.Query("UPDATE character_instances SET instance_id = %u WHERE char_id = %u AND instance_zone_name = '%s'", instance_id, char_id, database_new.EscapeStr(zone_name).c_str());
-		}
-	}
-	else {
-		if (type == 1) {
-			database_new.Query("UPDATE character_instances SET last_success_timestamp = %u WHERE char_id = %u AND instance_zone_name = '%s'", timestamp, char_id, database_new.EscapeStr(zone_name).c_str());
-		}
-		else if (type == 2) {
-			database_new.Query("UPDATE character_instances SET last_failure_timestamp = %u WHERE char_id = %u AND instance_zone_name = '%s'", timestamp, char_id, database_new.EscapeStr(zone_name).c_str());
-		}
-	}
-
-	if (database_new.GetError()) {
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in UpdateCharacterInstance() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-		return false;
-	}
-
-	return true;
-}
-
-bool WorldDatabase::VerifyInstanceID(int32 char_id, int32 instance_id) {
-	DatabaseResult result;
-	database_new.Select(&result, "SELECT COUNT(id) as num_instances FROM instances WHERE id = %u", instance_id);
-
-	if (result.Next() && result.GetInt32Str("num_instances") == 0) {
-		DeleteCharacterFromInstance(char_id, instance_id);
-		return false;
-	}
-
-	return true;
-}
-
-bool WorldDatabase::UpdateInstancedSpawnRemoved(int32 spawn_location_entry_id, int32 spawn_type, int32 respawn_time, int32 instance_id )
-{
-	LogWrite(INSTANCE__DEBUG, 0, "Instance", "Updating removed spawns for instance_id: %u", instance_id);
-	LogWrite(INSTANCE__DEBUG, 1, "Instance", "-- Spawn Location Entry ID: %u, Type: %u, Respawn: %u", spawn_location_entry_id, spawn_type, respawn_time);
-
-	if( !database_new.Query("UPDATE instance_spawns_removed SET respawn_time = %i WHERE spawn_location_entry_id = %i AND spawn_type = %i AND instance_id = %i", respawn_time, spawn_location_entry_id, spawn_type, instance_id) )
-	{
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in UpdateInstancedSpawnRemoved() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-		return false;
-	}
-
-	if ( database_new.AffectedRows() > 0 )
-	{
-		LogWrite(INSTANCE__DEBUG, 0, "Instance", "Updated removed spawns for instance_id: %u", instance_id);
-		return true;
-	}
-	else
-		return false;
-}
-
-int32 WorldDatabase::CreateNewInstance(int32 zone_id)
-{
-	int32 ret = 0;
-
-	LogWrite(INSTANCE__DEBUG, 0, "Instance", "Creating new instance for zone: %u ", zone_id);
-
-	if( !database_new.Query("INSERT INTO instances (zone_id) VALUES (%u)", zone_id) )
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in CreateNewInstance() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-	else
-		ret = database_new.LastInsertID();
-
-	if( ret > 0 )
-		LogWrite(INSTANCE__DEBUG, 0, "Instance", "Created new instance_id %u for zone: %u ", ret, zone_id);
-
-	return ret;
-}
-
-int32 WorldDatabase::CreateInstanceSpawnRemoved(int32 spawn_location_entry_id, int32 spawn_type, int32 respawn_time, int32 instance_id )
-{
-	int32 ret = 0;
-
-	LogWrite(INSTANCE__DEBUG, 3, "Instance", "Creating new instance spawn removed entries for instance_id: %u ", instance_id);
-	LogWrite(INSTANCE__DEBUG, 5, "Instance", "-- Spawn Location Entry ID: %u, Type: %u, Respawn: %u", spawn_location_entry_id, spawn_type, respawn_time);
-
-	if( !database_new.Query("INSERT INTO instance_spawns_removed (spawn_location_entry_id, spawn_type, instance_id, respawn_time) values(%u, %u, %u, %u)", spawn_location_entry_id, spawn_type, instance_id, respawn_time) )
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in CreateInstanceSpawnRemoved() query '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-	else
-		ret = database_new.LastInsertID();
-
-	// potentially spammy, if it calls for every spawn added. Set to level 3 or 5?
-	if( ret > 0 )
-		LogWrite(INSTANCE__DEBUG, 5, "Instance", "Created new spawn removed entry: %u for instance_id %u", ret, instance_id);
-
-	return ret;
-}
-
-bool WorldDatabase::DeleteInstance(int32 instance_id)
-{
-	if( !database_new.Query("DELETE FROM instances WHERE id = %u", instance_id) )
-	{
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in DeleteInstance() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-		return false;
-	}
-	
-	/* JA: should not need this delete with FK/Constraints
-	if( !database_new.Query("DELETE FROM instance_spawns_removed WHERE instance_id = %u", instance_id) )
-	{
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in DeleteInstance() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-		return false;
-	}
-	*/
-
-	// Remove the instance from the character_instances table
-	database_new.Query("UPDATE `character_instances` SET `instance_id` = 0 WHERE `instance_id` = %u", instance_id);
-
-	LogWrite(INSTANCE__DEBUG, 0, "Instance", "Deleted instance_id %u", instance_id);
-
-	return true;
-}
-
-bool WorldDatabase::DeleteInstanceSpawnRemoved(int32 instance_id, int32 spawn_location_entry_id) 
-{
-	if( !database_new.Query("DELETE FROM instance_spawns_removed WHERE instance_id = %u AND spawn_location_entry_id = %u", instance_id, spawn_location_entry_id) )
-	{
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in DeleteInstanceSpawnRemoved() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-		return false;
-	}
-
-	LogWrite(INSTANCE__DEBUG, 0, "Instance", "Deleted removed spawn: %u for instance_id %u", spawn_location_entry_id, instance_id);
-
-	return true;
-}
-
-bool WorldDatabase::DeleteCharacterFromInstance(int32 char_id, int32 instance_id)
-{
-	LogWrite(INSTANCE__DEBUG, 0, "Instance", "Delete character %u from instance_id %u.", char_id, instance_id);
-
-	if( !database_new.Query("UPDATE `character_instances` SET `instance_id` = 0 WHERE `instance_id` = %u AND `char_id` = %u", instance_id, char_id) )
-	{
-		LogWrite(INSTANCE__ERROR, 0, "Instance", "Error in DeleteCharacterFromInstance() '%s': %i", database_new.GetErrorMsg(), database_new.GetError());
-		return false;
-	}
-
-	if ( database_new.AffectedRows() == 0 ) // didn't find an instance to delete
-	{
-		LogWrite(INSTANCE__DEBUG, 1, "Instance", "No instance_id %u for character %u to delete.", instance_id, char_id);
-		return false;
-	}
-	else
-	{
-		// delete entire instance if the last player has left
-		DatabaseResult result;
-		database_new.Select(&result, "SELECT count(id) as num_instances FROM character_instances where instance_id = %u",instance_id);
-
-		if(result.Next() && result.GetInt32Str("num_instances") == 0)
-		{
-			LogWrite(INSTANCE__DEBUG, 0, "Instance", "No characters in instance: Delete instance_id %u.", instance_id);
-			DeleteInstance(instance_id);
-		}
-	}
-
-	return true;
-}
-
-bool WorldDatabase::LoadCharacterInstances(Client* client) 
-{
-	DatabaseResult result;
-	DatabaseResult result2;
-
-	bool addedInstance = false;
-
-	database_new.Select(&result, "SELECT `id`, `instance_id`, `instance_zone_name`, `instance_type`, `last_success_timestamp`, `last_failure_timestamp`, `success_lockout_time`, `failure_lockout_time` FROM `character_instances` WHERE `char_id` = %u", client->GetCharacterID());
-
-	if( result.GetNumRows() > 0 )
-	{
-		while( result.Next() )
-		{
-			int32 zone_id = 0;
-			int32 instance_id = result.GetInt32Str("instance_id");
-			// If `instance_id` is greater then 0 then get the zone id with it, else get the zone id from the zone name
-			if (instance_id != 0) {
-				if (database_new.Select(&result2, "SELECT `zone_id` FROM `instances` WHERE `id` = %u", instance_id)) {
-					if (result2.Next())
-						zone_id = result2.GetInt32Str("zone_id");
-				}
-			}
-			 if (zone_id == 0)
-				zone_id = GetZoneID(result.GetStringStr("instance_zone_name"));
-
-			client->GetPlayer()->GetCharacterInstances()->AddInstance(
-				result.GetInt32Str("id"),
-				instance_id,
-				result.GetInt32Str("last_success_timestamp"),
-				result.GetInt32Str("last_failure_timestamp"),
-				result.GetInt32Str("success_lockout_time"),
-				result.GetInt32Str("failure_lockout_time"),
-				zone_id,
-				result.GetInt8Str("instance_type"),
-				string(result.GetStringStr("instance_zone_name"))
-				);
-			addedInstance = true;
-		}
-	}
-
-	return addedInstance;
-}
-
-void WorldDatabase::UpdateLoginEquipment() 
-{
-	LogWrite(INIT__LOGIN_DEBUG, 0, "Login", "Updating `character_items` CRC in %s", __FUNCTION__);
-
-	database_new.Query("UPDATE character_items SET login_checksum = CRC32(CRC32(type) + CRC32(slot) + CRC32(item_id)) WHERE `type` = 'EQUIPPED' AND ( slot <= 8 OR slot = 19 )");
-}
-
-MutexMap<int32, LoginEquipmentUpdate>* WorldDatabase::GetEquipmentUpdates() 
-{
-	DatabaseResult result;
-	MutexMap<int32, LoginEquipmentUpdate>* ret = 0;
-	LoginEquipmentUpdate update;
-	int32 count = 0;
-
-	LogWrite(INIT__LOGIN_DEBUG, 0, "Login", "Looking for Login Appearance Updates...");
-	
-	// TODO: Someday store the equipment colors in character_items, for custom colorization of gear (?)
-	if( database_new.Select(&result, "SELECT ci.id, ci.char_id, ia.equip_type, ia.red, green, ia.blue, ia.highlight_red, ia.highlight_green, ia.highlight_blue, ci.slot FROM characters c JOIN character_items ci ON c.id = ci.char_id JOIN item_appearances ia ON ci.item_id = ia.item_id WHERE c.deleted = 0 AND ci.type = 'EQUIPPED' AND ( ci.slot <= 8 OR ci.slot = 19 ) AND ci.login_checksum <> CRC32(CRC32(`ci`.`type`) + CRC32(ci.slot) + CRC32(ci.item_id)) ORDER BY ci.char_id, ci.slot") )
-	{
-		while( result.Next() )
-		{
-			LogWrite(INIT__LOGIN_DEBUG, 5, "Login", "Found update for char_id %i!", result.GetInt32Str("char_id"));
-
-			if(!ret)
-				ret = new MutexMap<int32, LoginEquipmentUpdate>();
-
-			update.world_char_id	= result.GetInt32Str("char_id");
-			update.equip_type		= result.GetInt16Str("equip_type");
-			update.red				= result.GetInt8Str("red");
-			update.green			= result.GetInt8Str("green");
-			update.blue				= result.GetInt8Str("blue");
-			update.highlight_red	= result.GetInt8Str("highlight_red");
-			update.highlight_green	= result.GetInt8Str("highlight_green");
-			update.highlight_blue	= result.GetInt8Str("highlight_blue");
-			update.slot				= result.GetInt8Str("slot");
-			ret->Put(result.GetInt32Str("id"), update);
-			count++;
-
-		}
-	}
-
-	if(count)
-		LogWrite(INIT__LOGIN_DEBUG, 0, "Login", "Found %i Login Appearance Update%s...", count, count == 1 ? "" : "s");
-
-	return ret;
-}
-
-
-MutexMap<int32, LoginEquipmentUpdate>* WorldDatabase::GetEquipmentUpdates(int32 char_id) 
-{
-	DatabaseResult result;
-	MutexMap<int32, LoginEquipmentUpdate>* ret = 0;
-	LoginEquipmentUpdate update;
-	int32 count = 0;
-
-	LogWrite(INIT__LOGIN_DEBUG, 0, "Login", "Looking for Login Appearance Updates for char_id: %u", char_id);
-
-	// TODO: Someday store the equipment colors in character_items, for custom colorization of gear (?)
-	if( database_new.Select(&result, "SELECT ci.id, ci.char_id, ia.equip_type, ia.red, green, ia.blue, ia.highlight_red, ia.highlight_green, ia.highlight_blue, ci.slot FROM characters c JOIN character_items ci ON c.id = ci.char_id JOIN item_appearances ia ON ci.item_id = ia.item_id WHERE c.deleted = 0 AND ci.type = 'EQUIPPED' AND ( ci.slot <= 8 OR ci.slot = 19 ) AND ci.login_checksum <> CRC32(CRC32(ci.type) + CRC32(ci.slot) + CRC32(ci.item_id)) AND ci.char_id = %u ORDER BY ci.slot", char_id) )
-	{
-		while( result.Next() )
-		{
-			LogWrite(INIT__LOGIN_DEBUG, 5, "Login", "Found update for char_id %i!", result.GetInt32Str("char_id"));
-
-			if(!ret)
-				ret = new MutexMap<int32, LoginEquipmentUpdate>();
-
-			update.world_char_id	= char_id;
-			update.equip_type		= result.GetInt16Str("equip_type");
-			update.red				= result.GetInt8Str("red");
-			update.green			= result.GetInt8Str("green");
-			update.blue				= result.GetInt8Str("blue");
-			update.highlight_red	= result.GetInt8Str("highlight_red");
-			update.highlight_green	= result.GetInt8Str("highlight_green");
-			update.highlight_blue	= result.GetInt8Str("highlight_blue");
-			update.slot				= result.GetInt8Str("slot");
-			ret->Put(result.GetInt32Str("id"), update);
-			count++;
-		}
-	}
-		
-	if(count)
-		LogWrite(INIT__LOGIN_DEBUG, 0, "Login", "Found %i Login Appearance Update%s...", count, count == 1 ? "" : "s");
-
-	return ret;
-}
-
-
-void WorldDatabase::UpdateLoginZones() {
-	Query query;
-	LogWrite(INIT__LOGIN_DEBUG, 0, "Login", "Updating `zones` CRC in %s", __FUNCTION__);
-	query.RunQuery2("UPDATE zones SET login_checksum = CRC32(CRC32(id) + CRC32(`name`) + CRC32(`file`) + CRC32(description))", Q_UPDATE);
-}
-
-MutexMap<int32, LoginZoneUpdate>* WorldDatabase::GetZoneUpdates() {
-	LogWrite(INIT__LOGIN_DEBUG, 0, "Login", "Looking for Login Zone Updates...");
-	MutexMap<int32, LoginZoneUpdate>* ret = 0;
-	LoginZoneUpdate update;
-	Query query;
-	MYSQL_ROW row;
-	int32 count = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, name, description FROM zones where login_checksum != crc32(crc32(id) + crc32(name) + crc32(file) + crc32(description))");
-	while(result && (row = mysql_fetch_row(result))) {
-		if(row[0] && row[1]) {
-
-			LogWrite(INIT__LOGIN_DEBUG, 5, "Login", "Found update for zone_id %i!", atoi(row[0]));
-
-			if(!ret)
-				ret = new MutexMap<int32, LoginZoneUpdate>();			
-			update.name = string(row[1]);
-			if(row[2])
-				update.description = string(row[2]);
-			else
-				update.description = "";
-			ret->Put(atoi(row[0]), update);
-			count++;
-		}
-	}
-	if(count)
-		LogWrite(INIT__LOGIN_DEBUG, 0, "Login", "Found %i Login Zone Update%s...", count, count == 1 ? "" : "s");
-	return ret;
-}
-
-void WorldDatabase::LoadLocationGrids(ZoneServer* zone) {
-	if (zone) {
-		Query query;
-		MYSQL_ROW row;
-		MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `id`, `grid_id`, `name`, `include_y`, `discovery` FROM `locations` WHERE `zone_id`=%u", zone->GetZoneID());
-		while (result && (row = mysql_fetch_row(result))) {
-			LocationGrid* grid = new LocationGrid;
-			grid->id = atoul(row[0]);
-			grid->grid_id = atoul(row[1]);
-			grid->name = string(row[2]);
-			grid->include_y = (atoi(row[3]) == 1);
-			grid->discovery = (atoi(row[4]) == 1);
-			if (LoadLocationGridLocations(grid))
-				zone->AddLocationGrid(grid);
-			else
-				safe_delete(grid);
-		}
-	}
-}
-
-bool WorldDatabase::LoadLocationGridLocations(LocationGrid* grid) {
-	bool ret = false;
-	if (grid) {
-		Query query;
-		MYSQL_ROW row;
-		MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `id`, `x`, `y`, `z` FROM `location_details` WHERE `location_id`=%u", grid->id);
-		if (result->row_count >= 3) {
-			while (result && (row = mysql_fetch_row(result))) {
-				Location* location = new Location;
-				location->id = atoul(row[0]);
-				location->x = atof(row[1]);
-				location->y = atof(row[2]);
-				location->z = atof(row[3]);
-				grid->locations.Add(location);
-			}
-			ret = true;
-		}
-		else
-			LogWrite(WORLD__ERROR, 0, "World", "Grid '%s' only has %u location(s).  A minimum of 3 is needed.", grid->name.c_str(), result->row_count);
-	}
-	return ret;
-}
-
-int32 WorldDatabase::CreateLocation(int32 zone_id, int32 grid_id, const char* name, bool include_y) {
-	int32 ret = 0;
-	if (name && strlen(name) > 0) {
-		Query query;
-		query.RunQuery2(Q_INSERT, "INSERT INTO `locations` (`zone_id`, `grid_id`, `name`, `include_y`) VALUES (%u, %u, '%s', %u)", zone_id, grid_id, name, include_y == true ? 1 : 0);
-		ret = query.GetLastInsertedID();
-	}
-	return ret;
-}
-
-bool WorldDatabase::AddLocationPoint(int32 location_id, float x, float y, float z) {
-	bool ret = false;
-	if (LocationExists(location_id)) {
-		Query query;
-		query.RunQuery2(Q_INSERT, "INSERT INTO `location_details` (`location_id`, `x`, `y`, `z`) VALUES (%u, %f, %f, %f)", location_id, x, y, z);
-		ret = true;
-	}
-	return ret;
-}
-
-bool WorldDatabase::DeleteLocation(int32 location_id) {
-	bool ret = false;
-	if (LocationExists(location_id)) {
-		Query query;
-		query.RunQuery2(Q_DELETE, "DELETE FROM `locations` WHERE `id`=%u", location_id);
-		ret = true;
-	}
-	return ret;
-}
-
-bool WorldDatabase::DeleteLocationPoint(int32 location_point_id) {
-	Query query;
-	query.RunQuery2(Q_DELETE, "DELETE FROM `location_details` WHERE `id`=%u", location_point_id);
-	return true;
-}
-
-void WorldDatabase::ListLocations(Client* client) {
-	if (client) {
-		Query query;
-		MYSQL_ROW row;
-		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Listing all locations:");
-		MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `id`, `zone_id`, `grid_id`, `name` FROM `locations`");
-		while (result && (row = mysql_fetch_row(result))) {
-			int32 id = atoul(row[0]);
-			int32 zone_id = atoul(row[1]);
-			int32 grid_id = atoul(row[2]);
-			const char* name = row[3];
-			client->Message(CHANNEL_COLOR_YELLOW, "%u) Zone ID: %u  Grid ID:%u  Name: '%s'", id, zone_id, grid_id, name);
-		}
-	}
-}
-
-void WorldDatabase::ListLocationPoints(Client* client, int32 location_id) {
-	if (client) {
-		if (LocationExists(location_id)) {
-			Query query;
-			client->Message(CHANNEL_COLOR_YELLOW, "Listing all points for location ID %u:", location_id);
-			MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `id`, `x`, `y`, `z` FROM `location_details` WHERE `location_id`=%u", location_id);
-			MYSQL_ROW row;
-			while (result && (row = mysql_fetch_row(result))) {
-				int32 id = atoul(row[0]);
-				float x = atof(row[1]);
-				float y = atof(row[2]);
-				float z = atof(row[3]);
-				client->Message(CHANNEL_COLOR_YELLOW, "%u) (%f, %f, %f)", id, x, y, z);
-			}
-		}
-		else
-			client->Message(CHANNEL_COLOR_YELLOW, "A location with ID %u does not exist", location_id);
-	}
-}
-
-bool WorldDatabase::LocationExists(int32 location_id) {
-	bool ret = false;
-	Query query;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT COUNT(id) FROM `locations` WHERE `id`=%u", location_id);
-	MYSQL_ROW row;
-	if (result && (row = mysql_fetch_row(result))) {
-		if (atoul(row[0]) > 0)
-			ret = true;
-	}
-	return ret;
-}
-
-bool WorldDatabase::GetTableVersions(vector<TableVersion*>* table_versions) {
-	DatabaseResult result;
-	TableVersion *table_version;
-	bool success;
-
-	//don't treat 1146 (table not found) as an error since the patch server will create it
-	database_new.SetIgnoredErrno(1146);
-
-	success = database_new.Select(&result, "SELECT `name`,`version`,`download_version`\n"
-										   "FROM `table_versions`\n");
-	
-	database_new.RemoveIgnoredErrno(1146);
-
-	if (!success)
-		return false;
-
-	while (result.Next()) {
-		table_version = (TableVersion *)malloc(sizeof(*table_version));
-		table_version->name_len = (unsigned int)strlcpy(table_version->name, result.GetString(0), sizeof(table_version->name));
-		table_version->version = result.GetInt32(1);
-		table_version->data_version = result.GetInt32(2);
-
-		table_versions->push_back(table_version);
-	}
-
-	return true;
-}
-
-bool WorldDatabase::QueriesFromFile(const char * file) {
-	return database_new.QueriesFromFile(file);
-}
-
-bool WorldDatabase::CheckBannedIPs(const char* loginIP)
-{
-	// til you build the table, all IPs are allowed
- 	return false;
-}
-
-sint32 WorldDatabase::AddMasterTitle(const char* titleName, int8 isPrefix)
-{
-	if(titleName == nullptr || strlen(titleName) < 1)
-	{
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "AddMasterTitle called with missing titleName");
-		return -1;
-	}
-
-	Query query;
-	Title* title = master_titles_list.GetTitleByName(titleName);
-	
-	if(title)
-		return title->GetID();
-
-	query.RunQuery2(Q_INSERT, "INSERT INTO titles set title='%s', prefix=%u", titleName, isPrefix);
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(DATABASE__ERROR, 0, "Database", "Error in AddMasterTitle query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-
-	int32 last_insert_id = query.GetLastInsertedID();
-	if(last_insert_id > 0)
-	{
-		title = new Title;
-		title->SetID(last_insert_id);
-		title->SetName(titleName);
-		title->SetPrefix(isPrefix);
-		master_titles_list.AddTitle(title);
-		return (sint32)last_insert_id;
-	}
-
-
-	return -1;
-}
-
-void WorldDatabase::LoadTitles(){
-	Query query;
-	MYSQL_ROW row;
-	int32 count = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, title, prefix FROM titles");
-	if(result && mysql_num_rows(result) > 0){
-		Title* title = 0;
-		while(result && (row = mysql_fetch_row(result))){
-			sint32 idx = atoi(row[0]);
-			LogWrite(WORLD__DEBUG, 5, "World", "\tLoading Title '%s' (%u), Prefix: %i, Index: %u", row[1], idx, atoi(row[2]), count);
-			title = new Title;
-			title->SetID(idx);
-			title->SetName(row[1]);
-			title->SetPrefix(atoi(row[2]));
-			master_titles_list.AddTitle(title);
-			count++;
-		}
-	}
-	LogWrite(WORLD__DEBUG, 0, "World", "\tLoaded %u Title%s", count, count == 1 ? "" : "s");
-}
-
-sint32 WorldDatabase::LoadCharacterTitles(int32 char_id, Player *player){
-	LogWrite(WORLD__DEBUG, 0, "World", "Loading Titles for player '%s'...", player->GetName());
-	Query query;
-	MYSQL_ROW row;
-	sint32 index = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT title_id, title, prefix FROM character_titles, titles WHERE character_titles.title_id = titles.id AND character_titles.char_id = %u", char_id);
-	if(result && mysql_num_rows(result) > 0){
-		while(result && (row = mysql_fetch_row(result))){
-			LogWrite(WORLD__DEBUG, 5, "World", "\tLoading Title ID: %u, Title: '%s' Index: %u", atoul(row[0]), row[1], index);
-			player->AddTitle(index, row[1], atoi(row[2]));
-			index++;
-		}
-	}
-	return index;
-}
-
-sint32 WorldDatabase::GetCharPrefixIndex(int32 char_id, Player *player){
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Getting current title index for player '%s'...", player->GetName());
-	Query query;
-	MYSQL_ROW row;
-	sint32 ret = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT prefix_title FROM character_details WHERE char_id = %u", char_id);
-	if(result && mysql_num_rows(result) > 0)
-		while(result && (row = mysql_fetch_row(result))){
-			 ret  = atoi(row[0]);
-			LogWrite(PLAYER__DEBUG, 5, "Player", "\tPrefix Index: %i", ret);
-		}
-	return ret;
-}
-
-sint32 WorldDatabase::GetCharSuffixIndex(int32 char_id, Player *player){
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Getting current title index for player '%s'...", player->GetName());
-	Query query;
-	MYSQL_ROW row;
-	sint32 ret = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT suffix_title FROM character_details WHERE char_id = %u", char_id);
-	if(result && mysql_num_rows(result) > 0)
-		while(result && (row = mysql_fetch_row(result))){
-			ret = atoi(row[0]);
-			LogWrite(PLAYER__DEBUG, 5, "Player", "\tSuffix Index: %i", ret);
-		}
-	return ret;
-}
-
-void WorldDatabase::SaveCharPrefixIndex(sint32 index, int32 char_id){
-	Query query;
-	query.RunQuery2(Q_UPDATE, "UPDATE character_details SET prefix_title = %i WHERE char_id = %u", index, char_id);
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Saving Prefix Index %i for character id '%u'...", index, char_id);
-}
-
-void WorldDatabase::SaveCharSuffixIndex(sint32 index, int32 char_id){
-	Query query;
-	query.RunQuery2(Q_SELECT, "UPDATE character_details SET suffix_title = %i WHERE char_id = %u", index, char_id);
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Saving Suffix Index %i for character id %u...", index, char_id);
-}
-
-sint32 WorldDatabase::AddCharacterTitle(sint32 index, int32 char_id, Spawn* player) {
-	if(!player || !player->IsPlayer())
-	{
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "AddCharacterTitle spawn is not a player: %s", player ? player->GetName() : "Unset");
-		return -1;
-	}
-
-	Title* title = master_titles_list.GetTitle(index);
-	if(!title)
-	{
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "AddCharacterTitle title index %u missing from master_titles_list for player: %s (%u)", index, player ? player->GetName() : "Unset", char_id);
-		return -1;
-	}
-
-	Query query;
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Adding titles for char_id: %u, index: %i", char_id, index);
-	query.RunQuery2(Q_INSERT, "INSERT IGNORE INTO character_titles (char_id, title_id) VALUES (%u, %i)", char_id, index);
-	sint32 curIndex = (sint32)((Player*)player)->GetPlayerTitles()->Size();
-	((Player*)player)->AddTitle(curIndex++, title->GetName(), title->GetPrefix(), title->GetSaveNeeded());
-
-	return curIndex;
-}
-
-void WorldDatabase::LoadLanguages()
-{
-	int32 count = 0;
-	Query query;
-	MYSQL_ROW row;
-
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, language FROM languages");
-
-	if(result && mysql_num_rows(result) > 0)
-	{
-		Language* language = 0;
-
-		while(result && (row = mysql_fetch_row(result)))
-		{
-			LogWrite(WORLD__DEBUG, 5, "World", "\tLoading language '%s' , ID: %u", row[1], atoul(row[0]));
-			language = new Language;
-			language->SetID(atoul(row[0]));
-			language->SetName(row[1]);
-			master_languages_list.AddLanguage(language);
-			count++;
-		}
-	}
-	LogWrite(WORLD__DEBUG, 0, "World", "\tLoaded %u Language%s", count, count == 1 ? "" : "s");
-}
-
-int32 WorldDatabase::LoadCharacterLanguages(int32 char_id, Player *player)
-{
-	LogWrite(WORLD__DEBUG, 0, "World", "Loading Languages for player '%s'...", player->GetName());
-	Query query;
-	MYSQL_ROW row;
-	int32 count = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT language_id, language FROM character_languages, languages WHERE character_languages.language_id = languages.id AND character_languages.char_id = %u", char_id);
-
-	if(result && mysql_num_rows(result) > 0)
-	{
-		while(result && (row = mysql_fetch_row(result)))
-		{
-			LogWrite(WORLD__DEBUG, 5, "World", "\tLoading Language ID: %u, Language: '%s'", atoul(row[0]), row[1]);
-			player->AddLanguage(atoul(row[0]), row[1]);
-			count++;
-		}
-	}
-	return count;
-}
-
-int16 WorldDatabase::GetCharacterCurrentLang(int32 char_id, Player *player)
-{
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Getting current language for player '%s'...", player->GetName());
-	Query query;
-	MYSQL_ROW row;
-	int16 ret = 0;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT current_language FROM character_details WHERE char_id = %u", char_id);
-
-	if(result && mysql_num_rows(result) > 0)
-		while(result && (row = mysql_fetch_row(result)))
-		{
-			ret = atoi(row[0]);
-			LogWrite(PLAYER__DEBUG, 5, "Player", "\tLanguage ID: %i", ret);
-		}
-	return ret;
-}
-
-void WorldDatabase::SaveCharacterCurrentLang(int32 id, int32 char_id, Client *client)
-{
-	Query query;
-	query.RunQuery2(Q_UPDATE, "UPDATE character_details SET current_language = %i WHERE char_id = %u", id, char_id);
-	LogWrite(PLAYER__DEBUG, 3, "Player", "Saving current language ID %i for player '%s'...", id, client->GetPlayer()->GetName());
-}
-
-void WorldDatabase::SaveCharacterLang(int32 char_id, int32 lang_id) {
-	if (!database_new.Query("INSERT INTO character_languages (char_id, language_id) VALUES (%u, %u)", char_id, lang_id))
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "MySQL Error %u: %s", database_new.GetError(), database_new.GetErrorMsg());
-}
-
-// JA - this is not used yet, lots more to consider for storing player history
-void WorldDatabase::LoadCharacterHistory(int32 char_id, Player *player) 
-{
-	DatabaseResult result;
-
-	// Use -1 on type and subtype to turn the enum into an int and make it a 0 index
-	if (!database_new.Select(&result, "SELECT type-1, subtype-1, value, value2, location, event_id, event_date FROM character_history WHERE char_id = %u", char_id)) {
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "MySQL Error %u: %s", database_new.GetError(), database_new.GetErrorMsg());
-		return;
-	}
-
-	while (result.Next()) {
-
-		int8 type = result.GetInt8(0);
-		int8 subtype = result.GetInt8(1);
-
-		HistoryData* hd = new HistoryData;
-		hd->Value = result.GetInt32(2);
-		hd->Value2 = result.GetInt32(3);
-		strcpy(hd->Location, result.GetString(4));
-		// skipped event id as use for it has not been determined yet
-		hd->EventDate = result.GetInt32(6);
-
-		player->LoadPlayerHistory(type, subtype, hd);
-	}
-}
-
-void WorldDatabase::LoadSpellErrors() {
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `version`, `error_index`, `value` FROM `spell_error_versions`");
-
-	if (result && mysql_num_rows(result) > 0) {
-		while ((row = mysql_fetch_row(result))) {
-			master_spell_list.AddSpellError(atoi(row[0]), atoi(row[1]), atoi(row[2]));
-		}
-	}
-}
-
-void WorldDatabase::SaveCharacterHistory(Player* player, int8 type, int8 subtype, int32 value, int32 value2, char* location, int32 event_date) {
-	string str_type;
-	string str_subtype;
-	switch (type) {
-	case HISTORY_TYPE_NONE:
-		str_type = "None";
-		break;
-	case HISTORY_TYPE_DEATH:
-		str_type = "Death";
-		break;
-	case HISTORY_TYPE_DISCOVERY:
-		str_type = "Discovery";
-		break;
-	case HISTORY_TYPE_XP:
-		str_type = "XP";
-		break;
-	default:
-		LogWrite(PLAYER__ERROR, 0, "Player", "WorldDatabase::SaveCharacterHistory() - Invalid history type given (%i) with subtype (%i), character history NOT saved.", type, subtype);
-		return;
-	}
-	switch (subtype) {
-	case HISTORY_SUBTYPE_NONE:
-		str_subtype = "None";
-		break;
-	case HISTORY_SUBTYPE_ADVENTURE:
-		str_subtype = "Adventure";
-		break;
-	case HISTORY_SUBTYPE_TRADESKILL:
-		str_subtype = "Tradeskill";
-		break;
-	case HISTORY_SUBTYPE_QUEST:
-		str_subtype = "Quest";
-		break;
-	case HISTORY_SUBTYPE_AA:
-		str_subtype = "AA";
-		break;
-	case HISTORY_SUBTYPE_ITEM:
-		str_subtype = "Item";
-		break;
-	case HISTORY_SUBTYPE_LOCATION:	
-		str_subtype = "Location";
-		break;
-	default:
-		LogWrite(PLAYER__ERROR, 0, "Player", "WorldDatabase::SaveCharacterHistory() - Invalid history sub type given (%i) with type (%i), character history NOT saved.", subtype, type);
-		return;
-	}
-
-	LogWrite(PLAYER__INFO, 1, "Player", "Saving character history, type = %s (%i) subtype = %s (%i)", (char*)str_type.c_str(), type, (char*)str_subtype.c_str(), subtype);
-
-	Query query;
-	query.AddQueryAsync(player->GetCharacterID(), this, Q_REPLACE, "replace into character_history (char_id, type, subtype, value, value2, location, event_date) values (%u, '%s', '%s', %i, %i, '%s', %u)", 
-		player->GetCharacterID(), str_type.c_str(), str_subtype.c_str(), value, value2, location, event_date);
-}
-
-void WorldDatabase::LoadTransportMaps(ZoneServer* zone) {
-	int32 total = 0;
-
-	LogWrite(TRANSPORT__DEBUG, 0, "Transport", "-Loading Transporter Maps...");
-	zone->DeleteTransporterMaps();
-
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `transport_id`, `map_name` FROM `transport_maps`");
-	if(result) {
-		while(result && (row = mysql_fetch_row(result))){
-			zone->AddTransportMap(atoul(row[0]), string(row[1]));
-			total++;
-		}
-	}
-	LogWrite(TRANSPORT__DEBUG, 0, "Transport", "--Loaded %i Transporter Maps", total);
-}
-
-bool WorldDatabase::LoadSign(ZoneServer* zone, int32 spawn_id) {
-	Sign* sign = 0;
-	int32 id = 0;
-	DatabaseResult result;
-	database_new.Select(&result, "SELECT ss.spawn_id, s.name, s.model_type, s.size, s.show_command_icon, ss.widget_id, ss.widget_x, ss.widget_y, ss.widget_z, s.command_primary, s.command_secondary, s.collision_radius, ss.icon, ss.type, ss.title, ss.description, ss.sign_distance, ss.zone_id, ss.zone_x, ss.zone_y, ss.zone_z, ss.zone_heading, ss.include_heading, ss.include_location, s.transport_id, s.size_offset, s.display_hand_icon, s.visual_state, s.disable_sounds, s.merchant_min_level, s.merchant_max_level, s.aaxp_rewards, s.loot_tier\n"
-								 "FROM spawn s\n"
-								 "INNER JOIN spawn_signs ss\n"
-								 "ON ss.spawn_id = s.id\n"
-								 "WHERE s.id = %u\n",
-								 spawn_id);
-
-	if (result.GetNumRows() > 0 && result.Next()) {
-		id = result.GetInt32(0);
-		sign = new Sign();
-		sign->SetDatabaseID(id);
-		strcpy(sign->appearance.name, result.GetString(1));
-		sign->appearance.model_type = result.GetInt16(2);
-		sign->SetSize(result.GetInt16(3));
-		sign->appearance.show_command_icon = result.GetInt8(4);
-		sign->SetWidgetID(result.GetInt32(5));
-		sign->SetWidgetX(result.GetFloat(6));
-		sign->SetWidgetY(result.GetFloat(7));
-		sign->SetWidgetZ(result.GetFloat(8));
-		vector<EntityCommand*>* primary_command_list = zone->GetEntityCommandList(result.GetInt32(9));
-		if(primary_command_list){
-			sign->SetPrimaryCommands(primary_command_list);
-			sign->primary_command_list_id = result.GetInt32(9);
-		}
-
-		vector<EntityCommand*>* secondary_command_list = zone->GetEntityCommandList(result.GetInt32(10));
-		if (secondary_command_list) {
-			sign->SetSecondaryCommands(secondary_command_list);
-			sign->secondary_command_list_id = result.GetInt32(10);
-		}
-
-		sign->appearance.pos.collision_radius = result.GetInt16(11);
-		sign->SetSignIcon(result.GetInt8(12));
-		if(strncasecmp(result.GetString(13), "Generic", 7) == 0)
-			sign->SetSignType(SIGN_TYPE_GENERIC);
-		else if(strncasecmp(result.GetString(13), "Zone", 4) == 0)
-			sign->SetSignType(SIGN_TYPE_ZONE);
-		sign->SetSignTitle(result.GetString(14));
-		sign->SetSignDescription(result.GetString(15));
-		sign->SetSignDistance(result.GetFloat(16));
-		sign->SetSignZoneID(result.GetInt32(17));
-		sign->SetSignZoneX(result.GetFloat(18));
-		sign->SetSignZoneY(result.GetFloat(19));
-		sign->SetSignZoneZ(result.GetFloat(20));
-		sign->SetSignZoneHeading(result.GetFloat(21));
-		sign->SetIncludeHeading(result.GetInt8(22) == 1);
-		sign->SetIncludeLocation(result.GetInt8(23) == 1);
-		sign->SetTransporterID(result.GetInt32(24));
-		sign->SetSizeOffset(result.GetInt8(25));
-		sign->appearance.display_hand_icon = result.GetInt8(26);
-		sign->SetVisualState(result.GetInt16(27));
-
-		sign->SetSoundsDisabled(result.GetInt8(28));
-
-		sign->SetMerchantLevelRange(result.GetInt32(29), result.GetInt32(30));
-		
-		sign->SetAAXPRewards(result.GetInt32(31));
-
-		sign->SetLootTier(result.GetInt32(32));
-
-		zone->AddSign(id, sign);
-
-
-		LogWrite(SIGN__DEBUG, 0, "Sign", "Loaded Sign: '%s' (%u).", sign->appearance.name, spawn_id);
-		return true;
-	}
-	LogWrite(SIGN__DEBUG, 0, "Sign", "Unable to find a sign for spawn id of %u", spawn_id);
-	return false;
-}
-
-bool WorldDatabase::LoadWidget(ZoneServer* zone, int32 spawn_id) {
-	Widget* widget = 0;
-	int32 id = 0;
-	DatabaseResult result;
-
-	database_new.Select(&result, "SELECT sw.spawn_id, s.name, s.model_type, s.size, s.show_command_icon, sw.widget_id, sw.widget_x, sw.widget_y, sw.widget_z, s.command_primary, s.command_secondary, s.collision_radius, sw.include_heading, sw.include_location, sw.icon, sw.type, sw.open_heading, sw.open_y, sw.action_spawn_id, sw.open_sound_file, sw.close_sound_file, sw.open_duration, sw.closed_heading, sw.linked_spawn_id, sw.close_y, s.transport_id, s.size_offset, sw.house_id, sw.open_x, sw.open_z, sw.close_x, sw.close_z, s.display_hand_icon, s.disable_sounds, s.merchant_min_level, s.merchant_max_level, s.aaxp_rewards, s.loot_tier\n"
-								 "FROM spawn s\n"
-								 "INNER JOIN spawn_widgets sw\n"
-								 "ON sw.spawn_id = s.id\n"
-								 "WHERE s.id = %u",
-								 spawn_id);
-
-	if (result.GetNumRows() > 0 && result.Next()) {
-		id = result.GetInt32(0);
-		widget = new Widget();
-		widget->SetDatabaseID(id);
-		strcpy(widget->appearance.name, result.GetString(1));
-		widget->appearance.model_type = result.GetInt16(2);
-		widget->SetSize(result.GetInt16(3));
-		widget->appearance.show_command_icon = result.GetInt8(4);
-		widget->SetWidgetID(result.GetInt32(5));
-		widget->SetWidgetX(result.GetFloat(6));
-		widget->SetWidgetY(result.GetFloat(7));
-		widget->SetWidgetZ(result.GetFloat(8));
-		vector<EntityCommand*>* primary_command_list = zone->GetEntityCommandList(result.GetInt32(9));
-		if(primary_command_list){
-			widget->SetPrimaryCommands(primary_command_list);
-			widget->primary_command_list_id = result.GetInt32(9);
-		}
-
-		vector<EntityCommand*>* secondary_command_list = zone->GetEntityCommandList(result.GetInt32(10));
-		if (secondary_command_list) {
-			widget->SetSecondaryCommands(secondary_command_list);
-			widget->secondary_command_list_id = result.GetInt32(10);
-		}
-
-		widget->appearance.pos.collision_radius = result.GetInt16(11);
-		widget->SetIncludeHeading(result.GetInt8(12) == 1);
-		widget->SetIncludeLocation(result.GetInt8(13) == 1);
-		widget->SetWidgetIcon(result.GetInt8(14));
-		if(strncasecmp(result.GetString(15),"Generic", 7) == 0)
-			widget->SetWidgetType(WIDGET_TYPE_GENERIC);
-		else if(strncasecmp(result.GetString(15),"Door", 4) == 0)
-			widget->SetWidgetType(WIDGET_TYPE_DOOR);
-		widget->SetOpenHeading(result.GetFloat(16));
-		widget->SetOpenY(result.GetFloat(17));
-		widget->SetActionSpawnID(result.GetInt32(18));
-		if(!result.IsNull(19) && strlen(result.GetString(19)) > 5)
-			widget->SetOpenSound(result.GetString(19));
-		if(!result.IsNull(20) && strlen(result.GetString(20)) > 5)
-			widget->SetCloseSound(result.GetString(20));
-		widget->SetOpenDuration(result.GetInt16(21));
-		widget->SetClosedHeading(result.GetFloat(22));
-		widget->SetLinkedSpawnID(result.GetInt32(23));
-		widget->SetCloseY(result.GetFloat(24));
-		widget->SetTransporterID(result.GetInt32(25));
-		widget->SetSizeOffset(result.GetInt8(26));
-		widget->SetHouseID(result.GetInt32(27));
-		widget->SetOpenX(result.GetFloat(28));
-		widget->SetOpenZ(result.GetFloat(29));
-		widget->SetCloseX(result.GetFloat(30));
-		widget->SetCloseZ(result.GetFloat(31));
-		widget->appearance.display_hand_icon = result.GetInt8(32);
-
-		widget->SetSoundsDisabled(result.GetInt8(33));
-
-		widget->SetMerchantLevelRange(result.GetInt32(34), result.GetInt32(35));
-		
-		widget->SetAAXPRewards(result.GetInt32(36));
-
-		widget->SetLootTier(result.GetInt32(37));
-
-		zone->AddWidget(id, widget);
-
-		LogWrite(WIDGET__DEBUG, 0, "Widget", "Loaded Widget: '%s' (%u).", widget->appearance.name, spawn_id);
-		return true;
-	}
-
-	LogWrite(WIDGET__DEBUG, 0, "Widget", "Unable to find a widget for spawn id of %u", spawn_id);
-	return false;
-}
-
-bool WorldDatabase::LoadObject(ZoneServer* zone, int32 spawn_id) {
-	Object* object = 0;
-	int32 id = 0;
-	DatabaseResult result;
-
-	database_new.Select(&result, "SELECT so.spawn_id, s.name, s.race, s.model_type, s.command_primary, s.command_secondary, s.targetable, s.size, s.show_name, s.visual_state, s.attackable, s.show_level, s.show_command_icon, s.display_hand_icon, s.faction_id, s.collision_radius, s.transport_id, s.size_offset, so.device_id, s.disable_sounds, s.merchant_min_level, s.merchant_max_level, s.aaxp_rewards, s.loot_tier\n"
-								 "FROM spawn s\n"
-								 "INNER JOIN spawn_objects so\n"
-								 "ON so.spawn_id = s.id\n"
-								 "WHERE s.id = %u",
-								 spawn_id);
-
-	if (result.GetNumRows() > 0 && result.Next()) {
-		id = result.GetInt32(0);
-		object = new Object();
-		object->SetDatabaseID(id);
-		strcpy(object->appearance.name, result.GetString(1));
-		vector<EntityCommand*>* primary_command_list = zone->GetEntityCommandList(result.GetInt32(4));
-		vector<EntityCommand*>* secondary_command_list = zone->GetEntityCommandList(result.GetInt32(5));
-		if(primary_command_list){
-			object->SetPrimaryCommands(primary_command_list);
-			object->primary_command_list_id = result.GetInt32(4);
-		}
-		if(secondary_command_list){
-			object->SetSecondaryCommands(secondary_command_list);
-			object->secondary_command_list_id = result.GetInt32(5);
-		}
-		object->appearance.race = result.GetInt8(2);
-		object->appearance.model_type = result.GetInt16(3);
-		object->appearance.targetable = result.GetInt8(6);
-		object->size = result.GetInt16(7);
-		object->appearance.display_name = result.GetInt8(8);
-		object->appearance.visual_state = result.GetInt16(9);
-		object->appearance.attackable = result.GetInt8(10);
-		object->appearance.show_level = result.GetInt8(11);
-		object->appearance.show_command_icon = result.GetInt8(12);
-		object->appearance.display_hand_icon = result.GetInt8(13);
-		object->faction_id = result.GetInt32(14);
-		object->appearance.pos.collision_radius = result.GetInt16(15);
-		object->SetTransporterID(result.GetInt32(16));
-		object->SetSizeOffset(result.GetInt8(17));
-		object->SetDeviceID(result.GetInt8(18));
-		object->SetSoundsDisabled(result.GetInt8(19));
-
-		object->SetMerchantLevelRange(result.GetInt32(20), result.GetInt32(21));
-		
-		object->SetAAXPRewards(result.GetInt32(22));
-
-		object->SetLootTier(result.GetInt32(23));
-
-		zone->AddObject(id, object);
-
-		LogWrite(OBJECT__DEBUG, 0, "Object", "Loaded Object: '%s' (%u).", object->appearance.name, spawn_id);
-		return true;
-	}
-
-	LogWrite(OBJECT__DEBUG, 0, "Object", "Unable to find an object for spawn id of %u", spawn_id);
-	return false;
-}
-
-bool WorldDatabase::LoadGroundSpawn(ZoneServer* zone, int32 spawn_id) {
-	GroundSpawn* spawn = 0;
-	int32 id = 0;
-	DatabaseResult result;
-
-	database_new.Select(&result, "SELECT sg.spawn_id, s.name, s.race, s.model_type, s.command_primary, s.command_secondary, s.targetable, s.size, s.show_name, s.visual_state, s.attackable, s.show_level, s.show_command_icon, s.display_hand_icon, s.faction_id, s.collision_radius, sg.number_harvests, sg.num_attempts_per_harvest, sg.groundspawn_id, sg.collection_skill, s.size_offset, s.disable_sounds, s.aaxp_rewards, s.loot_tier\n"
-								 "FROM spawn s\n"
-								 "INNER JOIN spawn_ground sg\n"
-								 "ON sg.spawn_id = s.id\n"
-								 "WHERE s.id = %u",
-								 spawn_id);
-
-	if (result.GetNumRows() > 0 && result.Next()) {
-		id = result.GetInt32(0);
-		spawn = new GroundSpawn();
-		spawn->SetDatabaseID(id);
-		strcpy(spawn->appearance.name, result.GetString(1));
-		vector<EntityCommand*>* primary_command_list = zone->GetEntityCommandList(result.GetInt32(4));
-		vector<EntityCommand*>* secondary_command_list = zone->GetEntityCommandList(result.GetInt32(5));
-		if(primary_command_list){
-			spawn->SetPrimaryCommands(primary_command_list);
-			spawn->primary_command_list_id = result.GetInt32(4);
-		}
-		if(secondary_command_list){
-			spawn->SetSecondaryCommands(secondary_command_list);
-			spawn->secondary_command_list_id = result.GetInt32(5);
-		}
-		spawn->appearance.race = result.GetInt8(2);
-		spawn->appearance.model_type = result.GetInt16(3);
-		spawn->appearance.targetable = result.GetInt8(6);
-		spawn->size = result.GetInt16(7);
-		spawn->appearance.display_name = result.GetInt8(8);
-		spawn->appearance.visual_state = result.GetInt16(9);
-		spawn->appearance.attackable = result.GetInt8(10);
-		spawn->appearance.show_level = result.GetInt8(11);
-		spawn->appearance.show_command_icon = result.GetInt8(12);
-		spawn->appearance.display_hand_icon = result.GetInt8(13);
-		spawn->faction_id = result.GetInt32(14);
-		spawn->appearance.pos.collision_radius = result.GetInt16(15);
-		spawn->SetNumberHarvests(result.GetInt8(16));
-		spawn->SetAttemptsPerHarvest(result.GetInt8(17));
-		spawn->SetGroundSpawnEntryID(result.GetInt32(18));
-		spawn->SetCollectionSkill(result.GetString(19));
-		spawn->SetSizeOffset(result.GetInt8(20));
-		
-		spawn->SetSoundsDisabled(result.GetInt8(21));
-		spawn->SetAAXPRewards(result.GetInt32(22));
-
-		spawn->SetLootTier(result.GetInt32(23));
-
-		zone->AddGroundSpawn(id, spawn);
-
-		if (!zone->GetGroundSpawnEntries(spawn->GetGroundSpawnEntryID()))
-			LoadGroundSpawnEntry(zone, spawn->GetGroundSpawnEntryID());
-
-		LogWrite(GROUNDSPAWN__DEBUG, 0, "GSpawn", "Loaded Ground Spawn: '%s' (%u).", spawn->appearance.name, spawn_id);
-		return true;
-	}
-
-	LogWrite(GROUNDSPAWN__DEBUG, 0, "GSpawn", "Unable to find a ground spawn for spawn id of %u", spawn_id);
-	return false;
-}
-
-void WorldDatabase::LoadGroundSpawnItems(ZoneServer* zone, int32 entry_id) {
- 	DatabaseResult result;
-
-	database_new.Select(&result, "SELECT item_id, is_rare, grid_id\n"
-								 "FROM groundspawn_items\n"
-								 "WHERE groundspawn_id = %u",
-								 entry_id);
-
-	if (result.GetNumRows() > 0 && result.Next()) {
-		zone->AddGroundSpawnItem(entry_id, result.GetInt32(0), result.GetInt8(1), result.GetInt32(2));
-		LogWrite(GROUNDSPAWN__DEBUG, 5, "GSpawn", "---Loading GroundSpawn Items: ID: %u\n", entry_id);
-		LogWrite(GROUNDSPAWN__DEBUG, 5, "GSpawn", "---item: %ul, rare: %i, grid: %ul", result.GetInt32(0), result.GetInt8(1), result.GetInt32(2));
- 	}
-}
-
-void WorldDatabase::LoadGroundSpawnEntry(ZoneServer* zone, int32 entry_id) {
- 	DatabaseResult result;
-
-	database_new.Select(&result, "SELECT min_skill_level, min_adventure_level, bonus_table, harvest1, harvest3, harvest5, harvest_imbue, harvest_rare, harvest10, harvest_coin\n"
-								 "FROM groundspawns\n"
-								 "WHERE enabled = 1 AND groundspawn_id = %u",
-								 entry_id);
-
-	if (result.GetNumRows() > 0 && result.Next()) {
-		// this is getting ridonkulous...
-		LogWrite(GROUNDSPAWN__DEBUG, 5, "GSpawn", "---Loading GroundSpawn ID: %u\n" \
-			"---min_skill_level: %i, min_adventure_level: %i, bonus_table: %i\n" \
-			"---harvest1: %.2f, harvest3: %.2f, harvest5: %.2f\n" \
-			"---harvest_imbue: %.2f, harvest_rare: %.2f, harvest10: %.2f\n" \
-			"---harvest_coin: %u", entry_id, result.GetInt16(0), result.GetInt16(1), result.GetInt8(2), result.GetFloat(3), result.GetFloat(4), result.GetFloat(5), result.GetFloat(6), result.GetFloat(7), result.GetFloat(8), result.GetInt32(9));
-
-		zone->AddGroundSpawnEntry(entry_id, result.GetInt16(0), result.GetInt16(1), result.GetInt8(2), result.GetFloat(3), result.GetFloat(4), result.GetFloat(5), result.GetFloat(6), result.GetFloat(7), result.GetFloat(8), result.GetInt32(9));
-		LoadGroundSpawnItems(zone, entry_id);
- 	}
-}
-
-bool WorldDatabase::LoadNPC(ZoneServer* zone, int32 spawn_id) {
-	NPC* npc = nullptr;
-	int32 id = 0;
-	DatabaseResult result;
-										
-	database_new.Select(&result, "SELECT npc.spawn_id, s.name, npc.min_level, npc.max_level, npc.enc_level, s.race, s.model_type, npc.class_, npc.gender, s.command_primary, s.command_secondary, s.show_name, npc.min_group_size, npc.max_group_size, npc.hair_type_id, npc.facial_hair_type_id, npc.wing_type_id, npc.chest_type_id, npc.legs_type_id, npc.soga_hair_type_id, npc.soga_facial_hair_type_id, s.attackable, s.show_level, s.targetable, s.show_command_icon, s.display_hand_icon, s.hp, s.power, s.size, s.collision_radius, npc.action_state, s.visual_state, npc.mood_state, npc.initial_state, npc.activity_status, s.faction_id, s.sub_title, s.merchant_id, s.merchant_type, s.size_offset, npc.attack_type, npc.ai_strategy+0, npc.spell_list_id, npc.secondary_spell_list_id, npc.skill_list_id, npc.secondary_skill_list_id, npc.equipment_list_id, npc.str, npc.sta, npc.wis, npc.intel, npc.agi, npc.heat, npc.cold, npc.magic, npc.mental, npc.divine, npc.disease, npc.poison, npc.aggro_radius, npc.cast_percentage, npc.randomize, npc.soga_model_type, npc.heroic_flag, npc.alignment, npc.elemental, npc.arcane, npc.noxious, s.savagery, s.dissonance, npc.hide_hood, npc.emote_state, s.prefix, s.suffix, s.last_name, s.disable_sounds, s.merchant_min_level, s.merchant_max_level, s.aaxp_rewards, s.loot_tier\n"
-								 "FROM spawn s\n"
-								 "INNER JOIN spawn_npcs npc\n"
-								 "ON npc.spawn_id = s.id\n"
-								 "WHERE s.id = %u",
-								 spawn_id);
-
-	if (result.GetNumRows() > 0 && result.Next()) {
-		id = result.GetInt32(0);
-		npc = new NPC();
-		npc->SetDatabaseID(id);
-		strcpy(npc->appearance.name, result.GetString(1));
-		vector<EntityCommand*>* primary_command_list = zone->GetEntityCommandList(result.GetInt32(9));
-		vector<EntityCommand*>* secondary_command_list = zone->GetEntityCommandList(result.GetInt32(10));
-		if(primary_command_list){
-			npc->SetPrimaryCommands(primary_command_list);
-			npc->primary_command_list_id = result.GetInt32(9);
-		}
-		if(secondary_command_list){
-			npc->SetSecondaryCommands(secondary_command_list);
-			npc->secondary_command_list_id = result.GetInt32(10);
-		}
-		npc->appearance.min_level = result.GetInt8(2);
-		npc->appearance.max_level = result.GetInt8(3);
-		npc->appearance.level =		result.GetInt8(2);
-		npc->appearance.encounter_level = result.GetInt8(4);
-		npc->appearance.race = result.GetInt8(5);
-		 
-		//npc->appearance.lua_race_id = result.GetInt16(74);
-		npc->appearance.model_type = result.GetInt16(6);
-		npc->appearance.soga_model_type = result.GetInt16(62);
-		npc->appearance.adventure_class = result.GetInt8(7);
-		npc->appearance.gender = result.GetInt8(8);
-		npc->appearance.display_name = result.GetInt8(11);
-		npc->features.hair_type = result.GetInt16(14);
-		npc->features.hair_face_type = result.GetInt16(15);
-		npc->features.wing_type = result.GetInt16(16);
-		npc->features.chest_type = result.GetInt16(17);
-		npc->features.legs_type = result.GetInt16(18);
-		npc->features.soga_hair_type = result.GetInt16(19);
-		npc->features.soga_hair_face_type = result.GetInt16(20);
-		npc->appearance.attackable = result.GetInt8(21);
-		npc->appearance.show_level = result.GetInt8(22);
-		npc->appearance.targetable = result.GetInt8(23);
-		npc->appearance.show_command_icon = result.GetInt8(24);
-		npc->appearance.display_hand_icon = result.GetInt8(25);
-		npc->appearance.hide_hood = result.GetInt8(70);
-		npc->appearance.randomize = result.GetInt32(61);
-		npc->SetTotalHP(result.GetInt32(26));
-		npc->SetTotalPower(result.GetInt32(27));
-		npc->SetHP(npc->GetTotalHP());
-		npc->SetPower(npc->GetTotalPower());
-		if(npc->GetTotalHP() == 0){
-			npc->SetTotalHP(15*npc->GetLevel() + 1);
-			npc->SetHP(15*npc->GetLevel() + 1);
-		}
-		if(npc->GetTotalPower() == 0){
-			npc->SetTotalPower(15*npc->GetLevel() + 1);
-			npc->SetPower(15*npc->GetLevel() + 1);
-		}
-		npc->size = result.GetInt16(28);
-		npc->appearance.pos.collision_radius = result.GetInt16(29);
-		npc->appearance.action_state = result.GetInt16(30);
-		npc->appearance.visual_state = result.GetInt16(31);
-		npc->appearance.mood_state = result.GetInt16(32);
-		npc->appearance.emote_state = result.GetInt16(71);
-		npc->appearance.pos.state = result.GetInt16(33);
-		npc->appearance.activity_status = result.GetInt16(34);
-		npc->faction_id = result.GetInt32(35);
-		if(!result.IsNull(36)){
-			std::string sub_title = std::string(result.GetString(36));
-			if(sub_title.find("Collector") != std::string::npos) {
-				npc->SetCollector(true);
-			}
-			if(strlen(result.GetString(36)) < sizeof(npc->appearance.sub_title))
-				strcpy(npc->appearance.sub_title, result.GetString(36));
-			else
-				strncpy(npc->appearance.sub_title, result.GetString(36), sizeof(npc->appearance.sub_title));
-		}
-		npc->SetMerchantID(result.GetInt32(37));
-		npc->SetMerchantType(result.GetInt8(38));
-		npc->SetSizeOffset(result.GetInt8(39));
-		npc->SetAttackType(result.GetInt8(40));
-		npc->SetAIStrategy(result.GetInt8(41));
-		npc->SetPrimarySpellList(result.GetInt32(42));
-		npc->SetSecondarySpellList(result.GetInt32(43));
-		npc->SetPrimarySkillList(result.GetInt32(44));
-		npc->SetSecondarySkillList(result.GetInt32(45));
-		npc->SetEquipmentListID(result.GetInt32(46));
-
-		InfoStruct* info = npc->GetInfoStruct();
-		info->set_str_base(result.GetInt16(47));
-		info->set_sta_base(result.GetInt16(48));
-		info->set_wis_base(result.GetInt16(49));		
-		info->set_intel_base(result.GetInt16(50));
-		info->set_agi_base(result.GetInt16(51));
-		info->set_heat_base(result.GetInt16(52));
-		info->set_cold_base(result.GetInt16(53));
-		info->set_magic_base(result.GetInt16(54));
-		info->set_mental_base(result.GetInt16(55));
-		info->set_divine_base(result.GetInt16(56));
-		info->set_disease_base(result.GetInt16(57));
-		info->set_poison_base(result.GetInt16(58));
-		info->set_alignment(result.GetInt8(64));
-
-		npc->SetAggroRadius(result.GetFloat(59));
-		npc->SetCastPercentage(result.GetInt8(60));
-		npc->appearance.heroic_flag = result.GetInt8(63);
-
-		info->set_elemental_base(result.GetInt16(65));
-		info->set_arcane_base(result.GetInt16(66));
-		info->set_noxious_base(result.GetInt16(67));
-		npc->SetTotalSavagery(result.GetInt32(68));
-		npc->SetTotalDissonance(result.GetInt32(69));
-		npc->SetSavagery(npc->GetTotalSavagery());
-		npc->SetDissonance(npc->GetTotalDissonance());
-		if(npc->GetTotalSavagery() == 0){
-			npc->SetTotalSavagery(15*npc->GetLevel() + 1);
-			npc->SetSavagery(15*npc->GetLevel() + 1);
-		}
-		if(npc->GetTotalDissonance() == 0){
-			npc->SetTotalDissonance(15*npc->GetLevel() + 1);
-			npc->SetDissonance(15*npc->GetLevel() + 1);
-		}
-		npc->SetPrefixTitle(result.GetString(72));
-		npc->SetSuffixTitle(result.GetString(73));
-		npc->SetLastName(result.GetString(74));
-
-		npc->SetSoundsDisabled(result.GetInt8(75));
-
-		npc->SetMerchantLevelRange(result.GetInt32(76), result.GetInt32(77));
-		
-		npc->SetAAXPRewards(result.GetInt32(78));
-
-		npc->SetLootTier(result.GetInt32(79));
-
-		zone->AddNPC(id, npc);
-
-		//skipped spells/skills/equipment as it is all loaded, the following rely on a spawn to load
-		LoadAppearance(zone, spawn_id);
-		LoadNPCAppearanceEquipmentData(zone, spawn_id);
-		
-		LogWrite(NPC__DEBUG, 0, "NPC", "Loaded NPC: '%s' (%u).", npc->appearance.name, spawn_id);
-		return true;
-	}
-
-	LogWrite(NPC__DEBUG, 0, "NPC", "Unable to find a npc for spawn id of %u", spawn_id);
-	return false;
-}
-
-void WorldDatabase::LoadAppearance(ZoneServer* zone, int32 spawn_id) {
-	Entity* entity = zone->GetNPC(spawn_id);
-	if (!entity)
-		return;
-
-	DatabaseResult result, result2;
-	map<string, int8> appearance_types;
-	map<int32, map<int8, EQ2_Color> > appearance_colors;
-	EQ2_Color color;
-	color.red = 0;
-	color.green = 0;
-	color.blue = 0;
-	string type;
-
-	database_new.Select(&result2, "SELECT distinct `type`\n"
-								 "FROM npc_appearance\n"
-								 "WHERE length(`type`) > 0 AND `spawn_id` = %u",
-								 spawn_id);
-	
-	while(result2.Next()) {
-		type = string(result2.GetString(0));
-		appearance_types[type] = GetAppearanceType(type);
-		if(appearance_types[type] == 255)
-			LogWrite(WORLD__ERROR, 0, "Appearance", "Unknown appearance type '%s' in LoadAppearances.", type.c_str());
-	}
-
-	database_new.Select(&result, "SELECT `type`, `signed_value`, `red`, `green`, `blue`\n"
-								 "FROM npc_appearance\n"
-								 "WHERE length(`type`) > 0 AND `spawn_id` = %u",
-								 spawn_id);
-	
-	while(result.Next()) {
-		if(appearance_types[result.GetString(0)] < APPEARANCE_SOGA_EBT){ 
-			color.red = result.GetInt8(2);
-			color.green = result.GetInt8(3);
-			color.blue = result.GetInt8(4);
-		}
-		switch(appearance_types[result.GetString(0)]){
-			case APPEARANCE_SOGA_HFHC:{
-				entity->features.soga_hair_face_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HTHC:{
-				entity->features.soga_hair_type_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HFC:{
-				entity->features.soga_hair_face_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HTC:{
-				entity->features.soga_hair_type_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HH:{
-				entity->features.soga_hair_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HC1:{
-				entity->features.soga_hair_color1 = color;
-				break;
-			}
-			case APPEARANCE_SOGA_HC2:{
-				entity->features.soga_hair_color2 = color;
-				break;
-			}
-			case APPEARANCE_SOGA_SC:{
-				entity->features.soga_skin_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_EC:{
-				entity->features.soga_eye_color = color;
-				break;
-			}
-			case APPEARANCE_HTHC:{
-				entity->features.hair_type_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_HFHC:{
-				entity->features.hair_face_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_HTC:{
-				entity->features.hair_type_color = color;
-				break;
-				}
-			case APPEARANCE_HFC:{
-				entity->features.hair_face_color = color;
-				break;
-				}
-			case APPEARANCE_HH:{
-				entity->features.hair_highlight_color = color;
-				break;
-			}
-			case APPEARANCE_HC1:{
-				entity->features.hair_color1 = color;
-				break;
-				}
-			case APPEARANCE_HC2:{
-				entity->features.hair_color2 = color;
-				break;
-				}
-			case APPEARANCE_WC1:{
-				entity->features.wing_color1 = color;
-				break;
-				}
-			case APPEARANCE_WC2:{
-				entity->features.wing_color2 = color;
-				break;
-				}
-			case APPEARANCE_SC:{
-				entity->features.skin_color = color;
-				break;
-			}
-			case APPEARANCE_EC:{
-				entity->features.eye_color = color;
-				break;
-			}
-			case APPEARANCE_SOGA_EBT:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_eye_brow_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_SOGA_CHEEKT:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_cheek_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_SOGA_NT:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_nose_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_SOGA_CHINT:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_chin_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_SOGA_LT:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_lip_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_SOGA_EART:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_ear_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_SOGA_EYET:{
-				for(int i=0;i<3;i++)
-					entity->features.soga_eye_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_EBT:{
-				for(int i=0;i<3;i++)
-					entity->features.eye_brow_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_CHEEKT:{
-				for(int i=0;i<3;i++)
-					entity->features.cheek_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_NT:{
-				for(int i=0;i<3;i++)
-					entity->features.nose_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_CHINT:{
-				for(int i=0;i<3;i++)
-					entity->features.chin_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_EART:{
-				for(int i=0;i<3;i++)
-					entity->features.ear_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_EYET:{
-				for(int i=0;i<3;i++)
-					entity->features.eye_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_LT:{
-				for(int i=0;i<3;i++)
-					entity->features.lip_type[i] = result.GetInt8(2+i);
-				break;
-			}
-			case APPEARANCE_SHIRT:{
-				entity->features.shirt_color = color;
-				break;
-			}
-			case APPEARANCE_UCC:{
-				break;
-			}
-			case APPEARANCE_PANTS:{
-				entity->features.pants_color = color;
-				break;
-			}
-			case APPEARANCE_ULC:{
-				break;
-			}
-			case APPEARANCE_U9:{
-				break;
-			}
-			case APPEARANCE_BODY_SIZE:{
-				entity->features.body_size = color.red;
-				break;
-			}
-			case APPEARANCE_SOGA_WC1:{
-				break;
-			}
-			case APPEARANCE_SOGA_WC2:{
-				break;
-			}
-			case APPEARANCE_SOGA_SHIRT:{				
-				break;
-			}
-			case APPEARANCE_SOGA_UCC:{
-				break;
-			}
-			case APPEARANCE_SOGA_PANTS:{
-				break;
-			}
-			case APPEARANCE_SOGA_ULC:{
-				break;
-			}
-			case APPEARANCE_SOGA_U13:{
-				break;
-			}
-			case APPEARANCE_BODY_AGE: {
-				entity->features.body_age = color.red;
-				break;
-			}
-			case APPEARANCE_MC:{
-				entity->features.model_color = color;
-				break;
-			}
-			case APPEARANCE_SMC:{
-				entity->features.soga_model_color = color;
-				break;
-			}
-			case APPEARANCE_SBS: {
-				entity->features.soga_body_size = color.red;
-				break;
-			}
-			case APPEARANCE_SBA: {
-				entity->features.soga_body_age = color.red;
-				break;
-			}
-		}
-	}
-
-	entity->info_changed = true;
-}
-
-void WorldDatabase::LoadNPCAppearanceEquipmentData(ZoneServer* zone, int32 spawn_id) {
-	NPC* npc = zone->GetNPC(spawn_id);
-	if(!npc) {
-		LogWrite(NPC__ERROR, 0, "NPC", "Unable to get a valid npc (%u) in %s", spawn_id, __FUNCTION__);
-		return;
-	}
-
-	DatabaseResult result;
-	int8 slot = 0;
-
-	if (!database_new.Select(&result, "SELECT slot_id, equip_type, red, green, blue, highlight_red, highlight_green, highlight_blue\n"
-								 "FROM npc_appearance_equip\n"
-								 "WHERE spawn_id = %u\n",
-								 spawn_id))
-	{
-		
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "MySQL Error %u: %s", database_new.GetError(), database_new.GetErrorMsg());
-		return;
-	}
-
-	while (result.Next()) {
-		slot = result.GetInt8(0);
-		if(slot < NUM_SLOTS) {
-			npc->SetEquipment(slot, result.GetInt16(1), result.GetInt8(2), result.GetInt8(3), result.GetInt8(4), result.GetInt8(5), result.GetInt8(6), result.GetInt8(7));
-		}
-	}
-}
-
-void WorldDatabase::SaveCharacterPicture(int32 characterID, int8 type, uchar* picture, int32 picture_size) {
-	stringstream ss_hex;
-	stringstream ss_query;
-	ss_hex.flags(ios::hex);
-	for (int32 i = 0; i < picture_size; i++)
-		ss_hex << setfill('0') << setw(2) << (int32)picture[i];
-
-	ss_query << "INSERT INTO `character_pictures` (`char_id`, `pic_type`, `picture`) VALUES (" << characterID << ", " << (int32)type << ", '" << ss_hex.str() << "') ON DUPLICATE KEY UPDATE `picture` = '" << ss_hex.str() << "'";
-	
-	if (!database_new.Query(ss_query.str().c_str()))
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "MySQL Error %u: %s", database_new.GetError(), database_new.GetErrorMsg());
-}
-
-void WorldDatabase::LoadZoneFlightPaths(ZoneServer* zone) {
-	DatabaseResult result;
-	int32 total = 0;
-
-	if (!database_new.Select(&result, "SELECT id, speed, flying, early_dismount FROM flight_paths WHERE zone_id = %u", zone->GetZoneID())) {
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "MySQL Error %u: %s", database_new.GetError(), database_new.GetErrorMsg());
-		return;
-	}
-
-	while (result.Next()) {
-		FlightPathInfo* info = new FlightPathInfo;
-		int32 id = result.GetInt32(0);
-		info->speed = result.GetFloat(1);
-		info->flying = result.GetInt8(2) == 1 ? true : false;
-		info->dismount = result.GetInt8(3) == 1 ? true : false;
-
-		zone->AddFlightPath(id, info);
-		total++;
-	}
-
-	LogWrite(ZONE__DEBUG, 0, "Zone", "Loaded %u flight paths for %s", total, zone->GetZoneDescription());
-	LoadZoneFlightPathLocations(zone);
-}
-
-void WorldDatabase::LoadZoneFlightPathLocations(ZoneServer* zone) {
-	DatabaseResult result;
-	int32 total = 0;
-
-	if (!database_new.Select(&result, "SELECT loc.flight_path, loc.x, loc.y, loc.z FROM flight_paths_locations loc\n"
-									  "INNER JOIN flight_paths path\n"
-									  "ON loc.flight_path = path.id\n"
-									  "WHERE path.zone_id = %u\n"
-									  "ORDER BY loc.id",
-									  zone->GetZoneID()))
-	{
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "MySQL Error %u: %s", database_new.GetError(), database_new.GetErrorMsg());
-		return;
-	}
-
-	while (result.Next()) {
-		FlightPathLocation* loc = new FlightPathLocation;
-		int32 id = result.GetInt32(0);
-		loc->X = result.GetFloat(1);
-		loc->Y = result.GetFloat(2);
-		loc->Z = result.GetFloat(3);
-
-		zone->AddFlightPathLocation(id, loc);
-		total++;
-	}
-
-	LogWrite(ZONE__DEBUG, 0, "Zone", "Loaded %u flight path locations for %s", total, zone->GetZoneDescription());
-}
-
-void WorldDatabase::SaveCharacterLUAHistory(Player* player, int32 event_id, int32 value, int32 value2) {
-	Query query;
-	query.AddQueryAsync(player->GetCharacterID(), this, Q_REPLACE, "REPLACE INTO character_lua_history(char_id, event_id, value, value2) VALUES(% u, % u, % u, % u)", player->GetCharacterID(), event_id, value, value2);
-
-//	if (!database_new.Query("REPLACE INTO character_lua_history (char_id, event_id, value, value2) VALUES (%u, %u, %u, %u)", player->GetCharacterID(), event_id, value, value2))
-//		LogWrite(DATABASE__ERROR, 0, "DBNew", "MySQL Error %u: %s", database_new.GetError(), database_new.GetErrorMsg());
-}
-
-void WorldDatabase::LoadCharacterLUAHistory(int32 char_id, Player* player) {
-	DatabaseResult result;
-	int32 total = 0;
-
-	if (!database_new.Select(&result, "SELECT event_id, value, value2 FROM character_lua_history WHERE char_id = %u", char_id)) {
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "MySQL Error %u: %s", database_new.GetError(), database_new.GetErrorMsg());
-		return;
-	}
-
-	while (result.Next()) {
-		int32 id = result.GetInt32(0);
-		LUAHistory* hd = new LUAHistory;
-		hd->Value = result.GetInt32(1);
-		hd->Value2 = result.GetInt32(2);
-		hd->SaveNeeded = false;
-		player->LoadLUAHistory(id, hd);
-		total++;
-	}
-
-	LogWrite(PLAYER__DEBUG, 0, "Player", "Loaded %u LUA history for %s", total, player->GetName());
-}
-
-void WorldDatabase::FindSpell(Client* client, char* findString)
-{
-	DatabaseResult result;
-		if (!database_new.Select(&result, "SELECT s.`id`, ts.spell_id, ts.index, `name`, `tier` "
-			"FROM (spells s, spell_tiers st) "
-			"LEFT JOIN spell_ts_ability_index ts "
-			"ON s.`id` = ts.spell_id "
-			"WHERE s.id = st.spell_id and s.name like '%%%s%%' AND s.is_active = 1 "
-			"ORDER BY s.`id`, `tier` limit 50", findString))
-		{
-			// error
-		}
-		else
-		{
-			client->Message(CHANNEL_COLOR_YELLOW, "SpellID (SpellTier): SpellName for %s", findString);
-			while (result.Next())
-			{
-				int32 spell_id = result.GetInt32Str("id");
-				string spell_name = result.GetStringStr("name");
-				int8 tier = result.GetInt8Str("tier");
-				client->Message(CHANNEL_COLOR_YELLOW, "%i (%i): %s", spell_id, tier, spell_name.c_str());
-			}
-			client->Message(CHANNEL_COLOR_YELLOW, "End Spell Results for %s", findString);
-		}
-}
-
-void WorldDatabase::LoadChestTraps() {
-	chest_trap_list.Clear();
-	int32 index = 0;
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, applicable_zone_id, chest_min_difficulty, chest_max_difficulty, spell_id, spell_tier FROM chest_traps");
-	if (result && mysql_num_rows(result) > 0) {
-		Title* title = 0;
-		while (result && (row = mysql_fetch_row(result))) {
-			int32 dbid = atoul(row[0]);
-			sint32 applicable_zone_id = atoi(row[1]);
-			int32 mindifficulty = atoul(row[2]);
-			int32 maxdifficulty = atoul(row[3]);
-			int32 spellid = atoul(row[4]);
-			int32 tier = atoul(row[5]);
-			ChestTrap* trap = new ChestTrap(dbid,applicable_zone_id,mindifficulty,maxdifficulty,spellid,tier);
-			chest_trap_list.AddChestTrap(trap);
-		}
-	}
-}
-
-bool WorldDatabase::CheckExpansionFlags(ZoneServer* zone, int32 spawnXpackFlag)
-{
-	if (spawnXpackFlag == 0)
-		return true;
-
-	int32 globalXpackFlag = rule_manager.GetGlobalRule(R_Expansion, GlobalExpansionFlag)->GetInt32();
-	int32 zoneXpackFlag = zone->GetExpansionFlag();
-	// zone expansion flag takes priority
-	if (zoneXpackFlag > 0 && (spawnXpackFlag & zoneXpackFlag) == 0)
-		return false;
-	// zone expansion flag fails, then if global expansion flag set, we see if that bit operand doesn't match, skip mob then
-	else if (zoneXpackFlag == 0 && globalXpackFlag > 0 && (spawnXpackFlag & globalXpackFlag) == 0)
-		return false;
-
-	return true;
-}
-
-bool WorldDatabase::CheckHolidayFlags(ZoneServer* zone, int32 spawnHolidayFlag)
-{
-	if (spawnHolidayFlag == 0)
-		return true;
-
-	int32 globalHolidayFlag = rule_manager.GetGlobalRule(R_Expansion, GlobalHolidayFlag)->GetInt32();
-	int32 zoneHolidayFlag = zone->GetHolidayFlag();
-	// zone holiday flag takes priority
-	if (zoneHolidayFlag > 0 && (spawnHolidayFlag & zoneHolidayFlag) == 0)
-		return false;
-	// zone holiday flag fails, then if global expansion flag set, we see if that bit operand doesn't match, skip mob then
-	else if (zoneHolidayFlag == 0 && globalHolidayFlag > 0 && (spawnHolidayFlag & globalHolidayFlag) == 0)
-		return false;
-
-	return true;
-}
-
-void WorldDatabase::GetHouseSpawnInstanceData(ZoneServer* zone, Spawn* spawn)
-{
-	if (!spawn)
-		return;
-
-	if (zone->house_object_database_lookup.count(spawn->GetModelType()) < 1)
-		zone->house_object_database_lookup.Put(spawn->GetModelType(), spawn->GetDatabaseID());
-
-	DatabaseResult result;
-
-	database_new.Select(&result, "SELECT pickup_item_id, pickup_unique_item_id\n"
-		" FROM spawn_instance_data\n"
-		" WHERE spawn_id = %u and spawn_location_id = %u",
-		spawn->GetDatabaseID(),spawn->GetSpawnLocationID());
-
-	if (result.GetNumRows() > 0 && result.Next()) {
-		spawn->SetPickupItemID(result.GetInt32(0));
-		spawn->SetPickupUniqueItemID(result.GetInt32(1));
-
-		if (spawn->GetZone() != nullptr && spawn->GetMap() != nullptr && spawn->GetMap()->IsMapLoaded())
-		{
-			auto loc = glm::vec3(spawn->GetX(),spawn->GetZ(),spawn->GetY());
-			uint32 GridID = 0;
-			float new_z = spawn->GetMap()->FindBestZ(loc, nullptr, &GridID);
-			spawn->SetPos(&(spawn->appearance.pos.grid_id), GridID);
-		}
-	}
-}
-
-int32 WorldDatabase::FindHouseInstanceSpawn(Spawn* spawn)
-{
-	DatabaseResult result;
-
-	database_new.Select(&result, "SELECT id\n"
-		" FROM spawn\n"
-		" WHERE model_type = %u and is_instanced_spawn=1 limit 1",
-		spawn->GetModelType());
-
-	if (result.GetNumRows() > 0 && result.Next()) {
-		return result.GetInt32(0);
-	}
-
-	return 0;
-}
-
-
-void WorldDatabase::LoadStartingSkills(World* world)
-{
-	world->MStartingLists.writelock();
-
-	int32 total = 0;
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT race_id, class_id, skill_id, current_val, max_val, progress FROM starting_skills");
-
-	if (result)
-	{
-		if (mysql_num_rows(result) > 0)
-		{
-			Skill* skill = 0;
-
-			while (result && (row = mysql_fetch_row(result)))
-			{
-
-				StartingSkill skill;
-				skill.header.race_id = atoul(row[0]);
-				skill.header.class_id = atoul(row[1]);
-				skill.skill_id = atoul(row[2]);
-				skill.current_val = atoul(row[3]);
-				skill.max_val = atoul(row[4]);
-
-				if (!world->starting_skills.count(skill.header.race_id))
-				{
-					multimap<int8, StartingSkill>* skills = new multimap<int8, StartingSkill>();
-					skills->insert(make_pair(skill.header.class_id, skill));
-					world->starting_skills.insert(make_pair(skill.header.race_id, skills));
-				}
-				else
-				{
-					multimap<int8, multimap<int8, StartingSkill>*>::const_iterator skills = world->starting_skills.find(skill.header.race_id);
-					skills->second->insert(make_pair(skill.header.class_id, skill));
-				}
-				total++;
-			}
-		}
-	}
-	LogWrite(WORLD__DEBUG, 3, "World", "--Loaded %u Starting Skill(s)", total);
-
-	world->MStartingLists.releasewritelock();
-}
-
-
-void WorldDatabase::LoadStartingSpells(World* world)
-{
-	world->MStartingLists.writelock();
-
-	int32 total = 0;
-	Query query;
-	MYSQL_ROW row;
-	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT race_id, class_id, spell_id, tier, knowledge_slot FROM starting_spells");
-
-	if (result)
-	{
-		if (mysql_num_rows(result) > 0)
-		{
-			Skill* skill = 0;
-
-			while (result && (row = mysql_fetch_row(result)))
-			{
-
-				StartingSpell spell;
-				spell.header.race_id = atoul(row[0]);
-				spell.header.class_id = atoul(row[1]);
-				spell.spell_id = atoul(row[2]);
-				spell.tier = atoul(row[3]);
-				spell.knowledge_slot = atoul(row[4]);
-
-				if (!world->starting_spells.count(spell.header.race_id))
-				{
-					multimap<int8, StartingSpell>* spells = new multimap<int8, StartingSpell>();
-					spells->insert(make_pair(spell.header.class_id, spell));
-					world->starting_spells.insert(make_pair(spell.header.race_id, spells));
-				}
-				else
-				{
-					multimap<int8, multimap<int8, StartingSpell>*>::iterator spells = world->starting_spells.find(spell.header.race_id);
-					spells->second->insert(make_pair(spell.header.class_id, spell));
-				}
-				total++;
-			}
-		}
-	}
-	LogWrite(WORLD__DEBUG, 3, "World", "--Loaded %u Starting Spell(s)", total);
-
-	world->MStartingLists.releasewritelock();
-}
-
-
-bool WorldDatabase::DeleteSpiritShard(int32 id){
-	Query query;
-	query.RunQuery2(Q_DELETE, "delete FROM character_spirit_shards where id=%u",id);
-	if(query.GetErrorNumber() && query.GetError() && query.GetErrorNumber() < 0xFFFFFFFF){
-		LogWrite(WORLD__ERROR, 0, "World", "Error in DeleteSpiritShard query '%s': %s", query.GetQuery(), query.GetError());
-		return false;
-	}
-	return true;
-}
-
-int32 WorldDatabase::CreateSpiritShard(const char* name, int32 level, int8 race, int8 gender, int8 adventure_class, 
-									  int16 model_type, int16 soga_model_type, int16 hair_type, int16 hair_face_type, int16 wing_type,
-									  int16 chest_type, int16 legs_type, int16 soga_hair_type, int16 soga_hair_face_type, int8 hide_hood, 
-									  int16 size, int16 collision_radius, int16 action_state, int16 visual_state, int16 mood_state, int16 emote_state, 
-									  int16 pos_state, int16 activity_status, char* sub_title, char* prefix_title, char* suffix_title, char* lastname, 
-									  float x, float y, float z, float heading, int32 gridid, int32 charid, int32 zoneid, int32 instanceid) 
-{
-	LogWrite(WORLD__INFO, 3, "World", "Saving Spirit Shard %s %u", name, charid);
-
-	Query query;
-	char* name_escaped = getEscapeString(name);
-	
-	if(!sub_title)
-		sub_title = "";
-	char* subtitle_escaped = getEscapeString(sub_title);
-	char* prefix_escaped = getEscapeString(prefix_title);
-	char* suffix_escaped = getEscapeString(suffix_title);
-	char* lastname_escaped = getEscapeString(lastname);
-	string insert = string("INSERT INTO character_spirit_shards (name, level, race, gender, adventure_class, model_type, soga_model_type, hair_type, hair_face_type, wing_type, chest_type, legs_type, soga_hair_type, soga_hair_face_type, hide_hood, size, collision_radius, action_state, visual_state, mood_state, emote_state, pos_state, activity_status, sub_title, prefix_title, suffix_title, lastname, x, y, z, heading, gridid, charid, zoneid, instanceid) VALUES ('%s', %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, '%s', '%s', '%s', '%s', %f, %f, %f, %f, %u, %u, %u, %u)");
-	query.RunQuery2(Q_INSERT, insert.c_str(), name_escaped, level, race, gender, adventure_class, model_type, soga_model_type, 
-																hair_type, hair_face_type, wing_type, chest_type, legs_type, soga_hair_type, 
-																soga_hair_face_type, hide_hood, size, collision_radius, action_state, visual_state, 
-																mood_state, emote_state, pos_state, activity_status, subtitle_escaped, prefix_escaped, suffix_escaped, 
-																lastname_escaped, x, y, z, heading, gridid, charid, zoneid, instanceid);
-
-	
-	safe_delete_array(name_escaped);
-	safe_delete_array(subtitle_escaped);
-	safe_delete_array(prefix_escaped);
-	safe_delete_array(suffix_escaped);
-	safe_delete_array(lastname_escaped);
-
-	return query.GetLastInsertedID();
-}
-
-void WorldDatabase::LoadCharacterSpellEffects(int32 char_id, Client* client, int8 db_spell_type) 
-{
-	SpellProcess* spellProcess = client->GetCurrentZone()->GetSpellProcess();
-	Player* player = client->GetPlayer();
-
-		if(!spellProcess)
-			return;
-	DatabaseResult result;
-
-	multimap<LuaSpell*, Entity*> restoreSpells;
-	// Use -1 on type and subtype to turn the enum into an int and make it a 0 index
-	if (!database_new.Select(&result, "SELECT name, caster_char_id, target_char_id, target_type, spell_id, effect_slot, slot_pos, icon, icon_backdrop, conc_used, tier, total_time, expire_timestamp, lua_file, custom_spell, damage_remaining, effect_bitmask, num_triggers, had_triggers, cancel_after_triggers, crit, last_spellattack_hit, interrupted, resisted, custom_function FROM character_spell_effects WHERE charid = %u and db_effect_type = %u", char_id, db_spell_type)) {
-		LogWrite(DATABASE__ERROR, 0, "DBNew", "MySQL Error %u: %s", database_new.GetError(), database_new.GetErrorMsg());
-		return;
-	}
-	InfoStruct* info = player->GetInfoStruct();
-	while (result.Next()) {
-//result.GetInt8Str
-		char spell_name[60];
-		strncpy(spell_name, result.GetStringStr("name"), 60);
-
-		int32 caster_char_id = result.GetInt32Str("caster_char_id");
-		int32 target_char_id = result.GetInt32Str("target_char_id");
-		int8 target_type = result.GetInt8Str("target_type");
-		int32 spell_id = result.GetInt32Str("spell_id");
-		int32 effect_slot = result.GetInt32Str("effect_slot");
-		int32 slot_pos = result.GetInt32Str("slot_pos");
-		int16 icon = result.GetInt32Str("icon");
-		int16 icon_backdrop = result.GetInt32Str("icon_backdrop");
-		int8 conc_used = result.GetInt32Str("conc_used");
-		int8 tier = result.GetInt32Str("tier");
-		float total_time = result.GetFloatStr("total_time");
-		int32 expire_timestamp = result.GetInt32Str("expire_timestamp");
-
-		string lua_file (result.GetStringStr("lua_file"));
-
-		int8 custom_spell = result.GetInt32Str("custom_spell");
-
-		int32 damage_remaining = result.GetInt32Str("damage_remaining");
-		int32 effect_bitmask = result.GetInt32Str("effect_bitmask");
-		int16 num_triggers = result.GetInt32Str("num_triggers");
-		int8 had_triggers = result.GetInt32Str("had_triggers");
-		int8 cancel_after_triggers = result.GetInt32Str("cancel_after_triggers");
-		int8 crit = result.GetInt32Str("crit");
-		int8 last_spellattack_hit = result.GetInt32Str("last_spellattack_hit");
-		int8 interrupted = result.GetInt32Str("interrupted");
-		int8 resisted = result.GetInt32Str("resisted");
-		std::string custom_function = std::string(result.GetStringStr("custom_function"));
-		LuaSpell* lua_spell = 0;
-		if(custom_spell)
-		{
-			if((lua_spell = lua_interface->GetSpell(lua_file.c_str())) == nullptr)
-			{
-				LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: GetSpell(%u, %u, '%s'), custom lua script not loaded, when attempting to load.", spell_id, tier, lua_file.c_str());
-				lua_interface->LoadLuaSpell(lua_file);
-			}
-		}
-
-		Spell* spell = master_spell_list.GetSpell(spell_id, tier);
-		
-		if(!spell)
-		{
-			LogWrite(LUA__ERROR, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: GetSpell(%u, %u), spell could not be found!", spell_id, tier);
-			spell = master_spell_list.GetSpell(spell_id, 0);
-			if(spell)
-				LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: GetSpell(%u, %u), identified tier 0 as replacement since the GetSpell failed!", spell_id, tier);
-			else
-				continue;
-		}
-		
-		bool isMaintained = false;
-		bool isExistingLuaSpell = false;
-		MaintainedEffects* effect = nullptr;
-		Client* tmpCaster = nullptr;
-		if(caster_char_id == player->GetCharacterID() && (target_char_id == 0xFFFFFFFF || target_char_id == player->GetCharacterID()) && (effect = player->GetMaintainedSpell(spell_id)) != nullptr)
-		{
-			safe_delete(lua_spell);
-			lua_spell = effect->spell;
-			if(lua_spell)
-				spell = lua_spell->spell;
-			isMaintained = true;
-			isExistingLuaSpell = true;
-		}
-		else if ( caster_char_id != player->GetCharacterID() && (tmpCaster = zone_list.GetClientByCharID(caster_char_id)) != nullptr 
-					 && tmpCaster->GetPlayer() && (effect = tmpCaster->GetPlayer()->GetMaintainedSpell(spell_id)) != nullptr)
-		{
-			if(effect->spell && effect->spell_id == spell_id)
-			{
-				safe_delete(lua_spell);
-				effect->spell->MSpellTargets.writelock(__FUNCTION__, __LINE__);
-				if(tmpCaster->GetCurrentZone() == player->GetZone())
-					effect->spell->targets.push_back(client->GetPlayer()->GetID());
-				effect->spell->MSpellTargets.releasewritelock(__FUNCTION__, __LINE__);
-				lua_spell = effect->spell;
-				spell = effect->spell->spell;
-				isExistingLuaSpell = true;
-				isMaintained = true;
-				LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: GetSpell(%u, %u, '%s'), effect spell id %u maintained spell recovered from %s", spell_id, tier, spell_name, effect ? effect->spell_id : 0, (tmpCaster && tmpCaster->GetPlayer()) ? tmpCaster->GetPlayer()->GetName() : "?");
-			}
-			else
-			{
-				LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: GetSpell(%u, %u, '%s'), something went wrong loading another characters maintained spell. Effect has spell id %u", spell_id, tier, lua_file.c_str(), effect ? effect->spell_id : 0);
-				safe_delete(lua_spell);
-				continue;
-			}
-		}
-		else if(custom_spell && lua_spell)
-		{
-			lua_spell->spell = new Spell(spell);
-
-			lua_interface->AddCustomSpell(lua_spell);
-		}
-		else if(db_spell_type == DB_TYPE_MAINTAINEDEFFECTS)
-		{
-			safe_delete(lua_spell);
-			if(!target_char_id)
-				continue;
-			
-			lua_spell = lua_interface->GetSpell(spell->GetSpellData()->lua_script.c_str());
-			if(lua_spell)
-				lua_spell->spell = spell;
-		}
-		
-		if(!lua_spell)
-		{
-			LogWrite(LUA__ERROR, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: GetSpell(%u, %u, '%s'), lua_spell FAILED, when attempting to load.", spell_id, tier, lua_file.c_str());
-			continue;
-		}
-	
-		SpellScriptTimer* timer = nullptr;
-		if(!isExistingLuaSpell && expire_timestamp != 0xFFFFFFFF && custom_function.size() > 0)
-		{
-			timer = new SpellScriptTimer;
-
-			timer->caster = 0;
-			timer->deleteWhenDone = false;
-			timer->target = 0;
-
-			timer->time = expire_timestamp;
-			timer->customFunction = string(custom_function); // TODO
-			timer->spell = lua_spell;
-			timer->caster = (caster_char_id == player->GetCharacterID()) ? player->GetID() : 0;
-			
-			if(target_char_id == 0xFFFFFFFF && player->HasPet())
-				timer->target = player->GetPet()->GetID();
-			else
-				timer->target = (target_char_id == player->GetCharacterID()) ? player->GetID() : 0;
-
-			if(!timer->target && target_char_id)
-			{
-				Client* tmpClient = zone_list.GetClientByCharID(target_char_id);
-				if(tmpClient && tmpClient->GetPlayer() && tmpClient->GetPlayer()->GetZone() == player->GetZone())
-					timer->target = tmpClient->GetPlayer()->GetID();
-			}
-		}
-		
-		if(!isExistingLuaSpell)
-		{
-			lua_spell->crit = crit;
-			lua_spell->damage_remaining = damage_remaining;
-			lua_spell->effect_bitmask = effect_bitmask;
-			lua_spell->had_dmg_remaining = (damage_remaining>0) ? true : false;
-			lua_spell->had_triggers = had_triggers;
-			lua_spell->initial_caster_char_id = caster_char_id; 
-			lua_spell->initial_target = (target_char_id == player->GetCharacterID()) ? player->GetID() : 0;
-			lua_spell->initial_target_char_id = target_char_id;
-			lua_spell->interrupted = interrupted;
-			lua_spell->last_spellattack_hit = last_spellattack_hit;
-			lua_spell->num_triggers = num_triggers;
-		}
-
-		if(lua_spell->initial_target == 0 && target_char_id == 0xFFFFFFFF && player->HasPet())
-		{
-			lua_spell->initial_target = player->GetPet()->GetID();
-			lua_spell->initial_target_char_id = target_char_id;
-		}
-		//lua_spell->num_calls  ??
-		//if(target_char_id == player->GetCharacterID())
-		//	lua_spell->targets.push_back(player->GetID());
-		
-		if(db_spell_type == DB_TYPE_SPELLEFFECTS)
-		{
-			if (caster_char_id != player->GetCharacterID() && lua_spell->spell->GetSpellData()->group_spell && lua_spell->spell->GetSpellData()->friendly_spell)
-				{
-					if(!isExistingLuaSpell)
-						safe_delete(lua_spell);
-					continue;
-				}
-			
-			player->MSpellEffects.writelock();
-			LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: %s lua_spell caster %s (%u), caster char id: %u.", lua_spell->spell->GetName(), lua_spell->caster ? lua_spell->caster->GetName() : "", lua_spell->caster ? lua_spell->caster->GetID() : 0, caster_char_id);
-
-			if(lua_spell->caster && (rule_manager.GetGlobalRule(R_Spells,EnableCrossZoneTargetBuffs)->GetInt8() || (!rule_manager.GetGlobalRule(R_Spells,EnableCrossZoneTargetBuffs)->GetInt8() && lua_spell->caster->GetZone() == player->GetZone())))
-				info->spell_effects[effect_slot].caster = lua_spell->caster;
-			else if(caster_char_id != player->GetCharacterID())
-			{
-				Client* tmpCaster = zone_list.GetClientByCharID(caster_char_id);
-				if(tmpCaster)
-				{
-					if((rule_manager.GetGlobalRule(R_Spells,EnableCrossZoneTargetBuffs)->GetInt8() || (!rule_manager.GetGlobalRule(R_Spells,EnableCrossZoneTargetBuffs)->GetInt8() && lua_spell->caster->GetZone() == player->GetZone())))
-					{
-						info->spell_effects[effect_slot].caster = tmpCaster->GetPlayer();
-						LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: %s lua_spell caster %s (%u), caster char id: %u, found player %s.", lua_spell->spell->GetName(), lua_spell->caster ? lua_spell->caster->GetName() : "", lua_spell->caster ? lua_spell->caster->GetID() : 0, caster_char_id, tmpCaster->GetPlayer()->GetName());
-					}
-					else
-					{
-						LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: %s lua_spell caster %s (%u), caster char id: %u, found player %s, SKIPPED due to R_Spells, EnableCrossZoneTargetBuffs.", lua_spell->spell->GetName(), lua_spell->caster ? lua_spell->caster->GetName() : "", lua_spell->caster ? lua_spell->caster->GetID() : 0, caster_char_id, tmpCaster->GetPlayer()->GetName());
-						if(!isExistingLuaSpell)
-						{
-							safe_delete(lua_spell);
-						}
-						else
-						{
-							lua_spell->MSpellTargets.writelock(__FUNCTION__, __LINE__);
-							lua_spell->char_id_targets.insert(make_pair(player->GetCharacterID(),0));
-							lua_spell->MSpellTargets.releasewritelock(__FUNCTION__, __LINE__);
-						}
-						player->MSpellEffects.releasewritelock();
-						continue;
-					}
-
-				}
-			}
-			else if(caster_char_id == player->GetCharacterID())
-				info->spell_effects[effect_slot].caster = player;
-			else
-			{					
-				LogWrite(LUA__ERROR, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: %s lua_spell caster %s (%u), caster char id: %u, failed to find caster will delete: %u", lua_spell->spell->GetName(), lua_spell->caster ? lua_spell->caster->GetName() : "", lua_spell->caster ? lua_spell->caster->GetID() : 0, caster_char_id, isExistingLuaSpell);
-				if(!isExistingLuaSpell)
-					safe_delete(lua_spell);
-				continue;
-			}
-			if(spell->GetSpellData()->duration_until_cancel)
-				info->spell_effects[effect_slot].expire_timestamp = 0xFFFFFFFF;
-			else
-				info->spell_effects[effect_slot].expire_timestamp = Timer::GetCurrentTime2() + expire_timestamp;
-			info->spell_effects[effect_slot].icon = icon;
-			info->spell_effects[effect_slot].icon_backdrop = icon_backdrop;
-			info->spell_effects[effect_slot].spell_id = spell_id;
-			info->spell_effects[effect_slot].tier = tier;
-			info->spell_effects[effect_slot].total_time = total_time;
-			info->spell_effects[effect_slot].spell = lua_spell;
-
-			lua_spell->MSpellTargets.writelock(__FUNCTION__, __LINE__);
-			multimap<int32,int8>::iterator entries;
-			while((entries = lua_spell->char_id_targets.find(player->GetCharacterID())) != lua_spell->char_id_targets.end())
-			{
-				lua_spell->char_id_targets.erase(entries);
-			}
-			lua_spell->MSpellTargets.releasewritelock(__FUNCTION__, __LINE__);
-
-			lua_spell->slot_pos = slot_pos;
-			if(!isExistingLuaSpell)
-				lua_spell->caster = player; // TODO: get actual player
-
-			player->MSpellEffects.releasewritelock();
-
-			if(!isMaintained)
-				spellProcess->ProcessSpell(lua_spell, true, "cast", timer);
-				else
-				{
-					// track target id when caster isnt in zone somehow
-				}
-		}
-		else if ( db_spell_type == DB_TYPE_MAINTAINEDEFFECTS )
-		{
-			player->MMaintainedSpells.writelock();
-
-			DatabaseResult targets;
-			// Use -1 on type and subtype to turn the enum into an int and make it a 0 index
-			if (database_new.Select(&targets, "SELECT target_char_id, target_type, db_effect_type, spell_id from character_spell_effect_targets where caster_char_id = %u and effect_slot = %u and slot_pos = %u", char_id, effect_slot, slot_pos)) {
-				while (targets.Next()) {
-					int32 target_char = targets.GetInt32Str("target_char_id");
-					int8 maintained_target_type = targets.GetInt32Str("target_type");
-					int32 in_spell_id = targets.GetInt32Str("spell_id");
-					if(spell_id != in_spell_id)
-						continue;
-					
-					int32 idToAdd = 0;
-
-					if(target_char == 0xFFFFFFFF)
-					{
-						if( player->HasPet() )
-						{
-							restoreSpells.insert(make_pair(lua_spell, player->GetPet()));
-							// target added via restoreSpells
-						}
-					}
-					else
-					{
-						Client* client2 = zone_list.GetClientByCharID(target_char);
-						if(client2 && client2->GetPlayer() && client2->GetCurrentZone() == client->GetCurrentZone())
-						{
-							if(maintained_target_type > 0)
-							{
-								if(client != client2)
-								{
-									lua_spell->MSpellTargets.writelock(__FUNCTION__, __LINE__);
-									
-									if(client2->GetPlayer()->GetPet() && maintained_target_type == PET_TYPE_COMBAT)
-									{
-										restoreSpells.insert(make_pair(lua_spell, client2->GetPlayer()->GetPet()));
-										// target added via restoreSpells
-									}
-									if(client2->GetPlayer()->GetCharmedPet() && maintained_target_type == PET_TYPE_CHARMED)
-									{
-										restoreSpells.insert(make_pair(lua_spell, client2->GetPlayer()->GetCharmedPet()));
-										// target added via restoreSpells
-									}
-									
-									lua_spell->MSpellTargets.releasewritelock(__FUNCTION__, __LINE__);
-								}
-							} // end of pet clause
-							else if(client != client2) // maintained type must be 0, so client
-								restoreSpells.insert(make_pair(lua_spell, client2->GetPlayer()));
-							
-							lua_spell->MSpellTargets.writelock(__FUNCTION__, __LINE__);
-							multimap<int32,int8>::iterator entries;
-							for(entries = lua_spell->char_id_targets.begin(); entries != lua_spell->char_id_targets.end(); entries++)
-							{
-								int32 ent_char_id = entries->first;
-								int8 ent_target_type = entries->second;
-								if(ent_char_id == target_char && ent_target_type == maintained_target_type)
-									entries = lua_spell->char_id_targets.erase(entries);
-							}
-							lua_spell->MSpellTargets.releasewritelock(__FUNCTION__, __LINE__);
-						}
-						else
-						{
-							lua_spell->MSpellTargets.writelock(__FUNCTION__, __LINE__);
-							lua_spell->char_id_targets.insert(make_pair(target_char,maintained_target_type));
-							lua_spell->MSpellTargets.releasewritelock(__FUNCTION__, __LINE__);
-						}
-					}
-				}
-			}
-			
-			Client* tmpClient = 0;
-			int32 targetID = 0;
-			if(target_char_id == 0xFFFFFFFF && player->HasPet())
-				targetID = player->GetPet()->GetID();
-			else if(target_char_id == player->GetCharacterID())
-			{
-				targetID = player->GetID();
-				tmpClient = player->GetClient();
-			}
-			else if((tmpClient = zone_list.GetClientByCharID(target_char_id)) != nullptr && tmpClient->GetPlayer())
-				targetID = tmpClient->GetPlayer()->GetID();
-			
-			info->maintained_effects[effect_slot].conc_used = conc_used;
-			strncpy(info->maintained_effects[effect_slot].name, spell_name, 60);
-			info->maintained_effects[effect_slot].slot_pos = slot_pos;
-			info->maintained_effects[effect_slot].target = targetID;
-			info->maintained_effects[effect_slot].target_type = target_type;
-			if(spell->GetSpellData()->duration_until_cancel)
-				info->maintained_effects[effect_slot].expire_timestamp = 0xFFFFFFFF;
-			else
-				info->maintained_effects[effect_slot].expire_timestamp = Timer::GetCurrentTime2() + expire_timestamp;
-			info->maintained_effects[effect_slot].icon = icon;
-			info->maintained_effects[effect_slot].icon_backdrop = icon_backdrop;
-			info->maintained_effects[effect_slot].spell_id = spell_id;
-			info->maintained_effects[effect_slot].tier = tier;
-			info->maintained_effects[effect_slot].total_time = total_time;
-			info->maintained_effects[effect_slot].spell = lua_spell;
-			if(!isExistingLuaSpell)
-				lua_spell->caster = player;
-			player->MMaintainedSpells.releasewritelock();
-		
-			LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: %s process spell caster %s (%u), caster char id: %u, target id %u (%s).", lua_spell->spell->GetName(), lua_spell->caster ? lua_spell->caster->GetName() : "", 
-											lua_spell->caster ? lua_spell->caster->GetID() : 0, caster_char_id, targetID, tmpClient ? tmpClient->GetPlayer()->GetName() : "");
-			if(tmpClient && lua_spell->initial_target_char_id == tmpClient->GetCharacterID())
-			{
-				lua_spell->initial_target = tmpClient->GetPlayer()->GetID();
-				lua_spell->targets.push_back(lua_spell->initial_target);
-			}
-			
-			spellProcess->ProcessSpell(lua_spell, true, "cast", timer);
-		}
-		if(!isExistingLuaSpell && expire_timestamp != 0xFFFFFFFF && !isMaintained)
-		{
-			lua_spell->timer.SetTimer(expire_timestamp);
-			lua_spell->timer.SetAtTrigger(lua_spell->spell->GetSpellData()->duration1 * 100);
-			lua_spell->timer.Start();
-		}
-
-		if(target_char_id == player->GetCharacterID() && lua_spell->spell->GetSpellData()->det_type)
-			player->AddDetrimentalSpell(lua_spell, expire_timestamp);
-		
-		if(!isExistingLuaSpell)
-		{
-			if(timer)
-				spellProcess->AddSpellScriptTimer(timer);
-			
-			lua_spell->num_calls = 1;
-			lua_spell->restored = true;
-		}
-		
-		if(!lua_spell->resisted && (lua_spell->spell->GetSpellDuration() > 0 || lua_spell->spell->GetSpellData()->duration_until_cancel))
-				spellProcess->AddActiveSpell(lua_spell);
-
-		if ( db_spell_type == DB_TYPE_MAINTAINEDEFFECTS )
-		{
-			if (num_triggers > 0)
-				ClientPacketFunctions::SendMaintainedExamineUpdate(client, slot_pos, num_triggers, 0);
-			if (damage_remaining > 0)
-				ClientPacketFunctions::SendMaintainedExamineUpdate(client, slot_pos, damage_remaining, 1);
-		}
-	}
-
-	if(db_spell_type == DB_TYPE_SPELLEFFECTS)
-	{
-		// if the cross_zone_target_buff option is disabled then we check for all possible targets within the current zone
-		// if cross_zone_target_buff is enabled, we only check to restore pets, the players get restored by their own spell effects (we don't directly track the pets, indirectly we do through the player casting and their targets)
-		int8 cross_zone_target_buff = rule_manager.GetGlobalRule(R_Spells,EnableCrossZoneTargetBuffs)->GetInt8();
-
-		DatabaseResult targets;
-		if (
-			(!cross_zone_target_buff && database_new.Select(&targets, "SELECT caster_char_id, target_type, spell_id from character_spell_effect_targets where target_char_id = %u", player->GetCharacterID())) ||
-			(database_new.Select(&targets, "SELECT caster_char_id, target_type, spell_id from character_spell_effect_targets where target_char_id = %u and target_type > 0", player->GetCharacterID())))
-		 {
-			while (targets.Next()) {
-				int32 caster_char_id = targets.GetInt32Str("caster_char_id");
-				int8 prev_target_type = targets.GetInt32Str("target_type");
-				int32 in_spell_id = targets.GetInt32Str("spell_id");
-					Client* tmpCaster = nullptr;
-					MaintainedEffects* effect = nullptr;
-					if (caster_char_id != player->GetCharacterID() && (tmpCaster = zone_list.GetClientByCharID(caster_char_id)) != nullptr && (cross_zone_target_buff || 
-								 tmpCaster->GetCurrentZone() == player->GetZone()) && tmpCaster->GetPlayer() && (effect = tmpCaster->GetPlayer()->GetMaintainedSpell(in_spell_id)) != nullptr)
-					{
-						if(prev_target_type > 0)
-						{
-							if(player->HasPet())
-							{
-								if(player->GetPet() && prev_target_type == PET_TYPE_COMBAT)
-									restoreSpells.insert(make_pair(effect->spell, player->GetPet()));
-								if(player->GetCharmedPet() && prev_target_type == PET_TYPE_CHARMED)
-									restoreSpells.insert(make_pair(effect->spell, player->GetCharmedPet()));
-							}
-						}
-						else if(!player->GetSpellEffect(effect->spell_id, tmpCaster->GetPlayer()))
-						{
-							if(effect->spell->initial_target_char_id == player->GetCharacterID())
-								effect->spell->initial_target = player->GetID();
-							restoreSpells.insert(make_pair(effect->spell, player));
-						}
-					}
-				}
-			}
-	}
-	
-	multimap<LuaSpell*, Entity*>::const_iterator itr;
-
-	for (itr = restoreSpells.begin(); itr != restoreSpells.end(); itr++)
-	{
-		LuaSpell* tmpSpell = itr->first;
-		Entity* target = itr->second;
-		if(!target)
-		{
-			target = client->GetPlayer()->GetPet();
-			if(!target)
-				continue;
-		}
-
-		Entity* caster = tmpSpell->caster;
-		if(!caster)
-			caster = client->GetPlayer();
-		
-		int32 group_id_target = target->group_id;
-		if(target->IsPet() && target->GetOwner())
-			group_id_target = target->GetOwner()->group_id;
-			
-		if(caster != target && caster->GetPet() != target && 
-			tmpSpell->spell->GetSpellData()->group_spell && tmpSpell->spell->GetSpellData()->friendly_spell && (caster->group_id == 0 || group_id_target == 0 || caster->group_id != group_id_target))
-		{
-			LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: %s player no longer grouped with %s to reload bonuses for spell %s (target_groupid: %u, caster_groupid: %u).", target->GetName(), caster ? caster->GetName() : "?", tmpSpell->spell->GetName(), group_id_target, caster->group_id);
-			continue;
-		}
-
-		LogWrite(LUA__WARNING, 0, "LUA", "WorldDatabase::LoadCharacterSpellEffects: %s using caster %s to reload bonuses for spell %s.", player->GetName(), caster ? caster->GetName() : "?", tmpSpell->spell->GetName());
-		
-		tmpSpell->MSpellTargets.writelock(__FUNCTION__, __LINE__);
-		tmpSpell->targets.push_back(target->GetID());
-		tmpSpell->MSpellTargets.releasewritelock(__FUNCTION__, __LINE__);
-
-		target->AddSpellEffect(tmpSpell, tmpSpell->timer.GetRemainingTime() != 0 ? tmpSpell->timer.GetRemainingTime() : 0);
-		vector<BonusValues*>* sb_list = caster->GetAllSpellBonuses(tmpSpell);
-		for (int32 x = 0; x < sb_list->size(); x++) {
-			BonusValues* bv = sb_list->at(x);
-			target->AddSpellBonus(tmpSpell, bv->type, bv->value, bv->class_req, bv->race_req, bv->faction_req);
-		}
-		sb_list->clear();
-		safe_delete(sb_list);
-		// look for a skill bonus on the caster's spell
-		if(caster->IsPlayer())
-		{
-			SkillBonus* sb = ((Player*)caster)->GetSkillBonus(tmpSpell->spell->GetSpellID());
-			if (sb) {
-				map<int32, SkillBonusValue*>::iterator itr_skills;
-				for (itr_skills = sb->skills.begin(); itr_skills != sb->skills.end(); itr_skills++)
-				target->AddSkillBonus(sb->spell_id, (*itr_skills).second->skill_id, (*itr_skills).second->value);
-			}
-		}
-
-	}
-
-}
-
-//devn00b: We need to handle non-found factions so the subtraction/addition works on 1st kill. Need to find a better way to handle this, but for now..
-bool WorldDatabase::VerifyFactionID(int32 char_id, int32 faction_id) {
-	DatabaseResult result;
-	database_new.Select(&result, "SELECT COUNT(id) as faction_exists from character_factions where faction_id=%u and char_id=%u", faction_id, char_id);
-
-	if (result.Next() && result.GetInt32Str("faction_exists") == 0) 
-		return false;
-	
-	return true;
-}
-
-//using int/32 for starting city, should be large enough to support future zones (LOL). TODO: Will probably need more support bolted on, to support PVP and such.
-void WorldDatabase::UpdateStartingLanguage(int32 char_id, uint8 race_id, int32 starting_city)
-{
-	int8 rule = rule_manager.GetGlobalRule(R_World, StartingZoneLanguages)->GetInt8();
-	//this should never need to be done but lets make sure we got all the stuff we need. char_id at min since used for both.
-	if(!char_id || rule == 0 && !race_id ||rule == 1 && !starting_city)
-		return;
-
-	//check the rule, and that they gave us a race, if so use default entries to match live.
-	if(rule == 0 && race_id >= 0) {
-		Query query;
-		LogWrite(PLAYER__DEBUG, 0, "Player", "Adding default Languages for race: %i, for char_id: %u. No Custom Used.", race_id, char_id);
-		query.RunQuery2(Q_INSERT, "INSERT IGNORE INTO character_languages (char_id, language_id) VALUES (%i,(SELECT language_id FROM starting_languages WHERE race=%i))",char_id, race_id);
-		return;
-	}
-	//if we have a starting city supplied, and the rule is set to use it, deal with it
-	if(rule == 1) {
-		Query query;
-		MYSQL_ROW row;
-		MYSQL_RES* result = query.RunQuery2(Q_SELECT,"SELECT language_id from starting_languages where starting_city=%i",starting_city);
-		LogWrite(PLAYER__DEBUG, 0, "Player", "Adding Custom Languages for starting_city: %i.", starting_city);
-		if (result)	{
-			if (mysql_num_rows(result) > 0)	{
-				while (result && (row = mysql_fetch_row(result))){
-				//add custom languages to the character_languages db.
-					query.RunQuery2(Q_INSERT, "INSERT IGNORE INTO character_languages (char_id, language_id) VALUES (%i,%i)",char_id, atoi(row[0]));
-				}
-			}
-		}
-	
-	}
-return;
-}