Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- return {_ret}
- #function
- 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}%"
- 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
- set {_id} to {_id} parsed as item
- if KSHOP_isBasic({_id}) is true:
- add KSHOP_getPriceBasic({_id}) to {_ret}
- broadcast "%{_id}%"
- return 0
- function KSHOP_getPrice(i: item) :: number:
- if KSHOP_isBasic({_i}):
- return KSHOP_getPriceBasic({_i})
- return KSHOP_getPriceAdvanced({_i})
Advertisement
Add Comment
Please, Sign In to add comment