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"
- upgradeItem_multiplierIPrice: 100
- upgradeItem_multiplierIIPrice: 200
- upgradeItem_multiplierIIIPrice: 400
- upgradeItem_multiplierI_locked: gold ingot named "&eMultiplier" with lore " &8Used to multiply", " &8your income.", "&6 ", " &7Multiplier&8: &e2.0x", " &7Price&8: &e100", and " &7Status&8: &eLocked"
- upgradeItem_multiplierI_unlocked: gold ingot named "&eMultiplier" with lore " &8Used to multiply", " &8your income.", "&6 ", " &7Multiplier&8: &e2.0x", " &7Price&8: &e100", and " &7Status&8: &eUnlocked"
- upgradeItem_multiplierII_locked: 2 gold ingot named "&eMultiplier" with lore " &8Used to multiply", " &8your income.", "&6 ", " &7Multiplier&8: &e2.5x", " &7Price&8: &e200", and " &7Status&8: &eLocked"
- upgradeItem_multiplierII_unlocked: 2 gold ingot named "&eMultiplier" with lore " &8Used to multiply", " &8your income.", "&6 ", " &7Multiplier&8: &e2.5x", " &7Price&8: &e200", and " &7Status&8: &eUnlocked"
- upgradeItem_multiplierIII_locked: 3 gold ingot named "&eMultiplier" with lore " &8Used to multiply", " &8your income.", "&6 ", " &7Multiplier&8: &e3.0x", " &7Price&8: &e400", and " &7Status&8: &eLocked"
- upgradeItem_multiplierIII_unlocked: 3 gold ingot named "&eMultiplier" with lore " &8Used to multiply", " &8your income.", "&6 ", " &7Multiplier&8: &e3.0x", " &7Price&8: &e400", and " &7Status&8: &eUnlocked"
- 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
- if {tc.%uuid of player%.prestige} is not set:
- set {tc.%uuid of player%.prestige} to 0
- if {tc.%uuid of player%.upgradesWorth} is not set:
- set {tc.%uuid of player%.upgradesWorth} to 0
- if {tc.%uuid of player%.prestigeMultiplier} is not set:
- set {tc.%uuid of player%.prestigeMultiplier} to 0
- set {tc.%uuid of player%.prestigeConfirmAvailable} to false
- initializePlayerIncome(player)
- sendBalance()
- function initializePlayerIncome(player: Player):
- set {_uuid} to uuid of {_player}
- set {tc.%{_uuid}%.income} to 1
- loop {tc.signList.%{_uuid}%::*}:
- add {tc.signdata.%loop-value%.income} to {tc.%{_uuid}%.income}
- set {_multipliers::*} to "I", "II" and "III"
- set {_multiplierValues::*} to 2.0, 2.5 and 3.0
- loop {_multipliers::*}:
- if {tc.%{_uuid}%.upgradeItem_multiplier%loop-value%} is true:
- set {tc.%{_uuid}%.income} to {tc.%{_uuid}%.income}*{_multiplierValues::%loop-index%}
- on enable:
- set {_d} to 0
- while {tc.loopingBalance} is true:
- wait 5 ticks
- add 1 to {_d}
- if {_d} >= 4:
- delete {tc.loopingBalance}
- wait 1 ticks
- 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}%.incomeIncrease} 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%::*}
- set {tc.signdata.%location of event-block%.income} to {tc.signdata.%location of event-block%.incomeIncrease}
- initializePlayerIncome(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:
- add {tc.signdata.%location of event-block%.cost}/2.0 to {tc.%uuid of player%.upgradesWorth}
- remove {tc.signdata.%location of event-block%.cost} from {tc.%uuid of player%.balance}
- add {tc.signdata.%location of event-block%.incomeIncrease} to {tc.%uuid of player%.income}
- updateSignVariables(location of event-block)
- 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:
- if {tc.signList.%uuid of player%::*} does not contain location of event-block:
- cancel event
- stop
- 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%::*}
- initializePlayerIncome(player)
- #=========================================
- # Shop
- command /shop:
- trigger:
- set {tc.currentInventory.%player%} to true
- 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 1 rows named "{@upgrades}" to {_player}
- setUpgradeInGui({_player}, 0, "upgradeItem_multiplierI", {@upgradeItem_multiplierI_locked}, {@upgradeItem_multiplierI_unlocked})
- setUpgradeInGui({_player}, 1, "upgradeItem_multiplierII", {@upgradeItem_multiplierII_locked}, {@upgradeItem_multiplierII_unlocked})
- setUpgradeInGui({_player}, 2, "upgradeItem_multiplierIII", {@upgradeItem_multiplierIII_locked}, {@upgradeItem_multiplierIII_unlocked})
- wait 1 ticks
- set {tc.currentInventory.%{_player}%} to true
- function setUpgradeInGui(player: Player, slot: Integer, variableName: String, notBought: Item, bought: Item):
- set {_uuid} to uuid of {_player}
- if {tc.%{_uuid}%.%{_variableName}%}:
- set slot {_slot} of {_player}'s current inventory to {_bought}
- else:
- set slot {_slot} of {_player}'s current inventory to {_notBought}
- function openPrestigeUpgrades(player: Player):
- open chest with 1 rows named "{@prestigeUpgrades}" to {_player}
- wait 1 ticks
- set {tc.currentInventory.%{_player}%} to true
- 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}
- function tryBuyUpgrade(player: Player, name: String, variableName: String, price: int, prestigeUpgrades: Boolean):
- set {_uuid} to uuid of {_player}
- if {tc.%{_uuid}%.%{_variableName}%} is true:
- send "{@prefix} You already bought &e%{_name}%" to {_player}
- play sound "entity.item.break" to {_player}
- else:
- if {tc.%{_uuid}%.balance} < {_price}:
- send "{@prefix} You do not have enough coins to buy &e%{_name}%" to {_player}
- play sound "entity.item.break" to {_player}
- else:
- set {tc.%{_uuid}%.%{_variableName}%} to true
- remove {_price} from {tc.%{_uuid}%.balance}
- send "{@prefix} You have bought &e%{_name}%" to {_player}
- play sound "entity.player.levelup" to {_player}
- add {_price} to {tc.%{_uuid}%.upgradesWorth}
- initializePlayerIncome({_player})
- if {_prestigeUpgrades}:
- openPrestigeUpgrades({_player})
- else:
- openUpgrades({_player})
- function handleUpgradeInventoryClick(player: Player, clicked: Item):
- if {_clicked} is air:
- stop
- if checkIfItemIsEqualTo({_clicked}, {@upgradeItem_multiplierI_locked}) or checkIfItemIsEqualTo({_clicked}, {@upgradeItem_multiplierI_unlocked}):
- tryBuyUpgrade({_player}, "Multiplier I", "upgradeItem_multiplierI", {@upgradeItem_multiplierIPrice}, false)
- else if checkIfItemIsEqualTo({_clicked}, {@upgradeItem_multiplierII_locked}) or checkIfItemIsEqualTo({_clicked}, {@upgradeItem_multiplierII_unlocked}):
- tryBuyUpgrade({_player}, "Multiplier II", "upgradeItem_multiplierII", {@upgradeItem_multiplierIIPrice}, false)
- else if checkIfItemIsEqualTo({_clicked}, {@upgradeItem_multiplierIII_locked}) or checkIfItemIsEqualTo({_clicked}, {@upgradeItem_multiplierIII_unlocked}):
- tryBuyUpgrade({_player}, "Multiplier III", "upgradeItem_multiplierIII", {@upgradeItem_multiplierIIIPrice}, false)
- function checkIfItemIsEqualTo(check: Item, equalTo: Item) :: Boolean:
- if type of {_check} is not type of {_equalTo}:
- return false
- else if item amount of {_check} is not item amount of {_equalTo}:
- return false
- else if name of {_check} is not name of {_equalTo}:
- return false
- else if "%lore of {_check}%" is not "%lore of {_equalTo}%":
- return false
- return true
- on inventory click:
- if "%event-inventory%" is not "inventory of <none>":
- stop
- 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
- handleUpgradeInventoryClick(player, event-item)
- else if inventory name of clicked inventory is "{@prestigeUpgrades}":
- cancel event
- send "PRESTIGE UPGRADES"
- on inventory close:
- delete {tc.currentInventory.%player%}
- on inventory drag:
- if {tc.currentInventory.%player%} is set:
- cancel event
- on quit:
- delete {tc.currentInventory.%player%}
- command /prestige [<text>]:
- trigger:
- if executor is console:
- send "{@prefix} This command can only be executed by a player."
- else if arg-1 is "confirm":
- if {tc.%uuid of player%.prestigeConfirmAvailable} is not true:
- send "{@prefix} You cannot use this command as you have not used &e/prestige&7."
- else:
- set {tc.%uuid of player%.prestigeConfirmAvailable} to false
- add {tc.%uuid of player%.prestigeReceivedOnPrestige} to {tc.%uuid of player%.prestige}
- send "{@prefix} You have prestieged and received &e%{tc.%uuid of player%.prestigeReceivedOnPrestige}% &eprestige&7!"
- loop {tc.signList.%uuid of player%::*}:
- set {_sign} to block at loop-value
- if type of {_sign} is not sign:
- stop
- set {tc.signdata.%loop-value%.level} to 0
- set {tc.signdata.%loop-value%.cost} to 0
- set {tc.signdata.%loop-value%.income} to 0
- updateSignVariables(loop-value)
- if {tc.signdata.%loop-value%.cost} > -1:
- set line 3 of {_sign} to "&eCost&8: &7%{tc.signdata.%loop-value%.cost}%"
- else:
- set line 3 of {_sign} to "&eCost&8: &7Max Level"
- set line 4 of {_sign} to "&bLevel&8: &7%{tc.signdata.%loop-value%.level}%"
- initializePlayerIncome(player)
- else:
- set {tc.%uuid of player%.prestigeConfirmAvailable} to true
- calculatePrestige(player)
- send "&8&m "
- send " &7Prestiging will have the following effects:"
- send " &8• &7Your &eupgrades &7will &ereset"
- send " &8• &7You will gain &e%{tc.%uuid of player%.prestigeReceivedOnPrestige}% &eprestige"
- send " &8• &7Your &eprestige-multiplier &7will increase by &e0.1"
- send " "
- send " <ttp:&7Click to prestige!><cmd:/prestige confirm>&eConfirm"
- send "&8&m "
- function calculatePrestige(player: Player):
- set {_uuid} to uuid of {_player}
- set {_prestige::*} to ("%{tc.%{_uuid}%.upgradesWorth}*({tc.%{_uuid}%.prestigeMultiplier}+1)%") split at "."
- set {tc.%{_uuid}%.prestigeReceivedOnPrestige} to {_prestige::1} parsed as an integer
Advertisement
Add Comment
Please, Sign In to add comment