local config =
{
dungeon_one_open = 33311,
dungeon_one_pos = Position(32336, 32217, 7), -- teleport poss
knight_in_que = 33313,
sorc_in_que = 33314,
paladin_in_que = 33315,
druid_in_que = 33316,
in_que_one = 33317
}
function onSay(player, words, param, channel)
if Game.getStorageValue(config.dungeon_one_open) == 0 then
Game.getStorageValue(config.dungeon_one_open, 0)
end
------------------This part is if player uses talkaction again, after being qued into the dungeon--------------
if (param == "1" or param == "first") then
if player:getStorageValue(config.in_que_one) == 1 then
if player:getVocation():getId() == 1 or player:getVocation():getId() == 5 then
if Game.getStorageValue(config.knight_in_que) ~= 1 then
if Game.getStorageValue(config.druid_in_que) ~= 1 then
if Game.getStorageValue(config.paladin_in_que) ~= 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Waiting for all vocations.')
return false
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'waiting for a druid and a knight.')
return false
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Waiting for a knight.')
return false
end
end
elseif player:getVocation():getId() == 2 or player:getVocation():getId() == 6 then
if Game.getStorageValue(config.knight_in_que) ~= 1 then
if Game.getStorageValue(config.sorc_in_que) ~= 1 then
if Game.getStorageValue(config.paladin_in_que) ~= 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Waiting for all vocations.')
return false
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'waiting for a sorcerer and a knight.')
return false
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Waiting for a knight.')
return false
end
end
elseif player:getVocation():getId() == 3 or player:getVocation():getId() == 7 then
if Game.getStorageValue(config.knight_in_que) ~= 1 then
if Game.getStorageValue(config.sorc_in_que) ~= 1 then
if Game.getStorageValue(config.druid_in_que) ~= 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Waiting for all vocations.')
return false
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'waiting for a sorcerer and a knight.')
return false
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Waiting for a knight.')
return false
end
end
elseif player:getVocation():getId() == 4 or player:getVocation():getId() == 8 then
if Game.getStorageValue(config.druid_in_que) ~= 1 then
if Game.getStorageValue(config.sorc_in_que) ~= 1 then
if Game.getStorageValue(config.paladin_in_que) ~= 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Waiting for all vocations.')
return false
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'waiting for a sorcerer and a druid.')
return false
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Waiting for a druid.')
return false
end
end
else
----------------------This is main script--------------------------
if player:getVocation():getId() == 1 or player:getVocation():getId() == 5 then
if Game.getStorageValue(config.dungeon_one_open) == 0 then
if Game.getStorageValue(config.knight_in_que) == 1 then
if Game.getStorageValue(config.paladin_in_que) == 1 then
if Game.getStorageValue(config.druid_in_que) == 1 then
if Game.getStorageValue(config.sorc_in_que) == 0 then
players:setStorageValue(config.in_que_one, 1)
for _, players in ipairs(Game.getPlayers()) do
------------------Auto dungeon starter-----------------
if players:getStorageValue(config.in_que_one) == 1 then
players:teleportTo(config.dungeon_one_pos)
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Welcome to dungeon one. This is your team.')
players:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
Game.setStorageValue(config.dungeon_one_open, 1)
players:setStorageValue(config.in_que_one, 0)
end
end
else
player:sendCancelMessage('There is already a Sorcerer qued in this dungeon.')
return false
end
else
doPlayerplayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
player:sendCancelMessage('The dungeon is already in use.')
return false
end
------------------Reapeat script for each voc.------------
elseif player:getVocation():getId() == 2 or player:getVocation():getId() == 6 then
if Game.getStorageValue(config.dungeon_one_open) == 0 then
if Game.getStorageValue(config.sorc_in_que) == 1 then
if Game.getStorageValue(config.paladin_in_que) == 1 then
if Game.getStorageValue(config.knight_in_que) == 1 then
if Game.getStorageValue(config.druid_in_que) == 0 then
players:setStorageValue(config.in_que_one, 1)
for _, players in ipairs(Game.getPlayers()) do
if players:getStorageValue(config.in_que_one) == 1 then
players:teleportTo(config.dungeon_one_pos)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Welcome to dungeon one. This is your team.')
players:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
Game.setStorageValue(config.dungeon_one_open, 1)
end
end
else
player:sendCancelMessage('There is already a Druid qued in this dungeon.')
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
player:sendCancelMessage('The dungeon is already in use.')
return false
end
elseif player:getVocation():getId() == 3 or player:getVocation():getId() == 7 then
if Game.getStorageValue(config.dungeon_one_open) == 0 then
if Game.getStorageValue(config.knight_in_que) == 1 then
if Game.getStorageValue(config.sorc_in_que) == 1 then
if Game.getStorageValue(config.druid_in_que) == 1 then
if Game.getStorageValue(config.paladin_in_que) == 0 then
players:setStorageValue(config.in_que_one, 1)
for _, players in ipairs(Game.getPlayers()) do
if players:getStorageValue(config.in_que_one) == 1 then
players:teleportTo(config.dungeon_one_pos)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Welcome to dungeon one. This is your team.')
players:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
Game.setStorageValue(config.dungeon_one_open, 1)
end
end
else
players:sendCancelMessage('There is already a Paladin qued in this dungeon.')
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
players:sendCancelMessage('The dungeon is already in use.')
return false
end
elseif player:getVocation():getId() == 4 or player:getVocation():getId() == 8 then
if Game.getStorageValue(config.dungeon_one_open) == 0 then
if Game.getStorageValue(config.paladin_in_que) == 1 then
if Game.getStorageValue(config.sorc_in_que) == 1 then
if Game.getStorageValue(config.druid_in_que) == 1 then
if Game.getStorageValue(config.knight_in_que) == 0 then
players:setStorageValue(config.in_que_one, 1)
for _, players in ipairs(Game.getPlayers()) do
if players:getStorageValue(config.in_que_one) == 1 then
players:teleportTo(config.dungeon_one_pos)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Welcome to dungeon one. This is your team.')
players:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
Game.setStorageValue(config.dungeon_one_open, 1)
end
end
else
players:sendCancelMessage('There is already a Paladin qued in this dungeon.')
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
players:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have been qued, you will be teleported when there is a full team.')
players:setStorageValue(config.in_que_one, 1)
return false
end
else
players:sendCancelMessage('The dungeon is already in use.')
return false
end
end
end
end
end
return true
end