Open a1exp opened 3 years ago
The seconds issue is pretty straight forward and is caused by this: https://github.com/Sphereserver/Source-X/blob/12224eef08a5920c7e5248dec4b77fe76b777261/src/game/items/CItemContainer.cpp#L556-L563
While the first issue is more complicated.
This means gump size coordinates do not correspond to x,y set by https://github.com/Sphereserver/Source-X/blob/3dbb44713bec5d720cf3b932970584331637ec18/src/game/CObjBaseTemplate.cpp#L66-L73.
Perhaps this is the cause of the first issue, I don't understand the logic here. https://github.com/Sphereserver/Source-X/blob/f24687c5330f8fbf7b7ae9f626447fc91e280d77/src/game/items/CItemContainer.cpp#L500-L504
Or it may simply be the case when this struct is not filled right. E.g. if you check item's p.x and p.y in the game for a metal chest gump, the min X and Y seems to be ok, but max X and Y are in reality much less than defined here. https://github.com/Sphereserver/Source-X/blob/f24687c5330f8fbf7b7ae9f626447fc91e280d77/src/game/items/CItemContainer.cpp#L385
This is not reroducible with Orion (I guess it has additional client-side checks), but reprodicible with the default client.
First issue. When you drop an item to a bag (just drop on a bag witout opening a bag), or create an item inside container (e.g. add gold to player with gold += 5000000 and check gold piles in the bank). Items may be out of container boundaries. See screenshot.
Second issue. If you update TDATA3 and TDATA4 of containers then creating items via scripts (e.g. same test with gold += 5000000) will always place items at minX,minY. Seems like
GetRandContainerLoc()
is not called in such cases.I fuess this function is bugged https://github.com/Sphereserver/Source-X/blob/12224eef08a5920c7e5248dec4b77fe76b777261/src/game/items/CItemContainer.cpp#L507 since it only calls
GetRandContainerLoc()
when initial coordinates are invalid (e.g. = 0 which is the case for TDATA3 and TDATA4 not initialized).Fixing the first issue is more important, imo.