Register for your free account! | Forgot your password?

You last visited: Today at 21:53

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

 

[Snippet] Team Chat Color

Reply
 
Old   #1
 
elite*gold: 119
Join Date: Jan 2015
Posts: 855
Received Thanks: 398
[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:



Gentros' is online now  
Thanks
1 User
Old   #2
 
elite*gold: 0
Join Date: Jan 2008
Posts: 107
Received Thanks: 55
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   #3
 
elite*gold: 0
Join Date: Apr 2016
Posts: 48
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   #4
 
elite*gold: 119
Join Date: Jan 2015
Posts: 855
Received Thanks: 398
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.


Gentros' is online now  
Old   #5
 
elite*gold: 0
Join Date: Apr 2016
Posts: 48
Received Thanks: 5
Quote:
Originally Posted by Gentros' View Post
In 30minutes i can release the code for that.
Great!!
direktbottle is offline  
Old   #6
 
elite*gold: 0
Join Date: Aug 2014
Posts: 110
Received Thanks: 32
It's sexier when the text isnt color
xMeher is offline  
Thanks
1 User
Old   #7
 
elite*gold: 0
Join Date: Apr 2016
Posts: 48
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   #8
 
elite*gold: 0
Join Date: Jun 2009
Posts: 421
Received Thanks: 395
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   #9
 
elite*gold: 119
Join Date: Jan 2015
Posts: 855
Received Thanks: 398
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
Gentros' is online now  
Old   #10
 
elite*gold: 0
Join Date: Apr 2016
Posts: 48
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   #11
 
elite*gold: 119
Join Date: Jan 2015
Posts: 855
Received Thanks: 398
Tomorrow i will add the tags
Gentros' is online now  
Old   #12
 
elite*gold: 0
Join Date: Jun 2009
Posts: 421
Received Thanks: 395
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   #13
 
elite*gold: 0
Join Date: Apr 2016
Posts: 48
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   #14
 
elite*gold: 10
Join Date: Oct 2010
Posts: 279
Received Thanks: 51
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   #15
 
elite*gold: 0
Join Date: Apr 2016
Posts: 48
Received Thanks: 5
Oh yeah, you're right. I'll try!


direktbottle is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
Text in Color for the Chat !
Hi everyone, I want to know how to color text chat? Thank you to you :)
8 Replies - CO2 PServer - Discussions / Questions
Chat color text
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...
0 Replies - Metin2 PServer - Discussions / Questions
[Snippet] Anti Idle in Chat Lobby
Ich hatte hier irgendwo schonmal mein Problem erwähnt, das ich die Battle.net Connection verliere wenn meine Chars zulange (>3min) im lobby chat...
0 Replies - Diablo 2 Programming
Patch Color Chat
Hi guys, i'm looking for the patch to change text (system message....) color in chat game.... anyone have it? (for kamael :D)
5 Replies - Lineage 2
Chat color
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...
7 Replies - Lineage 2



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


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy
Copyright ©2017 elitepvpers All Rights Reserved.