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

Magic/Shops

来自Minecraft插件百科
炫宙菌讨论 | 贡献2021年6月6日 (日) 10:57的版本 The Items List
跳转至: 导航搜索

Magic支持多种形式的服务器GUI 商店。请参考商店 action. Like all scripted events in Magic, shops exist in the form of spells.

查看 ItemShop以获取简单范例。 还有这里也有一些范例There are also many examples included in the 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可以制作空槽以合理分配商店空间

修改价格

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:

emerald:
  worth: 1000

or in-game, by holding the item you want to set the value for, and typing /mitem save emerald 1000

Wands and other complex shops

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.

For instance, look at the 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

The Shop action extend Selector, providing a more simplified way to set up shops that mirrors the now-deprecated ItemShop action.

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 the Selector action section for more information on setting up complex shops or completely custom GUIs using the Selector action.