topaz-next / topaz

💎 A server emulator for Final Fantasy XI.
GNU General Public License v3.0
55 stars 80 forks source link

[release] Bug with treasure pool #2662

Open Chronos77 opened 3 years ago

Chronos77 commented 3 years ago

Additional Information (Steps to reproduce/Expected behavior) :

The problem arises when killing a mob that drops more than 10 items. Excess items are dropped instead of falling into the inventory. In addition, even the 100% drop does not drop as in the picture.

WhatsApp Image 2021-02-25 at 23 45 39

TeoTwawki commented 3 years ago

Awhile back there was an intentional change merged into darkstar to prevent overflows. The reason the change was introduced was that a mob could be killed and drop a ton of things only to have some of the drops instantly fall out of the pool with the message saying they couldn't be obtained or that nobody was eligible for the item, and people would then report that as a bug constantly. At that time, nobody considered that some drops would normally stack, that the order of rows in the db has an impact on the order in game drops happen, and that many drops belong groups (grouping didn't exist yet) and groups would lessen/eliminate this is most cases.

I would like to see the change removed but also items moved to their proper "drop slot", with correct groups where items should be groups. this requires a lot of retail testing to ballpark.

As a temporary fix, you can either move the 100% drop row to being this mobs first sql row, or modify the code to stop checking the size of dropCount and deal with players confused by lost items: https://github.com/topaz-next/topaz/blob/release/src/map/entities/mobentity.cpp#L820

void CMobEntity::DropItems(CCharEntity* PChar)
{
    // Adds an item to the treasure pool and returns true if the pool has been filled
    auto AddItemToPool = [this, PChar](uint16 ItemID, uint8 dropCount)
    {
        PChar->PTreasurePool->AddItem(ItemID, this);
        return dropCount >= TREASUREPOOL_SIZE;
    };

That is checking if the variable dropCount meets or exceeds the size of the treasure pool. The variable dropCount is being updated each time any item drops.