options: cena: 0 function giveArmor(p: player, i: item): if balance of {_p} > ("{@cena}" parsed as number): remove ("{@cena}" parsed as number) from balance of {_p} give {_i} to {_p} else: send "Nie posiadasz wystarczajacej kwoty aby zakupic ta zbroje." to {_p} function getDec(p: player) :: text: set {_color} to convert rgb {pyraArmor::%{_p}%::r}, {pyraArmor::%{_p}%::g}, {pyraArmor::%{_p}%::b} to hex set {_color} to convert hexa {_color} to bin set {_color} to convert bin {_color} to decimal return {_color} function updateArmor(p: player): add 7, 16, 25 and 34 to {_slots::*} add leather helmet, leather chestplate, leather leggings and leather boots to {_items::*} loop {_items::*}: set {_item} to {_items::%loop-index%} with custom nbt tag "{display:{color:%getDec({_p})%}}" format gui slot {_slots::*} of {_p} with {_item} with lore "&cCena: &4&l{@cena}" to run function giveArmor({_p}, ({_item})) delete {_slots::%loop-index%} format gui slot 3 of {_p} with red glass named "&c&l%{pyraArmor::%{_p}%::r}%" format gui slot 12 of {_p} with light green glass named "&a&l%{pyraArmor::%{_p}%::g}%" format gui slot 21 of {_p} with cyan glass named "&3&l%{pyraArmor::%{_p}%::b}%" function addColor(p: player, r: integer, g: integer, b: integer, type: text): add "r", "g" and "b" to {_rgb::*} loop {_rgb::*}: set {undo::%{_p}%::%loop-value%} to {pyraArmor::%{_p}%::%loop-value%} if {_type} is "add": loop {_rgb::*}: add {_%loop-value%} to {pyraArmor::%{_p}%::%loop-value%} if {pyraArmor::%{_p}%::%loop-value%} > 255: remove 255 from {pyraArmor::%{_p}%::%loop-value%} else if {pyraArmor::%{_p}%::%loop-value%} < 0: add 255 to {pyraArmor::%{_p}%::%loop-value%} if {_type} is "set": loop {_rgb::*}: set {pyraArmor::%{_p}%::%loop-value%} to {_%loop-value%} updateArmor({_p}) function undoColor(p: player): add "r", "g" and "b" to {_rgb::*} loop {_rgb::*}: set {pyraArmor::%{_p}%::%loop-value%} to {undo::%{_p}%::%loop-value%} updateArmor({_p}) on inventory close: delete {pyraArmor::%player%::r} delete {pyraArmor::%player%::g} delete {pyraArmor::%player%::b} command /pyraArmor: permission: pyraArmor.usage aliases: armor trigger: set {pyraArmor::%player%::r}, {pyraArmor::%player%::g} and {pyraArmor::%player%::b} to 0 open virtual chest inventory with 5 rows named "" to player loop 45 times: format gui slot ((loop-value)-1) of player with gray glass named "&fpyraArmor" add "35:14", "35:4", "35:5", "35:3", "35:1", "35:10", "35:0", "35:7" and "35:15" to {_colors::*} add "255 0 0", "255 220 0", "100 255 0", "90 200 230", "255 140 0", "173 76 255", "255 255 255", "100 100 100" and "0 0 0" to {_rgb::*} loop 9 times: set {_type::*} to {_rgb::%loop-number%} split at " " format gui slot (35+(loop-number)) of player with ("%{_colors::%loop-number%}%" parsed as item) to run function addColor(player, ({_type::1} parsed as integer), ({_type::2} parsed as integer), ({_type::3} parsed as integer), ("set")) format gui slot 30 of player with 1 of barrier named "&fUndo" to run function undoColor(player) updateArmor(player) format gui slot 4 of player with snowball named "&c+1" to run function addColor(player, 1, 0, 0, ("add")) format gui slot 13 of player with snowball named "&a+1" to run function addColor(player, 0, 1, 0, ("add")) format gui slot 22 of player with snowball named "&3+1" to run function addColor(player, 0, 0, 1, ("add")) format gui slot 2 of player with snowball named "&c-1" to run function addColor(player, (-1), 0, 0, ("add")) format gui slot 11 of player with snowball named "&a-1" to run function addColor(player, 0, (-1), 0, ("add")) format gui slot 20 of player with snowball named "&3-1" to run function addColor(player, 0, 0, (-1), ("add")) format gui slot 5 of player with slimeball named "&c+10" to run function addColor(player, 10, 0, 0, ("add")) format gui slot 14 of player with slimeball named "&a+10" to run function addColor(player, 0, 10, 0, ("add")) format gui slot 23 of player with slimeball named "&3+10" to run function addColor(player, 0, 0, 10, ("add")) format gui slot 1 of player with slimeball named "&c-10" to run function addColor(player, (-10), 0, 0, ("add")) format gui slot 10 of player with slimeball named "&a-10" to run function addColor(player, 0, (-10), 0, ("add")) format gui slot 19 of player with slimeball named "&3-10" to run function addColor(player, 0, 0, (-10), ("add")) #Created by LuckyPotato v1.0 (17.11.2018 23:25)