nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
129 stars 93 forks source link

Sell Store Event (after) returns 1, for edge case transaction #1567

Closed ReachPW closed 1 year ago

ReachPW commented 1 year ago

https://nwnxee.github.io/unified/group__events.html

Buy/Sell Store Events NWNX_ON_STORE_REQUEST_BUY_AFTER RESULT int TRUE/FALSE whether the request was successful. Only in *_AFTER events.

In this event, if you don't have enough gold then RESULT will be 0 as expected. But if the player's inventory is full, the transaction is not successful and is canceled, but RESULT returns 1.

Is that intended? It should also be 0 if transaction is canceled/failed for full inventory too?

to reproduce, just fill up inventory and try to buy something. It'll say "You cannot carry any more items, your inventory is full" (from base game), but RESULT will be 1 from NWNX

ReachPW commented 1 year ago

closing. Not a bug :

Sacha — Today at 7:51 AM I thought the transaction was done, but then the item was dropped on the ground

ReachPW — Today at 7:57 AM just checked. No items on ground and no gold was taken from player.

Daz — Today at 7:57 AM if the player fails to acquire the item it is deleted [7:58 AM] but that happens in a different function that fires later than the one that event hooks

ReachPW — Today at 7:58 AM I'm using infinite item store, let me check with limited store. [7:59 AM] but if no gold is taken and no item is given, then player would consider that a failed transaction

Daz — Today at 7:59 AM sorry, the bought item is deleted if its infinite [7:59 AM] it basically creates a copy

ReachPW — Today at 8:12 AM

Daz — Today at 8:17 AM yes, the function that event hooks (RequestBuy()) does not check if the creature can carry the item [8:17 AM] it only checks gold, really [8:18 AM] and if the item actually exists

ReachPW — Today at 8:25 AM k, so not a bug?

Daz — Today at 8:25 AM correct

ReachPW — Today at 8:25 AM I did find a work around for my case at least if (!GetBaseItemFitsInInventory(nBaseItemType, oPlayer)) { NWNX_Events_SetEventResult("0"); return; }