Oxalist

Shop Skript

Mar 11th, 2020 (edited)
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.03 KB | None | 0 0
  1. function addShopItem(p: player, shop: text, item: text, sell: number, buy: number):
  2. add {_item} to {shopitems::%{_shop}%::*}
  3. set {shopbuyprice::%{_shop}%::%{_item}%} to {_buy}
  4. set {shopsellprice::%{_shop}%::%{_item}%} to {_sell}
  5.  
  6. function removeShopItem(p: player, shop: text, item: text):
  7. remove {_item} from {shopitems::%{_shop}%::*}
  8. delete {shopbuyprice::%{_shop}%::%{_item}%}
  9. delete {shopsellprice::%{_shop}%::%{_item}%}
  10.  
  11. command /addshopitem [<text>] [<text>] [<number>] [<number>]:
  12. permission: add.shop.item
  13. trigger:
  14. if arg 1 is set:
  15. if arg 2 is set:
  16. if arg 3 is set:
  17. if arg 4 is set:
  18. addShopItem(player, arg 1, arg 2, arg 3, arg 4)
  19. send "Add %arg 2% to shop %arg 1% with sell %arg 3% and buy %arg 4%" to player
  20.  
  21. command /removeshopitem [<text>] [<text>]:
  22. permission: add.shop.item
  23. trigger:
  24. if arg 1 is set:
  25. if arg 2 is set:
  26. removeShopItem(player, arg 1, arg 2)
  27. send "remove %arg 2% from shop %arg 1%" to player
  28.  
  29. command /shopdeleteall:
  30. trigger:
  31. loop {shopitems::Potions::*}:
  32. delete {shopbuyprice::Potions::%loop-value%}
  33. delete {shopsellprice::Potions::%loop-value%}
  34. remove loop-value from {shopitems::Potions::*}
  35.  
  36.  
  37. command /shop:
  38. trigger:
  39. shopGUI(player)
  40.  
  41. function shopGUI(p: player):
  42. open virtual chest inventory named " &nRoaming Shop" to {_p}
  43. format a gui slot 10 of {_p} with grass block named "&a&lBlocks Shop &7(%size of {shopitems::Blocks::*}% blocks)" to close then run function shopPage({_p}, 0, "Blocks")
  44. format a gui slot 11 of {_p} with bone named "&a&lMiscellaneous Shop &7(%size of {shopitems::Misc::*}% items)" to close then run function shopPage({_p}, 0, "Misc")
  45. format a gui slot 12 of {_p} with poppy named "&a&lDecoration Shop &7(%size of {shopitems::Decoration::*}% items)" to close then run function shopPage({_p}, 0, "Decoration")
  46. format a gui slot 13 of {_p} with brewing stand named "&a&lPotion Shop &7(%size of {shopitems::Potions::*}% potions)" to close then run function shopPage({_p}, 0, "Potions")
  47. format a gui slot 14 of {_p} with hoe named "&a&lFarming Shop &7(%size of {shopitems::Farming::*}% items)" to close then run function shopPage({_p}, 0, "Farming")
  48. format a gui slot 15 of {_p} with steak named "&a&lFood Shop &7(%size of {shopitems::Food::*}% foods)" to close then run function shopPage({_p}, 0, "Food")
  49. format a gui slot 16 of {_p} with redstone named "&a&lRedstone Shop &7(%size of {shopitems::Redstone::*}% items)" to close then run function shopPage({_p}, 0, "Redstone")
  50.  
  51.  
  52. function shopBuy(p: player, shop: text, item: text):
  53. open virtual chest inventory with size 6 named "Buy %{_item}%" to {_p}
  54. set {_buy} to {shopbuyprice::%{_shop}%::%{_item}%}
  55. set {_sell} to {shopsellprice::%{_shop}%::%{_item}%}
  56. set {blockvalue::%{_p}%} to 1
  57. set {_blocks} to {blockvalue::%{_p}%}
  58. set {blockvalue::%{_p}%} to {_blocks}
  59. set {_itemtype} to {_item} parsed as item
  60. format a gui slot 22 of {_p} with {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%" to do nothing
  61. format a gui slot 31 of {_p} with sunflower named "&e&lConfirm Purchase" with lore "&7Click to confirm your purchase" to run:
  62. set {_ha} to {blockvalue::%{_p}%}*{shopbuyprice::%{_shop}%::%{_item}%}
  63. set {_itemtype} to {_item} parsed as item
  64. if {_p}'s balance is greater than or equal to {_ha}:
  65. close {_p}'s inventory
  66. remove {blockvalue::%{_p}%}*{shopbuyprice::%{_shop}%::%{_item}%} from {_p}'s balance
  67. send title "&e&lPURCHASE SUCCESSFULL" with subtitle "&fYou purchased &7%{blockvalue::%{_p}%}% %{_item}% &ffor &7$%{blockvalue::%{_p}%}*{shopbuyprice::%{_shop}%::%{_item}%}%" to {_p} for 4 seconds
  68. give {blockvalue::%{_p}%} of {_itemtype} to {_p}
  69. else if {_p}'s balance is less than {_ha}:
  70. send "&cNot enough money in your balance" to {_p}
  71. format a gui slot 24 of {_p} with minecart with chest named "&a&lAdd 512 %{_item}%" with lore "&7Click to buy 512 %{_item}%" to run:
  72. set {_blocks} to {blockvalue::%{_p}%}
  73. if {_blocks} is greater than 0:
  74. add 512 to {_blocks}
  75. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  76. set {blockvalue::%{_p}%} to {_blocks}
  77. format a gui slot 20 of {_p} with minecart named "&c&lReset %{_item}% Value" with lore "&7Click to reset %{_item}% value" to run:
  78. set {blockvalue::%{_p}%} to 1
  79. set {_blocks} to {blockvalue::%{_p}%}
  80. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  81. format a gui slot 0 of {_p} with green stained glass pane named "&a&l+ 1 %{_item}%" to run:
  82. set {_blocks} to {blockvalue::%{_p}%}
  83. if {_blocks} is greater than 0:
  84. add 1 to {_blocks}
  85. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  86. set {blockvalue::%{_p}%} to {_blocks}
  87. format a gui slot 1 of {_p} with green stained glass pane named "&a&l+ 2 %{_item}%" to run:
  88. set {_blocks} to {blockvalue::%{_p}%}
  89. if {_blocks} is greater than 0:
  90. add 2 to {_blocks}
  91. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  92. set {blockvalue::%{_p}%} to {_blocks}
  93. format a gui slot 2 of {_p} with green stained glass pane named "&a&l+ 4 %{_item}%" to run:
  94. set {_blocks} to {blockvalue::%{_p}%}
  95. if {_blocks} is greater than 0:
  96. add 4 to {_blocks}
  97. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  98. set {blockvalue::%{_p}%} to {_blocks}
  99. format a gui slot 3 of {_p} with green stained glass pane named "&a&l+ 8 %{_item}%" to run:
  100. set {_blocks} to {blockvalue::%{_p}%}
  101. if {_blocks} is greater than 0:
  102. add 8 to {_blocks}
  103. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  104. set {blockvalue::%{_p}%} to {_blocks}
  105. format a gui slot 4 of {_p} with green stained glass pane named "&a&l+ 16 %{_item}%" to run:
  106. set {_blocks} to {blockvalue::%{_p}%}
  107. if {_blocks} is greater than 0:
  108. add 16 to {_blocks}
  109. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  110. set {blockvalue::%{_p}%} to {_blocks}
  111. format a gui slot 5 of {_p} with green stained glass pane named "&a&l+ 32 %{_item}%" to run:
  112. set {_blocks} to {blockvalue::%{_p}%}
  113. if {_blocks} is greater than 0:
  114. add 32 to {_blocks}
  115. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  116. set {blockvalue::%{_p}%} to {_blocks}
  117. format a gui slot 6 of {_p} with green stained glass pane named "&a&l+ 64 %{_item}%" to run:
  118. set {_blocks} to {blockvalue::%{_p}%}
  119. if {_blocks} is greater than 0:
  120. add 64 to {_blocks}
  121. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  122. set {blockvalue::%{_p}%} to {_blocks}
  123. format a gui slot 7 of {_p} with green stained glass pane named "&a&l+ 128 %{_item}%" to run:
  124. set {_blocks} to {blockvalue::%{_p}%}
  125. if {_blocks} is greater than 0:
  126. add 128 to {_blocks}
  127. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  128. set {blockvalue::%{_p}%} to {_blocks}
  129. format a gui slot 8 of {_p} with green stained glass pane named "&a&l+ 256 %{_item}%" to run:
  130. set {_blocks} to {blockvalue::%{_p}%}
  131. if {_blocks} is greater than 0:
  132. add 256 to {_blocks}
  133. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  134. set {blockvalue::%{_p}%} to {_blocks}
  135. format a gui slot 45 of {_p} with red stained glass pane named "&c&l- 1 %{_item}%" to run:
  136. set {_blocks} to {blockvalue::%{_p}%}
  137. if {_blocks} is less than 1:
  138. send "&cYou cannot go into a negative figure" to {_p}
  139. else if {_blocks} is greater than 1:
  140. if {_blocks} is greater than or equal to 64:
  141. remove 1 from {_blocks}
  142. else if {_blocks} is less than 64:
  143. remove 1 from {_blocks}
  144. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  145. set {blockvalue::%{_p}%} to {_blocks}
  146. format a gui slot 46 of {_p} with red stained glass pane named "&c&l- 2 %{_item}%" to run:
  147. set {_blocks} to {blockvalue::%{_p}%}
  148. if {_blocks} is less than 2:
  149. send "&cYou cannot go into a negative figure" to {_p}
  150. else if {_blocks} is greater than 2:
  151. if {_blocks} is greater than or equal to 64:
  152. remove 2 from {_blocks}
  153. else if {_blocks} is less than 64:
  154. remove 2 from {_blocks}
  155. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  156. set {blockvalue::%{_p}%} to {_blocks}
  157. format a gui slot 47 of {_p} with red stained glass pane named "&c&l- 4 %{_item}%" to run:
  158. set {_blocks} to {blockvalue::%{_p}%}
  159. if {_blocks} is less than 4:
  160. send "&cYou cannot go into a negative figure" to {_p}
  161. else if {_blocks} is greater than 4:
  162. if {_blocks} is greater than or equal to 64:
  163. remove 4 from {_blocks}
  164. else if {_blocks} is less than 64:
  165. remove 4 from {_blocks}
  166. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  167. set {blockvalue::%{_p}%} to {_blocks}
  168. format a gui slot 48 of {_p} with red stained glass pane named "&c&l- 8 %{_item}%" to run:
  169. set {_blocks} to {blockvalue::%{_p}%}
  170. if {_blocks} is less than 8:
  171. send "&cYou cannot go into a negative figure" to {_p}
  172. else if {_blocks} is greater than 8:
  173. if {_blocks} is greater than or equal to 64:
  174. remove 8 from {_blocks}
  175. else if {_blocks} is less than 64:
  176. remove 8 from {_blocks}
  177. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  178. set {blockvalue::%{_p}%} to {_blocks}
  179. format a gui slot 49 of {_p} with red stained glass pane named "&c&l- 16 %{_item}%" to run:
  180. set {_blocks} to {blockvalue::%{_p}%}
  181. if {_blocks} is less than 16:
  182. send "&cYou cannot go into a negative figure" to {_p}
  183. else if {_blocks} is greater than 16:
  184. if {_blocks} is greater than or equal to 64:
  185. remove 16 from {_blocks}
  186. set slot 22 of {_p}'s current inventory to 64 of {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  187. else if {_blocks} is less than 64:
  188. remove 16 from {_blocks}
  189. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  190. set {blockvalue::%{_p}%} to {_blocks}
  191. format a gui slot 50 of {_p} with red stained glass pane named "&c&l- 32 %{_item}%" to run:
  192. set {_blocks} to {blockvalue::%{_p}%}
  193. if {_blocks} is greater than 32:
  194. if {_blocks} is greater than or equal to 64:
  195. remove 32 from {_blocks}
  196. else if {_blocks} is less than 64:
  197. remove 32 from {_blocks}
  198. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  199. else if {_blocks} is less than 32:
  200. send "&cYou cannot go into a negative figure" to {_p}
  201. set {blockvalue::%{_p}%} to {_blocks}
  202. format a gui slot 51 of {_p} with red stained glass pane named "&c&l- 64 %{_item}%" to run:
  203. set {_blocks} to {blockvalue::%{_p}%}
  204. if {_blocks} is less than 64:
  205. send "&cYou cannot go into a negative figure" to {_p}
  206. else if {_blocks} is greater than 64:
  207. remove 64 from {_blocks}
  208. else if {_blocks} is less than 64:
  209. remove 64 from {_blocks}
  210. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  211. set {blockvalue::%{_p}%} to {_blocks}
  212. format a gui slot 52 of {_p} with red stained glass pane named "&c&l- 128 %{_item}%" to run:
  213. set {_blocks} to {blockvalue::%{_p}%}
  214. if {_blocks} is less than 128:
  215. send "&cYou cannot go into a negative figure" to {_p}
  216. else if {_blocks} is greater than 128:
  217. remove 128 from {_blocks}
  218. else if {_blocks} is less than 64:
  219. remove 128 from {_blocks}
  220. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  221. set {blockvalue::%{_p}%} to {_blocks}
  222. format a gui slot 53 of {_p} with red stained glass pane named "&c&l- 256 %{_item}%" to run:
  223. set {_blocks} to {blockvalue::%{_p}%}
  224. if {_blocks} is less than 256:
  225. send "&cYou cannot go into a negative figure" to {_p}
  226. else if {_blocks} is greater than 256:
  227. remove 256 from {_blocks}
  228. send "%{_blocks}%" to {_p}
  229. else if {_blocks} is less than 256:
  230. remove 256 from {_blocks}
  231. send "%{_blocks}%" to {_p}
  232. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Buy for &a&l$%{_blocks}*{shopbuyprice::%{_shop}%::%{_item}%}%"
  233. set {blockvalue::%{_p}%} to {_blocks}
  234.  
  235. function shopSell(p: player, shop: text, item: text):
  236. open virtual chest inventory with size 6 named "Sell %{_item}%" to {_p}
  237. set {_sell} to {shopsellprice::%{_shop}%::%{_item}%}
  238. set {_sell} to {shopsellprice::%{_shop}%::%{_item}%}
  239. set {blockvalue::%{_p}%} to 1
  240. set {_blocks} to {blockvalue::%{_p}%}
  241. set {blockvalue::%{_p}%} to {_blocks}
  242. set {_itemtype} to {_item} parsed as item
  243. format a gui slot 22 of {_p} with {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%" to do nothing
  244. format a gui slot 31 of {_p} with sunflower named "&e&lConfirm Sell" with lore "&7Click to confirm your sell" to run:
  245. set {_ha} to {blockvalue::%{_p}%}*{shopsellprice::%{_shop}%::%{_item}%}
  246. set {_itemtype} to {_item} parsed as item
  247. if {_p} has {blockvalue::%{_p}%} of {_itemtype}:
  248. close {_p}'s inventory
  249. add {blockvalue::%{_p}%}*{shopsellprice::%{_shop}%::%{_item}%} to {_p}'s balance
  250. send title "&e&lSELL SUCCESSFULL" with subtitle "&fYou sold &7%{blockvalue::%{_p}%}% %{_item}% &ffor &7$%{blockvalue::%{_p}%}*{shopsellprice::%{_shop}%::%{_item}%}%" to {_p} for 4 seconds
  251. remove {blockvalue::%{_p}%} of {_itemtype} from {_p}
  252. else if {_p} does not have {blockvalue::%{_p}%} of {_itemtype}:
  253. send "&cNot enough %{_item}%&c in your inventory" to {_p}
  254. format a gui slot 24 of {_p} with minecart with chest named "&a&lSet to Inventory Amount" with lore "&7Click to set to inventory amount value" to run:
  255. set {_amount} to amount of {_itemtype} in {_p}'s inventory
  256. if {_amount} is not 0:
  257. set {_blocks} to {blockvalue::%{_p}%}
  258. if {_blocks} is greater than 0:
  259. set {_blocks} to {_amount}
  260. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  261. else if {_amount} is 0:
  262. send "&cNot enough %{_item}%&c in your inventory" to {_p}
  263. set {blockvalue::%{_p}%} to {_blocks}
  264. format a gui slot 20 of {_p} with minecart named "&c&lReset %{_item}% Value" with lore "&7Click to reset %{_item}% value" to run:
  265. set {blockvalue::%{_p}%} to 1
  266. set {_blocks} to {blockvalue::%{_p}%}
  267. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  268. format a gui slot 0 of {_p} with green stained glass pane named "&a&l+ 1 %{_item}%" to run:
  269. set {_blocks} to {blockvalue::%{_p}%}
  270. if {_blocks} is greater than 0:
  271. add 1 to {_blocks}
  272. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  273. set {blockvalue::%{_p}%} to {_blocks}
  274. format a gui slot 1 of {_p} with green stained glass pane named "&a&l+ 2 %{_item}%" to run:
  275. set {_blocks} to {blockvalue::%{_p}%}
  276. if {_blocks} is greater than 0:
  277. add 2 to {_blocks}
  278. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  279. set {blockvalue::%{_p}%} to {_blocks}
  280. format a gui slot 2 of {_p} with green stained glass pane named "&a&l+ 4 %{_item}%" to run:
  281. set {_blocks} to {blockvalue::%{_p}%}
  282. if {_blocks} is greater than 0:
  283. add 4 to {_blocks}
  284. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  285. set {blockvalue::%{_p}%} to {_blocks}
  286. format a gui slot 3 of {_p} with green stained glass pane named "&a&l+ 8 %{_item}%" to run:
  287. set {_blocks} to {blockvalue::%{_p}%}
  288. if {_blocks} is greater than 0:
  289. add 8 to {_blocks}
  290. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  291. set {blockvalue::%{_p}%} to {_blocks}
  292. format a gui slot 4 of {_p} with green stained glass pane named "&a&l+ 16 %{_item}%" to run:
  293. set {_blocks} to {blockvalue::%{_p}%}
  294. if {_blocks} is greater than 0:
  295. add 16 to {_blocks}
  296. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  297. set {blockvalue::%{_p}%} to {_blocks}
  298. format a gui slot 5 of {_p} with green stained glass pane named "&a&l+ 32 %{_item}%" to run:
  299. set {_blocks} to {blockvalue::%{_p}%}
  300. if {_blocks} is greater than 0:
  301. add 32 to {_blocks}
  302. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  303. set {blockvalue::%{_p}%} to {_blocks}
  304. format a gui slot 6 of {_p} with green stained glass pane named "&a&l+ 64 %{_item}%" to run:
  305. set {_blocks} to {blockvalue::%{_p}%}
  306. if {_blocks} is greater than 0:
  307. add 64 to {_blocks}
  308. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  309. set {blockvalue::%{_p}%} to {_blocks}
  310. format a gui slot 7 of {_p} with green stained glass pane named "&a&l+ 128 %{_item}%" to run:
  311. set {_blocks} to {blockvalue::%{_p}%}
  312. if {_blocks} is greater than 0:
  313. add 128 to {_blocks}
  314. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  315. set {blockvalue::%{_p}%} to {_blocks}
  316. format a gui slot 8 of {_p} with green stained glass pane named "&a&l+ 256 %{_item}%" to run:
  317. set {_blocks} to {blockvalue::%{_p}%}
  318. if {_blocks} is greater than 0:
  319. add 256 to {_blocks}
  320. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  321. set {blockvalue::%{_p}%} to {_blocks}
  322. format a gui slot 45 of {_p} with red stained glass pane named "&c&l- 1 %{_item}%" to run:
  323. set {_blocks} to {blockvalue::%{_p}%}
  324. if {_blocks} is less than 1:
  325. send "&cYou cannot go into a negative figure" to {_p}
  326. else if {_blocks} is greater than 1:
  327. if {_blocks} is greater than or equal to 64:
  328. remove 1 from {_blocks}
  329. else if {_blocks} is less than 64:
  330. remove 1 from {_blocks}
  331. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  332. set {blockvalue::%{_p}%} to {_blocks}
  333. format a gui slot 46 of {_p} with red stained glass pane named "&c&l- 2 %{_item}%" to run:
  334. set {_blocks} to {blockvalue::%{_p}%}
  335. if {_blocks} is less than 2:
  336. send "&cYou cannot go into a negative figure" to {_p}
  337. else if {_blocks} is greater than 2:
  338. if {_blocks} is greater than or equal to 64:
  339. remove 2 from {_blocks}
  340. else if {_blocks} is less than 64:
  341. remove 2 from {_blocks}
  342. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  343. set {blockvalue::%{_p}%} to {_blocks}
  344. format a gui slot 47 of {_p} with red stained glass pane named "&c&l- 4 %{_item}%" to run:
  345. set {_blocks} to {blockvalue::%{_p}%}
  346. if {_blocks} is less than 4:
  347. send "&cYou cannot go into a negative figure" to {_p}
  348. else if {_blocks} is greater than 4:
  349. if {_blocks} is greater than or equal to 64:
  350. remove 4 from {_blocks}
  351. else if {_blocks} is less than 64:
  352. remove 4 from {_blocks}
  353. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  354. set {blockvalue::%{_p}%} to {_blocks}
  355. format a gui slot 48 of {_p} with red stained glass pane named "&c&l- 8 %{_item}%" to run:
  356. set {_blocks} to {blockvalue::%{_p}%}
  357. if {_blocks} is less than 8:
  358. send "&cYou cannot go into a negative figure" to {_p}
  359. else if {_blocks} is greater than 8:
  360. if {_blocks} is greater than or equal to 64:
  361. remove 8 from {_blocks}
  362. else if {_blocks} is less than 64:
  363. remove 8 from {_blocks}
  364. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  365. set {blockvalue::%{_p}%} to {_blocks}
  366. format a gui slot 49 of {_p} with red stained glass pane named "&c&l- 16 %{_item}%" to run:
  367. set {_blocks} to {blockvalue::%{_p}%}
  368. if {_blocks} is less than 16:
  369. send "&cYou cannot go into a negative figure" to {_p}
  370. else if {_blocks} is greater than 16:
  371. if {_blocks} is greater than or equal to 64:
  372. remove 16 from {_blocks}
  373. set slot 22 of {_p}'s current inventory to 64 of {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  374. else if {_blocks} is less than 64:
  375. remove 16 from {_blocks}
  376. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  377. set {blockvalue::%{_p}%} to {_blocks}
  378. format a gui slot 50 of {_p} with red stained glass pane named "&c&l- 32 %{_item}%" to run:
  379. set {_blocks} to {blockvalue::%{_p}%}
  380. if {_blocks} is greater than 32:
  381. if {_blocks} is greater than or equal to 64:
  382. remove 32 from {_blocks}
  383. else if {_blocks} is less than 64:
  384. remove 32 from {_blocks}
  385. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  386. else if {_blocks} is less than 32:
  387. send "&cYou cannot go into a negative figure" to {_p}
  388. set {blockvalue::%{_p}%} to {_blocks}
  389. format a gui slot 51 of {_p} with red stained glass pane named "&c&l- 64 %{_item}%" to run:
  390. set {_blocks} to {blockvalue::%{_p}%}
  391. if {_blocks} is less than 64:
  392. send "&cYou cannot go into a negative figure" to {_p}
  393. else if {_blocks} is greater than 64:
  394. remove 64 from {_blocks}
  395. else if {_blocks} is less than 64:
  396. remove 64 from {_blocks}
  397. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  398. set {blockvalue::%{_p}%} to {_blocks}
  399. format a gui slot 52 of {_p} with red stained glass pane named "&c&l- 128 %{_item}%" to run:
  400. set {_blocks} to {blockvalue::%{_p}%}
  401. if {_blocks} is less than 128:
  402. send "&cYou cannot go into a negative figure" to {_p}
  403. else if {_blocks} is greater than 128:
  404. remove 128 from {_blocks}
  405. else if {_blocks} is less than 64:
  406. remove 128 from {_blocks}
  407. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  408. set {blockvalue::%{_p}%} to {_blocks}
  409. format a gui slot 53 of {_p} with red stained glass pane named "&c&l- 256 %{_item}%" to run:
  410. set {_blocks} to {blockvalue::%{_p}%}
  411. if {_blocks} is less than 256:
  412. send "&cYou cannot go into a negative figure" to {_p}
  413. else if {_blocks} is greater than 256:
  414. remove 256 from {_blocks}
  415. send "%{_blocks}%" to {_p}
  416. else if {_blocks} is less than 256:
  417. remove 256 from {_blocks}
  418. send "%{_blocks}%" to {_p}
  419. set slot 22 of {_p}'s current inventory to {_itemtype} named "&f%{_item}% &7x%{_blocks}%" with lore "&7Sell for &a&l$%{_blocks}*{shopsellprice::%{_shop}%::%{_item}%}%"
  420. set {blockvalue::%{_p}%} to {_blocks}
  421.  
  422.  
  423. function shopPage(p: player, page: number, shop: text):
  424. set {_pageStart} to 45*{_page}
  425. set {_i} to 1
  426. set {_a} to 0
  427. open virtual chest inventory with size 6 named "%{_shop}% Shop | Page: %{_page} + 1%" to {_p}
  428. format a gui slot 45 and 47 and 48 and 50 and 51 and 52 and 53 and 46 of {_p} with black stained glass pane named "" to do nothing
  429. wait 2 ticks
  430. loop {shopitems::%{_shop}%::*}:
  431. (loop-index parsed as integer) > {_pageStart}
  432. set {_item} to "%loop-value%" parsed as item
  433. format a gui slot {_a} of {_p} with {_item} named "&f%loop-value% &7x1" with lore "" and "&7Buy for &a&l$%{shopbuyprice::%{_shop}%::%loop-value%}%" and "&7Sell for &c&l$%{shopsellprice::%{_shop}%::%loop-value%}%" and "" and "&aLeft-Click to &a&lBUY" and "&cRight-Click to &c&lSELL" and "" to run function shopBuy({_p}, {_shop}, loop-value) with "left" click
  434. format a gui slot {_a} of {_p} with {_item} named "&f%loop-value% &7x1" with lore "" and "&7Buy for &a&l$%{shopbuyprice::%{_shop}%::%loop-value%}%" and "&7Sell for &c&l$%{shopsellprice::%{_shop}%::%loop-value%}%" and "" and "&aLeft-Click to &a&lBUY" and "&cRight-Click to &c&lSELL" and "" to run function shopSell({_p}, {_shop}, loop-value) with "right" click
  435. add 1 to {_a}
  436. if {_a} = ((45*{_i})):
  437. exit loop
  438. format a gui slot 49 of {_p} with gray dye named "&cGo back" to run function shopGUI({_p})
  439. if (amount of {shopitems::%{_shop}%::*}) > {_pageStart} + 45:
  440. format a gui slot 53 of {_p} with arrow named "&eNext Page" to run function shopPage({_p}, {_page} + 1, {_shop})
  441. if {_page} > 0:
  442. format a gui slot 45 of {_p} with arrow named "&ePrevious Page" to run function shopPage({_p}, ({_page} - 1), {_shop})
  443.  
  444. on block form of cobblestone:
  445. chance of 1%:
  446. set event-block to diamond ore
  447. stop
  448. chance of 5%:
  449. set event-block to gold ore
  450. stop
  451. chance of 10%:
  452. set event-block to iron ore
  453. stop
  454. chance of 15%:
  455. set event-block to coal ore
  456. stop
Advertisement
Add Comment
Please, Sign In to add comment