Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. command /
  2.  
  3. function openTokenshop(p: player, i: integer):
  4. if {_i} == 0:
  5. open virtual chest inventory with size 3 named "Shop" to {_p}
  6.  
  7. loop 27 times:
  8. format gui slot (loop-value - 1) of {_p} with gray stained glass pane named "&e " to do nothing
  9.  
  10. format gui slot 10 of {_p} with player head named "&bTier 1" to run:
  11. openShop({_p}, 1)
  12. format gui slot 13 of {_p} with creeper head named "&aTier 2" to run:
  13. openShop({_p}, 2)
  14. format gui slot 16 of {_p} with dragon head named "&cTier 3" to run:
  15. openShop({_p}, 3)
  16. else:
  17. open virtual chest inventory with size 6 named "Tier %{_i}% Shop" to {_p}
  18.  
  19. loop 54 times:
  20. format gui slot (loop-value - 1) of {_p} with gray stained glass pane named "&e " to do nothing
  21.  
  22. if {_i} == 1:
  23. formatShopItem(10, {_p}, wooden sword named "&6Wooden Sword", 25)
  24. formatShopItem(11, {_p}, stone sword named "&7Stone Sword", 300)
  25. formatShopItem(12, {_p}, iron sword named "&fIron Sword", 750)
  26. formatArmorSet(19, {_p}, leather chestplate named "&6&lLeather Set", 250, leather armor)
  27. formatArmorSet(20, {_p}, chainmail chestplate named "&7&lChainmail Set", 625, chainmail armor)
  28. formatArmorSet(21, {_p}, iron chestplate named "&f&lIron Set", 1200, iron armor)
  29.  
  30. formatShopItem(15, {_p}, water bucket named "&bWater Bucket", 450)
  31. formatShopItem(16, {_p}, 8 scaffolding, 75)
  32. formatShopItem(24, {_p}, 4 ladder, 40)
  33. formatShopItem(25, {_p}, 32 cobblestone, 16)
  34. formatShopItem(33, {_p}, 4 cobweb, 75)
  35. formatShopItem(34, {_p}, 16 oak planks, 32)
  36. formatShopItem(43, {_p}, 1 oak trapdoor, 250)
  37.  
  38. formatShopItem(37, {_p}, 16 white concrete, 64)
  39. formatShopItem(38, {_p}, 16 orange terracotta, 64)
  40. formatShopItem(39, {_p}, 16 green terracotta, 64)
  41. formatShopItem(40, {_p}, 16 dark gray terracotta, 64)
  42. else if {_i} == 2:
  43. formatShopItem(10, {_p}, diamond sword named "&bDiamond Sword", 1200)
  44. formatArmorSet(21, {_p}, diamond chestplate named "&b&lDiamond Set", 3700, diamond armor)
  45. else if {_i} == 3:
  46. send "&cempty" to {_p}
  47.  
  48. format gui slot 49 of {_p} with empty map named "&cBack to Main Menu" to run:
  49. openShop({_p}, 0)
  50.  
  51. command /shop:
  52. trigger:
  53. openShop(player, 0)
  54.  
  55. on right click on entity:
  56. if entity is citizen:
  57. set {_id} to citizen id of clicked entity
  58. if {_id} is 3:
  59. openShop(player, 0)
  60. else if {_id} is 4:
  61. openShop(player, 0)
  62.  
  63. function formatShopItem(s: integer, p: player, i: item, c: integer):
  64. format gui slot {_s} of {_p} with ({_i} with lore "&eCost: $%format({_c})%") to run:
  65. if {balance::%{_p}%} >= {_c}:
  66. remove {_c} from {balance::%{_p}%}
  67. give {_p} {_i}
  68. else:
  69. close {_p}'s inventory
  70. send "&7&l(&c&l!&7&l) &cYou need &e$%format({_c} - {balance::%{_p}%})% &cmore to buy this!" to {_p}
  71.  
  72. function formatArmorSet(s: integer, p: player, i: item, c: integer, x: item):
  73. format gui slot {_s} of {_p} with ({_i} with lore "&eCost: $%format({_c})%") to run:
  74. if {balance::%{_p}%} >= {_c}:
  75. remove {_c} from {balance::%{_p}%}
  76. give {_p} {_x}
  77. else:
  78. close {_p}'s inventory
  79. send "&7&l(&c&l!&7&l) &cYou need &e$%format({_c} - {balance::%{_p}%})% &cmore to buy this!" to {_p}
  80.  
  81. function calculatePrestige(p: player) :: integer:
  82. set {_prestige} to {prestige::%{_p}%}
  83. set {_cost} to "%({_prestige} * 1000000000)%" parsed as integer
  84. return {_cost}
  85.  
  86. function format(n: number) :: text:
  87. set {_data} to "T,12|B,9|M,6|k,3"
  88. loop split {_data} at "|":
  89. set {_s::*} to split loop-value at ","
  90. {_n} >= 10 ^ {_s::2} parsed as number
  91. return "%{_n} / 10 ^ {_s::2} parsed as number%%{_s::1}%"
  92. return "%{_n}%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement