Jump to content
Forgot your email address? ×
×
×
  • Create New...

Chat Coloring with Game


Recommended Posts

  • Premium

M2 Download Center

Hidden Content

    Give reaction to this post to see the hidden content.
( Internal )

Hi everyone,
 
In this thread I will show you how to change the color of the chat messages without any client modification. I will use the 2 new ring slots in this example.
 
First of all, the color codes:
 
RED: |cFFFF0000|H|h
GREEN: |cFF00FF00|H|h
BLUE: |cFF0080FF|H|h
YELLOW: |cFFFFFF00|H|h

Open game/unique_item.h and add these:

TEXT_COLOR_RED = ID_OF_THE_ITEM,
TEXT_COLOR_GREEN = ID_OF_THE_ITEM,
TEXT_COLOR_BLUE = ID_OF_THE_ITEM,
TEXT_COLOR_YELLOW = ID_OF_THE_ITEM,

Open game/input_main.cpp and search for this:

const TPacketCGChat* pinfo = reinterpret_cast<const TPacketCGChat*>(data);

Replace with this:

int len;
const TPacketCGChat* pinfo = reinterpret_cast<const TPacketCGChat*>(data);

Remove this:

int len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), buf);

Search for this:

if (CHAT_TYPE_SHOUT == pinfo->type)

Add this over that:

if (ch->IsEquipNewRingItem(TEXT_COLOR_RED))
{
	// RED
	len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s %s", ch->GetName(), "|cFFFF0000|H|h", buf);
}
else if (ch->IsEquipNewRingItem(TEXT_COLOR_GREEN))
{
	// GREEN
	len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s %s", ch->GetName(), "|cFF00FF00|H|h", buf);
}
else if (ch->IsEquipNewRingItem(TEXT_COLOR_BLUE))
{
	// BLUE
	len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s %s", ch->GetName(), "|cFF0080FF|H|h", buf);
}
else if (ch->IsEquipNewRingItem(TEXT_COLOR_YELLOW))
{
	// YELLOW
	len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s %s", ch->GetName(), "|cFFFFFF00|H|h", buf);
}
else
{
	// DEFAULT COLOR
	len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), buf);
}

Open game/char.cpp and add this event:

bool CHARACTER::IsEquipNewRingItem(DWORD dwItemVnum) const
{
	{
		LPITEM u = GetWear(WEAR_RING1);

		if (u && u->GetVnum() == dwItemVnum)
		{
			return true;
		}
	}

	{
		LPITEM u = GetWear(WEAR_RING2);

		if (u && u->GetVnum() == dwItemVnum)
		{
			return true;
		}
	}

	return false;
}

Open game/char.h and search for this:

bool			IsEquipUniqueGroup(DWORD dwGroupVnum) const;

Add this under that:

bool			IsEquipNewRingItem(DWORD dwItemVnum) const;

And now how it looks in the game:
 

Spoiler

http://www.kephost.com/images4/2014/2/8/a1_2014_2_8_9wtbvwo1pq.jpg




If you have any question or suggestion, please just reply to this topic.
 
Kind Regards,
Sanchez

  • Metin2 Dev 3
  • Love 23
Link to comment

cool, I remember they had this in Metin2US before using the same color code system and it was removed because people didn't want to only use it to sell and buy items. I've been looking for this modification for such a long time.

  • Love 1
Link to comment

cool, I remember they had this in Metin2US before using the same color code system and it was removed because people didn't want to only use it to sell and buy items. I've been looking for this modification for such a long time.

 

UndergroundMt2 used the same system but with python code.

You can append the same color codes over python.

 

@Topic: Not bad

  • Love 1
Link to comment
  • 2 months later...
  • Premium

You have to add the new slots to the inventorywindow.py:

				## Equipment Slot
				{
					"name" : "Equipment_Base",
					"type" : "image",

					"x" : 10,
					"y" : 33,

					"image" : "d:/ymir work/ui/equipment_bg_with_ring.tga",

					"children" :
					(

						{
							"name" : "EquipmentSlot",
							"type" : "slot",

							"x" : 3,
							"y" : 3,

							"width" : 150,
							"height" : 182,

							"slot" : (
										{"index":EQUIPMENT_START_INDEX+0, "x":39, "y":37, "width":32, "height":64},
										{"index":EQUIPMENT_START_INDEX+1, "x":39, "y":2, "width":32, "height":32},
										{"index":EQUIPMENT_START_INDEX+2, "x":39, "y":145, "width":32, "height":32},
										{"index":EQUIPMENT_START_INDEX+3, "x":75, "y":67, "width":32, "height":32},
										{"index":EQUIPMENT_START_INDEX+4, "x":3, "y":3, "width":32, "height":96},
										{"index":EQUIPMENT_START_INDEX+5, "x":114, "y":67, "width":32, "height":32},
										{"index":EQUIPMENT_START_INDEX+6, "x":114, "y":35, "width":32, "height":32},
										{"index":EQUIPMENT_START_INDEX+7, "x":2, "y":145, "width":32, "height":32},
										{"index":EQUIPMENT_START_INDEX+8, "x":75, "y":145, "width":32, "height":32},
										{"index":EQUIPMENT_START_INDEX+9, "x":114, "y":2, "width":32, "height":32},
										{"index":EQUIPMENT_START_INDEX+10, "x":75, "y":35, "width":32, "height":32},
										## »ő ąÝÁö1
										{"index":item.EQUIPMENT_RING1, "x":2, "y":106, "width":32, "height":32},
										## »ő ąÝÁö2
										{"index":item.EQUIPMENT_RING2, "x":75, "y":106, "width":32, "height":32},
										## »ő ş§Ć®
										{"index":item.EQUIPMENT_BELT, "x":39, "y":106, "width":32, "height":32},
									),
						},
  • Love 1
Link to comment

Yes, If I have the file with the selected check boxes and tga is correct but are not activate

 

on the subject of flags? Should the value of item selected go to the box? or do I need a special type, flag or antflag?

Link to comment
  • 4 months later...

For me it doesn't work, just edited the same function.

bool CHARACTER::IsEquipNewRingItem(DWORD dwItemVnum) const
{
    {
        LPITEM u = GetWear(WEAR_RING1);
 
        if (u && u->GetVnum() == dwItemVnum)
        {
            return true;
        }
    }
 
    return false;
}
Link to comment
  • 5 months later...
  • Premium

Can anyone Post what i have to do in item_proto.txt

 

I try this

 

90014    Gelber Stift    ITEM_RING    NONE    1    NONE    NONE    NONE        0    0    0    0    0    LIMIT_NONE    0    LIMIT_NONE    0    APPLY_NONE    0    APPLY_NONE    0    APPLY_NONE    0    0    0    0    0    0    0    0    0    0

 

but if i use my Item it goes in the Right Slot but my Chat is still normal

Link to comment
  • 4 months later...

Can anyone Post what i have to do in item_proto.txt

 

I try this

 

 

 
90014    Gelber Stift    ITEM_RING    NONE    1    NONE    NONE    NONE        0    0    0    0    0    LIMIT_NONE    0    LIMIT_NONE    0    APPLY_NONE    0    APPLY_NONE    0    APPLY_NONE    0    0    0    0    0    0    0    0    0    0

 

 

but if i use my Item it goes in the Right Slot but my Chat is still normal

​Same..

Link to comment
  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.