Advertisement
CREAMPAN0408

Untitled

Feb 23rd, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.63 KB | None | 0 0
  1. options:
  2. # Values for the different rarities' display names
  3. # Underline is used to split the Name and Color
  4. epic: &2_Epic
  5. rare: &9_Rare
  6. legendary: &6_Legendary
  7. # Here we set the player's skin variables
  8.  
  9. on join:
  10. loop 2 times:
  11. if loop-number = 1:
  12. set {_set} to -1
  13. set {_type} to "pac"
  14. else:
  15. set {_set} to 4
  16. set {_type} to "ghost"
  17. loop {%{_type}%Skins::*}:
  18. set {_skin} to loop-value-2
  19. if {playerSkins::%player%::%{_skin}%} is not set:
  20. $ thread
  21. set {playerSkins::%player%::%{_skin}%} to sql var "skins::pacmine::%{_skin}%::%{_p}%" exists
  22.  
  23. # Simply cutting down on the space used by skins; if it isn't owned, it will be deleted.
  24. if {playerSkins::%player%::%{_skin}%} is false:
  25. delete {playerSkins::%player%::%{_skin}%}
  26. on quit:
  27. clear {playerSkins::%player%::*}
  28.  
  29. function skinGui(p: player):
  30. open chest with 3 rows named "&7Pac-Mine Skins | Ghost Skins" to {_p}
  31. wait 1 tick
  32.  
  33. $ thread
  34. set {_selected} to value of sql var "skins::pacmine::selected::%{_p}%"
  35. if {_selected} is "<none>":
  36. set {_selected} to "default"
  37. $ thread
  38. set {_coins} to getCoins({_p})
  39. if {_coins} is not set:
  40. set {_coins} to 0
  41.  
  42. loop 2 times:
  43. if loop-number = 1:
  44. set {_set} to -1
  45. set {_type} to "pac"
  46. else:
  47. set {_set} to 4
  48. set {_type} to "ghost"
  49. loop {%{_type}%Skins::*}:
  50.  
  51. # Set skin variables
  52. set {_skin} to loop-value-2
  53. set {_price} to {%{_type}%Skins::%{_skin}%::price} parsed as number
  54. set {_displayName} to {%{_type}%Skins::%{_skin}%::displayName}
  55. set {_skinType} to {%{_type}%Skins::%{_skin}%::skinType}
  56. set {_color} to ""
  57. set {_lore} to ""
  58. if {%{_type}%Skins::%{_skin}%::lore} is not "":
  59. # We split the color code from the name
  60. set {_lores::*} to {%{_type}%Skins::%{_skin}%::lore} split at "_"
  61. set {_lore} to "||%{_lores::1}%(%{_lores::2}% Drop)"
  62.  
  63. evaluate "set {_displayitem} to %{%{_type}%Skins::%{_skin}%::displayitem}%"
  64.  
  65. # Detect when the skin display needs to wrap around in the GUI
  66. if ({_set} / 3) = 1:
  67. add 6 to {_set}
  68. else if ({_set} / 8) = 1:
  69. add 6 to {_set}
  70. else:
  71. add 1 to {_set}
  72.  
  73. if not {_price} > 0:
  74. set {_price} to "&7Found in the &eBonus Box"
  75. else if {_price} is 0:
  76. set {playerSkins::%{_p}%::%{_skin}%} to true
  77. else:
  78. set {_price} to "&7Click to buy: &e%{_price}% coins"
  79.  
  80. inventory name of {_p}'s current inventory is "&7Pac-Mine Skins | Ghost Skins"
  81. if {_skin} is {_selected}:
  82. set slot {_set} of {_p}'s current inventory to glowing {_displayitem} with nbt "{Skin:%{_skin}%, SkinType:%{_skinType}%}" named "%colored {_displayName}%" with no nbt with lore "&7Currently Selected%{_lore}%"
  83. else if not {playerSkins::%{_p}%::%{_skin}%}:
  84. set slot {_set} of {_p}'s current inventory to {_displayitem} with nbt "{Skin:%{_skin}%, SkinType:%{_skinType}%}" named "%colored {_displayName}%" with no nbt with lore "%{_price}%%{_lore}%"
  85. else:
  86. set slot {_set} of {_p}'s current inventory to {_displayitem} with nbt "{Skin:%{_skin}%, SkinType:%{_skinType}%}" named "%colored {_displayName}%" with no nbt with lore "&7Click to Select%{_lore}%"
  87.  
  88.  
  89.  
  90. inventory name of {_p}'s current inventory is "&7Pac-Mine Skins | Ghost Skins"
  91. loop integers between 18 and 26:
  92. if "%{_coins}%" contains "none":
  93. set {_coins} to 0
  94. if loop-number is 22:
  95. set slot loop-number of {_p}'s current inventory to a glowing gold block named "&7Your Coins: &e%{_coins}% coins"
  96. else if loop-number is less than 22:
  97. set slot loop-number of {_p}'s current inventory to a gold nugget named "&6&l>>"
  98. else if loop-number is greater than 22:
  99. set slot loop-number of {_p}'s current inventory to a gold nugget named "&6&l<<"
  100.  
  101.  
  102. function loadSkin(p: player):
  103. clear {_p}'s inventory
  104. $ thread
  105. set {_selected} to value of sql var "skins::pacmine::selected::%{_p}%"
  106. if {_selected} is "<none>":
  107. set {_selected} to "default"
  108. loop {skins::*}:
  109. loop-value is {_selected}
  110. set {_num} to loop-index
  111. stop loop
  112. loop {skins::%{_num}%::slots::*}:
  113. evaluate "set slot %loop-index% of {_p} to %loop-value%"
  114.  
  115. on right click holding gunpowder:
  116. name of player's tool is "&7Skin Selector"
  117. cancel the event
  118. skinGui(player)
  119.  
  120. on load:
  121. clear {playerSkins::*}
  122. clear {pacSkins::*}
  123. # Add skin values
  124. add "pac_default", "pac1", "pac2", "pac3", and "pac4" to {pacSkins::*}
  125. # Add names
  126. add "&7Default", "&eBlue", "&eRed", "&eGreen", and "&eUSA" to {_displayNames::*}
  127. # Add prices
  128. add "0", "750", and "1250" to {_prices::*}
  129. # Add display items
  130. add "orange carpet", "magenta carpet", "light blue carpet", "yellow carpet", and "green carpet" to {_displayItems::*}
  131. # Add item lores
  132. add "", "", "", "{@rare}", and "{@legendary}" to {_itemLores::*}
  133.  
  134. loop {pacSkins::*}:
  135. set {pacSkins::%loop-value%::price} to {_prices::%loop-index%}
  136. set {pacSkins::%loop-value%::displayItem} to {_displayItems::%loop-index%}
  137. set {pacSkins::%loop-value%::displayName} to {_displayNames::%loop-index%}
  138. set {pacSkins::%loop-value%::lore} to {_itemLores::%loop-index%}
  139.  
  140. clear {_prices::*}
  141. clear {_displayNames::*}
  142. clear {_displayItems::*}
  143. clear {_itemLores::*}
  144.  
  145. clear {ghostSkins::*}
  146. # Add skin values
  147. add "ghost_default", "ghost1", "ghost2", "ghost3", and "ghost4" to {ghostSkins::*}
  148. # Add names
  149. add "&7Default", "&eOrange", "&ePink", "&eBlue", and "&ePLACEHOLDER" to {_displayNames::*}
  150. # Add prices
  151. add "0", "750", and "1250" to {_prices::*}
  152. # Add display items
  153. add "light green carpet", "pink carpet", "gray carpet", "blue carpet", and "light gray carpet" to {_displayItems::*}
  154. # Add item lores
  155. add "", "", "", "{@rare}", and "{@legendary}" to {_itemLores::*}
  156.  
  157. loop {ghostSkins::*}:
  158. set {ghostSkins::%loop-value%::price} to {_prices::%loop-index%}
  159. set {ghostSkins::%loop-value%::displayItem} to {_displayItems::%loop-index%}
  160. set {ghostSkins::%loop-value%::displayName} to {_displayNames::%loop-index%}
  161. set {ghostSkins::%loop-value%::lore} to {_itemLores::%loop-index%}
  162.  
  163. broadcast "&aAll skins loaded!"
  164.  
  165. on inventory click:
  166. if inventory name of player's current inventory is "&7Pac-Mine Skins | Ghost Skins":
  167. cancel the event
  168. set {_skin} to tag "Skin" of nbt of clicked item
  169. set {_skinType} to tag "SkinType" of nbt of clicked item
  170.  
  171. if {_skin} is set:
  172. set {_lore} to lore of clicked item
  173. if {_lore} contains "Currently Selected":
  174. send "&7You already have that skin selected."
  175. close player's inventory
  176. else if {_lore} contains "Click to select":
  177. close player's inventory
  178. send "&7You have selected skin %name of clicked item%&7."
  179.  
  180. if {_skinType} contains "pac":
  181. set {game::pacman::%{_p}%::skin} to clicked item
  182. else:
  183. set {game::ghost::%{_p}%::skin} to clicked item
  184.  
  185.  
  186. $ thread
  187. set sql var "skins::pacmine::selected::%player%" to "%{_skin}%"
  188. else:
  189. set {_price} to get digits of uncolored {_lore} parsed as integer
  190. if {_price} is not set:
  191. close player's inventory
  192. send "&7You cannot buy that, it is found in the Bonus Box only."
  193. else:
  194. $ thread
  195. set {_coins} to getCoins(sender)
  196. if "%{_coins}%" = "<none>":
  197. set {_coins} to 0
  198. if {_coins} is less than {_price}:
  199. close player's inventory
  200. send "&7You do not have sufficient funds to purchase &7the %name of clicked item%&7 skin."
  201. else:
  202. close player's inventory
  203. send "&7You have purchased &7the %name of clicked item%&7 skin."
  204. $ thread
  205. set sql var "skins::pacmine::%{_skin}%::%player%" to "true"
  206. $ thread
  207. set {playerSkins::%player%::%{_skin}%} to true
  208. $ thread
  209. remCoins(sender, {_price})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement