Guest User

SHOP

a guest
Aug 19th, 2019
659
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ShopSystem ver 1.2
  2. #Created By しそ#1459
  3. #{money.%player%}
  4. #/sell
  5. #/selling (player)
  6. #/shop
  7.  
  8. options:
  9. max_selling: 30 #プレイヤーが出品できる最大値
  10.  
  11. variables:
  12. {shop.player.delete} = on #サーバーに一定時間ログインしなかった場合自動的にShopの出品物を消す on|off
  13. {shop.player.delete.time} = 7 #↑の時間設定(日) 初期設定では7日
  14.  
  15. command /sell [<integer>]:
  16. trigger:
  17. if arg 1 is not set:
  18. send "&5========SHOP========"
  19. send "&6&l売りたいアイテムを手にもって&a↓&6のコマンドを入力してください。"
  20. send "&6&l/sell (値段)"
  21. stop
  22. if player's held item is air:
  23. send "&c手にアイテムを持ってください。"
  24. stop
  25. if size of {shop.player.%player%::*} >= {@max_selling}:
  26. send "&cあなたは出品できる数が上限に達しました。"
  27. stop
  28. if arg 1 < 1:
  29. send "&c1より大きい数字を入力してください。"
  30. stop
  31. if {shop.count.%player%} is not set:
  32. set {shop.count.%player%} to 100
  33. if {shop.delete.time.%player%} is not set:
  34. set {shop.sell.delete.time::*} to player
  35. add 1 to {shop.count.%player%}
  36. set {shop::%player%%{shop.count.%player%}%} to player's held item #all shop
  37. set {shop.player.%player%::%player%%{shop.count.%player%}%} to player's held item #player selling
  38. set {price::%player%%{shop.count.%player%}%} to "%arg 1%"
  39. set {shop.item::%player%%{shop.count.%player%}%} to player's held item
  40. set {shop.delete.time.%player%} to floor(unix timestamp of now) + {shop.player.delete.time} * 86400
  41. if name of player's held item is not set:
  42. send "&6&l%player's held item%&aを出品しました! &6&l値段&7->&e%arg 1%"
  43. else:
  44. send "&6&l%name of player's held item%&aを出品しました! &6&l値段&7->&e%arg 1%"
  45. if lore of player's held item is set:
  46. set {shop.lore.%player%%{shop.count.%player%}%::*} to lore of player's held item
  47. remove player's held item from player
  48.  
  49. command /shop:
  50. trigger:
  51. if {shop.money.%player%} is not set:
  52. set {shop.money.%player%} to 0
  53. sound(player, "block.chest.open")
  54. set {_slotnum} to 9
  55. open chest with 6 row named "&a&lSHOP" to player
  56. set slot 0 of player's current inventory to ender chest named "&6&lItem list"
  57. if size of {shop::*} >= 28:
  58. set slot 53 of player's current inventory to arrow named "&6Next Page"
  59. set slot 48 of player's current inventory to chest named "&d&l稼いだ金額:%{shop.money.%player%}%"
  60. set slot 49 of player's current inventory to gold nugget named "&6&lお金:&e&l%{money.%player%}%"
  61. if {shop.count.%player%} is set:
  62. set slot 50 of player's current inventory to paper named "&6現在出品しているものを確認する。"
  63. else:
  64. set slot 50 of player's current inventory to paper named "&c現在出品しているものはありません。"
  65. set slot 0 of player's current inventory to ender chest named "&6&lItem list"
  66. loop {shop::*}:
  67. set {shop.page.%player%::%loop-index%} to loop-value
  68. loop {shop.page.%player%::*}:
  69. add 1 to {_slotnum}
  70. set {_playername} to subtext of loop-index from characters 1 to (length of loop-index - 3)
  71. set {_shop.price::*} to loop-index split at {_playername}
  72. if {_slotnum} is 17 or 26 or 35:
  73. add 2 to {_slotnum}
  74. if {_slotnum} >= 44:
  75. stop loop
  76. stop
  77. if {shop.lore.%loop-index%::*} is set:
  78. set slot {_slotnum} of player's current inventory to loop-value with lore "&f&k&ltekitou%loop-index%" and "&6Price&7:&e&l%{price::%{_playername}%%{_shop.price::2}%}%" and "&6出品者&7:&b&l%{_playername}%" and "&f&k&ltekitou%loop-index%" and "" and {shop.lore.%loop-index%::*}
  79. else:
  80. set slot {_slotnum} of player's current inventory to loop-value with lore "&f&k&ltekitou%loop-index%" and "&6Price&7:&e&l%{price::%{_playername}%%{_shop.price::2}%}%" and "&6出品者&7:&b&l%{_playername}%" and "&f&k&ltekitou%loop-index%"
  81. delete {shop.page.%player%::%loop-index%}
  82.  
  83. command /selling [<player>]:
  84. trigger:
  85. if arg 1 is not set:
  86. send "&5========SHOP========"
  87. send "&6&l/selling (プレイヤー)"
  88. stop
  89. open chest with 6 row named "&a&l%arg 1%が出品している物" to player
  90. set {_slotnum} to 0
  91. loop {shop.player.%arg 1%::*}:
  92. set {_playername} to subtext of loop-index from characters 1 to (length of loop-index - 3)
  93. set {_shop.price::*} to loop-index split at {_playername}
  94. if {shop.lore.%loop-index%::*} is set:
  95. set slot {_slotnum} of player's current inventory to loop-value with lore "&f&k&ltekitou%loop-index%" and "&6Price&7:&e&l%{price::%{_playername}%%{_shop.price::2}%}%" and "&6出品者&7:&b&l%{_playername}%" and "&f&k&ltekitou%loop-index%" and "" and {shop.lore.%loop-index%::*}
  96. else:
  97. set slot {_slotnum} of player's current inventory to loop-value with lore "&f&k&ltekitou%loop-index%" and "&6Price&7:&e&l%{price::%{_playername}%%{_shop.price::2}%}%" and "&6出品者&7:&b&l%{_playername}%" and "&f&k&ltekitou%loop-index%"
  98. add 1 to {_slotnum}
  99. stop
  100.  
  101. on inventory click:
  102. #player selling
  103. if name of player's current inventory contain "が出品している物":
  104. cancel event
  105. if clicked inventory is player's inventory:
  106. cancel event
  107. stop
  108. set {_price::*} to line 2 of lore of clicked item split at "&6Price&7:&e&l"
  109. if {_price::2} parsed as number > {money.%player%}:
  110. sound(player, "entity.wolf.whine")
  111. send "&cお金が足りません。"
  112. stop
  113. if {money.%player%} is not set:
  114. send "&4エラー -> &e%player%&4の変数&a{money.%%player%%}&4が設定されていません。 &3(Shop.sk)" to ops
  115. send "&cエラー、運営に連絡してください。"
  116. stop
  117. set {_player.sell::*} to line 3 of lore of clicked item split at "&6出品者&7:&b&l"
  118. if {_player.sell::2} parsed as player is player:
  119. send "&c自分で出品した物は購入できません。"
  120. close player's inventory
  121. stop
  122. set {_shop.indexnum::*} to line 1 of lore of clicked item split at "&f&k&ltekitou%{_player.sell::2}%"
  123. set {buyselect.index.%player%} to "%{_player.sell::2}%%{_shop.indexnum::2}%"
  124. set {buyselect.price.%player%} to {_price::2}
  125. set {buyselect.sell.%player%} to {_player.sell::2}
  126. set {buyselect.item.%player%} to clicked item
  127. close player's inventory
  128. wait a tick
  129. open chest with 1 row named "&5&l本当に購入しますか?" to player
  130. set slot 2 of player's current inventory to light green wool named "&a購入する"
  131. set slot 6 of player's current inventory to red wool named "&cキャンセル"
  132. set slot 4 of player's current inventory to barrier block named "&6&l購入内容" with lore "&6&lItem&7->%name of clicked item%" and "&6&lPrice&7->&e&l%{_price::2}%" and "&6&l出品者&7->&b%{buyselect.sell.%player%}%"
  133. stop
  134. #item buying
  135. if name of player's current inventory contain "本当に購入しますか?":
  136. cancel event
  137. if clicked inventory is player's inventory:
  138. stop
  139. if name of clicked item is "&a購入する":
  140. if player doesn't have enough space for barrier block:
  141. send "&cインベントリに空きを作ってください。"
  142. close player's inventory
  143. stop
  144. if {shop::%{buyselect.index.%player%}%} is not set:
  145. send "&c先に他のプレイヤーに買われました。"
  146. close player's inventory
  147. stop
  148. give {shop.item::%{buyselect.index.%player%}%} to player
  149. remove {buyselect.price.%player%} parsed as number from {money.%player%}
  150. if name of {buyselect.item.%player%} is not set:
  151. send "%{buyselect.item.%player%}%&aを購入しました。"
  152. else:
  153. send "%name of {buyselect.item.%player%}%&aを購入しました。"
  154. add {buyselect.price.%player%} parsed as number to {money.%{buyselect.sell.%player%}%}
  155. add {buyselect.price.%player%} parsed as number to {shop.money.%{buyselect.sell.%player%}%}
  156. if name of {buyselect.item.%player%} is not set:
  157. send "&e%player%&6が%{buyselect.item.%player%}%&6を購入しました。" to {buyselect.sell.%player%} parsed as player
  158. else:
  159. send "&e%player%&6が%name of {buyselect.item.%player%}%&6を購入しました。" to {buyselect.sell.%player%} parsed as player
  160. delete {shop::%{buyselect.index.%player%}%}
  161. delete {shop.player.%{buyselect.sell.%player%}%::%{buyselect.index.%player%}%}
  162. delete {shop.item.%{buyselect.sell.%player%}%}
  163. delete {shop.lore.%{buyselect.index.%player%}%::*}
  164. if {buyselect.sell.%player%} parsed as player is offline:
  165. if name of {buyselect.item.%player%} is not set:
  166. add "&e%player%&6が%{buyselect.item.%player%}%&6を購入しました。" to {shop.notice.%{buyselect.sell.%player%}%::*}
  167. else:
  168. add "&e%player%&6が%name of {buyselect.item.%player%}%&6を購入しました。" to {shop.notice.%{buyselect.sell.%player%}%::*}
  169. close player's inventory
  170. stop
  171. if name of clicked item is "&cキャンセル":
  172. cancel event
  173. if clicked inventory is player's inventory:
  174. stop
  175. send "&c購入をキャンセルしました。"
  176. close player's inventory
  177. stop
  178. #item come back
  179. if name of player's current inventory contain "現在出品しているもの":
  180. cancel event
  181. if clicked inventory is player's inventory:
  182. stop
  183. if clicked item is air:
  184. stop
  185. if clicked slot is -999:
  186. stop
  187. set {_player.sell::*} to line 3 of lore of clicked item split at "&6出品者&7:&b&l"
  188. set {_shop.indexnum::*} to line 1 of lore of clicked item split at "&f&k&ltekitou%{_player.sell::2}%"
  189. set {itemcomeback.index.%player%} to "%{_player.sell::2}%%{_shop.indexnum::2}%"
  190. set {itemcomeback.sell.%player%} to {_player.sell::2}
  191. close player's inventory
  192. open chest with 1 row named "&6&lアイテムを戻す" to player
  193. set slot 2 of player's current inventory to light green wool named "&aアイテムを戻す"
  194. set slot 6 of player's current inventory to red wool named "&cキャンセル"
  195. stop
  196. if name of player's current inventory contain "アイテムを戻す":
  197. cancel event
  198. if name of clicked item contain "アイテムを戻す":
  199. cancel event
  200. if player doesn't have enough space for barrier block:
  201. send "&cインベントリに空きを作ってください。"
  202. close player's inventory
  203. stop
  204. give {shop.item::%{itemcomeback.index.%player%}%} to player
  205. delete {shop::%{itemcomeback.index.%player%}%}
  206. delete {shop.player.%player%::%{itemcomeback.index.%player%}%}
  207. delete {shop.lore.%{itemcomeback.index.%player%}%::*}
  208. send "&6アイテムを戻しました。" to player
  209. close player's inventory
  210. stop
  211. if name of clicked item contain "キャンセル":
  212. close player's inventory
  213. stop
  214. if name of clicked item contain "現在出品しているものはありません":
  215. cancel event
  216. stop
  217. if name of clicked item contain "稼いだ金額":
  218. cancel event
  219. stop
  220. name of player's current inventory contain "SHOP"
  221. cancel event
  222. if clicked slot is -999:
  223. stop
  224. if clicked slot is empty:
  225. stop
  226. if name of clicked item contain "Item list":
  227. cancel event
  228. stop
  229. if name of clicked item contain "お金":
  230. cancel event
  231. stop
  232. if clicked inventory is player's inventory:
  233. cancel event
  234. stop
  235. if name of clicked item contain "Next Page":
  236. cancel event
  237. sound(player, "block.chest.open")
  238. set {_slotnum} to 9
  239. open chest with 6 row named "&a&lSHOP" to player
  240. set slot 0 of player's current inventory to ender chest named "&6&lItem list"
  241. if size of {shop.page.%player%::*} >= 28:
  242. set slot 53 of player's current inventory to arrow named "&6Next Page"
  243. set slot 48 of player's current inventory to chest named "&e&l稼いだ金額:%{shop.money.%player%}%"
  244. set slot 49 of player's current inventory to gold nugget named "&6&lお金:&e&l%{money.%player%}%"
  245. set slot 45 of player's current inventory to arrow named "&6&lTOPに戻る。"
  246. if {shop.count.%player%} is set:
  247. set slot 50 of player's current inventory to paper named "&6現在出品しているものを確認する。"
  248. else:
  249. set slot 50 of player's current inventory to paper named "&c現在出品しているものはありません。"
  250. loop {shop.page.%player%::*}:
  251. add 1 to {_slotnum}
  252. set {_playername} to subtext of loop-index from characters 1 to (length of loop-index - 3)
  253. set {_shop.price::*} to loop-index split at {_playername}
  254. if {_slotnum} is 17 or 26 or 35:
  255. add 2 to {_slotnum}
  256. if {_slotnum} >= 44:
  257. stop loop
  258. stop
  259. if {shop.lore.%loop-index%::*} is set:
  260. set slot {_slotnum} of player's current inventory to loop-value with lore "&f&k&ltekitou%loop-index%" and "&6Price&7:&e&l%{price::%{_playername}%%{_shop.price::2}%}%" and "&6出品者&7:&b&l%{_playername}%" and "&f&k&ltekitou%loop-index%" and "" and {shop.lore.%loop-index%::*}
  261. else:
  262. set slot {_slotnum} of player's current inventory to loop-value with lore "&f&k&ltekitou%loop-index%" and "&6Price&7:&e&l%{price::%{_playername}%%{_shop.price::2}%}%" and "&6出品者&7:&b&l%{_playername}%" and "&f&k&ltekitou%loop-index%"
  263. delete {shop.page.%player%::%loop-index%}
  264. stop
  265. if name of clicked item contain "TOPに戻る":
  266. cancel event
  267. close player's inventory
  268. execute player command "/shop"
  269. stop
  270. if name of clicked item contain "TTTTTTTTTF":
  271. sound(player, "entity.villager.no")
  272. stop
  273. if name of clicked item contain "出品しているものを確認する":
  274. cancel event
  275. close player's inventory
  276. open chest with 6 row named "&a&l現在出品しているもの" to player
  277. set {_slotnum} to 0
  278. loop {shop.player.%player%::*}:
  279. set {_playername} to subtext of loop-index from characters 1 to (length of loop-index - 3)
  280. set {_shop.price::*} to loop-index split at {_playername}
  281. if {shop.lore.%loop-index%::*} is set:
  282. set slot {_slotnum} of player's current inventory to loop-value with lore "&f&k&ltekitou%loop-index%" and "&6Price&7:&e&l%{price::%{_playername}%%{_shop.price::2}%}%" and "&6出品者&7:&b&l%{_playername}%" and "&f&k&ltekitou%loop-index%" and "" and {shop.lore.%loop-index%::*}
  283. else:
  284. set slot {_slotnum} of player's current inventory to loop-value with lore "&f&k&ltekitou%loop-index%" and "&6Price&7:&e&l%{price::%{_playername}%%{_shop.price::2}%}%" and "&6出品者&7:&b&l%{_playername}%" and "&f&k&ltekitou%loop-index%"
  285. add 1 to {_slotnum}
  286. stop
  287. #Main Shop System
  288. set {_price::*} to line 2 of lore of clicked item split at "&6Price&7:&e&l"
  289. if {_price::2} parsed as number > {money.%player%}:
  290. sound(player, "entity.wolf.whine")
  291. send "&cお金が足りません。"
  292. stop
  293. if {money.%player%} is not set:
  294. send "&4エラー -> &e%player%&4の変数 &a{money.%%player%%} &4が設定されていません。" to ops
  295. send "&cエラー、運営に連絡してください。"
  296. stop
  297. set {_player.sell::*} to line 3 of lore of clicked item split at "&6出品者&7:&b&l"
  298. if {_player.sell::2} parsed as player is player: #debug用の#
  299. send "&c自分で出品した物は購入できません。"
  300. close player's inventory
  301. stop
  302. set {_shop.indexnum::*} to line 1 of lore of clicked item split at "&f&k&ltekitou%{_player.sell::2}%"
  303. set {buyselect.index.%player%} to "%{_player.sell::2}%%{_shop.indexnum::2}%"
  304. set {buyselect.price.%player%} to {_price::2}
  305. set {buyselect.sell.%player%} to {_player.sell::2}
  306. set {buyselect.item.%player%} to clicked item
  307. close player's inventory
  308. wait a tick
  309. open chest with 1 row named "&5&l本当に購入しますか?" to player
  310. set slot 2 of player's current inventory to light green wool named "&a購入する"
  311. set slot 6 of player's current inventory to red wool named "&cキャンセル"
  312. if name of clicked item is not set:
  313. set slot 4 of player's current inventory to barrier block named "&6&l購入内容" with lore "&6&lItem&7->%clicked item%" and "&6&lPrice&7->&e&l%{_price::2}%" and "&6&l出品者&7->&b%{buyselect.sell.%player%}%"
  314. else:
  315. set slot 4 of player's current inventory to barrier block named "&6&l購入内容" with lore "&6&lItem&7->%name of clicked item%" and "&6&lPrice&7->&e&l%{_price::2}%" and "&6&l出品者&7->&b%{buyselect.sell.%player%}%"
  316.  
  317. on skript start:
  318. {shop.player.delete} is true
  319. loop {shop.sell.delete.time::*}:
  320. {shop.delete.time.%loop-value%} is set
  321. floor(unix timestamp of now) >= {shop.delete.time.%loop-value%}
  322. set {shop.notice.%loop-value-1%::*} to "&cあなたは%{shop.player.delete.time}%日間サーバーにログインしなかったのでShopの出品物を削除しました。"
  323. set {_shop.delete.num} to 100
  324. loop 100 times:
  325. add 1 to {_shop.delete.num}
  326. delete {shop.player.%loop-value-1%::%loop-value-1%%{_shop.delete.num}%}
  327. delete {shop::%loop-value-1%%{_shop.delete.num}%}
  328. delete {shop.lore.%loop-value-1%%{_shop.delete.num}%::*}
  329. remove loop-value-1 from {shop.sell.delete.time::*}
  330. delete {shop.delete.time.%loop-value-1%}
  331.  
  332. on join:
  333. if {shop.delete.time.%player%} is set:
  334. set {shop.delete.time.%player%} to floor(unix timestamp of now) + {shop.player.delete.time} * 86400
  335. if {shop.notice.%player%::*} is set:
  336. loop {shop.notice.%player%::*}:
  337. send "%loop-value%"
  338. if loop-value contains "サーバーにログインしなかったので":
  339. wait 3 seconds
  340. open chest with 1 row named "&cこの画面を閉じるとアイテムは消去されます。" to player
  341. set {_slotnum} to 0
  342. loop {shop.player.%player%::*}:
  343. set slot {_slotnum} of player's current inventory to loop-value-2
  344. add 1 to {_slotnum}
  345. delete {shop.notice.%player%::*}
  346.  
  347. command /shopdelete [<player>]:
  348. permission: admin
  349. trigger:
  350. if arg 1 is not set:
  351. send "&9/shopdelete &e(player)"
  352. send "&9そのプレイヤーが出品したものをすべて消去します。"
  353. stop
  354. set {_shop.delete.number} to 100
  355. loop 900 times:
  356. add 1 to {_shop.delete.number}
  357. delete {shop::%arg 1%%{_shop.delete.number}%}
  358. delete {shop.player.%arg 1%::%arg 1%%{_shop.delete.number}%}
  359. delete {price::%arg 1%%{_shop.delete.number}%}
  360. delete {shop.item::%arg 1%%{_shop.delete.number}%}
  361. delete {shop.delete.time.%arg 1%}
  362. send "&e%arg 1%&6の出品したものをすべて消去しました。"
  363.  
  364.  
  365. function sound(p: player, sound: text):
  366. play sound "%{_sound}%" with volume 1 and pitch 1 at {_p} for {_p}
RAW Paste Data