Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- shopp: &7[&7&l・&r&7]
- c: ◈
- variables:
- {mg::1} = iron nugget
- {mg::2} = iron ingot
- {mg::3} = iron block
- {mg::4} = bone block
- on join:
- set {%player%.maxbuy} to 1
- function maxbuy_guicreate(p: player) :: item:
- set {_cl} to {%{_p}%.guic}
- set {_disp::*} to (coloured "&r&7[x1]"), (coloured "&r&7[x10]"), (coloured "&r&7[x100]"), and (coloured "&r&7[max]")
- set {_disp::1} to coloured "&a&n[x1]" if mod({_cl}, 4) is 0
- set {%{_p}%.maxbuy} to 1 if mod({_cl}, 4) is 0
- set {_disp::2} to coloured "&a&n[x10]" if mod({_cl}, 4) is 1
- set {%{_p}%.maxbuy} to 10 if mod({_cl}, 4) is 1
- set {_disp::3} to coloured "&a&n[x100]" if mod({_cl}, 4) is 2
- set {%{_p}%.maxbuy} to 100 if mod({_cl}, 4) is 2
- set {_disp::4} to coloured "&a&n[max]" if mod({_cl}, 4) is 3
- set {%{_p}%.maxbuy} to -1 if mod({_cl}, 4) is 3
- set {_answer} to iron block named "&7&n購入オプション" with lore "%{_disp::1}% %{_disp::2}% %{_disp::3}% %{_disp::4}%" with nbt "{loc:""buy""}"
- return {_answer}
- on inventory click:
- if name of event-item is "&7&n購入オプション":
- cancel event
- function maxbuy_multibuy(m: number, a: number, mbuy: number, startm: number, limit: number, max: number) :: numbers:
- if {_mbuy} is -1:
- set {_mbuy} to floor(log(({_max}*({_a}-1))/{_m}+{_a}^{_startm}, {_a}))-{_startm}
- if {_limit} is not -1:
- set {_mbuy} to {_limit}-{_startm} if {_limit} <= {_startm}+{_mbuy}
- set {_answer::1} to {_m}*(({_a}^({_mbuy}+{_startm})-{_a}^{_startm})/({_a}-1))
- set {_answer::2} to {_mbuy}
- return {_answer::*}
- function maxbuy_shop(m: number, a: number, startm: number, limit: number, c: text, p: player, upgp: text):
- set {_mbuy} to {%{_p}%.maxbuy}
- set {_cost::*} to maxbuy_multibuy({_m}, {_a}, {_mbuy}, {%{_p}%::upgrade::%{_upgp}%}, {_limit}, {%{_p}%::%{_c}%})
- broadcast "%{_cost::*}%"
- if {%{_p}%::%{_c}%} >= {_cost::1}:
- remove {_cost::1} from {%{_p}%::%{_c}%}
- add {_cost::2} to {%{_p}%::upgrade::%{_upgp}%}
- message "&f{@c} &f購入に成功しました。&7(+%{_cost::2}%)" to {_p}
- else if {_mbuy} is not 0:
- message "&f{@c} &7購入に失敗しました。" to {_p}
- message "&f{@c} &7あと &f%nn({_cost::1}-{%{_p}%::%{_c}%}, {_p})% %{_c}% &7必要です。 &8(%100*{%{_p}%::%{_c}%}/{_cost::1}% %%)" to {_p}
- else:
- message "&f{@c} &7既に上限に達しています。"
- command /numbered <number> <number> <number> <number> <number> <number>:
- trigger:
- set {_aa::*} to maxbuy_multibuy(arg-1, arg-2, arg-3, arg-4, arg-5, arg-6)
- broadcast "%{_aa::1}%"
- command /aaaa:
- trigger:
- set {%player%::upgrade::test} to 0
- command /buy:
- trigger:
- maxbuy_shop(2, 1.5, {%player%::upgrade::test}, 50, "xp", player, "test")
- command /getxp <number>:
- trigger:
- set {%player%::xp} to arg-1
Add Comment
Please, Sign In to add comment