(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);
}
}
- Fix the position and equipped items.
- Implement in equipmentwindow double click equipped or unequipped item.
The result ^^