Index: trunk/src/game/WorldSocketMgr.cpp
===================================================================
--- trunk/src/game/WorldSocketMgr.cpp (revision 102)
+++ trunk/src/game/WorldSocketMgr.cpp (revision 149)
@@ -1,26 +1,26 @@
 /*
- * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
- *
- * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
- *
- * This program 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 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
+* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
+*
+* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
+*
+* This program 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 2 of the License, or
+* (at your option) any later version.
+*
+* This program 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 this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
 
 /** \file WorldSocketMgr.cpp
- *  \ingroup u2w
- *  \author Derex <derex101@gmail.com>
- */
+*  \ingroup u2w
+*  \author Derex <derex101@gmail.com>
+*/
 
 #include "WorldSocketMgr.h"
@@ -48,170 +48,166 @@
 
 /** 
- * This is a helper class to WorldSocketMgr ,that manages 
- * network threads, and assigning connections from acceptor thread
- * to other network threads
- */
+* This is a helper class to WorldSocketMgr ,that manages 
+* network threads, and assigning connections from acceptor thread
+* to other network threads
+*/
 class ReactorRunnable : protected ACE_Task_Base
 {
 public:
 
-  ReactorRunnable () :
-  m_ThreadId (-1),
-  m_Connections (0),
-  m_Reactor (0)
-  {
-    ACE_Reactor_Impl* imp = 0;
+	ReactorRunnable () :
+	  m_ThreadId (-1),
+		  m_Connections (0),
+		  m_Reactor (0)
+	  {
+		  ACE_Reactor_Impl* imp = 0;
 
 #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
-    imp = new ACE_Dev_Poll_Reactor ();
-
-    imp->max_notify_iterations (128);
-    imp->restart (1);
+
+		  imp = new ACE_Dev_Poll_Reactor ();
+
+		  imp->max_notify_iterations (128);
+		  imp->restart (1);
+
 #else
-    imp = new ACE_TP_Reactor ();
-    imp->max_notify_iterations (128);
+
+		  imp = new ACE_TP_Reactor ();
+		  imp->max_notify_iterations (128);
+
 #endif
 
-    m_Reactor = new ACE_Reactor (imp, 1);
-  }
-
-  virtual
-  ~ReactorRunnable ()
-  {
-    this->Stop ();
-    this->Wait ();
-
-    if (m_Reactor)
-      delete m_Reactor;
-  }
-
-  void
-  Stop ()
-  {
-    m_Reactor->end_reactor_event_loop ();
-  }
-
-  int
-  Start ()
-  {
-    if (m_ThreadId != -1)
-      return -1;
-
-    return (m_ThreadId = this->activate ());
-  }
-
-  void
-  Wait ()
-  {
-    ACE_Task_Base::wait ();
-  }
-
-  long
-  Connections ()
-  {
-    return static_cast<long> (m_Connections.value ());
-  }
-
-  int
-  AddSocket (WorldSocket* sock)
-  {
-    ACE_GUARD_RETURN (ACE_Thread_Mutex, Guard, m_NewSockets_Lock, -1);
-
-    ++m_Connections;
-    sock->AddReference();
-    sock->reactor (m_Reactor);
-    m_NewSockets.insert (sock);
-
-    return 0;
-  }
-  
-  ACE_Reactor* GetReactor ()
-  {
-    return m_Reactor;
-  }
-  
+		  m_Reactor = new ACE_Reactor (imp, 1);
+	  }
+
+	  virtual ~ReactorRunnable ()
+	  {
+		  this->Stop ();
+		  this->Wait ();
+
+		  if (m_Reactor)
+			  delete m_Reactor;
+	  }
+
+	  void Stop ()
+	  {
+		  m_Reactor->end_reactor_event_loop ();
+	  }
+
+	  int Start ()
+	  {
+		  if (m_ThreadId != -1)
+			  return -1;
+
+		  return (m_ThreadId = this->activate ());
+	  }
+
+	  void Wait ()
+	  {
+		  ACE_Task_Base::wait ();
+	  }
+
+	  long Connections ()
+	  {
+		  return static_cast<long> (m_Connections.value ());
+	  }
+
+	  int AddSocket (WorldSocket* sock)
+	  {
+		  ACE_GUARD_RETURN (ACE_Thread_Mutex, Guard, m_NewSockets_Lock, -1);
+
+		  ++m_Connections;
+		  sock->AddReference();
+		  sock->reactor (m_Reactor);
+		  m_NewSockets.insert (sock);
+
+		  return 0;
+	  }
+
+	  ACE_Reactor* GetReactor ()
+	  {
+		  return m_Reactor;
+	  }
+
 protected:
-  
-  void
-  AddNewSockets ()
-  {
-    ACE_GUARD (ACE_Thread_Mutex, Guard, m_NewSockets_Lock);
-
-    if (m_NewSockets.empty ())
-      return;
-
-    for (SocketSet::iterator i = m_NewSockets.begin (); i != m_NewSockets.end (); ++i)
-      {
-        WorldSocket* sock = (*i);
-
-        if (sock->IsClosed ())
-          {
-            sock->RemoveReference ();
-            --m_Connections;
-          }
-        else
-          m_Sockets.insert (sock);
-      }
-
-    m_NewSockets.clear ();
-  }
-
-  virtual int
-  svc (void)
-  {
-    DEBUG_LOG ("Network Thread Starting");
-
-    WorldDatabase.ThreadStart ();
-
-    ACE_ASSERT (m_Reactor);
-
-    SocketSet::iterator i, t;
-
-    while (!m_Reactor->reactor_event_loop_done ())
-      {
-        // dont be too smart to move this outside the loop 
-        // the run_reactor_event_loop will modify interval
-        ACE_Time_Value interval (0, 10000);
-
-        if (m_Reactor->run_reactor_event_loop (interval) == -1)
-          break;
-
-        AddNewSockets ();
-
-        for (i = m_Sockets.begin (); i != m_Sockets.end ();)
-          {
-            if ((*i)->Update () == -1)
-              {
-                t = i;
-                i++;
-                (*t)->CloseSocket ();
-                (*t)->RemoveReference ();
-                --m_Connections;
-                m_Sockets.erase (t);
-              }
-            else
-              i++;
-          }
-      }
-
-    WorldDatabase.ThreadEnd ();
-
-    DEBUG_LOG ("Network Thread Exitting");
-
-    return 0;
-  }
+
+	void AddNewSockets ()
+	{
+		ACE_GUARD (ACE_Thread_Mutex, Guard, m_NewSockets_Lock);
+
+		if (m_NewSockets.empty ())
+			return;
+
+		for (SocketSet::iterator i = m_NewSockets.begin (); i != m_NewSockets.end (); ++i)
+		{
+			WorldSocket* sock = (*i);
+
+			if (sock->IsClosed ())
+			{
+				sock->RemoveReference ();
+				--m_Connections;
+			}
+			else
+				m_Sockets.insert (sock);
+		}
+
+		m_NewSockets.clear ();
+	}
+
+	virtual int svc (void)
+	{
+		DEBUG_LOG ("Network Thread Starting");
+
+		WorldDatabase.ThreadStart ();
+
+		ACE_ASSERT (m_Reactor);
+
+		SocketSet::iterator i, t;
+
+		while (!m_Reactor->reactor_event_loop_done ())
+		{
+			// dont be too smart to move this outside the loop 
+			// the run_reactor_event_loop will modify interval
+			ACE_Time_Value interval (0, 10000);
+
+			if (m_Reactor->run_reactor_event_loop (interval) == -1)
+				break;
+
+			AddNewSockets ();
+
+			for (i = m_Sockets.begin (); i != m_Sockets.end ();)
+			{
+				if ((*i)->Update () == -1)
+				{
+					t = i;
+					i++;
+					(*t)->CloseSocket ();
+					(*t)->RemoveReference ();
+					--m_Connections;
+					m_Sockets.erase (t);
+				}
+				else
+					i++;
+			}
+		}
+
+		WorldDatabase.ThreadEnd ();
+
+		DEBUG_LOG ("Network Thread Exitting");
+
+		return 0;
+	}
 
 private:
-  typedef ACE_Atomic_Op<ACE_SYNCH_MUTEX, long> AtomicInt;
-  typedef std::set<WorldSocket*> SocketSet;
-
-  ACE_Reactor* m_Reactor;
-  AtomicInt m_Connections;
-  int m_ThreadId;
-
-  SocketSet m_Sockets;
-
-  SocketSet m_NewSockets;
-  ACE_Thread_Mutex m_NewSockets_Lock;
+	typedef ACE_Atomic_Op<ACE_SYNCH_MUTEX, long> AtomicInt;
+	typedef std::set<WorldSocket*> SocketSet;
+
+	ACE_Reactor* m_Reactor;
+	AtomicInt m_Connections;
+	int m_ThreadId;
+
+	SocketSet m_Sockets;
+
+	SocketSet m_NewSockets;
+	ACE_Thread_Mutex m_NewSockets_Lock;
 };
 
@@ -228,144 +224,137 @@
 WorldSocketMgr::~WorldSocketMgr ()
 {
-  if (m_NetThreads)
-    delete [] m_NetThreads;
-  
-  if(m_Acceptor)
-    delete m_Acceptor;
-}
-
-int
-WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
-{
-  m_UseNoDelay = sConfig.GetBoolDefault ("Network.TcpNodelay", true);
-
-  int num_threads = sConfig.GetIntDefault ("Network.Threads", 1);
-
-  if (num_threads <= 0)
-    {
-      sLog.outError ("Network.Threads is wrong in your config file");
-      return -1;
-    }
-
-  m_NetThreadsCount = static_cast<size_t> (num_threads + 1);
-
-  m_NetThreads = new ReactorRunnable[m_NetThreadsCount];
-
-  sLog.outBasic ("Max alowed socket connections %d",ACE::max_handles ());
-
-  m_SockOutKBuff = sConfig.GetIntDefault ("Network.OutKBuff", -1); // -1 means use default
-
-  m_SockOutUBuff = sConfig.GetIntDefault ("Network.OutUBuff", 65536);
-
-  if ( m_SockOutUBuff <= 0 )
-    {
-      sLog.outError ("Network.OutUBuff is wrong in your config file");
-      return -1;
-    }
-
-  WorldSocket::Acceptor *acc = new WorldSocket::Acceptor;
-  m_Acceptor = acc;
-
-  ACE_INET_Addr listen_addr (port, address);
-
-  if (acc->open (listen_addr, m_NetThreads[0].GetReactor (), ACE_NONBLOCK) == -1)
-    {
-      sLog.outError ("Failed to open acceptor ,check if the port is free");
-      return -1;
-    }
-
-  for (size_t i = 0; i < m_NetThreadsCount; ++i)
-    m_NetThreads[i].Start ();
-
-  return 0;
-}
-
-int
-WorldSocketMgr::StartNetwork (ACE_UINT16 port, const char* address)
-{
-  if (!sLog.IsOutDebug ())
-    ACE_Log_Msg::instance ()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS);
-
-  if (this->StartReactiveIO (port, address) == -1)
-    return -1;
-
-  return 0;
-}
-
-void
-WorldSocketMgr::StopNetwork ()
-{
-  if (m_Acceptor)
-    {
-      WorldSocket::Acceptor* acc = dynamic_cast<WorldSocket::Acceptor*> (m_Acceptor);
-
-      if (acc)
-        acc->close ();
-    }
-
-  if (m_NetThreadsCount != 0)
-    {
-      for (size_t i = 0; i < m_NetThreadsCount; ++i)
-        m_NetThreads[i].Stop ();
-    }
-  
-  this->Wait ();
-}
-
-void 
-WorldSocketMgr::Wait ()
-{
-  if (m_NetThreadsCount != 0)
-    {
-      for (size_t i = 0; i < m_NetThreadsCount; ++i)
-        m_NetThreads[i].Wait ();
-    }
-}
-
-int
-WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
-{
-  // set some options here
-  if (m_SockOutKBuff >= 0)
-    if (sock->peer ().set_option (SOL_SOCKET,
-                                  SO_SNDBUF,
-                                  (void*) & m_SockOutKBuff,
-                                  sizeof (int)) == -1 && errno != ENOTSUP)
-      {
-        sLog.outError ("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
-        return -1;
-      }
-
-  static const int ndoption = 1;
-
-  // Set TCP_NODELAY.
-  if (m_UseNoDelay)
-    if (sock->peer ().set_option (ACE_IPPROTO_TCP,
-                                  TCP_NODELAY,
-                                  (void*) & ndoption,
-                                  sizeof (int)) == -1)
-      {
-        sLog.outError ("WorldSocketMgr::OnSocketOpen: peer ().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno));
-        return -1;
-      }
-  
-  sock->m_OutBufferSize = static_cast<size_t> (m_SockOutUBuff);
-
-  // we skip the Acceptor Thread
-  size_t min = 1;
-
-  ACE_ASSERT (m_NetThreadsCount >= 1);
-
-  for (size_t i = 1; i < m_NetThreadsCount; ++i)
-    if (m_NetThreads[i].Connections () < m_NetThreads[min].Connections ())
-      min = i;
-
-  return m_NetThreads[min].AddSocket (sock);
-
-}
-
-WorldSocketMgr*
-WorldSocketMgr::Instance ()
-{
-  return ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>::instance();
-}
+	if (m_NetThreads)
+		delete [] m_NetThreads;
+
+	if(m_Acceptor)
+		delete m_Acceptor;
+}
+
+int WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
+{
+	m_UseNoDelay = sConfig.GetBoolDefault ("Network.TcpNodelay", true);
+
+	int num_threads = sConfig.GetIntDefault ("Network.Threads", 1);
+
+	if (num_threads <= 0)
+	{
+		sLog.outError ("Network.Threads is wrong in your config file");
+		return -1;
+	}
+
+	m_NetThreadsCount = static_cast<size_t> (num_threads + 1);
+
+	m_NetThreads = new ReactorRunnable[m_NetThreadsCount];
+
+	sLog.outBasic ("Max alowed socket connections %d",ACE::max_handles ());
+
+	m_SockOutKBuff = sConfig.GetIntDefault ("Network.OutKBuff", -1); // -1 means use default
+
+	m_SockOutUBuff = sConfig.GetIntDefault ("Network.OutUBuff", 65536);
+
+	if ( m_SockOutUBuff <= 0 )
+	{
+		sLog.outError ("Network.OutUBuff is wrong in your config file");
+		return -1;
+	}
+
+	WorldSocket::Acceptor *acc = new WorldSocket::Acceptor;
+	m_Acceptor = acc;
+
+	ACE_INET_Addr listen_addr (port, address);
+
+	if (acc->open (listen_addr, m_NetThreads[0].GetReactor (), ACE_NONBLOCK) == -1)
+	{
+		sLog.outError ("Failed to open acceptor ,check if the port is free");
+		return -1;
+	}
+
+	for (size_t i = 0; i < m_NetThreadsCount; ++i)
+		m_NetThreads[i].Start ();
+
+	return 0;
+}
+
+int WorldSocketMgr::StartNetwork (ACE_UINT16 port, const char* address)
+{
+	if (!sLog.IsOutDebug ())
+		ACE_Log_Msg::instance ()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS);
+
+	if (this->StartReactiveIO (port, address) == -1)
+		return -1;
+
+	return 0;
+}
+
+void WorldSocketMgr::StopNetwork ()
+{
+	if (m_Acceptor)
+	{
+		WorldSocket::Acceptor* acc = dynamic_cast<WorldSocket::Acceptor*> (m_Acceptor);
+
+		if (acc)
+			acc->close ();
+	}
+
+	if (m_NetThreadsCount != 0)
+	{
+		for (size_t i = 0; i < m_NetThreadsCount; ++i)
+			m_NetThreads[i].Stop ();
+	}
+
+	this->Wait ();
+}
+
+void WorldSocketMgr::Wait ()
+{
+	if (m_NetThreadsCount != 0)
+	{
+		for (size_t i = 0; i < m_NetThreadsCount; ++i)
+			m_NetThreads[i].Wait ();
+	}
+}
+
+int WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
+{
+	// set some options here
+	if (m_SockOutKBuff >= 0)
+		if (sock->peer ().set_option (SOL_SOCKET,
+			SO_SNDBUF,
+			(void*) & m_SockOutKBuff,
+			sizeof (int)) == -1 && errno != ENOTSUP)
+		{
+			sLog.outError ("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
+			return -1;
+		}
+
+		static const int ndoption = 1;
+
+		// Set TCP_NODELAY.
+		if (m_UseNoDelay)
+			if (sock->peer ().set_option (ACE_IPPROTO_TCP,
+				TCP_NODELAY,
+				(void*) & ndoption,
+				sizeof (int)) == -1)
+			{
+				sLog.outError ("WorldSocketMgr::OnSocketOpen: peer ().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno));
+				return -1;
+			}
+
+			sock->m_OutBufferSize = static_cast<size_t> (m_SockOutUBuff);
+
+			// we skip the Acceptor Thread
+			size_t min = 1;
+
+			ACE_ASSERT (m_NetThreadsCount >= 1);
+
+			for (size_t i = 1; i < m_NetThreadsCount; ++i)
+				if (m_NetThreads[i].Connections () < m_NetThreads[min].Connections ())
+					min = i;
+
+			return m_NetThreads[min].AddSocket (sock);
+}
+
+WorldSocketMgr* WorldSocketMgr::Instance ()
+{
+	return ACE_Singleton<WorldSocketMgr,ACE_Thread_Mutex>::instance();
+}
Index: trunk/src/game/SpellEffects.cpp
===================================================================
--- trunk/src/game/SpellEffects.cpp (revision 145)
+++ trunk/src/game/SpellEffects.cpp (revision 149)
@@ -4074,10 +4074,10 @@
 
     uint32 faction = m_caster->getFaction();
-    if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isTotem())
-    {
-        Unit* owner = ((Totem*)m_caster)->GetOwner();
-        if(owner)
-            faction = owner->getFaction();
-        NewSummon->GetCharmInfo()->SetReactState(REACT_AGGRESSIVE);
+    if(m_caster->GetTypeId() == TYPEID_UNIT)
+    {
+		if ( ((Creature*)m_caster)->isTotem() )
+			NewSummon->GetCharmInfo()->SetReactState(REACT_AGGRESSIVE);
+		else
+			NewSummon->GetCharmInfo()->SetReactState(REACT_DEFENSIVE);
     }
 
Index: trunk/src/game/Chat.h
===================================================================
--- trunk/src/game/Chat.h (revision 132)
+++ trunk/src/game/Chat.h (revision 149)
@@ -100,5 +100,4 @@
         bool HandleCommandsCommand(const char* args);
         bool HandleStartCommand(const char* args);
-        bool HandleInfoCommand(const char* args);
         bool HandleDismountCommand(const char* args);
         bool HandleSaveCommand(const char* args);
@@ -230,4 +229,5 @@
 		bool HandleServerCorpsesCommand(const char* args);
 		bool HandleServerExitCommand(const char* args);
+		bool HandleServerInfoCommand(const char* args);
 		bool HandleServerMotdCommand(const char* args);
 		bool HandleServerSetMotdCommand(const char* args);
Index: trunk/src/game/Level3.cpp
===================================================================
--- trunk/src/game/Level3.cpp (revision 132)
+++ trunk/src/game/Level3.cpp (revision 149)
@@ -5543,5 +5543,5 @@
 			return false;
 		case DUMP_TOO_MANY_CHARS:
-			PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL,account_name,account_id);
+			PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL,account_name.c_str(),account_id);
 			SetSentErrorMessage(true);
 			return false;
Index: trunk/src/game/Chat.cpp
===================================================================
--- trunk/src/game/Chat.cpp (revision 134)
+++ trunk/src/game/Chat.cpp (revision 149)
@@ -70,5 +70,5 @@
 		{ "idlerestart",    SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleIdleRestartCommand,         "", NULL },
 		{ "idleshutdown",   SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleIdleShutDownCommand,        "", NULL },
-		{ "info",           SEC_PLAYER,         true,  &ChatHandler::HandleInfoCommand,                "", NULL },
+		{ "info",           SEC_PLAYER,         true,  &ChatHandler::HandleServerInfoCommand,          "", NULL },
 		{ "motd",           SEC_PLAYER,         true,  &ChatHandler::HandleServerMotdCommand,          "", NULL },
 		{ "restart",        SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleRestartCommand,             "", NULL },
Index: trunk/src/game/WorldSocket.cpp
===================================================================
--- trunk/src/game/WorldSocket.cpp (revision 102)
+++ trunk/src/game/WorldSocket.cpp (revision 149)
@@ -19,7 +19,4 @@
  */
 
-#include "Common.h"
-#include "WorldSocket.h" 
-
 #include <ace/Message_Block.h>
 #include <ace/OS_NS_string.h>
@@ -32,4 +29,7 @@
 #include <ace/Reactor.h>
 #include <ace/Auto_Ptr.h>
+
+#include "WorldSocket.h"
+#include "Common.h"
 
 #include "Util.h"
Index: trunk/src/game/Unit.h
===================================================================
--- trunk/src/game/Unit.h (revision 143)
+++ trunk/src/game/Unit.h (revision 149)
@@ -647,7 +647,7 @@
         CommandStates GetCommandState() { return m_CommandState; }
         bool HasCommandState(CommandStates state) { return (m_CommandState == state); }
-        void SetReactState(ReactStates st) { m_ReactSate = st; }
-        ReactStates GetReactState() { return m_ReactSate; }
-        bool HasReactState(ReactStates state) { return (m_ReactSate == state); }
+        void SetReactState(ReactStates st) { m_reactState = st; }
+		ReactStates GetReactState() { return m_reactState; }
+		bool HasReactState(ReactStates state) { return (m_reactState == state); }
 
         void InitPossessCreateSpells();
@@ -666,5 +666,5 @@
         CharmSpellEntry m_charmspells[4];
         CommandStates   m_CommandState;
-        ReactStates     m_ReactSate;
+        ReactStates     m_reactState;
         uint32          m_petnumber;
 };
Index: trunk/src/game/World.h
===================================================================
--- trunk/src/game/World.h (revision 112)
+++ trunk/src/game/World.h (revision 149)
@@ -481,4 +481,13 @@
 
         LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; }
+
+		//used World DB version
+		void LoadDBVersion();
+		char const* GetDBVersion() { return m_DBVersion.c_str(); }
+
+		//used Script version
+		void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; }
+		char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); }
+
     protected:
         void _UpdateGameTime();
@@ -541,4 +550,8 @@
         void AddSession_(WorldSession* s);
         ZThread::LockedQueue<WorldSession*, ZThread::FastMutex> addSessQueue;
+
+		//used versions
+		std::string m_DBVersion;
+		std::string m_ScriptsVersion;
 };
 
Index: trunk/src/game/Unit.cpp
===================================================================
--- trunk/src/game/Unit.cpp (revision 143)
+++ trunk/src/game/Unit.cpp (revision 149)
@@ -6485,5 +6485,5 @@
         case 836:                                           // Improved Blizzard (Rank 1)
         {
-            if( !procSpell || procSpell->SpellVisual!=9487 )
+            if( !procSpell || procSpell->SpellVisual!=9487)
                 return false;
             triggered_spell_id = 12484;
@@ -6492,5 +6492,5 @@
         case 988:                                           // Improved Blizzard (Rank 2)
         {
-            if( !procSpell || procSpell->SpellVisual!=9487 )
+            if( !procSpell || procSpell->SpellVisual!=9487)
                 return false;
             triggered_spell_id = 12485;
@@ -6499,5 +6499,5 @@
         case 989:                                           // Improved Blizzard (Rank 3)
         {
-            if( !procSpell || procSpell->SpellVisual!=9487 )
+            if( !procSpell || procSpell->SpellVisual!=9487)
                 return false;
             triggered_spell_id = 12486;
@@ -9871,5 +9871,5 @@
 
 CharmInfo::CharmInfo(Unit* unit)
-: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_ReactSate(REACT_PASSIVE), m_petnumber(0)
+: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0)
 {
     for(int i =0; i<4; ++i)
Index: trunk/src/game/ObjectMgr.h
===================================================================
--- trunk/src/game/ObjectMgr.h (revision 112)
+++ trunk/src/game/ObjectMgr.h (revision 149)
@@ -206,7 +206,9 @@
     CONDITION_QUESTTAKEN            = 9,                    // quest_id     0,      for condition true while quest active.
     CONDITION_AD_COMMISSION_AURA    = 10,                   // 0            0,      for condition true while one from AD ñommission aura active
-};
-
-#define MAX_CONDITION                 11                    // maximum value in ConditionType enum
+	CONDITION_NO_AURA               = 11,                   // spell_id     effindex
+	CONDITION_ACTIVE_EVENT          = 12,                   // event_id
+};
+
+#define MAX_CONDITION                 13                    // maximum value in ConditionType enum
 
 //Player's info
@@ -771,4 +773,5 @@
         bool RemoveVendorItem(uint32 entry,uint32 item, bool savetodb = true);
         bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const;
+
     protected:
         uint32 m_auctionid;
Index: trunk/src/game/Level0.cpp
===================================================================
--- trunk/src/game/Level0.cpp (revision 112)
+++ trunk/src/game/Level0.cpp (revision 149)
@@ -87,5 +87,5 @@
 }
 
-bool ChatHandler::HandleInfoCommand(const char* /*args*/)
+bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
 {
     uint32 activeClientsNum = sWorld.GetActiveSessionCount();
@@ -95,5 +95,13 @@
     std::string str = secsToTimeString(sWorld.GetUptime());
 
-    PSendSysMessage(_FULLVERSION);
+    PSendSysMessage(_FULLVERSION); //char const* full;
+    //if(m_session)
+    //    full = _FULLVERSION(REVISION_DATE,REVISION_TIME,"|cffffffff|Hurl:" REVISION_ID "|h" REVISION_ID "|h|r");
+    //else
+    //    full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID);
+
+    //SendSysMessage(full);
+    //PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion());
+    //PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion());
     PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
     PSendSysMessage(LANG_UPTIME, str.c_str());
Index: trunk/src/game/World.cpp
===================================================================
--- trunk/src/game/World.cpp (revision 138)
+++ trunk/src/game/World.cpp (revision 149)
@@ -2613,2 +2613,16 @@
     m_maxQueuedSessionCount = std::max(m_maxQueuedSessionCount,uint32(m_QueuedPlayer.size()));
 }
+
+void World::LoadDBVersion()
+{
+	QueryResult* result = WorldDatabase.Query("SELECT version FROM db_version LIMIT 1");
+	if(result)
+	{
+		Field* fields = result->Fetch();
+
+		m_DBVersion = fields[0].GetString();
+		delete result;
+	}
+	else
+		m_DBVersion = "unknown world database";
+}
Index: trunk/src/game/ScriptCalls.h
===================================================================
--- trunk/src/game/ScriptCalls.h (revision 102)
+++ trunk/src/game/ScriptCalls.h (revision 149)
@@ -40,4 +40,5 @@
 typedef void(TRINITY_IMPORT * scriptCallScriptsInit) ();
 typedef void(TRINITY_IMPORT * scriptCallScriptsFree) ();
+typedef char const* (TRINITY_IMPORT * scriptCallScriptsVersion) ();
 
 typedef bool(TRINITY_IMPORT * scriptCallGossipHello) (Player *player, Creature *_Creature );
@@ -65,4 +66,5 @@
     scriptCallScriptsInit ScriptsInit;
     scriptCallScriptsFree ScriptsFree;
+	scriptCallScriptsVersion ScriptsVersion;
 
     scriptCallGossipHello GossipHello;
Index: trunk/src/game/Level2.cpp
===================================================================
--- trunk/src/game/Level2.cpp (revision 132)
+++ trunk/src/game/Level2.cpp (revision 149)
@@ -1955,5 +1955,5 @@
     if(num > 0)
     {
-        QueryResult *result = CharacterDatabase.PQuery("SELECT guid,ticket_text,ticket_lastchange FROM character_ticket ORDER BY ticket_id ASC LIMIT %d,1",num-1);
+        QueryResult *result = CharacterDatabase.PQuery("SELECT guid,ticket_text,ticket_lastchange FROM character_ticket ORDER BY ticket_id ASC "_OFFSET_, num-1);
 
         if(!result)
@@ -2067,7 +2067,7 @@
     if(num > 0)
     {
-        QueryResult *result = CharacterDatabase.PQuery("SELECT ticket_id,guid FROM character_ticket LIMIT %i",num);
-
-        if(!result || uint64(num) > result->GetRowCount())
+        QueryResult *result = CharacterDatabase.PQuery("SELECT ticket_id,guid FROM character_ticket ORDER BY ticket_id ASC "_OFFSET_,num-1);
+
+        if(!result)
         {
             PSendSysMessage(LANG_COMMAND_TICKENOTEXIST, num);
@@ -2076,7 +2076,4 @@
             return false;
         }
-
-        for(int i = 1; i < num; ++i)
-            result->NextRow();
 
         Field* fields = result->Fetch();
Index: trunk/src/game/CharacterHandler.cpp
===================================================================
--- trunk/src/game/CharacterHandler.cpp (revision 102)
+++ trunk/src/game/CharacterHandler.cpp (revision 149)
@@ -380,5 +380,5 @@
     SendPacket( &data );
 
-    std::string IP_str = GetRemoteAddress().c_str();
+    std::string IP_str = GetRemoteAddress();
     sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
     sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
Index: trunk/src/game/WorldSession.cpp
===================================================================
--- trunk/src/game/WorldSession.cpp (revision 128)
+++ trunk/src/game/WorldSession.cpp (revision 149)
@@ -52,8 +52,8 @@
 {
    if (sock)
-     {
-       m_Address = sock->GetRemoteAddress ();
-       sock->AddReference ();
-     }
+   {
+	   m_Address = sock->GetRemoteAddress ();
+	   sock->AddReference ();
+   }
 }
 
@@ -100,5 +100,7 @@
     if (!m_Socket)
         return;
+
     #ifdef TRINITY_DEBUG
+
     // Code for network use statistic
     static uint64 sendPacketCount = 0;
@@ -132,10 +134,9 @@
         sendLastPacketBytes = packet->wpos();               // wpos is real written size
     }
-#endif                                                  // !TRINITY_DEBUG
-
-  if (m_Socket->SendPacket (*packet) == -1)
-    {
-      m_Socket->CloseSocket ();
-    }
+
+	#endif                                                  // !TRINITY_DEBUG
+
+	if (m_Socket->SendPacket (*packet) == -1)
+		m_Socket->CloseSocket ();
 }
 
@@ -158,10 +159,9 @@
 bool WorldSession::Update(uint32 /*diff*/)
 {
-  if (m_Socket)
-    if (m_Socket->IsClosed ())
-      { 
+  if (m_Socket && m_Socket->IsClosed ())
+  {
         m_Socket->RemoveReference ();
         m_Socket = NULL;
-      }
+  }
   
     WorldPacket *packet;
@@ -396,5 +396,6 @@
         ///- Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline
         //No SQL injection as AccountId is uint32
-        CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'", GetAccountId());
+        CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'",
+			GetAccountId());
         sLog.outDebug( "SESSION: Sent SMSG_LOGOUT_COMPLETE Message" );
     }
@@ -408,8 +409,6 @@
 void WorldSession::KickPlayer()
 {
-  if (m_Socket)
-    {
-      m_Socket->CloseSocket ();
-    }
+	if (m_Socket)
+		m_Socket->CloseSocket ();
 }
 
Index: trunk/src/game/Player.cpp
===================================================================
--- trunk/src/game/Player.cpp (revision 142)
+++ trunk/src/game/Player.cpp (revision 149)
@@ -3258,4 +3258,6 @@
     updateVisualBits.SetCount(PLAYER_END);
 
+	// TODO: really implement OWNER_ONLY and GROUP_ONLY. Flags can be found in UpdateFields.h
+
     updateVisualBits.SetBit(OBJECT_FIELD_GUID);
     updateVisualBits.SetBit(OBJECT_FIELD_TYPE);
@@ -3269,4 +3271,5 @@
 
     updateVisualBits.SetBit(UNIT_FIELD_CHARMEDBY);
+	updateVisualBits.SetBit(UNIT_FIELD_CHARMEDBY+1);
 
     updateVisualBits.SetBit(UNIT_FIELD_TARGET);
@@ -3300,10 +3303,8 @@
     updateVisualBits.SetBit(UNIT_FIELD_BASEATTACKTIME);
     updateVisualBits.SetBit(UNIT_FIELD_BASEATTACKTIME + 1);
-    updateVisualBits.SetBit(UNIT_FIELD_RANGEDATTACKTIME);
     updateVisualBits.SetBit(UNIT_FIELD_BOUNDINGRADIUS);
     updateVisualBits.SetBit(UNIT_FIELD_COMBATREACH);
     updateVisualBits.SetBit(UNIT_FIELD_DISPLAYID);
     updateVisualBits.SetBit(UNIT_FIELD_NATIVEDISPLAYID);
-    updateVisualBits.SetBit(UNIT_FIELD_MOUNTDISPLAYID);
     updateVisualBits.SetBit(UNIT_FIELD_BYTES_1);
     updateVisualBits.SetBit(UNIT_FIELD_MOUNTDISPLAYID);
@@ -3315,14 +3316,14 @@
     updateVisualBits.SetBit(UNIT_FIELD_BYTES_2);
 
+	updateVisualBits.SetBit(PLAYER_DUEL_ARBITER);
+	updateVisualBits.SetBit(PLAYER_DUEL_ARBITER+1);
     updateVisualBits.SetBit(PLAYER_FLAGS);
+	updateVisualBits.SetBit(PLAYER_GUILDID);
+	updateVisualBits.SetBit(PLAYER_GUILDRANK);
     updateVisualBits.SetBit(PLAYER_BYTES);
     updateVisualBits.SetBit(PLAYER_BYTES_2);
     updateVisualBits.SetBit(PLAYER_BYTES_3);
-    updateVisualBits.SetBit(PLAYER_GUILDID);
-    updateVisualBits.SetBit(PLAYER_GUILDRANK);
+    updateVisualBits.SetBit(PLAYER_DUEL_TEAM);
     updateVisualBits.SetBit(PLAYER_GUILD_TIMESTAMP);
-    updateVisualBits.SetBit(PLAYER_DUEL_TEAM);
-    updateVisualBits.SetBit(PLAYER_DUEL_ARBITER);
-    updateVisualBits.SetBit(PLAYER_DUEL_ARBITER+1);
 
     // PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)...
@@ -3353,14 +3354,4 @@
 
     updateVisualBits.SetBit(PLAYER_CHOSEN_TITLE);
-
-    updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY);
-    updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY + 1);
-    updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY + 2);
-    updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_INFO);
-    updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_INFO + 1);
-    updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_INFO + 2);
-    updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_INFO + 3);
-    updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_INFO + 4);
-    updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_INFO + 5);
 }
 
Index: trunk/src/game/Mail.cpp
===================================================================
--- trunk/src/game/Mail.cpp (revision 102)
+++ trunk/src/game/Mail.cpp (revision 149)
@@ -188,4 +188,5 @@
                 return;
             }
+
             if (mailItem.item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_CONJURED) || mailItem.item->GetUInt32Value(ITEM_FIELD_DURATION))
             {
@@ -193,4 +194,10 @@
                 return;
             }
+
+			if(COD && mailItem.item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED))
+			{
+				pl->SendMailResult(0, 0, MAIL_ERR_CANT_SEND_WRAPPED_COD);
+				return;
+			}
         }
     }
Index: trunk/src/game/ScriptCalls.cpp
===================================================================
--- trunk/src/game/ScriptCalls.cpp (revision 102)
+++ trunk/src/game/ScriptCalls.cpp (revision 149)
@@ -25,4 +25,5 @@
 #include "Platform/Define.h"
 #include "ScriptCalls.h"
+#include "World.h"
 
 ScriptsSet Script=NULL;
@@ -58,4 +59,5 @@
     if(   !(testScript->ScriptsInit         =(scriptCallScriptsInit         )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsInit"         ))
         ||!(testScript->ScriptsFree         =(scriptCallScriptsFree         )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsFree"         ))
+		||!(testScript->ScriptsVersion      =(scriptCallScriptsVersion      )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsVersion"      ))
         ||!(testScript->GossipHello         =(scriptCallGossipHello         )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GossipHello"         ))
         ||!(testScript->GOChooseReward      =(scriptCallGOChooseReward      )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOChooseReward"      ))
@@ -94,4 +96,6 @@
     Script->ScriptsInit();
 
+	sWorld.SetScriptsVersion(Script->ScriptsVersion());
+
     return true;
 }
Index: trunk/src/game/Pet.cpp
===================================================================
--- trunk/src/game/Pet.cpp (revision 120)
+++ trunk/src/game/Pet.cpp (revision 149)
@@ -1367,4 +1367,8 @@
                 remaincharges = -1;
 
+			/// do not load single target auras (unless they were cast by the player)
+			if (caster_guid != GetGUID() && IsSingleTargetSpell(spellproto))
+				continue;
+
             Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL);
 
@@ -1396,8 +1400,17 @@
                 break;
 
-        if (i == 3 && !itr->second->IsPassive())
-            CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_index,amount,maxduration,remaintime,remaincharges) "
-                "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%d', '%d', '%d', '%d')",
-                m_charmInfo->GetPetNumber(), itr->second->GetCasterGUID(),(uint32)(*itr).second->GetId(), (uint32)(*itr).second->GetEffIndex(),(*itr).second->GetModifier()->m_amount,int((*itr).second->GetAuraMaxDuration()),int((*itr).second->GetAuraDuration()),int((*itr).second->m_procCharges));
+        if (i != 3)
+			continue;
+
+		if(itr->second->IsPassive())
+			continue;
+
+		/// do not save single target auras (unless they were cast by the player)
+		if (itr->second->GetCasterGUID() != GetGUID() && IsSingleTargetSpell(spellInfo))
+			continue;
+
+		CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_index,amount,maxduration,remaintime,remaincharges) "
+			"VALUES ('%u', '" I64FMTD "', '%u', '%u', '%d', '%d', '%d', '%d')",
+			m_charmInfo->GetPetNumber(), itr->second->GetCasterGUID(),(uint32)(*itr).second->GetId(), (uint32)(*itr).second->GetEffIndex(),(*itr).second->GetModifier()->m_amount,int((*itr).second->GetAuraMaxDuration()),int((*itr).second->GetAuraDuration()),int((*itr).second->m_procCharges));
     }
 }
Index: trunk/src/game/ObjectMgr.cpp
===================================================================
--- trunk/src/game/ObjectMgr.cpp (revision 144)
+++ trunk/src/game/ObjectMgr.cpp (revision 149)
@@ -6570,4 +6570,8 @@
             return false;
         }
+		case CONDITION_NO_AURA:
+			return !player->HasAura(value1, value2);
+		case CONDITION_ACTIVE_EVENT:
+			return gameeventmgr.IsActiveEvent(value1);
         default:
             return false;
@@ -6690,4 +6694,28 @@
             break;
         }
+		case CONDITION_NO_AURA:
+		{
+			if(!sSpellStore.LookupEntry(value1))
+			{
+				sLog.outErrorDb("Aura condition requires to have non existing spell (Id: %d), skipped", value1);
+				return false;
+			}
+			if(value2 > 2)
+			{
+				sLog.outErrorDb("Aura condition requires to have non existing effect index (%u) (must be 0..2), skipped", value2);
+				return false;
+			}
+			break;
+		}
+		case CONDITION_ACTIVE_EVENT:
+		{
+			GameEvent::GameEventDataMap const& events = gameeventmgr.GetEventMap();
+			if(value1 >=events.size() || !events[value1].isValid())
+			{
+				sLog.outErrorDb("Active event condition requires existed event id (%u), skipped", value1);
+				return false;
+			}
+			break;
+		}
     }
     return true;
Index: trunk/src/game/Map.cpp
===================================================================
--- trunk/src/game/Map.cpp (revision 141)
+++ trunk/src/game/Map.cpp (revision 149)
@@ -579,13 +579,4 @@
     }
 }
-
-void InstanceMap::Update(const uint32& t_diff)
-{
-    Map::Update(t_diff);
-
-    if(i_data)
-        i_data->Update(t_diff);
-}
-
 
 void Map::Remove(Player *player, bool remove)
@@ -1558,4 +1549,12 @@
 }
 
+void InstanceMap::Update(const uint32& t_diff)
+{
+	Map::Update(t_diff);
+
+	if(i_data)
+		i_data->Update(t_diff);
+}
+
 void InstanceMap::Remove(Player *player, bool remove)
 {
Index: trunk/src/game/SpellMgr.cpp
===================================================================
--- trunk/src/game/SpellMgr.cpp (revision 131)
+++ trunk/src/game/SpellMgr.cpp (revision 149)
@@ -2193,5 +2193,5 @@
                 return zone_id ==3522 || map_id==565;
             }
-            if(mask & ELIXIR_UNSTABLE_MASK)
+            if(mask & ELIXIR_SHATTRATH_MASK)
             {
                 // in Tempest Keep, Serpentshrine Cavern, Caverns of Time: Mount Hyjal, Black Temple
Index: trunk/src/game/Language.h
===================================================================
--- trunk/src/game/Language.h (revision 132)
+++ trunk/src/game/Language.h (revision 149)
@@ -83,5 +83,7 @@
 	LANG_PASSWORD_TOO_LONG              = 55,
 	LANG_MOTD_CURRENT                   = 56,
-	// Room for more level 0              57-99 not used
+	LANG_USING_WORLD_DB                 = 57,
+	LANG_USING_SCRIPT_LIB               = 58,
+	// Room for more level 0              59-99 not used
 
     // level 1 chat
