Guest User

Shop

a guest
Nov 8th, 2022
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.62 KB | None | 0 0
  1. options:
  2. sgp: stained glass pane named " " with all flags hidden
  3.  
  4. function smallText(t: text) :: string:
  5. set {_chars::*} to split "ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡʏxᴢ:" at ""
  6. set {_chars1::*} to split "abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWYXZ:" at ""
  7. loop (size of {_chars::*}) times:
  8. replace all {_chars::%loop-value%} and {_chars1::%loop-value+26%} in {_t} with {_chars::%loop-value%}
  9. return {_t}
  10.  
  11. function setSlots(I: number, P: player, IT1: item, IT2: item, IT3: item, IT4: item, IT5: item, IT6: item):
  12. set {_slot} to 9
  13. if {_I} is 0:
  14. loop 6 times:
  15. add 1 to {_slot}
  16. set slot {_slot} of {_P}'s current inventory to {_IT%loop-value%}
  17. else:
  18. loop 3 times:
  19. add 1 to {_slot}
  20. set slot {_slot} of {_P}'s current inventory to {_IT%loop-value%}
  21. add 1 to {_slot}
  22. set {_lvalue} to 3
  23. loop 3 times:
  24. add 1 to {_slot}
  25. add 1 to {_lvalue}
  26. set slot {_slot} of {_P}'s current inventory to {_IT%{_lvalue}%}
  27.  
  28. function inventory(P: player, T: string):
  29. open chest inventory with 3 rows named coloured {_T} to {_P}
  30. set slots 0,1,2,3,4,5,6,7,8,9,13,17,18,19,20,21,22,23,24,25 and 26 of {_P}'s current inventory to black {@sgp}
  31.  
  32. function addBlockShop(N: number, I1: item, I2: item, I3: item, I4: item, I5: item, I6: item, C1: number, C2: number, C3: number, C4: number, C5: number, C6: number):
  33. loop 6 times:
  34. add 16 of {_I%loop-value%} with lore "&7Cost&f: &2$&a%{_C%loop-value%}%" to {blockshop%{_N}%::*}
  35.  
  36. on load:
  37. delete {blockshop1::*}
  38. addBlockShop(1, grass block, stone, cobblestone, stone bricks, stone brick slab, stone brick stairs, 150, 150, 150, 150, 150, 150)
  39.  
  40. function blockshop(P: player, T: text, S: number):
  41. open chest inventory with 6 rows named coloured {_T} to {_P}
  42. set slots (integers between 45 and 53) of {_P}'s current inventory to black {@sgp}
  43. set slot 50 of {_P}'s current inventory to lime {@sgp} named "&aNext Page &7[&f»&7]" with all flags hidden
  44. set slot 48 of {_P}'s current inventory to red {@sgp} named "&cPrevious Page &7[&f«&7]" with all flags hidden if {_S} isn't 1
  45. set slot 48 of {_P}'s current inventory to red {@sgp} named "&cClose" with all flags hidden if {_S} is 1
  46. set {_slot} to -1
  47. set {_maxslot} to 45
  48. loop {_maxslot} times:
  49. add 1 to {_slot}
  50. set slot {_slot} of {_P}'s current inventory to {blockshop%{_S}%::%loop-value%} if {blockshop::%loop-value%} is set
  51. set slot {_slot} of {_P}'s current inventory to gray {@sgp} if {blockshop%{_S}%::%loop-value%} isn't set
  52.  
  53. function itemReturn(I: item, N: text, X: text, B: text, Z: text) :: item:
  54. return {_I} named "%{_Z}%%smallText({_N})%" with lore " ", "&f%smallText({_X})%", "&f%smallText({_B})%", " " and "%{_Z}%➥ %smallText("click to browse")%" with all flags hidden
  55.  
  56. function categories(P: player):
  57. set {_misclist::*} to water bucket and hopper
  58. set {_ran} to random element out of {_misclist::*}
  59. inventory({_P}, " <##FB5444>&l%smallText("shop")%")
  60. setSlots(1, {_P}, itemReturn(grass block, "blocks", "find all of the blocks", "you would need here!", "<##E37939>"), itemReturn(cornflower, "decorations", "find all of the decor", "you would need here!", "<##556CF2>"), itemReturn(red concrete, "colored blocks", "find all of the", "colored blocks here!", "<##52F262>"), itemReturn(hay block, "generators", "purchase your", "generators here!", "<##F2E855>"), itemReturn(blaze rod, "sellwands", "purchase your", "sellwands here!", "<##F25641>"), itemReturn({_ran}, "miscellaneous", "purchase misc", "items here!", "<##E76AFF>"))
  61.  
  62. command /bal:
  63. trigger:
  64. send {balance::%player's uuid%} to player
  65.  
  66. command /setmybal <number>:
  67. trigger:
  68. set {balance::%player's uuid%} to arg-1
  69.  
  70. on inventory click:
  71. if name of player's current inventory is " <##E37939>&l%smallText("blocks")%<##c6c6c6>1":
  72. cancel event
  73. if clicked inventory isn't player's inventory:
  74. if event-slot isn't lime {@sgp} or red {@sgp} or black {@sgp} or gray {@sgp}:
  75. set {_cost} to uncoloured line 1 of lore of event-slot
  76. replace all "Cost: $" in {_cost} with ""
  77. set {_cost} to {_cost} parsed as an integer
  78. if {balance::%player's uuid%} >= {_cost}:
  79. if player has enough space for a diamond pickaxe:
  80. remove {_cost} from {balance::%player's uuid%}
  81. set {_eventslot} to event-slot
  82. delete lore of {_eventslot}
  83. give player {_eventslot}
  84. play sound "minecraft:block.note_block.pling" at pitch 2 to player
  85. else:
  86. play sound "minecraft:block.note_block.pling" at pitch 1 to player
  87. else:
  88. if event-slot is a red stained glass pane named "&cClose":
  89. play sound "minecraft:block.note_block.pling" at pitch 2 to player
  90. categories(player)
  91. else:
  92. play sound "minecraft:block.note_block.pling" at pitch 1 to player
  93.  
  94. if name of player's current inventory is " <##FB5444>&l%smallText("shop")%":
  95. cancel event
  96. play sound "minecraft:block.note_block.pling" at pitch 2 to player
  97. blockshop(player, " <##E37939>&l%smallText("blocks")%<##c6c6c6>1", 1) if index of event-slot is 10
  98.  
  99. command /shop:
  100. trigger:
  101. categories(player)
Add Comment
Please, Sign In to add comment