Jump to content

[PROBLEM] Costume Weapon


Recommended Posts

Hi, I have code and problem: https://metin2.download/picture/x9GwEqWE7WrmQUV72GBgZ1cxp38z5yg3/.gif

common/item_length.h

enum ECostumeSubTypes
{
	COSTUME_BODY = ARMOR_BODY,
	COSTUME_HAIR = ARMOR_HEAD,
	COSTUME_WEAPON = WEAPON_SWORD,
	COSTUME_NUM_TYPES,
};
enum EItemWearableFlag
{
	WEARABLE_BODY	= (1 << 0),
	WEARABLE_HEAD	= (1 << 1),
	WEARABLE_FOOTS	= (1 << 2),
	WEARABLE_WRIST	= (1 << 3),
	WEARABLE_WEAPON	= (1 << 4),
	WEARABLE_NECK	= (1 << 5),
	WEARABLE_EAR	= (1 << 6),
	WEARABLE_UNIQUE	= (1 << 7),
	WEARABLE_SHIELD	= (1 << 8),
	WEARABLE_ARROW	= (1 << 9),
	WEARABLE_HAIR	= (1 << 10),
	WEARABLE_ABILITY		= (1 << 11),
	WEARABLE_COSTUME_BODY	= (1 << 12),
	WEARABLE_COSTUME_WEAPON	= (1 << 13),
};

common/length.h

enum EWearPositions
{
	WEAR_BODY,		// 0
	WEAR_HEAD,		// 1
	WEAR_FOOTS,		// 2
	WEAR_WRIST,		// 3
	WEAR_WEAPON,	// 4
	WEAR_NECK,		// 5
	WEAR_EAR,		// 6
	WEAR_UNIQUE1,	// 7
	WEAR_UNIQUE2,	// 8
	WEAR_ARROW,		// 9
	WEAR_SHIELD,	// 10
    WEAR_ABILITY1,  // 11
    WEAR_ABILITY2,  // 12
    WEAR_ABILITY3,  // 13
    WEAR_ABILITY4,  // 14
    WEAR_ABILITY5,  // 15
    WEAR_ABILITY6,  // 16
    WEAR_ABILITY7,  // 17
    WEAR_ABILITY8,  // 18
	WEAR_COSTUME_BODY,	// 19
	WEAR_COSTUME_HAIR,	// 20
	WEAR_COSTUME_WEAPON,	// 20
	
	WEAR_RING1,			// 21	: 신규 반지슬롯1 (왼쪽)
	WEAR_RING2,			// 22	: 신규 반지슬롯2 (오른쪽)

	WEAR_BELT,			// 23	: 신규 벨트슬롯

	WEAR_MAX = 32	// 
};

game/src/char_item.cpp

			case POINT_COSTUME_ATTR_BONUS:
				{
					static BYTE abSlot[] = { WEAR_COSTUME_BODY, WEAR_COSTUME_HAIR, WEAR_COSTUME_WEAPON };
					static std::vector <BYTE> vec_slots (abSlot, abSlot + _countof(abSlot));
					pBuff = M2_NEW CBuffOnAttributes(this, bType, &vec_slots);
				}

game/src/cmd_general.cpp

ACMD(do_costume)
{
	char buf[512];
	const size_t bufferSize = sizeof(buf);

	char arg1[256];
	one_argument(argument, arg1, sizeof(arg1));

	CItem* pBody = ch->GetWear(WEAR_COSTUME_BODY);
	CItem* pHair = ch->GetWear(WEAR_COSTUME_HAIR);
	CItem* pWeapon = ch->GetWear(WEAR_COSTUME_WEAPON);

	ch->ChatPacket(CHAT_TYPE_INFO, "COSTUME status:");

	if (pHair)
	{
		const char* itemName = pHair->GetName();
		ch->ChatPacket(CHAT_TYPE_INFO, "  HAIR : %s", itemName);

		for (int i = 0; i < pHair->GetAttributeCount(); ++i)
		{
			const TPlayerItemAttribute& attr = pHair->GetAttribute(i);
			if (0 < attr.bType)
			{
				snprintf(buf, bufferSize, FN_point_string(attr.bType), attr.sValue);
				ch->ChatPacket(CHAT_TYPE_INFO, "     %s", buf);
			}
		}

		if (pHair->IsEquipped() && arg1[0] == 'h')
			ch->UnequipItem(pHair);
	}

	if (pBody)
	{
		const char* itemName = pBody->GetName();
		ch->ChatPacket(CHAT_TYPE_INFO, "  BODY : %s", itemName);

		if (pBody->IsEquipped() && arg1[0] == 'b')
			ch->UnequipItem(pBody);
	}
	if (pWeapon)
	{
		const char* itemName = pWeapon->GetName();
		ch->ChatPacket(CHAT_TYPE_INFO, "  WEAPON : %s", itemName);

		if (pWeapon->IsEquipped() && arg1[0] == 'w')
			ch->UnequipItem(pWeapon);
	}
}

game/src/item.cpp

	else if (GetType() == ITEM_COSTUME)
	{
		if (GetSubType() == COSTUME_BODY)
			return WEAR_COSTUME_BODY;
		else if (GetSubType() == COSTUME_HAIR)
			return WEAR_COSTUME_HAIR;
		else if (GetSubType() == COSTUME_WEAPON)
			return WEAR_COSTUME_WEAPON;
	}
               else if (GetSubType() == COSTUME_WEAPON)
                {
                    toSetPart = PART_WEAPON;

                    if (false == bAdd)
                    {
                        // 코스츔 갑옷을 벗었을 때 원래 갑옷을 입고 있었다면 그 갑옷으로 look 세팅, 입지 않았다면 default look
                        const CItem* pWeapon = m_pOwner->GetWear(WEAR_WEAPON);
                        toSetValue = (NULL != pWeapon) ? pWeapon->GetVnum() : m_pOwner->GetOriginalPart(PART_WEAPON);                        
                    }
                    
                }

game/src/char.cpp

	switch (bPartPos)
	{
		case PART_MAIN:
			if (!IsPC()) // PC가 아닌 경우 현재 파트를 그대로 리턴
				return GetPart(PART_MAIN);
			else
				return m_pointsInstant.bBasePart;

		case PART_HAIR:
			return GetPart(PART_HAIR);
			
		case PART_WEAPON:// to dodałem
			return GetPart(PART_WEAPON);// to

		default:
			return 0;
	}

db/src/ProtoReader.cpp

	static string arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_WEAPON" };

CLIENT:

UserInterface/GameType.h

#ifdef ENABLE_COSTUME_SYSTEM
	const DWORD c_Costume_Slot_Start = c_Equipment_Start + 19;
	const DWORD	c_Costume_Slot_Body = c_Costume_Slot_Start + 0;
	const DWORD	c_Costume_Slot_Hair = c_Costume_Slot_Start + 1;
	const DWORD	c_Costume_Slot_Weapon = c_Costume_Slot_Start + 2;
	const DWORD c_Costume_Slot_Count = 3;
	const DWORD c_Costume_Slot_End = c_Costume_Slot_Start + c_Costume_Slot_Count;
#endif
#ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
	const DWORD c_New_Equipment_Start = c_Equipment_Start + 22;
	const DWORD c_New_Equipment_Count = 3;
	const DWORD c_Equipment_Ring1 = c_New_Equipment_Start + 1;
	const DWORD c_Equipment_Ring2 = c_New_Equipment_Start + 2;
	const DWORD c_Equipment_Belt = c_New_Equipment_Start + 0;
#endif

UserInterface/PythonItemModule.cpp

#ifdef ENABLE_COSTUME_SYSTEM
	PyModule_AddIntConstant(poModule, "ITEM_TYPE_COSTUME",			CItemData::ITEM_TYPE_COSTUME);
	PyModule_AddIntConstant(poModule, "COSTUME_TYPE_BODY",			CItemData::COSTUME_BODY);
	PyModule_AddIntConstant(poModule, "COSTUME_TYPE_HAIR",			CItemData::COSTUME_HAIR);
	PyModule_AddIntConstant(poModule, "COSTUME_TYPE_WEAPON",			CItemData::COSTUME_WEAPON);
	PyModule_AddIntConstant(poModule, "COSTUME_SLOT_START",			c_Costume_Slot_Start);
	PyModule_AddIntConstant(poModule, "COSTUME_SLOT_COUNT",			c_Costume_Slot_Count);
	PyModule_AddIntConstant(poModule, "COSTUME_SLOT_BODY",			c_Costume_Slot_Body);
	PyModule_AddIntConstant(poModule, "COSTUME_SLOT_HAIR",			c_Costume_Slot_Hair);
	PyModule_AddIntConstant(poModule, "COSTUME_SLOT_WEAPON",			c_Costume_Slot_Weapon);
	PyModule_AddIntConstant(poModule, "COSTUME_SLOT_END",			c_Costume_Slot_End);
#endif

GameLib/ItemData.h

enum ECostumeSubTypes
{
	COSTUME_BODY,
	COSTUME_HAIR,
	COSTUME_WEAPON,
	COSTUME_NUM_TYPES,
};

root/uiTooltip.py

		isCostumeItem = 0
		isCostumeHair = 0
		isCostumeBody = 0
		isCostumeWeapon = 0
			
		if app.ENABLE_COSTUME_SYSTEM:
			if item.ITEM_TYPE_COSTUME == itemType:
				isCostumeItem = 1
				isCostumeHair = item.COSTUME_TYPE_HAIR == itemSubType
				isCostumeBody = item.COSTUME_TYPE_BODY == itemSubType
				isCostumeWeapon = item.COSTUME_TYPE_WEAPON == itemSubType

uiscript/costumewindow.py

										{"index":COSTUME_START_INDEX+2, "x":10, "y": 8, "width":32, "height":92},

querty:

10    Ǧތڹ    ITEM_COSTUME    COSTUME_WEAPON    2    ANTI_FEMALE | ANTI_DROP | ANTI_SELL | ANTI_GIVE | ANTI_STACK | ANTI_MYSHOP    NONE    NONE    NONE    0    0    0    0    0    REAL_TIME    86400    LIMIT_NONE    0    APPLY_NONE    0    APPLY_NONE    0    APPLY_NONE    0    5    0    0    40033    0    0    0    0    0

 

 

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

  • 1 year later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Premium

syserr

Spoiler

1108 18:17:22548 ::   File "ui.py", line 79, in __call__

1108 18:17:22548 ::   File "uiInventory.py", line 1183, in OverInItem

1108 18:17:22549 ::   File "uiInventory.py", line 1359, in ShowToolTip

1108 18:17:22549 ::   File "uiToolTip.py", line 545, in SetInventoryItem

1108 18:17:22549 ::   File "uiToolTip.py", line 880, in AddItemData

1108 18:17:22549 ::   File "uiToolTip.py", line 1272, in __AppendHairIcon

1108 18:17:22549 ::   File "uiToolTip.py", line 239, in ResizeToolTip

1108 18:17:22549 ::   File "ui.py", line 1980, in SetSize

1108 18:17:22549 :: RuntimeError
1108 18:17:22549 :: : 
1108 18:17:22549 :: Failed to load image (filename: icon/hair/46002.sub)
1108 18:17:22549 :: 

 

Any help???

if pc.get_sex() == true and npc.get_sex() == false then
	npc.purge()
end

 

Link to comment
Share on other sites

  • 10 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.