function Player.sendModalringvip(self)
local cid = self:getId()
local window = ModalWindow {
title = "temples",
message = "Which of the temples below would you like to be teleported to?",
}
local towns = {}
for i, town in ipairs(Game.getTowns()) do
towns[#towns + 1] = town:getName()
end
-- sort table alphabetically
table.sort(towns)
for i = 1, #towns do
local name = towns[i]
if not table.contains(blockedCitys, name:lower()) then
window:addChoice(name)
end
end
window:addButton("Go!",
function(button, choice)
local self = Player(cid)
local town = Town(choice.text)
if self and town then
self:teleportTo(town:getTemplePosition())
end
end
)
window:setDefaultEnterButton("Go!")
window:addButton("back",
function(button, choice)
local self = Player(cid)
if self then
self:sendMainModalringvip()
end
end
)
window:addButton("Exit")
window:sendToPlayer(self)
end