• 欢迎来到Minecraft插件百科!
  • 对百科编辑一脸懵逼?帮助:快速入门带您快速熟悉百科编辑!
  • 因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289

“Magic/Shops”的版本间的差异

来自Minecraft插件百科
跳转至: 导航搜索
(创建页面,内容为“Magic supports various forms of server GUI shops via the [http://reference.elmakers.com/#actions.shop Shop] action. Like all scripted events in Magic, shops exist in…”)
 
 
(未显示同一用户的11个中间版本)
第1行: 第1行:
Magic supports various forms of server GUI shops via the [http://reference.elmakers.com/#actions.shop Shop] action. Like all scripted events in Magic, shops exist in the form of spells.
+
Magic支持多种形式的服务器GUI 商店。请参考[http://reference.elmakers.com/#actions.shop 商店] 。就和Magic中所有的 脚本化事件一样,商店作为法术的一种形式而存在。
  
See [https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/itemshop.yml itemshop] for a simple example. There are also many examples included in the [https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/examples/elworld/spells.yml#L2909 elMakers dev server configs]
+
查看 [https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/itemshop.yml ItemShop]以获取简单范例。
 +
还有这里也有一些范例[https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/examples/elworld/spells.yml#L2909 elMakers dev 服务器配置]
  
Under the hood, the Shop action re-works its parameters into expanded Selector parameters.
+
在后台,商店这一行为基于拓展的选择器参数运行
  
== Adding a Shop NPC ==
+
== 添加一个商店NPC ==
  
NPCs can cast any spell, including shops. You can set one up with these commands:
+
NPC可以释放任何法术,包括商店法术。你可以用这些指令设置一个
  
 
<pre class="">/mnpc add Magic Items!
 
<pre class="">/mnpc add Magic Items!
 
/mnpc cast magicitemshop</pre>
 
/mnpc cast magicitemshop</pre>
== Creating a Custom Shop ==
 
  
Making a custom shop is pretty easy if you inherit from the[https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/buyshop.yml buyshop] or [https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/sellshop.yml sellshop] spells.
+
== 创建一个自定义商店 ==
  
Looking at a snippet of [https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/trinketshop.yml trinketshop] for example:
+
制作一个自定义商店相当容易,只要使用继承功能参考[https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/buyshop.yml 购买商店] 或[https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/sellshop.yml 出售商店] 
 +
 
 +
看看这一段示例也有帮助[https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/trinketshop.yml 饰品商店]:
 +
 
 +
(翻译者:Magic插件的商店也是一种形式的法术,或者说有一类法术就是商店)
  
 
<pre class="">trinketshop:
 
<pre class="">trinketshop:
     inherit: buyshop
+
     inherit: buyshop #继承哪个商店
     hidden: true
+
     hidden: true #隐藏
     parameters:
+
     parameters: #参数
 
         items:
 
         items:
 
         - skull_ale
 
         - skull_ale
第27行: 第31行:
 
         - skull_arrowdown
 
         - skull_arrowdown
 
         - ...</pre>
 
         - ...</pre>
This spell only has 3 properties:
+
此法术只存在三个设置:
 
 
* '''inherit''' This tells the spell to take all of the properties of some other spell. In this case you will want <code>buyshop</code> for a shop where players will buy items and <code>sellshop</code> for shops where players can sell items. See the Selector section below if you want something more complicated than that.
 
* '''hidden''' This tells the spell not to shop appear in the /spells list, spell books or on the web site. It's not really necessary to have this for your own spells.
 
* '''parameters''' Here is where you will specify what items can be bought or sold in this shop.
 
  
=== Parameters ===
+
* '''inherit''' 【继承】这一条告诉法术采用其他法术的全部设置。如果你想使用 <code>buyshop</code> 作为玩家可以购买物品的商店,或者 <code>sellshop</code> 作为玩家可以出售物品的商店。如果你想尝试一些更复杂的东西,请查看选择器下面的部分
 +
* '''hidden''' 【隐藏】这一条告诉法术让它不要出现在/spell列表、技能书或网页中。如果要做一个你自己的专属法术可能需要这么做
 +
* '''parameters'''【参数】 此处可以设置你要买卖什么物品
  
The parameters section of a shop spell is mainly used for the <code>items</code> parameter, which specifies what items are in the shop.
+
=== 参数 ===
  
You can also optionally have a <code>scale</code> parameter in a shop, such as in the [https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/lootshop.yml lootshop], this will scale prices up or down. In the case of sellshops, I use a scale to make items worth consistently less when sold back then they cost to buy.
+
参数部分通常使用 <code>items</code> 参数,它可以指定商店内的物品
  
Other parameters include:
+
你也可以使用 <code>scale</code> 参数来设置商店,例如在 [https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/lootshop.yml 战利品商店]的设置(似乎链接已挂), 可以设置价格范围,在出售商店的设置中使用<code>scale</code>始终使出售价格低于购买价格
  
* <code>confirm</code>: true/false, whether or not there should be confirmation screen before the purchase is finalized.
+
其他参数还有:
* <code>confirm_filler</code>: A Material type used to fill in empty space in the confirmation screen.
 
* <code>auto_close</code>: true/false, whether the shop should automatically close after a purchase is complete. Set this to false to make shops where large amounts of items can be bought or sold quickly.
 
* <code>sell</code>: Set to true to have this shop sell items rather than buy items. Under the hood this re-writes many of the Selector parameters to flip around costs and results.
 
  
== The Items List ==
+
* <code>confirm</code>:【确认】 true/false,可以设置玩家在交易之前是否有一个确认的操作
 +
* <code>confirm_filler</code>: 【填充确认】填充空的确认界面位置的材质
 +
* <code>auto_close</code>: 【自动关闭】true/false,当一次交易结束后是否自动关闭商店。设置为false可以应对大量物品的交易
 +
* <code>sell</code>: 【出售】设置为true可以让商店出售物品而非购买物品。 在后台会重新写入一些选择器参数以实现效果的反转
  
The <code>items</code> parameter in a shop can take two different forms:
+
== 物品列表 ==
  
=== List of items ===
+
<code>items</code> 参数在商店里可以使用两种不同的形式:
  
Just a simple list of items. The prices of the items must be defined for each item in the items config. This can be done in items.yml, or in-game using <code>/mitem save &lt;worth&gt;</code> to specify how much an item is worth.
+
=== 物品的列表 ===
  
If an item does not have a worth specified it will be offered for free.
+
简单列出物品。每个物品的价格必须在物品设置中被指定。可以在items.yml中设置,或在游戏中使用 <code>/mitem save &lt;worth&gt;</code>来设置物品值多少钱
  
The format <code>itemname@amount</code> can be used to offer multiple items in one slot.
+
如果未指定价格,那么物品将会被免费提供
  
=== List of configuration sections ===
+
使用格式<code>itemname物品名@amount数量</code> 可以指定同一格内多个物品的价格
  
For more complex shops, items can be specified in configuration sections. See [https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/examples/elworld/spells.yml#L1225 fieldshop] from the elMakers dev server configs as an example.
+
=== 配置部分的列表 ===
  
Each item in a shop can have a few different properties:
+
对于一个复杂的商店,物品可在配置部分被指定。查看elMakers dev服务器的相关配置如[https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/examples/elworld/spells.yml#L1225 领域商店]可作为范例''(我倒是没有看懂这个链接是什么意思)''
  
* <code>item</code>: The Material type of the item sold in this slot.
+
商店里的每一个物品都有些不同的设置:
* <code>slot</code>: A specific slot of the item GUI to put this item. Omit this to just fill in order.
 
* <code>cost</code>: The cost of this item, if omitted the saved item worth will be used.
 
* <code>name</code>: A custom display name for this item. Will be used by the icon as well as the item given.
 
* <code>lore</code>: A custom list of lore for this item. Will be used by the icon as well as the item given.
 
  
=== Empty slots ===
+
* <code>item</code>: 【物品】设定槽位中物品的材质
 +
* <code>slot</code>:【槽位】在GUI中防止物品的指定槽,忽略此项只是为了适应顺序
 +
* <code>cost</code>: 【价格】物品的价格,如果忽略则会使用默认的价格
 +
* <code>name</code>: 【名字】物品自定义的名字,将会和物品图标相同
 +
* <code>lore</code>: 【lore】自定义物品的一些lore。将会和物品图标相同
  
A simple <code>none</code> can be put in the item list for an empty slot, allowing you to organize your shops.
+
=== 空槽位 ===
  
== Changing Prices ==
+
使用 <code>none</code>可以制作空槽以合理分配商店空间
  
Changing prices on the default builtin shops can be done two different ways.
+
== 修改价格 ==
  
=== Item Shops ===
+
改变内置的商店价格有两种方式
  
For simple item shops, it's best to change the value of the item rather than change the cost in each shop that sells it. This way your server has consistent prices across shops.
+
=== 物品商店 ===
  
This can be done in items.yml, by adding a config like this:
+
对于简单的物品商店,最好修改修改价值而不是再每个商店都修改价格,这样可以在服务器的不同商店中定下同样的物品价格
 +
可以通过 items.yml修改,只需要添加如下内容:
  
 
<pre class="">emerald:
 
<pre class="">emerald:
 
   worth: 1000</pre>
 
   worth: 1000</pre>
or in-game, by holding the item you want to set the value for, and typing <code>/mitem save emerald 1000</code>
+
或者在游戏中手持物品设置价格,只需要打指令<code>/mitem save emerald 1000</code>(绿宝石值1000)
 +
 
 +
=== 法杖以及其他复杂商店 ===
  
=== Wands and other complex shops ===
+
对于非物品,如 法杖或法术,商店也应该收取一定费用。 这种情况下你设置的价格会覆盖默认设置的价格。把默认内容复制到Magic/spells文件夹以编辑。
  
For non-items, such as wands or spells, the shop most likely has the prices built in. In this case you override the prices like you would any other spells' parameters- find the default configs, copy it to your Magic/spells folder and edit it.
+
举例,请看 [https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/magicitemshop.yml 魔法物品商店], 这里类出来所有物品的价格。只需要复制这份文件到你的spells文件夹 (或者说粘贴到Magic/spells.yml也可以)之后自行编辑价格
  
For instance, look at the [https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/resources/examples/survival/spells/magicitemshop.yml magicitemshop], it has prices listed for each item. Simply copy that file to your spells folder (or paste it in spells.yml if you prefer) and edit the prices as you wish.
+
同样的方法可以从商店添加或删除物品
  
This is also how you can add and remove items from a shop.
+
== 选择器行为 ==
  
== The Selector Action ==
+
译者注:行为(Actions)指的是每个法术的施法状态中的一些举动
  
The Shop action extend Selector, providing a more simplified way to set up shops that mirrors the now-deprecated ItemShop action.
+
选择器是商店的一个行为拓展,提供了一种更简易的方法照应现已删除的ItemShop行为
  
However, this means that all of the parameters available to a Selector action and its options are also available to shops and shop items.
+
这意味着选择器可用的全部参数和设置同样可用于商店及其物品
  
See the [[Selector|the Selector action]] section for more information on setting up complex shops or completely custom GUIs using the Selector action.
+
请查阅[[Magic/Selector|选择器部分]]以学习使用了选择器行为的更多复杂商店和自定义GUI的内容

2021年7月31日 (六) 23:57的最新版本

Magic支持多种形式的服务器GUI 商店。请参考商店 。就和Magic中所有的 脚本化事件一样,商店作为法术的一种形式而存在。

查看 ItemShop以获取简单范例。 还有这里也有一些范例elMakers dev 服务器配置

在后台,商店这一行为基于拓展的选择器参数运行

添加一个商店NPC

NPC可以释放任何法术,包括商店法术。你可以用这些指令设置一个

/mnpc add Magic Items!
/mnpc cast magicitemshop

创建一个自定义商店

制作一个自定义商店相当容易,只要使用继承功能参考购买商店出售商店

看看这一段示例也有帮助饰品商店:

(翻译者:Magic插件的商店也是一种形式的法术,或者说有一类法术就是商店)

trinketshop:
    inherit: buyshop #继承哪个商店
    hidden: true #隐藏
    parameters: #参数
        items:
        - skull_ale
        - skull_apple
        - skull_aquarium
        - skull_arrowdown
        - ...

此法术只存在三个设置:

  • inherit 【继承】这一条告诉法术采用其他法术的全部设置。如果你想使用 buyshop 作为玩家可以购买物品的商店,或者 sellshop 作为玩家可以出售物品的商店。如果你想尝试一些更复杂的东西,请查看选择器下面的部分
  • hidden 【隐藏】这一条告诉法术让它不要出现在/spell列表、技能书或网页中。如果要做一个你自己的专属法术可能需要这么做
  • parameters【参数】 此处可以设置你要买卖什么物品

参数

参数部分通常使用 items 参数,它可以指定商店内的物品

你也可以使用 scale 参数来设置商店,例如在 战利品商店的设置(似乎链接已挂), 可以设置价格范围,在出售商店的设置中使用scale始终使出售价格低于购买价格

其他参数还有:

  • confirm:【确认】 true/false,可以设置玩家在交易之前是否有一个确认的操作
  • confirm_filler: 【填充确认】填充空的确认界面位置的材质
  • auto_close: 【自动关闭】true/false,当一次交易结束后是否自动关闭商店。设置为false可以应对大量物品的交易
  • sell: 【出售】设置为true可以让商店出售物品而非购买物品。 在后台会重新写入一些选择器参数以实现效果的反转

物品列表

items 参数在商店里可以使用两种不同的形式:

物品的列表

简单列出物品。每个物品的价格必须在物品设置中被指定。可以在items.yml中设置,或在游戏中使用 /mitem save <worth>来设置物品值多少钱

如果未指定价格,那么物品将会被免费提供

使用格式itemname物品名@amount数量 可以指定同一格内多个物品的价格

配置部分的列表

对于一个复杂的商店,物品可在配置部分被指定。查看elMakers dev服务器的相关配置如领域商店可作为范例(我倒是没有看懂这个链接是什么意思)

商店里的每一个物品都有些不同的设置:

  • item: 【物品】设定槽位中物品的材质
  • slot:【槽位】在GUI中防止物品的指定槽,忽略此项只是为了适应顺序
  • cost: 【价格】物品的价格,如果忽略则会使用默认的价格
  • name: 【名字】物品自定义的名字,将会和物品图标相同
  • lore: 【lore】自定义物品的一些lore。将会和物品图标相同

空槽位

使用 none可以制作空槽以合理分配商店空间

修改价格

改变内置的商店价格有两种方式

物品商店

对于简单的物品商店,最好修改修改价值而不是再每个商店都修改价格,这样可以在服务器的不同商店中定下同样的物品价格 可以通过 items.yml修改,只需要添加如下内容:

emerald:
  worth: 1000

或者在游戏中手持物品设置价格,只需要打指令/mitem save emerald 1000(绿宝石值1000)

法杖以及其他复杂商店

对于非物品,如 法杖或法术,商店也应该收取一定费用。 这种情况下你设置的价格会覆盖默认设置的价格。把默认内容复制到Magic/spells文件夹以编辑。

举例,请看 魔法物品商店, 这里类出来所有物品的价格。只需要复制这份文件到你的spells文件夹 (或者说粘贴到Magic/spells.yml也可以)之后自行编辑价格

同样的方法可以从商店添加或删除物品

选择器行为

译者注:行为(Actions)指的是每个法术的施法状态中的一些举动

选择器是商店的一个行为拓展,提供了一种更简易的方法照应现已删除的ItemShop行为

这意味着选择器可用的全部参数和设置同样可用于商店及其物品

请查阅选择器部分以学习使用了选择器行为的更多复杂商店和自定义GUI的内容