120 lines
4.3 KiB
Lua
120 lines
4.3 KiB
Lua
-- Forgotten Island Module
|
|
|
|
|
|
-- Executes every minute for everybody in the server
|
|
function on_forgotten_hook( player_x, player_y, minute )
|
|
if (player_x > 161280 and player_x < 177408 and player_y > 145152 and player_y < 161280) then
|
|
on_forgotten_island(minute)
|
|
|
|
elseif (player_x > 155157 and player_x < 155533 and player_y > 149330 and player_y < 149636) then
|
|
on_forgotten_ship(minute)
|
|
|
|
elseif (player_x > 154803 and player_x < 156147 and player_y > 149364 and player_y < 150619) then
|
|
on_forgotten_port(minute)
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
-- 9.4 Ship Boarding, Island, and Town Return Script
|
|
function on_forgotten_island(mod_min)
|
|
local actions =
|
|
{
|
|
-- You will be summoned to Shepard in #@min@# minutes.
|
|
[23] = function() private_notice(sconv("@1173", "#@min@#", 28 - 23)) end,
|
|
[24] = function() private_notice(sconv("@1173", "#@min@#", 28 - 24)) end,
|
|
[25] = function() private_notice(sconv("@1173", "#@min@#", 28 - 25)) end,
|
|
[26] = function() private_notice(sconv("@1173", "#@min@#", 28 - 26)) end,
|
|
[27] = function() private_notice(sconv("@1173", "#@min@#", 28 - 27)) end,
|
|
|
|
[28] = function() -- Warp to the ship near island
|
|
warp(174925 + math.random(0,20), 151641 + math.random(0,20))
|
|
private_notice(sconv("@1171", "#@min@#", 1)) -- The vessel sets sail in #@min@# minutes.
|
|
end,
|
|
|
|
[29] = function() -- Warp to seaport
|
|
warp(155396 + math.random(0,10), 149683 + math.random(0,10))
|
|
end,
|
|
|
|
-- You will be summoned to Shepard in #@min@# minutes.
|
|
[45] = function() private_notice(sconv("@1173", "#@min@#", 55 - 45)) end,
|
|
[46] = function() private_notice(sconv("@1173", "#@min@#", 55 - 46)) end,
|
|
[47] = function() private_notice(sconv("@1173", "#@min@#", 55 - 47)) end,
|
|
[48] = function() private_notice(sconv("@1173", "#@min@#", 55 - 48)) end,
|
|
[49] = function() private_notice(sconv("@1173", "#@min@#", 55 - 49)) end,
|
|
[50] = function() private_notice(sconv("@1173", "#@min@#", 55 - 50)) end,
|
|
[51] = function() private_notice(sconv("@1173", "#@min@#", 55 - 51)) end,
|
|
[52] = function() private_notice(sconv("@1173", "#@min@#", 55 - 52)) end,
|
|
[53] = function() private_notice(sconv("@1173", "#@min@#", 58 - 53)) end,
|
|
[54] = function() private_notice(sconv("@1173", "#@min@#", 58 - 54)) end,
|
|
|
|
[55] = function() -- Warp to the ship near island
|
|
warp(174925 + math.random(0,20), 151641 + math.random(0,20))
|
|
private_notice(sconv("@1171", "#@min@#", 1))
|
|
end,
|
|
|
|
[56] = function() -- Warp to seaport
|
|
warp(155396 + math.random(0,10), 149683 + math.random(0,10))
|
|
end,
|
|
|
|
[58] = function() -- Warp to the ship near island
|
|
warp(174925 + math.random(0,20), 151641 + math.random(0,20))
|
|
private_notice(sconv("@1171", "#@min@#", 1))
|
|
end,
|
|
|
|
|
|
[59] = function() -- Warp to seaport
|
|
warp(155396 + math.random(0,10), 149683 + math.random(0,10))
|
|
end,
|
|
}
|
|
|
|
local action = actions[mod_min]
|
|
if action then
|
|
action() -- call the corresponding function
|
|
end
|
|
end
|
|
|
|
|
|
function on_forgotten_port(mod_min)
|
|
local actions = {}
|
|
|
|
-- 0 - 10: The vessel sets sail shortly
|
|
for i = 0, 10 do
|
|
actions[i] = function() private_notice("@1174") end
|
|
end
|
|
|
|
-- 20 - 29: The vessel sets sail in #@min@# minutes
|
|
for i = 20, 29 do
|
|
actions[i] = function() private_notice(sconv("@1171", "#@min@#", 30 - i)) end
|
|
end
|
|
|
|
-- 30 - 35: The vessel sets sail shortly
|
|
for i = 30, 35 do
|
|
actions[i] = function() private_notice("@1174") end
|
|
end
|
|
|
|
-- 50 - 59: The vessel sets sail in #@min@# minutes
|
|
for i = 50, 59 do
|
|
actions[i] = function() private_notice(sconv("@1171", "#@min@#", 60 - i)) end
|
|
end
|
|
|
|
local action = actions[mod_min]
|
|
if action then
|
|
action()
|
|
end
|
|
end
|
|
|
|
-- From the Ruined City to the Island of Forgotten Gods
|
|
function on_forgotten_ship(mod_min)
|
|
if find_item( 2016091 ) >= 1 then
|
|
if mod_min <= 10 or ( mod_min >= 30 and mod_min <= 35 ) then
|
|
local itemHandle = get_item_handle(2016091)
|
|
set_flag( "onboard_time", get_os_time() - get_minute() )
|
|
warp( 174816 + math.random(0,10), 151777 + math.random(0,10) )
|
|
delete_item( itemHandle, 1 )
|
|
end
|
|
end
|
|
end
|
|
|