Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Worldserver with console :) Usefull? donno

Game Developer
Loyal Member
Joined
Jun 19, 2009
Messages
1,491
Reaction score
460
Alright thought I release another simple part :)
It creates a console window and print the errors out in the console.
If you want you can add some printf("Sumlog %s",someshit); like when someone logs in you be able to see that.

In worldserver open versionCommon.h
add
Code:
#define __QUGET_CONSOLE
Open worldserver.cpp and look for
Code:
// float point ¿¡·¯°¡ exceptionÀ» ³»°Ô ÇÑ´Ù.
void EnableFloatException()
{
	int cw = _controlfp( 0, 0 );
	cw &= ~(EM_OVERFLOW|EM_UNDERFLOW|EM_ZERODIVIDE|EM_DENORMAL);
	_controlfp( cw, MCW_EM );
}
Add this under it
Code:
#ifdef __QUGET_CONSOLE
//Picked up from a proxy hack source code(Not infiltration) and used some google
HANDLE CreateConsole()
{
    int hConHandle = 0;
    HANDLE lStdHandle = 0;
    FILE *fp = 0;
 
    // Allocate a console
    AllocConsole();
	WNDCLASSEX wc = { 0 };
//Quget test
	wc.cbSize = sizeof( WNDCLASSEX ) ;
	wc.cbClsExtra = 0;  // ignore for now
	wc.cbWndExtra = 0;  // ignore for now
	wc.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH );
	wc.hCursor = LoadCursor( NULL, IDC_ARROW );
	//wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
	wc.lpfnWndProc = WndProc;
	wc.lpszClassName = TEXT("Console");
	wc.lpszMenuName = 0;
	wc.style = CS_HREDRAW | CS_VREDRAW; // Redraw the window

	RegisterClassEx( &wc );
//End test
    // redirect unbuffered STDOUT to the console
    lStdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
	hConHandle = _open_osfhandle(PtrToUlong(lStdHandle), 0x4000);//_O_TEXT);
    fp = _fdopen(hConHandle, "w");
    *stdout = *fp;
    setvbuf(stdout, NULL, _IONBF, 0);
	return lStdHandle;
}
#endif // __QUGET_CONSOLE

In the same file look for

Code:
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{

And add this under it
Code:
#ifdef __QUGET_CONSOLE
	CreateConsole();
	SetProcessWorkingSetSize(hInstance, -1, -1);
	printf("Quget Server Console.\n");
#endif // __QUGET_CONSOLE

Open xUtil.cpp

Look for

Code:
LPCTSTR Error( LPCTSTR strFormat, ... )
{
    char szBuff[8192];
    va_list args;
    va_start(args, strFormat);
    int n = _vsntprintf( szBuff, 8191, strFormat, args );
    va_end(args);

	if( n > 0 )
	{
#if defined(_DEBUG) && defined(__XUZHU)
		if( g_bShowMsgBox && MessageBox( NULL, szBuff, "¿À·ù", MB_OKCANCEL) == IDCANCEL )
			g_bShowMsgBox	= FALSE;		
#endif
		char szStr[8192];
		SYSTEMTIME time;
		GetLocalTime( &time );
		sprintf( szStr, "%d/%2d/%2d   %02d:%02d:%02d   %s\n", 
			time.wYear, time.wMonth, time.wDay,
			time.wHour, time.wMinute, time.wSecond, 
			szBuff );		
		
		DEBUGOUT2( szStr );
And add this under it

Code:
#ifdef __QUGET_CONSOLE
		printf(szStr);
#endif

Now the console will print all errors :)

An example too add extra logs(Some extra features!)

For showing who logged in and out

Look for

Code:
void CDPDatabaseClient::SendLogConnect( CUser* pUser )
{
	BEFORESENDDUAL( ar, PACKETTYPE_LOG_PLAY_CONNECT, DPID_UNKNOWN, DPID_UNKNOWN );
	ar << pUser->GetWorld()->GetID();	// world id
	ar.Write( &pUser->m_playAccount.m_stLogin, sizeof(SYSTEMTIME) );
	ar.WriteString( pUser->m_playAccount.lpAddr );	// ip
	DWORD dwSeed = pUser->GetGold() + pUser->m_dwGoldBank[pUser->m_nSlot];
	ar << dwSeed;	// seed
	ar << pUser->m_idPlayer;
	ar.WriteString( pUser->m_playAccount.lpszAccount );
	ar << pUser->GetLevel();
	ar << pUser->GetJob();
#if __VER >= 14 // __PCBANG
	ar << CPCBang::GetInstance()->GetPCBangClass( pUser->m_idPlayer );
#endif // __PCBANG

And add this under it

Code:
#ifdef __QUGET_CONSOLE
	printf("Logged out:[%s],Gold:[%d],JobId:[%d],Level:[%d],Autht:[%d] \n",pUser->GetName(),pUser->GetGold(),pUser->GetJob(),pUser->GetLevel(),pUser->m_dwAuthorization);
#endif //__QUGET_CONSOLE

Now for the log in Look for

Code:
#if __VER >= 15 // __GUILD_HOUSE
		pUser->AddGuildHouseAllInfo( GuildHouseMng->GetGuildHouse( pUser->m_idGuild ) );
		GuildHouseMng->SetApplyDST( pUser );
		if( pWorld && GuildHouseMng->IsGuildHouse( pWorld->GetID() ) && pUser->GetLayer() == pUser->m_idGuild )	// Á¢¼ÓÁö°¡ ±æµåÇϿ콺 À̸é..
			pUser->SetIncRestPoint( tLogOut / REST_POINT_TICK * REST_POINT_LOGOUT_INC );	// ·Î±×¾Æ¿ô ÈÞ½Ä Æ÷ÀÎÆ®¸¦ Áõ°¡ ½ÃÄÑÁØ´Ù.
#endif // __GUILD_HOUSE

#if __VER >= 15 // __CAMPUS
		u_long idCampus = pUser->GetCampusId();
		if( idCampus )
		{
			CCampus* pCampus = CCampusHelper::GetInstance()->GetCampus( idCampus );
			if( pCampus && pCampus->IsMember( pUser->m_idPlayer ) )
				pUser->AddUpdateCampus( pCampus );
			else
				pUser->SetCampusId( 0 );
		}
#endif // __CAMPUS

And add this under it

Code:
#ifdef __QUGET_CONSOLE
		printf("Character logged in:[%s] Gold:[%d] JobId:[%d] level:[%d] Auth:[%d] \n",pUser->GetName(),pUser->GetGold(),pUser->GetJob(),pUser->GetLevel(),pUser->m_dwAuthorization);
#endif //__QUGET_CONSOLE

Now you are all done having a wolrdserver with a console window printing everything that goes in error%%%.txt and showing who logged in and off :)

Credits:
70% me
30% Google and some hack source code for giving me the idea.
 
Not working on UnitedFlyf
Loyal Member
Joined
Apr 21, 2009
Messages
1,385
Reaction score
934
Why not just convert the whole app to a console application? That's what I did.

I hide the actual consoles on the server machine though, as I access the console remotely with my server manager.
MisterKid - Worldserver with console :) Usefull? donno - RaGEZONE Forums
 
Scarlet Dreamz ~waves~
Joined
Jul 29, 2008
Messages
786
Reaction score
87
What? theres no Adler like this on mooties post? lol, it is a kewl idea, but people its just to lazy to do that, they just want to get ingame and create gm chars.. lol thats it.
 
Not working on UnitedFlyf
Loyal Member
Joined
Apr 21, 2009
Messages
1,385
Reaction score
934
lol, it is a kewl idea, but people its just to lazy to do that, they just want to get ingame and create gm chars.. lol thats it.

If they just want to "get ingame and create GM characters" then they shouldn't make a pserver or even touch the illegal files/source code. Private servers can be good, but this kind of attitude is the reason why there are so few with features over officials.
 
Game Developer
Loyal Member
Joined
Jun 19, 2009
Messages
1,491
Reaction score
460
Aoensoft makes more games then flyff.
People who seek private servers want to play flyff adding extra's to it is fun but still people want to play flyff.
 
i sell platypus
Loyal Member
Joined
Jun 26, 2009
Messages
2,640
Reaction score
1,326
why my post got deleted? i just gave u a real worth opinion and many ideas how to improve and the result is to remove my post? thx alot.
i think u reported it, not nice.

When did it occur to you that it'd be a good idea mocking someones server in a completely unrelated topic with no reference to the OP at all? In addition to that, you're mocking the FlyFF Scene. If you dislike it, you should leave. That attitude is not respected nor tolerated at all around these parts. The off-topic discussion ends here.
 
Back
Top