Files
ulepsz.sk
Code
1 560
ulepsz.sk
# UlepszSet - system ulepszania setów dla Skript
# Wymaga: Skript 2.7+, SkBee oraz Vault z pluginem ekonomii.
# Instalacja: plugins/Skript/scripts/ulepsz.sk
# Przeładuj: /sk reload ulepsz
options:
prefix: &8[&6UlepszSet&8]&r
sets-title: &8UlepszSet &7• &fWybierz set
upgrade-title: &8UlepszSet &7• &f%{_set}%
confirm-title: &8UlepszSet &7• &fPotwierdzenie
admin-title: &8UlepszSet &7• &cPanel administratora
admin-set-title: &8UlepszSet &7• &cKonfiguracja &f%{_set}%
on load:
if {ulepsz.enabled} is not set:
set {ulepsz.enabled} to true
if {ulepsz.initialized} is not set:
set {ulepsz.sets::*} to "wojownik", "rycerz"
set {ulepsz.set.name::wojownik} to "&cWojownik"
set {ulepsz.set.max::wojownik} to 3
set {ulepsz.item::wojownik::1::helmet.material} to "iron helmet"
set {ulepsz.item::wojownik::1::helmet.name} to "&cHełm Wojownika I"
set {ulepsz.item::wojownik::1::helmet.lore::*} to "&7Podstawowy element seta Wojownika"
set {ulepsz.item::wojownik::1::chestplate.material} to "iron chestplate"
set {ulepsz.item::wojownik::1::chestplate.name} to "&cNapierśnik Wojownika I"
set {ulepsz.item::wojownik::1::chestplate.lore::*} to "&7Podstawowy element seta Wojownika"
set {ulepsz.item::wojownik::1::leggings.material} to "iron leggings"
set {ulepsz.item::wojownik::1::leggings.name} to "&cSpodnie Wojownika I"
set {ulepsz.item::wojownik::1::leggings.lore::*} to "&7Podstawowy element seta Wojownika"
set {ulepsz.item::wojownik::1::boots.material} to "iron boots"
set {ulepsz.item::wojownik::1::boots.name} to "&cButy Wojownika I"
set {ulepsz.item::wojownik::1::boots.lore::*} to "&7Podstawowy element seta Wojownika"
set {ulepsz.item::wojownik::2::helmet.material} to "diamond helmet"
set {ulepsz.item::wojownik::2::helmet.name} to "&cHełm Wojownika II"
set {ulepsz.item::wojownik::2::helmet.lore::*} to "&7Ulepszony element seta Wojownika"
set {ulepsz.cost::wojownik::2::helmet} to 300
set {ulepsz.item::wojownik::2::chestplate.material} to "diamond chestplate"
set {ulepsz.item::wojownik::2::chestplate.name} to "&cNapierśnik Wojownika II"
set {ulepsz.item::wojownik::2::chestplate.lore::*} to "&7Ulepszony element seta Wojownika"
set {ulepsz.cost::wojownik::2::chestplate} to 500
set {ulepsz.item::wojownik::2::leggings.material} to "diamond leggings"
set {ulepsz.item::wojownik::2::leggings.name} to "&cSpodnie Wojownika II"
set {ulepsz.item::wojownik::2::leggings.lore::*} to "&7Ulepszony element seta Wojownika"
set {ulepsz.cost::wojownik::2::leggings} to 400
set {ulepsz.item::wojownik::2::boots.material} to "diamond boots"
set {ulepsz.item::wojownik::2::boots.name} to "&cButy Wojownika II"
set {ulepsz.item::wojownik::2::boots.lore::*} to "&7Ulepszony element seta Wojownika"
set {ulepsz.cost::wojownik::2::boots} to 300
set {ulepsz.item::wojownik::3::helmet.material} to "netherite helmet"
set {ulepsz.item::wojownik::3::helmet.name} to "&4Hełm Wojownika III"
set {ulepsz.item::wojownik::3::helmet.lore::*} to "&7Najwyższy poziom seta Wojownika"
set {ulepsz.cost::wojownik::3::helmet} to 900
set {ulepsz.item::wojownik::3::chestplate.material} to "netherite chestplate"
set {ulepsz.item::wojownik::3::chestplate.name} to "&4Napierśnik Wojownika III"
set {ulepsz.item::wojownik::3::chestplate.lore::*} to "&7Najwyższy poziom seta Wojownika"
set {ulepsz.cost::wojownik::3::chestplate} to 1500
set {ulepsz.item::wojownik::3::leggings.material} to "netherite leggings"
set {ulepsz.item::wojownik::3::leggings.name} to "&4Spodnie Wojownika III"
set {ulepsz.item::wojownik::3::leggings.lore::*} to "&7Najwyższy poziom seta Wojownika"
set {ulepsz.cost::wojownik::3::leggings} to 1200
set {ulepsz.item::wojownik::3::boots.material} to "netherite boots"
set {ulepsz.item::wojownik::3::boots.name} to "&4Buty Wojownika III"
set {ulepsz.item::wojownik::3::boots.lore::*} to "&7Najwyższy poziom seta Wojownika"
set {ulepsz.cost::wojownik::3::boots} to 900
set {ulepsz.set.name::rycerz} to "&bRycerz"
set {ulepsz.set.max::rycerz} to 2
set {ulepsz.item::rycerz::1::helmet.material} to "golden helmet"
set {ulepsz.item::rycerz::1::helmet.name} to "&bHełm Rycerza I"
set {ulepsz.item::rycerz::1::helmet.lore::*} to "&7Podstawowy element seta Rycerza"
set {ulepsz.item::rycerz::1::chestplate.material} to "golden chestplate"
set {ulepsz.item::rycerz::1::chestplate.name} to "&bNapierśnik Rycerza I"
set {ulepsz.item::rycerz::1::chestplate.lore::*} to "&7Podstawowy element seta Rycerza"
set {ulepsz.item::rycerz::1::leggings.material} to "golden leggings"
set {ulepsz.item::rycerz::1::leggings.name} to "&bSpodnie Rycerza I"
set {ulepsz.item::rycerz::1::leggings.lore::*} to "&7Podstawowy element seta Rycerza"
set {ulepsz.item::rycerz::1::boots.material} to "golden boots"
set {ulepsz.item::rycerz::1::boots.name} to "&bButy Rycerza I"
set {ulepsz.item::rycerz::1::boots.lore::*} to "&7Podstawowy element seta Rycerza"
set {ulepsz.item::rycerz::2::helmet.material} to "diamond helmet"
set {ulepsz.item::rycerz::2::helmet.name} to "&bHełm Rycerza II"
set {ulepsz.item::rycerz::2::helmet.lore::*} to "&7Ulepszony element seta Rycerza"
set {ulepsz.cost::rycerz::2::helmet} to 450
set {ulepsz.item::rycerz::2::chestplate.material} to "diamond chestplate"
set {ulepsz.item::rycerz::2::chestplate.name} to "&bNapierśnik Rycerza II"
set {ulepsz.item::rycerz::2::chestplate.lore::*} to "&7Ulepszony element seta Rycerza"
set {ulepsz.cost::rycerz::2::chestplate} to 700
set {ulepsz.item::rycerz::2::leggings.material} to "diamond leggings"
set {ulepsz.item::rycerz::2::leggings.name} to "&bSpodnie Rycerza II"
set {ulepsz.item::rycerz::2::leggings.lore::*} to "&7Ulepszony element seta Rycerza"
set {ulepsz.cost::rycerz::2::leggings} to 600
set {ulepsz.item::rycerz::2::boots.material} to "diamond boots"
set {ulepsz.item::rycerz::2::boots.name} to "&bButy Rycerza II"
set {ulepsz.item::rycerz::2::boots.lore::*} to "&7Ulepszony element seta Rycerza"
set {ulepsz.cost::rycerz::2::boots} to 450
set {ulepsz.initialized} to true
if plugin "Vault" is not enabled:
send "&c[UlepszSet] Vault nie jest aktywny. Ulepszenia z ceną będą zablokowane." to console
else:
send "&a[UlepszSet] System załadowany. Pamiętaj o aktywnym pluginie ekonomii." to console
function makeUlepszItem(set: text, level: number, piece: text) :: item:
set {_material} to {ulepsz.item::%{_set}%::%{_level}%::%{_piece}%.material}
set {_item} to {_material} parsed as item type
set {_name} to {ulepsz.item::%{_set}%::%{_level}%::%{_piece}%.name}
set name of {_item} to colored {_name}
set {_lore::*} to {ulepsz.item::%{_set}%::%{_level}%::%{_piece}%.lore::*}
if {_lore::*} is not set:
set {_lore::*} to "&7Element seta %{_set}% - poziom %{_level}%"
delete {_colored-lore::*}
loop {_lore::*}:
add colored loop-value to {_colored-lore::*}
set lore of {_item} to {_colored-lore::*}
set string tag "ulepsz:set_id" of custom nbt of {_item} to {_set}
set integer tag "ulepsz:set_level" of custom nbt of {_item} to {_level}
set string tag "ulepsz:armor_piece" of custom nbt of {_item} to {_piece}
return {_item}
function ulepszItemMatches(item: item, expectedSet: text, expectedLevel: number, expectedPiece: text) :: boolean:
if {_item} is not set:
return false
if {_item} is air:
return false
set {_found-set} to string tag "ulepsz:set_id" of custom nbt of {_item}
set {_found-level} to integer tag "ulepsz:set_level" of custom nbt of {_item}
set {_found-piece} to string tag "ulepsz:armor_piece" of custom nbt of {_item}
if {_found-set} is not {_expectedSet}:
return false
if {_found-level} is not {_expectedLevel}:
return false
if {_found-piece} is not {_expectedPiece}:
return false
return true
function getUlepszCurrentLevel(p: player, set: text, piece: text) :: number:
set {_current} to 0
set {_max} to {ulepsz.set.max::%{_set}%}
loop integers between 1 and {_max}:
loop integers between 0 and 40:
set {_candidate} to slot loop-value-2 of {_p}'s inventory
if ulepszItemMatches({_candidate}, {_set}, loop-value-1, {_piece}) is true:
set {_current} to loop-value-1
return {_current}
function getPieceName(piece: text) :: text:
if {_piece} is "helmet":
return "Hełm"
if {_piece} is "chestplate":
return "Napierśnik"
if {_piece} is "leggings":
return "Spodnie"
return "Buty"
function openSetMenu(p: player):
set {_inv} to chest inventory with 3 rows named colored "{@sets-title}"
set {_filler} to gray stained glass pane named " "
loop integers between 0 and 26:
set slot loop-value of {_inv} to {_filler}
delete {ulepsz.menu.set.%uuid of {_p}%::*}
loop {ulepsz.sets::*}:
if loop-index <= 9:
set {_slot} to 9 + loop-index
set {_set-name} to {ulepsz.set.name::%loop-value%}
set {_icon} to chest named colored "%{_set-name}%"
set {_lore::*} to colored "&7Kliknij, aby zobaczyć ulepszenia"
add colored "&7Maksymalny poziom: &e%{ulepsz.set.max::%loop-value%}%" to {_lore::*}
set lore of {_icon} to {_lore::*}
set slot {_slot} of {_inv} to {_icon}