Files
EmblemSystem.sk
Code
1 306
EmblemSystem.sk
#
# System Emblematów v1.0
#
# Funkcje:
# - Emblematy Siły, Szybkości, Odporności (start 100%, max 200%)
# - Wyświetlanie statystyk na action barze
# - Utrata 10% przy śmierci + drop (niebieskie szkło)
# - Drop z losowymi przedmiotami (konfigurowalny przez admina)
# - Artefakt Siły w offhandzie (Siła II)
# - System dodatkowych serc (max 30)
# - Specjalna zbroja dająca bonusowe serca
# - Kilof 3x3
#
options:
prefix: "&8[&bEmblematy&8]&r"
max_percent: 200
max_hearts: 30
# ==================== INICJALIZACJA ====================
on script load:
broadcast "{@prefix} &aSystem Emblematów załadowany!"
if {drop_items_initialized} is not set:
set {drop_items_initialized} to true
add 1 of diamond pickaxe named "&bKilof Górnika" with lore "&7Wydajność VII", "&7Niezniszczalność V" enchanted with efficiency 7 and unbreaking 5 to {drop_items::*}
add 1 of diamond sword named "&bMiecz Mocy" with lore "&7Ostrość VI" enchanted with sharpness 6 to {drop_items::*}
add 1 of blaze rod named "&cArtefakt Siły" with lore "&7Trzymaj w offhandzie", "&7aby otrzymać Siłę II" to {drop_items::*}
add 1 of diamond pickaxe named "&bKilof Szeroki" with lore "&7Kopie 3x3", "&7Wydajność V", "&7Niezniszczalność III" enchanted with efficiency 5 and unbreaking 3 to {drop_items::*}
add 1 of diamond leggings named "&bSpodnie Ochrony" with lore "&7Ochrona IV", "&7Niezniszczalność III", "&7Po założeniu dają +2 serca" enchanted with protection 4 and unbreaking 3 to {drop_items::*}
add 1 of diamond helmet named "&bHełm Ochrony" with lore "&7Ochrona IV", "&7Niezniszczalność III", "&7Po założeniu daje +2 serca" enchanted with protection 4 and unbreaking 3 to {drop_items::*}
add 1 of blaze powder named "&cEmblemat Siły" with lore "&7Kliknij PPM aby użyć", "&7+10% do Siły (max 200%)" to {drop_items::*}
add 1 of sugar named "&bEmblemat Szybkości" with lore "&7Kliknij PPM aby użyć", "&7+10% do Szybkości (max 200%)" to {drop_items::*}
add 1 of iron ingot named "&aEmblemat Odporności" with lore "&7Kliknij PPM aby użyć", "&7+10% do Odporności (max 200%)" to {drop_items::*}
add 1 of nether star named "&6Insygnia Odrodzenia" with lore "&7Kliknij PPM aby użyć", "&7Przywraca wszystkie statystyki do 100%" to {drop_items::*}
add 1 of red dye named "&cDodatkowe Serce" with lore "&7Kliknij PPM aby użyć", "&7Dodaje +1 serce na stałe (max 30)" to {drop_items::*}
add 1 of gold nugget named "&6Złote Serce" with lore "&7Kliknij PPM aby użyć", "&7Dodaje +2 serca na stałe (max 30)" to {drop_items::*}
# ==================== GRACZ DOŁĄCZA ====================
on player join:
if {emblems::%player%::strength} is not set:
set {emblems::%player%::strength} to 100
if {emblems::%player%::speed} is not set:
set {emblems::%player%::speed} to 100
if {emblems::%player%::resistance} is not set:
set {emblems::%player%::resistance} to 100
if {emblems::%player%::extra_hearts} is not set:
set {emblems::%player%::extra_hearts} to 0
wait 1 tick
updatePlayerHealth(player)
# ==================== WYŚWIETLANIE STATYSTYK ====================
every 5 seconds:
loop all players:
if loop-player is online:
set {_s} to {emblems::%loop-player%::strength}
set {_sp} to {emblems::%loop-player%::speed}
set {_r} to {emblems::%loop-player%::resistance}
set {_h} to {emblems::%loop-player%::extra_hearts}
send action bar formatActionBar(loop-player, {_s}, {_sp}, {_r}, {_h}) to loop-player
applyPlayerEffects(loop-player)
checkArtifactOffhand(loop-player)
updatePlayerHealth(loop-player)
function formatActionBar(p: player, strength: integer, speed: integer, resistance: integer, hearts: integer) :: text:
set {_armorHearts} to getArmorHearts({_p})
set {_totalHearts} to 10 + {_hearts} + {_armorHearts}
if {_totalHearts} > {@max_hearts}:
set {_totalHearts} to {@max_hearts}
return "&c⚔ Siła: &f%{_strength}%%% &7| &b💨 Szybkość: &f%{_speed}%%% &7| &a🛡 Odporność: &f%{_resistance}%%% &7| &c❤ Serca: &f%{_totalHearts%}/%{@max_hearts%}"
function applyPlayerEffects(p: player):
set {_s} to {emblems::%{_p}%::strength}
set {_sp} to {emblems::%{_p}%::speed}
set {_r} to {emblems::%{_p}%::resistance}
set {_strLevel} to floor({_s} / 20)
set {_spdLevel} to floor({_sp} / 20)
set {_resLevel} to floor({_r} / 20)
if {_strLevel} > 0:
apply strength {_strLevel} to {_p} for 10 seconds
if {_spdLevel} > 0:
apply speed {_spdLevel} to {_p} for 10 seconds
if {_resLevel} > 0:
apply resistance {_resLevel} to {_p} for 10 seconds
function checkArtifactOffhand(p: player):
set {_item} to off hand of {_p}
if {_item} is blaze rod named "&cArtefakt Siły":
apply strength 2 to {_p} for 10 seconds
function getArmorHearts(p: player) :: integer:
set {_bonus} to 0
set {_helm} to helmet of {_p}
set {_legs} to leggings of {_p}
if {_helm} is diamond helmet named "&bHełm Ochrony":
add 2 to {_bonus}
if {_legs} is diamond leggings named "&bSpodnie Ochrony":
add 2 to {_bonus}
return {_bonus}
function updatePlayerHealth(p: player):
set {_itemHearts} to {emblems::%{_p}%::extra_hearts}
set {_armorHearts} to getArmorHearts({_p})
set {_totalExtra} to {_itemHearts} + {_armorHearts}
set {_maxExtra} to {@max_hearts} - 10
if {_totalExtra} > {_maxExtra}:
set {_totalExtra} to {_maxExtra}
set max health of {_p} to 20 + ({_totalExtra} * 2)
# ==================== ŚMIERĆ GRACZA ====================
on death of player:
set {_s} to {emblems::%player%::strength}
set {_sp} to {emblems::%player%::speed}
set {_r} to {emblems::%player%::resistance}
if {_s} >= 10:
subtract 10 from {emblems::%player%::strength}
else:
set {emblems::%player%::strength} to 0
if {_sp} >= 10:
subtract 10 from {emblems::%player%::speed}
else:
set {emblems::%player%::speed} to 0
if {_r} >= 10:
subtract 10 from {emblems::%player%::resistance}
else:
set {emblems::%player%::resistance} to 0
set {_drop} to blue stained glass pane named "&9Emblematyczny Drop" with lore "&7Kliknij PPM aby otworzyć!", "&7Zawiera losową nagrodę!"
add 1 of {_drop} to drops of player
send "{@prefix} &cStraciłeś 10% każdego emblematu!" to player
send "{@prefix} &9Otrzymałeś Emblematyczny Drop! Kliknij PPM aby otworzyć." to player
# ==================== UŻYWANIE PRZEDMIOTÓW (PPM) ====================
on right click:
set {_item} to player's tool
if {_item} is blue stained glass pane named "&9Emblematyczny Drop":
cancel event
remove 1 of blue stained glass pane named "&9Emblematyczny Drop" from player's inventory
giveRandomDropItem(player)
send "{@prefix} &aOtworzyłeś drop i otrzymałeś nagrodę!" to player
stop
if {_item} is blaze powder named "&cEmblemat Siły":
cancel event
set {_current} to {emblems::%player%::strength}
if {_current} >= {@max_percent}:
send "{@prefix} &cMasz już maksymalną Siłę (%{@max_percent}%%%)!" to player
stop
set {_new} to {_current} + 10
if {_new} > {@max_percent}:
set {_new} to {@max_percent}
set {emblems::%player%::strength} to {_new}
remove 1 of blaze powder named "&cEmblemat Siły" from player's inventory
send "{@prefix} &aZwiększono Siłę do &f%{_new}%%%&a!" to player
stop
if {_item} is sugar named "&bEmblemat Szybkości":
cancel event
set {_current} to {emblems::%player%::speed}
if {_current} >= {@max_percent}:
send "{@prefix} &cMasz już maksymalną Szybkość (%{@max_percent}%%%)!" to player
stop
set {_new} to {_current} + 10
if {_new} > {@max_percent}:
set {_new} to {@max_percent}
set {emblems::%player%::speed} to {_new}
remove 1 of sugar named "&bEmblemat Szybkości" from player's inventory
send "{@prefix} &aZwiększono Szybkość do &f%{_new}%%%&a!" to player
stop
if {_item} is iron ingot named "&aEmblemat Odporności":
cancel event
set {_current} to {emblems::%player%::resistance}
if {_current} >= {@max_percent}:
send "{@prefix} &cMasz już maksymalną Odporność (%{@max_percent}%%%)!" to player
stop
set {_new} to {_current} + 10
if {_new} > {@max_percent}:
set {_new} to {@max_percent}
set {emblems::%player%::resistance} to {_new}
remove 1 of iron ingot named "&aEmblemat Odporności" from player's inventory
send "{@prefix} &aZwiększono Odporność do &f%{_new}%%%&a!" to player
stop
if {_item} is nether star named "&6Insygnia Odrodzenia":
cancel event
set {emblems::%player%::strength} to 100
set {emblems::%player%::speed} to 100
set {emblems::%player%::resistance} to 100
remove 1 of nether star named "&6Insygnia Odrodzenia" from player's inventory
send "{@prefix} &6Twoje statystyki zostały przywrócone do 100%!" to player