Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- prefix: &6Tycoon&8:&7
- shop: Shop
- upgrades: Upgrades
- prestigeUpgrades: Prestige Upgrades
- upgradesItem: gold nugget named "&eUpgrades"
- prestigeUpgradesItem: ghast tear named "&fPrestige Upgrades"
- function sendBalance():
- if {tc.loopingBalance} is true:
- stop
- set {tc.loopingBalance} to true
- while {tc.loopingBalance} is true:
- if {tc.stopped} is true:
- delete {tc.loopingBalance}
- else if size of online players is 0:
- delete {tc.loopingBalance}
- else:
- loop all players:
- add {tc.%uuid of loop-player%.income} to {tc.%uuid of loop-player%.balance}
- send actionbar "&6Coins&8: &e%{tc.%uuid of loop-player%.balance}%" to loop-player
- wait 20 ticks
- on join:
- if {tc.%uuid of player%.balance} is not set:
- set {tc.%uuid of player%.balance} to 0
- set {tc.%uuid of player%.income} to 1
- loop {tc.signList.%uuid of player%::*}:
- add {tc.signdata.%loop-value%.income} to {tc.%uuid of player%.income}
- sendBalance()
- on enable:
- while {tc.loopingBalance} is true:
- wait 10 ticks
- if {tc.stopped}:
- wait 1 tick
- delete {tc.stopped}
- sendBalance()
- on disable:
- if {tc.loopingBalance} is true:
- set {tc.stopped} to true
- function setLineData(sign: Location, line: String, firstType: String, secondType: String):
- set {_lines::*} to {_line} split at " "
- if size of {_lines::*} is not 2:
- stop
- set {_firstValue} to {_lines::1} parsed as an integer
- set {_secondValue} to {_lines::2} parsed as an integer
- if {_firstValue} is set:
- if {_secondValue} is set:
- if {_firstValue} > 0:
- if {_secondValue} > 0:
- set {tc.signdata.%{_sign}%.%{_firstType}%} to {_firstValue}
- set {tc.signdata.%{_sign}%.%{_secondType}%} to {_secondValue}
- function updateSignVariables(sign: Location):
- add 1 to {tc.signdata.%{_sign}%.level}
- add {tc.signdata.%{_sign}%.costIncrease} to {tc.signdata.%{_sign}%.cost}
- add {tc.signdata.%{_sign}%.income} to {tc.signdata.%{_sign}%.income}
- if {tc.signdata.%{_sign}%.level} >= {tc.signdata.%{_sign}%.maxLevel}:
- set {tc.signdata.%{_sign}%.cost} to -1
- on sign change:
- if line 1 doesn't start with "[T] ":
- stop
- setLineData(location of event-block, line 4 of event-block, "level", "maxLevel")
- setLineData(location of event-block, line 3 of event-block, "cost", "costIncrease")
- setLineData(location of event-block, line 2 of event-block, "income", "incomeIncrease")
- if {tc.signdata.%location of event-block%.level} >= {tc.signdata.%location of event-block%.maxLevel}:
- set {tc.signdata.%location of event-block%.cost} to -1
- if {tc.signdata.%location of event-block%.cost} is not set:
- stop
- set {_l1} to line 1
- replace "[T] " in {_l1} with ""
- set line 1 to "&6&l%{_l1}%"
- set line 2 to ""
- if {tc.signdata.%location of event-block%.cost} > -1:
- set line 3 to "&eCost&8: &7%{tc.signdata.%location of event-block%.cost}%"
- else:
- set line 3 to "&eCost&8: &7Max Level"
- set line 4 to "&bLevel&8: &7%{tc.signdata.%location of event-block%.level}%"
- add location of event-block to {tc.signList.%uuid of player%::*}
- on right click on sign:
- if {tc.signdata.%location of event-block%.cost} is not set:
- stop
- else if {tc.signdata.%location of event-block%.level} >= {tc.signdata.%location of event-block%.maxLevel}:
- play sound "entity.item.break" to player
- else if {tc.%uuid of player%.balance} < {tc.signdata.%location of event-block%.cost}:
- play sound "entity.item.break" to player
- else:
- remove {tc.signdata.%location of event-block%.cost} from {tc.%uuid of player%.balance}
- updateSignVariables(location of event-block)
- add {tc.signdata.%location of event-block%.incomeIncrease} to {tc.%uuid of player%.income}
- play sound "entity.player.levelup" to player
- if {tc.signdata.%location of event-block%.cost} > -1:
- set line 3 to "&eCost&8: &7%{tc.signdata.%location of event-block%.cost}%"
- else:
- set line 3 to "&eCost&8: &7Max Level"
- set line 4 to "&bLevel&8: &7%{tc.signdata.%location of event-block%.level}%"
- on break of sign:
- if {tc.signdata.%location of event-block%.cost} is set:
- delete {tc.signdata.%location of event-block%.cost}
- delete {tc.signdata.%location of event-block%.costIncrease}
- delete {tc.signdata.%location of event-block%.level}
- delete {tc.signdata.%location of event-block%.maxLevel}
- remove location of event-block from {tc.signList.%uuid of player%::*}
- command /shop:
- trigger:
- open chest with 1 rows named "{@shop}" to player
- set slot 0 of player's current inventory to {@upgradesItem}
- set slot 1 of player's current inventory to {@prestigeUpgradesItem}
- function openUpgrades(player: Player):
- open chest with 3 rows named "{@upgrades}" to {_player}
- function openPrestigeUpgrades(player: Player):
- open chest with 3 rows named "{@prestigeUpgrades}" to {_player}
- function handleShopInventoryClick(player: Player, clicked: Item):
- if {_clicked} is {@upgradesItem}:
- openUpgrades({_player})
- else if {_clicked} is {@prestigeUpgradesItem}:
- openPrestigeUpgrades({_player})
- else:
- stop
- play sound "ui.button.click" to {_player}
- on inventory click:
- # Fix that inventory click is only cancelled when clicked inside the shop-GUI
- if inventory name of clicked inventory is "{@shop}":
- cancel event
- handleShopInventoryClick(player, event-item)
- else if inventory name of clicked inventory is "{@upgrades}":
- cancel event
- send "UPGRADES"
- else if inventory name of clicked inventory is "{@prestigeUpgrades}":
- cancel event
- send "PRESTIGE UPGRADES"
Advertisement
Add Comment
Please, Sign In to add comment