Thanks
But how do I do to get the next free slot?
The max slot is 6, the weapon/armor can use 3 by default, how to get the 4th slot? And if the 4th is already occupied, how to get the 5th?
EDIT: I'm using this code, item type 3, subtype 10, (using this code above case 71051) but when I drag and drop on an item, nothing happens...
In comment is another part I tried, but with no success...
case 3520 :
{
LPITEM item2;
if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
{
return false;
}
if (item2->IsEquipped() || item2->IsExchanging() || item2->IsEquipped())
{
return false;
}
if(item2->GetSubType() == ARMOR_BODY || item2-> GetType() == ITEM_WEAPON)
{
int count = item2->GetSocketCount();
if (count == ITEM_SOCKET_MAX_NUM)
return false;
item2->SetSocket(count, -1, true);
item2->UpdatePacket();
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Abris-te um socket com sucesso!"));
item->SetCount(item->GetCount() - 1);
return false;
}
}
break;
EDIT2: Working, but with a slight problem, when I open a slot it doesn't save on the database, it's just open while I don't teleport or reboot the server, is there any way to save it when the slot is open and maintain it open "forever"?
Code used:
case 3520 :
{
LPITEM item2;
if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
{
return false;
}
if (item2->IsEquipped() || item2->IsExchanging() || item2->IsEquipped())
{
return false;
}
if(item2->GetSubType() != ARMOR_BODY || item2-> GetType() != ITEM_WEAPON)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Só podes usar este item em armas e armaduras!"));
}
if(item2->GetSocketCount() == ITEM_SOCKET_MAX_NUM)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Só podes abrir até 6 sockets!"));
return false;
}
/*int count = item2->GetSocketCount();
if (count == ITEM_SOCKET_MAX_NUM)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Só podes abrir até 6 sockets!"));
return false;*/
//item2->SetSocket(count, -1, true);
item2->AddSocket();
item2->UpdatePacket();
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Abris-te um socket com sucesso!"));
item->SetCount(item->GetCount() - 1);
}
break;
EDIT3: Problem from EDIT2 solved, just needed to add item2->UpdatePacket() and item2->Save() or edit the AddSocket() function and add UpdatePacket() and Save()...
I think there's no more problems, thanks @ahynoa for the help!