Register for your free account! | Forgot your password?

You last visited: Today at 21:55

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Snippet] Team Chat Color

Discussion on [Snippet] Team Chat Color within the Flyff PServer Guides & Releases forum part of the Flyff Private Server category.

Reply
 
Old   #1
 
-Venom''s Avatar
 
elite*gold: 10
Join Date: Jan 2015
Posts: 929
Received Thanks: 444
[Snippet] Team Chat Color

Hallo,

hier ein kleines Snippet, die Idee kam ursprünglich von Primal Flyff

In:
Code:
void CDPClient::OnChat( OBJID objid, CAr & ar )
Das:
Code:
sprintf(szChat, "%s : %s", pMover->GetName(TRUE), szBuf);
g_WndMng.PutString((LPCTSTR)szChat, pMover, 0xffffffff, CHATSTY_GENERAL);
Durch:
Code:
			if (pMover->m_dwAuthorization == AUTH_ADMINISTRATOR)
			{
				sprintf(szChat, "[Admin] %s : %s", pMover->GetName(TRUE), szBuf);
				g_WndMng.PutString((LPCTSTR)szChat, pMover, COLOR_ADMINISTRATOR, CHATSTY_GENERAL);
			}
			else if (pMover->m_dwAuthorization >= AUTH_GAMEMASTER)
			{
				sprintf(szChat, "[Gamemaster] %s : %s", pMover->GetName(TRUE), szBuf);
				g_WndMng.PutString((LPCTSTR)szChat, pMover, COLOR_GAMEMASTER, CHATSTY_GENERAL);
			}
			else 
			{
				sprintf(szChat, "%s : %s", pMover->GetName(TRUE), szBuf);
				g_WndMng.PutString((LPCTSTR)szChat, pMover, COLOR_PLAYER, CHATSTY_GENERAL);
			}
ersetzen.


Ergebnis:
-Venom' is offline  
Thanks
1 User
Old 01/09/2017, 21:39   #2
 
elite*gold: 0
Join Date: Jan 2008
Posts: 130
Received Thanks: 78
Or "Color Only" in shout.

BOOL TextCmd_shout( CScanner& scanner )
Code:
#if __VER >= 12 // __LORD
	DWORD dwColor	= 0xffff99cc;
	if( pUser->HasBuff(  BUFF_ITEM, II_SYS_SYS_LS_SHOUT ) )
		dwColor		= 0xff00ff00;
	if (pUser->IsAuthHigher(AUTH_GAMEMASTER))
		dwColor		= COLOR_GAMEMASTER;
	arBlock << dwColor;
#endif	// __LORD
Sammyz is offline  
Old 01/10/2017, 19:05   #3
 
elite*gold: 0
Join Date: Apr 2016
Posts: 59
Received Thanks: 5
Quote:
Originally Posted by Sammyz View Post
Or "Color Only" in shout.

BOOL TextCmd_shout( CScanner& scanner )
Code:
#if __VER >= 12 // __LORD
	DWORD dwColor	= 0xffff99cc;
	if( pUser->HasBuff(  BUFF_ITEM, II_SYS_SYS_LS_SHOUT ) )
		dwColor		= 0xff00ff00;
	if (pUser->IsAuthHigher(AUTH_GAMEMASTER))
		dwColor		= COLOR_GAMEMASTER;
	arBlock << dwColor;
#endif	// __LORD
That code for GM / Admin shout color never worked for me. I have it exactly like that and it does nothing. I also tried "else if" but no different results.
direktbottle is offline  
Old 01/10/2017, 19:14   #4
 
-Venom''s Avatar
 
elite*gold: 10
Join Date: Jan 2015
Posts: 929
Received Thanks: 444
Quote:
Originally Posted by direktbottle View Post
That code for GM / Admin shout color never worked for me. I have it exactly like that and it does nothing. I also tried "else if" but no different results.
In 30minutes i can release the code for that.
-Venom' is offline  
Old 01/10/2017, 19:22   #5
 
elite*gold: 0
Join Date: Apr 2016
Posts: 59
Received Thanks: 5
Quote:
Originally Posted by Gentros' View Post
In 30minutes i can release the code for that.
Great!!
direktbottle is offline  
Old 01/10/2017, 19:23   #6
 
elite*gold: 0
Join Date: Aug 2014
Posts: 113
Received Thanks: 36
It's sexier when the text isnt color
xMeher is offline  
Thanks
1 User
Old 01/10/2017, 19:44   #7
 
elite*gold: 0
Join Date: Apr 2016
Posts: 59
Received Thanks: 5
Quote:
Originally Posted by xMeher View Post
It's sexier when the text isnt color
Then don't use it.

Quote:
Originally Posted by Gentros' View Post
Thanks!
direktbottle is offline  
Old 01/10/2017, 20:02   #8
 
elite*gold: 294
Join Date: Jun 2009
Posts: 407
Received Thanks: 587
Quote:
Originally Posted by Gentros' View Post
In:
Code:
void CDPClient::OnShout( CAr & ar )
Change this:
Code:
str.Format("[%s] %s", lpszPlayer, lpString);
g_WndMng.PutString(str, NULL, dwColor, CHATSTY_SHOUT);

to:
Code:
		if (pMover->m_dwAuthorization == AUTH_ADMINISTRATOR)
		{
			str.Format("[Admin Shout][%s] %s", lpszPlayer, lpString);
			g_WndMng.PutString(str, NULL, COLOR_ADMINISTRATOR, CHATSTY_SHOUT);
		}
		else if (pMover->m_dwAuthorization >= AUTH_GAMEMASTER)
		{
			str.Format("[Gamemaster Shout][%s] %s", lpszPlayer, lpString);
			g_WndMng.PutString(str, NULL, COLOR_GAMEMASTER, CHATSTY_SHOUT);
		}
		else
		{
			str.Format("[%s] %s", lpszPlayer, lpString);
			g_WndMng.PutString(str, NULL, dwColor, CHATSTY_SHOUT);
		}
The color and text will not apply for users too far / different maps because they wouldn't be in the client's memory still (GetMover() will be null).

If that is the case, your example would crash for accessing a null pointer, and if you checked if the pointer wasn't null and the object was real, it would still be incorrect text during certain scenarios like I stated.


Edit:
Furthermore, the example provided by Sammyz should be working, as it sends a different color into the packet information, which is being read on the client. You can even detect to add a tag for auth based on sending another variable, preferably a byte and then handle the data on the client. But, if you're doing it that way, you can also remove sending a color and just use a numeric byte scale, which increases options. Whatever is more preferable to whoever is doing it for themselves.
Avalion is offline  
Old 01/10/2017, 20:58   #9
 
-Venom''s Avatar
 
elite*gold: 10
Join Date: Jan 2015
Posts: 929
Received Thanks: 444
Quote:
Originally Posted by Avalion View Post
The color and text will not apply for users too far / different maps because they wouldn't be in the client's memory still (GetMover() will be null).

If that is the case, your example would crash for accessing a null pointer, and if you checked if the pointer wasn't null and the object was real, it would still be incorrect text during certain scenarios like I stated.


Edit:
Furthermore, the example provided by Sammyz should be working, as it sends a different color into the packet information, which is being read on the client. You can even detect to add a tag for auth based on sending another variable, preferably a byte and then handle the data on the client. But, if you're doing it that way, you can also remove sending a color and just use a numeric byte scale, which increases options. Whatever is more preferable to whoever is doing it for themselves.

Oh i have see it.
I will fix it in the next minutes.

Quote:
Originally Posted by direktbottle View Post
That code for GM / Admin shout color never worked for me. I have it exactly like that and it does nothing. I also tried "else if" but no different results.
Quote:
Originally Posted by Sammyz View Post
Or "Color Only" in shout.

BOOL TextCmd_shout( CScanner& scanner )
Code:
#if __VER >= 12 // __LORD
	DWORD dwColor	= 0xffff99cc;
	if( pUser->HasBuff(  BUFF_ITEM, II_SYS_SYS_LS_SHOUT ) )
		dwColor		= 0xff00ff00;
	if (pUser->IsAuthHigher(AUTH_GAMEMASTER))
		dwColor		= COLOR_GAMEMASTER;
	arBlock << dwColor;
#endif	// __LORD

I have make it so. It works

Code:
#if __VER >= 12 // __LORD
	DWORD dwColor = 0xffff99cc;
	if(pUser->m_dwAuthorization == AUTH_ADMINISTRATOR)
	{
		dwColor = COLOR_ADMINISTRATOR;
	}
	else if (pUser->m_dwAuthorization >= AUTH_GAMEMASTER)
	{
		dwColor = COLOR_GAMEMASTER;
	}
	

if( pUser->HasBuff(  BUFF_ITEM, II_SYS_SYS_LS_SHOUT ) )
		{
			dwColor		= 0xff00ff00;
		}
	arBlock << dwColor;
#endif	// __LORD
-Venom' is offline  
Old 01/10/2017, 21:45   #10
 
elite*gold: 0
Join Date: Apr 2016
Posts: 59
Received Thanks: 5
That works great, but now we don't have the [GM] tags in shout anymore, unless you use the other script which Avalion said could cause crashes.

Code:
#if __VER >= 12 //__LORD
	DWORD dwColor	= 0xffff99cc;
	if(pUser->m_dwAuthorization >= AUTH_GAMEMASTER)
	{
		dwColor = 0xff00ff00;
	}
	if( pUser->HasBuff(  BUFF_ITEM, II_SYS_SYS_LS_SHOUT ) )
	{
		dwColor = 0xff00ff00;
	}
#ifdef __PREMIUM_STATUS
	else if( pUser->IsSMMode( SM_PREMIUM) )
	{
		dwColor = COLOR_PREMIUM;
	}
#endif //__PREMIUM_STATUS
	arBlock << dwColor;
#endif	//__LORD
Can anyone help me modify this code so it will display the GAMEMASTER color if you are GAMEMASTER and PREMIUM? Right now it will always take premium color first even if you are GM.
direktbottle is offline  
Old 01/10/2017, 22:14   #11
 
-Venom''s Avatar
 
elite*gold: 10
Join Date: Jan 2015
Posts: 929
Received Thanks: 444
Tomorrow i will add the tags
-Venom' is offline  
Old 01/10/2017, 22:25   #12
 
elite*gold: 294
Join Date: Jun 2009
Posts: 407
Received Thanks: 587
This is another way of doing it.
BOOL TextCmd_shout(CScanner &scanner)
Code:
	unsigned long dwColor = pUser->m_dwAuthorization;
	if (pUser->HasBuff(BUFF_ITEM, II_SYS_SYS_LS_SHOUT) && !pUser->m_dwAuthorization > AUTH_GENERAL)
		dwColor = 1;

	arBlock << dwColor;

void CDPClient::OnShout(CAr &ar)
Code:
	CString str;
	switch (dwColor)
	{
		case AUTH_ADMINISTRATOR:
			str.Format("[Admin][%s] : %s", lpszPlayer, lpString);
			dwColor = COLOR_ADMINISTRATOR;
			break;
		case AUTH_OPERATOR:
			str.Format("[GM][%s] : %s", lpszPlayer, lpString);
			dwColor = COLOR_GAMEMASTER;
			break;
		case AUTH_GAMEMASTER2:
		case AUTH_GAMEMASTER:
			str.Format("[Event GM][%s] : %s", lpszPlayer, lpString);
			dwColor = COLOR_EVENTGAMEMASTER;
			break;
		case 1:
			str.Format("[%s] : %s", lpszPlayer, lpString);
			dwColor = 0xff00ff00;
			break;
		default:
			str.Format("[%s] : %s", lpszPlayer, lpString);
			dwColor = 	0xffefab59;
			break;
		}
	}
	g_WndMng.PutString(str, NULL, COLOR_ADMINISTRATOR, CHATSTY_SHOUT);
You can even start doing some crazy stuff, like if you wanted the shout color to change with lordbuff but with the admin tag prepended, you can start using a binary flag inside the variable. Even though Auth levels are stored as a DWORD, they are stored using letters (ascii to dec), so they never really pass the size of a byte, nor would one have that many auth levels.

Code:
	unsigned long dwColor = pUser->m_dwAuthorization;
	if (pUser->HasBuff(BUFF_ITEM, II_SYS_SYS_LS_SHOUT))
		dwColor = 0x100 | dwColor;
	if (pUser->isVip() && !pUser->m_dwAuthorization > AUTH_GENERAL)
		dwColor = 0x200 | dwColor;
	
	arBlock << dwColor;
Code:
	bool hasLord = false, hasVip = false;
	if (dwColor & 0x100)
	{
		hasLord = true;
		dwColor = dwColor &~0x100;
	}
	if (dwColor & 0x200)
	{
		hasVip = true;
		dwColor = dwColor &~0x200;
	}
	
	switch (dwColor)
	{
		case AUTH_ADMINISTRATOR:
			str.Format("[Admin][%s] : %s", lpszPlayer, lpString);
			dwColor = hasLord ? 0xff00ff00 : COLOR_ADMINISTRATOR;
			break;
		case AUTH_OPERATOR:
			str.Format("[GM][%s] : %s", lpszPlayer, lpString);
			dwColor = hasLord ? 0xff00ff00 : COLOR_GAMEMASTER;
			break;
		case AUTH_GAMEMASTER2:
		case AUTH_GAMEMASTER:
			str.Format("[Event GM][%s] : %s", lpszPlayer, lpString);
			dwColor = hasLord ? 0xff00ff00 : COLOR_EVENTGAMEMASTER;
			break;
		default:
			if (hasVip)
			{
				str.Format("[%s] : %s", lpszPlayer, lpString);
				dwColor = 	hasLord ? 0xff00ff00 : COLOR_VIP;
			}
			else
			{
				str.Format("[%s] : %s", lpszPlayer, lpString);
				dwColor = 	hasLord ? 0xff00ff00 : 0xffefab59;
			}
			break;
		}
	}
These are all rough examples on what you can do. If you expect to have loads of Auths with the same information, would probably be better to use like if (auth >= admin) etc. Also, excuse me if I messed up the bitwise operations.




-------------------------------------------------------------------------

Quote:
Originally Posted by direktbottle View Post
That works great, but now we don't have the [GM] tags in shout anymore, unless you use the other script which Avalion said could cause crashes.

Code:
#if __VER >= 12 //__LORD
	DWORD dwColor	= 0xffff99cc;
	if(pUser->m_dwAuthorization >= AUTH_GAMEMASTER)
	{
		dwColor = 0xff00ff00;
	}
	if( pUser->HasBuff(  BUFF_ITEM, II_SYS_SYS_LS_SHOUT ) )
	{
		dwColor = 0xff00ff00;
	}
#ifdef __PREMIUM_STATUS
	else if( pUser->IsSMMode( SM_PREMIUM) )
	{
		dwColor = COLOR_PREMIUM;
	}
#endif //__PREMIUM_STATUS
	arBlock << dwColor;
#endif	//__LORD
Can anyone help me modify this code so it will display the GAMEMASTER color if you are GAMEMASTER and PREMIUM? Right now it will always take premium color first even if you are GM.
Code:
	ELSE if( pUser->HasBuff(  BUFF_ITEM, II_SYS_SYS_LS_SHOUT ) )
	{
		dwColor = 0xff00ff00;
	}
add this else and it should take the first if statement that applies to the user. IE: Auth Color > Lord Color > Premium color.
Avalion is offline  
Thanks
1 User
Old 01/11/2017, 10:03   #13
 
elite*gold: 0
Join Date: Apr 2016
Posts: 59
Received Thanks: 5
While we're working on shout, I figured I'd try this thing where premium and GMs+ have Full Shout automatically.

Code:
BOOL CMover::IsShoutFull( void )
{
	return	( IsSMMode( SM_SHOUT15 ) || IsSMMode( SM_SHOUT30 ) || IsSMMode( SM_SHOUT001 ) || IsSMMode( IsAuthHigher( AUTH_GAMEMASTER) )
#ifdef __PREMIUM_STATUS
	|| IsSMMode( SM_PREMIUM )
#endif //__PREMIUM_STATUS
	);
}
But it only works for Premium, not Gamemasters+. Something is missing I guess
direktbottle is offline  
Old 01/11/2017, 10:09   #14
 
kevinkraus's Avatar
 
elite*gold: 110
Join Date: Oct 2010
Posts: 306
Received Thanks: 58
Quote:
Originally Posted by direktbottle View Post
While we're working on shout, I figured I'd try this thing where premium and GMs+ have Full Shout automatically.

Code:
BOOL CMover::IsShoutFull( void )
{
	return	( IsSMMode( SM_SHOUT15 ) || IsSMMode( SM_SHOUT30 ) || IsSMMode( SM_SHOUT001 ) || IsSMMode( IsAuthHigher( AUTH_GAMEMASTER) )
#ifdef __PREMIUM_STATUS
	|| IsSMMode( SM_PREMIUM )
#endif //__PREMIUM_STATUS
	);
}
But it only works for Premium, not Gamemasters+. Something is missing I guess
Change this:
Code:
BOOL CMover::IsShoutFull( void )
{
	return	( IsSMMode( SM_SHOUT15 ) || IsSMMode( SM_SHOUT30 ) || IsSMMode( SM_SHOUT001 ) || IsSMMode( IsAuthHigher( AUTH_GAMEMASTER) )
#ifdef __PREMIUM_STATUS
	|| IsSMMode( SM_PREMIUM )
#endif //__PREMIUM_STATUS
	);
}
to:
Code:
BOOL CMover::IsShoutFull( void )
{
	return	( IsSMMode( SM_SHOUT15 ) || IsSMMode( SM_SHOUT30 ) || IsSMMode( SM_SHOUT001 ) || IsAuthHigher( AUTH_GAMEMASTER )
#ifdef __PREMIUM_STATUS
	|| IsSMMode( SM_PREMIUM )
#endif //__PREMIUM_STATUS
	);
}
and it should work for Gamemasters+ too.

- Kevin
kevinkraus is offline  
Old 01/11/2017, 10:20   #15
 
elite*gold: 0
Join Date: Apr 2016
Posts: 59
Received Thanks: 5
Oh yeah, you're right. I'll try!
direktbottle is offline  
Reply


Similar Threads Similar Threads
Text in Color for the Chat !
03/20/2014 - CO2 Private Server - 8 Replies
Hi everyone, I want to know how to color text chat? Thank you to you :)
Chat color text
07/15/2012 - Metin2 Private Server - 0 Replies
Hello, I saw in kamers metin2mod 2011 sf that if you have an item (71113), you can change the text color using, for exemple, text and your text it's red. So I was wondering if someone can give me that python script, I've searched for it and I couldn't find it. Thank you for helping me.
[Snippet] Anti Idle in Chat Lobby
12/01/2011 - Diablo 2 Programming - 0 Replies
Ich hatte hier irgendwo schonmal mein Problem erwähnt, das ich die Battle.net Connection verliere wenn meine Chars zulange (>3min) im lobby chat rumlümmeln. Daher habe ich folgendes in Muddy´s Leecher Startpunkt (NTBotLeech.ntj) eingefügt, damit er alle 60 Sekunden kurz mal die Join Liste öffnet und wieder schliest, solange er auf das nächste Spiel wartet. Zu dem If Block bei Zeile ~185 if(SayChatMsgAfterGame) { folgende Zeile hinzufügen ChatJoinedTime = GetTickCount(); damit wissen...
Patch Color Chat
03/19/2010 - Lineage 2 - 5 Replies
Hi guys, i'm looking for the patch to change text (system message....) color in chat game.... anyone have it? (for kamael :D)
Chat color
11/07/2008 - Lineage 2 - 7 Replies
Hello I've tryed all the solution for patch color, but it doesn't work, I've tryed systemmsng_editor but I think the ddf file doesn't work whit gracia part two. Any help or suggestion? thanks:handsdown:



All times are GMT +2. The time now is 21:55.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.