Jump to content

Enchant & Transform Costume


Recommended Posts

  • Premium

Enchant Costume Enchant_Costume.png

  • Removes the bonuses from one of your costumes and replaces them with new ones.

 

Transform Costume Transform_Costume.png

  • Removes the bonuses from one of your costumes and replaces them with new ones. With a bit of luck, the number of bonuses might also change (up to max. 3).

 

  • Open "char_item.cpp" (Server-Source, game)
  • Search for:
if (ITEM_COSTUME == item2->GetType()

in

					case USE_PUT_INTO_RING_SOCKET:
					case USE_PUT_INTO_ACCESSORY_SOCKET:
					case USE_ADD_ACCESSORY_SOCKET:
					case USE_CLEAN_SOCKET:
					case USE_CHANGE_ATTRIBUTE:
					case USE_CHANGE_ATTRIBUTE2 :
					case USE_ADD_ATTRIBUTE:
					case USE_ADD_ATTRIBUTE2:
  • Replace the if-statement with following:
if (ITEM_COSTUME == item2->GetType() && item->GetVnum() != 70063 && item->GetVnum() != 70064)
  • Search for:
if (item2->GetAttributeSetIndex() == -1)

in

case USE_CHANGE_ATTRIBUTE :
  • Paste this above it:
// Transform costume
if (item->GetVnum() == 70063)
{
	if (item2->GetType() != ITEM_COSTUME)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ITEM_ISNT_COSTUME"));
		return false;
	}
	//SLZ fix
	if (item2->GetAttributeCount() == 0)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ĽÓĽşŔ» şŻ°ćÇŇ Ľö ľř´Â ľĆŔĚĹŰŔÔ´Ď´Ů."));
		return false;
	}
	//SLZ fix
	if (item2->GetAttributeCount() < 3)
	{
		if (number(1, 100) < 30)
		{
			while(item2->GetAttributeCount() < number(2, 3))
				item2->AddAttribute();
		}
	}
}
// Enchant costume
if (item->GetVnum() == 70064)
{
	if (item2->GetType() != ITEM_COSTUME)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ITEM_ISNT_COSTUME"));
		return false;
	}
}

11af851fab.png

5c4ef480ab.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 2
  • Love 11
Link to comment
Share on other sites

Thank you for this topic, but let me to improve it a little bit more complex.

 

It works perfectly. :D

Source/Client/GameLib/ItemData.cpp

// Search this

		case USE_PUT_INTO_RING_SOCKET:
			return DEF_STR(USE_PUT_INTO_RING_SOCKET);

// And add above this

		case USE_COSTUME_CHANGE_ATTRIBUTE:
			return DEF_STR(USE_COSTUME_CHANGE_ATTRIBUTE);
		case USE_COSTUME_ADD_ATTRIBUTE:
			return DEF_STR(USE_COSTUME_ADD_ATTRIBUTE);

Tools/Dump_Proto (txt)

 

itemdata.h  add 

USE_COSTUME_CHANGE_ATTRIBUTE 

USE_COSTUME_ADD_ATTRIBUTE

// Search this

"USE_PUT_INTO_RING_SOCKET"

// And put this

,"USE_COSTUME_CHANGE_ATTRIBUTE", "USE_COSTUME_ADD_ATTRIBUTE"

Now Source/Server/common - item_length:

// Search this

	USE_PUT_INTO_RING_SOCKET,

// And add above this

	USE_COSTUME_CHANGE_ATTRIBUTE,
	USE_COSTUME_ADD_ATTRIBUTE,

Source/Server/game - char_item.cpp:

// Search this
					case USE_TUNING:
					case USE_DETACHMENT:
						{
							LPITEM item2;

							if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
								return false;

							if (item2->IsExchanging())
								return false;
	
							if (item2->IsEquipped())
                                return false;

							if (item2->GetVnum() >= 28330 && item2->GetVnum() <= 28343) // ??+3
							{
								ChatPacket(CHAT_TYPE_INFO, LC_TEXT("+3 ??? ? ????? ??? ? ????"));
								return false;
							}

							if (item->GetValue(0) == ACCE_CLEAN_ATTR)
							{
								CleanAcceAttr(item, item2);
							}

							if (item2->GetVnum() >= 28430 && item2->GetVnum() <= 28443)  // ??+4
							{
								if (item->GetVnum() == 71056) // ?????
								{
									RefineItem(item, item2);
								}
								else
								{
									ChatPacket(CHAT_TYPE_INFO, LC_TEXT("??? ? ????? ??? ? ????"));
								}
							}
							else
							{
								RefineItem(item, item2);
							}
						}
						break;

// And paste above this

					// COSTUMEATTR
					case USE_COSTUME_CHANGE_ATTRIBUTE:
					case USE_COSTUME_ADD_ATTRIBUTE:
						{
							LPITEM item2;
							if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
								return false;

							if (item2->IsExchanging())
								return false;

							if (item2->IsEquipped())
								return false;

							if (ITEM_WEAPON == item2->GetType() || ITEM_ARMOR  == item2->GetType() ||
									 COSTUME_HAIR == item2->GetSubType() || COSTUME_ACCE == item2->GetSubType())
							{
								ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can use these bonuses only costumes."));
								return false;
							}

							switch (item->GetSubType())
							{
								case USE_COSTUME_ADD_ATTRIBUTE:
									if (item2->GetAttributeSetIndex() == -1)
									{
										ChatPacket(CHAT_TYPE_INFO, LC_TEXT("??? ??? ? ?? ??????."));
										return false;
									}

									if (item2->GetAttributeCount() < 1)
									{
										char buf[21];
										snprintf(buf, sizeof(buf), "%u", item2->GetID());

										item2->AddAttribute();
										ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You have successfully added bonus."));
										item->SetCount(item->GetCount() - 1);
									}
									else
									{
										ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can add just a bonus outfit."));
										break;
									}
									break;

								case USE_COSTUME_CHANGE_ATTRIBUTE:
									if (item2->GetAttributeSetIndex() == -1)
									{
										ChatPacket(CHAT_TYPE_INFO, LC_TEXT("??? ??? ? ?? ??????."));
									return false;
									}

									if (item2->GetAttributeCount() == 0)
									{
										ChatPacket(CHAT_TYPE_INFO, LC_TEXT("This suit does not own any bonus."));
										return false;
									}

									item2->ClearAttribute();
									item2->AlterToMagicItem();
									item->SetCount(item->GetCount() - 1);
									ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You just changed the bonus."));
									break;
							}
						}
						break;

Source/Server/game - item.cpp:

// Search this

			case ITEM_COSTUME:
			case ITEM_ARMOR:
				if (GetSubType() == ARMOR_BODY)
				{
					iSecondPct = 10;
					iThirdPct = 2;
				}
				else
				{
					iSecondPct = 10;
					iThirdPct = 1;
				}
				break;

// And paste with this

			case ITEM_COSTUME:
				iSecondPct = 50;
				iThirdPct = 40;
				break;

			case ITEM_ARMOR:
				if (GetSubType() == ARMOR_BODY)
				{
					iSecondPct = 10;
					iThirdPct = 2;
				}
				else
				{
					iSecondPct = 10;
					iThirdPct = 1;
				}
				break;

// Now search

			case ITEM_COSTUME:
			case ITEM_ARMOR:
				if (GetSubType() == ARMOR_BODY)
				{
					iSecondPct = 20;
					iThirdPct = 10;
				}
				else
				{
					iSecondPct = 10;
					iThirdPct = 5;
				}
				break;

// And paste with this

			case ITEM_COSTUME:
				iSecondPct = 50;
				iThirdPct = 40;
				break;

			case ITEM_ARMOR:
				if (GetSubType() == ARMOR_BODY)
				{
					iSecondPct = 20;
					iThirdPct = 10;
				}
				else
				{
					iSecondPct = 10;
					iThirdPct = 5;
				}
				break;

 

 

Now client (uiinventory.py/root):

# Search this

USE_TYPE_TUPLE = ("USE_CLEAN_SOCKET", "USE_CHANGE_ATTRIBUTE", "USE_ADD_ATTRIBUTE", "USE_ADD_ATTRIBUTE2", "USE_ADD_ACCESSORY_SOCKET", "USE_PUT_INTO_ACCESSORY_SOCKET", "USE_PUT_INTO_BELT_SOCKET", "USE_PUT_INTO_RING_SOCKET")

# And paste with this

USE_TYPE_TUPLE = ("USE_CLEAN_SOCKET", "USE_CHANGE_ATTRIBUTE", "USE_ADD_ATTRIBUTE", "USE_ADD_ATTRIBUTE2", "USE_ADD_ACCESSORY_SOCKET", "USE_PUT_INTO_ACCESSORY_SOCKET", "USE_PUT_INTO_BELT_SOCKET", "USE_PUT_INTO_RING_SOCKET", "USE_COSTUME_CHANGE_ATTRIBUTE", "USE_COSTUME_ADD_ATTRIBUTE")

locale/xx/itemdesc.txt:

 

79998	Bonus spell Your description
79999	Changing spell  Your description

locale/xx/item_list.txt

79998	ETC	icon/item/79998.tga
79999	ETC	icon/item/79999.tga

Item_proto.txt:

79998	????	ITEM_USE	USE_COSTUME_CHANGE_ATTRIBUTE	1	ANTI_DROP | ANTI_SELL | ANTI_GIVE | ANTI_MYSHOP	ITEM_STACKABLE | LOG	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
79999	????	ITEM_USE	USE_COSTUME_ADD_ATTRIBUTE	1	ANTI_DROP | ANTI_SELL | ANTI_GIVE | ANTI_MYSHOP	ITEM_STACKABLE | LOG	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

item_names.txt:

79998	Bonus spell
79999	Changing spell

 

Link download: 

This is the hidden content, please

 

Password archive: vegas_metin2dev.org

  • Metin2 Dev 20
  • Eyes 1
  • Not Good 1
  • Confused 1
  • Good 5
  • Love 2
  • Love 21
Link to comment
Share on other sites

Edit: It works, thanks  (.Avenue™ method)

 

Edit2: Fix for .Avenue™ method:

 

// Transform costume
if (item->GetVnum() == 70063)
{
	if (item2->GetType() != ITEM_COSTUME)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ITEM_ISNT_COSTUME"));
		return false;
	}
	
	//SLZ fix
	if (item2->GetAttributeCount() == 0)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ĽÓĽşŔ» şŻ°ćÇŇ Ľö ľř´Â ľĆŔĚĹŰŔÔ´Ď´Ů."));
		return false;
	}
	//SLZ fix
	
	if (item2->GetAttributeCount() < 3)
	{
		if (number(1, 100) < 30)
		{
			while(item2->GetAttributeCount() < number(2, 3))
				item2->AddAttribute();
		}
	}
}
// Enchant costume
if (item->GetVnum() == 70064)
{
	if (item2->GetType() != ITEM_COSTUME)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ITEM_ISNT_COSTUME"));
		return false;
	}
}

Because when we're lucky and 70063 want to give plus bonuses, we can add bonus to a non-bonus costume.

(Bad English i know.. but hope u can understand)

Edited by TheSLZ
Link to comment
Share on other sites

Tactius, do you use .Avenue™ method?

If yes, use this proto:

70063	ňء¤Ŕç°ˇşńĽ­11	ITEM_USE	USE_CHANGE_ATTRIBUTE	1	NONE	ITEM_STACKABLE | LOG | STACKABLE	NONE	NONE	1000000	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
70064	ňء¤Ŕç°ćşńĽ­11	ITEM_USE	USE_CHANGE_ATTRIBUTE	1	NONE	ITEM_STACKABLE | LOG | STACKABLE	NONE	NONE	500000	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

626091783Screenshot_1_www.kepfeltoltes.h

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Premium

work good just problem is why when put item in costume show me red color, and normal must show green...here is picUntitled.thumb.png.271d8efe61651340be583

If someone uses my method:

Open uiInventory.py (Client)

Search for 

elif "USE_CHANGE_ATTRIBUTE" == useType:

Replace with 

elif "USE_CHANGE_ATTRIBUTE" == useType:
                if srcItemVNum == 70063 or srcItemVNum == 70064:
                    if self.__CanChangeCostumeAttrList(dstSlotPos):
                        return True
                else:
                    if self.__CanChangeItemAttrList(dstSlotPos):
                        return True

After that, search for

def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):

Paste this above it

	def __CanChangeCostumeAttrList(self, dstSlotPos):
		dstItemVNum = player.GetItemIndex(dstSlotPos)
		if dstItemVNum == 0:
			return False

		item.SelectItem(dstItemVNum)

		if item.GetItemType() == item.ITEM_TYPE_COSTUME:
			return True

		return False

@TheSLZ: Don't needed. It checks first, wether the bonuses are == 0 and returns

  1.         if (item2->GetAttributeCount() == 0)
  2.         {
  3.                 ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯°æÇÒ ¼Ó¼ºÀÌ ¾ø½À´Ï´Ù."));
  4.                 return false;
  5.         }
Edited by .Avenue™
Link to comment
Share on other sites

  • Premium

work good just problem is why when put item in costume show me red color, and normal must show green...here is picUntitled.thumb.png.271d8efe61651340be583

If someone uses my method:

Search for 

elif "USE_CHANGE_ATTRIBUTE" == useType:

Replace with 

elif "USE_CHANGE_ATTRIBUTE" == useType:
                if srcItemVNum == 70063 or srcItemVNum == 70064:
                    if self.__CanChangeCostumeAttrList(dstSlotPos):
                        return True
                else:
                    if self.__CanChangeItemAttrList(dstSlotPos):
                        return True

After that, search for

def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):

Paste this above it

	def __CanChangeCostumeAttrList(self, dstSlotPos):
		dstItemVNum = player.GetItemIndex(dstSlotPos)
		if dstItemVNum == 0:
			return False

		item.SelectItem(dstItemVNum)

		if item.GetItemType() == item.ITEM_TYPE_COSTUME:
			return True

		return False

@TheSLZ: Don't needed. It checks first, wether the bonuses are == 0 and returns

  1.         if (item2->GetAttributeCount() == 0)
  2.         {
  3.                 ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯°æÇÒ ¼Ó¼ºÀÌ ¾ø½À´Ï´Ù."));
  4.                 return false;
  5.         }

sorry but i don't understand !

search for them in what file ?

Link to comment
Share on other sites

  • Premium

work good just problem is why when put item in costume show me red color, and normal must show green...here is picUntitled.thumb.png.271d8efe61651340be583

If someone uses my method:

Search for 

elif "USE_CHANGE_ATTRIBUTE" == useType:

Replace with 

elif "USE_CHANGE_ATTRIBUTE" == useType:
                if srcItemVNum == 70063 or srcItemVNum == 70064:
                    if self.__CanChangeCostumeAttrList(dstSlotPos):
                        return True
                else:
                    if self.__CanChangeItemAttrList(dstSlotPos):
                        return True

After that, search for

def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):

Paste this above it

	def __CanChangeCostumeAttrList(self, dstSlotPos):
		dstItemVNum = player.GetItemIndex(dstSlotPos)
		if dstItemVNum == 0:
			return False

		item.SelectItem(dstItemVNum)

		if item.GetItemType() == item.ITEM_TYPE_COSTUME:
			return True

		return False

@TheSLZ: Don't needed. It checks first, wether the bonuses are == 0 and returns

  1.         if (item2->GetAttributeCount() == 0)
  2.         {
  3.                 ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯°æÇÒ ¼Ó¼ºÀÌ ¾ø½À´Ï´Ù."));
  4.                 return false;
  5.         }

 

sorry but i don't understand !

search for them in what file ?

I'm sorry.

uiInventory.py (Client)*

Link to comment
Share on other sites

  • Premium

thanks .Avenue™

but one more thing i want the item_proto.txt data

kind regards

70063	transform_costume	ITEM_USE	USE_CHANGE_ATTRIBUTE	1	ANTI_DROP | ANTI_SELL | ANTI_GIVE | ANTI_MYSHOP	ITEM_STACKABLE | LOG	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
70064	enchant_costume	ITEM_USE	USE_CHANGE_ATTRIBUTE	1	ANTI_DROP | ANTI_SELL | ANTI_GIVE | ANTI_MYSHOP	ITEM_STACKABLE | LOG	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

 

  • Love 1
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

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.