Jump to content

Dragon soul stones trading says inventory full


Go to solution Solved by Karbust,

Recommended Posts

  • Management

Hello,

When I try to trade soul stones it says the victim's inventory is full...

With other items it works, but with soul stones in trade it always says the same message...

My exchange CheckSpace function:

Spoiler

bool CExchange::CheckSpace()
{
    static CGrid s_grid1(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 1
    static CGrid s_grid2(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 2
    static CGrid s_grid3(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 3
    static CGrid s_grid4(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 4
    static CGrid s_grid5(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 5
    static CGrid s_grid6(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 6
    static CGrid s_grid7(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 7
    static CGrid s_grid8(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 8
    static CGrid s_grid9(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 9
    static CGrid s_grid10(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 10
    static CGrid s_grid11(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 11
    static CGrid s_grid12(5, INVENTORY_MAX_NUM / 5 / 12); // inven page 12

    s_grid1.Clear();
    s_grid2.Clear();
    s_grid3.Clear();
    s_grid4.Clear();
    s_grid5.Clear();
    s_grid6.Clear();
    s_grid7.Clear();
    s_grid8.Clear();
    s_grid9.Clear();
    s_grid10.Clear();
    s_grid11.Clear();
    s_grid12.Clear();

    LPCHARACTER    victim = GetCompany()->GetOwner();
    LPITEM item;

    int i;
    const int PageSlotCount = INVENTORY_MAX_NUM / 12;

    for (i = 0; i < INVENTORY_MAX_NUM; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        BYTE itemSize = item->GetSize();

        if (i < PageSlotCount)
            s_grid1.Put(i, 1, itemSize);
        else if (i < PageSlotCount * 2)
            s_grid2.Put(i - PageSlotCount, 1, itemSize);
        else if (i < PageSlotCount * 3)
            s_grid3.Put(i - PageSlotCount * 2, 1, itemSize);
        else if (i < PageSlotCount * 4)
            s_grid4.Put(i - PageSlotCount * 3, 1, itemSize);
        else if (i < PageSlotCount * 5)
            s_grid5.Put(i - PageSlotCount * 4, 1, itemSize);
        else if (i < PageSlotCount * 6)
            s_grid6.Put(i - PageSlotCount * 5, 1, itemSize);
        else if (i < PageSlotCount * 7)
            s_grid7.Put(i - PageSlotCount * 6, 1, itemSize);
        else if (i < PageSlotCount * 8)
            s_grid8.Put(i - PageSlotCount * 7, 1, itemSize);
        else if (i < PageSlotCount * 9)
            s_grid9.Put(i - PageSlotCount * 8, 1, itemSize);
        else if (i < PageSlotCount * 10)
            s_grid10.Put(i - PageSlotCount * 9, 1, itemSize);
        else if (i < PageSlotCount * 11)
            s_grid11.Put(i - PageSlotCount * 10, 1, itemSize);
        else if (i < PageSlotCount * 12)
            s_grid12.Put(i - PageSlotCount * 11, 1, itemSize);
    }

    static std::vector <WORD> s_vDSGrid(DRAGON_SOUL_INVENTORY_MAX_NUM);
    
    bool bDSInitialized = false;
    
    for (i = 0; i < EXCHANGE_ITEM_MAX_NUM; ++i)
    {
        if (!(item = m_apItems[i]))
            continue;

        BYTE itemSize = item->GetSize();

        if (item->IsDragonSoul())
        {
            if (!victim->DragonSoul_IsQualified())
            {
                return false;
            }

            if (!bDSInitialized)
            {
                bDSInitialized = true;
                victim->CopyDragonSoulItemGrid(s_vDSGrid);
            }

            bool bExistEmptySpace = false;
            WORD wBasePos = DSManager::instance().GetBasePosition(item);
            if (wBasePos >= DRAGON_SOUL_INVENTORY_MAX_NUM)
                return false;
            
            for (int i = 0; i < DRAGON_SOUL_BOX_SIZE; i++)
            {
                WORD wPos = wBasePos + i;
                if (0 == s_vDSGrid[wBasePos])
                {
                    bool bEmpty = true;
                    for (int j = 1; j < item->GetSize(); j++)
                    {
                        if (s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM])
                        {
                            bEmpty = false;
                            break;
                        }
                    }
                    if (bEmpty)
                    {
                        for (int j = 0; j < item->GetSize(); j++)
                        {
                            s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM] =  wPos + 1;
                        }
                        bExistEmptySpace = true;
                        break;
                    }
                }
                if (bExistEmptySpace)
                    break;
            }
            if (!bExistEmptySpace)
                return false;
        }
        else
        {
            int iPos = s_grid1.FindBlank(1, itemSize);
            if (iPos >= 0) 
            {
                s_grid1.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid2.FindBlank(1, itemSize);
            if (iPos >= 0) 
            {
                s_grid2.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid3.FindBlank(1, itemSize);
            if (iPos >= 0) 
            {
                s_grid3.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid4.FindBlank(1, itemSize);
            if (iPos >= 0) 
            {
                s_grid4.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid5.FindBlank(1, itemSize);
            if (iPos >= 0) 
            {
                s_grid5.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid6.FindBlank(1, itemSize);
            if (iPos >= 0)
            {
                s_grid6.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid7.FindBlank(1, itemSize);
            if (iPos >= 0)
            {
                s_grid7.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid8.FindBlank(1, itemSize);
            if (iPos >= 0)
            {
                s_grid8.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid9.FindBlank(1, itemSize);
            if (iPos >= 0)
            {
                s_grid9.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid10.FindBlank(1, itemSize);
            if (iPos >= 0)
            {
                s_grid10.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid11.FindBlank(1, itemSize);
            if (iPos >= 0)
            {
                s_grid11.Put(iPos, 1, itemSize);
                continue;
            }

            iPos = s_grid12.FindBlank(1, itemSize);
            if (iPos >= 0)
            {
                s_grid12.Put(iPos, 1, itemSize);
                continue;
            }

            return false;
        }
    }

    return true;
}  

 

Does anyone know what can be causing the problem?

Thank you

raw

raw

Link to comment
Share on other sites

  • Management
  • Solution

I found the solution in this topic a few days ago: 

 

It the same solution as @Chookez posted.

@Legend I already had ds qualification, other wise I could even use the most of dragon soul system, I just couldn't trade it...

Thanks anyway

raw

raw

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.