#SkUtilities #SkQuerry #WildSkript options: update: true function KSHOP_getPath(t: text) :: string: if "%skquery version%" is "3.21.4": set {_path} to "../../kShop/" else: set {_path} to "plugins/kShop/" set {_path} to "%{_path}%%{_t}%.yml" return {_path} function KSHOP_getRepairId(i: item) :: string: set {_id} to id of ("%{_i}%" parsed as item) set {_id} to "%{_id}%:%data of {_i}%" replace all ":0" with "" in {_id} return {_id} function KSHOP_isBasic(i: item) :: boolean: set {_id} to KSHOP_getRepairId({_i}) set {_items::*} to yaml list "basic" from KSHOP_getPath("basic") loop {_items::*}: if "%loop-value%" is "%{_id}%": return true return false function KSHOP_getPriceBasic(i: item) :: number: set {_id} to KSHOP_getRepairId({_i}) set {_ret} to yaml value "price.%{_id}%.%type of {_i}%" from KSHOP_getPath("prices") broadcast "price.%{_id}%.%type of {_i}%" set {_ret} to {_ret} parsed as number broadcast "%{_ret}% basic" return {_ret} #przyjmowany_typ #function (.......) :: zwracany_typ function KSHOP_getPriceAdvanced(i: item) :: number: set {_id} to KSHOP_getRepairId({_i}) set {_craft} to yaml value "advanced.%{_id}%.craft" from KSHOP_getPath("advanced") #broadcast "%{_i}% %id of {_i}% %{_craft}%" broadcast "Craft: &9%{_craft}%" set {_ret} to 0 loop length of {_craft} times: if subtext of {_craft} between index loop-number and loop-number is "{": set {_a} to loop-number if subtext of {_craft} between index loop-number and loop-number is "}": set {_moreId::%{_a}%} to loop-number loop {_moreId::*}: clear {_id} set {_id} to subtext of {_craft} between index loop-index parsed as integer + 1 and loop-value - 1 broadcast "%{_id}% xD" set {_id} to {_id} parsed as item if KSHOP_isBasic({_id}) is true: add KSHOP_getPriceBasic({_id}) to {_ret} #Mnożenie... Kurwa mać else: #Jebane kurwa KSHOP_getPriceAdvanced.... czyli powtórka z rozrywki set {_get} to KSHOP_getPriceAdvanced( broadcast "Cała cena? &a%{_ret}%" #broadcast "%{_id}%" return {_ret} #.... kurwaaaaaa maaaaaaćććććć function KSHOP_getPrice(i: item) :: number: if KSHOP_isBasic({_i}): return KSHOP_getPriceBasic({_i}) return KSHOP_getPriceAdvanced({_i})#ym? xd on script load: set {_basic} to KSHOP_getPath("basic") if yaml value "version" from {_basic} is not set: create file "plugins/kShop/data/basic.yml" #create file "plugins/kShop/data/advanced.yml" wait 5 second download from "https://pastebin.com/raw/F1P37m4r" to "plugins/kShop/data/basic.yml" else: if {@update}: set {_a} to yaml value "version" from {_basic} set {_url} to line 1 from url "https://pastebin.com/raw/F1P37m4r" replace all "version: " and "'" with "" in {_url} if "%{_url}%" is not "%{_a}%": download from "https://pastebin.com/raw/F1P37m4r" to "plugins/kShop/data/basic.yml" #download from "" to "plugins/kShop/data/advanced.yml" if file "plugins/kShop/prices.yml" is not exists: set {_list::*} to yaml list "basic" from {_basic} set {_prices} to KSHOP_getPath("prices") loop {_list::*}: #broadcast "%loop-value%" set {_id} to "%loop-value%" parsed as item set yaml value "price.%loop-value%.%{_id}%" from {_prices} to 1 command /setprice []: trigger: if sender is console: stop if player has permissions "kShop.admin.command.setPrice": if arg 1 is not set: if "%type of player's tool%" is "air": send "&2$&8kShop &7 Powietrze jest bezcenne :3" stop send "&2$&8kShop &7 Podaj cene dla: %type of player's tool%" stop if KSHOP_isBasic(type of player's tool) is true: set {_id} to "%id of player's tool%:%data of player's tool%" replace all ":0" with "" in {_id} set yaml value "price.%{_id}%.%type of player's tool%" from KSHOP_getPath("prices") to arg 1 send "&2$&8kShop &7 Pomyslnie ustawiles cene %type of player's tool% na: &6%arg 1%" stop send "&2$&8kShop &7 Przedmiot w rece nie nadaje sie do uzycia komendy.%nl%Wez w reke podstawowy przedmiot" stop send "&2$&8kShop &7 Brak uprawnien. &8(&7kShop.admin.command.setPrice&8)" command /test []: trigger: if arg 1 is not set: set {_x} to KSHOP_getPrice(player's tool) send "Cena za &3%type of player's tool%&r to: &c%{_x}%" stop set {_x} to KSHOP_getPrice(arg) send "Cena za &3%type of arg%&r to: &c%{_x}%" command /send []: trigger: send "%coloured arg%"