2019-02-03 12:37:23 Skript

マルチページ(6 page)ショップ

Copy Copied! Full
function Buy(p: player, item: number, i: int, r: offline player, n: number): set {_njklsdfnjsfd} to "&8Page %{_n}%" set {_id} to {_p}'s uuid set {_rd} to {_r}'s uuid set {_money} to {money::%{_id}%} set {_price} to {_i} if {_n} is 1: set {_slot} to {_item} - 1 else: set {_kakeru} to {_n} - 1 set {_kakeru} to {_kakeru} * 64 set {_slot} to {_item} - {_kakeru} loop 36 times: set {_call} to slot loop-number - 1 of {_p}'s inventory if {_call} is not air: set {_aa} to false else if {_call} is air: set {_aa} to true exit 1 loop if {_aa} is false: send "&cInventoryに空きがありません!" to {_p} stop if {_p} is {_r}: send "&f%{shopinv.1::%{_item}%}%&eの出品をキャンセルしました。" to {_p} give {shopinv.1::%{_item}%} to {_p} loop all players: if inventory name of loop-player's current inventory contains "&bShop": if inventory name of loop-player's current inventory contains {_njklsdfnjsfd}: delete slot {_slot} of current inventory of loop-player delete {shopinv.1::%{_item}%} delete {shopinv.2::%{_item}%} delete {shopinv.3::%{_item}%} stop if {_price} > {_money}: send "&c所持金が足りません!" to {_p} stop if {_price} is not set: send "&cその商品は他の人に購入されています!" to {_p} # {_p} command "/shop" stop add {_price} to {money::%{_rd}%} if {_r} is online: send "&a+%{_price}% 円(SHOP)" to {_r} send "&f%{_p}%さん&aがあなたの&f%{shopinv.1::%{_item}%}%&aを購入しました。" to {_r} else: add "&aあなたがオフラインの間に&f%{_p}%さん&aが&f%{shopinv.1::%{_item}%}%&aを購入しました。(+%{_price}% 円)" to {selled.%{_rd}%::*} remove {_price} from {money::%{_id}%} send "&c-%{_price}% 円(SHOP)" to {_p} send "&6%{_r}%さんから&f%{shopinv.1::%{_item}%}%&6を購入しました。" to {_p} give {shopinv.1::%{_item}%} to {_p} loop all players: if inventory name of loop-player's current inventory contains "&bShop": if inventory name of loop-player's current inventory contains {_njklsdfnjsfd}: delete slot {_slot} of current inventory of loop-player delete {shopinv.1::%{_item}%} delete {shopinv.2::%{_item}%} delete {shopinv.3::%{_item}%} # {_p} command "/shop" function Shop(p: player, n: number): # close {_p}'s inventory open chest with 8 rows named "&bShop &8Page %{_n}%" to {_p} if {shopinv.1::*} is not set: set slot 22 of current inventory of {_p} to red stained glass pane named "&cThere are no items!" stop while inventory name of {_p}'s current inventory contains "&bShop": if {shopinv.1::*} is not set: set slot 22 of current inventory of {_p} to red stained glass pane named "&cThere are no items!" else: if inventory name of {_p}'s current inventory contains "&8Page 1": set slot 71 of current inventory of {_p} to paper named "&a次のページ" with lore "2" loop {shopinv.1::*}: set {_slot} to loop-index parsed as integer set {_slot2} to {_slot} - 1 if {_slot} < 64: set slot {_slot2} of current inventory of {_p} to loop-value named "&f%loop-value%" with lore "&f出品者 %{shopinv.3::%{_slot}%}%, &f金額 %{shopinv.2::%{_slot}%}% 円" else if inventory name of {_p}'s current inventory contains "&8Page 2": set slot 63 of current inventory of {_p} to paper named "&a前のページ" with lore "1" set slot 71 of current inventory of {_p} to paper named "&a次のページ" with lore "3" loop {shopinv.1::*}: set {_slot} to loop-index parsed as integer set {_slot2} to {_slot} - 64 if {_slot} > 63: if {_slot} < 127: set slot {_slot2} of current inventory of {_p} to loop-value named "&f%loop-value%" with lore "&f出品者 %{shopinv.3::%{_slot}%}%, &f金額 %{shopinv.2::%{_slot}%}% 円" else if inventory name of {_p}'s current inventory contains "&8Page 3": set slot 63 of current inventory of {_p} to paper named "&a前のページ" with lore "2" set slot 71 of current inventory of {_p} to paper named "&a次のページ" with lore "4" loop {shopinv.1::*}: set {_slot} to loop-index parsed as integer set {_slot2} to {_slot} - 128 if {_slot} > 126: if {_slot} < 190: set slot {_slot2} of current inventory of {_p} to loop-value named "&f%loop-value%" with lore "&f出品者 %{shopinv.3::%{_slot}%}%, &f金額 %{shopinv.2::%{_slot}%}% 円" else if inventory name of {_p}'s current inventory contains "&8Page 4": set slot 63 of current inventory of {_p} to paper named "&a前のページ" with lore "3" set slot 71 of current inventory of {_p} to paper named "&a次のページ" with lore "5" loop {shopinv.1::*}: set {_slot} to loop-index parsed as integer set {_slot2} to {_slot} - 192 if {_slot} > 189: if {_slot} < 253: set slot {_slot2} of current inventory of {_p} to loop-value named "&f%loop-value%" with lore "&f出品者 %{shopinv.3::%{_slot}%}%, &f金額 %{shopinv.2::%{_slot}%}% 円" else if inventory name of {_p}'s current inventory contains "&8Page 5": set slot 63 of current inventory of {_p} to paper named "&a前のページ" with lore "4" set slot 71 of current inventory of {_p} to paper named "&a次のページ" with lore "6" loop {shopinv.1::*}: set {_slot} to loop-index parsed as integer set {_slot2} to {_slot} - 256 if {_slot} > 252: if {_slot} < 316: set slot {_slot2} of current inventory of {_p} to loop-value named "&f%loop-value%" with lore "&f出品者 %{shopinv.3::%{_slot}%}%, &f金額 %{shopinv.2::%{_slot}%}% 円" else if inventory name of {_p}'s current inventory contains "&8Page 6": set slot 63 of current inventory of {_p} to paper named "&a前のページ" with lore "5" loop {shopinv.1::*}: set {_slot} to loop-index parsed as integer set {_slot2} to {_slot} - 320 if {_slot} > 315: if {_slot} < 379: set slot {_slot2} of current inventory of {_p} to loop-value named "&f%loop-value%" with lore "&f出品者 %{shopinv.3::%{_slot}%}%, &f金額 %{shopinv.2::%{_slot}%}% 円" wait 5 tick function sEller(p: player, item: material, i: int): set {_item2} to "%{_item}%" set {_amount::*} to {_item2} split at " " set {_amount} to "%{_amount::1}%" parsed as number if {_amount} is set: delete {_amount::1} set {_item3} to "%{_amount::*}%" replace "," in {_item3} with "" replace "and " in {_item3} with "" if {_amount} is not set: set {_amount} to 1 if name of {_item} is set: set {_item} to name of {_item} else: set {_item} to {_item3} loop all players: if inventory name of {_p}'s current inventory contains "&bShop": stop if loop-player is not {_p}: send "&f%{_p}%さん&bがShopに&f%{_item}% &f*%{_amount}%&bを&f%{_i}% 円&bで出品しました。" to loop-player console command "tellraw %loop-player% {""text"":""[Click Here to Open SHOP]"",""color"":""aqua"",""clickEvent"":{""action"":""run_command"",""value"":""/shop""}}" function Sell(item: material, i: int, p: player): set {_currentnum} to number of {shopinv.1::*} if {_currentnum} >= 186: send "&cShopのInventoryが満杯です。" to {_p} stop add {_item} to {shopinv.1::*} add {_i} to {shopinv.2::*} add {_p} to {shopinv.3::*} remove {_item} from {_p}'s tool set {_item2} to "%{_item}%" set {_amount::*} to {_item2} split at " " set {_amount} to "%{_amount::1}%" parsed as number if {_amount} is set: delete {_amount::1} set {_item3} to "%{_amount::*}%" replace "," in {_item3} with "" replace "and " in {_item3} with "" if {_amount} is not set: set {_amount} to 1 if name of {_item} is set: set {_item2} to name of {_item} else: set {_item2} to {_item3} send "&f%{_item2}% &f*%{_amount}%&aを&f%{_i}% 円&aでShopに出品しました。" to {_p} sEller({_p}, {_item}, {_i}) command /shop [<int>]: trigger: if arg 1 is not set: Shop(player, 1) else: Shop(player, arg 1) on inventory click: if inventory name of current inventory of player contains "&bShop": if clicked item is red stained glass pane named "&cThere are no items!": cancel event else if lore of clicked item contains "円": set {_slot} to (clicked slot + 1) if inventory name of current inventory of player contains "&8Page 1": Buy(player, {_slot}, {shopinv.2::%{_slot}%}, {shopinv.3::%{_slot}%}, 1) else: set {_title} to inventory name of current inventory of player replace "&bShop &8Page " in {_title} with "" set {_page} to {_title} parsed as integer set {_final} to {_page} - 2 set {_ahaha} to 64 * {_final} set {_slot} to {_slot} + 63 + {_ahaha} Buy(player, {_slot}, {shopinv.2::%{_slot}%}, {shopinv.3::%{_slot}%}, 2) cancel event else if lore of clicked item contains "情報": cancel event Shop(player, 1) else if name of clicked item contains "前の" or "次の": set {_page} to "%lore of clicked item%" parsed as number Shop(player, {_page}) cancel event else: cancel event command /sell <int>: trigger: if player's tool is not air: if arg 1 < 1: send "&c販売最低価格は&f1 円&cです!" stop if arg 1 > 100000000: send "&c販売最高価格は&f100,000,000 円&cです!" stop set {_item} to player's tool Sell({_item}, arg 1, player) else: send "&c販売するアイテムを手に持ってください!" on join: set {_id} to player's uuid loop {selled.%{_id}%::*}: send "%loop-value%" to player delete {selled.%{_id}%::*}
マルチページ(6 page)ショップ
RECOMMEND