mangosd->trinitycore & realmd->trinityrealm

--HG--
branch : trunk
This commit is contained in:
panaut0lordv
2009-03-20 22:17:39 +01:00
parent f3a543bef3
commit e409fb63e9
52 changed files with 442 additions and 5343 deletions
+5 -15
View File
@@ -82,19 +82,10 @@ bool ChatHandler::HandleAccountDeleteCommand(const char* args)
}
/// Commands not recommended call from chat, but support anyway
if(m_session)
{
uint32 targetSecurity = accmgr.GetSecurity(account_id);
/// can delete only for account with less security
/// This is also reject self apply in fact
if (targetSecurity >= m_session->GetSecurity())
{
SendSysMessage (LANG_YOURS_SECURITY_IS_LOW);
SetSentErrorMessage (true);
return false;
}
}
/// can delete only for account with less security
/// This is also reject self apply in fact
if(HasLowerSecurityAccount (NULL,account_id,true))
return false;
AccountOpResult result = accmgr.DeleteAccount(account_id);
switch(result)
@@ -318,7 +309,7 @@ void CliRunnable::run()
char commandbuf[256];
///- Display the list of available CLI functions then beep
sLog.outString();
sLog.outString("");
if(sConfig.GetBoolDefault("BeepAtStart", true))
printf("\a"); // \a = Alert
@@ -373,4 +364,3 @@ void CliRunnable::run()
///- End the database thread
WorldDatabase.ThreadEnd(); // free mySQL thread resources
}
+3 -4
View File
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2008-2009 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
@@ -33,4 +33,3 @@ class CliRunnable : public ZThread::Runnable
};
#endif
/// @}
+5 -15
View File
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
@@ -21,8 +21,6 @@
/// \addtogroup Trinityd Trinity Daemon
/// @{
/// \file
#include "SystemConfig.h"
#include "revision.h"
#include "Common.h"
#include "Database/DatabaseEnv.h"
@@ -31,18 +29,18 @@
#include "Master.h"
#ifndef _TRINITY_CORE_CONFIG
# define _TRINITY_CORE_CONFIG "trinitycore.conf"
# define _TRINITY_CORE_CONFIG "TrinityCore.conf"
#endif //_TRINITY_CORE_CONFIG
// Format is YYYYMMDDRR where RR is the change in the conf file
// for that day.
#ifndef _TRINITY_CORE_CONFVER
# define _TRINITY_CORE_CONFVER 2008022901
# define _TRINITY_CORE_CONFVER 2009010301
#endif //_TRINITY_CORE_CONFVER
#ifdef WIN32
#include "ServiceWin32.h"
char serviceName[] = "Trinityd";
char serviceName[] = "TrinityCore";
char serviceLongName[] = "Trinity core service";
char serviceDescription[] = "Massive Network Game Object Server";
/*
@@ -64,7 +62,6 @@ uint32 realmID; ///< Id of the realm
void usage(const char *prog)
{
sLog.outString("Usage: \n %s [<options>]\n"
" --version print version and exit\n\r"
" -c config_file use config_file as configuration file\n\r"
#ifdef WIN32
" Running as service functions:\n\r"
@@ -95,12 +92,6 @@ extern int main(int argc, char **argv)
cfg_file = argv[c];
}
if( strcmp(argv[c],"--version") == 0)
{
printf("%s\n", _FULLVERSION);
return 0;
}
#ifdef WIN32
////////////
//Services//
@@ -147,7 +138,7 @@ extern int main(int argc, char **argv)
return 1;
}
sLog.outString("Using configuration file %s.", cfg_file);
uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);
if (confVersion < _TRINITY_CORE_CONFVER)
{
@@ -172,4 +163,3 @@ extern int main(int argc, char **argv)
}
/// @}
+62
View File
@@ -0,0 +1,62 @@
# Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
#
# Copyright (C) 2008-2009 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
## Process this file with automake to produce Makefile.in
## CPP flags for includes, defines, etc.
AM_CPPFLAGS = $(TRINI_INCLUDES) -I$(top_builddir)/src/shared -I$(srcdir)/../../dep/include -I$(srcdir)/../framework -I$(srcdir)/../shared -I$(srcdir)/../game -I$(srcdir) -DSYSCONFDIR=\"$(sysconfdir)/\"
## Build world list daemon as standalone program
bin_PROGRAMS = trinity-worldd
trinity_worldd_SOURCES = \
CliRunnable.cpp \
CliRunnable.h \
Main.cpp \
Master.cpp \
Master.h \
RASocket.cpp \
RASocket.h \
WorldRunnable.cpp \
WorldRunnable.h
## Link world daemon against the shared library
trinity_worldd_LDADD = ../bindings/scripts/libtrinityscript.la ../game/libmangosgame.a ../shared/Database/libmangosdatabase.a ../shared/Config/libmangosconfig.a ../shared/Auth/libmangosauth.a ../shared/libmangosshared.a ../shared/vmap/libmangosvmaps.a ../framework/libmangosframework.a ../../dep/src/sockets/libmangossockets.a ../../dep/src/zthread/libZThread.la ../../dep/src/g3dlite/libg3dlite.a
trinity_worldd_LDFLAGS = -L../../dep/src/sockets -L../../dep/src/zthread -L../../dep/src/g3dlite -L../bindings/scripts/ -L$(libdir) $(TRINI_LIBS) -export-dynamic
## Additional files to include when running 'make dist'
# Include world daemon configuration
EXTRA_DIST = \
mangosd.conf.dist
## Additional files to install
sysconf_DATA = \
mangosd.conf.dist
install-data-hook:
@list='$(sysconf_DATA)'; for p in $$list; do \
dest=`echo $$p | sed -e s/.dist//`; \
if test -f $(DESTDIR)$(sysconfdir)/$$dest; then \
echo "$@ will not overwrite existing $(DESTDIR)$(sysconfdir)/$$dest"; \
else \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(sysconfdir)/$$dest"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(sysconfdir)/$$dest; \
fi; \
done
clean-local:
rm -f $(sysconf_DATA)
+98 -88
View File
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
@@ -118,72 +118,74 @@ public:
class RARunnable : public ZThread::Runnable
{
public:
uint32 numLoops, loopCounter;
uint32 numLoops, loopCounter;
RARunnable ()
{
uint32 socketSelecttime = sWorld.getConfig (CONFIG_SOCKET_SELECTTIME);
numLoops = (sConfig.GetIntDefault ("MaxPingTime", 30) * (MINUTE * 1000000 / socketSelecttime));
loopCounter = 0;
}
void
checkping ()
{
// ping if need
if ((++loopCounter) == numLoops)
{
RARunnable ()
{
uint32 socketSelecttime = sWorld.getConfig (CONFIG_SOCKET_SELECTTIME);
numLoops = (sConfig.GetIntDefault ("MaxPingTime", 30) * (MINUTE * 1000000 / socketSelecttime));
loopCounter = 0;
sLog.outDetail ("Ping MySQL to keep connection alive");
delete WorldDatabase.Query ("SELECT 1 FROM command LIMIT 1");
delete LoginDatabase.Query ("SELECT 1 FROM realmlist LIMIT 1");
delete CharacterDatabase.Query ("SELECT 1 FROM bugreport LIMIT 1");
}
}
}
void
run (void)
{
SocketHandler h;
void checkping ()
{
// ping if need
if ((++loopCounter) == numLoops)
{
loopCounter = 0;
sLog.outDetail ("Ping MySQL to keep connection alive");
delete WorldDatabase.Query ("SELECT 1 FROM command LIMIT 1");
delete LoginDatabase.Query ("SELECT 1 FROM realmlist LIMIT 1");
delete CharacterDatabase.Query ("SELECT 1 FROM bugreport LIMIT 1");
}
}
// Launch the RA listener socket
ListenSocket<RASocket> RAListenSocket (h);
bool usera = sConfig.GetBoolDefault ("Ra.Enable", false);
void run ()
{
SocketHandler h;
if (usera)
{
port_t raport = sConfig.GetIntDefault ("Ra.Port", 3443);
std::string stringip = sConfig.GetStringDefault ("Ra.IP", "0.0.0.0");
ipaddr_t raip;
if (!Utility::u2ip (stringip, raip))
sLog.outError ("Trinity RA can not bind to ip %s", stringip.c_str ());
else if (RAListenSocket.Bind (raip, raport))
sLog.outError ("Trinity RA can not bind to port %d on %s", raport, stringip.c_str ());
// Launch the RA listener socket
ListenSocket<RASocket> RAListenSocket (h);
bool usera = sConfig.GetBoolDefault ("Ra.Enable", false);
if (usera)
{
port_t raport = sConfig.GetIntDefault ("Ra.Port", 3443);
std::string stringip = sConfig.GetStringDefault ("Ra.IP", "0.0.0.0");
ipaddr_t raip;
if (!Utility::u2ip (stringip, raip))
sLog.outError ("MaNGOS RA can not bind to ip %s", stringip.c_str ());
else if (RAListenSocket.Bind (raip, raport))
sLog.outError ("MaNGOS RA can not bind to port %d on %s", raport, stringip.c_str ());
else
{
h.Add (&RAListenSocket);
sLog.outString ("Starting Remote access listner on port %d on %s", raport, stringip.c_str ());
}
}
// Socket Selet time is in microseconds , not miliseconds!!
uint32 socketSelecttime = sWorld.getConfig (CONFIG_SOCKET_SELECTTIME);
// if use ra spend time waiting for io, if not use ra ,just sleep
if (usera)
{
while (!World::IsStopped())
{
h.Select (0, socketSelecttime);
checkping ();
}
}
else
{
h.Add (&RAListenSocket);
sLog.outString ("Starting Remote access listner on port %d on %s", raport, stringip.c_str ());
}
}
// Socket Selet time is in microseconds , not miliseconds!!
uint32 socketSelecttime = sWorld.getConfig (CONFIG_SOCKET_SELECTTIME);
// if use ra spend time waiting for io, if not use ra ,just sleep
if (usera)
while (!World::IsStopped())
{
h.Select (0, socketSelecttime);
checkping ();
while (!World::IsStopped())
{
ZThread::Thread::sleep (static_cast<unsigned long> (socketSelecttime / 1000));
checkping ();
}
}
else
while (!World::IsStopped())
{
ZThread::Thread::sleep (static_cast<unsigned long> (socketSelecttime / 1000));
checkping ();
}
}
}
};
Master::Master()
@@ -200,15 +202,15 @@ int Master::Run()
sLog.outString( "%s (core-daemon)", _FULLVERSION );
sLog.outString( "<Ctrl-C> to stop.\n" );
sLog.outTitle( " ______ __");
sLog.outTitle( "/\\__ _\\ __ __/\\ \\__");
sLog.outTitle( "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\ ,_\\ __ __");
sLog.outTitle( " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
sLog.outTitle( " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
sLog.outTitle( " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
sLog.outTitle( " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
sLog.outTitle( " C O R E /\\___/");
sLog.outTitle( "http://TrinityCore.org \\/__/\n");
sLog.outString( " ______ __");
sLog.outString( "/\\__ _\\ __ __/\\ \\__");
sLog.outString( "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\ ,_\\ __ __");
sLog.outString( " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
sLog.outString( " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
sLog.outString( " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
sLog.outString( " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
sLog.outString( " C O R E /\\___/");
sLog.outString( "http://TrinityCore.org \\/__/\n");
/// worldd PID file creation
std::string pidfile = sConfig.GetStringDefault("PidFile", "");
@@ -280,7 +282,7 @@ int Master::Run()
sLog.outError("Can't set used processors (hex): %x",curAff);
}
}
sLog.outString();
sLog.outString("");
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
@@ -292,7 +294,7 @@ int Master::Run()
sLog.outString("TrinityCore process priority class set to HIGH");
else
sLog.outError("ERROR: Can't set Trinityd process priority class.");
sLog.outString();
sLog.outString("");
}
}
#endif
@@ -317,14 +319,14 @@ int Master::Run()
}
///- Launch the world listener socket
port_t wsport = sWorld.getConfig (CONFIG_PORT_WORLD);
std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
port_t wsport = sWorld.getConfig (CONFIG_PORT_WORLD);
std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1)
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1)
{
sLog.outError ("Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
sLog.outError ("Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
}
sWorldSocketMgr->Wait ();
@@ -401,14 +403,15 @@ int Master::Run()
/// Initialize connection to the databases
bool Master::_StartDB()
{
///- Get world database info from configuration file
std::string dbstring;
if(!sConfig.GetString("WorldDatabaseInfo", &dbstring))
///- Get world database info from configuration file
dbstring = sConfig.GetStringDefault("WorldDatabaseInfo", "");
if(dbstring.empty())
{
sLog.outError("Database not specified in configuration file");
return false;
}
sLog.outDetail("World Database: %s", dbstring.c_str());
///- Initialise the world database
if(!WorldDatabase.Initialize(dbstring.c_str()))
@@ -417,12 +420,13 @@ bool Master::_StartDB()
return false;
}
if(!sConfig.GetString("CharacterDatabaseInfo", &dbstring))
///- Get character database info from configuration file
dbstring = sConfig.GetStringDefault("CharacterDatabaseInfo", "");
if(dbstring.empty())
{
sLog.outError("Character Database not specified in configuration file");
return false;
}
sLog.outDetail("Character Database: %s", dbstring.c_str());
///- Initialise the Character database
if(!CharacterDatabase.Initialize(dbstring.c_str()))
@@ -432,14 +436,14 @@ bool Master::_StartDB()
}
///- Get login database info from configuration file
if(!sConfig.GetString("LoginDatabaseInfo", &dbstring))
dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", "");
if(dbstring.empty())
{
sLog.outError("Login database not specified in configuration file");
return false;
}
///- Initialise the login database
sLog.outDetail("Login Database: %s", dbstring.c_str() );
if(!LoginDatabase.Initialize(dbstring.c_str()))
{
sLog.outError("Cannot connect to login database %s",dbstring.c_str());
@@ -455,12 +459,17 @@ bool Master::_StartDB()
}
sLog.outString("Realm running as realm ID %d", realmID);
///- Initialize the DB logging system
if(sConfig.GetBoolDefault("EnableLogDB", false))
{
// everything successful - set var to enable DB logging once startup finished.
sLog.SetLogDBLater(true);
sLog.SetRealmID(realmID);
}
///- Clean the database before starting
clearOnlineAccounts();
///- Insert version info into DB
WorldDatabase.PExecute("UPDATE `version` SET `core_version` = '%s', `core_revision` = '%s'", _FULLVERSION, _REVISION);
sWorld.LoadDBVersion();
sLog.outString("Using %s", sWorld.GetDBVersion());
@@ -476,8 +485,10 @@ void Master::clearOnlineAccounts()
"UPDATE account SET online = 0 WHERE online > 0 "
"AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = '%d')",realmID);
CharacterDatabase.Execute("UPDATE characters SET online = 0 WHERE online<>0");
// Battleground instance ids reset at server restart
CharacterDatabase.Execute("UPDATE characters SET bgid = 0 WHERE bgid<>0");
}
/// Handle termination signals
@@ -518,4 +529,3 @@ void Master::_UnhookSignals()
signal(SIGBREAK, 0);
#endif
}
+3 -4
View File
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2008-2009 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
@@ -50,4 +50,3 @@ class Master
#define sMaster Trinity::Singleton<Master>::Instance()
#endif
/// @}
+8 -9
View File
@@ -69,7 +69,7 @@ RASocket::~RASocket()
///- Delete buffer and decrease active admins count
delete [] buff;
sLog.outRALog("Connection was closed.\n");
sLog.outRemote("Connection was closed.\n");
if(stage==OK)
iUsers--;
@@ -79,7 +79,7 @@ RASocket::~RASocket()
void RASocket::OnAccept()
{
std::string ss=GetRemoteAddress();
sLog.outRALog("Incoming connection from %s.\n",ss.c_str());
sLog.outRemote("Incoming connection from %s.\n",ss.c_str());
///- If there is already an active admin, drop the connection
if(iUsers)
dropclient
@@ -97,7 +97,7 @@ void RASocket::OnRead()
unsigned int sz=ibuf.GetLength();
if(iInputLength+sz>=RA_BUFF_SIZE)
{
sLog.outRALog("Input buffer overflow, possible DOS attack.\n");
sLog.outRemote("Input buffer overflow, possible DOS attack.\n");
SetCloseAndDelete();
return;
}
@@ -160,7 +160,7 @@ void RASocket::OnRead()
if(!result)
{
Sendf("-No such user.\r\n");
sLog.outRALog("User %s does not exist.\n",szLogin.c_str());
sLog.outRemote("User %s does not exist.\n",szLogin.c_str());
if(bSecure)SetCloseAndDelete();
}
else
@@ -173,7 +173,7 @@ void RASocket::OnRead()
if(fields[0].GetUInt32()<iMinLevel)
{
Sendf("-Not enough privileges.\r\n");
sLog.outRALog("User %s has no privilege.\n",szLogin.c_str());
sLog.outRemote("User %s has no privilege.\n",szLogin.c_str());
if(bSecure)SetCloseAndDelete();
} else
{
@@ -208,14 +208,14 @@ void RASocket::OnRead()
++iUsers;
Sendf("+Logged in.\r\n");
sLog.outRALog("User %s has logged in.\n",szLogin.c_str());
sLog.outRemote("User %s has logged in.\n",szLogin.c_str());
Sendf("TC>");
}
else
{
///- Else deny access
Sendf("-Wrong pass.\r\n");
sLog.outRALog("User %s has failed to log in.\n",szLogin.c_str());
sLog.outRemote("User %s has failed to log in.\n",szLogin.c_str());
if(bSecure)SetCloseAndDelete();
}
}
@@ -224,7 +224,7 @@ void RASocket::OnRead()
case OK:
if(strlen(buff))
{
sLog.outRALog("Got '%s' cmd.\n",buff);
sLog.outRemote("Got '%s' cmd.\n",buff);
sWorld.QueueCliCommand(&RASocket::zprint , buff);
}
else
@@ -257,4 +257,3 @@ void RASocket::zprint( const char * szText )
#endif
}
+2 -3
View File
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2008-2009 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
@@ -65,4 +65,3 @@ class RASocket: public TcpSocket
};
#endif
/// @}
Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

+21 -4
View File
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
@@ -29,13 +29,19 @@
#include "Timer.h"
#include "ObjectAccessor.h"
#include "MapManager.h"
#include "BattleGroundMgr.h"
#include "Database/DatabaseEnv.h"
#if (defined(SHORT_SLEEP) || defined(WIN32))
#ifdef WIN32
#define WORLD_SLEEP_CONST 50
#else
#define WORLD_SLEEP_CONST 100 //Is this still needed?? [On linux some time ago not working 50ms]
#define WORLD_SLEEP_CONST 100 //Is this still needed?? [On linux some time ago not working 50ms]
#endif
#ifdef WIN32
#include "ServiceWin32.h"
extern int m_ServiceStatus;
#endif
/// Heartbeat for the World
@@ -43,6 +49,8 @@ void WorldRunnable::run()
{
///- Init new SQL thread for the world database
WorldDatabase.ThreadStart(); // let thread do safe mySQL requests (one connection call enough)
CharacterDatabase.ThreadStart();
LoginDatabase.ThreadStart();
sWorld.InitResultQueue();
uint32 realCurrTime = 0;
@@ -72,16 +80,25 @@ void WorldRunnable::run()
}
else
prevSleepTime = 0;
#ifdef WIN32
if (m_ServiceStatus == 0) World::StopNow(SHUTDOWN_EXIT_CODE);
while (m_ServiceStatus == 2) Sleep(1000);
#endif
}
sWorld.KickAll(); // save and kick all players
sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call
// unload battleground templates before different singletons destroyed
sBattleGroundMgr.DeleteAllBattleGrounds();
sWorldSocketMgr->StopNetwork();
MapManager::Instance().UnloadAll(); // unload all grids (including locked in memory)
///- End the database thread
WorldDatabase.ThreadEnd(); // free mySQL thread resources
CharacterDatabase.ThreadStart();
LoginDatabase.ThreadEnd();
}
+3 -4
View File
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
* Copyright (C) 2008-2009 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
@@ -33,4 +33,3 @@ class WorldRunnable : public ZThread::Runnable
};
#endif
/// @}
+85
View File
@@ -0,0 +1,85 @@
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* 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
*/
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APPICON ICON "TrinityCore.ico"
/////////////////////////////////////////////////////////////////////////////
// Neutre (Par défaut système) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,4,6743,685
PRODUCTVERSION 0,4,6743,685
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x0L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080004b0"
BEGIN
VALUE "FileDescription", "TrinityCore"
VALUE "FileVersion", "0, 4, 6743, 685"
VALUE "InternalName", "TrinityCore"
VALUE "LegalCopyright", "Copyright (C) 2008"
VALUE "OriginalFilename", "TrinityCore.exe"
VALUE "ProductName", "TrinityCore"
VALUE "ProductVersion", "0, 4, 6743, 685"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x800, 1200
END
END
#endif
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
# Massive Network Game Object Server
# Monitoring Script
pid=`ps ax | awk '($5 ~ /mangos-worldd/) { print $1 }'`
cpu=`top -b -n 1 -p $pid | awk '($12 ~ /mangos-worldd/) { print $9 }'`
#echo $pid
#echo $cpu
intcpu=${cpu%.*}
#echo $intcpu
if [ "$intcpu" -gt "95" ]
then
kill -9 $pid
echo "Killed MaNGOS for exceeding it's cpu limit."
echo `date` ", Killed MaNGOS for $intcpu% CPU Usage." >> serverlog
else
echo "MaNGOS Passes the cpu test."
fi
+1 -2
View File
@@ -4,7 +4,7 @@
//
// Next default values for new objects
//
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
@@ -13,4 +13,3 @@
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# Trinity Server
# autorestart Script
while :
do
echo "TrinityCore daemon restarted"
echo `date` >> crash.log &
./mangosd | tail -n 20 >> crash.log
echo " " >> crash.log &
pid=`ps ax | awk '($5 ~ /trinitycore/) { print $1 }'`
wait $pid
echo `date` ", TrinityCore daemon crashed and restarted." >> serverlog
done
+232 -99
View File
@@ -1,7 +1,7 @@
##########################################
# Trinity Core worldd configuration file #
##########################################
ConfVersion=2009010301
ConfVersion=2008080101
###################################################################################################################
# CONNECTIONS AND DIRECTORIES
@@ -25,11 +25,15 @@ ConfVersion=2009010301
# WorldDatabaseInfo
# CharacterDatabaseInfo
# Database connection settings for the world server.
# Default: hostname;port;username;password;database
# .;somenumber;username;password;database - use named pipes at Windows
# Named pipes: mySQL required adding "enable-named-pipe" to [mysqld] section my.ini
# .;/path/to/unix_socket;username;password;database - use Unix sockets at Unix/Linux
# Unix sockets: experimental, not tested
# Default:
# ---MYSQL---
# hostname;port;username;password;database
# .;somenumber;username;password;database - use named pipes at Windows
# Named pipes: mySQL required adding "enable-named-pipe" to [mysqld] section my.ini
# .;/path/to/unix_socket;username;password;database - use Unix sockets at Unix/Linux
# ---PGSQL---
# hostname;port;username;password;database
# .;/path/to/unix_socket/DIRECTORY or . for default path;username;password;database - use Unix sockets at Unix/Linux
#
# MaxPingTime
# Settings for maximum database-ping interval (minutes between pings)
@@ -109,7 +113,7 @@ EAIErrorLevel = 2
#
# SocketSelectTime
# Socket select time (in milliseconds)
# Default: 10000
# Default: 10000 (10 secs)
#
# GridCleanUpDelay
# Grid clean up delay (in milliseconds)
@@ -127,15 +131,11 @@ EAIErrorLevel = 2
# Player save interval (in milliseconds)
# Default: 900000 (15 min)
#
# DisconnectToleranceInterval
# Tolerance for disconnected players before putting in the queue. (in seconds)
# Default: 0 (disabled)
#
# vmap.enableLOS
# vmap.enableHeight
# Enable/Disable VMmap support for line of sight and height calculation
# Default: 1 (true)
# 0 (false)
# Default: 0 (disable)
# 1 (enable)
#
# vmap.ignoreMapIds
# Map id that will be ignored by VMaps
@@ -188,7 +188,6 @@ GridCleanUpDelay = 300000
MapUpdateInterval = 100
ChangeWeatherInterval = 600000
PlayerSaveInterval = 900000
DisconnectToleranceInterval = 0
vmap.enableLOS = 0
vmap.enableHeight = 0
vmap.ignoreMapIds = "369"
@@ -216,14 +215,9 @@ AddonChannel = 1
#
# LogLevel
# Server console level of logging
# 0 = Minimum; 1 = Basic&Error; 2 = Detail; 3 = Full/Debug
# 0 = Minimum; 1 = Basic; 2 = Detail; 3 = Full/Debug
# Default: 3
#
# LogTime
# Include time in server console output [hh:mm:ss]
# Default: 0 (no time)
# 1 (print time)
#
# LogFile
# Logfile name
# Default: "Server.log"
@@ -236,11 +230,12 @@ AddonChannel = 1
#
# LogFileLevel
# Server file level of logging
# 0 = Minimum; 1 = Error; 2 = Detail; 3 = Full/Debug
# 0 = Minimum; 1 = Basic; 2 = Detail; 3 = Full/Debug
# Default: 0
#
# LogFilter_TransportMoves
# LogFilter_AchievementUpdates
# LogFilter_CreatureMoves
# LogFilter_TransportMoves
# LogFilter_VisibilityChanges
# Log filters
# Default: 1 - not include with any log level
@@ -294,23 +289,53 @@ AddonChannel = 1
# "" - Empty name for disable
#
# LogColors
# Color for messages (format "normal_color details_color debug_color error_color")
# Color for messages (format "normal error basic detail debug")
# Colors: 0 - BLACK, 1 - RED, 2 - GREEN, 3 - BROWN, 4 - BLUE, 5 - MAGENTA, 6 - CYAN, 7 - GREY,
# 8 - YELLOW, 9 - LRED, 10 - LGREEN, 11 - LBLUE, 12 - LMAGENTA, 13 - LCYAN, 14 - WHITE
# Default: "" - none colors
# Example: "13 7 11 9"
# Example: "13 7 11 9 5"
#
# EnableLogDB
# Enable/disable logging to database (LogDatabaseInfo).
# Default: 0 - disabled
# 1 - enabled
#
# DBLogLevel
# Log level of DB logging.
# 0 = Minimum; 1 = Basic; 2 = Detail; 3 = Full/Debug
# Default: 3
#
# LogDB.Char
# Enable/disable logging character outputs to DB.
# Default: 0 - off
# 1 - on
#
# LogDB.GM
# Enable/disable logging GM commands to DB.
# Default: 0 - off
# 1 - on
#
# LogDB.RA
# Enable/disable logging remote access events to DB.
# Default: 0 - off
# 1 - on
#
# LogDB.World
# Enable/disable logging world packets to DB.
# Default: 0 - off
# 1 - on (very heavy)
#
###################################################################################################################
LogSQL = 1
PidFile = ""
LogLevel = 1
LogTime = 0
LogFile = "Server.log"
LogTimestamp = 0
LogFileLevel = 0
LogFilter_TransportMoves = 1
LogFilter_AchievementUpdates = 1
LogFilter_CreatureMoves = 1
LogFilter_TransportMoves = 1
LogFilter_VisibilityChanges = 1
WorldLogFile = ""
DBErrorLogFile = "db_errors.log"
@@ -322,6 +347,12 @@ GmLogTimestamp = 0
GmLogPerAccount = 0
RaLogFile = "ra_commands.log"
LogColors = ""
EnableLogDB = 0
DBLogLevel = 1
LogDB.Char = 0
LogDB.GM = 0
LogDB.RA = 0
LogDB.World = 0
###################################################################################################################
# SERVER SETTINGS
@@ -367,9 +398,9 @@ LogColors = ""
#
# Expansion
# Allow server use content from expansion
# 2 - check expansion 2 maps existence, and if client support expansion 2 and account have
# Default: 2 - check expansion 2 maps existence, and if client support expansion 2 and account have
# expansion 2 setting then allow visit expansion 2 maps, allow create new class character)
# Default: 1 - check expansion 1 maps existence, and if client support expansion 1 and account have
# 1 - check expansion 1 maps existence, and if client support expansion 1 and account have
# expansion 1 setting then allow visit expansion 1 maps, allow create new races character)
# 0 - not check expansion maps existence, not allow wisit its, not allow create new race or new class
# characters, ignore account expansion setting)
@@ -433,6 +464,18 @@ LogColors = ""
# Default: 10 (client limitation)
# The number must be between 1 and 10
#
# HeroicCharactersPerRealm
# Limit numbers of heroic class characters for account at realm
# Default: 1
# The number must be between 0 (not allowed) and 10
#
# MinLevelForHeroicCharacterCreating
# Limit creating heroic characters only for account with another character of specific level (ignored for GM accounts)
# 0 - not require any existed chaarcter
# 1 - require at least any character existed
# Default: 55 - default requirement
#
#
# SkipCinematics
# Disable in-game script movie at first character's login(allows to prevent buggy intro in case of custom start location coordinates)
# Default: 0 - show intro for each new characrer
@@ -440,14 +483,18 @@ LogColors = ""
# 2 - disable intro show in all cases
#
# MaxPlayerLevel
# Max level that can be reached by player for experience (in range from 1 to 255).
# Max level that can be reached by player for experience (in range from 1 to 100).
# Change not recommended
# Default: 70
# Default: 80
#
# StartPlayerLevel
# Staring level that have character at creating (in range 1 to MaxPlayerLevel)
# Default: 1
#
# StartHeroicPlayerLevel
# Staring level that have character of heroic class at creating (in range 1 to MaxPlayerLevel)
# Default: 55
#
# StartPlayerMoney
# Amount of money that new players will start with.
# If you want to start with silver, use for example 100 (100 copper = 1 silver)
@@ -484,29 +531,14 @@ LogColors = ""
#
# AlwaysMaxSkillForLevel
# Players will automatically gain max level dependent (weapon/defense) skill when logging in, leveling up etc.
# Default: 0 (true)
# 1 (false)
# Default: 0 (false)
# 1 (true)
#
# ActivateWeather
# Activate weather system
# Default: 1 (true)
# 0 (false)
#
# Battleground.CastDeserter
# Cast or not Deserter spell at player who leave battleground in progress
# Default: 1 (true)
# 0 (false)
#
# Battleground.QueueAnnouncer.Enable
# Enable queue announcer posting to chat
# Default: 1 (true)
# 0 (false)
#
# Battleground.QueueAnnouncer.PlayerOnly
# Enable queue announcer posting to chat
# Default: 0 (false)
# 1 (true)
#
# CastUnstuck
# Allow cast or not Unstuck spell at .start or client Help option use
# Default: 1 (true)
@@ -528,7 +560,7 @@ LogColors = ""
#
# Instance.UnloadDelay
# Unload the instance map from memory after some time if no players are inside.
# Default: 1800000 (miliseconds, i.e 30 minutes)
# Default: 1800000 (miliseconds 30 minutes)
# 0 (instance maps are kept in memory until they are reset)
#
# Quests.LowLevelHideDiff
@@ -561,10 +593,20 @@ LogColors = ""
# Default: 3600 sec (1 hour)
#
# SkillChance.Prospecting
# For prospecting skillup not possible by default, but can be allowed as custom setting
# For prospecting skillup impossible by default, but can be allowed as custom setting
# Default: 0 - no skilups
# 1 - skilups possible
#
# SkillChance.Milling
# For milling skillup impossible by default, but can be allowed as custom setting
# Default: 0 - no skilups
# 1 - skilups possible
#
# OffhandCheckAtTalentsReset
# Talent reset can change offhand weapon restrictions for equip slots.
# Default: 0 - recheck offhand slot weapon only at zone update
# 1 - recheck offhand slot weapon at talent reset also
#
# Event.Announce
# Default: 0 (false)
# 1 (true)
@@ -586,7 +628,7 @@ LogColors = ""
GameType = 1
RealmZone = 1
Expansion = 1
Expansion = 2
DBC.Locale = 255
DeclinedNames = 0
StrictPlayerNames = 0
@@ -596,9 +638,12 @@ MaxWhoListReturns = 49
CharactersCreatingDisabled = 0
CharactersPerAccount = 50
CharactersPerRealm = 10
HeroicCharactersPerRealm = 1
MinLevelForHeroicCharacterCreating = 55
SkipCinematics = 0
MaxPlayerLevel = 70
MaxPlayerLevel = 80
StartPlayerLevel = 1
StartHeroicPlayerLevel = 55
StartPlayerMoney = 0
MaxHonorPoints = 75000
StartHonorPoints = 0
@@ -609,9 +654,6 @@ DisableWaterBreath = 4
AllFlightPaths = 0
AlwaysMaxSkillForLevel = 0
ActivateWeather = 1
Battleground.CastDeserter = 1
Battleground.QueueAnnouncer.Enable = 1
Battleground.QueueAnnouncer.PlayerOnly = 0
CastUnstuck = 1
Instance.IgnoreLevel = 0
Instance.IgnoreRaid = 0
@@ -624,6 +666,8 @@ MinPetitionSigns = 9
MaxGroupXPDistance = 74
MailDeliveryDelay = 3600
SkillChance.Prospecting = 0
SkillChance.Milling = 0
OffhandCheckAtTalentsReset = 0
Event.Announce = 0
BeepAtStart = 1
Motd = "Welcome to a Trinity Core server."
@@ -841,6 +885,18 @@ Channel.SilentlyGMJoin = 0
# 0 (disable)
# 1 (enable)
#
# GM.Visible
# GM visibility at login
# Default: 2 (last save state)
# 0 (invisible)
# 1 (visible)
#
# GM.AcceptTickets
# Is GM accepting tickets from player by default or not.
# Default: 2 (last save state)
# 0 (disable)
# 1 (enable)
#
# GM.Chat
# GM chat mode at login
# Default: 2 (last save state)
@@ -854,7 +910,7 @@ Channel.SilentlyGMJoin = 0
# 1 (enable)
#
# GM.InGMList
# Is GM showed in GM list (if visible) in non-GM state (.gmoff)
# Is GM showed in GM list (if visible) in non-GM state (.gm off)
# Default: 0 (false)
# 1 (true)
#
@@ -869,18 +925,32 @@ Channel.SilentlyGMJoin = 0
# 0 (not include)
#
# GM.StartLevel
# GM starting level (1-255)
# GM starting level (1-100)
# Default: 1
#
# GM.LowerSecurity
# Disallow a lower security member to interact with a higher one using commands
# Default: 0 (disable)
# 1 (enable)
#
# GM.AllowAchievementGain
# If enabled it allows gaining achievements for GM characters
# Default: 1 (enable)
# 0 (disable)
#
###################################################################################################################
GM.LoginState = 2
GM.Chat = 2
GM.WhisperingTo = 2
GM.InGMList = 0
GM.InWhoList = 0
GM.LogTrade = 1
GM.StartLevel = 70
GM.LoginState = 2
GM.Visible = 2
GM.AcceptTickets = 2
GM.Chat = 2
GM.WhisperingTo = 2
GM.InGMList = 0
GM.InWhoList = 0
GM.LogTrade = 1
GM.StartLevel = 80
GM.LowerSecurity = 0
GM.AllowAchievementGain = 1
###################################################################################################################
# VISIBILITY AND RADIUSES
@@ -894,9 +964,9 @@ GM.StartLevel = 70
# Visibility.Distance.Creature
# Visibility.Distance.Player
# Visibility distance for different in game object
# Max limited by active player zone: ~ 333
# Max limited by active player zone: ~ 166
# Min limit dependent from objects
# Default: 132 (cell size)
# Default: 66 (cell size)
# Min limit is max aggro radius (45) * Rate.Creature.Aggro
#
# Visibility.Distance.Object
@@ -922,10 +992,10 @@ GM.StartLevel = 70
###################################################################################################################
Visibility.GroupMode = 0
Visibility.Distance.Creature = 132
Visibility.Distance.Player = 132
Visibility.Distance.Object = 132
Visibility.Distance.InFlight = 132
Visibility.Distance.Creature = 66
Visibility.Distance.Player = 66
Visibility.Distance.Object = 66
Visibility.Distance.InFlight = 66
Visibility.Distance.Grey.Unit = 1
Visibility.Distance.Grey.Object = 10
@@ -936,6 +1006,8 @@ Visibility.Distance.Grey.Object = 10
# Rate.Mana
# Rate.Rage.Income
# Rate.Rage.Loss
# Rate.RunicPower.Income
# Rate.RunicPower.Loss
# Rate.Focus
# Rate.Loyalty
# Health and power regeneration and rage income from damage.
@@ -1052,12 +1124,20 @@ Visibility.Distance.Grey.Object = 10
# Default: 1 (enabled)
# 0 (disabled)
#
# Death.Bones.World
# Death.Bones.BattlegroundOrArena
# Enable/disable creating bones instead corpse at resurrection (in normal zones/instacnes, or battleground/arenas)
# Default: 1 (enabled)
# 0 (disabled)
#
###################################################################################################################
Rate.Health = 1
Rate.Mana = 1
Rate.Rage.Income = 1
Rate.Rage.Loss = 1
Rate.RunicPower.Income = 1
Rate.RunicPower.Loss = 1
Rate.Focus = 1
Rate.Loyalty = 1
Rate.Skill.Discovery = 1
@@ -1104,51 +1184,104 @@ DurabilityLossChance.Block = 0.05
Death.SicknessLevel = 11
Death.CorpseReclaimDelay.PvP = 1
Death.CorpseReclaimDelay.PvE = 0
Death.Bones.World = 1
Death.Bones.BattlegroundOrArena = 1
###################################################################################################################
# BATTLEGROUND CONFIG
#
# Rated arena matches config
# Battleground.CastDeserter
# Cast Deserter spell at player who leave battleground in progress
# Default: 1 (enable)
# 0 (disable)
#
# MaxRatingDifference: the maximum rating difference between two groups in rated matches
# Default: 0 (disable, rating difference is discarded)
# Battleground.QueueAnnouncer.Enable
# Enable queue announcer posting to chat
# Default: 0 (disable)
# 1 (enable)
#
# RatingDiscardTimer: after the specified milliseconds has passed,
# rating information will be discarded when selecting teams for matches
# also initiates an update by this timer
# Default: 60000
# Battleground.QueueAnnouncer.PlayerOnly
# Enable queue announcer posting to chat
# Default: 0 (disable)
# 1 (enable)
#
# AutoDistributePoints: set if arena points should be distributed automatically, or by GM command
# Default: 0 (disable) (recommended): use gm command or sql query to distribute the points
# 1 (enable): arena points are distributed automatically
# Battleground.InvitationType
# Set Battleground invitation type
# Default: 0 (normal - invite as much players to bg as possible, don't bother with ballance)
# 1 (Experimental - don't allow to invite much more players of one faction)
#
# AutoDistributeInterval: how often should the distribution take place
# if automatic distribution is enabled
# in days
# Default: 7 (weekly)
# Battleground.PrematureFinishTimer
# The time to end the bg if there are less than MinPlayersPerTeam on one side in milliseconds
# Default: 300000 (5 minutes)
# 0 - disable (not recommended)
#
# BattleGround.PremadeGroupWaitForMatch
# The time in which premade group of 1 faction waits in BG Queue for premade group of other faction
# Default: 1800000 (30 minutes)
# 0 - disable (not recommended)
#
###################################################################################################################
Arena.MaxRatingDifference = 0
Arena.RatingDiscardTimer = 60000
Battleground.CastDeserter = 1
Battleground.QueueAnnouncer.Enable = 0
Battleground.QueueAnnouncer.PlayerOnly = 0
Battleground.InvitationType = 0
BattleGround.PrematureFinishTimer = 300000
BattleGround.PremadeGroupWaitForMatch = 1800000
###################################################################################################################
# ARENA CONFIG
#
# Arena.MaxRatingDifference
# The maximum rating difference between two groups in rated matches
# Default: 150 (enable, recommended)
# 0 (disable, rating difference is discarded)
#
# Arena.RatingDiscardTimer
# After the specified milliseconds has passed,
# rating information will be discarded when selecting teams for matches
# also initiates an update by this timer
# Default: 600000 (10 minutes, recommended)
# 0 (disable)
#
# Arena.AutoDistributePoints
# Set if arena points should be distributed automatically, or by GM command
# Default: 0 (disable) (recommended): use gm command or sql query to distribute the points
# 1 (enable) arena points are distributed automatically
#
# Arena.AutoDistributeInterval
# How often should the distribution take place
# If automatic distribution is enabled in days
# Default: 7 (weekly)
#
# Arena.QueueAnnouncer.Enable
# Enable bg queue announcer posting to chat
# Default: 0 (disable)
# 1 (enable)
#
# Arena.ArenaSeason.ID
# Current area season id show in client
# Default: 1
#
# Arena.ArenaSeason.InProgress
# Current area season state
# Default: 1 (active)
# 0 (finished)
#
###################################################################################################################
Arena.MaxRatingDifference = 150
Arena.RatingDiscardTimer = 600000
Arena.AutoDistributePoints = 0
Arena.AutoDistributeInterval = 7
###################################################################################################################
#
# Battleground config
#
# PrematureFinishTimer: the time to end the bg if there are less than minplayersperteam on one side
# in milliseconds
# Default: 300000
# 0 - disable
#
###################################################################################################################
BattleGround.PrematureFinishTimer = 300000
Arena.QueueAnnouncer.Enable = 0
Arena.ArenaSeason.ID = 1
Arena.ArenaSeason.InProgress = 1
###################################################################################################################
#
# NETWORK CONFIG
#
# Network.Threads