Advertisement
xNawi

Case opening 2.0 update 13 (no wildskript)

Dec 20th, 2015
1,757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.11 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: 1% # Szansa na wykopanie klucza podana w procentach
  19. chance drop chest: 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: 2% # Szansa na wypadniecie klucza po zabiciu gracza
  23. chance death chest: 4% # 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. broadcast "{@tag} {@general}Gracz {@important}%{_player}% {@general}wylosowal {@important}%{_item5}% {@general}ze skrzyni {@important}%{_name}%{@general}. Gratulacje!"
  233. launch flickering trailing ball firework colored green at {_player} timed 1
  234. add {_item5} to {_player}'s inventory
  235. play raw sound "mob.endermen.portal" at {_player} with pitch 0.1 volume 1
  236. set {case::player::%{_player}%::openwait} to false
  237. else:
  238. send "{@tag} {@general}W tej skrzyni nie mozna nic wylosowac!" to {_player}
  239. else:
  240. send "{@tag} {@general}Nie posiadasz tej skrzyni!" to {_player}
  241. else:
  242. send "{@tag} {@general}Nie posiadasz klucza do tej skrzyni!" to {_player}
  243. else:
  244. if {_player}'s inventory contains ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || ":
  245. if {case::player::%{_player}%::openwait} is true:
  246. send "{@tag} {@general}Juz otwierasz skrzynie!" to {_player}
  247. else:
  248. if (size of {case::%{_name}%::itemlist::*}) > 0:
  249. add 1 to {case::player::%{_player}%::stats::%{_name}%}
  250. remove 1 ender chest named "{@important}%{_name}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " from {_player}'s inventory
  251. set {case::player::%{_player}%::open} to true
  252. set {case::player::%{_player}%::openwait} to true
  253. open chest with 6 rows named "{@important}Skrzynia {@lore}%{_name}%" to {_player}
  254. wait 1 tick
  255. loop 9 times:
  256. set {_item%loop-number%} to random element out of {case::%{_name}%::itemlist::*}
  257. format slot loop-number + 8 of {_player} with {_item%loop-number%} to be unstealable
  258. format slot loop-number - 1 of {_player} with 1 of black stained glass pane to be unstealable
  259. format slot loop-number + 17 of {_player} with 1 of black stained glass pane to be unstealable
  260. format slot 4 of {_player} with 1 of hopper to be unstealable
  261. set {_slot} to 0
  262. loop {case::%{_name}%::itemlist::*}:
  263. if {case::player::%{_player}%::open} is true:
  264. add 1 to {_slot}
  265. format slot {_slot} + 26 of {_player} with loop-value-2 to be unstealable
  266. wait 1 tick
  267. set {_random} to random integer between 20 and 30
  268. wait 1 seconds
  269. loop {_random} times:
  270. if loop-number > 15:
  271. loop loop-number - 12 times:
  272. wait 1 tick
  273. else:
  274. wait 3 tick
  275. play raw sound "mob.skeleton.death" at {_player} with pitch 8 volume 1
  276. loop 8 times:
  277. set {_item%loop-number-2%} to {_item%loop-number-2 + 1%}
  278. if {case::player::%{_player}%::open} is true:
  279. format slot loop-number-2 + 8 of {_player} with {_item%loop-number-2%} to be unstealable
  280. set {_item9} to random element out of {case::%{_name}%::itemlist::*}
  281. if {case::player::%{_player}%::open} is true:
  282. format slot 17 of {_player} with {_item9} to be unstealable
  283. set {case::player::%{_player}%::open} to false
  284. wait 3 seconds
  285. broadcast "{@tag} {@general}Gracz {@important}%{_player}% {@general}wylosowal {@important}%{_item5}% {@general}ze skrzyni {@important}%{_name}%{@general}. Gratulacje!"
  286. launch flickering trailing ball firework colored green at {_player} timed 1
  287. add {_item5} to {_player}'s inventory
  288. play raw sound "mob.endermen.portal" at {_player} with pitch 0.1 volume 1
  289. set {case::player::%{_player}%::openwait} to false
  290. else:
  291. send "{@tag} {@general}W tej skrzyni nie mozna nic wylosowac!" to {_player}
  292. else:
  293. send "{@tag} {@general}Nie posiadasz tej skrzyni!" to {_player}
  294. stop
  295. send "{@tag} {@general}Taka skrzynia nie istnieje!" to {_player}
  296. on inventory close:
  297. if {case::player::%player%::open} is true:
  298. set {case::player::%player%::open} to false
  299. send "{@tag} {@general}Zamknieto podglad losowania."
  300. if {case::player::%player%::openedit} is set:
  301. clear {case::%{case::player::%player%::openedit}%::itemlist::*}
  302. loop 27 times:
  303. if slot "%loop-number - 1%" parsed as an integer of current inventory of player is not air:
  304. set {_item} to slot loop-number - 1 of current inventory of player
  305. add {_item} to {case::%{case::player::%player%::openedit}%::itemlist::*}
  306. clear {case::player::%player%::openedit}
  307. send "{@tag} {@general}Zapisano."
  308. on quit:
  309. set {case::player::%player%::open} to false
  310. set {case::player::%player%::openwait} to false
  311. clear {case::player::%player%::openedit}
  312. on death:
  313. set {case::player::%victim%::open} to false
  314. set {case::player::%victim%::openwait} to false
  315. clear {case::player::%player%::openedit}
  316. if attacker is a player:
  317. chance of {@chance death chest}:
  318. set {_element} to random element out of {case::chestlist::*}
  319. set {_lore} to "%{case::%{_element}%::itemlist::*}%"
  320. replace all ", " with "|| {@leere}- {@lore}" in {_lore}
  321. replace all "and " with "|| {@leere}- {@lore}" in {_lore}
  322. if {case::type::%{_element}%} is "key":
  323. drop chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " at location of victim
  324. else:
  325. drop ender chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || " at location of victim
  326. chance of {@chance death key}:
  327. set {_element} to random element out of {case::chestlist::*}
  328. if {case::type::%{_element}%} is "notkey":
  329. drop tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_element}%" at location of victim
  330. on right click:
  331. if player's tool is chest or ender chest:
  332. loop {case::chestlist::*}:
  333. if uncolored name of player's tool is loop-value:
  334. cancel event
  335. set {_name} to uncolored name of player's tool
  336. replace all " " with "_" in {_name}
  337. execute player command "case open %{_name}%"
  338. stop
  339. if player's tool is tripwire hook:
  340. if name of player's tool contains "Klucz do skrzyni":
  341. cancel event
  342. open chest with 6 rows named "{@important}Lista skrzynek:" to player
  343. wait 1 tick
  344. set {_slot} to 0
  345. loop {case::chestlist::*}:
  346. if loop-value contains "<none>":
  347. remove loop-value from {case::chestlist::*}
  348. set {_lore} to "%{case::%loop-value%::itemlist::*}%"
  349. set {_name%loop-index%} to loop-value
  350. replace all ", " with "|| {@leere}- {@lore}" in {_lore}
  351. replace all "and " with "|| {@leere}- {@lore}" in {_lore}
  352. replace all " " with "_" in {_name%loop-index%}
  353. if {case::type::%loop-value%} is "key":
  354. 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}%}%"]
  355. else:
  356. 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}%}%"]
  357. add 1 to {_slot}
  358. wait 1 tick
  359. on mine of {@block drop}:
  360. chance of {@chance drop chest}:
  361. set {_element} to random element out of {case::chestlist::*}
  362. set {_lore} to "%{case::%{_element}%::itemlist::*}%"
  363. replace all ", " with "|| {@leere}- {@lore}" in {_lore}
  364. replace all "and " with "|| {@leere}- {@lore}" in {_lore}
  365. if {case::type::%{_element}%} is "key":
  366. drop chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || "
  367. else:
  368. drop ender chest named "{@important}%{_element}%" with lore " || {@important}W tej skrzyni mozesz zdobyc: || || {@leere}- {@lore}%{_lore}% || "
  369. play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
  370. send "{@tag} {@general}Zdobyles skrzynie {@important}%{_element}%{@general}!"
  371. chance of {@chance drop key}:
  372. set {_element} to random element out of {case::chestlist::*}
  373. if {case::type::%{_element}%} is "key":
  374. drop tripwire hook named "{@important}Klucz do skrzyni {@lore}%{_element}%"
  375. play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
  376. send "{@tag} {@general}Zdobyles klucz do skrzyni {@important}%{_element}%{@general}!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement