Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- # Values for the different rarities' display names
- # Underline is used to split the Name and Color
- epic: &2_Epic
- rare: &9_Rare
- legendary: &6_Legendary
- # Here we set the player's skin variables
- on join:
- loop 2 times:
- if loop-number = 1:
- set {_set} to -1
- set {_type} to "pac"
- else:
- set {_set} to 4
- set {_type} to "ghost"
- loop {%{_type}%Skins::*}:
- set {_skin} to loop-value-2
- if {playerSkins::%player%::%{_skin}%} is not set:
- $ thread
- set {playerSkins::%player%::%{_skin}%} to sql var "skins::pacmine::%{_skin}%::%{_p}%" exists
- # Simply cutting down on the space used by skins; if it isn't owned, it will be deleted.
- if {playerSkins::%player%::%{_skin}%} is false:
- delete {playerSkins::%player%::%{_skin}%}
- on quit:
- clear {playerSkins::%player%::*}
- function skinGui(p: player):
- open chest with 3 rows named "&7Pac-Mine Skins | Ghost Skins" to {_p}
- wait 1 tick
- $ thread
- set {_selected} to value of sql var "skins::pacmine::selected::%{_p}%"
- if {_selected} is "<none>":
- set {_selected} to "default"
- $ thread
- set {_coins} to getCoins({_p})
- if {_coins} is not set:
- set {_coins} to 0
- loop 2 times:
- if loop-number = 1:
- set {_set} to -1
- set {_type} to "pac"
- else:
- set {_set} to 4
- set {_type} to "ghost"
- loop {%{_type}%Skins::*}:
- # Set skin variables
- set {_skin} to loop-value-2
- set {_price} to {%{_type}%Skins::%{_skin}%::price} parsed as number
- set {_displayName} to {%{_type}%Skins::%{_skin}%::displayName}
- set {_skinType} to {%{_type}%Skins::%{_skin}%::skinType}
- set {_color} to ""
- set {_lore} to ""
- if {%{_type}%Skins::%{_skin}%::lore} is not "":
- # We split the color code from the name
- set {_lores::*} to {%{_type}%Skins::%{_skin}%::lore} split at "_"
- set {_lore} to "||%{_lores::1}%(%{_lores::2}% Drop)"
- evaluate "set {_displayitem} to %{%{_type}%Skins::%{_skin}%::displayitem}%"
- # Detect when the skin display needs to wrap around in the GUI
- if ({_set} / 3) = 1:
- add 6 to {_set}
- else if ({_set} / 8) = 1:
- add 6 to {_set}
- else:
- add 1 to {_set}
- if not {_price} > 0:
- set {_price} to "&7Found in the &eBonus Box"
- else if {_price} is 0:
- set {playerSkins::%{_p}%::%{_skin}%} to true
- else:
- set {_price} to "&7Click to buy: &e%{_price}% coins"
- inventory name of {_p}'s current inventory is "&7Pac-Mine Skins | Ghost Skins"
- if {_skin} is {_selected}:
- 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}%"
- else if not {playerSkins::%{_p}%::%{_skin}%}:
- 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}%"
- else:
- 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}%"
- inventory name of {_p}'s current inventory is "&7Pac-Mine Skins | Ghost Skins"
- loop integers between 18 and 26:
- if "%{_coins}%" contains "none":
- set {_coins} to 0
- if loop-number is 22:
- set slot loop-number of {_p}'s current inventory to a glowing gold block named "&7Your Coins: &e%{_coins}% coins"
- else if loop-number is less than 22:
- set slot loop-number of {_p}'s current inventory to a gold nugget named "&6&l>>"
- else if loop-number is greater than 22:
- set slot loop-number of {_p}'s current inventory to a gold nugget named "&6&l<<"
- function loadSkin(p: player):
- clear {_p}'s inventory
- $ thread
- set {_selected} to value of sql var "skins::pacmine::selected::%{_p}%"
- if {_selected} is "<none>":
- set {_selected} to "default"
- loop {skins::*}:
- loop-value is {_selected}
- set {_num} to loop-index
- stop loop
- loop {skins::%{_num}%::slots::*}:
- evaluate "set slot %loop-index% of {_p} to %loop-value%"
- on right click holding gunpowder:
- name of player's tool is "&7Skin Selector"
- cancel the event
- skinGui(player)
- on load:
- clear {playerSkins::*}
- clear {pacSkins::*}
- # Add skin values
- add "pac_default", "pac1", "pac2", "pac3", and "pac4" to {pacSkins::*}
- # Add names
- add "&7Default", "&eBlue", "&eRed", "&eGreen", and "&eUSA" to {_displayNames::*}
- # Add prices
- add "0", "750", and "1250" to {_prices::*}
- # Add display items
- add "orange carpet", "magenta carpet", "light blue carpet", "yellow carpet", and "green carpet" to {_displayItems::*}
- # Add item lores
- add "", "", "", "{@rare}", and "{@legendary}" to {_itemLores::*}
- loop {pacSkins::*}:
- set {pacSkins::%loop-value%::price} to {_prices::%loop-index%}
- set {pacSkins::%loop-value%::displayItem} to {_displayItems::%loop-index%}
- set {pacSkins::%loop-value%::displayName} to {_displayNames::%loop-index%}
- set {pacSkins::%loop-value%::lore} to {_itemLores::%loop-index%}
- clear {_prices::*}
- clear {_displayNames::*}
- clear {_displayItems::*}
- clear {_itemLores::*}
- clear {ghostSkins::*}
- # Add skin values
- add "ghost_default", "ghost1", "ghost2", "ghost3", and "ghost4" to {ghostSkins::*}
- # Add names
- add "&7Default", "&eOrange", "&ePink", "&eBlue", and "&ePLACEHOLDER" to {_displayNames::*}
- # Add prices
- add "0", "750", and "1250" to {_prices::*}
- # Add display items
- add "light green carpet", "pink carpet", "gray carpet", "blue carpet", and "light gray carpet" to {_displayItems::*}
- # Add item lores
- add "", "", "", "{@rare}", and "{@legendary}" to {_itemLores::*}
- loop {ghostSkins::*}:
- set {ghostSkins::%loop-value%::price} to {_prices::%loop-index%}
- set {ghostSkins::%loop-value%::displayItem} to {_displayItems::%loop-index%}
- set {ghostSkins::%loop-value%::displayName} to {_displayNames::%loop-index%}
- set {ghostSkins::%loop-value%::lore} to {_itemLores::%loop-index%}
- broadcast "&aAll skins loaded!"
- on inventory click:
- if inventory name of player's current inventory is "&7Pac-Mine Skins | Ghost Skins":
- cancel the event
- set {_skin} to tag "Skin" of nbt of clicked item
- set {_skinType} to tag "SkinType" of nbt of clicked item
- if {_skin} is set:
- set {_lore} to lore of clicked item
- if {_lore} contains "Currently Selected":
- send "&7You already have that skin selected."
- close player's inventory
- else if {_lore} contains "Click to select":
- close player's inventory
- send "&7You have selected skin %name of clicked item%&7."
- if {_skinType} contains "pac":
- set {game::pacman::%{_p}%::skin} to clicked item
- else:
- set {game::ghost::%{_p}%::skin} to clicked item
- $ thread
- set sql var "skins::pacmine::selected::%player%" to "%{_skin}%"
- else:
- set {_price} to get digits of uncolored {_lore} parsed as integer
- if {_price} is not set:
- close player's inventory
- send "&7You cannot buy that, it is found in the Bonus Box only."
- else:
- $ thread
- set {_coins} to getCoins(sender)
- if "%{_coins}%" = "<none>":
- set {_coins} to 0
- if {_coins} is less than {_price}:
- close player's inventory
- send "&7You do not have sufficient funds to purchase &7the %name of clicked item%&7 skin."
- else:
- close player's inventory
- send "&7You have purchased &7the %name of clicked item%&7 skin."
- $ thread
- set sql var "skins::pacmine::%{_skin}%::%player%" to "true"
- $ thread
- set {playerSkins::%player%::%{_skin}%} to true
- $ thread
- remCoins(sender, {_price})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement