Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Author: Nawo
- # contact: romug1337@gmail.com
- # Presentation: http://www.mpcforum.pl/topic/1423401-skrypt-na-case-opening/
- # Launge: English
- options:
- tag: &8[&6Case&8] # Prefix message
- chance key: 20 # Chance to drop key
- chance chest: 30 # Chance to drop chest
- command /case [<text="null">] [<text>] [<text>] [<text>]:
- trigger:
- if player has permission "case.*":
- if arg 1 is not "add" or "remove" or "edit" or "give" or "list" or "method":
- send "{@tag}"
- send "&6/case add <name> &8- &7Add new case."
- send "&6/case remove <name> &8- &7Delete case."
- send "&6/case edit <name> &8- &7Edit case."
- send "&6/case give <name> [<player>] [<number>] &8- &7Give case and key."
- send "&6/case list &8- &7Case list."
- if arg 1 is "add":
- if arg 2 is set:
- loop {case::chestlist::*}:
- if loop-value is arg 2:
- send "{@tag} &7Box already exists!"
- stop
- add arg 2 to {case::chestlist::*}
- send "{@tag} &7Added chests named &6%arg 2%&7."
- else:
- send "&6/case add <name>"
- if arg 1 is "remove":
- if arg 2 is set:
- loop {case::chestlist::*}:
- if loop-value is arg 2:
- remove arg 2 from {case::chestlist::*}
- delete {case::%arg 2%::itemlist::*}
- send "{@tag} &7Removed boxes called &6%arg 2%&7."
- stop
- send "{@tag} &7Box does not exist!"
- else:
- send "&6/case remove <name>"
- if arg 1 is "edit":
- if arg 2 is set:
- loop {case::chestlist::*}:
- if loop-value is arg 2:
- open chest with 3 rows named "&6Editing: &c%arg 2%" to player
- wait 1 tick
- set {_slot} to 0
- loop {case::%arg 2%::itemlist::*}:
- set slot {_slot} of current inventory of player to loop-value-1
- add 1 to {_slot}
- set {case::player::%player%::openedit} to "%arg 2%"
- send "{@tag} &7Eediting &6%arg 2%&7." to player
- while inventory name of player is "&6Editing: &c%arg 2%":
- set {case::player::%player%::openedit} to "%arg 2%"
- wait 5 tick
- stop
- send "{@tag} &7Box does not exist!"
- else:
- send "&6/case additem <name>"
- if arg 1 is "give":
- if arg 2 is set:
- loop {case::chestlist::*}:
- if loop-value is arg 2:
- if arg 3 is set:
- set {_player} to arg 3 parsed as offlineplayer
- else:
- set {_player} to player
- if arg 4 is set:
- set {_number} to arg 4 parsed as integer
- else:
- set {_number} to 64 parsed as integer
- if {_player} is online:
- set {_lore} to "%{case::%arg 2%::itemlist::*}%"
- replace all ", " with "|| &8- &c" in {_lore}
- replace all "and " with "|| &8- &c" in {_lore}
- add {_number} chest named "&6%arg 2%" with lore " || &6In this box you can capturing: || || &8- &c%{_lore}% || " to {_player}'s inventory
- add {_number} tripwire hook named "&6Key to chest &c%arg 2%" to {_player}'s inventory
- stop
- send "{@tag} &7Box does not exist!"
- else:
- send "&6/case givechest <name>"
- if arg 1 is "list":
- open chest with 6 rows named "&6Chest list:" to player
- wait 1 tick
- loop {case::chestlist::*}:
- set {_case%loop-index%} to loop-value
- if {_case%loop-index%} contains "<none>":
- remove loop-value from {case::chestlist::*}
- delete {_case%loop-index%}
- loop (size of {case::chestlist::*}) times:
- set {_lore} to "%{case::%{_case%loop-number%}%::itemlist::*}%"
- replace all ", " with "|| &8- &c" in {_lore}
- replace all "and " with "|| &8- &c" in {_lore}
- 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
- if arg 1 is "method":
- set {_player} to arg 3 parsed as player
- if {_player}'s inventory contains tripwire hook named "&6Key to chest &c%arg 2%":
- set {_lore} to "%{case::%arg 2%::itemlist::*}%"
- replace all ", " with "|| &8- &c" in {_lore}
- replace all "and " with "|| &8- &c" in {_lore}
- if {_player}'s inventory contains chest named "&6%arg 2%" with lore " || &6In this box you can capturing: || || &8- &c%{_lore}% || ":
- if {case::player::%player%::openwait} is true:
- send "{@tag} &7Already open boxes!" to {_player}
- else:
- set {_size} to size of {case::%arg 2%::itemlist::*}
- if {_size} > 0:
- remove 1 tripwire hook named "&6Key to chest &c%arg 2%" from {_player}'s inventory
- remove 1 chest named "&6%arg 2%" with lore " || &6In this box you can capturing: || || &8- &c%{_lore}% || " from {_player}'s inventory
- set {case::player::%{_player}%::open} to true
- set {case::player::%{_player}%::openwait} to true
- open chest with 6 rows named "&6Chest &c%arg 2%" to {_player}
- wait 1 tick
- loop {case::%arg 2%::itemlist::*}:
- set {_skin%loop-index%} to loop-value
- loop (size of {case::%arg 2%::itemlist::*}) times:
- format slot loop-number + 26 of {_player} with 1 of {_skin%loop-number%} to be unstealable
- loop 9 times:
- set {_item%loop-number%} to random element out of {case::%arg 2%::itemlist::*}
- format slot loop-number + 8 of {_player} with 1 of {_item%loop-number%} to be unstealable
- format slot loop-number - 1 of {_player} with 1 of black stained glass pane to be unstealable
- format slot loop-number + 17 of {_player} with 1 of black stained glass pane to be unstealable
- format slot 4 of {_player} with 1 of hopper to be unstealable
- set {_random} to random integer between 20 and 30
- wait 1 seconds
- loop {_random} times:
- if loop-number > 15:
- loop loop-number - 12 times:
- wait 1 tick
- else:
- wait 3 tick
- play raw sound "mob.skeleton.death" at {_player} with pitch 8 volume 1
- loop 8 times:
- set {_item%loop-number-2%} to {_item%loop-number-2 + 1%}
- if {case::player::%{_player}%::open} is true:
- format slot loop-number-2 + 8 of {_player} with 1 of {_item%loop-number-2%} to be unstealable
- set {_item9} to random element out of {case::%arg 2%::itemlist::*}
- if {case::player::%{_player}%::open} is true:
- format slot 17 of {_player} with 1 of {_item9} to be unstealable
- set {case::player::%{_player}%::open} to false
- wait 3 seconds
- open chest with 1 rows named "&6Wygrales:" to {_player}
- broadcast "{@tag} &7Player &6%{_player}% &7drew &6%{_item5}% &7from chest &6%arg 2%&7. Congratulations!"
- send "{@tag} &7Claim your prize." to {_player}
- wait 1 tick
- set slot 4 of current inventory of {_player} to {_item5}
- play raw sound "mob.endermen.portal" at {_player} with pitch 0.1 volume 1
- set {case::player::%{_player}%::openwait} to false
- else:
- send "{@tag} &7In this box you can not draw anything!" to {_player}
- else:
- send "{@tag} &7You do not have the box!" to {_player}
- else:
- send "{@tag} &7You do not have the key to that box!" to {_player}
- on inventory close:
- if {case::player::%player%::open} is true:
- set {case::player::%player%::open} to false
- send "{@tag} &7Closed draw preview."
- if {case::player::%player%::openedit} is set:
- clear {case::%{case::player::%player%::openedit}%::itemlist::*}
- loop 27 times:
- if slot "%loop-number - 1%" parsed as an integer of current inventory of player is not air:
- set {_item} to slot loop-number - 1 of current inventory of player
- add {_item} to {case::%{case::player::%player%::openedit}%::itemlist::*}
- clear {case::player::%player%::openedit}
- send "{@tag} &7Saved."
- on quit:
- if {case::player::%player%::open} is true:
- set {case::player::%player%::open} to false
- on death:
- if {case::player::%victim%::open} is true:
- set {case::player::%victim%::open} to false
- on right click:
- if player's tool is chest:
- loop {case::chestlist::*}:
- if loop-value is uncolored name of player's tool:
- cancel event
- set {_lore} to "%{case::%loop-value%::itemlist::*}%"
- replace all ", " with "|| &8- &c" in {_lore}
- replace all "and " with "|| &8- &c" in {_lore}
- set lore of player's tool to " || &6In this box you can capturing: || || &8- &c%{_lore}% || "
- execute player command "case method %uncolored name of player's tool% %player%"
- if player's tool is tripwire hook:
- if name of player's tool contains "Key to chest":
- cancel event
- open chest with 6 rows named "&6Chest list:" to player
- wait 1 tick
- loop {case::chestlist::*}:
- set {_case%loop-index%} to loop-value
- if {_case%loop-index%} contains "<none>":
- remove loop-value from {case::chestlist::*}
- delete {_case%loop-index%}
- loop (size of {case::chestlist::*}) times:
- set {_lore} to "%{case::%{_case%loop-number%}%::itemlist::*}%"
- replace all ", " with "|| &8- &c" in {_lore}
- replace all "and " with "|| &8- &c" in {_lore}
- 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
- on mine of stone:
- chance of {@chance chest}%:
- set {_element} to random element out of {case::chestlist::*}
- set {_lore} to "%{case::%{_element}%::itemlist::*}%"
- replace all ", " with "|| &8- &c" in {_lore}
- replace all "and " with "|| &8- &c" in {_lore}
- drop chest named "&6%{_element}%" with lore " || &6In this box you can capturing: || || &8- &c%{_lore}% || "
- play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
- send "{@tag} &7You got chest &6%{_element}%&7!"
- chance of {@chance key}%:
- set {_element} to random element out of {case::chestlist::*}
- drop tripwire hook named "&6Key to chest &c%{_element}%"
- play raw sound "mob.endermen.portal" at player with pitch 0.001 volume 1
- send "{@tag} &7You got key to chest &6%{_element}%&7!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement