Page 1 of 1

[Source] Items equipped, not view in the inventory window.

Posted: 26 Oct 2005, 14:05
by GallaZ
It is my report...
(sry, my english is poor ._.)

in gui/itemcontainer.cpp

find function class 'void ItemContainer::draw(gcn::Graphics* graphics)'
and to replace it by this other:

Code: Select all

void ItemContainer::draw(gcn::Graphics* graphics)
{
    int gridWidth = itemset->spriteset[0]->getWidth() + 4;
    int gridHeight = itemset->spriteset[0]->getHeight() + 10;
    int w = getWidth();
    int columns = w / gridWidth;
    int itemX, itemY;
    int itemEquipped = 0;

    // Have at least 1 column
    if (columns < 1)
    {
        columns = 1;
    }

    // Reset selected item when quantity not above 0 (should probably be made
    // sure somewhere else)
    if (selectedItem && selectedItem->getQuantity() <= 0)
    {
        selectedItem = 0;
    }

    /*
     * eAthena seems to start inventory from the 3rd slot. Still a mystery to
     * us why, make sure not to copy this oddity to our own server.
     */
    for (int i = 2; i < INVENTORY_SIZE; i++)
    {
        Item *item = mInventory->getItem(i);

        if (item->getQuantity() <= 0) {
            continue;
        }
        
        if (!item->isEquipped()) {
            itemX = ((i - itemEquipped - 2) % columns) * gridWidth;
            itemY = ((i - itemEquipped - 2) / columns) * gridHeight;
        } else {
            itemEquipped++;
        }
        
        // Draw selection image below selected item
        if (selectedItem == item)
        {
            dynamic_cast<Graphics*>(graphics)->drawImage(
                    selImg, itemX, itemY);
        }

        // Draw item icon
        int idx;
        if ((idx = item->getInfo()->getImage()) > 0 && !item->isEquipped())
        {
            dynamic_cast<Graphics*>(graphics)->drawImage(
                    itemset->spriteset[idx - 1], itemX, itemY);
        }

        // Draw item caption
        std::stringstream ss;

        if (!item->isEquipped()) {
            ss << item->getQuantity();
        }

        graphics->drawText(ss.str(),
                itemX + gridWidth / 2,
                itemY + gridHeight - 11,
                gcn::Graphics::CENTER);
    }
}
TODO:
- Fix the position and equipped items.
- Implement in equipmentwindow double click equipped or unequipped item.

The result ^^
Image

Posted: 27 Oct 2005, 15:48
by Bjørn
I would prefer equipped items to stay visible in the inventory window.

Posted: 27 Oct 2005, 21:20
by Rotonen
Yet again, I would not.

So this should be an option? :)

Posted: 28 Oct 2005, 10:20
by GallaZ
amss... ok, np.

Posted: 28 Oct 2005, 15:45
by Matt
well..how can i unequip them?

Posted: 28 Oct 2005, 19:43
by Pajarico
Bjørn wrote:I would prefer equipped items to stay visible in the inventory window.
Me too. But it would be cool if selected equipment was grayed out, and quick use objects were tinted with some other color.

Posted: 29 Oct 2005, 07:49
by AoH
Humm i like that, Diablo II style thanks :P