mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
120 lines
3.8 KiB
Plaintext
120 lines
3.8 KiB
Plaintext
/**********************************************************************
|
|
* Title: travel_bag
|
|
* Description: Attaches to the vendor recovery bad and enables the player to travel
|
|
* to a planet of their choice.
|
|
**********************************************************************/
|
|
|
|
|
|
/***** INCLUDES ********************************************************/
|
|
|
|
|
|
/***** CONSTANTS *******************************************************/
|
|
const string DATATABLE_START_LOCATIONS = "datatables/creation/starting_locations.iff";
|
|
const string SCRIPT_TRAVEL_BAG = "item.container.travel_bag";
|
|
|
|
const string_id SID_TRAVEL_TATOOINE = new string_id("travel", "travel_tatooine");
|
|
const string_id SID_TRAVEL_NABOO = new string_id("travel", "travel_naboo");
|
|
const string_id SID_TRAVEL_CORELLIA = new string_id("travel", "travel_corellia");
|
|
const string_id SID_TRAVEL_LOK = new string_id("travel", "travel_lok");
|
|
const string_id SID_TRAVEL_DANTOOINE = new string_id("travel", "travel_dantooine");
|
|
const string_id SID_TRAVEL_TALUS = new string_id("travel", "travel_talus");
|
|
const string_id SID_TRAVEL_RORI = new string_id("travel", "travel_rori");
|
|
|
|
const string_id SID_NO_LOCATION_FOUND = new string_id("travel", "no_location_found");
|
|
const string_id SID_ALREADY_THERE = new string_id("travel", "already_there");
|
|
|
|
/***** TRIGGERS ********************************************************/
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
int root_menu = mi.addRootMenu (menu_info_types.SERVER_MENU1, SID_TRAVEL_TATOOINE);
|
|
|
|
mi.addSubMenu(root_menu, menu_info_types.SERVER_MENU2, SID_TRAVEL_NABOO);
|
|
mi.addSubMenu(root_menu, menu_info_types.SERVER_MENU3, SID_TRAVEL_CORELLIA);
|
|
mi.addSubMenu(root_menu, menu_info_types.SERVER_MENU4, SID_TRAVEL_LOK);
|
|
mi.addSubMenu(root_menu, menu_info_types.SERVER_MENU5, SID_TRAVEL_DANTOOINE);
|
|
mi.addSubMenu(root_menu, menu_info_types.SERVER_MENU6, SID_TRAVEL_TALUS);
|
|
mi.addSubMenu(root_menu, menu_info_types.SERVER_MENU7, SID_TRAVEL_RORI);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
string travel_point;
|
|
if (item == menu_info_types.SERVER_MENU1)
|
|
travel_point = "mos_eisley";
|
|
|
|
else if (item == menu_info_types.SERVER_MENU2)
|
|
travel_point = "theed";
|
|
|
|
else if (item == menu_info_types.SERVER_MENU3)
|
|
travel_point = "coronet";
|
|
|
|
else if (item == menu_info_types.SERVER_MENU4)
|
|
travel_point = "lok";
|
|
|
|
else if (item == menu_info_types.SERVER_MENU5)
|
|
travel_point = "dantooine";
|
|
|
|
else if (item == menu_info_types.SERVER_MENU6)
|
|
travel_point = "dearic";
|
|
|
|
else if (item == menu_info_types.SERVER_MENU7)
|
|
travel_point = "narmle";
|
|
else
|
|
return SCRIPT_CONTINUE;
|
|
|
|
|
|
int idx = dataTableSearchColumnForString(travel_point, "location", DATATABLE_START_LOCATIONS);
|
|
float x = 0.0f;
|
|
float z = 0.0f;
|
|
string planet = "none";
|
|
|
|
if (idx > -1)
|
|
{
|
|
dictionary row = dataTableGetRow(DATATABLE_START_LOCATIONS, idx);
|
|
x = row.getFloat("x");
|
|
z = row.getFloat("z");
|
|
planet = row.getString("planet");
|
|
}
|
|
else
|
|
{
|
|
// It could be one of our planets where there are no starting locations.
|
|
if (travel_point.equals("lok"))
|
|
{
|
|
planet = "lok";
|
|
x = 108;
|
|
z = 320;
|
|
}
|
|
else if (travel_point.equals("dantooine"))
|
|
{
|
|
planet = "dantooine";
|
|
// Mining Outpost
|
|
x = -617;
|
|
z = 2478;
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessage(player, SID_NO_LOCATION_FOUND);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
|
|
string current_planet = getCurrentSceneName();
|
|
if (current_planet.equals(planet))
|
|
{
|
|
sendSystemMessage(player, SID_ALREADY_THERE);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// remove the script from the bag as this can only be used once.
|
|
detachScript(self, SCRIPT_TRAVEL_BAG);
|
|
|
|
// Move the player.
|
|
//LOG("LOG_CHANNEL", "Moving " + player + " to " + planet + " " + travel_point + " " + x + " " + z);
|
|
warpPlayer(player, planet, x, 0.0f, z, null, 0.0f, 0.0f, 0.0f);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|