Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
require "lua_timers"
require "FTWR_Actions"
FTWR_Context = FTWR_Context or {}
local function splitString(inputString, delimiter)
local result = {} -- The resulting array
-- Loop through the string and find matches for the delimiter
for match in string.gmatch(inputString, "[^" .. delimiter .. "]+") do
table.insert(result, match) -- Add each match to the result array
end
return result
end
FTWR_Context.DoReturn = function(player, item)
print("Returning with ticket " .. item:getDisplayName());
if item:getDisplayName() ~= "Return Ticket" then
local splitResult = splitString(item:getDisplayName(), '#');
local x = splitResult[2]
local y = splitResult[3]
local z = splitResult[4]
getPlayer():getInventory():DoRemoveItem(item)
timer:Simple(11, function()
FTWR.TeleportPlayer(tonumber(x), tonumber(y), tonumber(z), false)
end)
if not timer:Exists("tpReturnDelay") then
timer:Create("tpReturnDelay", 1, 10, function()
if timer:RepsLeft("tpReturnDelay") == 2 then
getPlayer():playEmote("saluteformal")
end
getPlayer():setHaloNote("Teleporting to the return ticket's destination in " ..
timer:RepsLeft("tpReturnDelay"))
print("Teleporting to the return ticket's destination in " .. timer:RepsLeft("tpReturnDelay"))
end)
end
else
getPlayer():setHaloNote("Return Ticket seems to be invalid. Please contact our customer care!");
end
end
FTWR_Context.SetReturnTicketContextMenu = function(player, context, items)
if timer:Exists("tpReturnDelay") then
return;
end
-- If multiple selections = No Display
if #items > 1 then
return;
end
local item = items[1];
if item.items then
item = item.items[1];
end
-- if one of the selected items isn't ReturnTicket = No Display
if item:getFullType() ~= "FTWR.ReturnTicket" then
return;
end
-- Verifica se il ticket di ritorno è nell'inventario principale del giocatore
local mainInventory = getPlayer():getInventory()
if not mainInventory:contains(item) then
return;
end
if item:getDisplayName() == "Return Ticket" then
return;
end
context:addOption(getText("ContextMenu_return_ticket"), playerObj, FTWR_Context.DoReturn, item);
end
Events.OnFillInventoryObjectContextMenu.Add(FTWR_Context.SetReturnTicketContextMenu)