Browse Source

Minigame Server hinzugefügt

Kolja Strohm 6 years ago
parent
commit
094ed32242
4 changed files with 119 additions and 337 deletions
  1. 59 304
      MainServer/Datenbank.cpp
  2. 3 10
      MainServer/Datenbank.h
  3. 47 17
      MainServer/MainServer.cpp
  4. 10 6
      MainServer/MainServer.vcxproj

+ 59 - 304
MainServer/Datenbank.cpp

@@ -141,7 +141,7 @@ bool MSDatenbank::proveRegisteredClient( unsigned int num )
 	return ret;
 }
 
-int *MSDatenbank::unregisterClient( unsigned int num )
+int *MSDatenbank::unregisterClient( unsigned int num, int *len )
 {
 	Text *befehl = new Text( "SELECT unregister_client( " );
 	befehl->append( num );
@@ -156,6 +156,13 @@ int *MSDatenbank::unregisterClient( unsigned int num )
 	Result res = datenbank->getResult();
 	unlock();
 	befehl->release();
+	if( len )
+		*len = res.zeilenAnzahl;
+	if( !res.zeilenAnzahl )
+	{
+		res.destroy();
+		return 0;
+	}
 	int *ret = new int[ res.zeilenAnzahl ];
 	for( int i = 0; i < res.zeilenAnzahl; i++ )
 		ret[ i ] = TextZuInt( res.values[ i ].getText(), 10 );
@@ -183,40 +190,6 @@ int MSDatenbank::suchPatchServer( unsigned int client )
 	return ret;
 }
 
-unsigned char *MSDatenbank::getPatchServerPortIp( int num )
-{
-	Text *befehl = new Text( "SELECT port, ip FROM server WHERE id = " );
-	befehl->append( num );
-	lock();
-	if( !datenbank->befehl( befehl->getText() ) )
-	{
-		unlock();
-		befehl->release();
-		return 0;
-	}
-	befehl->release();
-	Result res = datenbank->getResult();
-	unlock();
-	unsigned short port = (unsigned short)TextZuInt( res.values[ 0 ].getText(), 10 );
-	Text *ip1 = res.values[ 1 ].getTeilText( 0, res.values[ 1 ].positionVon( '.', 0 ) );
-	Text *ip2 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 0 ) + 1, res.values[ 1 ].positionVon( '.', 1 ) );
-	Text *ip3 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 1 ) + 1, res.values[ 1 ].positionVon( '.', 2 ) );
-	Text *ip4 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 2 ) + 1 );
-	res.destroy();
-	unsigned char *ret = new unsigned char[ 6 ];
-	ret[ 0 ] = (unsigned char)TextZuInt( ip1->getText(), 10 );
-	ret[ 1 ] = (unsigned char)TextZuInt( ip2->getText(), 10 );
-	ret[ 2 ] = (unsigned char)TextZuInt( ip3->getText(), 10 );
-	ret[ 3 ] = (unsigned char)TextZuInt( ip4->getText(), 10 );
-	ret[ 4 ] = (unsigned char)( port & 0xFF );
-	ret[ 5 ] = (unsigned char)( port >> 8 );
-	ip1->release();
-	ip2->release();
-	ip3->release();
-	ip4->release();
-	return ret;
-}
-
 int MSDatenbank::suchRegisterServer( unsigned int client )
 {
 	Text *befehl = new Text( "SELECT such_server( " );
@@ -237,40 +210,6 @@ int MSDatenbank::suchRegisterServer( unsigned int client )
 	return ret;
 }
 
-unsigned char *MSDatenbank::getRegisterServerPortIp( int num )
-{
-	Text *befehl = new Text( "SELECT port, ip FROM server WHERE id = " );
-	befehl->append( num );
-	lock();
-	if( !datenbank->befehl( befehl->getText() ) )
-	{
-		unlock();
-		befehl->release();
-		return 0;
-	}
-	befehl->release();
-	Result res = datenbank->getResult();
-	unlock();
-	unsigned short port = (unsigned short)TextZuInt( res.values[ 0 ].getText(), 10 );
-	Text *ip1 = res.values[ 1 ].getTeilText( 0, res.values[ 1 ].positionVon( '.', 0 ) );
-	Text *ip2 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 0 ) + 1, res.values[ 1 ].positionVon( '.', 1 ) );
-	Text *ip3 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 1 ) + 1, res.values[ 1 ].positionVon( '.', 2 ) );
-	Text *ip4 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 2 ) + 1 );
-	res.destroy();
-	unsigned char *ret = new unsigned char[ 6 ];
-	ret[ 0 ] = (unsigned char)TextZuInt( ip1->getText(), 10 );
-	ret[ 1 ] = (unsigned char)TextZuInt( ip2->getText(), 10 );
-	ret[ 2 ] = (unsigned char)TextZuInt( ip3->getText(), 10 );
-	ret[ 3 ] = (unsigned char)TextZuInt( ip4->getText(), 10 );
-	ret[ 4 ] = (unsigned char)( port & 0xFF );
-	ret[ 5 ] = (unsigned char)( port >> 8 );
-	ip1->release();
-	ip2->release();
-	ip3->release();
-	ip4->release();
-	return ret;
-}
-
 int MSDatenbank::suchLoginServer( unsigned int client )
 {
 	Text *befehl = new Text( "SELECT such_server( " );
@@ -291,40 +230,6 @@ int MSDatenbank::suchLoginServer( unsigned int client )
 	return ret;
 }
 
-unsigned char *MSDatenbank::getLoginServerPortIp( int num )
-{
-	Text *befehl = new Text( "SELECT port, ip FROM server WHERE id = " );
-	befehl->append( num );
-	lock();
-	if( !datenbank->befehl( befehl->getText() ) )
-	{
-		unlock();
-		befehl->release();
-		return 0;
-	}
-	befehl->release();
-	Result res = datenbank->getResult();
-	unlock();
-	unsigned short port = (unsigned short)TextZuInt( res.values[ 0 ].getText(), 10 );
-	Text *ip1 = res.values[ 1 ].getTeilText( 0, res.values[ 1 ].positionVon( '.', 0 ) );
-	Text *ip2 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 0 ) + 1, res.values[ 1 ].positionVon( '.', 1 ) );
-	Text *ip3 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 1 ) + 1, res.values[ 1 ].positionVon( '.', 2 ) );
-	Text *ip4 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 2 ) + 1 );
-	res.destroy();
-	unsigned char *ret = new unsigned char[ 6 ];
-	ret[ 0 ] = (unsigned char)TextZuInt( ip1->getText(), 10 );
-	ret[ 1 ] = (unsigned char)TextZuInt( ip2->getText(), 10 );
-	ret[ 2 ] = (unsigned char)TextZuInt( ip3->getText(), 10 );
-	ret[ 3 ] = (unsigned char)TextZuInt( ip4->getText(), 10 );
-	ret[ 4 ] = (unsigned char)( port & 0xFF );
-	ret[ 5 ] = (unsigned char)( port >> 8 );
-	ip1->release();
-	ip2->release();
-	ip3->release();
-	ip4->release();
-	return ret;
-}
-
 int MSDatenbank::suchInformationServer( unsigned int client )
 {
 	Text *befehl = new Text( "SELECT such_server( " );
@@ -345,40 +250,6 @@ int MSDatenbank::suchInformationServer( unsigned int client )
 	return ret;
 }
 
-unsigned char *MSDatenbank::getInformationServerPortIp( int num )
-{
-	Text *befehl = new Text( "SELECT port, ip FROM server WHERE id = " );
-	befehl->append( num );
-	lock();
-	if( !datenbank->befehl( befehl->getText() ) )
-	{
-		unlock();
-		befehl->release();
-		return 0;
-	}
-	befehl->release();
-	Result res = datenbank->getResult();
-	unlock();
-	unsigned short port = (unsigned short)TextZuInt( res.values[ 0 ].getText(), 10 );
-	Text *ip1 = res.values[ 1 ].getTeilText( 0, res.values[ 1 ].positionVon( '.', 0 ) );
-	Text *ip2 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 0 ) + 1, res.values[ 1 ].positionVon( '.', 1 ) );
-	Text *ip3 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 1 ) + 1, res.values[ 1 ].positionVon( '.', 2 ) );
-	Text *ip4 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 2 ) + 1 );
-	res.destroy();
-	unsigned char *ret = new unsigned char[ 6 ];
-	ret[ 0 ] = (unsigned char)TextZuInt( ip1->getText(), 10 );
-	ret[ 1 ] = (unsigned char)TextZuInt( ip2->getText(), 10 );
-	ret[ 2 ] = (unsigned char)TextZuInt( ip3->getText(), 10 );
-	ret[ 3 ] = (unsigned char)TextZuInt( ip4->getText(), 10 );
-	ret[ 4 ] = (unsigned char)( port & 0xFF );
-	ret[ 5 ] = (unsigned char)( port >> 8 );
-	ip1->release();
-	ip2->release();
-	ip3->release();
-	ip4->release();
-	return ret;
-}
-
 int MSDatenbank::suchChatServer( unsigned int client )
 {
 	Text *befehl = new Text( "SELECT such_server( " );
@@ -399,40 +270,6 @@ int MSDatenbank::suchChatServer( unsigned int client )
 	return ret;
 }
 
-unsigned char *MSDatenbank::getChatServerPortIp( int num )
-{
-	Text *befehl = new Text( "SELECT port, ip FROM server WHERE id = " );
-	befehl->append( num );
-	lock();
-	if( !datenbank->befehl( befehl->getText() ) )
-	{
-		unlock();
-		befehl->release();
-		return 0;
-	}
-	befehl->release();
-	Result res = datenbank->getResult();
-	unlock();
-	unsigned short port = (unsigned short)TextZuInt( res.values[ 0 ].getText(), 10 );
-	Text *ip1 = res.values[ 1 ].getTeilText( 0, res.values[ 1 ].positionVon( '.', 0 ) );
-	Text *ip2 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 0 ) + 1, res.values[ 1 ].positionVon( '.', 1 ) );
-	Text *ip3 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 1 ) + 1, res.values[ 1 ].positionVon( '.', 2 ) );
-	Text *ip4 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 2 ) + 1 );
-	res.destroy();
-	unsigned char *ret = new unsigned char[ 6 ];
-	ret[ 0 ] = (unsigned char)TextZuInt( ip1->getText(), 10 );
-	ret[ 1 ] = (unsigned char)TextZuInt( ip2->getText(), 10 );
-	ret[ 2 ] = (unsigned char)TextZuInt( ip3->getText(), 10 );
-	ret[ 3 ] = (unsigned char)TextZuInt( ip4->getText(), 10 );
-	ret[ 4 ] = (unsigned char)( port & 0xFF );
-	ret[ 5 ] = (unsigned char)( port >> 8 );
-	ip1->release();
-	ip2->release();
-	ip3->release();
-	ip4->release();
-	return ret;
-}
-
 int MSDatenbank::suchAnmeldungServer( unsigned int client )
 {
 	Text *befehl = new Text( "SELECT such_server( " );
@@ -453,40 +290,6 @@ int MSDatenbank::suchAnmeldungServer( unsigned int client )
 	return ret;
 }
 
-unsigned char *MSDatenbank::getAnmeldungServerPortIp( int num )
-{
-	Text *befehl = new Text( "SELECT port, ip FROM server WHERE id = " );
-	befehl->append( num );
-	lock();
-	if( !datenbank->befehl( befehl->getText() ) )
-	{
-		unlock();
-		befehl->release();
-		return 0;
-	}
-	befehl->release();
-	Result res = datenbank->getResult();
-	unlock();
-	unsigned short port = (unsigned short)TextZuInt( res.values[ 0 ].getText(), 10 );
-	Text *ip1 = res.values[ 1 ].getTeilText( 0, res.values[ 1 ].positionVon( '.', 0 ) );
-	Text *ip2 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 0 ) + 1, res.values[ 1 ].positionVon( '.', 1 ) );
-	Text *ip3 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 1 ) + 1, res.values[ 1 ].positionVon( '.', 2 ) );
-	Text *ip4 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 2 ) + 1 );
-	res.destroy();
-	unsigned char *ret = new unsigned char[ 6 ];
-	ret[ 0 ] = (unsigned char)TextZuInt( ip1->getText(), 10 );
-	ret[ 1 ] = (unsigned char)TextZuInt( ip2->getText(), 10 );
-	ret[ 2 ] = (unsigned char)TextZuInt( ip3->getText(), 10 );
-	ret[ 3 ] = (unsigned char)TextZuInt( ip4->getText(), 10 );
-	ret[ 4 ] = (unsigned char)( port & 0xFF );
-	ret[ 5 ] = (unsigned char)( port >> 8 );
-	ip1->release();
-	ip2->release();
-	ip3->release();
-	ip4->release();
-	return ret;
-}
-
 int MSDatenbank::suchErhaltungServer( unsigned int client )
 {
 	Text *befehl = new Text( "SELECT such_server( " );
@@ -507,40 +310,6 @@ int MSDatenbank::suchErhaltungServer( unsigned int client )
 	return ret;
 }
 
-unsigned char *MSDatenbank::getErhaltungServerPortIp( int num )
-{
-	Text *befehl = new Text( "SELECT port, ip FROM server WHERE id = " );
-	befehl->append( num );
-	lock();
-	if( !datenbank->befehl( befehl->getText() ) )
-	{
-		unlock();
-		befehl->release();
-		return 0;
-	}
-	befehl->release();
-	Result res = datenbank->getResult();
-	unlock();
-	unsigned short port = (unsigned short)TextZuInt( res.values[ 0 ].getText(), 10 );
-	Text *ip1 = res.values[ 1 ].getTeilText( 0, res.values[ 1 ].positionVon( '.', 0 ) );
-	Text *ip2 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 0 ) + 1, res.values[ 1 ].positionVon( '.', 1 ) );
-	Text *ip3 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 1 ) + 1, res.values[ 1 ].positionVon( '.', 2 ) );
-	Text *ip4 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 2 ) + 1 );
-	res.destroy();
-	unsigned char *ret = new unsigned char[ 6 ];
-	ret[ 0 ] = (unsigned char)TextZuInt( ip1->getText(), 10 );
-	ret[ 1 ] = (unsigned char)TextZuInt( ip2->getText(), 10 );
-	ret[ 2 ] = (unsigned char)TextZuInt( ip3->getText(), 10 );
-	ret[ 3 ] = (unsigned char)TextZuInt( ip4->getText(), 10 );
-	ret[ 4 ] = (unsigned char)( port & 0xFF );
-	ret[ 5 ] = (unsigned char)( port >> 8 );
-	ip1->release();
-	ip2->release();
-	ip3->release();
-	ip4->release();
-	return ret;
-}
-
 int MSDatenbank::suchShopServer( unsigned int client )
 {
 	Text *befehl = new Text( "SELECT such_server( " );
@@ -561,40 +330,6 @@ int MSDatenbank::suchShopServer( unsigned int client )
 	return ret;
 }
 
-unsigned char *MSDatenbank::getShopServerPortIp( int num )
-{
-	Text *befehl = new Text( "SELECT port, ip FROM server WHERE id = " );
-	befehl->append( num );
-	lock();
-	if( !datenbank->befehl( befehl->getText() ) )
-	{
-		unlock();
-		befehl->release();
-		return 0;
-	}
-	befehl->release();
-	Result res = datenbank->getResult();
-	unlock();
-	unsigned short port = (unsigned short)TextZuInt( res.values[ 0 ].getText(), 10 );
-	Text *ip1 = res.values[ 1 ].getTeilText( 0, res.values[ 1 ].positionVon( '.', 0 ) );
-	Text *ip2 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 0 ) + 1, res.values[ 1 ].positionVon( '.', 1 ) );
-	Text *ip3 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 1 ) + 1, res.values[ 1 ].positionVon( '.', 2 ) );
-	Text *ip4 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 2 ) + 1 );
-	res.destroy();
-	unsigned char *ret = new unsigned char[ 6 ];
-	ret[ 0 ] = (unsigned char)TextZuInt( ip1->getText(), 10 );
-	ret[ 1 ] = (unsigned char)TextZuInt( ip2->getText(), 10 );
-	ret[ 2 ] = (unsigned char)TextZuInt( ip3->getText(), 10 );
-	ret[ 3 ] = (unsigned char)TextZuInt( ip4->getText(), 10 );
-	ret[ 4 ] = (unsigned char)( port & 0xFF );
-	ret[ 5 ] = (unsigned char)( port >> 8 );
-	ip1->release();
-	ip2->release();
-	ip3->release();
-	ip4->release();
-	return ret;
-}
-
 int MSDatenbank::suchNewsServer( unsigned int client )
 {
 	Text *befehl = new Text( "SELECT such_server( " );
@@ -615,38 +350,58 @@ int MSDatenbank::suchNewsServer( unsigned int client )
 	return ret;
 }
 
-unsigned char *MSDatenbank::getNewsServerPortIp( int num )
+int MSDatenbank::suchMinigameServer( unsigned int client )
 {
-	Text *befehl = new Text( "SELECT port, ip FROM server WHERE id = " );
-	befehl->append( num );
-	lock();
-	if( !datenbank->befehl( befehl->getText() ) )
-	{
-		unlock();
-		befehl->release();
-		return 0;
-	}
-	befehl->release();
-	Result res = datenbank->getResult();
-	unlock();
-	unsigned short port = (unsigned short)TextZuInt( res.values[ 0 ].getText(), 10 );
-	Text *ip1 = res.values[ 1 ].getTeilText( 0, res.values[ 1 ].positionVon( '.', 0 ) );
-	Text *ip2 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 0 ) + 1, res.values[ 1 ].positionVon( '.', 1 ) );
-	Text *ip3 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 1 ) + 1, res.values[ 1 ].positionVon( '.', 2 ) );
-	Text *ip4 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 2 ) + 1 );
-	res.destroy();
-	unsigned char *ret = new unsigned char[ 6 ];
-	ret[ 0 ] = (unsigned char)TextZuInt( ip1->getText(), 10 );
-	ret[ 1 ] = (unsigned char)TextZuInt( ip2->getText(), 10 );
-	ret[ 2 ] = (unsigned char)TextZuInt( ip3->getText(), 10 );
-	ret[ 3 ] = (unsigned char)TextZuInt( ip4->getText(), 10 );
-	ret[ 4 ] = (unsigned char)( port & 0xFF );
-	ret[ 5 ] = (unsigned char)( port >> 8 );
-	ip1->release();
-	ip2->release();
-	ip3->release();
-	ip4->release();
-	return ret;
+    Text *befehl = new Text( "SELECT such_server( " );
+    befehl->append( client );
+    befehl->append( ", 'minigame' )" );
+    lock();
+    if( !datenbank->befehl( befehl->getText() ) )
+    {
+        unlock();
+        befehl->release();
+        return 0;
+    }
+    befehl->release();
+    Result res = datenbank->getResult();
+    unlock();
+    int ret = TextZuInt( res.values[ 0 ].getText(), 10 );
+    res.destroy();
+    return ret;
+}
+
+unsigned char *MSDatenbank::getServerPortIp( int sId )
+{
+    Text *befehl = new Text( "SELECT port, ip FROM server WHERE id = " );
+    befehl->append( sId );
+    lock();
+    if( !datenbank->befehl( befehl->getText() ) )
+    {
+        unlock();
+        befehl->release();
+        return 0;
+    }
+    befehl->release();
+    Result res = datenbank->getResult();
+    unlock();
+    unsigned short port = (unsigned short)TextZuInt( res.values[ 0 ].getText(), 10 );
+    Text *ip1 = res.values[ 1 ].getTeilText( 0, res.values[ 1 ].positionVon( '.', 0 ) );
+    Text *ip2 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 0 ) + 1, res.values[ 1 ].positionVon( '.', 1 ) );
+    Text *ip3 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 1 ) + 1, res.values[ 1 ].positionVon( '.', 2 ) );
+    Text *ip4 = res.values[ 1 ].getTeilText( res.values[ 1 ].positionVon( '.', 2 ) + 1 );
+    res.destroy();
+    unsigned char *ret = new unsigned char[ 6 ];
+    ret[ 0 ] = (unsigned char)TextZuInt( ip1->getText(), 10 );
+    ret[ 1 ] = (unsigned char)TextZuInt( ip2->getText(), 10 );
+    ret[ 2 ] = (unsigned char)TextZuInt( ip3->getText(), 10 );
+    ret[ 3 ] = (unsigned char)TextZuInt( ip4->getText(), 10 );
+    ret[ 4 ] = (unsigned char)( port & 0xFF );
+    ret[ 5 ] = (unsigned char)( port >> 8 );
+    ip1->release();
+    ip2->release();
+    ip3->release();
+    ip4->release();
+    return ret;
 }
 
 int MSDatenbank::logoutKlient( int klientId, Array< int > *ret )

+ 3 - 10
MainServer/Datenbank.h

@@ -34,25 +34,18 @@ public:
 	unsigned int getNextClientId();
 	Text *getKlientKey( int cId );
 	bool proveRegisteredClient( unsigned int num );
-	int *unregisterClient( unsigned int num );
+	int *unregisterClient( unsigned int num, int *len);
 	int suchPatchServer( unsigned int client );
-	unsigned char *getPatchServerPortIp( int num );
 	int suchRegisterServer( unsigned int client );
-	unsigned char *getRegisterServerPortIp( int num );
 	int suchLoginServer( unsigned int client );
-	unsigned char *getLoginServerPortIp( int num );
 	int suchInformationServer( unsigned int client );
-	unsigned char *getInformationServerPortIp( int num );
 	int suchChatServer( unsigned int client );
-	unsigned char *getChatServerPortIp( int num );
 	int suchAnmeldungServer( unsigned int client );
-	unsigned char *getAnmeldungServerPortIp( int num );
 	int suchErhaltungServer( unsigned int client );
-	unsigned char *getErhaltungServerPortIp( int num );
 	int suchShopServer( unsigned int client );
-	unsigned char *getShopServerPortIp( int num );
 	int suchNewsServer( unsigned int client );
-	unsigned char *getNewsServerPortIp( int num );
+    int suchMinigameServer( unsigned int client );
+    unsigned char *getServerPortIp( int sId );
 	int logoutKlient( int klientId, Array< int > *ret );
 	bool getSpielServerPortIp( int spielErstelltId, unsigned short *port, Text *ip );
 	int getSpielerAusGruppe( int gruppeId, Array< int > *accountId );

+ 47 - 17
MainServer/MainServer.cpp

@@ -491,7 +491,7 @@ void MSKlient::thread()
 							int sNum = ms->zDB()->suchRegisterServer( klientNummer );
 							if( sNum )
 							{
-								unsigned char *msg = ms->zDB()->getRegisterServerPortIp( sNum );
+								unsigned char *msg = ms->zDB()->getServerPortIp( sNum );
 								if( msg )
 								{
 									if( encrypted )
@@ -521,7 +521,7 @@ void MSKlient::thread()
 							int sNum = ms->zDB()->suchPatchServer( klientNummer );
 							if( sNum )
 							{
-								unsigned char *msg = ms->zDB()->getPatchServerPortIp( sNum );
+								unsigned char *msg = ms->zDB()->getServerPortIp( sNum );
 								if( msg )
 								{
 									if( encrypted )
@@ -551,7 +551,7 @@ void MSKlient::thread()
 							int sNum = ms->zDB()->suchLoginServer( klientNummer );
 							if( sNum )
 							{
-								unsigned char *msg = ms->zDB()->getLoginServerPortIp( sNum );
+								unsigned char *msg = ms->zDB()->getServerPortIp( sNum );
 								if( msg )
 								{
 									if( encrypted )
@@ -581,7 +581,7 @@ void MSKlient::thread()
 							int sNum = ms->zDB()->suchInformationServer( klientNummer );
 							if( sNum )
 							{
-								unsigned char *msg = ms->zDB()->getInformationServerPortIp( sNum );
+								unsigned char *msg = ms->zDB()->getServerPortIp( sNum );
 								if( msg )
 								{
 									if( encrypted )
@@ -611,7 +611,7 @@ void MSKlient::thread()
 							int sNum = ms->zDB()->suchChatServer( klientNummer );
 							if( sNum )
 							{
-								unsigned char *msg = ms->zDB()->getChatServerPortIp( sNum );
+								unsigned char *msg = ms->zDB()->getServerPortIp( sNum );
 								if( msg )
 								{
 									if( encrypted )
@@ -641,7 +641,7 @@ void MSKlient::thread()
 							int sNum = ms->zDB()->suchAnmeldungServer( klientNummer );
 							if( sNum )
 							{
-								unsigned char *msg = ms->zDB()->getAnmeldungServerPortIp( sNum );
+								unsigned char *msg = ms->zDB()->getServerPortIp( sNum );
 								if( msg )
 								{
 									if( encrypted )
@@ -671,7 +671,7 @@ void MSKlient::thread()
 							int sNum = ms->zDB()->suchShopServer( klientNummer );
 							if( sNum )
 							{
-								unsigned char *msg = ms->zDB()->getShopServerPortIp( sNum );
+								unsigned char *msg = ms->zDB()->getServerPortIp( sNum );
 								if( msg )
 								{
 									if( encrypted )
@@ -701,7 +701,7 @@ void MSKlient::thread()
 							int sNum = ms->zDB()->suchErhaltungServer( klientNummer );
 							if( sNum )
 							{
-								unsigned char *msg = ms->zDB()->getErhaltungServerPortIp( sNum );
+								unsigned char *msg = ms->zDB()->getServerPortIp( sNum );
 								if( msg )
 								{
 									if( encrypted )
@@ -731,7 +731,7 @@ void MSKlient::thread()
 							int sNum = ms->zDB()->suchNewsServer( klientNummer );
 							if( sNum )
 							{
-								unsigned char *msg = ms->zDB()->getNewsServerPortIp( sNum );
+								unsigned char *msg = ms->zDB()->getServerPortIp( sNum );
 								if( msg )
 								{
 									if( encrypted )
@@ -755,6 +755,36 @@ void MSKlient::thread()
 						else
 							errorZuKlient( "Du besitzt noch keine Client Nummer!\0" );
 						break;
+                    case 0xA: // Minigame Server
+                        if( klientNummer )
+                        {
+                            int sNum = ms->zDB()->suchMinigameServer( klientNummer );
+                            if( sNum )
+                            {
+                                unsigned char *msg = ms->zDB()->getServerPortIp( sNum );
+                                if( msg )
+                                {
+                                    if( encrypted )
+                                    {
+                                        klient->sendeEncrypted( "\2", 1 );
+                                        klient->sendeEncrypted( (char*)msg, 6 );
+                                    }
+                                    else
+                                    {
+                                        klient->sende( "\2", 1 );
+                                        klient->sende( (char*)msg, 6 );
+                                    }
+                                }
+                                else
+                                    errorZuKlient( "Aufgrund eines unerwarteten Fehlers konnte dir kein\nMinigameserver zugewiesen werden!\0" );
+                                delete[]msg;
+                            }
+                            else
+                                errorZuKlient( "Der Server ist derzeit ausgelastet!\0" );
+                        }
+                        else
+                            errorZuKlient( "Du besitzt noch keine Client Nummer!\0" );
+                        break;
 					default:
 						errorZuKlient( "Die Art des Servers ist nicht bekannt!\0" );
 						break;
@@ -839,8 +869,8 @@ void MSKlient::thread()
                     weiter->kartenServerKlientAbsturz( klientNummer );
                     weiter->editorServerKlientAbsturz( klientNummer );
 					weiter->release();
-					int *treffer = ms->zDB()->unregisterClient( klientNummer );
-					if( !treffer[ 12 ] )
+					int *treffer = ms->zDB()->unregisterClient( klientNummer, 0 );
+					if( !treffer )
 						errorZuKlient( "Du bist nicht registriert!\0" );
 					else
 					{
@@ -1030,7 +1060,7 @@ bool MSGWeiterleitung::chatServerKlientAbsturz( int klientId )
 		return 0;
 	}
 	Klient *k = new Klient();
-	unsigned char key[ 20 ] = { 79, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
+	unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
 	k->setSendeKey( (char*)key, 20 );
 	k->setEmpfangKey( (char*)key, 20 );
 	k->verbinde( (unsigned short)port, ip->getText() );
@@ -1302,7 +1332,7 @@ bool MSGWeiterleitung::spielerLeavesGruppe( int gruppeId, int accountId )
 		if( ip->getLength() )
 		{
 			Klient *klient = new Klient();
-			unsigned char key[ 20 ] = { 79, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
+			unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
 			klient->setSendeKey( (char*)key, 20 );
 			klient->setEmpfangKey( (char*)key, 20 );
 			ret = ret & klient->verbinde( port, ip->getText() );
@@ -1354,7 +1384,7 @@ bool MSGWeiterleitung::setGruppeAdmin( int gruppeId, int adminId )
 		if( ip->getLength() )
 		{
 			Klient *klient = new Klient();
-			unsigned char key[ 20 ] = { 79, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
+			unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
 			klient->setSendeKey( (char*)key, 20 );
 			klient->setEmpfangKey( (char*)key, 20 );
 			ret = ret & klient->verbinde( port, ip->getText() );
@@ -1396,7 +1426,7 @@ bool MSGWeiterleitung::spielerLeavesChatroom( int chatroomId, int accountId )
 		if( ip->getLength() )
 		{
 			Klient *klient = new Klient();
-			unsigned char key[ 20 ] = { 79, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
+			unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
 			klient->setSendeKey( (char*)key, 20 );
 			klient->setEmpfangKey( (char*)key, 20 );
 			ret = ret & klient->verbinde( port, ip->getText() );
@@ -1433,7 +1463,7 @@ bool MSGWeiterleitung::setChatroomAdmin( int chatroomId, int adminId )
 	if( ip->getLength() )
 	{
 		Klient *klient = new Klient();
-		unsigned char key[ 20 ] = { 79, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
+		unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
 		klient->setSendeKey( (char*)key, 20 );
 		klient->setEmpfangKey( (char*)key, 20 );
 		ret = ret & klient->verbinde( port, ip->getText() );
@@ -1472,7 +1502,7 @@ bool MSGWeiterleitung::kickSpielerAusGruppe( int gruppeId )
 		if( ip->getLength() )
 		{
 			Klient *klient = new Klient();
-			unsigned char key[ 20 ] = { 79, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
+			unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
 			klient->setSendeKey( (char*)key, 20 );
 			klient->setEmpfangKey( (char*)key, 20 );
 			ret = ret & klient->verbinde( port, ip->getText() );

+ 10 - 6
MainServer/MainServer.vcxproj

@@ -35,14 +35,18 @@
   <ImportGroup Label="PropertySheets" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/Debug</RemoteProjectDir>
-    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/Debug;..\..\..\..\Allgemein\Network\Network;../../../Network/Debug;..\..\..\..\Allgemein\sql\sql;../../../sql/Debug;$(IncludePath)</IncludePath>
+    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/debug</RemoteProjectDir>
+    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/debug;..\..\..\..\Allgemein\Network\Network;../../../Network/debug;..\..\..\..\Allgemein\sql\sql;../../../sql/debug;$(IncludePath)</IncludePath>
     <TargetExt />
+    <OutDir>$(ProjectDir)bin\$(Platform)\debug\</OutDir>
+    <IntDir>$(ProjectDir)obj\$(Platform)\debug\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <TargetExt />
-    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/Release</RemoteProjectDir>
-    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/Release;..\..\..\..\Allgemein\Network\Network;../../../Network/Release;..\..\..\..\Allgemein\sql\sql;../../../sql/Release;$(IncludePath)</IncludePath>
+    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/release</RemoteProjectDir>
+    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/release;..\..\..\..\Allgemein\Network\Network;../../../Network/release;..\..\..\..\Allgemein\sql\sql;../../../sql/release;$(IncludePath)</IncludePath>
+    <OutDir>$(ProjectDir)bin\$(Platform)\release\</OutDir>
+    <IntDir>$(ProjectDir)obj\$(Platform)\release\</IntDir>
   </PropertyGroup>
   <ItemGroup>
     <ClCompile Include="Datenbank.cpp" />
@@ -55,7 +59,7 @@
   </ItemGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <Link>
-      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/Debug/bin/x64/debug;$(RemoteRootDir)/Network/Debug/bin/x64/debug;$(RemoteRootDir)/Framework/Debug/bin/x64/debug;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/debug/bin/x64/debug;$(RemoteRootDir)/Network/debug/bin/x64/debug;$(RemoteRootDir)/Framework/debug/bin/x64/debug;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <LibraryDependencies>dbgFramework;dbgNetwork;dbgSQL;pq;pthread</LibraryDependencies>
       <AdditionalOptions>-Wl,-rpath,../lib %(AdditionalOptions)</AdditionalOptions>
     </Link>
@@ -63,7 +67,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <Link>
       <AdditionalOptions>-Wl,-rpath,../lib %(AdditionalOptions)</AdditionalOptions>
-      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/Release/bin/x64/release;$(RemoteRootDir)/Network/Release/bin/x64/release;$(RemoteRootDir)/Framework/Release/bin/x64/release;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/release/bin/x64/release;$(RemoteRootDir)/Network/release/bin/x64/release;$(RemoteRootDir)/Framework/release/bin/x64/release;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <LibraryDependencies>Framework;Network;SQL;pq;pthread</LibraryDependencies>
     </Link>
   </ItemDefinitionGroup>