Files
empresas_bolsa_bitcoin.sk
Code
1 1,261
empresas_bolsa_bitcoin.sk
options:
prefix: &8[7D6BEᴍᴇʀᴄᴀᴅᴏ&8] &r
company-cost: 100000
sector-tax: 10
sector-employee-bonus: 5
dividend-rate: 20
dividend-interval: 60
daily-reset-interval: 1440
market-interval: 5
market-crisis-chance: 5
market-boom-chance: 8
market-crisis-impact: -10
market-boom-impact: 10
market-company-volatility: 5
market-crisis-resistance-per-level: 2
minimum-share-price: 1
initial-share-price: 100
bitcoin-initial-price: 50000
bitcoin-interval: 5
bitcoin-volatility: 15
bitcoin-alert-threshold: 12
bitcoin-minimum-price: 1
bitcoin-miner-cost: 25000
bitcoin-miner-production: 0.001
miner-efficiency-per-level: 10
company-bitcoin-sale-fee: 2
quick-transaction: 1000
upgrade-cost-2: 100000
upgrade-cost-3: 250000
upgrade-cost-4: 500000
upgrade-cost-5: 1000000
miner-limit-per-level: 2
loan-max: 1000000
loan-interest: 5
loan-principal-rate: 10
loan-interval: 60
loan-default-limit: 3
loan-default-price-drop: 25
contract-reward: 50000
contract-employee-bonus: 5000
contract-wheat-amount: 2000
contract-iron-amount: 1000
contract-stone-amount: 2000
contract-redstone-amount: 1000
contract-share-bonus: 5
company-employees-per-level: 3
company-title: &8ᴘᴀɪɴᴇʟ ᴅᴀ ᴇᴍᴘʀᴇsᴀ
market-title: &8ʙᴏʟsᴀ ᴅᴇ ᴠᴀʟᴏʀᴇs
bitcoin-title: &8ʙɪᴛᴄᴏɪɴ
# Estado de sessão por jogador bloqueia cliques/arrastes; Skript nativo não oferece metadata tags para inventários.
function company_id(companyName: text) :: text:
set {_id} to lowercase {_companyName}
replace all " " with "_" in {_id}
return {_id}
function open_company_menu(p: player):
set {_uuid} to "%uuid of {_p}%"
set {_id} to {company::member::%{_uuid}%}
if {_id} is not set:
send "{@prefix}&cVocê não faz parte de uma empresa." to {_p}
stop
set {_employee-count} to size of {company::%{_id}%::employees::*}
set {_miner-limit} to {company::%{_id}%::level} * {@miner-limit-per-level}
set {_inv} to chest inventory with 5 rows named "{@company-title}"
loop 45 times:
set slot (loop-number - 1) of {_inv} to black stained glass pane named "&0 "
set slot 10 of {_inv} to book named "&eInformações completas" with lore "&7Cofre: &a$%{company::%{_id}%::treasury}%" and "&7Nível: &f%{company::%{_id}%::level}%" and "&7Funcionários: &f%{_employee-count}%"
set slot 12 of {_inv} to lime stained glass pane named "&aDepositar $ {@quick-transaction}" with lore "&7Clique para transferir ao cofre."
set slot 14 of {_inv} to red stained glass pane named "&cSacar $ {@quick-transaction}" with lore "&7Clique para retirar do cofre."
set slot 16 of {_inv} to player head named "&bEquipe da empresa" with lore "&7Veja funcionários e use /empresa promover|demitir."
set slot 20 of {_inv} to iron block named "&bComprar mineradora" with lore "&7Custo: &f$ {@bitcoin-miner-cost}" and "&7Produção base: &f{@bitcoin-miner-production} BTC/ciclo" and "&7Limite: &f%{company::%{_id}%::miners}%&7/&f%{_miner-limit}%"
set slot 22 of {_inv} to gold nugget named "&6Vender BTC corporativo" with lore "&7Disponível: &f%{company::%{_id}%::btc}% BTC" and "&7Clique para vender tudo ao cofre."
set slot 24 of {_inv} to anvil named "&dEvoluir empresa" with lore "&7Nível atual: &f%{company::%{_id}%::level}%&7/5" and "&7Use /empresa upgrade para evoluir."
set slot 28 of {_inv} to gold ingot named "&6Abrir IPO de 10%%" with lore "&7Oferece 10%% das suas ações." and "&7Limite total na bolsa: 49%%."
set slot 30 of {_inv} to emerald named "&aAbrir a bolsa" with lore "&7Ver empresas com ações disponíveis."
set slot 32 of {_inv} to paper named "&eContratos corporativos" with lore "&7Ver ou aceitar o contrato da empresa."
set slot 34 of {_inv} to chest named "&6Empréstimos" with lore "&7Use /empresa emprestimo <valor>" and "&7Juros por ciclo: &f{@loan-interest}%%"
open {_inv} to {_p}
set {gui::kind::%{_uuid}%} to "company"
set {gui::company::%{_uuid}%} to {_id}
function open_company_staff(p: player):
set {_uuid} to "%uuid of {_p}%"
set {_id} to {company::member::%{_uuid}%}
if {_id} is not set:
send "{@prefix}&cVocê não faz parte de uma empresa." to {_p}
stop
set {_inv} to chest inventory with 3 rows named "&8ᴇǫᴜɪᴘᴇ ᴄᴏʀᴘᴏʀᴀᴛɪᴠᴀ"
delete {gui::staff-slot::%{_uuid}%::*}
set {_slot} to 0
loop {company::%{_id}%::employees::*}:
if {_slot} < 27:
set {_employee-uuid} to loop-value
set {gui::staff-slot::%{_uuid}%::%{_slot}%} to {_employee-uuid}
set slot {_slot} of {_inv} to player head named "&b%{company::%{_id}%::employee-name::%{_employee-uuid}%}%" with lore "&7Cargo: &f%{company::%{_id}%::role::%{_employee-uuid}%}%" and "&aClique esquerdo: promover/rebaixar" and "&cClique direito: demitir"
add 1 to {_slot}
if {_slot} is 0:
set slot 13 of {_inv} to barrier named "&cNenhum funcionário" with lore "&7Convide jogadores com /empresa convidar."
open {_inv} to {_p}
set {gui::kind::%{_uuid}%} to "staff"
set {gui::company::%{_uuid}%} to {_id}
function open_market_menu(p: player):
set {_uuid} to "%uuid of {_p}%"
set {_inv} to chest inventory with 3 rows named "{@market-title}"
delete {gui::market-slot::%{_uuid}%::*}
set {_slot} to 0
loop {companies::*}:
set {_id} to loop-value
if {company::%{_id}%::ipo-open} is true:
if {company::%{_id}%::ipo-remaining} > 0:
if {_slot} < 27:
set {gui::market-slot::%{_uuid}%::%{_slot}%} to {_id}
set {_trend-1} to "&8—"
set {_trend-2} to "&8—"
set {_trend-3} to "&8—"
if {company::%{_id}%::history::1} is set:
if {company::%{_id}%::history::1} >= 0:
set {_trend-1} to "&a▲ +%{company::%{_id}%::history::1}%%%"
else:
set {_trend-1} to "&c▼ %{company::%{_id}%::history::1}%%%"
if {company::%{_id}%::history::2} is set:
if {company::%{_id}%::history::2} >= 0:
set {_trend-2} to "&a▲ +%{company::%{_id}%::history::2}%%%"
else:
set {_trend-2} to "&c▼ %{company::%{_id}%::history::2}%%%"
if {company::%{_id}%::history::3} is set:
if {company::%{_id}%::history::3} >= 0:
set {_trend-3} to "&a▲ +%{company::%{_id}%::history::3}%%%"
else:
set {_trend-3} to "&c▼ %{company::%{_id}%::history::3}%%%"
set slot {_slot} of {_inv} to emerald named "&a%{company::%{_id}%::name}%" with lore "&7Ação (1%%): &f$%{company::%{_id}%::share-price}%" and "&7Disponível: &f%{company::%{_id}%::ipo-remaining}%%%" and "&7Histórico: %{_trend-1}% %{_trend-2}% %{_trend-3}%" and "&eClique para comprar 1%%."
add 1 to {_slot}
if {_slot} is 0:
set slot 13 of {_inv} to barrier named "&cNenhuma oferta disponível" with lore "&7Empresas podem abrir um IPO pelo painel."
open {_inv} to {_p}
set {gui::kind::%{_uuid}%} to "market"
function open_bitcoin_menu(p: player):
set {_uuid} to "%uuid of {_p}%"
set {_wallet} to {btc::wallet::%{_uuid}%}
if {_wallet} is not set:
set {_wallet} to 0
set {_inv} to chest inventory with 3 rows named "{@bitcoin-title}"
set slot 11 of {_inv} to emerald named "&aComprar 0.01 BTC" with lore "&7Cotação: &f$%{btc::price}%" and "&7Saldo BTC: &f%{_wallet}%"
set slot 13 of {_inv} to gold nugget named "&eCarteira Bitcoin" with lore "&7Você possui: &f%{_wallet}% BTC" and "&7Cotação atual: &f$%{btc::price}%"
set slot 15 of {_inv} to redstone named "&cVender 0.01 BTC" with lore "&7Recebe o valor da cotação atual."
open {_inv} to {_p}
set {gui::kind::%{_uuid}%} to "bitcoin"
on script load:
if {btc::price} is not set:
set {btc::price} to {@bitcoin-initial-price}
if {companies::*} is not set:
delete {companies::*}
loop {companies::*}:
if {company::%loop-value%::level} is not set:
set {company::%loop-value%::level} to 1
if {company::%loop-value%::loan::debt} is not set:
set {company::%loop-value%::loan::debt} to 0
if {company::%loop-value%::miners} is not set:
set {company::%loop-value%::miners} to 0
if {company::%loop-value%::btc} is not set:
set {company::%loop-value%::btc} to 0
on join:
set {_uuid} to "%uuid of player%"
if {dividend::due::%{_uuid}%} is set:
if {dividend::due::%{_uuid}%} > 0:
add {dividend::due::%{_uuid}%} to player's balance
send "{@prefix}&aDividendos acumulados pagos: &f$%{dividend::due::%{_uuid}%}%" to player
delete {dividend::due::%{_uuid}%}
if {contract::reward::%{_uuid}%} is set:
add {contract::reward::%{_uuid}%} to player's balance
send "{@prefix}&6Bônus de contrato acumulado pago: &f$%{contract::reward::%{_uuid}%}%" to player
delete {contract::reward::%{_uuid}%}
command /empresa [<text>] [<text>] [<number>]:
trigger:
set {_uuid} to "%uuid of player%"
if arg-1 is not set:
open_company_menu(player)
stop
if arg-1 is "criar":
if arg-2 is not set:
send "{@prefix}&cUso: /empresa criar <nome>" to player
stop
set {_id} to company_id(arg-2)
if {_id} is in {companies::*}:
send "{@prefix}&cEsse nome de empresa já está em uso." to player
stop
if {company::member::%{_uuid}%} is set:
send "{@prefix}&cVocê já pertence a uma empresa." to player
stop
if player's balance < {@company-cost}:
send "{@prefix}&cVocê precisa de $ {@company-cost} para abrir uma empresa." to player
stop