# ExcellentShop v5.0.0 Beta

ExcellentShop `v5.0.0` is a massive update where I completely reworked some of the core mechanics, like the **Buy Menu** and **Sell Menu**. They now feature a much more **dynamic and user-friendly interface**, making it perfectly clear exactly how many items are available to buy, and what you can sell to the shop(s) and for how much.

I have also overhauled the **item click actions** - you can now bind different keys and actions based on the item's **"status"**. For example, if an item cannot be bought, you can set it to only show sell actions (and vice versa) so your players do not get confused. Plus, I added **number key support (`0-9`)** so you can quickly buy or sell a specific amount of an item!

Alongside the click actions, I brought similar changes to the **item display info** in the shop menus. Now, depending on the item's status, the plugin will use one of four **"master-lores"**. This makes it super easy to filter out irrelevant details (like hiding the buy price if an item is strictly sell-only). For the more complex setups, I introduced **dynamic conditions** like `<if_[condition]>Some Text</if_[condition]>` and new **placeholders** `{some_placeholder}`.

Last but not least, I did a mini-rework of **Global Stocks** and **Individual Limits**. The global stock is now **unified** for both buying and selling, and the auto-restock amount can now be **randomized**. Even better, both of these features now have their own dedicated **on/off toggles**!

Oh, and the **transaction processing system** was completely rewritten from the ground up - it is now a truly unified, reliable, and high-performance system.

---

### Product Cart

The **Product Cart** feature has been retired. It has been replaced by two new GUIs:
- **Buying Menu** - Functions similarly to the previous Product Cart but includes several Quality of Life (QoL) improvements.
- **Selling Menu** - Functions similarly to the previous Sell GUI with added QoL features.

---

### Selling Menu

There is no longer a need for manual amount selection when simply selling items. Now, clicking an item to sell it will open the **Selling Menu**. From there, you can add any item belonging to that shop to the menu to sell it.

**What is new:**
- The Selling Menu displays client-side lore on items in the player's inventory, showing their worth or specific amount requirements.
- The Selling Menu can be bound to a shop, a specific product, or globally. This "scope" defines which items can be sold at once:
    - **Product Scope:** Only items matching that specific product can be sold.
    - **Shop Scope:** All items matching any product within that shop can be sold.
    - **Global Scope:** All items matching any product in any shop can be sold.
- Unsellable items will appear as barriers (configurable) in the player's inventory.
- The quantity of items sold must match the product's unit size. For example, if a product is defined as **8 x Apple**, you must sell in increments of 8 (8, 16, 24, 64, 128, etc.).
- The Selling Menu will now automatically attempt to sell as many items as possible and return any unsold items to your inventory. You no longer need to calculate exact amounts manually.
- If an item matches multiple products, the Selling Menu will automatically suggest the most valuable one.

!!!warning Configuration Changes
You may need to reconfigure the new default GUI layout to match your preferences.
!!!

---

### Buying Menu

When buying items, you still select the desired amount using the `+` and `-` buttons.

**What is new:**
- The Buying Menu displays barriers on item slots that you cannot reach using the amount buttons due to insufficient funds, stock limits, or other constraints.
- The `+` and `-` buttons now feature extra logic based on the item's maximum stack size. Increments are handled by percentages: `1/1`, `1/2`, `1/4`, and `1`. The `1/2` and `1/4` buttons will not display for items with a maximum stack size of less than 8.

!!!warning Configuration Changes
You may need to reconfigure the new default GUI layout to match your preferences.
!!!

---

### Product Click Key Mappings

You can map specific GUI click types to shop actions such as Buy, Sell, or Open Amount GUI. This update expands the current system:
- Mapping settings can now differ between **VirtualShop** and **ChestShop**. These are located in the `settings.yml` file of each respective module.
- Mapping settings can now vary based on the item's buyable or sellable status.
- When mapping the `NUMBER_KEY` click type to the `BUY_ONE` or `SELL_ONE` action, the specific number key pressed by the player is now detected. This allows players to quickly buy or sell 1-9 units of a product by pressing the corresponding number on their keyboard.

As a possible alternative (and a solution for Bedrock players), a new **Dialog Screen** has been added. It contains buttons for all possible buy and sell actions. You can map this dialog screen to any click type by specifying the action name `PURCHASE_DIALOG`.

!!!warning Configuration Changes
You may need to reconfigure the new default keys in the `settings.yml` of both the Virtual and Chest shop modules.
!!!

---

### Product Display Format

This update introduces a dynamic placeholder system for product lore formatting in shop GUIs. New "inner" placeholders and conditions have been added, allowing you to show or hide specific product information based on its current state.

!!!warning Configuration Changes
You may need to reconfigure the new default format settings in the `settings.yml` of both the Virtual and Chest shop modules.
!!!

---

### Product Stock & Limits

[!badge VirtualShop Only|info]

The **Global Stock** feature has been completely reworked. Previously, having separate buy and sell stock values was often redundant. Now, there is a single `stock` value that controls how much of a product is available for purchase.

For sales, a new `capacity` option has been added. This controls the maximum possible product amount the shop can hold. When items are sold to the shop, the `stock` value increases; however, if `stock >= capacity`, no further sales will be allowed.

Two new options have also been added: `min restock amount` and `max restock amount`. These allow you to create a randomized initial stock value every time the stock resets.

The **Player Limits** feature continues to function as it did previously. Additionally, an explicit `enabled` setting has been added for both features, allowing you to toggle them on or off without losing your configured values.

!!!warning Database Changes
The database and configuration structure for stocks and limits has changed. **No manual actions are required** as the update will handle this automatically.
!!!

### Other Changes

+++ New :icon-phs-seal-check:

1. Added **Buy All** feature for Virtual and Chest shop modules. Permission, like Sell All has, is included.
2. [!badge ChestShop] Added config option to limit max. price value players can set for buying and selling.
3. [!badge ChestShop] Added `Scale` option for shop holograms.

+++ Improved :icon-phs-thumbs-up:

1. [!badge VirtualShop] Float prices won't refresh randomly unless a refresh time/interval is set or a shop rotation is performed.
2. [!badge VirtualShop] Editor for "normal" (non-rotating) shop products now uses the same GUI (layout) as shop does when you open it.

+++ Fixed :icon-phs-bug-beetle:

1. Fixed a bug, where full inventory check not worked for products with stack size > 1.
2. [!badge ChestShop] Fixed a bug, where Rent's default currency was always `vault` even if it was disabled.
3. [!badge ChestShop] Fixed a bug, where sell/buy price can't be disabled for certain currencies from CoinsEngine.
4. [!badge ChestShop] Fixed (hopefully) some issues with PlotSquared integration.
5. [!badge VirtualShop] Fixed a bug, where shop rotations can generate duplicated items.

+++
