sirayasiki

ガチャ

Mar 25th, 2025 (edited)
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.80 KB | None | 0 0
  1. #on inventory click:
  2. #set {_a} to event-item's name
  3. #send "%{_a}%"
  4. #ガチャ設定アイテム
  5.  
  6.  
  7.  
  8. #
  9. on load:
  10. set {gatya.k} to diamond named "&e&l景品設定"
  11. set {gatya.n} to name tag named "&e&lガチャの名前変更"
  12. set {gatya.s} to writable book named "&e&lガチャの詳細設定"
  13. set {gatya.i} to chest named "&e&lガチャアイテム変更"
  14. set {gatya.r} to emerald named "&e&lレアリティ設定"
  15. set {gatya.n.%player%} to false
  16. set {gatya.R.N.%player%::status} to false
  17.  
  18. command /gatya <text>:
  19. permission: op
  20. trigger:
  21. if arg 1 is "list":
  22. set {_gatya} to chest with 6 row named "&6&lガチャ一覧"
  23. loop {gatya.list::*}:
  24. set slot loop-index parsed as number - 1 of {_gatya} to chest named "%loop-value%"
  25. open {_gatya} to player
  26. else if arg 1 is "create":
  27. if {gatya.list::*} is not set:
  28. add "&6&lガチャ1" to {gatya.list::*}
  29. set {_size} to 1
  30. set {gatya.rarity::%{_size}%::0} to 1
  31. loop 9 time:
  32. set {gatya.rarity::%{_size}%::%loop-number%} to "&f&lレアリティ%loop-number%"
  33. set {gatya.rarity.chance::%{_size}%::%loop-number%} to 1
  34. else:
  35. set {_size} to size of {gatya.list::*}
  36. set {_size} to {_size} + 1
  37. add "&6&lガチャ%{_size}%" to {gatya.list::*}
  38. set {gatya.rarity::%{_size}%::0} to 1
  39. loop 9 times:
  40. set {gatya.rarity::%{_size}%::%loop-number%} to "&f&lレアリティ%loop-number%"
  41. set {gatya.rarity.chance::%{_size}%::%loop-number%} to 1
  42. else if arg 1 is "reset":
  43. delete {gatya.list::*}
  44. delete {gatya.rarity::*}
  45. else:
  46. send "&cerror pleas [list] or [create]"
  47.  
  48. on chat:
  49. if {gatya.R.C.%player%::status} is true:
  50. cancel event
  51. set {_gatya.r.c} to message parsed as integer
  52. if parse error is set:
  53. send "&c数字のみ入力可能です。ガチャメニューより再試行してください"
  54. set {gatya.R.C.%player%::status} to false
  55. else:
  56. set {gatya.rarity.chance::%{gatya.setting.%player%}%::%{gatya.R.C.%player%::index}%} to {_gatya.r.c}
  57. send "&a&l%{gatya.rarity::%{gatya.setting.%player%}%::%{gatya.R.N.%player%::index}%}%の排出比率を&e&l%{_gatya.r.c}%&b&lに変更しました"
  58. set {gatya.R.C.%player%::status} to false
  59.  
  60. if {gatya.R.N.%player%::status} is true:
  61. cancel event
  62. set {_gatya.r.n} to the chat message
  63. set {_index} to {gatya.R.N.%player%::index}
  64. set {gatya.rarity::%{gatya.setting.%player%}%::%{_index}%} to "%{_gatya.r.n}%"
  65. send "&b&lレアリティの名前を%{_gatya.r.n}%&b&lに変更しました"
  66. set {gatya.R.N.%player%::status} to false
  67. if {gatya.n.%player%} is true:
  68. cancel event
  69. set {_gatya.c} to the chat message
  70. set {_size} to size of {gatya.list::*}
  71. loop {gatya.list::*}:
  72. set {_l} to loop-index parsed as number
  73. if {_gatya.c} is {gatya.list::%{_l}%}:
  74. send "&c同名のガチャがあります!別の名前で再試行してください"
  75. set {gatya.n.%player%} to false
  76. stop
  77. else if {_size} is {_l}:
  78. set {gatya.list::%{gatya.setting.%player%}%} to "%{_gatya.c}%"
  79. set {gatya.n.%player%} to false
  80. send "ガチャの名前を%{_gatya.c}%&fに変更しました"
  81.  
  82. on inventory click:
  83. if name of player's current inventory contain "&6&lガチャ一覧":
  84. cancel event
  85. if event-item is chest:
  86. set {_n} to event-item's name
  87. loop {gatya.list::*}:
  88. set {_l} to loop-index
  89. if {gatya.list::%{_l}%} is {_n}:
  90. set {gatya.setting.%player%} to {_l}
  91. open chest with 1 row named "&6&lガチャ設定&f[%{_n}%&f]" to player
  92. set slot 0 of player's current inventory to {gatya.k}
  93. set slot 1 of player's current inventory to {gatya.n}
  94. set slot 2 of player's current inventory to {gatya.i}
  95. set slot 3 of player's current inventory to {gatya.r}
  96. if name of player's current inventory contain "&6&lガチャ景品設定[レアリティ選択]":
  97. cancel event
  98. set {gatya.item.%player%} to event-slot's index + 1
  99. set {_gatya} to chest with 6 row named "&6&l景品設定[%{gatya.rarity::%{gatya.setting.%player%}%::%{gatya.item.%player%}%}%]"
  100. loop {gatya.item::%{gatya.setting.%player%}%::%{gatya.item.%player%}%::*}:
  101. set slot loop-index parsed as number - 1 of {_gatya} to loop-value
  102. open {_gatya} to player
  103. if event-item is {gatya.k}:
  104. cancel event
  105. open chest with 1 row named "&6&lガチャ景品設定[レアリティ選択]" to player
  106. loop 9 time:
  107. if {gatya.rarity::%{gatya.setting.%player%}%::0} >= loop-number:
  108. set slot loop-number - 1 of player's current inventory to chest named "%{gatya.rarity::%{gatya.setting.%player%}%::%loop-number%}%" with lore "&a有効"
  109. else if {gatya.rarity::%{gatya.setting.%player%}%::0} < loop-number:
  110. set slot loop-number - 1 of player's current inventory to ender chest named "%{gatya.rarity::%{gatya.setting.%player%}%::%loop-number%}%" with lore "&c無効" and "&f景品設定はできますがガチャからは排出されません"
  111. # set {_gatya} to chest with 6 row named "&6&lガチャ景品設定"
  112. # loop {gatya.item::%{gatya.setting.%player%}%::*}:
  113. # set slot loop-index parsed as number - 1 of {_gatya} to loop-value
  114. # open {_gatya} to player
  115. if event-item is {gatya.n}:
  116. cancel event
  117. set {gatya.n.%player%} to true
  118. send "&a&lガチャの名前を入力してください"
  119. send "&l現在:[%{gatya.list::%{gatya.setting.%player%}%}%&f]"
  120. close event-player's inventory
  121. if event-item is {gatya.i}:
  122. cancel event
  123. #open chest with 1 row named "&6&lガチャアイテム" to player
  124. give chest named "%{gatya.list::%{gatya.setting.%player%}%}%" with lore "&f右クリックで開封" to player
  125. if event-item is {gatya.r}:
  126. cancel event
  127. open chest with 5 row named "&6&lガチャレアリティ設定" to player
  128. set {_chance} to paper named "&f全体比率"
  129. set {_chance2} to paper named "&f有効比率"
  130.  
  131. loop 9 time:
  132. add {gatya.rarity.chance::%{gatya.setting.%player%}%::%loop-number%} to {_all}
  133. if {gatya.rarity::%{gatya.setting.%player%}%::0} >= loop-number:
  134. add {gatya.rarity.chance::%{gatya.setting.%player%}%::%loop-number%} to {_all2}
  135. add "&f合計比率:&a%{_all}%" to lore of {_chance}
  136. add "&f合計比率:&a%{_all2}%" to lore of {_chance2}
  137. loop 9 time:
  138. set {_name} to {gatya.rarity::%{gatya.setting.%player%}%::%loop-number%}
  139. set {_size} to {gatya.rarity.chance::%{gatya.setting.%player%}%::%loop-number%}
  140. set {_percent} to {_size} / {_all} * 100
  141. set {_percent2} to {_size} / {_all2} * 100
  142. set slot loop-number + 26 of player's current inventory to name tag named "&f名前の変更" with lore "&f現在%{_name}%"
  143. if {gatya.rarity::%{gatya.setting.%player%}%::0} >= loop-number:
  144. set slot loop-number + 17 of player's current inventory to chest named "%{_name}%" with lore "&a有効"
  145. set slot loop-number + 8 of player's current inventory to yellow stained glass pane named "&f比率変更" with lore "&f現在:&e%{gatya.rarity.chance::%{gatya.setting.%player%}%::%loop-number%}%"
  146. add "%{_name}%:&e%{_size}%,(%{_percent}%%%)" to lore of {_chance}
  147. add "%{_name}%:&e%{_size}%,(%{_percent2}%%%)" to lore of {_chance2}
  148. else if {gatya.rarity::%{gatya.setting.%player%}%::0} < loop-number:
  149. set slot loop-number + 17 of player's current inventory to ender chest named "%{_name}%" with lore "&c無効" and "&fクリックで有効化"
  150. set slot loop-number + 8 of player's current inventory to red stained glass pane named "&f比率変更" with lore "&f現在:&e%{gatya.rarity.chance::%{gatya.setting.%player%}%::%loop-number%}%" and "&c無効 変更は可能ですが排出対象にはなりません"
  151. add "%{_name}%:&c%{_size}%,(%{_percent}%%%)" to lore of {_chance}
  152. set slot 0 of player's current inventory to {_chance}
  153. set slot 1 of player's current inventory to {_chance2}
  154.  
  155.  
  156.  
  157. if name of player's current inventory contain "&6&lガチャレアリティ設定":
  158. cancel event
  159. if event-item is name tag:
  160. set {gatya.R.N.%player%::status} to true
  161. set {gatya.R.N.%player%::index} to event-slot's index - 26
  162. send "&a&lレアリティの名前を入力してください"
  163. send "&l現在:[%{gatya.rarity::%{gatya.setting.%player%}%::%{gatya.R.N.%player%::index}%}%&f&l]"
  164. close event-player's inventory
  165. if event-item is yellow stained glass pane or red stained glass pane:
  166. set {gatya.R.C.%player%::status} to true
  167. set {gatya.R.C.%player%::index} to event-slot's index - 8
  168. send "&a&l%{gatya.rarity::%{gatya.setting.%player%}%::%{gatya.R.N.%player%::index}%}%の排出比率を入力してください"
  169. send "&l現在:[%{gatya.rarity.chance::%{gatya.setting.%player%}%::%{gatya.R.C.%player%::index}%}%&f&l]"
  170. send "&c※数字が大きいほど排出されやすくなります"
  171. close event-player's inventory
  172.  
  173. if event-item is chest or ender chest:
  174. set {_slot} to event-slot's index - 17
  175. set {gatya.rarity::%{gatya.setting.%player%}%::0} to {_slot}
  176. set {_chance} to paper named "&f全体比率"
  177. set {_chance2} to paper named "&f有効比率2"
  178. loop 9 time:
  179. add {gatya.rarity.chance::%{gatya.setting.%player%}%::%loop-number%} to {_all}
  180. if {gatya.rarity::%{gatya.setting.%player%}%::0} >= loop-number:
  181. add {gatya.rarity.chance::%{gatya.setting.%player%}%::%loop-number%} to {_all2}
  182. add "&f合計比率:&a%{_all}%" to lore of {_chance}
  183. add "&f合計比率:&a%{_all2}%" to lore of {_chance2}
  184. loop 9 time:
  185. set {_name} to {gatya.rarity::%{gatya.setting.%player%}%::%loop-number%}
  186. set {_size} to {gatya.rarity.chance::%{gatya.setting.%player%}%::%loop-number%}
  187. set {_percent} to {_size} / {_all} * 100
  188. set {_percent2} to {_size} / {_all2} * 100
  189. set slot loop-number + 26 of player's current inventory to name tag named "&f名前の変更"
  190. if {gatya.rarity::%{gatya.setting.%player%}%::0} >= loop-number:
  191. set slot loop-number + 17 of player's current inventory to chest named "%{_name}%" with lore "&a有効"
  192. set slot loop-number + 8 of player's current inventory to yellow stained glass pane named "&f比率変更" with lore "&f現在:&e%{gatya.rarity.chance::%{gatya.setting.%player%}%::%loop-number%}%"
  193. add "%{_name}%:&e%{_size}%,(%{_percent}%%%)" to lore of {_chance}
  194. add "%{_name}%:&e%{_size}%,(%{_percent2}%%%)" to lore of {_chance2}
  195. else if {gatya.rarity::%{gatya.setting.%player%}%::0} < loop-number:
  196. set slot loop-number + 17 of player's current inventory to ender chest named "%{_name}%" with lore "&c無効" and "&fクリックで有効化"
  197. set slot loop-number + 8 of player's current inventory to red stained glass pane named "&f比率変更" with lore "&f現在:&e%{gatya.rarity.chance::%{gatya.setting.%player%}%::%loop-number%}%" and "&a無効 変更は可能ですが排出対象にはなりません"
  198. add "%{_name}%:&c%{_size}%,(%{_percent}%%%)" to lore of {_chance}
  199. set slot 0 of player's current inventory to {_chance}
  200. set slot 1 of player's current inventory to {_chance2}
  201.  
  202. if name of player's current inventory contain "&6&lガチャ景品一覧":
  203. if event-item is chest:
  204. cancel event
  205. set {gatya.view.%player%} to event-slot's index + 1
  206. set {_gatya} to chest with 6 row named "&6&l[%{gatya.rarity::%{gatya.using.%player%}%::%{gatya.view.%player%}%}%&6&l]景品一覧"
  207. loop {gatya.item::%{gatya.using.%player%}%::%{gatya.view.%player%}%::*}:
  208. set slot loop-index parsed as number - 1 of {_gatya} to loop-value
  209. open {_gatya} to player
  210. on inventory close:
  211. if name of event-inventory is "&6&l景品設定[%{gatya.rarity::%{gatya.setting.%player%}%::%{gatya.item.%player%}%}%]":
  212. set {_n} to {gatya.setting.%player%}
  213. set {_gatyanum} to 1
  214. #set {gatya-num} to 0
  215. delete {gatya.item::%{gatya.setting.%player%}%::%{gatya.item.%player%}%::*}
  216. loop 54 times:
  217. set {gatya.item::%{_n}%::%{gatya.item.%player%}%::%{_gatyanum}%} to slot loop-number - 1 of event-inventory
  218. if {gatya.item::%{_n}%::%{gatya.item.%player%}%::%{_gatyanum}%} is not air:
  219. add 1 to {_gatyanum}
  220. #add 1 to {gatya-num}
  221. else if {gatya.item::%{_n}%::%{gatya.item.%player%}%::%{_gatyanum}%} is air:
  222. delete {gatya.item::%{_n}%::%{gatya.item.%player%}%::%{_gatyanum}%}
  223.  
  224.  
  225. on left click:
  226. if player's tool is chest:
  227. set {_n} to event-item's name
  228. loop {gatya.list::*}:
  229. set {_l} to loop-index
  230. if {gatya.list::%{_l}%} is {_n}:
  231. set {gatya.using.%player%} to loop-index parsed as number
  232. open chest with 1 row named "&6&lガチャ景品一覧" to player
  233. loop 9 time:
  234. if {gatya.rarity::%{gatya.using.%player%}%::0} >= loop-number:
  235. add {gatya.rarity.chance::%{gatya.using.%player%}%::%loop-number%} to {_all2}
  236. loop 9 time:
  237. set {_size} to {gatya.rarity.chance::%{gatya.using.%player%}%::%loop-number%}
  238. set {_percent2} to {_size} / {_all2} * 100
  239. if {gatya.rarity::%{gatya.using.%player%}%::0} >= loop-number:
  240. set slot loop-number - 1 of player's current inventory to chest named "%{gatya.rarity::%{gatya.using.%player%}%::%loop-number%}%" with lore "&e&l排出確率:%{_percent2}%%%"
  241.  
  242. on right click:
  243. if player's tool is chest:
  244. set {_n} to event-item's name
  245. loop {gatya.list::*}:
  246. set {_l} to loop-index
  247. if {gatya.list::%{_l}%} is {_n}:
  248. send "%{_n}%"
  249. remove 1 of event-item from player
  250. play sound "entity.experience_orb.pickup" with volume 0.5 to the player
  251. loop 9 time:
  252. if {gatya.rarity::%{_l}%::0} >= loop-number:
  253. add {gatya.rarity.chance::%{_l}%::%loop-number%} to {_all}
  254. set {_r} to random integer between 1 and {_all}
  255. loop 9 time:
  256. add {gatya.rarity.chance::%{_l}%::%loop-number%} to {_p1} if 1 >= loop-number
  257. add {gatya.rarity.chance::%{_l}%::%loop-number%} to {_p2} if 2 >= loop-number
  258. add {gatya.rarity.chance::%{_l}%::%loop-number%} to {_p3} if 3 >= loop-number
  259. add {gatya.rarity.chance::%{_l}%::%loop-number%} to {_p4} if 4 >= loop-number
  260. add {gatya.rarity.chance::%{_l}%::%loop-number%} to {_p5} if 5 >= loop-number
  261. add {gatya.rarity.chance::%{_l}%::%loop-number%} to {_p6} if 6 >= loop-number
  262. add {gatya.rarity.chance::%{_l}%::%loop-number%} to {_p7} if 7 >= loop-number
  263. add {gatya.rarity.chance::%{_l}%::%loop-number%} to {_p8} if 8 >= loop-number
  264. add {gatya.rarity.chance::%{_l}%::%loop-number%} to {_p9} if 9 >= loop-number
  265.  
  266.  
  267.  
  268. if {_r} <= {_p1}:
  269. set {_size} to size of {gatya.item::%{_l}%::1::*}
  270. set {_r2} to random integer between 1 and {_size}
  271. give {gatya.item::%{_l}%::1::%{_r2}%} to player
  272. send "%{gatya.rarity::%{_l}%::1}%" to player
  273. else if {_r} <= {_p2}:
  274. send "%{gatya.rarity::%{_l}%::2}%" to player
  275. set {_size} to size of {gatya.item::%{_l}%::2::*}
  276. set {_r2} to random integer between 1 and {_size}
  277. give {gatya.item::%{_l}%::2::%{_r2}%} to player
  278. else if {_r} <= {_p3}:
  279. send "%{gatya.rarity::%{_l}%::3}%" to player
  280. set {_size} to size of {gatya.item::%{_l}%::3::*}
  281. set {_r2} to random integer between 1 and {_size}
  282. give {gatya.item::%{_l}%::3::%{_r2}%} to player
  283. else if {_r} <= {_p4}:
  284. send "%{gatya.rarity::%{_l}%::4}%" to player
  285. set {_size} to size of {gatya.item::%{_l}%::4::*}
  286. set {_r2} to random integer between 1 and {_size}
  287. give {gatya.item::%{_l}%::4::%{_r2}%} to player
  288. else if {_r} <= {_p5}:
  289. send "%{gatya.rarity::%{_l}%::5}%" to player
  290. set {_size} to size of {gatya.item::%{_l}%::5::*}
  291. set {_r2} to random integer between 1 and {_size}
  292. give {gatya.item::%{_l}%::5::%{_r2}%} to player
  293. else if {_r} <= {_p6}:
  294. send "%{gatya.rarity::%{_l}%::6}%" to player
  295. set {_size} to size of {gatya.item::%{_l}%::6::*}
  296. set {_r2} to random integer between 1 and {_size}
  297. give {gatya.item::%{_l}%::6::%{_r2}%} to player
  298. else if {_r} <= {_p7}:
  299. send "%{gatya.rarity::%{_l}%::7}%" to player
  300. set {_size} to size of {gatya.item::%{_l}%::7::*}
  301. set {_r2} to random integer between 1 and {_size}
  302. give {gatya.item::%{_l}%::7::%{_r2}%} to player
  303. else if {_r} <= {_p8}:
  304. send "%{gatya.rarity::%{_l}%::8}%" to player
  305. set {_size} to size of {gatya.item::%{_l}%::8::*}
  306. set {_r2} to random integer between 1 and {_size}
  307. give {gatya.item::%{_l}%::8::%{_r2}%} to player
  308. else if {_r} <= {_p9}:
  309. send "%{gatya.rarity::%{_l}%::9}%" to player
  310. set {_size} to size of {gatya.item::%{_l}%::9::*}
  311. set {_r2} to random integer between 1 and {_size}
  312. give {gatya.item::%{_l}%::9::%{_r2}%} to player
  313. on click:
  314. if player's tool is stone:
  315. set {_i} to event-items's name
  316. send "%{gatya.list::%{_i}%}%"
  317. if player's tool is stick:
  318. send "&b%{gatya.list::*}%"
  319. send "&c{gatya.setting.%player%}:%{gatya.setting.%player%}%"
  320. if player's tool is iron ingot:
  321. loop 54 time:
  322. send "&c{gatya.item::%{gatya.setting.%player%}%::%{gatya.item.%player%}%::*}:%{gatya.item::%{gatya.setting.%player%}%::%{gatya.item.%player%}%::%loop-number%}%"
  323. if player's tool is golden sword:
  324. make player execute command "/gatya list"
  325.  
  326.  
  327.  
Advertisement
Add Comment
Please, Sign In to add comment