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

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

Post Reply
GallaZ
Peon
Peon
Posts: 7
Joined: 11 Jun 2005, 21:54
Location: Bilbao

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

Post 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
User avatar
Bjørn
Manasource
Manasource
Posts: 1438
Joined: 09 Dec 2004, 18:50
Location: North Rhine-Westphalia, Germany
Contact:

Post by Bjørn »

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, 19:48
Location: Bern, Switzerland

Post by Rotonen »

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, 21:54
Location: Bilbao

Post by GallaZ »

amss... ok, np.
Matt
Grand Knight
Grand Knight
Posts: 1759
Joined: 07 Aug 2004, 10:47
Location: Germany->Bavaria

Post by Matt »

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

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

Post by AoH »

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