xMichuHDx

Untitled

Aug 7th, 2016
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.85 KB | None | 0 0
  1. # Case opening 2.0
  2.  
  3. # Author: xMichuHDx
  4. # Contact: [email protected]
  5.  
  6. variables:
  7. {case::player::%player%::open} = false
  8. {case::player::%player%::openwait} = false
  9.  
  10. options:
  11.  
  12. # General
  13.  
  14. tag: &8[&6Case&8] # Przedrostek wiadomosci
  15. preview items: true
  16. chest list gui: true
  17. permission: case.*
  18.  
  19. # Drop case
  20.  
  21. chance drop key: 1% # Szansa na wykopanie klucza podana w procentach
  22. chance drop chest: 2% # Szansa na wykopanie skrzyni podana w procentach
  23. block drop: stone or dirt or gravel # Z jakiego bloku mozna wykopac skrzynie/klucz
  24.  
  25. chance death key: 2% # Szansa na wypadniecie klucza po zabiciu gracza
  26. chance death chest: 4% # Szansa na wypadniecie skrzyni po zabiciu gracza
  27.  
  28. # Colour message:
  29.  
  30. important: &6
  31. general: &7
  32. leere: &8
  33.  
  34. lore: &c
  35.  
  36. command /case [<text="help">] [<text>] [<text>] [<text>]:
  37. trigger:
  38. if player has permission "{@permission}":
  39. if arg 1 is "help":
  40. send "{@tag}"
  41. send "{@important}/case add <name> <type> {@leere}- {@general}Dodaje nowa skrzynke."
  42. send "{@important}/case remove <name> {@leere}- {@general}Usuwa skrzynke."
  43. send "{@important}/case edit <name> {@leere}- {@general}Edytuje zawartosc skrzyni."
  44. send "{@important}/case give <name> [<player/all>] [<number>] {@leere}- {@general}Daje nam klucz i skrzynie."
  45. send "{@important}/case list {@leere}- {@general}Lista skrzyn w gui."
  46. send "{@important}/case stats [<player>] {@leere}- {@general}Statystyki gracza."
  47. send "{@important}/case open <name> [<player>] {@leere}- {@general}Recznie otwiera skrzynie."
  48. if arg 1 is "add":
  49. if arg 2 is set:
  50. set {_name} to arg 2
  51. replace all "_" with " " in {_name}
  52. loop {case::chestlist::*}:
  53. if loop-value is {_name}:
  54. send "{@tag} {@general}Taka skrzynia juz istnieje!"
  55. stop
  56. if arg 3 is set:
  57. set {_type} to arg 3
  58. if {_type} is "key" or "notkey":
  59. add {_name} to {case::chestlist::*}
  60. send "{@tag} {@general}Dodano skrzynie o nazwie {@important}%{_name}%{@general}."
  61. if {_type} is "key":
  62. set {case::type::%{_name}%} to "key"
  63. send "{@tag} {@general}Skrzynia wymaga klucza."
  64. if {_type} is "notkey":
  65. set {case::type::%{_name}%} to "notkey"
  66. send "{@tag} {@general}Skrzynia nie wymaga klucza."
  67. else:
  68. send "{@tag} {@important}/case add <name> <type=""key""or""notkey""> "
  69. else:
  70. send "{@tag} {@important}/case add <name> <type=""key""or""notkey""> "
  71. else:
  72. send "{@tag} {@important}/case add <name> <type=""key""or""notkey""> "
  73. if arg 1 is "remove":
  74. if arg 2 is set:
  75. set {_name} to arg 2
  76. replace all "_" with " " in {_name}
  77. loop {case::chestlist::*}:
  78. if loop-value is {_name}:
  79. remove {_name} from {case::chestlist::*}
  80. delete {case::%{_name}%::itemlist::*}
  81. delete {case::type::%{_name}%}
  82. send "{@tag} {@general}Usunieto skrzynie o nazwie {@important}%{_name}%{@general}."
  83. stop
  84. send "{@tag} {@general}Taka skrzynia nie istnieje!"
  85. else:
  86. send "{@tag} {@important}/case remove <name>"
  87. if arg 1 is "edit":
  88. if arg 2 is set:
  89. set {_name} to arg 2
  90. replace all "_" with " " in {_name}
  91. loop {case::chestlist::*}:
  92. if loop-value is {_name}:
  93. open chest with 3 rows named "{@important}Edytujesz: {@lore}%{_name}%" to player
  94. wait 1 tick
  95. set {_slot} to 0
  96. loop {case::%{_name}%::itemlist::*}:
  97. set slot {_slot} of current inventory of player to loop-value-2
  98. add 1 to {_slot}
  99. set {case::player::%player%::openedit} to "%{_name}%"
  100. send "{@tag} {@general}Edytujesz zawartosc skrzyni {@important}%{_name}%{@general}." to player
  101. while inventory name of player is "{@important}Edytujesz: {@lore}%{_name}%":
  102. set {case::player::%player%::openedit} to "%{_name}%"
  103. wait 5 tick
  104. stop
  105. send "{@tag} {@general}Taka skrzynia nie istnieje!"
  106. else:
  107. send "{@tag} {@important}/case additem <name>"
  108. if arg 1 is "give":
  109. if arg 2 is set:
  110. set {_name} to arg 2
  111. replace all "_" with " " in {_name}
  112. loop {case::chestlist::*}:
  113. if loop-value is {_name}:
  114. set {_lore} to "%{case::%{_name}%::itemlist::*}%"
  115. replace all ", " with "|| {@leere}- {@lore}" in {_lore}
  116. replace all "and " with "|| {@leere}- {@lore}" in {_lore}
  117. if arg 3 is set:
  118. set {_type} to arg 3
  119. if arg 4 is set:
  120. set {_number} to arg 4 parsed as integer
  121. else:
  122. set {_number} to 64
  123. if {_type} is "all":
  124. loop all players:
  125. if {case::type::%{_name}%} is "key":
  126. add {_number} of chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to loop-player's inventory
  127. add {_number} of tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_name}%" to loop-player's inventory
  128. else if {case::type::%{_name}%} is "notkey":
  129. add {_number} of ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to loop-player's inventory
  130. if {_type} is not "all":
  131. set {_player} to {_type} parsed as offlineplayer
  132. if {case::type::%{_name}%} is "key":
  133. add {_number} of chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to {_player}'s inventory
  134. add {_number} of tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_name}%" to {_player}'s inventory
  135. else if {case::type::%{_name}%} is "notkey":
  136. add {_number} of ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to {_player}'s inventory
  137. else:
  138. if {case::type::%{_name}%} is "key":
  139. add 64 of chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to player's inventory
  140. add 64 of tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_name}%" to player's inventory
  141. else:
  142. add 64 of ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to player's inventory
  143. stop
  144. send "{@tag} {@general}Taka skrzynia nie istnieje!"
  145. else:
  146. send "{@tag} {@important}/case give <name> [<type=""%%player%%""or""all"">] [<number>]"
  147. if arg 1 is "list":
  148. open chest with 6 rows named "{@important}Lista skrzynek:" to player
  149. wait 1 tick
  150. set {_slot} to 0
  151. loop {case::chestlist::*}:
  152. if loop-value contains "<none>":
  153. remove loop-value from {case::chestlist::*}
  154. set {_} to {@chest list gui}
  155. if {_} is "true":
  156. set {_lore} to "%{case::%loop-value%::itemlist::*}%"
  157. set {_name%loop-index%} to loop-value
  158. replace all ", " with "|| {@leere}- {@lore}" in {_lore}
  159. replace all "and " with "|| {@leere}- {@lore}" in {_lore}
  160. replace all " " with "_" in {_name%loop-index%}
  161. if {case::type::%loop-value%} is "key":
  162. format slot {_slot} of player with 1 of chest named "{@important}%loop-value%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to run [close player's inventory]->[wait 2 tick]->[execute player command "case open %{_name%{_slot}%}%"]
  163. else:
  164. format slot {_slot} of player with 1 of ender chest named "{@important}%loop-value%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to run [close player's inventory]->[wait 2 tick]->[execute player command "case open %{_name%{_slot}%}%"]
  165. add 1 to {_slot}
  166. wait 1 tick
  167. send "{@leere}%loop-index%. {@important}%loop-value%"
  168. if arg 1 is "stats":
  169. if arg 2 is set:
  170. set {_player} to arg 2 parsed as player
  171. else:
  172. set {_player} to player
  173. send "{@tag} {@general}Otworzone skrzynie gracza {@important}%{_player}%{@general}:"
  174. loop {case::chestlist::*}:
  175. if {case::player::%{_player}%::stats::%loop-value%} is set:
  176. send " {@important}%loop-value%{@leere}: {@general}%{case::player::%{_player}%::stats::%loop-value%}%"
  177. else:
  178. send " {@important}%loop-value%{@leere}: {@general}0"
  179. if arg 1 is "open":
  180. if arg 2 is set:
  181. if arg 3 is set:
  182. if player has permission "{@permission}":
  183. set {_player} to arg 3 parsed as player
  184. else:
  185. send "{@tag} {@general}Nie posiadasz uprawnien!"
  186. else:
  187. set {_player} to player
  188. set {_name} to arg 2
  189. replace all "_" with " " in {_name}
  190. loop {case::chestlist::*}:
  191. if loop-value is {_name}:
  192. set {_lore} to "%{case::%loop-value%::itemlist::*}%"
  193. replace all ", " with "|| {@leere}- {@lore}" in {_lore}
  194. replace all "and " with "|| {@leere}- {@lore}" in {_lore}
  195. set lore of player's tool to " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || "
  196. if {case::type::%{_name}%} is "key":
  197. if {_player}'s inventory contains tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_name}%":
  198. if {_player}'s inventory contains chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || ":
  199. if {case::player::%{_player}%::openwait} is true:
  200. send "{@tag} {@general}Juz otwierasz skrzynie!" to {_player}
  201. else:
  202. if (size of {case::%{_name}%::itemlist::*}) > 0:
  203. add 1 to {case::player::%{_player}%::stats::%{_name}%}
  204. remove 1 tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_name}%" from {_player}'s inventory
  205. remove 1 chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " from {_player}'s inventory
  206. set {case::player::%{_player}%::open} to true
  207. set {case::player::%{_player}%::openwait} to true
  208. set {_preview} to "{@preview items}"
  209. if {_preview} is "true":
  210. open chest with 6 rows named "{@important}Skrzynia {@lore}%{_name}%" to {_player}
  211. set {_slot} to 0
  212. if {_slot} < 27:
  213. loop {case::%{_name}%::itemlist::*}:
  214. if {case::player::%{_player}%::open} is true:
  215. add 1 to {_slot}
  216. format slot {_slot} + 26 of {_player} with loop-value-2 to be unstealable
  217. wait 1 tick
  218. else if {_preview} is "false":
  219. open chest with 3 rows named "{@important}Skrzynia {@lore}%{_name}%" to {_player}
  220. wait 1 tick
  221. loop 9 times:
  222. set {_item%loop-number%} to random element out of {case::%{_name}%::itemlist::*}
  223. format slot loop-number + 8 of {_player} with {_item%loop-number%} to be unstealable
  224. format slot loop-number - 1 of {_player} with 1 of black stained glass pane to be unstealable
  225. format slot loop-number + 17 of {_player} with 1 of black stained glass pane to be unstealable
  226. format slot 4 of {_player} with 1 of hopper to be unstealable
  227. set {_random} to random integer between 20 and 30
  228. wait 1 seconds
  229. loop {_random} times:
  230. if loop-number > 15:
  231. loop loop-number - 12 times:
  232. wait 1 tick
  233. else:
  234. wait 3 tick
  235. play raw sound "mob.skeleton.death" at {_player} with pitch 8 volume 1
  236. loop 8 times:
  237. set {_item%loop-number-2%} to {_item%loop-number-2 + 1%}
  238. if {case::player::%{_player}%::open} is true:
  239. format slot loop-number-2 + 8 of {_player} with {_item%loop-number-2%} to be unstealable
  240. set {_item9} to random element out of {case::%{_name}%::itemlist::*}
  241. if {case::player::%{_player}%::open} is true:
  242. format slot 17 of {_player} with {_item9} to be unstealable
  243. set {case::player::%{_player}%::open} to false
  244. wait 3 seconds
  245. broadcast "{@tag} {@general}Gracz {@important}%{_player}% {@general}wylosowal {@important}%{_item5}% {@general}ze skrzyni {@important}%{_name}%{@general}. Gratulacje!"
  246. launch flickering trailing ball firework colored green at {_player} timed 1
  247. add {_item5} to {_player}'s inventory
  248. play raw sound "mob.endermen.portal" at {_player} with pitch 0.1 volume 1
  249. set {case::player::%{_player}%::openwait} to false
  250. else:
  251. send "{@tag} {@general}W tej skrzyni nie mozna nic wylosowac!" to {_player}
  252. else:
  253. send "{@tag} {@general}Nie posiadasz tej skrzyni!" to {_player}
  254. else:
  255. send "{@tag} {@general}Nie posiadasz klucza do tej skrzyni!" to {_player}
  256. else:
  257. if {_player}'s inventory contains ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || ":
  258. if {case::player::%{_player}%::openwait} is true:
  259. send "{@tag} {@general}Juz otwierasz skrzynie!" to {_player}
  260. else:
  261. if (size of {case::%{_name}%::itemlist::*}) > 0:
  262. add 1 to {case::player::%{_player}%::stats::%{_name}%}
  263. remove 1 ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " from {_player}'s inventory
  264. set {case::player::%{_player}%::open} to true
  265. set {case::player::%{_player}%::openwait} to true
  266. set {_preview} to "{@preview items}"
  267. if {_preview} is "true":
  268. open chest with 6 rows named "{@important}Skrzynia {@lore}%{_name}%" to {_player}
  269. set {_slot} to 0 open
  270. if {_slot} < 27:
  271. loop {case::%{_name}%::itemlist::*}:
  272. if {case::player::%{_player}%::open} is true:
  273. add 1 to {_slot}
  274. format slot {_slot} + 26 of {_player} with loop-value-2 to be unstealable
  275. wait 1 tick
  276. else if {_preview} is "false":
  277. open chest with 3 rows named "{@important}Skrzynia {@lore}%{_name}%" to {_player}
  278. wait 1 tick
  279. loop 9 times:
  280. set {_item%loop-number%} to random element out of {case::%{_name}%::itemlist::*}
  281. format slot loop-number + 8 of {_player} with {_item%loop-number%} to be unstealable
  282. format slot loop-number - 1 of {_player} with 1 of black stained glass pane to be unstealable
  283. format slot loop-number + 17 of {_player} with 1 of black stained glass pane to be unstealable
  284. format slot 4 of {_player} with 1 of hopper to be unstealable
  285. set {_random} to random integer between 20 and 30
  286. wait 1 seconds
  287. loop {_random} times:
  288. if loop-number > 15:
  289. loop loop-number - 12 times:
  290. wait 1 tick
  291. else:
  292. wait 3 tick
  293. play raw sound "mob.skeleton.death" at {_player} with pitch 8 volume 1
  294. loop 8 times:
  295. set {_item%loop-number-2%} to {_item%loop-number-2 + 1%}
  296. if {case::player::%{_player}%::open} is true:
  297. format slot loop-number-2 + 8 of {_player} with {_item%loop-number-2%} to be unstealable
  298. set {_item9} to random element out of {case::%{_name}%::itemlist::*}
  299. if {case::player::%{_player}%::open} is true:
  300. format slot 17 of {_player} with {_item9} to be unstealable
  301. set {case::player::%{_player}%::open} to false
  302. wait 3 seconds
  303. broadcast "{@tag} {@general}Gracz {@important}%{_player}% {@general}wylosowal {@important}%{_item5}% {@general}ze skrzyni {@important}%{_name}%{@general}. Gratulacje!"
  304. launch flickering trailing ball firework colored green at {_player} timed 1
  305. add {_item5} to {_player}'s inventory
  306. play raw sound "mob.endermen.portal" at {_player} with pitch 0.1 volume 1
  307. set {case::player::%{_player}%::openwait} to false
  308. else:
  309. send "{@tag} {@general}W tej skrzyni nie mozna nic wylosowac!" to {_player}
  310. else:
  311. send "{@tag} {@general}Nie posiadasz tej skrzyni!" to {_player}
  312. stop
  313. send "{@tag} {@general}Taka skrzynia nie istnieje!" to {_player}
  314. on inventory close:
  315. if {case::player::%player%::open} is true:
  316. set {case::player::%player%::open} to false
  317. send "{@tag} {@general}Zamknieto podglad losowania."
  318. if {case::player::%player%::openedit} is set:
  319. clear {case::%{case::player::%player%::openedit}%::itemlist::*}
  320. loop 53 times:
  321. if slot "%loop-number - 1%" parsed as an integer of current inventory of player is not air:
  322. set {_item} to slot loop-number - 1 of current inventory of player
  323. add {_item} to {case::%{case::player::%player%::openedit}%::itemlist::*}
  324. clear {case::player::%player%::openedit}
  325. send "{@tag} {@general}Zapisano."
  326. on quit:
  327. set {case::player::%player%::open} to false
  328. set {case::player::%player%::openwait} to false
  329. clear {case::player::%player%::openedit}
  330. on death:
  331. set {case::player::%victim%::open} to false
  332. set {case::player::%victim%::openwait} to false
  333. clear {case::player::%player%::openedit}
  334. if attacker is a player:
  335. chance of {@chance death chest}:
  336. set {_element} to random element out of {case::chestlist::*}
  337. set {_lore} to "%{case::%{_element}%::itemlist::*}%"
  338. replace all ", " with "|| {@leere}- {@lore}" in {_lore}
  339. replace all "and " with "|| {@leere}- {@lore}" in {_lore}
  340. if {case::type::%{_element}%} is "key":
  341. drop chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " at location of victim
  342. else:
  343. drop ender chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " at location of victim
  344. chance of {@chance death key}:
  345. set {_element} to random element out of {case::chestlist::*}
  346. if {case::type::%{_element}%} is "notkey":
  347. drop tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_element}%" at location of victim
  348. on right click:
  349. if player's tool is chest or ender chest:
  350. loop {case::chestlist::*}:
  351. if uncolored name of player's tool is loop-value:
  352. cancel event
  353. set {_name} to uncolored name of player's tool
  354. replace all " " with "_" in {_name}
  355. execute player command "case open %{_name}%"
  356. stop
  357. if player's tool is tripwire hook:
  358. if name of player's tool contains "Klucz do skrzyni":
  359. cancel event
  360. open chest with 6 rows named "{@important}Lista skrzynek:" to player
  361. wait 1 tick
  362. set {_slot} to 0
  363. loop {case::chestlist::*}:
  364. if loop-value contains "<none>":
  365. remove loop-value from {case::chestlist::*}
  366. set {_lore} to "%{case::%loop-value%::itemlist::*}%"
  367. set {_name%loop-index%} to loop-value
  368. replace all ", " with "|| {@leere}- {@lore}" in {_lore}
  369. replace all "and " with "|| {@leere}- {@lore}" in {_lore}
  370. replace all " " with "_" in {_name%loop-index%}
  371. if {case::type::%loop-value%} is "key":
  372. format slot {_slot} of player with 1 of chest named "{@important}%loop-value%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to run [close player's inventory]->[wait 2 tick]->[execute player command "case open %{_name%{_slot}%}%"]
  373. else:
  374. format slot {_slot} of player with 1 of ender chest named "{@important}%loop-value%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " to run [close player's inventory]->[wait 2 tick]->[execute player command "case open %{_name%{_slot}%}%"]
  375. add 1 to {_slot}
  376. wait 1 tick
  377. on mine of {@block drop}:
  378. chance of {@chance drop chest}:
  379. set {_element} to random element out of {case::chestlist::*}
  380. set {_lore} to "%{case::%{_element}%::itemlist::*}%"
  381. replace all ", " with "|| {@leere}- {@lore}" in {_lore}
  382. replace all "and " with "|| {@leere}- {@lore}" in {_lore}
  383. if {case::type::%{_element}%} is "key":
  384. drop chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || "
  385. else:
  386. drop ender chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || "
  387. play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
  388. send "{@tag} {@general}Zdobyles skrzynie {@important}%{_element}%{@general}!"
  389. chance of {@chance drop key}:
  390. set {_element} to random element out of {case::chestlist::*}
  391. if {case::type::%{_element}%} is "key":
  392. drop tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_element}%"
  393. play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
  394. send "{@tag} {@general}Zdobyles klucz do skrzyni {@important}%{_element}%{@general}!"
Advertisement
Add Comment
Please, Sign In to add comment