StockMarket
StockMarket 是一款旨在创建虚拟且随机的游戏内股市的插件,其中包含随机事件,能带来不少乐趣。
你可以自定义插件设置,使得大多数玩家总体亏损,但聪明的玩家却能从中获利。你也可以将其设置为让几乎所有玩家都能持续盈利。此外,你还可以调整设置,使股票价格总体保持稳定,并设定最高和最低价格上限,从而限制玩家的利润空间。
这里有大量的随机事件,并且还有更多的事件可以添加,这些事件会影响特定世界事件或公司事件下的股票价格。这些事件的发生频率也可以自定义。
所有数据均使用 MySQL 存储。稍后将支持其他数据库,包括平面文件和 SQLite。
该插件目前处于 Alpha 阶段(或者你愿意怎么称呼它都行)。
依赖项
- Vault
- Vault 兼容的经济插件
- MySQL 数据库
命令
- /sm help <page> - 显示 StockMarket 帮助信息。- 权限节点: stockMarket.user.help
- /sm info - 显示插件版本及状态。- 权限节点: stockMarket.user.info
- /sm list - 显示你可以购买的所有股票列表及其当前价格。- 权限节点: stockMarket.user.list
- /sm list mine - 显示你当前持有的股票列表及其当前价格。- 权限节点: stockMarket.user.list
- /sm buy <stockID> <amount> - 购买指定的股票及数量。- 权限节点: stockMarket.user.buy
- /sm sell <stockID> <amount> - 卖出指定的股票及数量。- 权限节点: stockMarket.user.sell
- /sm add <stockID> <basePrice> <maxPrice> <minPrice> <volatility> <amount> <dividend> <stockName> - 向所有股票列表中新增一只股票。- 权限节点: stockMarket.admin.add
- /sm remove <stockID> - 从所有股票列表中移除现有股票。此操作不可撤销。- 权限节点: stockMarket.admin.remove
- /sm set <stockID> <newBasePrice> <newMaxPrice> <newMinPrice> <newVolatility> <newAmount> <newDividend> <newStockName> - 编辑现有股票的信息。- 权限节点: stockMarket.admin.set
- /sm forcerandom - 强制在随机股票上触发随机事件。如果不存在任何股票则无效果。- 权限节点: stockMarket.admin.event
- /sm reload - 重新加载插件配置文件。- 权限节点: stockMarket.admin.reload
- /sm <stockID> - 显示所请求股票的更多信息。- 权限节点: stockMarket.user.detail
配置
目前该插件仅支持 MySQL,如上所述,后续将添加对其他格式的支持。首次运行插件以生成默认配置文件。默认情况下,MySQL 服务器地址为 localhost:3306,用户名为 root,密码为空 (""),数据库名为 sm。如果数据库不存在,将会自动创建。里面还有一些其他选项。:)
此插件依赖于 Vault。它还要求存在一个经济插件和一个权限插件,否则将在启动时卸载。
添加股票
要添加股票,请使用 /sm add。
例如:
- /sm add MASH 100 200 1 100 -1 1 Mashlol's Epic Business of Amazingness
- /sm add AAPL 500 1000 1 25 500 2 Apple Inc.
通用格式如下:
- /sm add ID BasePrice MaxPrice MinPrice Volatility Amount Dividend (名称可以根据需要尽可能长)
创建事件
#: <-- 此编号必须按顺序排列(即不要出现 0-3 和 5-7 这样跳跃的情况,那样不仅毫无意义,也无法正常工作)
message: Message <-- 当事件发生时显示的这条消息。所有 %s 实例将被替换为股票 ID。
effect: 50 <-- 这是基于基准价格的效应基础。也就是说,如果数值为 50,且该股票的波动率为 100%,则股价最大变化幅度等于基准价格的 50%(当然,前提是股票的波动率为 100)
up: true <-- 此事件是增加还是减少股价?true 表示增加,false 表示减少。
frequency: 50 <-- 被选中的概率为 50/(所有频率之和)。例如,如果有 3 个事件,每个事件的频率均为 1,则它们各自发生的概率为 1/3。
默认配置
# 玩家总共允许持有多少只股票?
max-total-stocks-per-player: 250
# 玩家每种股票最多允许持有数量?
max-total-stocks-per-player-per-stock: 50
# 随机事件应每隔多少分钟发生一次?
random-event-frequency: 60
# 股息应每隔多少分钟发放一次?
dividend-frequency: 1440
# 离线玩家是否应在股息发放期间获得支付?
pay-offline-players: true
# 广播事件?
broadcast-events: true
# 广播股息发放?
broadcast-payouts: true
mysql:
ip: localhost
port: 3306
username: root
password: ""
database: sm
events:
0:
message: "%s 的首席执行官因心脏病发作去世。继任者看来表现不佳。"
effect: 40
up: false
frequency: 50
1:
message: "%s 的首席执行官因心脏病发作去世。继任者看起来甚至比前任更出色!"
effect: 40
up: true
frequency: 50
2:
message: "%s 宣布将发布新产品!市场猜测纷纷!"
effect: 8
up: true
frequency: 250
3:
message: "%s 宣布将发布新产品!市场猜测纷纷!"
effect: 8
up: false
frequency: 250
4:
message: “%s 宣布的产品取得了巨大成功,顾客非常满意!”
effect: 45
up: true
frequency: 250
5:
message: “%s 宣布的产品制作粗糙,导致顾客满意度低下!”
effect: 45
up: false
frequency: 250
6:
message: “%s 度过了一个糟糕的季度。”
effect: 30
up: false
frequency: 100
7:
message: “%s 度过了一个精彩的季度。”
effect: 30
up: true
frequency: 100
8:
message: “大家都在猜测 %s 即将推出一款极其惊人的产品!”
effect: 65
up: true
frequency: 5
9:
message: “%s 濒临破产。”
effect: 65
up: false
frequency: 5
10:
message: “%s 刚刚发明了继切片面包之后最伟大的发明!”
effect: 400
up: true
frequency: 1
11:
message: “%s 刚刚破产了。”
effect: 400
up: false
frequency: 1
12:
message: “%s 刚刚宣布将更换目前声誉不佳的首席执行官。”
effect: 25
up: true
frequency: 25
13:
message: “%s 刚刚宣布将更换目前深受大家喜爱首席执行官。”
effect: 25
up: false
frequency: 25
其他
警告
如果您决定测试此插件,我不对可能出现的任何错误承担责任。由于它仍处于 alpha(早期测试)阶段,很可能存在漏洞等缺陷,可能会允许玩家滥用经济系统。如果您的服务器完全依赖经济系统运行,您可能需要等待 beta(封闭测试)或正式发布 :)
StockMarket
StockMarket is a plugin designed to create a virtual and random in game Stock Market that has random events and can be a lot of fun.
You can customize the plugin so in general players will lose money, but the smart ones will come out making money. You can customize it so just about everyone is constantly making money. You can customize it so in general the stocks price stay about the same, with max and min prices so players cannot profit much from it.
Theres lots of random events and always room for more, where stocks prices are affected by certain world events or company events. The frequency of these events can be customized.
All data is stored using mySQL. Support for other DBs including flatfiles and sqlite will come later.
Plugin is currently in alpha (or whatever you want to think of it as).
Dependencies
- Vault
- Vault Compatible Economy Plugin
- MySQL Database
Commands
- /sm help <page> - Displays StockMarket help. - Permission Node: stockMarket.user.help
- /sm info - Displays plugin version & status. - Permission Node: stockMarket.user.info
- /sm list - Displays a list of stocks you are allowed to buy and their current price. - Permission Node: stockMarket.user.list
- /sm list mine - Displays a list of stocks that you currently own and their current price. - Permission Node: stockMarket.user.list
- /sm buy <stockID> <amount> - Buys the stock & amount specified. - Permission Node: stockMarket.user.buy
- /sm sell <stockID> <amount> - Sells the stock & amount specified - Permission Node: stockMarket.user.sell
- /sm add <stockID> <basePrice> <maxPrice> <minPrice> <volatility> <amount> <dividend> <stockName> - Adds a new stock to the list of all stocks. - Permission Node: stockMarket.admin.add
- /sm remove <stockID> - Removes an existing stock from the list of all stocks. Cannot be undone. - Permission Node: stockMarket.admin.remove
- /sm set <stockID> <newBasePrice> <newMaxPrice> <newMinPrice> <newVolatility> <newAmount> <newDividend> <newStockName> - Edits an existing stocks information. - Permission Node: stockMarket.admin.set
- /sm forcerandom - Forces a random event to occur on a random stock. Does nothing if no stocks exist - Permission Node: stockMarket.admin.event
- /sm reload - Reloads the plugins config. - Permission Node: stockMarket.admin.reload
- /sm <stockID> - displays more info about stock requested. - Permission Node: stockMarket.user.detail
Configuration
So right now the plugin is purely MySQL, as stated above support for other formats will be added later. Run the plugin once to generate the default config file. By default the MySQL server is localhost:3306 user: root pass: "" database: sm. If the database does not exist, it will be created. There are a few other options in there as well. :)
This plugin depends on Vault. It also requires that there be an economy plugin and a permissions plugin, else it unloads on start-up.
Adding Stocks
To add a stock use /sm add.
For example:
- /sm add MASH 100 200 1 100 -1 1 Mashlol's Epic Business of Amazingness
- /sm add AAPL 500 1000 1 25 500 2 Apple Inc.
In general:
- /sm add ID BasePrice MaxPrice MinPrice Volatility Amount Dividend (Name Can Continue For As Long As You Want)
Creating Events
#: <-- This number must follow order (i.e. don't have events 0-3 and 5-7, that would be pointless and also wouldn't work)
message: Message <-- This message will be displayed when the event occurs. All instances of %s will be replaced with the Stock ID.
effect: 50 <-- This is the base effect based on the base price. I.e. the max price change that can occur if this is 50, is an increase in the stocks price equal to 50% of the base price (that is of course if the volatility of the stock is 100)
up: true <-- Does this event increase the price or decrease it? True for increase, false for decrease.
frequency: 50 <-- This has a chance of 50/(sum of all frequencies) to be selected. For example if there are 3 events, each with a frequency of 1, they each have a 1/3 chance of occuring.
Default Config
# How many stocks is the player allowed in total?
max-total-stocks-per-player: 250
# How many stocks is the player allowed of each stock?
max-total-stocks-per-player-per-stock: 50
# How often in minutes should random events occur?
random-event-frequency: 60
# How often in minutes should dividends be paid out?
dividend-frequency: 1440
# Should offline players be paid during dividend payouts?
pay-offline-players: true
# Broadcast events?
broadcast-events: true
# Broadcast dividend payouts?
broadcast-payouts: true
mysql:
ip: localhost
port: 3306
username: root
password: ""
database: sm
events:
0:
message: "The CEO of %s has died of a heart attack. The replacement is looking to be a poor one."
effect: 40
up: false
frequency: 50
1:
message: "The CEO of %s has died of a heart attack. The replacement looks like he is even better than his successor!"
effect: 40
up: true
frequency: 50
2:
message: "%s has announced a new product to be released! Speculation is high!"
effect: 8
up: true
frequency: 250
3:
message: "%s has announced a new product to be released! Speculation is high!"
effect: 8
up: false
frequency: 250
4:
message: "%s's announced product was a huge success, customers are extremely satisfied!"
effect: 45
up: true
frequency: 250
5:
message: "%s's announced product was poorly made, causing poor customer satisfaction!"
effect: 45
up: false
frequency: 250
6:
message: "%s had a bad quarter."
effect: 30
up: false
frequency: 100
7:
message: "%s had a fantastic quarter."
effect: 30
up: true
frequency: 100
8:
message: "Everyone is speculating that %s is soon to come out with an extremely amazing product!"
effect: 65
up: true
frequency: 5
9:
message: "%s is on the brink of bankruptcy."
effect: 65
up: false
frequency: 5
10:
message: "%s just invented the next best thing since sliced bread!"
effect: 400
up: true
frequency: 1
11:
message: "%s just went bankrupt."
effect: 400
up: false
frequency: 1
12:
message: "%s just announced that they are replacing their current CEO, who has a bad reputation."
effect: 25
up: true
frequency: 25
13:
message: "%s just announced that they are replacing their current CEO, who everyone loves."
effect: 25
up: false
frequency: 25
Misc
Warning
If you decide to test this plugin, I hold no responsibility for any possible bugs. As it is in alpha, there are likely to be exploits and such which may possibly allow a player to abuse the economy. If you run a server that is based solely on economy, you might want to wait until beta or release :)
评论 0
登录后参与评分
还没有评论,来抢沙发吧