darkmu
Well-Known Member
I would like to put a validation if someone is with MC, he does not allow
TFS 1.3
TFS 1.3
Lua:
local config = {
requiredLevel = 250,
daily = false,
BossPosition = Position(423, 581, 15),
centerDemonRoomPosition = Position(423, 583, 15),
playerPositions = {
Position(454, 581, 15),
Position(454, 582, 15),
Position(454, 583, 15),
Position(454, 584, 15),
Position(454, 585, 15)
},
newPositions = {
Position(424, 589, 15), -- Posição dos players 1,2,3,4,5
Position(424, 589, 15),
Position(424, 589, 15),
Position(424, 589, 15),
Position(424, 589, 15)
},
}
function onUse(player, item, fromPosition, target, toPosition, monster, isHotkey)
if item.itemid == 9825 then
if player:getPosition() ~= Position(454, 581, 15) then
item:transform(9826)
return true
end
local storePlayers, playerTile = {}
local exaustedSeconds = 1
for i = 1, #config.playerPositions do
playerTile = Tile(config.playerPositions[i]):getTopCreature()
if not (player:getStorageValue(37869) <= os.time()) then
player:say(string.format("You did this boss before %i hours.", player:isVip() == true and 8 or 12), TALKTYPE_MONSTER_SAY)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone already did this room!")
return true
end
storePlayers[#storePlayers + 1] = playerTile
end
local specs, spec = Game.getSpectators(config.centerDemonRoomPosition, false, false, 15, 15, 15, 15)
for i = 1, #specs do
spec = specs[i]
if spec:isPlayer() then
if item.itemid == 9826 then
if player:getPosition() ~= Position(454, 580, 15) then
item:transform(9826)
player:say("Someone is fighting with Alptramun.", TALKTYPE_MONSTER_SAY)
return true
end
end
return true
end
end
local specs, spec = Game.getSpectators(config.centerDemonRoomPosition, false, false, 15, 15, 15, 15)
for i = 1, #specs do
spec = specs[i]
if spec:isPlayer() then
player:say("Someone is fighting with Alptramun.", TALKTYPE_MONSTER_SAY)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone is fighting with Alptramun.")
return true
end
spec:remove()
end
local players
local monster = Game.createMonster("Alptramun", Position(423, 581, 15))
if monster then
monster:setReward(true)
end
for i = 1, #storePlayers do
players = storePlayers[i]
if not (players:getStorageValue(37869) <= os.time()) then
players:sendTextMessage(TALKTYPE_MONSTER_SAY, string.format("You did this boss before %i hours.", player:isVip() == true and 8 or 12))
player:say("Someone already did this room!", TALKTYPE_MONSTER_SAY)
return
end
end
for i = 1, #storePlayers do
players = storePlayers[i]
config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
players:teleportTo(config.newPositions[i])
config.newPositions[i]:sendMagicEffect(CONST_ME_ENERGYAREA)
players:setDirection(DIRECTION_NORTH)
players:say('Seu time tem 15 minutos para matar o boss. Caso ao contrario serao kikados da sala e perdera a chance !!.', TALKTYPE_MONSTER_SAY)
if not players:isMonster() then
if players:isVip() then
players:setStorageValue(37869, os.time()+exaustedSeconds*28800)
else
players:setStorageValue(37869, os.time()+exaustedSeconds*43200)
end
end
end
addEvent(cleanRoom, 15 * 60 * 1000, config.centerDemonRoomPosition, 15, 15)
elseif item.itemid == 9825 then
if config.daily then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
return true
end
end
item:transform(item.itemid == 9826 and 9825 or 9826)
return true
end