2024-12-21 10:04:04 +08:00
# pragma once
enum eURLType
{
_URLTYPE_STRUCTINFO ,
_URLTYPE_RESOURCE ,
_URLTYPE_EXE ,
//_URLTYPE_PARTIAL_RESOURCE,
} ;
struct TURLInfo
{
int nType ;
TCHAR szInfo [ 256 ] ;
} ;
struct TFtpInfo
{
TCHAR szIP [ IPLENMAX ] ;
unsigned short nPort ;
TCHAR szID [ IDLENMAX ] ;
TCHAR szPass [ PASSWORDLENMAX ] ;
std : : vector < TURLInfo > URLList ;
} ;
struct TPartitionInfo
{
TCHAR szPartitionName [ 256 ] ;
int nPID ;
} ;
struct TMonitorUserData
{
char szUserName [ NAMELENMAX ] ;
char szPassWord [ PASSWORDLENMAX ] ;
int nMonitorLevel ; //eServerMonitorLevel
bool bDuplicateLogin ; //<2F> ߺ <EFBFBD> <DFBA> α <EFBFBD> <CEB1> ΰ<EFBFBD> <CEB0> <EFBFBD>
} ;
//<2F> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> xml<6D> <6C> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> ε常 <20> ϴ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> ü <20> ̰<EFBFBD> <CCB0> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> Ÿ<EFBFBD> <C5B8> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> ϰ<EFBFBD> <20> ȴ<EFBFBD> .
struct TStructSocketMax
{
int nSocketMax ; //Client Accept<70> <74> <20> ִ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> Ǯ <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
void InitSocketMax ( )
{
nSocketMax = 3000 ;
}
} ;
struct TDolbyAxon
{
int nDolbyWorldID ;
WCHAR wszPrivateDolbyIP [ IPLENMAX ] ;
WCHAR wszPublicDolbyIP [ IPLENMAX ] ;
int nDolbyAPort ;
int nDolbyCPort ;
TDolbyAxon ( )
{
nDolbyWorldID = 0 ;
memset ( wszPrivateDolbyIP , 0 , sizeof ( wszPrivateDolbyIP ) ) ;
memset ( wszPublicDolbyIP , 0 , sizeof ( wszPublicDolbyIP ) ) ;
nDolbyAPort = 0 ;
nDolbyCPort = 0 ;
}
} ;
struct TStructDolbyAxon
{
std : : vector < TDolbyAxon > vDolbyAxonInfo ;
void InitDolbyAxon ( )
{
vDolbyAxonInfo . clear ( ) ;
}
} ;
struct TStructDBMiddleWare
{
int nDBMiddleWareAcceptPort ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> ̵<EFBFBD> <CCB5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> (<28> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )<29> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> Ʈ
void InitDBMiddleWare ( )
{
nDBMiddleWareAcceptPort = 0 ;
}
} ;
struct TStructLogServer
{
int nLogServerAcceptPort ; //<2F> α <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> Ʈ
void InitLogServer ( )
{
nLogServerAcceptPort = 0 ;
}
} ;
struct TStructLoginServer
{
int nLoginMasterAcceptPort ; //<2F> α <EFBFBD> <CEB1> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> Ʈ
int nLoginClientAcceptPort ; //<2F> α <EFBFBD> <CEB1> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŭ<> <C5AC> <EFBFBD> ̾<EFBFBD> Ʈ <20> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> Ʈ
void InitLoginServer ( )
{
nLoginClientAcceptPort = 0 ;
nLoginMasterAcceptPort = 0 ;
}
} ;
struct TStructMasterServer
{
int nMasterVillageAcceptPort ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> Ʈ
int nMasterGameAcceptPort ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> Ʈ
void InitMasterServer ( )
{
nMasterGameAcceptPort = 0 ;
nMasterVillageAcceptPort = 0 ;
}
} ;
struct TStructVillageServer
{
int nVillageID ; //<2F> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> õ<EFBFBD> <C3B5> <EFBFBD> <20> ʴ´ <CAB4> .
int nVillageClientAcceptPort ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŭ<> <C5AC> <EFBFBD> ̾<EFBFBD> Ʈ <20> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> Ʈ
int nCombineWorld ;
void InitVillageServer ( )
{
nVillageID = 0 ;
nVillageClientAcceptPort = 0 ;
nCombineWorld = 0 ;
}
} ;
struct TStructGameServer
{
bool bPreLoad ; //<2F> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ִ<EFBFBD> .
int nGameClientAcceptUDPPort ; //<2F> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŭ<> <C5AC> <EFBFBD> ̾<EFBFBD> Ʈ UDP<44> <50> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> Ʈ
int nGameClientAcceptTCPPort ; //<2F> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŭ<> <C5AC> <EFBFBD> ̾<EFBFBD> Ʈ TCP<43> <50> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> Ʈ
int nGameAffinityType ; //<2F> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> <20> <> <EFBFBD> ̺긮<CCBA> <EAB8AE>
bool bGameWorldCombine ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> հ <EFBFBD> <D5B0> ӷ<EFBFBD>
void InitGameServer ( )
{
bPreLoad = true ;
nGameClientAcceptTCPPort = 0 ;
nGameClientAcceptUDPPort = 0 ;
nGameAffinityType = 1 ;
bGameWorldCombine = false ;
}
} ;
struct TStructCashServer
{
int nCashAcceptPort ; //ij<> ü<EFBFBD> <C3BC> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> Ʈ<EFBFBD> <C6AE> Ʈ
void InitCashServer ( )
{
nCashAcceptPort = 0 ;
}
} ;
struct TDefaultServerInfo : public TStructSocketMax ,
TStructDBMiddleWare ,
TStructLogServer ,
TStructLoginServer ,
TStructMasterServer ,
TStructVillageServer ,
TStructGameServer ,
TStructCashServer ,
TStructDolbyAxon
{
TDefaultServerInfo : : TDefaultServerInfo ( )
{
Init ( ) ;
}
void Init ( )
{
InitSocketMax ( ) ;
InitDBMiddleWare ( ) ;
InitLogServer ( ) ;
InitLoginServer ( ) ;
InitMasterServer ( ) ;
InitVillageServer ( ) ;
InitGameServer ( ) ;
InitCashServer ( ) ;
InitDolbyAxon ( ) ;
}
} ;
struct TSQLConnectionInfo
{
int nPort ;
WCHAR wszIP [ IPLENMAX ] ;
WCHAR wszDBID [ IDLENMAX ] ;
WCHAR wszDBName [ DBNAMELENMAX ] ;
} ;
struct TDoorsConnectionInfo
{
int nPort ;
WCHAR wszIP [ IPLENMAX ] ;
} ;
struct TDefaultDatabaseInfo
{
TSQLConnectionInfo MemberShipDB ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ؼ<EFBFBD> <D8BC> <EFBFBD> <20> ϳ <EFBFBD> <CFB3> ̴<EFBFBD> .
TSQLConnectionInfo ServerLogDB ; //<2F> α <CEB1> <D7B5> <EFBFBD> <EFBFBD> <EFBFBD> <20> ϳ <EFBFBD> <CFB3> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> Ѵ <EFBFBD> .
std : : map < int , TSQLConnectionInfo > WorldDB ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ؼ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> ´ <EFBFBD> . first key = worldid
void Init ( )
{
memset ( & MemberShipDB , 0 , sizeof ( TSQLConnectionInfo ) ) ;
memset ( & ServerLogDB , 0 , sizeof ( TSQLConnectionInfo ) ) ;
WorldDB . clear ( ) ;
}
} ;
struct TSIDBaseConnectionInfo
{
int nType ;
int nSID ;
} ;
struct TDefaultServerConstructData
{
int nSID ;
WCHAR wszType [ 16 ] ;
int nServerType ;
int nAssignedLauncher ;
WCHAR wszExcutePath [ MAX_PATH ] ;
WCHAR wszExcuteFile [ EXCUTELENMAX ] ;
int nForServerType ; //sid base dbconnection<6F> <6E> <20> ڵ<EFBFBD> <DAB5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ϱ <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
int nServerNo ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> ѹ<EFBFBD> (ij<> ÿ<EFBFBD> : Ÿ <20> <> <EFBFBD> <EFBFBD> <20> ʿ<EFBFBD> <CABF> <EFBFBD> Ȯ<> 尡<EFBFBD> <E5B0A1> )
std : : vector < int > nWorldIDList ;
std : : vector < TSIDBaseConnectionInfo > SIDConnectionList ;
} ;
struct TDBMiddleWareConstructData : public TDefaultServerConstructData , TStructDBMiddleWare
{
TDBMiddleWareConstructData ( )
{
InitDBMiddleWare ( ) ;
}
} ;
struct TLoginServerConstructData : public TDefaultServerConstructData , TStructLoginServer , TStructSocketMax
{
TLoginServerConstructData ( )
{
InitSocketMax ( ) ;
InitLoginServer ( ) ;
}
} ;
struct TMasterServerConstructData : public TDefaultServerConstructData , TStructMasterServer , TStructSocketMax
{
TMasterServerConstructData ( )
{
InitSocketMax ( ) ;
InitMasterServer ( ) ;
}
} ;
struct TGameServerConstructData : public TDefaultServerConstructData , TStructGameServer , TStructSocketMax
{
TGameServerConstructData ( )
{
InitSocketMax ( ) ;
InitGameServer ( ) ;
}
} ;
struct TVillageServerConstructData : public TDefaultServerConstructData , TStructVillageServer , TStructSocketMax
{
TVillageServerConstructData ( )
{
InitSocketMax ( ) ;
InitVillageServer ( ) ;
}
} ;
struct TLogServerConstructData : public TDefaultServerConstructData , TStructLogServer
{
TLogServerConstructData ( )
{
InitLogServer ( ) ;
}
} ;
struct TCashServerConstructData : public TDefaultServerConstructData , TStructCashServer
{
TCashServerConstructData ( )
{
InitCashServer ( ) ;
}
} ;
struct TPreServerStructData
{
std : : map < int , TDefaultServerConstructData * > PreStructList ;
} ;
struct TServerExcuteData
{
int nSID ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> Ǵ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ȣ
WCHAR wszType [ 8 ] ;
int nPatchType ;
int nServerType ;
int nAssignedLauncherID ;
int nCreateCount ;
int nCreateIndex ;
std : : wstring wstrExcuteData ;
TServerExcuteData ( )
{
nSID = 0 ;
memset ( wszType , 0 , sizeof ( wszType ) ) ;
nServerType = 0 ;
nAssignedLauncherID = 0 ;
nCreateCount = 0 ;
nCreateIndex = 0 ;
nPatchType = - 1 ;
}
} ;
struct TNetLauncher
{
int nWID ; //<2F> <> <EFBFBD> ӵǴ<D3B5> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> ̵<EFBFBD>
int nPID ; //<2F> <> <EFBFBD> ӵǴ<D3B5> <20> <> Ƽ <EFBFBD> <C6BC> <20> <> <EFBFBD> ̵<EFBFBD>
int nID ;
TCHAR szIP [ IPLENMAX ] ;
WCHAR wszPublicIP [ IPLENMAX ] ;
unsigned long nIP ;
std : : vector < TServerExcuteData * > ExcuteList ;
} ;
struct tMonitorChannelInfo
{
int nWorldID ;
int nManagedID ;
sChannelInfo Info ;
} ;
//for convert
struct TNetExcuteCommand
{
int nSID ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> Ǵ<EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ȣ
TCHAR szType [ 8 ] ;
char cType ;
int nAssignedLauncherID ;
WCHAR szExcuteFile [ EXCUTELENMAX ] ;
WCHAR szCmd [ EXCUTECMDMAX ] ;
std : : vector < std : : pair < int , std : : wstring > > strConList ;
int nWorldID ;
int nFor ;
int nVillageID ;
//for dbserver
std : : vector < std : : pair < int , int > > vAssignedTypeList ;
int nAssingedType ;
TNetExcuteCommand ( )
{
nSID = 0 ;
memset ( szType , 0 , sizeof ( szType ) ) ;
cType = 0 ;
nAssignedLauncherID = 0 ;
memset ( szExcuteFile , 0 , sizeof ( szExcuteFile ) ) ;
memset ( szCmd , 0 , sizeof ( szCmd ) ) ;
nWorldID = 0 ;
nFor = MANAGED_TYPE_NONE ;
nAssingedType = 0 ;
nVillageID = 0 ;
}
} ;
struct TWorldConnectionInfo
{
int nWorldID ;
int nVillagePort ;
int nGamePort ;
WCHAR wszIP [ IPLENMAX ] ;
} ;
# include "DNDataManagerBase.h"
class CDataManager : public CDNDataManagerBase
{
public :
CDataManager ( ) ;
~ CDataManager ( ) ;
static CDataManager * GetInstance ( ) ;
bool LoadUser ( ) ;
bool LoadStruct ( ) ;
bool ConvertStruct ( ) ;
bool LoadServerConstructData ( ) ;
bool SaveUser ( ) ;
int ChangeUserPassword ( TChangePassword * pData ) ;
int VerifyNetLauncher ( unsigned long nIP ) ;
int GetLauncherCount ( ) { return ( int ) m_NetLauncherList . size ( ) ; }
const TCHAR * GetIP ( ) { return m_szServiceIP ; }
const TNetLauncher * GetLauncherInfo ( unsigned int nIP ) ;
const TNetLauncher * GetLauncherInfobyID ( int nNID ) ;
bool IsNeedOtherExcutePath ( int nID ) ;
int GetLauncherCnt ( ) { return ( int ) m_NetLauncherList . size ( ) ; }
void SetLauncherPublicIP ( int nID , char * szPublicIP ) ;
void GetLauncherIds ( std : : vector < TNetLauncherInfo > * pList ) ;
void GetLauncherIds ( std : : map < int , TNetLauncherInfo > * pList ) ;
void GetAssingedPatchTypeList ( int nID , std : : list < char > * pList ) ;
int GetAssignedCreateLastIndex ( int nID , const TCHAR * pType ) ;
void SetAssignedCreateCount ( int nID , const TCHAR * pType , int nCreateCount ) ;
void GetCommandList ( std : : vector < int > * pvList ) ;
void GetCommandListByPID ( int nPID , std : : vector < int > * pvList ) ;
void GetExeCommandList ( int nNID , std : : vector < TServerExcuteData > * pvList ) ;
const TServerExcuteData * GetCommand ( int nSID ) ;
//
bool CheckMonitorUser ( const char * pName , const char * pPass , int & nLevel , bool & bCanDuplicate ) ;
inline WCHAR * GetDoorsIP ( void ) { return m_DoorsInfo . wszIP ; }
inline int GetDoorsPort ( void ) { return m_DoorsInfo . nPort ; }
# if defined (_SERVICEMANAGER_EX)
public :
void GetPartitionList ( OUT vector < const TPartitionInfo * > & list ) const ;
void GetWorldList ( OUT vector < const TServerInfo * > & list ) const ;
void GetLauncherList ( OUT vector < const TNetLauncher * > & list ) const ;
void GetPartitionText ( OUT wchar_t text [ 256 ] ) const ;
const TDefaultServerInfo & GetDefaultServerInfo ( ) const { return m_DefaultServerConstructInfo ; }
const TDefaultDatabaseInfo & GetDefaultDatabaseInfo ( ) const { return m_DefaultSQLData ; }
# endif // #if defined (_SERVICEMANAGER_EX)
bool IsFirstGameCon ( int nSID ) ;
private :
map < unsigned long , TNetLauncher * > m_NetLauncherList ;
map < int , TPartitionInfo * > m_PartitionList ;
vector < TMonitorUserData > m_MonitorUserData ;
TDefaultServerInfo m_DefaultServerConstructInfo ;
TDefaultDatabaseInfo m_DefaultSQLData ;
TPreServerStructData m_PreServerStructData ;
vector < int > m_vWorldList ;
TDoorsConnectionInfo m_DoorsInfo ;
map < int , TServerExcuteData > m_ServerExcuteData ;
bool ConstructServerStruct ( ) ;
void ClearPreConstructData ( ) ;
void GetServerCountFromPreconstruct ( int nWorldID , int nType , vector < const TDefaultServerConstructData * > & vConstDatalist ) ;
int GetAssingedUserCount ( int nWorldID , int nVillageID ) ;
void MakeWord ( const TDefaultServerConstructData * pConstruct , wstring & wstrMark , int nCreateIndex , int nCreateCount ) ;
void MakeDBConInfo ( const TSQLConnectionInfo * pInfo , wstring & wstrOut ) ;
void MakeWorldDBConInfo ( vector < int > & vWorldIDs , wstring & wstrOut ) ;
bool MakeConInfo ( int nType , int nSID , wstring & wstr , bool bCalledGame = false , vector < int > * pvWorldID = NULL ) ;
void MakeDolbyInfo ( int nWorldID , wstring & wstr ) ;
bool MakeFirstGameCon ( wstring & wstr , int & nFarmServerID ) ;
TCHAR m_szServiceIP [ IPLENMAX ] ;
USHORT m_nServicePort ;
void ClearData ( ) ;
void ClearUserData ( ) ;
void CheckChannelInfo ( ) const ;
} ;