akon1248

PvE

Jun 15th, 2019
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.35 KB | None | 0 0
  1. function removePrefix(str1: string, str2: string) :: string:
  2. first length of {_str2} characters of {_str1} is {_str2}
  3. return last length of {_str1} - length of {_str2} characters of {_str1}
  4. function getLivingEntityFromUUID(uuid: string) :: living entity:
  5. loop all entities:
  6. UUID of loop-entity is {_uuid}
  7. return loop-entity
  8. stop loop
  9. function getTagValues(e: entity) :: strings:
  10. set {_tagnbt} to "%tag ""Tags"" of nbt of {_e}%"
  11. replace "[""" and """]" in {_tagnbt} with ""
  12. return split {_tagnbt} by ""","""
  13. command /customdrop [<text>] [<text>] [<text>]:
  14. permission: skript.admin
  15. permission message: &cYou do not permission to use this command.
  16. trigger:
  17. if arg-1 is not set:
  18. send "&cUsage: /customdrop <add|remove|give> <dropname> OR /customdrop drops"
  19. else if arg-1 is not "add" or "remove" or "give" or "drops":
  20. send "&cUsage: /customdrop <add|remove|give> <dropname> OR /customdrop drops"
  21. else if arg-1 is "add" or "remove" or "give":
  22. if arg-2 is not set:
  23. send "&cUsage: /customdrop %arg-1% <dropname>"
  24. else if arg-3 is set:
  25. send "&cドロップアイテム名に空白は使用できません"
  26. else if arg-1 is set:
  27. if arg-1 is "add":
  28. if {customdrops::%arg-2%} is set:
  29. send "&cドロップアイテム%arg-2%は既に存在しています"
  30. else if player's tool is air:
  31. send "&cメインハンドに追加したいアイテムを持ってください"
  32. else if player's tool is not air:
  33. set {customdrops::%arg-2%} to player's tool
  34. send "&e新しいドロップアイテム%arg-2%を追加しました"
  35. else if arg-1 is "remove":
  36. if {customdrops::%arg-2%} is not set:
  37. send "&cドロップアイテム%arg-2%は存在しません"
  38. else if {customdrops::%arg-2%} is set:
  39. delete {customdrops::%arg-2%}
  40. send "&eドロップアイテム%arg-2%を消去しました"
  41. else if arg-1 is "drops":
  42. if {customdrops::*} is not set:
  43. send "&c登録されているドロップアイテムはありません"
  44. else if {customdrops::*} is set:
  45. loop {customdrops::*}:
  46. set {_dropnames::%loop-index%} to loop-index
  47. send "%{_dropnames::*}%" to console
  48. set {_dropstext} to join {_dropnames::*} by "&f, &e"
  49. send "&7CustomDrops (%size of {customdrops::*}%): &e%{_dropstext}%"
  50. on death:
  51. victim is a living entity
  52. victim is not a player
  53. victim is not armor stand
  54. set {_tags::*} to getTagValues(victim)
  55. if {_tags::*} contain "CustomDropOnly":
  56. clear drops
  57. loop {_tags::*}:
  58. set {_dropoptions::*} to loop-value split by ";"
  59. loop {_dropoptions::*}:
  60. if removePrefix(loop-value-2, "Drop:") is set:
  61. set {_customdropname} to removePrefix(loop-value-2, "Drop:")
  62. if removePrefix(loop-value-2, "DropChance:") is set:
  63. set {_dropchance} to removePrefix(loop-value-2, "DropChance:") parsed as number
  64. if removePrefix(loop-value-2, "MinAmount:") is set:
  65. set {_minamount} to removePrefix(loop-value-2, "MinAmount:") parsed as integer
  66. if removePrefix(loop-value-2, "MaxAmount:") is set:
  67. set {_maxamount} to removePrefix(loop-value-2, "MaxAmount:") parsed as integer
  68. if removePrefix(loop-value-2, "RareDrop:") is set:
  69. set {_raredrop} to removePrefix(loop-value-2, "RareDrop:") parsed as boolean
  70. {_customdropname} is set
  71. {_dropchance} is set
  72. {_minamount} is set
  73. {_maxamount} is set
  74. {_raredrop} is set
  75. if {_raredrop} is true:
  76. attacker is a player
  77. chance of {_dropchance}%:
  78. loop random integer between {_minamount} and {_maxamount} times:
  79. if {customdrops::%{_customdropname}%} is set:
  80. add {customdrops::%{_customdropname}%} to drops
  81. else if {customdrops::%{_customdropname}%} is not set:
  82. set {_dropitem} to {_customdropname} parsed as item
  83. {_dropitem} is set
  84. add {_dropitem} to drops
  85. else if {_raredrop} is false:
  86. chance of {_dropchance}%:
  87. loop random integer between {_minamount} and {_maxamount} times:
  88. if {customdrops::%{_customdropname}%} is set:
  89. add {customdrops::%{_customdropname}%} to drops
  90. else if {customdrops::%{_customdropname}%} is not set:
  91. set {_dropitem} to {_customdropname} parsed as item
  92. {_dropitem} is set
  93. add {_dropitem} to drops
  94. delete {_dropoptions::*}
  95. delete {_customdropname}
  96. delete {_dropchance}
  97. delete {_minamount}
  98. delete {_maxamount}
  99. delete {_raredrop}
  100. delete {_dropitem}
  101. function deleteBossBar(bossbar: string):
  102. evaluate "remove all players from bar %{_bossbar}%"
  103. evaluate "delete %{_bossbar}%"
  104. every tick:
  105. loop {bossbar::*}:
  106. getLivingEntityFromUUID(loop-index) is not set
  107. deleteBossBar("{bossbar::%loop-index%}")
  108. loop all entities:
  109. loop-entity is a living entity
  110. loop-entity is not a player
  111. set {_tags::*} to getTagValues(loop-entity)
  112. loop {_tags::*}:
  113. set {_bossbaroptions::*} to loop-value-2 split by ";"
  114. loop {_bossbaroptions::*}:
  115. if removePrefix(loop-value-3, "BarColor:") is set:
  116. set {_barcolor} to removePrefix(loop-value-3, "BarColor:")
  117. if removePrefix(loop-value-3, "BarStyle:") is set:
  118. set {_barstyle} to removePrefix(loop-value-3, "BarStyle:")
  119. if removePrefix(loop-value-3, "BarRange:") is set:
  120. set {_barrange} to removePrefix(loop-value-3, "BarRange:") parsed as number
  121. {_barcolor} is set
  122. {_barstyle} is set
  123. {_barrange} is set
  124. if {bossbar::%UUID of loop-entity%} is not set:
  125. set {bossbar::%UUID of loop-entity%} to new bossbar
  126. set color of bar {bossbar::%UUID of loop-entity%} to PINK
  127. set style of bar {bossbar::%UUID of loop-entity%} to SOLID
  128. evaluate "set color of bar {bossbar::%UUID of loop-entity%} to %{_barcolor} in upper case%"
  129. evaluate "set style of bar {bossbar::%UUID of loop-entity%} to %{_barstyle} in upper case%"
  130. if name of loop-entity is set:
  131. set name of bar {bossbar::%UUID of loop-entity%} to name of loop-entity
  132. else:
  133. set name of bar {bossbar::%UUID of loop-entity%} to "%loop-entity%"
  134. set progress of bar {bossbar::%UUID of loop-entity%} to health of loop-entity/max health of loop-entity
  135. loop all players:
  136. if distance between loop-entity-1 and loop-player-1 <= {_barrange}:
  137. add loop-player-1 to bar {bossbar::%UUID of loop-entity-1%}
  138. else:
  139. remove loop-player-1 from bar {bossbar::%UUID of loop-entity-1%}
  140. delete {_tags::*}
  141. delete {_bossbaroptions::*}
  142. delete {_barcolor}
  143. delete {_barstyle}
  144. delete {_barrange}
Advertisement
Add Comment
Please, Sign In to add comment