Advertisement
PabloEduardo

Chakra

Jun 24th, 2022 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. import:
  2. com.nisovin.magicspells.MagicSpells
  3. com.nisovin.magicspells.Spell
  4. com.nisovin.magicspells.mana.ManaChangeReason
  5. com.nisovin.magicspells.mana.ManaHandler
  6. com.nisovin.magicspells.mana.ManaSystem
  7.  
  8. function setMaxMana(user: player, quantity: text) :: boolean:
  9. set {_handler} to MagicSpells.getManaHandler()
  10. set {_quantity} to {_quantity} parsed as integer
  11. {_handler}.setMaxMana({_user}, {_quantity})
  12. #{_handler}.addMana({_user}, {_quantity}, ManaChangeReason.OTHER)
  13. return true
  14. function addMana(user: player, quantity: text) :: boolean:
  15. set {_handler} to MagicSpells.getManaHandler()
  16. set {_quantity} to {_quantity} parsed as integer
  17. set {_changed} to {_handler}.addMana({_user}, {_quantity}, ManaChangeReason.OTHER)
  18. if {_changed} is true:
  19. return true
  20. else:
  21. return false
  22. on quit:
  23. set {PlayerConectado.%player%} to false
  24. on join:
  25. set {PlayerConectado.%player%} to true
  26. wait 10 seconds
  27. set {_x} to {chakra::%player%} + {vigor::%player%}
  28. if {Sancionado::%player%} is true:
  29. set {_sancion} to {NChakra::%player%} * 5
  30. subtract {_sancion} from {_x}
  31. wait 7 seconds
  32. setMaxMana(player, "%{_x}%")
  33. set {cdrchakra::%player%} to 60 - ({con::%player%} * 2)
  34. while {PlayerConectado.%player%} is true:
  35. if {cdrchakra::%player%} is greater than 0:
  36. wait 1 second
  37. subtract 1 from {cdrchakra::%player%}
  38. if {cdrchakra::%player%} is 1:
  39. addMana(player, "1")
  40. set {cdrchakra::%player%} to 60 - ({con::%player%} * 2)
  41. send action bar "&a+1 &fde &9Chakra" to player
  42. command /Chakra [<text>] [<offline player>] [<number>]:
  43. permission: Staff
  44. trigger:
  45. if arg 1 is "adjust":
  46. set {_x} to {chakra::%player%} + {vigor::%player%}
  47. setMaxMana(player, "%{_x}%")
  48. if arg 1 is "set":
  49. #setMaxMana(player, 35)
  50. set {chakra::%arg-2%} to arg-3
  51. setMaxMana(arg-2, "%{chakra::%arg-2%}%")
  52. set {_query3} to "UPDATE usuarios SET chakra = ""%{chakra::%arg-2%}%"" WHERE uuid = ""%arg-2's uuid%"""
  53. execute unsafe {_query3} in {-sql}
  54. send "&7[&bSistema&7] &fEl chakra de &b%arg-2% &fahora es &d%arg-2%" to player
  55. send "&7[&bSistema&7] &fTu chakra ahora es&d %arg-3%" to arg-2
  56. if arg 1 is "add":
  57. add arg-3 to {chakra::%arg-2%}
  58. setMaxMana(arg-2, "%{chakra::%arg-2%}%")
  59. set {_query3} to "UPDATE usuarios SET chakra = ""%{chakra::%arg-2%}%"" WHERE uuid = ""%arg-2's uuid%"""
  60. execute unsafe {_query3} in {-sql}
  61. send "&7[&bSistema&7] &fEl chakra de &b%arg-2% &fahora es &d%arg-2%" to player
  62. send "&7[&bSistema&7] &fTu chakra ahora es&d %arg-3%" to arg-2
  63. if arg 1 is "Remove":
  64. subtract arg-3 from {chakra::%arg-2%}
  65. setMaxMana(arg-2, "%{chakra::%arg-2%}%")
  66. set {_query3} to "UPDATE usuarios SET chakra = ""%{chakra::%arg-2%}%"" WHERE uuid = ""%arg-2's uuid%"""
  67. execute unsafe {_query3} in {-sql}
  68. send "&7[&bSistema&7] &fEl chakra de &b%arg-2% &fahora es &d%arg-2%" to player
  69. send "&7[&bSistema&7] &fTu chakra ahora es&d %arg-3%" to arg-2
  70. if arg 1 is "ver":
  71. set {_f} to MagicSpells.getManaHandler().getMaxMana(arg-2)
  72. send "&9Chakra Maximo de &d%arg-2%: &f%{_f}%" to player
  73.  
  74.  
  75.  
  76.  
  77.  
  78. function getMaxMana(user: player) :: number:
  79. set {_handler} to MagicSpells.getManaHandler()
  80. return {_handler}.getMaxMana({_user})
  81. function setCooldown(p: player, spell: string, cooldown: integer):
  82. MagicSpells.getSpellByInternalName({_spell}).setCooldown({_p}, {_cooldown})
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. #
  94. on region enter:
  95. if "%event-region%" contains "Spawn":
  96. set {nopotions.%player%} to true
  97. send "&a¬°Entrando en una Zona Segura!"
  98. make player run command "/nopotions" as op
  99. command /nopotions:
  100. permission: Staff
  101. trigger:
  102. while {nopotions.%player%} is true:
  103. remove Blindness from the player
  104. remove Slowness from the player
  105. wait 10 seconds
  106. on region leave:
  107. if "%event-region%" contains "Spawn":
  108. set {nopotions.%player%} to false
  109. send "&c¬°Saliendo de una Zona Segura!"
  110. function cd(p: player, spell: string,):
  111. MagicSpells.getSpellByInternalName({_spell}).onCooldown({_p}) is true:
  112. set {_x} to MagicSpells.getSpellByInternalName({_spell}).getCooldown({_p})
  113. send "&cHabilidad en Enfriamiento &7(&b%{_x}% s&7)" to {_p}
  114. else:
  115. send "&aHabilidad &7(%{_spell}%) &aDisponible" to {_p}
  116. command /cd [<text>]:
  117. trigger:
  118. if arg 1 isn't set:
  119. send "&fColoca el nombre de un Cast para ver si esta en CD o No"
  120. else:
  121. cd(player, "%arg-1%")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement