The DPSrvr.cpp code goes like this:
Code:
void CDPSrvr::OnCraftingCMD( CAr & ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize )
{
CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
CMover* pMover = (CMover*)pUser;
if(!IsValidObj(pUser))
return;
const int nMaxMaterialCount = 3; // 3
CItemElem* pCraftingMaterial[nMaxMaterialCount];
OBJID objMaterial[3];
int tmpExtra;
CraftingItemProduct* pFoundProduct = NULL;
for(int i = 0;i < 3;i++)
{
ar >> dwItem[i];
ar >> tmpExtra;
pCraftingMaterial[i] = (CItemElem*)pUser->m_Inventory.GetAtId( dwItem[i] );
if(!pCraftingMaterial[i])
return;
pCraftingMaterial[i]->SetExtra(tmpExtra);
if((unsigned short)pCraftingMaterial[i]->GetExtra() > (unsigned short)pCraftingMaterial[i]->m_nItemNum)
{
pCraftingMaterial[i]->SetExtra(0);
return;
}
}
for(size_t i = 0;i < prj.m_aCraftingItemProducts.size();i++)
{
size_t nMatches = 0;
CraftingItemProduct* pCraftingProduct = &prj.m_aCraftingItemProducts.at(i);
if(pCraftingProduct)
{
for(size_t j = 0;j < pCraftingProduct->dwCraftingItems.size();j++)
{
CraftingItem* pCraftingItem = &pCraftingProduct->dwCraftingItems[j];
if(pCraftingItem)
{
for(size_t k = 0;k < nMaxMaterialCount;k++)
{
if(pCraftingItem->dwItemID == pCraftingMaterial[k]->GetProp()->dwID &&
pCraftingItem->dwCount == (DWORD)pCraftingMaterial[k]->GetExtra())
{
nMatches++;
if(nMatches == pCraftingProduct->dwCraftingItems.size() )
{
pFoundProduct = pCraftingProduct;
}
}
}
}
}
nMatches = 0;
}
}
I want to add an item id check on this system to prevent duplication's.
Example:
If the user put's a guardian weapon on the first slot the user is not allowed to put a guard weapon again on the 2nd and 3rd slot.
I tried this code base on the model change function:
Code:
DWORD dwItem1, dwItem2, dwItem3;
ar >> dwItem1 >> dwItem2 >> dwItem3;
if( pUser )
{
CItemElem * pItemElem = pUser->m_Inventory.GetAtId( dwItem1 );
CItemElem * pItemElem1 = pUser->m_Inventory.GetAtId( dwItem2 );
CItemElem * pItemElem2 = pUser->m_Inventory.GetAtId( dwItem3 );
if(pItemElem->GetProp()->dwID == pItemElem1->GetProp()->dwID == pItemElem2->GetProp()->dwID )
{
pUser->AddText("You can not use the same item!");
return;
}
}
But it's not working. >.<
I've been exploring around the source code

but no luck i hope you can help me. thanks