Advertisement
xNawi

Case opening 1.0

May 19th, 2015
821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.82 KB | None | 0 0
  1. options:
  2. tag: &8[&6Case&8]
  3. chance key: 0.1
  4. chance chest: 1
  5. method "list" {player}:
  6. set {_1} to arg{1};
  7. open chest with 6 rows named "&6&lLista skrzynek:" to {_1}
  8. wait 1 tick
  9. loop {case::chestlist::*}:
  10. set {_case%loop-index%} to loop-value
  11. if {_case%loop-index%} contains "<none>":
  12. remove loop-value from {case::chestlist::*}
  13. delete {_case%loop-index%}
  14. loop (size of {case::chestlist::*}) times:
  15. format slot loop-number - 1 of {_1} with 1 of chest named "&6%{_case%loop-number%}%" to close
  16. method "opening" {player and case}:
  17. set {_1} to arg{1};
  18. set {_2} to arg{2};
  19. remove 1 tripwire hook named "&6Klucz do skrzyni &c%{_2}%" from {_1}'s inventory
  20. remove 1 chest named "&c%{_2}%" from {_1}'s inventory
  21. set {case::%{_1}%::open} to true
  22. open chest with 6 rows named "&6&lSkrzynia &c&l%{_2}%" to {_1}
  23. wait 1 tick
  24. loop {case::itemlist::%{_2}%::*}:
  25. set {_skin%loop-index%} to loop-value
  26. loop (size of {case::itemlist::%{_2}%::*}) times:
  27. format slot loop-number + 26 of {_1} with 1 of {_skin%loop-number%} to be unstealable
  28. loop 9 times:
  29. set {_item%loop-number%} to random element out of {case::itemlist::%{_2}%::*}
  30. format slot loop-number + 8 of {_1} with 1 of {_item%loop-number%} to be unstealable
  31. format slot loop-number - 1 of {_1} with 1 of black stained glass pane to be unstealable
  32. format slot loop-number + 17 of {_1} with 1 of black stained glass pane to be unstealable
  33. format slot 4 of {_1} with 1 of hopper to be unstealable
  34. play raw sound "random.pop" at {_1} with pitch 0.5 volume 1
  35. wait 1 seconds
  36. loop 20 times:
  37. if {case::%{_1}%::open} is true:
  38. loop loop-number times:
  39. wait 1 tick
  40. play raw sound "random.pop" at {_1} with pitch 1.5 volume 1
  41. loop 8 times:
  42. if {case::%{_1}%::open} is true:
  43. set {_item%loop-number-2%} to {_item%loop-number-2 + 1%}
  44. format slot loop-number-2 + 8 of {_1} with 1 of {_item%loop-number-2%} to be unstealable
  45. if {case::%{_1}%::open} is true:
  46. set {_item9} to random element out of {case::itemlist::%{_2}%::*}
  47. format slot 17 of {_1} with 1 of {_item9} to be unstealable
  48. wait 4 seconds
  49. if {case::%{_1}%::open} is true:
  50. open chest with 1 rows named "&6&lWygrales:" to {_1}
  51. wait 1 tick
  52. give {_1} {_item5}
  53. format slot 4 of {_1} with 1 of {_item5} to close
  54. play raw sound "mob.endermen.portal" at {_1} with pitch 0.001 volume 1
  55. command /case [<text>] [<text>] [<text>]:
  56. trigger:
  57. if player has permission "case.*":
  58. if arg 1 is not set:
  59. execute player command "/case null"
  60. if arg 1 is not "add" or "remove" or "additem" or "removeitem" or "givekey" or "givechest" or "list" or "method":
  61. send "{@tag}"
  62. send "&6/case add <name> &8- &7dodaje nowa skrzynke"
  63. send "&6/case remove <name> &8- &7usuwa skrzynke"
  64. send "&6/case additem <name> &8- &7dodaje do skrzynki przedmiot trzymany w rece"
  65. send "&6/case removeitem <name> &8- &7usuwa z skrzynki przedmiot trzymany w rece"
  66. send "&6/case givekey <name> &8- &7daje nam klucz do skrzyni"
  67. send "&6/case givechest <name> &8- &7daje nam skrzynie"
  68. send "&6/case list &8- &7lista skrzyń w gui"
  69. if arg 1 is "add":
  70. if arg 2 is set:
  71. loop {case::chestlist::*}:
  72. if loop-value is arg 2:
  73. send "{@tag} &7Taka skrzynia juz istnieje!"
  74. stop
  75. add arg 2 to {case::chestlist::*}
  76. send "{@tag} &7Dodano skrzynie o nazwie &6%arg 2%&7."
  77. else:
  78. send "&6/case add <name>"
  79. if arg 1 is "remove":
  80. if arg 2 is set:
  81. loop {case::chestlist::*}:
  82. if loop-value is arg 2:
  83. remove arg 2 from {case::chestlist::*}
  84. delete {case::itemlist::%arg 2%::*}
  85. send "{@tag} &7Usunieto skrzynie o nazwie &6%arg 2%&7."
  86. stop
  87. send "{@tag} &7Taka skrzynia nie istnieje!"
  88. else:
  89. send "&6/case remove <name>"
  90. if arg 1 is "additem":
  91. if arg 2 is set:
  92. loop {case::chestlist::*}:
  93. if loop-value is arg 2:
  94. if {case::itemlist::%arg 2%::*} contains player's tool:
  95. send "{@tag} &7Ta skrzynka zawiera już taki przedmiot!"
  96. stop
  97. add player's tool to {case::itemlist::%arg 2%::*}
  98. send "{@tag} &7Dodano &6%player's tool%&7 do skrzyni &6%arg 2%&7."
  99. stop
  100. send "{@tag} &7Taka skrzynia nie istnieje!"
  101. else:
  102. send "&6/case additem <name>"
  103. if arg 1 is "removeitem":
  104. if arg 2 is set:
  105. loop {case::chestlist::*}:
  106. if loop-value is arg 2:
  107. if {case::itemlist::%arg 2%::*} contains player's tool:
  108. remove player's tool from {case::itemlist::%arg 2%::*}
  109. send "{@tag} &7Usunieto &6%player's tool%&7 ze skrzyni &6%arg 2%&7."
  110. stop
  111. send "{@tag} &7W tej skrzynce nie ma takiego przedmiotu!"
  112. stop
  113. send "{@tag} &7Taka skrzynia nie istnieje!"
  114. else:
  115. send "&6/case removeitem <name>"
  116. if arg 1 is "givekey":
  117. if arg 2 is set:
  118. loop {case::chestlist::*}:
  119. if loop-value is arg 2:
  120. add 1 tripwire hook named "&6Klucz do skrzyni &c%arg 2%" to player's inventory
  121. stop
  122. send "{@tag} &7Taka skrzynia nie istnieje!"
  123. else:
  124. send "&6/case givekey <name>"
  125. if arg 1 is "givechest":
  126. if arg 2 is set:
  127. loop {case::chestlist::*}:
  128. if loop-value is arg 2:
  129. add 1 chest named "&c%arg 2%" to player's inventory
  130. stop
  131. send "{@tag} &7Taka skrzynia nie istnieje!"
  132. else:
  133. send "&6/case givechest <name>"
  134. if arg 1 is "list":
  135. function "list" {player};
  136. if arg 1 is "method":
  137. set {_player} to arg 3 parsed as player
  138. if {_player}'s inventory contains tripwire hook named "&6Klucz do skrzyni &c%arg 2%":
  139. if {_player}'s inventory contains chest named "&c%arg 2%":
  140. function "opening" {{_player} and arg 2};
  141. else:
  142. send "{@tag} &7Nie posiadasz tej skrzyni!" to {_player}
  143. else:
  144. send "{@tag} &7Nie posiadasz klucza do tej skrzyni!" to {_player}
  145. on inventory close:
  146. if {case::%player%::open} is true:
  147. set {case::%player%::open} to false
  148. on quit:
  149. if {case::%player%::open} is true:
  150. set {case::%player%::open} to false
  151. on right click:
  152. if player's tool is chest:
  153. loop {case::chestlist::*}:
  154. if loop-value is uncolored name of player's tool:
  155. cancel event
  156. execute player command "case method %uncolored name of player's tool% %player%"
  157. if player's tool is tripwire hook:
  158. if name of player's tool contains "&6Klucz do skrzyni":
  159. cancel event
  160. function "list" {player};
  161. on mine of stone:
  162. if {case:chestlist::*} is set:
  163. chance of {@chance chest}%:
  164. set {_x} to random element out of {case::chestlist::*}
  165. drop chest named "%{_x}%"
  166. play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
  167. chance of {@chance key}%:
  168. set {_x} to random element out of {case::chestlist::*}
  169. drop tripwire hook named "&6Klucz do skrzyni &c%{_x}%"
  170. play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement