Advertisement
Guest User

Untitled

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