Shops: Difference between revisions

From Citizens Wiki

 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
Citizens has added support for basic built in GUI shops.
Citizens has built-in support for basic GUI shops.


== Getting Started ==
== Getting Started ==
Type <code>/npc shop edit</code> to open the NPC's shop.
Type <code>/npc shop edit</code> to open the NPC's shop.
You can also edit any named shop by typing <code>/npc shop edit NAMEHERE</code>.
You can also create a named shop by typing <code>/npc shop edit NAMEHERE</code>. Named shops can be shared by any NPC.


You will see basic configuration settings including editing the type of shop from buy to sell to command shops, setting the permission required to view the shop, and whether to open the shop on right click.
You will see basic configuration settings including editing the type of shop from buy to sell to command shops, setting the permission required to view the shop, and whether to open the shop on right click.
Here you can see the settings screen from left to right:
[[File:Shop Settings.png|frameless]]
You can edit the permission required to view the shop, the shop items, the shop title, whether to open this shop on right click and the type of shop (explained later).
After clicking on the edit shop button for example you can see the following screen. Edit the shop title in the anvil menu and click on the paper to change the title!
[[File:Edit Shop Screen.png|frameless]]


== Editing pages ==
== Editing pages ==
Line 11: Line 21:


In this screen, you can drop an item onto the page slots to put it into the shop.  
In this screen, you can drop an item onto the page slots to put it into the shop.  
[[File:Edit Shop Items.png|frameless]]
This will be the item that's displayed in your shop. You can also edit the next page slots by using shift-click.


== Editing items ==
== Editing items ==
Once in the editing item screen, you can set a '''cost''' and a '''result'''. Note that a result item must be set or else the item will just sit in the shop looking pretty.
Once in the editing item screen, you can set a '''cost''' (on the top left) and a '''result''' (on the top right). Note that a result item must be set or else the item will just sit in the shop looking pretty.
 
 
[[File:Edit Item Screen.png|frameless]]
 
There's some buttons at the bottom to edit various things like purchase message, click to confirm, max purchases etc.
Please note: the green emerald block must be clicked to save the item when you're done.
 
Next, let's add a cost and a result. I have some sand and I want to set up a trade from one sand to three sticks.
 
First, I click on the item cost chest button at the top left.
 
[[File:Item Cost .png|frameless]]
 
Just drag and drop an item anywhere in the top screen to set it as a cost. I do the same thing for the item result (3 sticks). You can see the preview of the cost and result by hovering over the icons.
 
[[File:Item Result preview.png|frameless]]
[[File:Item Display Preview.png|frameless]]
 
I also set the shop to show on right click using the following setting.
 
[[File:Shop Show on right click.png|frameless]]
 
Here's the final resulting shop and I can easily trade for some sticks.
 
[[File:Shop Result 1.png|frameless]]
[[File:Shop Result 2.png|frameless]]
 
== Changing the shop type ==
You can change the shop type in the shop settings. Currently, this lets you change the number of chest rows your shop will show and also make it into a trader shop i.e. display as a villager trader GUI.
 
Using the above demo, let's see what the trader shop looks like. First, I set the shop to a trader shop.
 
[[File:Shop type set.png|frameless]]
 
Now we can see the final result.
 
[[File:Trader shop.png|frameless]]
 
Note that the result of the trade is shown as the display item, not the stick result.
 
== Advanced topics ==
Citizens has a <cost> and <result> placeholder that you can put into the display item description to automatically show the cost and result. If you would like to customise this then set a custom description.
 
There are a lot more advanced topics within the shop GUI. If you would like more info here, please ask on Discord to get it added.

Latest revision as of 11:58, 2 November 2024

Citizens has built-in support for basic GUI shops.

Getting Started

Type /npc shop edit to open the NPC's shop. You can also create a named shop by typing /npc shop edit NAMEHERE. Named shops can be shared by any NPC.

You will see basic configuration settings including editing the type of shop from buy to sell to command shops, setting the permission required to view the shop, and whether to open the shop on right click.

Here you can see the settings screen from left to right:

Shop Settings.png

You can edit the permission required to view the shop, the shop items, the shop title, whether to open this shop on right click and the type of shop (explained later).

After clicking on the edit shop button for example you can see the following screen. Edit the shop title in the anvil menu and click on the paper to change the title!

Edit Shop Screen.png

Editing pages

You probably want to create a shop page. Click on the feather icon to start editing individual pages.

In this screen, you can drop an item onto the page slots to put it into the shop.

Edit Shop Items.png

This will be the item that's displayed in your shop. You can also edit the next page slots by using shift-click.

Editing items

Once in the editing item screen, you can set a cost (on the top left) and a result (on the top right). Note that a result item must be set or else the item will just sit in the shop looking pretty.


Edit Item Screen.png

There's some buttons at the bottom to edit various things like purchase message, click to confirm, max purchases etc. Please note: the green emerald block must be clicked to save the item when you're done.

Next, let's add a cost and a result. I have some sand and I want to set up a trade from one sand to three sticks.

First, I click on the item cost chest button at the top left.

Item Cost .png

Just drag and drop an item anywhere in the top screen to set it as a cost. I do the same thing for the item result (3 sticks). You can see the preview of the cost and result by hovering over the icons.

Item Result preview.png Item Display Preview.png

I also set the shop to show on right click using the following setting.

Shop Show on right click.png

Here's the final resulting shop and I can easily trade for some sticks.

Shop Result 1.png Shop Result 2.png

Changing the shop type

You can change the shop type in the shop settings. Currently, this lets you change the number of chest rows your shop will show and also make it into a trader shop i.e. display as a villager trader GUI.

Using the above demo, let's see what the trader shop looks like. First, I set the shop to a trader shop.

Shop type set.png

Now we can see the final result.

Trader shop.png

Note that the result of the trade is shown as the display item, not the stick result.

Advanced topics

Citizens has a <cost> and <result> placeholder that you can put into the display item description to automatically show the cost and result. If you would like to customise this then set a custom description.

There are a lot more advanced topics within the shop GUI. If you would like more info here, please ask on Discord to get it added.