Advertisement
xNawi

Case opening 2.0 English

Dec 18th, 2015
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.79 KB | None | 0 0
  1. # Author: Nawo
  2. # contact: romug1337@gmail.com
  3. # Presentation: http://www.mpcforum.pl/topic/1423401-skrypt-na-case-opening/
  4. # Launge: English
  5.  
  6. options:
  7. tag: &8[&6Case&8] # Prefix message
  8. chance key: 20 # Chance to drop key
  9. chance chest: 30 # Chance to drop chest
  10.  
  11. command /case [<text="null">] [<text>] [<text>] [<text>]:
  12. trigger:
  13. if player has permission "case.*":
  14. if arg 1 is not "add" or "remove" or "edit" or "give" or "list" or "method":
  15. send "{@tag}"
  16. send "&6/case add <name> &8- &7Add new case."
  17. send "&6/case remove <name> &8- &7Delete case."
  18. send "&6/case edit <name> &8- &7Edit case."
  19. send "&6/case give <name> [<player>] [<number>] &8- &7Give case and key."
  20. send "&6/case list &8- &7Case list."
  21. if arg 1 is "add":
  22. if arg 2 is set:
  23. loop {case::chestlist::*}:
  24. if loop-value is arg 2:
  25. send "{@tag} &7Box already exists!"
  26. stop
  27. add arg 2 to {case::chestlist::*}
  28. send "{@tag} &7Added chests named &6%arg 2%&7."
  29. else:
  30. send "&6/case add <name>"
  31. if arg 1 is "remove":
  32. if arg 2 is set:
  33. loop {case::chestlist::*}:
  34. if loop-value is arg 2:
  35. remove arg 2 from {case::chestlist::*}
  36. delete {case::%arg 2%::itemlist::*}
  37. send "{@tag} &7Removed boxes called &6%arg 2%&7."
  38. stop
  39. send "{@tag} &7Box does not exist!"
  40. else:
  41. send "&6/case remove <name>"
  42. if arg 1 is "edit":
  43. if arg 2 is set:
  44. loop {case::chestlist::*}:
  45. if loop-value is arg 2:
  46. open chest with 3 rows named "&6Editing: &c%arg 2%" to player
  47. wait 1 tick
  48. set {_slot} to 0
  49. loop {case::%arg 2%::itemlist::*}:
  50. set slot {_slot} of current inventory of player to loop-value-1
  51. add 1 to {_slot}
  52. set {case::player::%player%::openedit} to "%arg 2%"
  53. send "{@tag} &7Eediting &6%arg 2%&7." to player
  54. while inventory name of player is "&6Editing: &c%arg 2%":
  55. set {case::player::%player%::openedit} to "%arg 2%"
  56. wait 5 tick
  57. stop
  58. send "{@tag} &7Box does not exist!"
  59. else:
  60. send "&6/case additem <name>"
  61. if arg 1 is "give":
  62. if arg 2 is set:
  63. loop {case::chestlist::*}:
  64. if loop-value is arg 2:
  65. if arg 3 is set:
  66. set {_player} to arg 3 parsed as offlineplayer
  67. else:
  68. set {_player} to player
  69. if arg 4 is set:
  70. set {_number} to arg 4 parsed as integer
  71. else:
  72. set {_number} to 64 parsed as integer
  73. if {_player} is online:
  74. set {_lore} to "%{case::%arg 2%::itemlist::*}%"
  75. replace all ", " with "|| &8- &c" in {_lore}
  76. replace all "and " with "|| &8- &c" in {_lore}
  77. add {_number} chest named "&6%arg 2%" with lore " || &6In this box you can capturing: || || &8- &c%{_lore}% || " to {_player}'s inventory
  78. add {_number} tripwire hook named "&6Key to chest &c%arg 2%" to {_player}'s inventory
  79. stop
  80. send "{@tag} &7Box does not exist!"
  81. else:
  82. send "&6/case givechest <name>"
  83. if arg 1 is "list":
  84. open chest with 6 rows named "&6Chest list:" to player
  85. wait 1 tick
  86. loop {case::chestlist::*}:
  87. set {_case%loop-index%} to loop-value
  88. if {_case%loop-index%} contains "<none>":
  89. remove loop-value from {case::chestlist::*}
  90. delete {_case%loop-index%}
  91. loop (size of {case::chestlist::*}) times:
  92. set {_lore} to "%{case::%{_case%loop-number%}%::itemlist::*}%"
  93. replace all ", " with "|| &8- &c" in {_lore}
  94. replace all "and " with "|| &8- &c" in {_lore}
  95. format slot loop-number - 1 of player with 1 of chest named "&6%{_case%loop-number%}%" with lore " || &6In this box you can capturing: || || &8- &c%{_lore}% || " to close
  96. if arg 1 is "method":
  97. set {_player} to arg 3 parsed as player
  98. if {_player}'s inventory contains tripwire hook named "&6Key to chest &c%arg 2%":
  99. set {_lore} to "%{case::%arg 2%::itemlist::*}%"
  100. replace all ", " with "|| &8- &c" in {_lore}
  101. replace all "and " with "|| &8- &c" in {_lore}
  102. if {_player}'s inventory contains chest named "&6%arg 2%" with lore " || &6In this box you can capturing: || || &8- &c%{_lore}% || ":
  103. if {case::player::%player%::openwait} is true:
  104. send "{@tag} &7Already open boxes!" to {_player}
  105. else:
  106. set {_size} to size of {case::%arg 2%::itemlist::*}
  107. if {_size} > 0:
  108. remove 1 tripwire hook named "&6Key to chest &c%arg 2%" from {_player}'s inventory
  109. remove 1 chest named "&6%arg 2%" with lore " || &6In this box you can capturing: || || &8- &c%{_lore}% || " from {_player}'s inventory
  110. set {case::player::%{_player}%::open} to true
  111. set {case::player::%{_player}%::openwait} to true
  112. open chest with 6 rows named "&6Chest &c%arg 2%" to {_player}
  113. wait 1 tick
  114. loop {case::%arg 2%::itemlist::*}:
  115. set {_skin%loop-index%} to loop-value
  116. loop (size of {case::%arg 2%::itemlist::*}) times:
  117. format slot loop-number + 26 of {_player} with 1 of {_skin%loop-number%} to be unstealable
  118. loop 9 times:
  119. set {_item%loop-number%} to random element out of {case::%arg 2%::itemlist::*}
  120. format slot loop-number + 8 of {_player} with 1 of {_item%loop-number%} to be unstealable
  121. format slot loop-number - 1 of {_player} with 1 of black stained glass pane to be unstealable
  122. format slot loop-number + 17 of {_player} with 1 of black stained glass pane to be unstealable
  123. format slot 4 of {_player} with 1 of hopper to be unstealable
  124. set {_random} to random integer between 20 and 30
  125. wait 1 seconds
  126. loop {_random} times:
  127. if loop-number > 15:
  128. loop loop-number - 12 times:
  129. wait 1 tick
  130. else:
  131. wait 3 tick
  132. play raw sound "mob.skeleton.death" at {_player} with pitch 8 volume 1
  133. loop 8 times:
  134. set {_item%loop-number-2%} to {_item%loop-number-2 + 1%}
  135. if {case::player::%{_player}%::open} is true:
  136. format slot loop-number-2 + 8 of {_player} with 1 of {_item%loop-number-2%} to be unstealable
  137. set {_item9} to random element out of {case::%arg 2%::itemlist::*}
  138. if {case::player::%{_player}%::open} is true:
  139. format slot 17 of {_player} with 1 of {_item9} to be unstealable
  140. set {case::player::%{_player}%::open} to false
  141. wait 3 seconds
  142. open chest with 1 rows named "&6Wygrales:" to {_player}
  143. broadcast "{@tag} &7Player &6%{_player}% &7drew &6%{_item5}% &7from chest &6%arg 2%&7. Congratulations!"
  144. send "{@tag} &7Claim your prize." to {_player}
  145. wait 1 tick
  146. set slot 4 of current inventory of {_player} to {_item5}
  147. play raw sound "mob.endermen.portal" at {_player} with pitch 0.1 volume 1
  148. set {case::player::%{_player}%::openwait} to false
  149. else:
  150. send "{@tag} &7In this box you can not draw anything!" to {_player}
  151. else:
  152. send "{@tag} &7You do not have the box!" to {_player}
  153. else:
  154. send "{@tag} &7You do not have the key to that box!" to {_player}
  155. on inventory close:
  156. if {case::player::%player%::open} is true:
  157. set {case::player::%player%::open} to false
  158. send "{@tag} &7Closed draw preview."
  159. if {case::player::%player%::openedit} is set:
  160. clear {case::%{case::player::%player%::openedit}%::itemlist::*}
  161. loop 27 times:
  162. if slot "%loop-number - 1%" parsed as an integer of current inventory of player is not air:
  163. set {_item} to slot loop-number - 1 of current inventory of player
  164. add {_item} to {case::%{case::player::%player%::openedit}%::itemlist::*}
  165. clear {case::player::%player%::openedit}
  166. send "{@tag} &7Saved."
  167. on quit:
  168. if {case::player::%player%::open} is true:
  169. set {case::player::%player%::open} to false
  170. on death:
  171. if {case::player::%victim%::open} is true:
  172. set {case::player::%victim%::open} to false
  173. on right click:
  174. if player's tool is chest:
  175. loop {case::chestlist::*}:
  176. if loop-value is uncolored name of player's tool:
  177. cancel event
  178. set {_lore} to "%{case::%loop-value%::itemlist::*}%"
  179. replace all ", " with "|| &8- &c" in {_lore}
  180. replace all "and " with "|| &8- &c" in {_lore}
  181. set lore of player's tool to " || &6In this box you can capturing: || || &8- &c%{_lore}% || "
  182. execute player command "case method %uncolored name of player's tool% %player%"
  183. if player's tool is tripwire hook:
  184. if name of player's tool contains "Key to chest":
  185. cancel event
  186. open chest with 6 rows named "&6Chest list:" to player
  187. wait 1 tick
  188. loop {case::chestlist::*}:
  189. set {_case%loop-index%} to loop-value
  190. if {_case%loop-index%} contains "<none>":
  191. remove loop-value from {case::chestlist::*}
  192. delete {_case%loop-index%}
  193. loop (size of {case::chestlist::*}) times:
  194. set {_lore} to "%{case::%{_case%loop-number%}%::itemlist::*}%"
  195. replace all ", " with "|| &8- &c" in {_lore}
  196. replace all "and " with "|| &8- &c" in {_lore}
  197. format slot loop-number - 1 of player with 1 of chest named "&6%{_case%loop-number%}%" with lore " || &6In this box you can capturing: || || &8- &c%{_lore}% || " to close
  198. on mine of stone:
  199. chance of {@chance chest}%:
  200. set {_element} to random element out of {case::chestlist::*}
  201. set {_lore} to "%{case::%{_element}%::itemlist::*}%"
  202. replace all ", " with "|| &8- &c" in {_lore}
  203. replace all "and " with "|| &8- &c" in {_lore}
  204. drop chest named "&6%{_element}%" with lore " || &6In this box you can capturing: || || &8- &c%{_lore}% || "
  205. play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
  206. send "{@tag} &7You got chest &6%{_element}%&7!"
  207. chance of {@chance key}%:
  208. set {_element} to random element out of {case::chestlist::*}
  209. drop tripwire hook named "&6Key to chest &c%{_element}%"
  210. play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
  211. send "{@tag} &7You got key to chest &6%{_element}%&7!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement