Jump to content

Recommended Posts

  • Active+ Member

Hey guys,

someone know how to extend this function to block use of items when shop window is opened which are in slots like experience ring? 

Spoiler

bool CPythonNetworkStream::SendItemUsePacket(TItemPos pos)
{
	if (!__CanActMainInstance())
		return true;

	if (__IsEquipItemInSlot(pos))
	{
		if (CPythonExchange::Instance().isTrading())
		{
			PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_AppendNotifyMessage", Py_BuildValue("(s)", "CANNOT_EQUIP_EXCHANGE"));
			return true;
		}

		if (CPythonShop::Instance().IsOpen())
		{
			PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_AppendNotifyMessage", Py_BuildValue("(s)", "CANNOT_EQUIP_SHOP"));
			return true;
		}

		if (__IsPlayerAttacking())
			return true;
	}

	__PlayInventoryItemUseSound(pos);

	TPacketCGItemUse itemUsePacket;
	itemUsePacket.header = HEADER_CG_ITEM_USE;
	itemUsePacket.pos = pos;

	if (!Send(sizeof(TPacketCGItemUse), &itemUsePacket))
	{
		Tracen("SendItemUsePacket Error");
		return false;
	}

	return SendSequence();
}

 

Thanks for answers!

Sincerely,

ReFresh

I'll be always helpful!  😉

Link to comment
https://metin2.dev/topic/20111-block-item-use-when-shop-window-is-opened/
Share on other sites

  • 2 weeks later...
  • 1 month later...

Search in itemData.cpp for

BOOL CItemData::IsEquipment() const

and extend the cases like this:

BOOL CItemData::IsEquipment() const
{
	switch (GetType())
	{
		case ITEM_TYPE_WEAPON:
		case ITEM_TYPE_ARMOR:
		case ITEM_TYPE_UNIQUE:
			return TRUE;
			break;
	}

	return FALSE;
}

This should work. You can extend for as much as you want. just add the item type for the items you want to block.

  • Love 1
  • 4 years later...
  • Active Member

Fast Fix:

uiinventory.py

Search for:

	def __UseItem(self, slotIndex):

 

Add it below:

		if shop.IsOpen():
			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CANNOT_EQUIP_IN_SHOP)
			return

 

What you showed should work, but it doesn't. ?

Buy a new system? 
My systems:  https://payhip.com/Pisti95

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.