IFInventory.cpp

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
1.7 kB
49
Indexable
Never
void CIFInventory::FakePick(int nRefObjId, BYTE btSlot, int nCount) {
    const CItemData *data = g_CGlobalDataManager->GetItem(nRefObjId);
    if (data != NULL) {
        const SItemData &sItemData = data->GetData();

        CMsgStreamBuffer buf(0xB034);
        buf << BYTE(0x01) <<  BYTE(0x06) << btSlot << INT32(0) << INT32(nRefObjId);
        u_short typeID2 = sItemData.m_typeId.getTypeID2();
        u_short typeID3 = sItemData.m_typeId.getTypeID3();
        u_short typeID4 = sItemData.m_typeId.getTypeID4();

        switch (typeID2) {
            case 1:
            case 4:
            case 5:
                buf << UINT8(0) << UINT64(0) << UINT32(1) << UINT8(0) << UINT8(1) << UINT8(0) << UINT8(2) << UINT8(0);
                break;
            case 2:
                switch (typeID3) {
                    case 1:
                        buf << UINT8(0x01);
                        break;
                    case 2:
                        buf << UINT32(0x00);
                        break;
                    case 3:
                        buf << USHORT(0);
                        break;
                    default:
                        if (typeID4 == 3)//Magic cube
                            buf << UINT32(0x01);
                        break;
                }
                break;
            case 3:
                buf << UINT16(nCount);
                if (typeID3 == 11)
                    if (typeID4 == 1 || typeID4 == 2)
                        buf << UINT8(0x00);
                    else if (typeID3 == 14 && typeID4 == 2)
                        buf << UINT8(0x00);
                break;
        }

        SendMsgClient(buf);
    }
}
Leave a Comment