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

View File

@@ -1,6 +1,6 @@
add_subdirectory(framework)
add_subdirectory(shared)
add_subdirectory(realmd)
add_subdirectory(game)
add_subdirectory(bindings)
add_subdirectory(mangosd)
add_subdirectory(framework)
add_subdirectory(game)
add_subdirectory(shared)
add_subdirectory(trinitycore)
add_subdirectory(trinityrealm)

View File

@@ -1,53 +0,0 @@
########### next target ###############
SET(trinity-core_SRCS
CliRunnable.cpp
CliRunnable.h
Main.cpp
Master.cpp
Master.h
RASocket.cpp
RASocket.h
WorldRunnable.cpp
WorldRunnable.h
)
add_executable(trinity-core ${trinity-core_SRCS})
add_definitions(
-D_TRINITY_CORE_CONFIG='"${CONF_DIR}/trinitycore.conf"'
)
IF (DO_MYSQL)
SET_TARGET_PROPERTIES(trinity-core PROPERTIES LINK_FLAGS "-pthread")
ENDIF(DO_MYSQL)
target_link_libraries(
trinity-core
game
shared
zlib
trinityframework
trinitysockets
trinitydatabase
trinityauth
trinityconfig
vmaps
ZThread
g3dlite
${SCRIPT_LIB}
${MYSQL_LIBRARIES}
${POSTGRE_LIBS}
${SSLLIB}
${ACE_LIBRARY}
${ZLIB}
)
install(TARGETS trinity-core DESTINATION bin)
########### install files ###############
install(FILES mangosd.conf.dist.in DESTINATION etc)

View File

@@ -1,366 +0,0 @@
/*
* 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
*/
/// \addtogroup Trinityd
/// @{
/// \file
#include "Common.h"
#include "Language.h"
#include "Log.h"
#include "World.h"
#include "ScriptCalls.h"
#include "ObjectMgr.h"
#include "WorldSession.h"
#include "Config/ConfigEnv.h"
#include "Util.h"
#include "AccountMgr.h"
#include "CliRunnable.h"
#include "MapManager.h"
#include "Player.h"
#include "Chat.h"
void utf8print(const char* str)
{
#if PLATFORM == PLATFORM_WINDOWS
wchar_t wtemp_buf[6000];
size_t wtemp_len = 6000-1;
if(!Utf8toWStr(str,strlen(str),wtemp_buf,wtemp_len))
return;
char temp_buf[6000];
CharToOemBuffW(&wtemp_buf[0],&temp_buf[0],wtemp_len+1);
printf(temp_buf);
#else
printf(str);
#endif
}
/// Delete a user account and all associated characters in this realm
/// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm, delete account chars in realm then delete account
bool ChatHandler::HandleAccountDeleteCommand(const char* args)
{
if(!*args)
return false;
///- Get the account name from the command line
char *account_name_str=strtok ((char*)args," ");
if (!account_name_str)
return false;
std::string account_name = account_name_str;
if(!AccountMgr::normilizeString(account_name))
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
return false;
}
uint32 account_id = accmgr.GetId(account_name);
if(!account_id)
{
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
return false;
}
/// Commands not recommended call from chat, but support anyway
/// 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)
{
case AOR_OK:
PSendSysMessage(LANG_ACCOUNT_DELETED,account_name.c_str());
break;
case AOR_NAME_NOT_EXIST:
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());
SetSentErrorMessage(true);
return false;
case AOR_DB_INTERNAL_ERROR:
PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR,account_name.c_str());
SetSentErrorMessage(true);
return false;
default:
PSendSysMessage(LANG_ACCOUNT_NOT_DELETED,account_name.c_str());
SetSentErrorMessage(true);
return false;
}
return true;
}
bool ChatHandler::HandleCharacterDeleteCommand(const char* args)
{
if(!*args)
return false;
char *character_name_str = strtok((char*)args," ");
if(!character_name_str)
return false;
std::string character_name = character_name_str;
if(!normalizePlayerName(character_name))
return false;
uint64 character_guid;
uint32 account_id;
Player *player = objmgr.GetPlayer(character_name.c_str());
if(player)
{
character_guid = player->GetGUID();
account_id = player->GetSession()->GetAccountId();
player->GetSession()->KickPlayer();
}
else
{
character_guid = objmgr.GetPlayerGUIDByName(character_name);
if(!character_guid)
{
PSendSysMessage(LANG_NO_PLAYER,character_name.c_str());
SetSentErrorMessage(true);
return false;
}
account_id = objmgr.GetPlayerAccountIdByGUID(character_guid);
}
std::string account_name;
accmgr.GetName (account_id,account_name);
Player::DeleteFromDB(character_guid, account_id, true);
PSendSysMessage(LANG_CHARACTER_DELETED,character_name.c_str(),GUID_LOPART(character_guid),account_name.c_str(), account_id);
return true;
}
/// Exit the realm
bool ChatHandler::HandleServerExitCommand(const char* args)
{
SendSysMessage(LANG_COMMAND_EXIT);
World::StopNow(SHUTDOWN_EXIT_CODE);
return true;
}
/// Display info on users currently in the realm
bool ChatHandler::HandleAccountOnlineListCommand(const char* args)
{
///- Get the list of accounts ID logged to the realm
QueryResult *resultDB = CharacterDatabase.Query("SELECT name,account FROM characters WHERE online > 0");
if (!resultDB)
return true;
///- Display the list of account/characters online
SendSysMessage("=====================================================================");
SendSysMessage(LANG_ACCOUNT_LIST_HEADER);
SendSysMessage("=====================================================================");
///- Circle through accounts
do
{
Field *fieldsDB = resultDB->Fetch();
std::string name = fieldsDB[0].GetCppString();
uint32 account = fieldsDB[1].GetUInt32();
///- Get the username, last IP and GM level of each account
// No SQL injection. account is uint32.
// 0 1 2 3
QueryResult *resultLogin = LoginDatabase.PQuery("SELECT username, last_ip, gmlevel, expansion FROM account WHERE id = '%u'",account);
if(resultLogin)
{
Field *fieldsLogin = resultLogin->Fetch();
PSendSysMessage("|%15s| %20s | %15s |%4d|%5d|",
fieldsLogin[0].GetString(),name.c_str(),fieldsLogin[1].GetString(),fieldsLogin[2].GetUInt32(),fieldsLogin[3].GetUInt32());
delete resultLogin;
}
else
PSendSysMessage(LANG_ACCOUNT_LIST_ERROR,name.c_str());
}while(resultDB->NextRow());
delete resultDB;
SendSysMessage("=====================================================================");
return true;
}
/// Create an account
bool ChatHandler::HandleAccountCreateCommand(const char* args)
{
if(!*args)
return false;
///- %Parse the command line arguments
char *szAcc = strtok((char*)args, " ");
char *szPassword = strtok(NULL, " ");
if(!szAcc || !szPassword)
return false;
// normilized in accmgr.CreateAccount
std::string account_name = szAcc;
std::string password = szPassword;
AccountOpResult result = accmgr.CreateAccount(account_name, password);
switch(result)
{
case AOR_OK:
PSendSysMessage(LANG_ACCOUNT_CREATED,account_name.c_str());
break;
case AOR_NAME_TOO_LONG:
SendSysMessage(LANG_ACCOUNT_TOO_LONG);
SetSentErrorMessage(true);
return false;
case AOR_NAME_ALREDY_EXIST:
SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST);
SetSentErrorMessage(true);
return false;
case AOR_DB_INTERNAL_ERROR:
PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR,account_name.c_str());
SetSentErrorMessage(true);
return false;
default:
PSendSysMessage(LANG_ACCOUNT_NOT_CREATED,account_name.c_str());
SetSentErrorMessage(true);
return false;
}
return true;
}
/// Set the level of logging
bool ChatHandler::HandleServerSetLogLevelCommand(const char *args)
{
if(!*args)
return false;
char *NewLevel = strtok((char*)args, " ");
if (!NewLevel)
return false;
sLog.SetLogLevel(NewLevel);
return true;
}
/// set diff time record interval
bool ChatHandler::HandleServerSetDiffTimeCommand(const char *args)
{
if(!*args)
return false;
char *NewTimeStr = strtok((char*)args, " ");
if(!NewTimeStr)
return false;
int32 NewTime =atoi(NewTimeStr);
if(NewTime < 0)
return false;
sWorld.SetRecordDiffInterval(NewTime);
printf( "Record diff every %u ms\n", NewTime);
return true;
}
/// @}
#ifdef linux
// Non-blocking keypress detector, when return pressed, return 1, else always return 0
int kb_hit_return()
{
struct timeval tv;
fd_set fds;
tv.tv_sec = 0;
tv.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(STDIN_FILENO, &fds);
select(STDIN_FILENO+1, &fds, NULL, NULL, &tv);
return FD_ISSET(STDIN_FILENO, &fds);
}
#endif
/// %Thread start
void CliRunnable::run()
{
///- Init new SQL thread for the world database (one connection call enough)
WorldDatabase.ThreadStart(); // let thread do safe mySQL requests
char commandbuf[256];
///- Display the list of available CLI functions then beep
sLog.outString("");
if(sConfig.GetBoolDefault("BeepAtStart", true))
printf("\a"); // \a = Alert
// print this here the first time
// later it will be printed after command queue updates
printf("TC>");
///- As long as the World is running (no World::m_stopEvent), get the command line and handle it
while (!World::IsStopped())
{
fflush(stdout);
#ifdef linux
while (!kb_hit_return() && !World::IsStopped())
// With this, we limit CLI to 10commands/second
usleep(100);
if (World::IsStopped())
break;
#endif
char *command_str = fgets(commandbuf,sizeof(commandbuf),stdin);
if (command_str != NULL)
{
for(int x=0;command_str[x];x++)
if(command_str[x]=='\r'||command_str[x]=='\n')
{
command_str[x]=0;
break;
}
if(!*command_str)
{
printf("TC>");
continue;
}
std::string command;
if(!consoleToUtf8(command_str,command)) // convert from console encoding to utf8
{
printf("TC>");
continue;
}
sWorld.QueueCliCommand(&utf8print,command.c_str());
}
else if (feof(stdin))
{
World::StopNow(SHUTDOWN_EXIT_CODE);
}
}
///- End the database thread
WorldDatabase.ThreadEnd(); // free mySQL thread resources
}

View File

@@ -1,35 +0,0 @@
/*
* 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
*/
/// \addtogroup Trinityd
/// @{
/// \file
#ifndef __CLIRUNNABLE_H
#define __CLIRUNNABLE_H
/// Command Line Interface handling thread
class CliRunnable : public ZThread::Runnable
{
public:
void run();
};
#endif
/// @}

View File

@@ -1,165 +0,0 @@
/*
* 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
*/
/// \addtogroup Trinityd Trinity Daemon
/// @{
/// \file
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "Config/ConfigEnv.h"
#include "Log.h"
#include "Master.h"
#ifndef _TRINITY_CORE_CONFIG
# 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
#endif //_TRINITY_CORE_CONFVER
#ifdef WIN32
#include "ServiceWin32.h"
char serviceName[] = "TrinityCore";
char serviceLongName[] = "Trinity core service";
char serviceDescription[] = "Massive Network Game Object Server";
/*
* -1 - not in service mode
* 0 - stopped
* 1 - running
* 2 - paused
*/
int m_ServiceStatus = -1;
#endif
DatabaseType WorldDatabase; ///< Accessor to the world database
DatabaseType CharacterDatabase; ///< Accessor to the character database
DatabaseType LoginDatabase; ///< Accessor to the realm/login database
uint32 realmID; ///< Id of the realm
/// Print out the usage string for this program on the console.
void usage(const char *prog)
{
sLog.outString("Usage: \n %s [<options>]\n"
" -c config_file use config_file as configuration file\n\r"
#ifdef WIN32
" Running as service functions:\n\r"
" --service run as service\n\r"
" -s install install service\n\r"
" -s uninstall uninstall service\n\r"
#endif
,prog);
}
/// Launch the Trinity server
extern int main(int argc, char **argv)
{
///- Command line parsing to get the configuration file name
char const* cfg_file = _TRINITY_CORE_CONFIG;
int c=1;
while( c < argc )
{
if( strcmp(argv[c],"-c") == 0)
{
if( ++c >= argc )
{
sLog.outError("Runtime-Error: -c option requires an input argument");
usage(argv[0]);
return 1;
}
else
cfg_file = argv[c];
}
#ifdef WIN32
////////////
//Services//
////////////
if( strcmp(argv[c],"-s") == 0)
{
if( ++c >= argc )
{
sLog.outError("Runtime-Error: -s option requires an input argument");
usage(argv[0]);
return 1;
}
if( strcmp(argv[c],"install") == 0)
{
if (WinServiceInstall())
sLog.outString("Installing service");
return 1;
}
else if( strcmp(argv[c],"uninstall") == 0)
{
if(WinServiceUninstall())
sLog.outString("Uninstalling service");
return 1;
}
else
{
sLog.outError("Runtime-Error: unsupported option %s",argv[c]);
usage(argv[0]);
return 1;
}
}
if( strcmp(argv[c],"--service") == 0)
{
WinServiceRun();
}
////
#endif
++c;
}
if (!sConfig.SetSource(cfg_file))
{
sLog.outError("Could not find configuration file %s.", cfg_file);
return 1;
}
sLog.outString("Using configuration file %s.", cfg_file);
uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);
if (confVersion < _TRINITY_CORE_CONFVER)
{
sLog.outError("*****************************************************************************");
sLog.outError(" WARNING: Your trinitycore.conf version indicates your conf file is out of date!");
sLog.outError(" Please check for updates, as your current default values may cause");
sLog.outError(" strange behavior.");
sLog.outError("*****************************************************************************");
clock_t pause = 3000 + clock();
while (pause > clock()) {}
}
///- and run the 'Master'
/// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd?
return sMaster.Run();
// at sMaster return function exist with codes
// 0 - normal shutdown
// 1 - shutdown at error
// 2 - restart command used, this code can be used by restarter for restart Trinityd
}
/// @}

View File

@@ -1,531 +0,0 @@
/*
* 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
*/
/** \file
\ingroup Trinityd
*/
#include <ace/OS_NS_signal.h>
#include "WorldSocketMgr.h"
#include "Common.h"
#include "Master.h"
#include "WorldSocket.h"
#include "WorldRunnable.h"
#include "World.h"
#include "Log.h"
#include "Timer.h"
#include "Policies/SingletonImp.h"
#include "SystemConfig.h"
#include "Config/ConfigEnv.h"
#include "Database/DatabaseEnv.h"
#include "CliRunnable.h"
#include "RASocket.h"
#include "ScriptCalls.h"
#include "Util.h"
#include "sockets/TcpSocket.h"
#include "sockets/Utility.h"
#include "sockets/Parse.h"
#include "sockets/Socket.h"
#include "sockets/SocketHandler.h"
#include "sockets/ListenSocket.h"
#ifdef WIN32
#include "ServiceWin32.h"
extern int m_ServiceStatus;
#endif
/// \todo Warning disabling not useful under VC++2005. Can somebody say on which compiler it is useful?
#pragma warning(disable:4305)
INSTANTIATE_SINGLETON_1( Master );
volatile uint32 Master::m_masterLoopCounter = 0;
class FreezeDetectorRunnable : public ZThread::Runnable
{
public:
FreezeDetectorRunnable() { _delaytime = 0; }
uint32 m_loops, m_lastchange;
uint32 w_loops, w_lastchange;
uint32 _delaytime;
void SetDelayTime(uint32 t) { _delaytime = t; }
void run(void)
{
if(!_delaytime)
return;
sLog.outString("Starting up anti-freeze thread (%u seconds max stuck time)...",_delaytime/1000);
m_loops = 0;
w_loops = 0;
m_lastchange = 0;
w_lastchange = 0;
while(!World::IsStopped())
{
ZThread::Thread::sleep(1000);
uint32 curtime = getMSTime();
//DEBUG_LOG("anti-freeze: time=%u, counters=[%u; %u]",curtime,Master::m_masterLoopCounter,World::m_worldLoopCounter);
// There is no Master anymore
// TODO: clear the rest of the code
// // normal work
// if(m_loops != Master::m_masterLoopCounter)
// {
// m_lastchange = curtime;
// m_loops = Master::m_masterLoopCounter;
// }
// // possible freeze
// else if(getMSTimeDiff(m_lastchange,curtime) > _delaytime)
// {
// sLog.outError("Main/Sockets Thread hangs, kicking out server!");
// *((uint32 volatile*)NULL) = 0; // bang crash
// }
// normal work
if(w_loops != World::m_worldLoopCounter)
{
w_lastchange = curtime;
w_loops = World::m_worldLoopCounter;
}
// possible freeze
else if(getMSTimeDiff(w_lastchange,curtime) > _delaytime)
{
sLog.outError("World Thread hangs, kicking out server!");
*((uint32 volatile*)NULL) = 0; // bang crash
}
}
sLog.outString("Anti-freeze thread exiting without problems.");
}
};
class RARunnable : public ZThread::Runnable
{
public:
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)
{
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 ()
{
SocketHandler h;
// 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
{
while (!World::IsStopped())
{
ZThread::Thread::sleep (static_cast<unsigned long> (socketSelecttime / 1000));
checkping ();
}
}
}
};
Master::Master()
{
}
Master::~Master()
{
}
/// Main function
int Master::Run()
{
sLog.outString( "%s (core-daemon)", _FULLVERSION );
sLog.outString( "<Ctrl-C> to stop.\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", "");
if(!pidfile.empty())
{
uint32 pid = CreatePIDFile(pidfile);
if( !pid )
{
sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() );
return 1;
}
sLog.outString( "Daemon PID: %u\n", pid );
}
///- Start the databases
if (!_StartDB())
return 1;
///- Initialize the World
sWorld.SetInitialWorldSettings();
///- Catch termination signals
_HookSignals();
///- Launch WorldRunnable thread
ZThread::Thread t(new WorldRunnable);
t.setPriority ((ZThread::Priority )2);
// set server online
LoginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0 WHERE id = '%d'",realmID);
#ifdef WIN32
if (sConfig.GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
#else
if (sConfig.GetBoolDefault("Console.Enable", true))
#endif
{
///- Launch CliRunnable thread
ZThread::Thread td1(new CliRunnable);
}
ZThread::Thread td2(new RARunnable);
///- Handle affinity for multiple processors and process priority on Windows
#ifdef WIN32
{
HANDLE hProcess = GetCurrentProcess();
uint32 Aff = sConfig.GetIntDefault("UseProcessors", 0);
if(Aff > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
if(GetProcessAffinityMask(hProcess,&appAff,&sysAff))
{
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
if(!curAff )
{
sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for Trinityd. Accessible processors bitmask (hex): %x",Aff,appAff);
}
else
{
if(SetProcessAffinityMask(hProcess,curAff))
sLog.outString("Using processors (bitmask, hex): %x", curAff);
else
sLog.outError("Can't set used processors (hex): %x",curAff);
}
}
sLog.outString("");
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
// if(Prio && (m_ServiceStatus == -1)/* need set to default process priority class in service mode*/)
if(Prio)
{
if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
sLog.outString("TrinityCore process priority class set to HIGH");
else
sLog.outError("ERROR: Can't set Trinityd process priority class.");
sLog.outString("");
}
}
#endif
uint32 realCurrTime, realPrevTime;
realCurrTime = realPrevTime = getMSTime();
uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME);
// maximum counter for next ping
uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / socketSelecttime));
uint32 loopCounter = 0;
///- Start up freeze catcher thread
uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0);
if(freeze_delay)
{
FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();
fdr->SetDelayTime(freeze_delay*1000);
ZThread::Thread t(fdr);
t.setPriority(ZThread::High);
}
///- Launch the world listener socket
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)
{
sLog.outError ("Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
}
sWorldSocketMgr->Wait ();
// set server offline
LoginDatabase.PExecute("UPDATE realmlist SET color = 2 WHERE id = '%d'",realmID);
///- Remove signal handling before leaving
_UnhookSignals();
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master
t.wait();
td2.wait ();
///- Clean database before leaving
clearOnlineAccounts();
///- Wait for delay threads to end
CharacterDatabase.HaltDelayThread();
WorldDatabase.HaltDelayThread();
LoginDatabase.HaltDelayThread();
sLog.outString( "Halting process..." );
#ifdef WIN32
if (sConfig.GetBoolDefault("Console.Enable", true))
{
// this only way to terminate CLI thread exist at Win32 (alt. way exist only in Windows Vista API)
//_exit(1);
// send keyboard input to safely unblock the CLI thread
INPUT_RECORD b[5];
HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
b[0].EventType = KEY_EVENT;
b[0].Event.KeyEvent.bKeyDown = TRUE;
b[0].Event.KeyEvent.uChar.AsciiChar = 'X';
b[0].Event.KeyEvent.wVirtualKeyCode = 'X';
b[0].Event.KeyEvent.wRepeatCount = 1;
b[1].EventType = KEY_EVENT;
b[1].Event.KeyEvent.bKeyDown = FALSE;
b[1].Event.KeyEvent.uChar.AsciiChar = 'X';
b[1].Event.KeyEvent.wVirtualKeyCode = 'X';
b[1].Event.KeyEvent.wRepeatCount = 1;
b[2].EventType = KEY_EVENT;
b[2].Event.KeyEvent.bKeyDown = TRUE;
b[2].Event.KeyEvent.dwControlKeyState = 0;
b[2].Event.KeyEvent.uChar.AsciiChar = '\r';
b[2].Event.KeyEvent.wVirtualKeyCode = VK_RETURN;
b[2].Event.KeyEvent.wRepeatCount = 1;
b[2].Event.KeyEvent.wVirtualScanCode = 0x1c;
b[3].EventType = KEY_EVENT;
b[3].Event.KeyEvent.bKeyDown = FALSE;
b[3].Event.KeyEvent.dwControlKeyState = 0;
b[3].Event.KeyEvent.uChar.AsciiChar = '\r';
b[3].Event.KeyEvent.wVirtualKeyCode = VK_RETURN;
b[3].Event.KeyEvent.wVirtualScanCode = 0x1c;
b[3].Event.KeyEvent.wRepeatCount = 1;
DWORD numb;
BOOL ret = WriteConsoleInput(hStdIn, b, 4, &numb);
}
#endif
// for some unknown reason, unloading scripts here and not in worldrunnable
// fixes a memory leak related to detaching threads from the module
UnloadScriptingModule();
// Exit the process with specified return value
return World::GetExitCode();
}
/// Initialize connection to the databases
bool Master::_StartDB()
{
std::string 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;
}
///- Initialise the world database
if(!WorldDatabase.Initialize(dbstring.c_str()))
{
sLog.outError("Cannot connect to world database %s",dbstring.c_str());
return false;
}
///- 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;
}
///- Initialise the Character database
if(!CharacterDatabase.Initialize(dbstring.c_str()))
{
sLog.outError("Cannot connect to Character database %s",dbstring.c_str());
return false;
}
///- Get login database info from configuration file
dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", "");
if(dbstring.empty())
{
sLog.outError("Login database not specified in configuration file");
return false;
}
///- Initialise the login database
if(!LoginDatabase.Initialize(dbstring.c_str()))
{
sLog.outError("Cannot connect to login database %s",dbstring.c_str());
return false;
}
///- Get the realm Id from the configuration file
realmID = sConfig.GetIntDefault("RealmID", 0);
if(!realmID)
{
sLog.outError("Realm ID not defined in configuration file");
return false;
}
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();
sWorld.LoadDBVersion();
sLog.outString("Using %s", sWorld.GetDBVersion());
return true;
}
/// Clear 'online' status for all accounts with characters in this realm
void Master::clearOnlineAccounts()
{
// Cleanup online status for characters hosted at current realm
/// \todo Only accounts with characters logged on *this* realm should have online status reset. Move the online column from 'account' to 'realmcharacters'?
LoginDatabase.PExecute(
"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
void Master::_OnSignal(int s)
{
switch (s)
{
case SIGINT:
World::StopNow(RESTART_EXIT_CODE);
break;
case SIGTERM:
#ifdef _WIN32
case SIGBREAK:
#endif
World::StopNow(SHUTDOWN_EXIT_CODE);
break;
}
signal(s, _OnSignal);
}
/// Define hook '_OnSignal' for all termination signals
void Master::_HookSignals()
{
signal(SIGINT, _OnSignal);
signal(SIGTERM, _OnSignal);
#ifdef _WIN32
signal(SIGBREAK, _OnSignal);
#endif
}
/// Unhook the signals before leaving
void Master::_UnhookSignals()
{
signal(SIGINT, 0);
signal(SIGTERM, 0);
#ifdef _WIN32
signal(SIGBREAK, 0);
#endif
}

View File

@@ -1,52 +0,0 @@
/*
* 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
*/
/// \addtogroup Trinityd
/// @{
/// \file
#ifndef _MASTER_H
#define _MASTER_H
#include "Common.h"
#include "Policies/Singleton.h"
/// Start the server
class Master
{
public:
Master();
~Master();
int Run();
static volatile uint32 m_masterLoopCounter;
private:
bool _StartDB();
void _HookSignals();
void _UnhookSignals();
static void _OnSignal(int s);
void clearOnlineAccounts();
};
#define sMaster Trinity::Singleton<Master>::Instance()
#endif
/// @}

View File

@@ -1,259 +0,0 @@
/*
* 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
*/
/** \file
\ingroup Trinityd
*/
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "Log.h"
#include "RASocket.h"
#include "World.h"
#include "Config/ConfigEnv.h"
#include "Util.h"
#include "AccountMgr.h"
/// \todo Make this thread safe if in the future 2 admins should be able to log at the same time.
SOCKET r;
#define dropclient {Sendf("I'm busy right now, come back later."); \
SetCloseAndDelete(); \
return; \
}
uint32 iSession=0; ///< Session number (incremented each time a new connection is made)
unsigned int iUsers=0; ///< Number of active administrators
typedef int(* pPrintf)(const char*,...);
void ParseCommand(CliCommandHolder::Print*, char*command);
/// RASocket constructor
RASocket::RASocket(ISocketHandler &h): TcpSocket(h)
{
///- Increment the session number
iSess =iSession++ ;
///- Get the config parameters
bSecure = sConfig.GetBoolDefault( "RA.Secure", true );
iMinLevel = sConfig.GetIntDefault( "RA.MinLevel", 3 );
///- Initialize buffer and data
iInputLength=0;
buff=new char[RA_BUFF_SIZE];
stage=NONE;
}
/// RASocket destructor
RASocket::~RASocket()
{
///- Delete buffer and decrease active admins count
delete [] buff;
sLog.outRemote("Connection was closed.\n");
if(stage==OK)
iUsers--;
}
/// Accept an incoming connection
void RASocket::OnAccept()
{
std::string ss=GetRemoteAddress();
sLog.outRemote("Incoming connection from %s.\n",ss.c_str());
///- If there is already an active admin, drop the connection
if(iUsers)
dropclient
///- Else print Motd
Sendf("%s\r\n",sWorld.GetMotd());
}
/// Read data from the network
void RASocket::OnRead()
{
///- Read data and check input length
TcpSocket::OnRead();
unsigned int sz=ibuf.GetLength();
if(iInputLength+sz>=RA_BUFF_SIZE)
{
sLog.outRemote("Input buffer overflow, possible DOS attack.\n");
SetCloseAndDelete();
return;
}
///- If there is already an active admin (other than you), drop the connection
if(stage!=OK && iUsers)
dropclient
char *inp = new char [sz+1];
ibuf.Read(inp,sz);
/// \todo Can somebody explain this 'Linux bugfix'?
if(stage==NONE)
if(sz>4) //linux remote telnet
if(memcmp(inp ,"USER ",5))
{
delete [] inp;return;
printf("lin bugfix");
} //linux bugfix
///- Discard data after line break or line feed
bool gotenter=false;
unsigned int y=0;
for(;y<sz;y++)
if(inp[y]=='\r'||inp[y]=='\n')
{
gotenter=true;
break;
}
//No buffer overflow (checked above)
memcpy(&buff[iInputLength],inp,y);
iInputLength+=y;
delete [] inp;
if(gotenter)
{
buff[iInputLength]=0;
iInputLength=0;
switch(stage)
{
/// <ul> <li> If the input is 'USER <username>'
case NONE:
if(!memcmp(buff,"USER ",5)) //got "USER" cmd
{
szLogin=&buff[5];
///- Get the gmlevel and password from the account table
std::string login = szLogin;
///- Convert Account name to Upper Format
AccountMgr::normilizeString(login);
///- Escape the Login to allow quotes in names
LoginDatabase.escape_string(login);
QueryResult* result = LoginDatabase.PQuery("SELECT gmlevel FROM account WHERE username = '%s'",login.c_str());
///- If the user is not found, deny access
if(!result)
{
Sendf("-No such user.\r\n");
sLog.outRemote("User %s does not exist.\n",szLogin.c_str());
if(bSecure)SetCloseAndDelete();
}
else
{
Field *fields = result->Fetch();
//szPass=fields[0].GetString();
///- if gmlevel is too low, deny access
if(fields[0].GetUInt32()<iMinLevel)
{
Sendf("-Not enough privileges.\r\n");
sLog.outRemote("User %s has no privilege.\n",szLogin.c_str());
if(bSecure)SetCloseAndDelete();
} else
{
stage=LG;
}
delete result;
}
}
break;
///<li> If the input is 'PASS <password>' (and the user already gave his username)
case LG:
if(!memcmp(buff,"PASS ",5)) //got "PASS" cmd
{ //login+pass ok
///- If password is correct, increment the number of active administrators
std::string login = szLogin;
std::string pw = &buff[5];
AccountMgr::normilizeString(login);
AccountMgr::normilizeString(pw);
LoginDatabase.escape_string(login);
LoginDatabase.escape_string(pw);
QueryResult *check = LoginDatabase.PQuery(
"SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash=SHA1(CONCAT(username,':','%s'))",
login.c_str(), pw.c_str());
if(check)
{
delete check;
r=GetSocket();
stage=OK;
++iUsers;
Sendf("+Logged in.\r\n");
sLog.outRemote("User %s has logged in.\n",szLogin.c_str());
Sendf("TC>");
}
else
{
///- Else deny access
Sendf("-Wrong pass.\r\n");
sLog.outRemote("User %s has failed to log in.\n",szLogin.c_str());
if(bSecure)SetCloseAndDelete();
}
}
break;
///<li> If user is logged, parse and execute the command
case OK:
if(strlen(buff))
{
sLog.outRemote("Got '%s' cmd.\n",buff);
sWorld.QueueCliCommand(&RASocket::zprint , buff);
}
else
Sendf("TC>");
break;
///</ul>
};
}
}
/// Output function
void RASocket::zprint( const char * szText )
{
if( !szText )
return;
#ifdef RA_CRYPT
char *megabuffer=strdup(szText);
unsigned int sz=strlen(megabuffer);
Encrypt(megabuffer,sz);
send(r,megabuffer,sz,0);
delete [] megabuffer;
#else
unsigned int sz=strlen(szText);
send(r,szText,sz,0);
#endif
}

View File

@@ -1,67 +0,0 @@
/*
* 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
*/
/// \addtogroup Trinityd
/// @{
/// \file
#ifndef _RASOCKET_H
#define _RASOCKET_H
#include "Common.h"
#include "sockets/TcpSocket.h"
#define RA_BUFF_SIZE 1024
class ISocketHandler;
/// Remote Administration socket
class RASocket: public TcpSocket
{
public:
RASocket(ISocketHandler& h);
~RASocket();
void OnAccept();
void OnRead();
private:
char * buff;
std::string szLogin;
uint32 iSess;
unsigned int iInputLength;
bool bLog;
bool bSecure; //kick on wrong pass, non exist. user, user with no priv
//will protect from DOS, bruteforce attacks
//some 'smart' protection must be added for more security
uint8 iMinLevel;
enum
{
NONE, //initial value
LG, //only login was entered
OK, //both login and pass were given, and they are correct and user have enough priv.
}stage;
static void zprint( const char * szText );
};
#endif
/// @}

View File

@@ -1,104 +0,0 @@
/*
* 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
*/
/** \file
\ingroup Trinityd
*/
#include "WorldSocketMgr.h"
#include "Common.h"
#include "World.h"
#include "WorldRunnable.h"
#include "Timer.h"
#include "ObjectAccessor.h"
#include "MapManager.h"
#include "BattleGroundMgr.h"
#include "Database/DatabaseEnv.h"
#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]
#endif
#ifdef WIN32
#include "ServiceWin32.h"
extern int m_ServiceStatus;
#endif
/// Heartbeat for the World
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;
uint32 realPrevTime = getMSTime();
uint32 prevSleepTime = 0; // used for balanced full tick time length near WORLD_SLEEP_CONST
///- While we have not World::m_stopEvent, update the world
while (!World::IsStopped())
{
++World::m_worldLoopCounter;
realCurrTime = getMSTime();
uint32 diff = getMSTimeDiff(realPrevTime,realCurrTime);
sWorld.Update( diff );
realPrevTime = realCurrTime;
// diff (D0) include time of previous sleep (d0) + tick time (t0)
// we want that next d1 + t1 == WORLD_SLEEP_CONST
// we can't know next t1 and then can use (t0 + d1) == WORLD_SLEEP_CONST requirement
// d1 = WORLD_SLEEP_CONST - t0 = WORLD_SLEEP_CONST - (D0 - d0) = WORLD_SLEEP_CONST + d0 - D0
if (diff <= WORLD_SLEEP_CONST+prevSleepTime)
{
prevSleepTime = WORLD_SLEEP_CONST+prevSleepTime-diff;
ZThread::Thread::sleep(prevSleepTime);
}
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();
}

View File

@@ -1,35 +0,0 @@
/*
* 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
*/
/// \addtogroup Trinityd
/// @{
/// \file
#ifndef __WORLDRUNNABLE_H
#define __WORLDRUNNABLE_H
/// Heartbeat thread for the World
class WorldRunnable : public ZThread::Runnable
{
public:
void run();
};
#endif
/// @}

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by TrinityCore.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -1,75 +0,0 @@
/*
* 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
*/
/** \file
\ingroup realmd
*/
#ifndef _AUTHCODES_H
#define _AUTHCODES_H
enum eAuthResults
{
REALM_AUTH_SUCCESS = 0x00,
REALM_AUTH_FAILURE = 0x01, ///< Unable to connect
REALM_AUTH_UNKNOWN1 = 0x02, ///< Unable to connect
REALM_AUTH_ACCOUNT_BANNED = 0x03, ///< This <game> account has been closed and is no longer available for use. Please go to <site>/banned.html for further information.
REALM_AUTH_NO_MATCH = 0x04, ///< The information you have entered is not valid. Please check the spelling of the account name and password. If you need help in retrieving a lost or stolen password, see <site> for more information
REALM_AUTH_UNKNOWN2 = 0x05, ///< The information you have entered is not valid. Please check the spelling of the account name and password. If you need help in retrieving a lost or stolen password, see <site> for more information
REALM_AUTH_ACCOUNT_IN_USE = 0x06, ///< This account is already logged into <game>. Please check the spelling and try again.
REALM_AUTH_PREPAID_TIME_LIMIT = 0x07, ///< You have used up your prepaid time for this account. Please purchase more to continue playing
REALM_AUTH_SERVER_FULL = 0x08, ///< Could not log in to <game> at this time. Please try again later.
REALM_AUTH_WRONG_BUILD_NUMBER = 0x09, ///< Unable to validate game version. This may be caused by file corruption or interference of another program. Please visit <site> for more information and possible solutions to this issue.
REALM_AUTH_UPDATE_CLIENT = 0x0a, ///< Downloading
REALM_AUTH_UNKNOWN3 = 0x0b, ///< Unable to connect
REALM_AUTH_ACCOUNT_FREEZED = 0x0c, ///< This <game> account has been temporarily suspended. Please go to <site>/banned.html for further information
REALM_AUTH_UNKNOWN4 = 0x0d, ///< Unable to connect
REALM_AUTH_UNKNOWN5 = 0x0e, ///< Connected.
REALM_AUTH_PARENTAL_CONTROL = 0x0f ///< Access to this account has been blocked by parental controls. Your settings may be changed in your account preferences at <site>
};
enum LoginResult
{
LOGIN_OK = 0x00,
LOGIN_FAILED = 0x01,
LOGIN_FAILED2 = 0x02,
LOGIN_BANNED = 0x03,
LOGIN_UNKNOWN_ACCOUNT = 0x04,
LOGIN_UNKNOWN_ACCOUNT3 = 0x05,
LOGIN_ALREADYONLINE = 0x06,
LOGIN_NOTIME = 0x07,
LOGIN_DBBUSY = 0x08,
LOGIN_BADVERSION = 0x09,
LOGIN_DOWNLOAD_FILE = 0x0A,
LOGIN_FAILED3 = 0x0B,
LOGIN_SUSPENDED = 0x0C,
LOGIN_FAILED4 = 0x0D,
LOGIN_CONNECTED = 0x0E,
LOGIN_PARENTALCONTROL = 0x0F,
LOGIN_LOCKED_ENFORCED = 0x10,
};
// we need to stick to 1 version or half of the stuff will work for someone
// others will not and opposite
// will only support WoW, WoW:TBC and WoW:WotLK 3.0.9 client build 9551...
#define EXPECTED_TRINITY_CLIENT_BUILD {9551, 0}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,86 +0,0 @@
/*
* 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
*/
/// \addtogroup realmd
/// @{
/// \file
#ifndef _AUTHSOCKET_H
#define _AUTHSOCKET_H
#include "Common.h"
#include "Auth/BigNumber.h"
#include "sockets/TcpSocket.h"
#include "sockets/SocketHandler.h"
#include "sockets/ListenSocket.h"
#include "sockets/Utility.h"
#include "sockets/Parse.h"
#include "sockets/Socket.h"
#include "zthread/Mutex.h"
/// Handle login commands
class AuthSocket: public TcpSocket
{
public:
const static int s_BYTE_SIZE = 32;
AuthSocket(ISocketHandler& h);
~AuthSocket();
void OnAccept();
void OnRead();
bool _HandleLogonChallenge();
bool _HandleLogonProof();
bool _HandleReconnectChallenge();
bool _HandleReconnectProof();
bool _HandleRealmList();
//data transfer handle for patch
bool _HandleXferResume();
bool _HandleXferCancel();
bool _HandleXferAccept();
void _SetVSFields(const std::string& rI);
FILE *pPatch;
ZThread::Mutex patcherLock;
bool IsLag();
private:
BigNumber N, s, g, v;
BigNumber b, B;
BigNumber K;
BigNumber _reconnectProof;
bool _authed;
std::string _login;
std::string _safelogin;
// Since GetLocaleByName() is _NOT_ bijective, we have to store the locale as a string. Otherwise we can't differ
// between enUS and enGB, which is important for the patch system
std::string _localizationName;
uint16 _build;
AccountTypes _accountSecurityLevel;
};
#endif
/// @}

View File

@@ -1,45 +0,0 @@
########### next target ###############
SET(trinity-realm_SRCS
AuthCodes.h
AuthSocket.cpp
AuthSocket.h
Main.cpp
RealmList.cpp
RealmList.h
)
add_executable(trinity-realm ${trinity-realm_SRCS})
add_definitions(
-D_TRINITY_REALM_CONFIG='"${CONF_DIR}/trinityrealm.conf"'
)
IF (DO_MYSQL)
#SET_TARGET_PROPERTIES(mangos-realmd PROPERTIES LINK_FLAGS ${MYSQL_LIBS})
SET_TARGET_PROPERTIES(trinity-realm PROPERTIES LINK_FLAGS "-pthread")
ENDIF(DO_MYSQL)
IF (DO_POSTGRE)
SET_TARGET_PROPERTIES(trinity-realmd PROPERTIES LINK_FLAGS ${POSTGRE_LIBS})
ENDIF(DO_POSTGRE)
target_link_libraries(
trinity-realm
shared
trinityframework
trinitysockets
trinitydatabase
trinityauth
trinityconfig
ZThread
zlib
${SSLLIB}
${MYSQL_LIBRARIES}
)
install(TARGETS trinity-realm DESTINATION bin)
########### install files ###############
install(FILES realmd.conf.dist.in DESTINATION etc)

View File

@@ -1,364 +0,0 @@
/*
* 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
*/
/// \addtogroup realmd Realm Daemon
/// @{
/// \file
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "RealmList.h"
#include "Config/ConfigEnv.h"
#include "Log.h"
#include "sockets/ListenSocket.h"
#include "AuthSocket.h"
#include "SystemConfig.h"
#include "Util.h"
// Format is YYYYMMDDRR where RR is the change in the conf file
// for that day.
#ifndef _REALMDCONFVERSION
# define _REALMDCONFVERSION 2007062001
#endif
#ifndef _TRINITY_REALM_CONFIG
# define _TRINITY_REALM_CONFIG "TrinityRealm.conf"
#endif //_TRINITY_REALM_CONFIG
#ifdef WIN32
#include "ServiceWin32.h"
char serviceName[] = "TrinityRealm";
char serviceLongName[] = "Trinity realm service";
char serviceDescription[] = "Massive Network Game Object Server";
/*
* -1 - not in service mode
* 0 - stopped
* 1 - running
* 2 - paused
*/
int m_ServiceStatus = -1;
#endif
bool StartDB();
void UnhookSignals();
void HookSignals();
bool stopEvent = false; ///< Setting it to true stops the server
RealmList m_realmList; ///< Holds the list of realms for this server
DatabaseType LoginDatabase; ///< Accessor to the realm server database
/// Print out the usage string for this program on the console.
void usage(const char *prog)
{
sLog.outString("Usage: \n %s [<options>]\n"
" -c config_file use config_file as configuration file\n\r"
#ifdef WIN32
" Running as service functions:\n\r"
" --service run as service\n\r"
" -s install install service\n\r"
" -s uninstall uninstall service\n\r"
#endif
,prog);
}
/// Launch the realm server
extern int main(int argc, char **argv)
{
///- Command line parsing to get the configuration file name
char const* cfg_file = _TRINITY_REALM_CONFIG;
int c=1;
while( c < argc )
{
if( strcmp(argv[c],"-c") == 0)
{
if( ++c >= argc )
{
sLog.outError("Runtime-Error: -c option requires an input argument");
usage(argv[0]);
return 1;
}
else
cfg_file = argv[c];
}
#ifdef WIN32
////////////
//Services//
////////////
if( strcmp(argv[c],"-s") == 0)
{
if( ++c >= argc )
{
sLog.outError("Runtime-Error: -s option requires an input argument");
usage(argv[0]);
return 1;
}
if( strcmp(argv[c],"install") == 0)
{
if (WinServiceInstall())
sLog.outString("Installing service");
return 1;
}
else if( strcmp(argv[c],"uninstall") == 0)
{
if(WinServiceUninstall())
sLog.outString("Uninstalling service");
return 1;
}
else
{
sLog.outError("Runtime-Error: unsupported option %s",argv[c]);
usage(argv[0]);
return 1;
}
}
if( strcmp(argv[c],"--service") == 0)
{
WinServiceRun();
}
////
#endif
++c;
}
if (!sConfig.SetSource(cfg_file))
{
sLog.outError("Could not find configuration file %s.", cfg_file);
return 1;
}
sLog.outString("Using configuration file %s.", cfg_file);
///- Check the version of the configuration file
uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);
if (confVersion < _REALMDCONFVERSION)
{
sLog.outError("*****************************************************************************");
sLog.outError(" WARNING: Your trinityrealm.conf version indicates your conf file is out of date!");
sLog.outError(" Please check for updates, as your current default values may cause");
sLog.outError(" strange behavior.");
sLog.outError("*****************************************************************************");
clock_t pause = 3000 + clock();
while (pause > clock()) {}
}
sLog.outString( "%s (realm-daemon)", _FULLVERSION );
sLog.outString( "<Ctrl-C> to stop.\n" );
/// realmd PID file creation
std::string pidfile = sConfig.GetStringDefault("PidFile", "");
if(!pidfile.empty())
{
uint32 pid = CreatePIDFile(pidfile);
if( !pid )
{
sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() );
return 1;
}
sLog.outString( "Daemon PID: %u\n", pid );
}
///- Initialize the database connection
if(!StartDB())
return 1;
///- Initialize the log database
if(sConfig.GetBoolDefault("EnableLogDB", false))
{
// everything successful - set var to enable DB logging once startup finished.
sLog.SetLogDBLater(true);
// ensure we've set realm to 0 (realmd realmid)
sLog.SetRealmID(0);
}
///- Get the list of realms for the server
m_realmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
if (m_realmList.size() == 0)
{
sLog.outError("No valid realms specified.");
return 1;
}
///- Launch the listening network socket
port_t rmport = sConfig.GetIntDefault( "RealmServerPort", DEFAULT_REALMSERVER_PORT );
std::string bind_ip = sConfig.GetStringDefault("BindIP", "0.0.0.0");
SocketHandler h;
ListenSocket<AuthSocket> authListenSocket(h);
if ( authListenSocket.Bind(bind_ip.c_str(),rmport))
{
sLog.outError( "Trinity realm can not bind to %s:%d",bind_ip.c_str(), rmport );
return 1;
}
h.Add(&authListenSocket);
///- Catch termination signals
HookSignals();
///- Handle affinity for multiple processors and process priority on Windows
#ifdef WIN32
{
HANDLE hProcess = GetCurrentProcess();
uint32 Aff = sConfig.GetIntDefault("UseProcessors", 0);
if(Aff > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
if(GetProcessAffinityMask(hProcess,&appAff,&sysAff))
{
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
if(!curAff )
{
sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for realmd. Accessible processors bitmask (hex): %x",Aff,appAff);
}
else
{
if(SetProcessAffinityMask(hProcess,curAff))
sLog.outString("Using processors (bitmask, hex): %x", curAff);
else
sLog.outError("Can't set used processors (hex): %x", curAff);
}
}
sLog.outString("");
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
if(Prio)
{
if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
sLog.outString("TrinityRealm process priority class set to HIGH");
else
sLog.outError("ERROR: Can't set realmd process priority class.");
sLog.outString("");
}
}
#endif
// maximum counter for next ping
uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / 100000));
uint32 loopCounter = 0;
// possibly enable db logging; avoid massive startup spam by doing it here.
if (sLog.GetLogDBLater())
{
sLog.outString("Enabling database logging...");
sLog.SetLogDBLater(false);
// login db needs thread for logging
sLog.SetLogDB(true);
}
///- Wait for termination signal
while (!stopEvent)
{
h.Select(0, 100000);
if( (++loopCounter) == numLoops )
{
loopCounter = 0;
sLog.outDetail("Ping MySQL to keep connection alive");
delete LoginDatabase.Query("SELECT 1 FROM realmlist LIMIT 1");
}
#ifdef WIN32
if (m_ServiceStatus == 0) stopEvent = true;
while (m_ServiceStatus == 2) Sleep(1000);
#endif
}
///- Wait for the delay thread to exit
LoginDatabase.ThreadEnd();
LoginDatabase.HaltDelayThread();
///- Remove signal handling before leaving
UnhookSignals();
sLog.outString( "Halting process..." );
return 0;
}
/// Handle termination signals
/** Put the global variable stopEvent to 'true' if a termination signal is caught **/
void OnSignal(int s)
{
switch (s)
{
case SIGINT:
case SIGTERM:
stopEvent = true;
break;
#ifdef _WIN32
case SIGBREAK:
stopEvent = true;
break;
#endif
}
signal(s, OnSignal);
}
/// Initialize connection to the database
bool StartDB()
{
std::string dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", "");
if(dbstring.empty())
{
sLog.outError("Database not specified");
return false;
}
if(!LoginDatabase.Initialize(dbstring.c_str()))
{
sLog.outError("Cannot connect to database");
return false;
}
LoginDatabase.ThreadStart();
return true;
}
/// Define hook 'OnSignal' for all termination signals
void HookSignals()
{
signal(SIGINT, OnSignal);
signal(SIGTERM, OnSignal);
#ifdef _WIN32
signal(SIGBREAK, OnSignal);
#endif
}
/// Unhook the signals before leaving
void UnhookSignals()
{
signal(SIGINT, 0);
signal(SIGTERM, 0);
#ifdef _WIN32
signal(SIGBREAK, 0);
#endif
}
/// @}

View File

@@ -1,101 +0,0 @@
/*
* 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
*/
/** \file
\ingroup realmd
*/
#include "Common.h"
#include "RealmList.h"
#include "Policies/SingletonImp.h"
#include "Database/DatabaseEnv.h"
INSTANTIATE_SINGLETON_1( RealmList );
extern DatabaseType LoginDatabase;
RealmList::RealmList( ) : m_UpdateInterval(0), m_NextUpdateTime(time(NULL))
{
}
/// Load the realm list from the database
void RealmList::Initialize(uint32 updateInterval)
{
m_UpdateInterval = updateInterval;
///- Get the content of the realmlist table in the database
UpdateRealms(true);
}
void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu)
{
///- Create new if not exist or update existed
Realm& realm = m_realms[name];
realm.m_ID = ID;
realm.icon = icon;
realm.color = color;
realm.timezone = timezone;
realm.allowedSecurityLevel = allowedSecurityLevel;
realm.populationLevel = popu;
///- Append port to IP address.
std::ostringstream ss;
ss << address << ":" << port;
realm.address = ss.str();
}
void RealmList::UpdateIfNeed()
{
// maybe disabled or updated recently
if(!m_UpdateInterval || m_NextUpdateTime > time(NULL))
return;
m_NextUpdateTime = time(NULL) + m_UpdateInterval;
// Clears Realm list
m_realms.clear();
// Get the content of the realmlist table in the database
UpdateRealms(false);
}
void RealmList::UpdateRealms(bool init)
{
sLog.outDetail("Updating Realm List...");
QueryResult *result = LoginDatabase.Query( "SELECT id, name, address, port, icon, color, timezone, allowedSecurityLevel, population FROM realmlist WHERE color <> 3 ORDER BY name" );
///- Circle through results and add them to the realm map
if(result)
{
do
{
Field *fields = result->Fetch();
uint8 allowedSecurityLevel = fields[7].GetUInt8();
UpdateRealm(fields[0].GetUInt32(), fields[1].GetCppString(),fields[2].GetCppString(),fields[3].GetUInt32(),fields[4].GetUInt8(), fields[5].GetUInt8(), fields[6].GetUInt8(), (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), fields[8].GetFloat() );
if(init)
sLog.outString("Added realm \"%s\".", fields[1].GetString());
} while( result->NextRow() );
delete result;
}
}

View File

@@ -1,67 +0,0 @@
/*
* 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
*/
/// \addtogroup realmd
/// @{
/// \file
#ifndef _REALMLIST_H
#define _REALMLIST_H
#include "Common.h"
/// Storage object for a realm
struct Realm
{
std::string address;
uint8 icon;
uint8 color;
uint8 timezone;
uint32 m_ID;
AccountTypes allowedSecurityLevel;
float populationLevel;
};
/// Storage object for the list of realms on the server
class RealmList
{
public:
typedef std::map<std::string, Realm> RealmMap;
RealmList();
~RealmList() {}
void Initialize(uint32 updateInterval);
void UpdateIfNeed();
RealmMap::const_iterator begin() const { return m_realms.begin(); }
RealmMap::const_iterator end() const { return m_realms.end(); }
uint32 size() const { return m_realms.size(); }
private:
void UpdateRealms(bool init);
void UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu);
private:
RealmMap m_realms; ///< Internal map of realms
uint32 m_UpdateInterval;
time_t m_NextUpdateTime;
};
#endif
/// @}

View File

@@ -1,15 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by TrinityCore.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

7
src/shared/revision.h Normal file
View File

@@ -0,0 +1,7 @@
#ifndef __REVISION_H__
#define __REVISION_H__
#define _REVISION "2040"
#define _HASH "4fae080e5446"
#define _REVISION_DATE "*"
#define _REVISION_TIME "*"
#endif // __REVISION_H__

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
}

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
/// @}

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)
}
/// @}

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
}

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
/// @}

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
}

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
/// @}

View File

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

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();
}

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
/// @}

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

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

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
@@ -68,9 +68,8 @@ enum LoginResult
// we need to stick to 1 version or half of the stuff will work for someone
// others will not and opposite
// will only support WoW and WoW:TBC 2.4.3 client build 8606...
// will only support WoW, WoW:TBC and WoW:WotLK 3.0.9 client build 9551...
#define EXPECTED_TRINITY_CLIENT_BUILD {8606, 0}
#define EXPECTED_TRINITY_CLIENT_BUILD {9551, 0}
#endif

View File

@@ -1092,4 +1092,3 @@ Patcher::~Patcher()
for(Patches::iterator i = _patches.begin(); i != _patches.end(); i++ )
delete i->second;
}

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
@@ -84,4 +84,3 @@ class AuthSocket: public TcpSocket
};
#endif
/// @}

View File

@@ -9,24 +9,18 @@ RealmList.cpp
RealmList.h
)
SET(trinity-realm_LINK_FLAGS "")
add_executable(trinity-realm ${trinity-realm_SRCS})
add_definitions(
-D_TRINITY_REALM_CONFIG='"${CONF_DIR}/trinityrealm.conf"'
)
IF (DO_MYSQL)
SET(trinity-realm_LINK_FLAGS "-pthread ${trinity-realm_LINK_FLAGS}")
#SET_TARGET_PROPERTIES(mangos-realmd PROPERTIES LINK_FLAGS ${MYSQL_LIBS})
SET_TARGET_PROPERTIES(trinity-realm PROPERTIES LINK_FLAGS "-pthread")
ENDIF(DO_MYSQL)
IF (DO_POSTGRE)
SET(trinity-realm_LINK_FLAGS "${POSTGRE_LIBS} ${trinity-realm_LINK_FLAGS}")
SET_TARGET_PROPERTIES(trinity-realmd PROPERTIES LINK_FLAGS ${POSTGRE_LIBS})
ENDIF(DO_POSTGRE)
IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
SET(trinity-realm_LINK_FLAGS "-framework Carbon ${trinity-realm_LINK_FLAGS}")
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
SET_TARGET_PROPERTIES(trinity-realm PROPERTIES LINK_FLAGS "${trinity-realm_LINK_FLAGS}")
target_link_libraries(
trinity-realm
@@ -40,11 +34,11 @@ ZThread
zlib
${SSLLIB}
${MYSQL_LIBRARIES}
${OSX_LIBS}
)
install(TARGETS trinity-realm DESTINATION bin)
########### install files ###############
install(FILES trinityrealm.conf.dist DESTINATION etc)

View File

@@ -31,7 +31,6 @@
#include "sockets/ListenSocket.h"
#include "AuthSocket.h"
#include "SystemConfig.h"
#include "revision.h"
#include "Util.h"
// Format is YYYYMMDDRR where RR is the change in the conf file
@@ -41,12 +40,12 @@
#endif
#ifndef _TRINITY_REALM_CONFIG
# define _TRINITY_REALM_CONFIG "trinityrealm.conf"
# define _TRINITY_REALM_CONFIG "TrinityRealm.conf"
#endif //_TRINITY_REALM_CONFIG
#ifdef WIN32
#include "ServiceWin32.h"
char serviceName[] = "realmd";
char serviceName[] = "TrinityRealm";
char serviceLongName[] = "Trinity realm service";
char serviceDescription[] = "Massive Network Game Object Server";
/*
@@ -58,7 +57,7 @@ char serviceDescription[] = "Massive Network Game Object Server";
int m_ServiceStatus = -1;
#endif
bool StartDB(std::string &dbstring);
bool StartDB();
void UnhookSignals();
void HookSignals();
@@ -71,7 +70,6 @@ DatabaseType LoginDatabase; ///< Accessor to the
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"
@@ -102,12 +100,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//
@@ -187,10 +179,18 @@ extern int main(int argc, char **argv)
}
///- Initialize the database connection
std::string dbstring;
if(!StartDB(dbstring))
if(!StartDB())
return 1;
///- Initialize the log database
if(sConfig.GetBoolDefault("EnableLogDB", false))
{
// everything successful - set var to enable DB logging once startup finished.
sLog.SetLogDBLater(true);
// ensure we've set realm to 0 (realmd realmid)
sLog.SetRealmID(0);
}
///- Get the list of realms for the server
m_realmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
if (m_realmList.size() == 0)
@@ -243,7 +243,7 @@ extern int main(int argc, char **argv)
sLog.outError("Can't set used processors (hex): %x", curAff);
}
}
sLog.outString();
sLog.outString("");
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
@@ -254,7 +254,7 @@ extern int main(int argc, char **argv)
sLog.outString("TrinityRealm process priority class set to HIGH");
else
sLog.outError("ERROR: Can't set realmd process priority class.");
sLog.outString();
sLog.outString("");
}
}
#endif
@@ -263,6 +263,15 @@ extern int main(int argc, char **argv)
uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / 100000));
uint32 loopCounter = 0;
// possibly enable db logging; avoid massive startup spam by doing it here.
if (sLog.GetLogDBLater())
{
sLog.outString("Enabling database logging...");
sLog.SetLogDBLater(false);
// login db needs thread for logging
sLog.SetLogDB(true);
}
///- Wait for termination signal
while (!stopEvent)
{
@@ -282,6 +291,7 @@ extern int main(int argc, char **argv)
}
///- Wait for the delay thread to exit
LoginDatabase.ThreadEnd();
LoginDatabase.HaltDelayThread();
///- Remove signal handling before leaving
@@ -312,20 +322,21 @@ void OnSignal(int s)
}
/// Initialize connection to the database
bool StartDB(std::string &dbstring)
bool StartDB()
{
if(!sConfig.GetString("LoginDatabaseInfo", &dbstring))
std::string dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", "");
if(dbstring.empty())
{
sLog.outError("Database not specified");
return false;
}
sLog.outString("Database: %s", dbstring.c_str() );
if(!LoginDatabase.Initialize(dbstring.c_str()))
{
sLog.outError("Cannot connect to database");
return false;
}
LoginDatabase.ThreadStart();
return true;
}
@@ -351,4 +362,3 @@ void UnhookSignals()
}
/// @}

View File

@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
@@ -50,7 +50,6 @@ void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::stri
Realm& realm = m_realms[name];
realm.m_ID = ID;
realm.name = name;
realm.icon = icon;
realm.color = color;
realm.timezone = timezone;
@@ -100,4 +99,3 @@ void RealmList::UpdateRealms(bool init)
delete result;
}
}

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
@@ -30,7 +30,6 @@
/// Storage object for a realm
struct Realm
{
std::string name;
std::string address;
uint8 icon;
uint8 color;
@@ -66,4 +65,3 @@ class RealmList
};
#endif
/// @}

View File

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

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

View File

@@ -25,7 +25,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3dlite", "VC80\g3dlite.vcp
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "VC80\sockets.vcproj", "{04BAF755-0D67-46F8-B1C6-77AE5368F3CB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrinityCore", "VC80\mangosd.vcproj", "{A3A04E47-43A2-4C08-90B3-029CEF558594}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrinityCore", "VC80\TrinityCore.vcproj", "{A3A04E47-43A2-4C08-90B3-029CEF558594}"
ProjectSection(ProjectDependencies) = postProject
{563E9905-3657-460C-AE63-0AC39D162E23} = {563E9905-3657-460C-AE63-0AC39D162E23}
{90297C34-F231-4DF4-848E-A74BCC0E40ED} = {90297C34-F231-4DF4-848E-A74BCC0E40ED}
@@ -33,7 +33,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrinityCore", "VC80\mangosd
{1DC6C4DA-A028-41F3-877D-D5400C594F88} = {1DC6C4DA-A028-41F3-877D-D5400C594F88}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrinityRealm", "VC80\realmd.vcproj", "{563E9905-3657-460C-AE63-0AC39D162E23}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrinityRealm", "VC80\TrinityRealm.vcproj", "{563E9905-3657-460C-AE63-0AC39D162E23}"
ProjectSection(ProjectDependencies) = postProject
{90297C34-F231-4DF4-848E-A74BCC0E40ED} = {90297C34-F231-4DF4-848E-A74BCC0E40ED}
{04BAF755-0D67-46F8-B1C6-77AE5368F3CB} = {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}

View File

@@ -25,7 +25,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3dlite", "VC90\g3dlite.vcp
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "VC90\sockets.vcproj", "{04BAF755-0D67-46F8-B1C6-77AE5368F3CB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrinityCore", "VC90\mangosd.vcproj", "{A3A04E47-43A2-4C08-90B3-029CEF558594}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrinityCore", "VC90\TrinityCore.vcproj", "{A3A04E47-43A2-4C08-90B3-029CEF558594}"
ProjectSection(ProjectDependencies) = postProject
{563E9905-3657-460C-AE63-0AC39D162E23} = {563E9905-3657-460C-AE63-0AC39D162E23}
{90297C34-F231-4DF4-848E-A74BCC0E40ED} = {90297C34-F231-4DF4-848E-A74BCC0E40ED}
@@ -33,7 +33,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrinityCore", "VC90\mangosd
{1DC6C4DA-A028-41F3-877D-D5400C594F88} = {1DC6C4DA-A028-41F3-877D-D5400C594F88}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrinityRealm", "VC90\realmd.vcproj", "{563E9905-3657-460C-AE63-0AC39D162E23}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrinityRealm", "VC90\TrinityRealm.vcproj", "{563E9905-3657-460C-AE63-0AC39D162E23}"
ProjectSection(ProjectDependencies) = postProject
{90297C34-F231-4DF4-848E-A74BCC0E40ED} = {90297C34-F231-4DF4-848E-A74BCC0E40ED}
{04BAF755-0D67-46F8-B1C6-77AE5368F3CB} = {04BAF755-0D67-46F8-B1C6-77AE5368F3CB}