Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

player:addItem and player:addItemEx does not drop the item to the ground if there's no space #3185

Closed
2 tasks done
RafaelVidaurre opened this issue Oct 14, 2020 · 4 comments · Fixed by #3186
Closed
2 tasks done

Comments

@RafaelVidaurre
Copy link

RafaelVidaurre commented Oct 14, 2020

Before creating an issue, please ensure:

  • This is a bug in the software that resides in this repository, and not a
    support matter (use https://otland.net/forums/support.16/ for support)
  • This issue is reproducible without changes to the C++ code in this repository

Steps to reproduce (include any configuration/script required to reproduce)

  1. Download/compile/run the latest version of TFS without performing any changes and create a God
  2. Drop your backpack, put a helmet on and say /i dark helmet (or try to spawn any other item)

Expected behaviour

The item should drop to the ground when there is no space, note that without capacity this works properly

Actual behaviour

The item is not dropped on the map

Environment

Used Docker image provided in this repository

Reproduction environment

Simply use the Docker image provided in this repository

Notes

  • This is an issue with the player:addItem method. It doesn't matter if you pass dropOnMap as true which is the default anyways
  • Does work with insufficient cap
  • Commit I tested this on is 24508912

UPDATE: Temporary workaround

Comment these lines in iologindata.cpp

if (!player->inventory[CONST_SLOT_STORE_INBOX]) {
        player->internalAddThing(CONST_SLOT_STORE_INBOX, Item::CreateItem(ITEM_STORE_INBOX));
}

If you have already created players you will need to delete item 26052 from all off them. Also, not sure if this might cause issues in modern clients, but yeah...

@RafaelVidaurre
Copy link
Author

Some more info. Trading is also broken (if a player has no available slot to receive the item the trade still goes through and the item dissappears)

@RafaelVidaurre
Copy link
Author

It seems to be that this commit broke it, due to Container now counting the 40 extra capacity of this new slot .

@EPuncker does this make sense?

@nekiro
Copy link
Member

nekiro commented Oct 15, 2020

Yeah, this makes sense. The fix would be to not iterate this container when getting free slots as it's special and not meant for normal items.

CONST_SLOT_LAST shouldn't probably be CONST_SLOT_STORE_INBOX, but AMMO like before.

I'll push a fix for this soon.

@RafaelVidaurre
Copy link
Author

@nekiro Awesome, thanks for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants