qbcore-framework / qb-inventory

Slot Based Inventory System Used With QB-Core :school_satchel:
GNU General Public License v3.0
51 stars 370 forks source link

Improvements to shop behavior #527

Closed swkeep closed 1 month ago

swkeep commented 1 month ago

Description

This pull request addresses several issues with the shopping system:

  1. We could swap items within or from/to shop inventories (The backend handled it well most of the times, but players had to close the inventory to refresh it)
  2. When players moved items to their inventories, they turned into purchasable items, and they could click that item inside (their inventory) and buy it from there (While having the shop open)
  3. Corrected the useStock behavior from qb-shops to prevent purchasing items after they reach 0 stock
  4. Implemented distance checks for the attemptPurchase callback, we didn't have any checks for shops or players' distance

Improvements the video format: https://drive.google.com/drive/folders/1__ctqYqHBWL9eChh8HIuIzzPAQvkiMXD

Checklist

GhzGarage commented 1 month ago

I made some changes here, the only one missing from this pr was the one checking stock which i am going to setup something that works directly with the shop so it updates how it should https://github.com/qbcore-framework/qb-inventory/commit/5a5f2836629eb23ffb7b5610fe36df8384524fff