Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- #SkQuery (bez Lime)
- file: "../../Rozsypanka/config.yml"
- #SkQuery Lime
- #file "plugins/Rozsypanka/config.yml"
- function rozsypanka_getReward(t: text) :: item:
- if "%{_t}%" contains "named":
- set {_item} to subtext of {_t} between index 0 to index of "named" in {_t} - 2
- set {_item} to {_item} parsed as item type
- if {_item} is not item type:
- return air
- if "%{_t}%" contains "with lore":
- set {_name} to subtext of {_t} between index index of "named" in {_t} + 7 to index of "with lore" in {_t} - 3
- set {_lore} to subtext of {_t} between index index of "with lore" in {_t} + 11 to length of {_t} - 1
- return ("%{_item}%" parsed as item) named coloured {_name} with lore coloured {_lore}
- else:
- set {_name} to subtext of {_t} between index index of "named" in {_t} + 7 to length of {_t} - 1
- return ("%{_item}%" parsed as item) named coloured {_name}
- if "%{_t}%" contains "with lore":
- set {_item} to subtext of {_t} between index 0 to index of "with lore" in {_t} - 2
- set {_lore} to subtext of {_t} between index length of "%{_item}%" + 13 to index length of {_t} - 1
- set {_item} to {_item} parsed as item type
- if {_item} is item type:
- return {_item} with lore coloured {_lore}
- return air
- set {_item} to {_t} parsed as item type
- if {_item} is item type:
- return {_item}
- return air
- function rozsypanka_Start(t: text = ""):
- set {_kat::*} to yaml nodes "rozsypanka" from {@file}
- loop {_kat::*}:
- set {_kat::%loop-value%::*} to yaml list "rozsypanka.%loop-value%" from {@file}
- loop 50 times:
- if {_kat} is set:
- exit loop
- loop {_kat::*}:
- chance of 100/size of {_kat::*}%:
- set {_kat} to loop-value-2
- exit loop
- set {_slowo} to random element out of {_kat::%{_kat}%::*}
- set {rozsypanka.slowo} to {_slowo}
- if {_slowo} contains " ":
- loop length of {_slowo} times:
- if subtext of {_slowo} between index loop-number and loop-number is " ":
- add loop-number to {_space::*}
- add length of {_slowo} to {_space::*}
- loop {_space::*}:
- if {_back} is not set:
- add subtext of {_slowo} between index 0 and "%loop-value%" parsed as integer to {_slowa::*}
- else:
- add subtext of {_slowo} between index {_back} and "%loop-value%" parsed as integer to {_slowa::*}
- set {_back} to "%loop-value%" parsed as integer
- loop {_slowa::*}:
- set {_s} to loop-value
- replace all " " in {_s} with ""
- set {_slowa::%loop-index%} to {_s}
- else:
- add {_slowo} to {_slowa::*}
- set {_rozsypanka} to ""
- loop {_slowa::*}:
- loop length of loop-value times:
- add loop-number to {_length::%loop-index%::*}
- loop {_slowa::*}:
- if {_rozsypanka} is not "":
- set {_rozsypanka} to "%{_rozsypanka}% "
- loop size of {_length::%loop-index%::*} times:
- set {_l} to "%random element out of {_length::%loop-index%::*}%" parsed as integer
- set {_rozsypanka} to "%{_rozsypanka}%%subtext of {_slowa::%loop-index%} between index {_l} and {_l}%"
- clear {_length::%loop-index%::%{_l}%}
- #loop length of {_slowo} times:
- # add loop-number to {_length::*}
- #set {_rozsypanka} to ""
- #loop size of {_length::*} times:
- # set {_l} to "%random element out of {_length::*}%" parsed as integer
- # set {_rozsypanka} to "%{_rozsypanka}%%subtext of {_slowo} between index {_l} and {_l}%"
- # clear {_length::%{_l}%}
- broadcast "&c* &7Slowo do odgadniecia: &8[&6%{_kat}%&8] &3%{_rozsypanka}%"
- function rozsypanka_SendList(p: player) :: inventory:
- set {_kat::*} to yaml nodes "rozsypanka" from {@file}
- loop {_kat::*}:
- set {_kat::%loop-value%::*} to yaml list "rozsypanka.%loop-value%" from {@file}
- loop {_kat::*}:
- loop {_kat::%loop-value%::*}:
- set {_kat::%loop-value-1%::%loop-index-2%} to " &a%loop-value-2%"
- set {_rows} to rounded up ("%size of {_kat::*}%" parsed as integer / 9)
- set {_inv} to chest with {_rows} rows named " &9&lDostepne slowa"
- loop {_kat::*}:
- set slot loop-index parsed as integer - 1 of {_inv} to paper named "&6%loop-value%" with lore "%join {_kat::%loop-value%::*} by ""||""%"
- return {_inv}
- stop
- send "&cDostepne slowa:" to {_p}
- loop {_kat::*}:
- loop {_kat::%loop-value%::*}:
- if {_s.%loop-value-1%} is not set:
- send " &6Kategoria &c%loop-value-1%&6: &7(Ogolnie: %size of {_kat::%loop-value-1%::*}%)" to {_p}
- set {_s.%loop-value-1%} to true
- send " &a%loop-value-2%" to {_p}
- on script load:
- if yaml nodes "rozsypanka" from {@file} is not set:
- set yaml value "start" from {@file} to "10 minutes"
- set yaml value "nagroda" from {@file} to "1 diamond"
- add "Kon" to yaml list "rozsypanka.Zwierzeta" from {@file}
- add "Pies" to yaml list "rozsypanka.Zwierzeta" from {@file}
- add "Swinia" to yaml list "rozsypanka.Zwierzeta" from {@file}
- add "Krowa" to yaml list "rozsypanka.Zwierzeta" from {@file}
- add "Biurko" to yaml list "rozsypanka.Przedmioty" from {@file}
- add "Sluchawki" to yaml list "rozsypanka.Przedmioty" from {@file}
- add "Ksiazka" to yaml list "rozsypanka.Przedmioty" from {@file}
- add "Stol" to yaml list "rozsypanka.Przedmioty" from {@file}
- add "Telefon" to yaml list "rozsypanka.Przedmioty" from {@file}
- add "Patryk" to yaml list "rozsypanka.Imie" from {@file}
- add "Paulina" to yaml list "rozsypanka.Imie" from {@file}
- add "Kacper" to yaml list "rozsypanka.Imie" from {@file}
- add "Korneliusz" to yaml list "rozsypanka.Imie" from {@file}
- add "Kornelia" to yaml list "rozsypanka.Imie" from {@file}
- add "Jacek" to yaml list "rozsypanka.Imie" from {@file}
- add "Ania" to yaml list "rozsypanka.Imie" from {@file}
- add "Zofia" to yaml list "rozsypanka.Imie" from {@file}
- add "Kanapka" to yaml list "rozsypanka.Jedzenie" from {@file}
- add "Schabowy" to yaml list "rozsypanka.Jedzenie" from {@file}
- add "Kotlet" to yaml list "rozsypanka.Jedzenie" from {@file}
- add "Zupa Mleczna" to yaml list "rozsypanka.Jedzenie" from {@file}
- add "Kurczak" to yaml list "rozsypanka.Jedzenie" from {@file}
- add "Ziemniaki" to yaml list "rozsypanka.Jedzenie" from {@file}
- add "Platki Sniadaniowe" to yaml list "rozsypanka.Jedzenie" from {@file}
- set {rozsypanka.delay} to yaml value "start" from {@file}
- set {rozsypanka.delay} to {rozsypanka.delay} parsed as time span
- set {rozsypanka.start} to now
- add {rozsypanka.delay} to {rozsypanka.start}
- on chat:
- if {rozsypanka.slowo} is set:
- if "%message%" is "%{rozsypanka.slowo}%":
- cancel event
- broadcast "&c* &7Gracz &6%player% &7odgladl slowo: &3%{rozsypanka.slowo}%"
- clear {rozsypanka.slowo}
- set {_} to yaml value "nagroda" from {@file}
- give rozsypanka_getReward({_}) to player
- stop
- every 1 second:
- if {rozsypanka.start} is smaller than or equal to now:
- set {rozsypanka.start} to now
- add {rozsypanka.delay} to {rozsypanka.start}
- rozsypanka_Start()
- command /rozsypanka [<text>]:
- trigger:
- if player has permission "rozsypanka.admin":
- if arg 1 is not set:
- send "&a/rozsypanka start &7Dajesz slowo do odgadniecia."
- send "&a/rozsypanka lista &7Pokazuje wszystkie slowa"
- stop
- if arg 1 is "start":
- rozsypanka_Start()
- stop
- if arg 1 is "lista":
- open rozsypanka_SendList(player) to player
- on inventory click:
- if "%inventory name of player's current inventory%" is " &9&lDostepne slowa":
- cancel event
Advertisement
Add Comment
Please, Sign In to add comment