Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dangerous depth entrance (change from aid to position) #863

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,46 +1,57 @@
local positions = {
{x = 33831, y = 32138, z = 14},
{x = 34021, y = 32037, z = 14},
{x = 33784, y = 32205, z = 14},
{x = 33921, y = 32402, z = 14},
{x = 33829, y = 32187, z = 14},
{x = 33982, y = 32234, z = 14},
}

local energyEntrance = MoveEvent()

function energyEntrance.onStepIn(creature, item, position, fromPosition, toPosition)
local player = creature:getPlayer()
if not player then
return true
end

if item:getPosition() == Position(33831, 32138, 14) then
if player:getStorageValue(Storage.DangerousDepths.Scouts.Status) >= 10 then
if player:getPosition() == Position(33831, 32138, 14) then
if player:getStorageValue(Storage.DangerousDepths.Scouts.Status) >= -50 then
player:teleportTo(Position(34023, 32037, 14))
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this portal yet.")
player:teleportTo(Position(fromPosition.x, fromPosition.y + 1, fromPosition.z))
end
elseif item:getPosition() == Position(34021, 32037, 14) then
elseif player:getPosition() == Position(34021, 32037, 14) then
player:teleportTo(Position(33831, 32141, 14))
end

if item:getPosition() == Position(33784, 32205, 14) then
if player:getStorageValue(Storage.DangerousDepths.Dwarves.Status) >= 10 then
if player:getPosition() == Position(33784, 32205, 14) then
if player:getStorageValue(Storage.DangerousDepths.Dwarves.Status) >= -50 then
player:teleportTo(Position(33921, 32401, 14))
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this portal yet.")
player:teleportTo(Position(fromPosition.x - 1, fromPosition.y, fromPosition.z))
end
elseif item:getPosition() == Position(33921, 32402, 14) then
elseif player:getPosition() == Position(33921, 32402, 14) then
player:teleportTo(Position(33782, 32205, 14))
end

if item:getPosition() == Position(33829, 32187, 14) then
if player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) >= 10 then
if player:getPosition() == Position(33829, 32187, 14) then
if player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) >= -50 then
player:teleportTo(Position(33982, 32236, 14))
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this portal yet.")
player:teleportTo(Position(fromPosition.x, fromPosition.y - 1, fromPosition.z))
end
elseif item:getPosition() == Position(33982, 32234, 14) then
elseif player:getPosition() == Position(33982, 32234, 14) then
player:teleportTo(Position(33829, 32186, 14))
end
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)

return true
end

energyEntrance:type("stepin")
energyEntrance:aid(57232)
for index, value in pairs(positions) do
energyEntrance:position(value)
end
energyEntrance:register()