Jump to content

Recommended Posts

Posted (edited)

Hey com,

i implemented the system by mali in my server but i can't put the item into the socket... it says This item cannot be used.

Spoiler

.png

I'm using the reference files by TMP4

 

no syserr errors in server and client

Can someone help me here please?

 

Sorry for my bad english😅

Edited by backtop
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

14 hours ago, xP3NG3Rx said:

Check the conditions and the type/subtype of the item on both sides(server, client).

Hey thank you for your time

ich check the type/subtype and i can't see a issue there... Type is ITEM_MEDIUM and subytype is MEDIUM_MOVE_COSTUME_ATTR

the conditions are:

char_item.cpp

Spoiler
void CHARACTER::ItemCombination(const short MediumIndex, const short BaseIndex, const short MaterialIndex)
{
	if (IsItemComb() == false)
		return;
	
	const LPITEM MediumItem		= GetItem(TItemPos(INVENTORY, MediumIndex));
	const LPITEM BaseItem		= GetItem(TItemPos(INVENTORY, BaseIndex));
	const LPITEM MaterialItem	= GetItem(TItemPos(INVENTORY, MaterialIndex));

	if (MediumItem == NULL || BaseItem == NULL || MaterialItem == NULL)
		return;

	switch (MediumItem->GetType())
	{
	case EItemTypes::ITEM_MEDIUM:
		switch (MediumItem->GetSubType())
		{
		case EMediumSubTypes::MEDIUM_MOVE_COSTUME_ATTR:
			break;
		/*case EMediumSubTypes::MEDIUM_MOVE_ACCE_ATTR:
			break;*/
		default:
			return;
		}
		break;
	default:
		return;
	}

	if (BaseItem->IsEquipped() || MaterialItem->IsEquipped())
		return;

	if (BaseItem->GetType() != EItemTypes::ITEM_COSTUME || MaterialItem->GetType() != EItemTypes::ITEM_COSTUME)
		return;
	
	if (BaseItem->GetSubType() != MaterialItem->GetSubType())
		return;

	if (BaseItem->GetAttributeCount() < 1 || MaterialItem->GetAttributeCount() < 1)
		return;

	BaseItem->SetAttributes(MaterialItem->GetAttributes());
	BaseItem->UpdatePacket();

	ITEM_MANAGER::instance().RemoveItem(MaterialItem, "REMOVE (Item Combination)");
	MediumItem->SetCount(MediumItem->GetCount() - 1);
}

 

This should be the clientside condition i think

Spoiler
PyObject* playerCanAttachToCombMediumSlot(PyObject* poSelf, PyObject* poArgs)
{
	BYTE bSlotType;
	if (!PyTuple_GetByte(poArgs, 0, &bSlotType))
		return Py_BadArgument();

	TItemPos Cell;
	if (!PyTuple_GetByte(poArgs, 1, &Cell.window_type))
		return Py_BuildException();
	if (!PyTuple_GetInteger(poArgs, 2, &Cell.cell))
		return Py_BuildException();

	if (bSlotType != ECombSlotType::COMB_WND_SLOT_MEDIUM || Cell.window_type != INVENTORY)
		return Py_BuildValue("b", false);

	const TItemData* pItem = CPythonPlayer::Instance().GetItemData(Cell);
	if (pItem == nullptr)
		return Py_BuildValue("b", false);

	CItemData* pItemData = nullptr;
	if (CItemManager::Instance().GetItemDataPointer(pItem->vnum, &pItemData) == false)
		return Py_BuildValue("b", false);

	const bool bRet = pItemData->GetType() == CItemData::EItemType::ITEM_TYPE_MEDIUM 
		&& pItemData->GetSubType() == CItemData::EMediumSubTypes::MEDIUM_MOVE_COSTUME_ATTR;

	return Py_BuildValue("b", bRet);
}

 

i can't see a issue here...

Link to comment
Share on other sites

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.