mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-02 02:15:48 -04:00
75 lines
2.2 KiB
Plaintext
75 lines
2.2 KiB
Plaintext
/* Title: terminal_travel.script
|
|
* Description: script that attaches to the travel terminal
|
|
*/
|
|
|
|
|
|
/***** INCLUDES ********************************************************/
|
|
include library.travel;
|
|
include library.utils;
|
|
include library.player_structure;
|
|
include library.city;
|
|
|
|
/***** CONSTANTS *******************************************************/
|
|
const string_id SID_TRAVEL_OPTIONS = new string_id("travel", "purchase_ticket");
|
|
const string_id SID_BANNED_TICKET = new string_id("city/city", "banned_services");
|
|
|
|
/***** TRIGGERS ********************************************************/
|
|
trigger OnUnloadedFromMemory()
|
|
{
|
|
obj_id starport = travel.getStarportFromTerminal(self);
|
|
LOG("LOG_CHANNEL", "terminal_travel::OnUnloadedFromMemory -- " + self + " from starport " + starport);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
//int travel_root = mi.addRootMenu (menu_info_types.SERVER_TRAVEL_OPTIONS, SID_TRAVEL_OPTIONS);
|
|
menu_info_data data = mi.getMenuItemByType (menu_info_types.ITEM_USE);
|
|
|
|
if (data != null)
|
|
data.setServerNotify (true);
|
|
else
|
|
mi.addRootMenu (menu_info_types.ITEM_USE, SID_TRAVEL_OPTIONS);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
if ( item == menu_info_types.ITEM_USE)
|
|
{
|
|
string planet = getCurrentSceneName();
|
|
obj_id starport = travel.getStarportFromTerminal(self);
|
|
string travel_point = travel.getTravelPointName(starport);
|
|
|
|
if ( player_structure.isCivic( starport ) )
|
|
{
|
|
// See if we are city banned.
|
|
int city_id = getCityAtLocation( getLocation(starport), 0 );
|
|
if ( city.isCityBanned( player, city_id ) )
|
|
{
|
|
// Can't buy a ticket.
|
|
sendSystemMessage( player, SID_BANNED_TICKET );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
|
|
LOG("LOG_CHANNEL", "player ->" + player + " planet ->" + planet + " travel_point ->" + travel_point);
|
|
|
|
// Check to see if terminals have been disabled.
|
|
string config = getConfigSetting("GameServer", "disableTravelSystem");
|
|
if (config != null)
|
|
{
|
|
if (config.equals("on"))
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
utils.setScriptVar(player, travel.SCRIPT_VAR_TERMINAL, self);
|
|
|
|
enterClientTicketPurchaseMode(player, planet, travel_point, false);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|