#pragma once //Define for static stuff #define LOGIN_SERVER #define VERSION "0.9.7" //Win32 specific stuff #ifdef WIN32 #pragma comment(lib, "mysqlclient.lib") #pragma comment(lib, "wsock32.lib") #pragma comment(lib, "dbghelp.lib") #define WIN32_LEAN_AND_MEAN #include #include #include #include "mysql.h" #pragma warning( disable : 4996) #endif //OS Neutral Includes #define _LOCAL_DATA_PATH "..\LoginServer\src\LocalData.h" #define LOCAL_DATA_TYPE LOCAL_DATA* #include "../../src/Opcode.h" #include "../../src/Shared.h" #include "../../src/ConfigLoader.h" #include "../../src/PacketMan.h" #include "../../src/ItemDefManager.h" using namespace std; //This is our server configuration. These values should be filled by loading them from a file. struct SERVER_CONFIG { ConfigLoader cl; //Customization of the NetServer's that are used int port; //Port the NetServer should run on unsigned char ip[4]; //IP Address the NetServer should run on bool automaticIp; //Automatically select an ip address for the NetServer unsigned char authorizationPassword[32]; //Password the game server must tell to be considered registered. unsigned short maxGameServers; unsigned long maxPlayers; short icPort; bool detectGameServIp; bool requireValidKey; bool requireValidPassword; bool ignoreNoGameServer; int maxRetryConnects; char serverName[50]; int bfWarningThreshold; int bfBanThreshold; int bfBanLength; int bfCheckInterval; bool lockServerAtStart; bool throttleCpu; int maxLevel; //Not configuration, but related bool serverHasCrashed; }; //Server data struct SERVER_DATA { ItemDefManager itemDefMan; unsigned long freeCharacterID; }; //Server status struct SERVER_STATUS { bool adminLock; int peakPlayers; time_t startTime; SERVER_STATUS() { peakPlayers=0; } }; //Structure used for detecting brute force attacks struct BRUTE_FORCE_TRACK_DATA { unsigned long tries; short networkId; bool admin; unsigned char ip[4]; BRUTE_FORCE_TRACK_DATA() { memset(ip, 0, 4); tries=0; networkId=0; admin=false; } }; extern hash_map gBruteForceTracker; extern hash_map gFileServerOpcodes; extern SERVER_STATUS gServerStatus; extern SERVER_CONFIG gServerConfig; //Configuration for the main NetServer, LoginServer extern MYSQL_SERVER gDatabaseInfo; //Information needed to connect to the database extern PacketMan gPacketManager; extern Server *gpInternalComm; extern Server *gpLoginServer; extern bool gShuttingDown; //Set when the server must start shutting down. extern char gCmdLine[250]; extern SERVER_DATA gData; //Contains static data the server loads. extern bool gShutdownOK; //OK to shutdown if true extern void *gpAppMutex;