Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- command /
- function openTokenshop(p: player, i: integer):
- if {_i} == 0:
- open virtual chest inventory with size 3 named "Shop" to {_p}
- loop 27 times:
- format gui slot (loop-value - 1) of {_p} with gray stained glass pane named "&e " to do nothing
- format gui slot 10 of {_p} with player head named "&bTier 1" to run:
- openShop({_p}, 1)
- format gui slot 13 of {_p} with creeper head named "&aTier 2" to run:
- openShop({_p}, 2)
- format gui slot 16 of {_p} with dragon head named "&cTier 3" to run:
- openShop({_p}, 3)
- else:
- open virtual chest inventory with size 6 named "Tier %{_i}% Shop" to {_p}
- loop 54 times:
- format gui slot (loop-value - 1) of {_p} with gray stained glass pane named "&e " to do nothing
- if {_i} == 1:
- formatShopItem(10, {_p}, wooden sword named "&6Wooden Sword", 25)
- formatShopItem(11, {_p}, stone sword named "&7Stone Sword", 300)
- formatShopItem(12, {_p}, iron sword named "&fIron Sword", 750)
- formatArmorSet(19, {_p}, leather chestplate named "&6&lLeather Set", 250, leather armor)
- formatArmorSet(20, {_p}, chainmail chestplate named "&7&lChainmail Set", 625, chainmail armor)
- formatArmorSet(21, {_p}, iron chestplate named "&f&lIron Set", 1200, iron armor)
- formatShopItem(15, {_p}, water bucket named "&bWater Bucket", 450)
- formatShopItem(16, {_p}, 8 scaffolding, 75)
- formatShopItem(24, {_p}, 4 ladder, 40)
- formatShopItem(25, {_p}, 32 cobblestone, 16)
- formatShopItem(33, {_p}, 4 cobweb, 75)
- formatShopItem(34, {_p}, 16 oak planks, 32)
- formatShopItem(43, {_p}, 1 oak trapdoor, 250)
- formatShopItem(37, {_p}, 16 white concrete, 64)
- formatShopItem(38, {_p}, 16 orange terracotta, 64)
- formatShopItem(39, {_p}, 16 green terracotta, 64)
- formatShopItem(40, {_p}, 16 dark gray terracotta, 64)
- else if {_i} == 2:
- formatShopItem(10, {_p}, diamond sword named "&bDiamond Sword", 1200)
- formatArmorSet(21, {_p}, diamond chestplate named "&b&lDiamond Set", 3700, diamond armor)
- else if {_i} == 3:
- send "&cempty" to {_p}
- format gui slot 49 of {_p} with empty map named "&cBack to Main Menu" to run:
- openShop({_p}, 0)
- command /shop:
- trigger:
- openShop(player, 0)
- on right click on entity:
- if entity is citizen:
- set {_id} to citizen id of clicked entity
- if {_id} is 3:
- openShop(player, 0)
- else if {_id} is 4:
- openShop(player, 0)
- function formatShopItem(s: integer, p: player, i: item, c: integer):
- format gui slot {_s} of {_p} with ({_i} with lore "&eCost: $%format({_c})%") to run:
- if {balance::%{_p}%} >= {_c}:
- remove {_c} from {balance::%{_p}%}
- give {_p} {_i}
- else:
- close {_p}'s inventory
- send "&7&l(&c&l!&7&l) &cYou need &e$%format({_c} - {balance::%{_p}%})% &cmore to buy this!" to {_p}
- function formatArmorSet(s: integer, p: player, i: item, c: integer, x: item):
- format gui slot {_s} of {_p} with ({_i} with lore "&eCost: $%format({_c})%") to run:
- if {balance::%{_p}%} >= {_c}:
- remove {_c} from {balance::%{_p}%}
- give {_p} {_x}
- else:
- close {_p}'s inventory
- send "&7&l(&c&l!&7&l) &cYou need &e$%format({_c} - {balance::%{_p}%})% &cmore to buy this!" to {_p}
- function calculatePrestige(p: player) :: integer:
- set {_prestige} to {prestige::%{_p}%}
- set {_cost} to "%({_prestige} * 1000000000)%" parsed as integer
- return {_cost}
- function format(n: number) :: text:
- set {_data} to "T,12|B,9|M,6|k,3"
- loop split {_data} at "|":
- set {_s::*} to split loop-value at ","
- {_n} >= 10 ^ {_s::2} parsed as number
- return "%{_n} / 10 ^ {_s::2} parsed as number%%{_s::1}%"
- return "%{_n}%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement