Files
playstyle_smp.sk
Code
1 960
playstyle_smp.sk
# Playstyle SMP
# Place in plugins/Skript/scripts/ and run: /sk reload playstyle_smp
options:
menu-title: &8Playstyle Menu
info-title: &8Playstyle Guide
prefix: &5Playstyle &8»&r
grace-minutes: 30
function ps_core(style: text) :: item:
set {_item} to echo shard named "&b%{_style}% Core"
if {_style} is "aggro":
set custom model data of {_item} to 11001
else if {_style} is "quickdropper":
set custom model data of {_item} to 11002
else if {_style} is "drain":
set custom model data of {_item} to 11003
else if {_style} is "passive":
set custom model data of {_item} to 11004
else if {_style} is "strategic":
set custom model data of {_item} to 11005
else if {_style} is "tank":
set custom model data of {_item} to 11006
else if {_style} is "coward":
set custom model data of {_item} to 11007
else if {_style} is "annoying":
set custom model data of {_item} to 11008
else if {_style} is "dragon warrior":
set custom model data of {_item} to 11009
return {_item}
function ps_trial_key(style: text) :: item:
set {_item} to tripwire hook named "&d%{_style}% Trial Key"
if {_style} is "aggro":
set custom model data of {_item} to 12001
else if {_style} is "quickdropper":
set custom model data of {_item} to 12002
else if {_style} is "drain":
set custom model data of {_item} to 12003
else if {_style} is "passive":
set custom model data of {_item} to 12004
else if {_style} is "strategic":
set custom model data of {_item} to 12005
else if {_style} is "tank":
set custom model data of {_item} to 12006
else if {_style} is "coward":
set custom model data of {_item} to 12007
else if {_style} is "annoying":
set custom model data of {_item} to 12008
else if {_style} is "dragon warrior":
set custom model data of {_item} to 12009
return {_item}
function ps_style_from_core(i: item) :: text:
set {_model} to custom model data of {_i}
if {_model} is 11001:
return "aggro"
if {_model} is 11002:
return "quickdropper"
if {_model} is 11003:
return "drain"
if {_model} is 11004:
return "passive"
if {_model} is 11005:
return "strategic"
if {_model} is 11006:
return "tank"
if {_model} is 11007:
return "coward"
if {_model} is 11008:
return "annoying"
if {_model} is 11009:
return "dragon warrior"
return ""
function ps_style_from_key(i: item) :: text:
set {_model} to custom model data of {_i}
if {_model} is 12001:
return "aggro"
if {_model} is 12002:
return "quickdropper"
if {_model} is 12003:
return "drain"
if {_model} is 12004:
return "passive"
if {_model} is 12005:
return "strategic"
if {_model} is 12006:
return "tank"
if {_model} is 12007:
return "coward"
if {_model} is 12008:
return "annoying"
if {_model} is 12009:
return "dragon warrior"
return ""
function ps_valid_style(style: text) :: boolean:
if {_style} is "aggro":
return true
if {_style} is "quickdropper":
return true
if {_style} is "drain":
return true
if {_style} is "passive":
return true
if {_style} is "strategic":
return true
if {_style} is "tank":
return true
if {_style} is "coward":
return true
if {_style} is "annoying":
return true
if {_style} is "dragon warrior":
return true
return false
function ps_style_name(style: text) :: text:
if {_style} is "dragon warrior":
return "Dragon Warrior"
set {_name} to {_style}
replace all "quickdropper" in {_name} with "Quickdropper"
replace all "aggro" in {_name} with "Aggro"
replace all "drain" in {_name} with "Drain"
replace all "passive" in {_name} with "Passive"
replace all "strategic" in {_name} with "Strategic"
replace all "tank" in {_name} with "Tank"
replace all "coward" in {_name} with "Coward"
replace all "annoying" in {_name} with "Annoying"
return {_name}
function ps_trusted(p: player, target: player) :: boolean:
if {_p} is {_target}:
return true
if {ps::trust::%uuid of {_p}%::%uuid of {_target}%} is set:
return true
return false
function ps_has(p: player, style: text) :: boolean:
if {ps::style::%uuid of {_p}%::1} is {_style}:
return true
if {ps::style::%uuid of {_p}%::2} is {_style}:
return true
return false
function ps_add_style(p: player, style: text) :: boolean:
if ps_has({_p}, {_style}) is true:
return false
if {ps::style::%uuid of {_p}%::1} is not set:
set {ps::style::%uuid of {_p}%::1} to {_style}
return true
if {ps::style::%uuid of {_p}%::2} is not set:
set {ps::style::%uuid of {_p}%::2} to {_style}
return true
return false
function ps_remove_style(p: player, style: text) :: boolean:
if {ps::style::%uuid of {_p}%::1} is {_style}:
delete {ps::style::%uuid of {_p}%::1}
set {ps::style::%uuid of {_p}%::1} to {ps::style::%uuid of {_p}%::2}
delete {ps::style::%uuid of {_p}%::2}
return true
if {ps::style::%uuid of {_p}%::2} is {_style}:
delete {ps::style::%uuid of {_p}%::2}
return true
return false
function ps_random_style() :: text:
set {_styles::*} to "aggro", "quickdropper", "drain", "passive", "strategic", "tank", "coward", "annoying", "dragon warrior"
return random element out of {_styles::*}
function ps_reroll(p: player):
delete {ps::style::%uuid of {_p}%::*}
set {_style} to ps_random_style()
set {ps::style::%uuid of {_p}%::1} to {_style}
give ps_core({_style}) to {_p}
send title "&5Playstyle Rerolled" with subtitle "&d%ps_style_name({_style})%" to {_p}
play sound "ui.toast.challenge_complete" to {_p}
play sound "entity.player.levelup" to {_p}
send "{@prefix}&dYou received the &f%ps_style_name({_style})% &dplaystyle." to {_p}
function ps_assign_random(p: player):
ps_reroll({_p})
set {_p}'s food level to 20
give 10 cooked beef to {_p}
send title "&5Playstyle SMP has started!" with subtitle "&dYour playstyle has been selected." to {_p}
function ps_open_menu(p: player):
set {_inv} to chest inventory with 1 row named "{@menu-title}"
set {_empty} to gray stained glass pane named "&7Empty Slot"
loop 9 times:
set slot (loop-number - 1) of {_inv} to {_empty}
if {ps::style::%uuid of {_p}%::1} is set:
set slot 1 of {_inv} to ps_core({ps::style::%uuid of {_p}%::1})
else:
set slot 1 of {_inv} to lime stained glass pane named "&aHotkey first core here"
if {ps::style::%uuid of {_p}%::2} is set:
set slot 7 of {_inv} to ps_core({ps::style::%uuid of {_p}%::2})
else: