EOSERV Forum > Client Editing > When Items Are Sold
Page: << 1 >>
When Items Are Sold
Author Message
Post #202695 When Items Are Sold

So when you open the sell menu on shops it will list the items you have that are able to be sold on the shop list and after you sell them the items that were on their "stay on it" even though you already sold them. They do disappear when you exit and re-open the sell menu so its nothing big.... but it seems like a bit of a visual fail is their anyway to fix that?

---
Graphics Designer.
"I'll keep believing in the future, not caring if anyone laughs at me"
Hi : D I am me!
2 years, 2 weeks ago
Post #202707 Re: When Items Are Sold

What happens if you re-send the sellable items packet after an item is sold?

---
I not hacker

“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its
whole life believing that it is stupid.” - Albert Einstein : Really Great Quote Ramy!
2 years, 2 weeks ago
Post #202710 Re: When Items Are Sold
Hacker_Alex posted: (6th Mar 2017, 07:38 pm)

What happens if you re-send the sellable items packet after an item is sold?


The server checks if you have the items, if you have 4 items and you sell 2, re sending the packet would just sell the other 2.

I think the shop only updates when you open it. Have you tried resending the shop open packet?

---
https://Havenshost.net/ - Cheap Windows VPS
2 years, 2 weeks ago
Post #202712 Re: When Items Are Sold

Pretty sure it's a client side issue and it won't clear the item from the menu until you open the entire shop again. When you open a shop the sell and buy menus are loaded into memory right there, so simply going into the buy or sell menus does not request any info from the server.

2 years, 2 weeks ago
Post #202792 Re: When Items Are Sold

@Callum

Good suggestion. It works great.

It was pretty easy to implement:


Config file:
## ShopReopenOnSell (bool)
# Navigation will go back to the shop's main menu after you sell an item.
# This will force the list of sellable items to update. Otherwise, the sellable list only updates once you re-open the "Sell Item(s)" window.
ShopReopenOnSell = true

eoserv_config.cpp:

eoserv_config_default(config, "ShopReopenOnSell"false);

Shop.cpp:

- Replace "Shop_Open()" method with:

void Shop_Open(Character *character, PacketReader &reader)
{
    short id = reader.GetShort();
    Shop_Open_ID(character, id);
}

- Add this method to the top:

void Shop_Open_ID(Character *character, short id)
{
    UTIL_FOREACH(character->map->npcs, npc)
    {
        if (npc->index == id && (npc->Data().shop_trade.size() > 0 || npc->Data().shop_craft.size() > 0))
        {
            character->npc = npc;
            character->npc_type = ENF::Shop;

            PacketBuilder reply(PACKET_SHOP, PACKET_OPEN,
                5 + npc->Data().shop_name.length() + npc->Data().shop_trade.size() * 9 + npc->Data().shop_craft.size() * 14);
            reply.AddShort(npc->id);
            reply.AddBreakString(npc->Data().shop_name.c_str());

            UTIL_FOREACH_CREF(npc->Data().shop_trade, item)
            {
                reply.AddShort(item->id);
                reply.AddThree(item->buy);
                reply.AddThree(item->sell);
                reply.AddChar(static_cast<int>(character->world->config["MaxShopBuy"]));
            }
            reply.AddByte(255);

            UTIL_FOREACH_CREF(npc->Data().shop_craft, item)
            {
                std::size_t i = 0;

                reply.AddShort(item->id);

                for (; i < item->ingredients.size(); ++i)
                {
                    reply.AddShort(item->ingredients[i].id);
                    reply.AddChar(item->ingredients[i].amount);
                }

                for (; i < 4; ++i)
                {
                    reply.AddShort(0);
                    reply.AddChar(0);
                }
            }
            reply.AddByte(255);

            character->Send(reply);

            break;
        }
    }
}

- In "void Shop_Sell(Character *character, PacketReader &reader)" below the following line:

                character->Send(reply);

Add the following code:

                if (character->world->config["ShopReopenOnSell"]) {
                    Shop_Open_ID(character, character->npc->index);
                }
---
Just your friendly neighborhood Programmer-Man!
2 years, 2 weeks ago
Post #202794 Re: When Items Are Sold

This is a good idea. It's always annoyed me how the items do not update properly..

---
EO Resources/Guides: ◄ eobud.boards.net ► ◄ eoguide.boards.net ►
2 years, 2 weeks ago
Post #202795 Re: When Items Are Sold

doesnt that mean the main menu re-opens each time you sell a single item? sounds like more clicking work when selling like 15+ items, maybe players would rather want to configure that for themselves through a command.

/sellmenurefresh on

---
I not hacker

“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its
whole life believing that it is stupid.” - Albert Einstein : Really Great Quote Ramy!
2 years, 2 weeks ago
Post #202796 Re: When Items Are Sold
Hacker_Alex posted: (9th Mar 2017, 11:53 pm)

doesnt that mean the main menu re-opens each time you sell a single item? sounds like more clicking work when selling like 15+ items, maybe players would rather want to configure that for themselves through a command.

/sellmenurefresh on


Would there not be a way to refresh & redirect back to sell?
2 years, 2 weeks ago
Post #202797 Re: When Items Are Sold
Destiny posted: (10th Mar 2017, 12:44 am)

Hacker_Alex posted: (9th Mar 2017, 11:53 pm)

doesnt that mean the main menu re-opens each time you sell a single item? sounds like more clicking work when selling like 15+ items, maybe players would rather want to configure that for themselves through a command.

/sellmenurefresh on


Would there not be a way to refresh & redirect back to sell?

It's not possible to refresh or redirect to the "sell items" window directly, without a client modification.
---
Just your friendly neighborhood Programmer-Man!
2 years, 2 weeks ago
Post #202851 Re: When Items Are Sold

It is one extra click but, I think gives a cleaner feel when selling items rather then some players having to click the item again to make sure they actually sold it...... : D

---
Graphics Designer.
"I'll keep believing in the future, not caring if anyone laughs at me"
Hi : D I am me!
2 years, 2 weeks ago
Page: << 1 >>

EOSERV Forum > Client Editing > When Items Are Sold