Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. local config = {
  2. requiredLevel = 100,
  3. daily = false,
  4. timekill = 20, -- Tempo que o Jogador Terá Para Matar o bossy
  5. centerDemonRoomPosition = Position(32912, 31599, 14),
  6. rangeX = 20,
  7. rangeY = 20,
  8. playerPositions = {
  9. Position(32902, 31623, 14),
  10. Position(32902, 31624, 14),
  11. Position(32902, 31625, 14),
  12. Position(32902, 31626, 14),
  13. Position(32902, 31627, 14),
  14. },
  15. newPositions = {
  16. Position(32912, 31591, 14),
  17. Position(32912, 31591, 14),
  18. Position(32912, 31591, 14),
  19. Position(32912, 31591, 14),
  20. Position(32912, 31591, 14),
  21. },
  22. demonPositions = {
  23. Position(32912, 31599, 14)
  24. }
  25. }
  26.  
  27.  
  28. local function roomIsOccupied(bossposition, rangeX, rangeY)
  29. local spectators = Game.getSpectators(bossposition, false, false, rangeX, rangeX, rangeY, rangeY)
  30. if #spectators ~= 0 then
  31. return true
  32. end
  33.  
  34. return false
  35. end
  36.  
  37. function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  38. if item.itemid == 9826 then
  39. local storePlayers, playerTile = {}
  40.  
  41. local tmpConfig = config
  42. if not tmpConfig then
  43. return true
  44. end
  45.  
  46. for i = 1, #config.playerPositions do
  47. playerTile = Tile(config.playerPositions[i]):getTopCreature()
  48.  
  49. if playerTile and playerTile:getLevel() < config.requiredLevel then
  50. player:sendTextMessage(MESSAGE_STATUS_SMALL, "All the players need to be level ".. config.requiredLevel .." or higher.")
  51. return true
  52. end
  53.  
  54. storePlayers[#storePlayers + 1] = playerTile
  55. end
  56. if roomIsOccupied(tmpConfig.centerDemonRoomPosition, tmpConfig.rangeX, tmpConfig.rangeY) then
  57. player:sendTextMessage(TALKTYPE_MONSTER_SAY, 'Uma equipe ja esta dentro da sala de quest,aguarde..')
  58. return true
  59. end
  60. local specs, spec = Game.getSpectators(config.centerDemonRoomPosition, false, false, 3, 3, 2, 2)
  61. for i = 1, #specs do
  62. spec = specs[i]
  63. if spec:isPlayer() then
  64. player:sendTextMessage(MESSAGE_STATUS_SMALL, "Uma equipe ja esta dentro da sala de quest,aguarde..")
  65. return true
  66. end
  67.  
  68. spec:remove()
  69. end
  70.  
  71.  
  72. for i = 1, #config.demonPositions do
  73. addEvent(doRemoveCreature, 1000 * 60 * 20,'Lady Tenebris')
  74. local boss = Game.createMonster("Lady Tenebris", config.demonPositions[i])
  75. boss:setReward(true)
  76. end
  77.  
  78. local players
  79. for i = 1, #storePlayers do
  80. players = storePlayers[i]
  81. config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
  82. players:teleportTo(config.newPositions[i])
  83. player:sendTextMessage(MESSAGE_STATUS_WARNING, 'You have ' .. config.timekill .. ' minute(s) to kill Lady Tenebris.')
  84. config.newPositions[i]:sendMagicEffect(CONST_ME_ENERGYAREA)
  85. players:setDirection(DIRECTION_EAST)
  86. end
  87. elseif item.itemid == 9825 then
  88. if config.daily then
  89. player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
  90. return true
  91. end
  92. end
  93.  
  94. item:transform(item.itemid == 9826 and 9825 or 9826)
  95. return true
  96. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement