void COfflineShop::RequestBuyRequiredItem(User *pUser)
{
if(m_Enabled)
{
if(!pUser->IsNowTrade())
{
if(pUser->pSD->nStoreMode == 0)
{
if(m_RequiredItemPriceId > 0 && m_RequiredItemPriceCount > 0)
{
if(!pUser->inventory.HaveItemByClassID(m_RequiredItemId, m_RequiredItemCount))
{
if(pUser->inventory.HaveItemByClassID(m_RequiredItemPriceId, m_RequiredItemPriceCount))
{
pUser->DeleteItemInInventory(m_RequiredItemPriceId, m_RequiredItemPriceCount);
pUser->AddItemToInventory(m_RequiredItemId, m_RequiredItemCount);
}else
{
pUser->pSocket->SendSystemMessage(L"You don't have enough required items to do this action!");
return;
}
}else
{
pUser->pSocket->SendSystemMessage(L"You already have offline shop item!");
return;
}
}else
{
pUser->AddItemToInventory(m_RequiredItemId, m_RequiredItemCount);
}
}else
{
pUser->pSocket->SendSystemMessage(L"You cannot do this action while having a private store!");
}
}else
{
pUser->pSocket->SendSystemMessage(L"You cannot do this action while trading!");
}
}else
{
pUser->pSocket->SendSystemMessage(L"This feature is disabled!");
return;
}
}
Code for fix button buy offline shop item.