欢迎来到Minecraft插件百科!
对百科编辑一脸懵逼?
帮助:快速入门
带您快速熟悉百科编辑!
因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289
查看“Magic/Shops”的源代码
←
Magic/Shops
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于这些用户组的用户执行:
用户
、
自动确认用户
、
巡查者
您可以查看和复制此页面的源代码。
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. 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] Under the hood, the Shop action re-works its parameters into expanded Selector parameters. == Adding a Shop NPC == NPCs can cast any spell, including shops. You can set one up with these commands: <pre class="">/mnpc add Magic Items! /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: <pre class="">trinketshop: inherit: buyshop hidden: true parameters: items: - skull_ale - skull_apple - skull_aquarium - skull_arrowdown - ...</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 === 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. Other parameters include: * <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 == The <code>items</code> parameter in a shop can take two different forms: === List of items === 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 <worth></code> to specify how much an item is worth. If an item does not have a worth specified it will be offered for free. The format <code>itemname@amount</code> can be used to offer multiple items in one slot. === List of configuration sections === 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: * <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 === A simple <code>none</code> can be put in the item list for an empty slot, allowing you to organize your shops. == Changing Prices == 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: <pre class="">emerald: 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> === 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 [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 == 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 [[Selector|the Selector action]] section for more information on setting up complex shops or completely custom GUIs using the Selector action.
返回
Magic/Shops
。
导航菜单
个人工具
登录
命名空间
页面
讨论
大陆简体
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
编辑相关
百科公告
编辑帮助
互助客栈
贡献分数
测试沙盒
发布条目
插件分类
管理
安全
聊天
编程
经济
修正
娱乐
综合
信息
机械
角色
传送
网页
整地
创世
付费
其它
工具
链入页面
相关更改
特殊页面
页面信息
相关网站
MCMOD百科
Minecraft中文百科
Minecraft纪念论坛
Minecraft百度贴吧
虚无世界Wiki