[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: Sat Jun 11, 2005 10:54 pm
Location: Bilbao

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

Post by GallaZ » Wed Oct 26, 2005 3:05 pm

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: Thu Dec 09, 2004 7:50 pm
Location: North Rhine-Westphalia, Germany
Contact:

Post by Bjørn » Thu Oct 27, 2005 4:48 pm

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

Post by Rotonen » Thu Oct 27, 2005 10:20 pm

Yet again, I would not.

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

Post by GallaZ » Fri Oct 28, 2005 11:20 am

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

Post by Matt » Fri Oct 28, 2005 4:45 pm

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

Post by Pajarico » Fri Oct 28, 2005 8:43 pm

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: Tue Oct 18, 2005 5:53 am

Post by AoH » Sat Oct 29, 2005 8:49 am

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