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

Content and general development discussion, including maps, quests, and server code from the development team.
Post Reply
GallaZ
Peon
Peon
Posts: 7
Joined: 11 Jun 2005, 22:54
Location: Bilbao

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

Post by GallaZ » 26 Oct 2005, 15:05

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
User avatar
Bjørn
TMW Adviser
TMW Adviser
Posts: 1430
Joined: 09 Dec 2004, 19:50
Location: North Rhine-Westphalia, Germany
Contact:

Post by Bjørn » 27 Oct 2005, 16:48

I would prefer equipped items to stay visible in the inventory window.
User avatar
Rotonen
TMW Adviser
TMW Adviser
Posts: 3154
Joined: 08 Sep 2004, 20:48
Location: Espoo, Finland

Post by Rotonen » 27 Oct 2005, 22:20

Yet again, I would not.

So this should be an option? :)
This message used to be meaningful.
GallaZ
Peon
Peon
Posts: 7
Joined: 11 Jun 2005, 22:54
Location: Bilbao

Post by GallaZ » 28 Oct 2005, 11:20

amss... ok, np.
Matt
Knight
Knight
Posts: 1746
Joined: 07 Aug 2004, 11:47
Location: Germany->Bavaria

Post by Matt » 28 Oct 2005, 16:45

well..how can i unequip them?
User avatar
Pajarico
Warrior
Warrior
Posts: 592
Joined: 28 Feb 2005, 20:29
Contact:

Post by Pajarico » 28 Oct 2005, 20:43

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.
Lv.: Maggot
Please, read the FAQ before posting.
User avatar
AoH
Peon
Peon
Posts: 25
Joined: 18 Oct 2005, 05:53

Post by AoH » 29 Oct 2005, 08:49

Humm i like that, Diablo II style thanks :P
Post Reply