Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.
on script load:
load "plugins\TuSKe\enchantments.yml" as "TuSKe_Enchantments"
function replace(s: string) :: string:
replace all "ยง" in {_s} with "&"
return {_s}
function allCapitalize(s: string) :: string:
replace all "a" in {_s} with "A"
replace all "b" in {_s} with "B"
replace all "c" in {_s} with "C"
replace all "d" in {_s} with "D"
replace all "e" in {_s} with "E"
replace all "f" in {_s} with "F"
replace all "g" in {_s} with "G"
replace all "h" in {_s} with "H"
replace all "i" in {_s} with "I"
replace all "j" in {_s} with "J"
replace all "k" in {_s} with "K"
replace all "l" in {_s} with "L"
replace all "m" in {_s} with "M"
replace all "n" in {_s} with "N"
replace all "o" in {_s} with "O"
replace all "p" in {_s} with "P"
replace all "q" in {_s} with "Q"
replace all "r" in {_s} with "R"
replace all "s" in {_s} with "S"
replace all "t" in {_s} with "T"
replace all "u" in {_s} with "U"
replace all "v" in {_s} with "V"
replace all "w" in {_s} with "W"
replace all "x" in {_s} with "X"
replace all "y" in {_s} with "Y"
replace all "z" in {_s} with "Z"
return {_s}
command /ench [<text>] [<text>] [<text>] [<text>]:
trigger:
if arg 1 is not set:
message "&f&m----------------"
message "&f/&aench make <enchantment>"
message "&f/&aench edit <enchantment> <description/maxlevel/rarity/accepteditems/enabled> <text/integer/boolean>"
message "&f/&aench info <enchantment>"
message "&f&m----------------"
else if arg 1 is "make":
if arg 2 is not set:
message "&cError &fEnchantment name is not &aset&f."
else if arg 2 is set:
set yaml value "Enchantments.%arg 2%.Name" from "TuSKe_Enchantments" to "&7%arg 2%"
save yaml "TuSKe_Enchantments"
message "&fEnchantment &a%arg 2% &fis created."
else if arg 1 is "edit":
if arg 2 is not set:
message "&cError &fEnchantment name is not &aset&f. (must be in &aTuSKe\enchantments.yml&f first.)"
else if arg 2 is set:
set {_enchantment} to yaml value "Enchantments.%arg 2%.Name" from "TuSKe_Enchantments"
if {_enchantment} is not set:
message "&cError &fthe enchantment name &a%arg 2%&f is not set inside &aTuSKe\enchantments.yml&f yet."
else if {_enchantment} is not "<none>":
if arg 3 is not set:
message "&fPlease put in ""&adescription, maxlevel, rarity, accepteditems, &for &aenabled&f"" to edit this enchantment."
else if arg 3 is "description":
if arg 4 is not set:
message "&cError &aDescription &fis not set."
else if arg 4 is set:
set yaml value "Enchantments.%arg 2%.Description" from "TuSKe_Enchantments" to "%arg 4%"
save yaml "TuSKe_Enchantments"
message "&fEnchantment &a%arg 2%'s description &fhas been set to &a%arg 4%&f."
else if arg 3 is "maxlevel":
if arg 4 is not set:
message "&cError &aMaxLevel &fis not set."
else if arg 4 is set:
set {_arg4} to "%arg 4%" parsed as a integer
if {_arg4} is not set:
message "&cError &fthe &aMaxLevel &fmust be a &ainteger&f."
else if {_arg4} is a integer:
if {_arg4} is less than 1:
message "&cError &fthe &aMaxLevel &fmust be higher than &a0&f."
if {_arg4} is higher than 0:
set yaml value "Enchantments.%arg 2%.MaxLevel" from "TuSKe_Enchantments" to "%arg 4%"
save yaml "TuSKe_Enchantments"
message "&fEnchantment &a%arg 2%'s max level &fhas been set to &a%arg 4%&f."
else if arg 3 is "rarity":
if arg 4 is not set:
message "&cError &aRarity &fis not set."
else if arg 4 is set:
set {_arg4} to "%arg 4%" parsed as a integer
broadcast "%{_arg4}%"
if {_arg4} is not set:
message "&cError &fthe &aRarity &fmust be a &ainteger&f."
else if {_arg4} is set:
if {_arg4} is less than 1:
message "&cError &fthe &aMaxLevel &fmust be higher than &a1&f."
if {_arg4} is more than 5:
message "&cError &fthe &aMaxLevel &fmust be lower than &a5&f."
if {_arg4} is between 1 and 5:
set yaml value "Enchantments.%arg 2%.Rarity" from "TuSKe_Enchantments" to "%arg 4%"
save yaml "TuSKe_Enchantments"
message "&fEnchantment &a%arg 2%'s rarity &fhas been set to &a%arg 4%&f."
else if arg 3 is "accepteditems":
if arg 4 is not set:
message "&cError &aAcceptedItems &fis not set."
else if arg 4 is not "boots" or "leggings" or "chestplates" or "helmets" or "swords" or "bow" or "fishingrod" or "pickaxes" or "axes" or "shovels" or "tools" or "armor" or "all":
message "&cError &fyour accepted items can only be ""&aboots, leggings, chestplates, helmets, swords, bow, fishingrod, pickaxes, axes, shovels, tools, armor, &for &aall&f""."
else if arg 4 is "boots" or "leggings" or "chestplates" or "helmets" or "swords" or "bow" or "fishingrod" or "pickaxes" or "axes" or "shovels" or "tools" or "armor" or "all":
set yaml value "Enchantments.%arg 2%.AcceptedItems" from "TuSKe_Enchantments" to "%allCapitalize(arg 4)%"
save yaml "TuSKe_Enchantments"
message "&fEnchantment &a%arg 2%'s accepted items &fhas been set to &a%allCapitalize(arg 4)%&f."
else if arg 3 is "enabled":
set {_arg4} to arg 4 parsed as a boolean
if {_arg4} is not set:
message "&cError &fonly &abooleans &fare &aaccepted&f."
else if {_arg4} is true:
set yaml value "Enchantments.%arg 2%.Enabled" from "TuSKe_Enchantments" to {_arg4}
save yaml "TuSKe_Enchantments"
message "&fEnchantment &a%arg 2% &fhas been &aenabled&f."
else if {_arg4} is false:
set yaml value "Enchantments.%arg 2%.Enabled" from "TuSKe_Enchantments" to {_arg4}
save yaml "TuSKe_Enchantments"
message "&fEnchantment &a%arg 2% &fhas been &adisabled&f."
else if arg 1 is "info":
if arg 2 is not set:
message "&cError &fEnchantment name is not &aset&f."
else if arg 2 is set:
set {_name} to yaml value "Enchantments.%arg 2%.Name" from "TuSKe_Enchantments"
set {_name} to replace({_name})
set {_description} to yaml value "Enchantments.%arg 2%.Description" from "TuSKe_Enchantments"
set {_maxlevel} to yaml value "Enchantments.%arg 2%.MaxLevel" from "TuSKe_Enchantments"
set {_rarity} to yaml value "Enchantments.%arg 2%.Rarity" from "TuSKe_Enchantments"
set {_accepteditems} to yaml value "Enchantments.%arg 2%.AcceptedItems" from "TuSKe_Enchantments"
set {_enabled} to yaml value "Enchantments.%arg 2%.Enabled" from "TuSKe_Enchantments"
if {_name} is not set:
message "&cError, &fEnchantment &a%arg 2% &fdoes not exist inside the &aTuSKe enchantment config&f."
else if {_name} is set:
message ""
message "&fName: &a%{_name}%"
message "&fDescription: &a%{_description}%"
message "&fMax Level: &a%{_maxlevel}%"
message "&fRarity: &a%{_rarity}%"
message "&fAccepted Items: &a%{_accepteditems}%"
message "&fEnabled: &a%{_enabled}%"
message ""
on script unload:
unload yaml "TuSKe_Enchantments"