include library.callable; include library.space_dungeon; include library.sui; include library.utils; include library.pclib; include library.colors_hex; include library.pet_lib; include library.vehicle; include library.transition; const float distanceMax = 6.0f; const string dataTable = "datatables/travel/zone_transition.iff"; const string STF = "travel/zone_transition"; //Population constants const int LIGHT = 20; const int MEDIUM = 40; const int HEAVY = 60; const int FULL = 80; const string_id LIGHT_STRING = new string_id (STF, "population_light"); const string_id MEDIUM_STRING = new string_id (STF, "population_medium"); const string_id HEAVY_STRING = new string_id (STF, "population_heavy"); const string_id FULL_STRING = new string_id (STF, "population_full"); const string_id zone_unavailable = new string_id (STF, "zone_unavailable"); const string_id bad_zone_data = new string_id (STF, "bad_zone_data"); const string_id invalid_travel = new string_id (STF, "invalid_travel"); const boolean doLogging = false; //--------------------For the temporary speaker hack------------------- trigger OnAttach() { if (hasScript(self, "item.microphone_and_speaker.speaker")) detachScript(self, "item.microphone_and_speaker.speaker"); return SCRIPT_CONTINUE; } trigger OnInitialize() { if (hasScript(self, "item.microphone_and_speaker.speaker")) detachScript(self, "item.microphone_and_speaker.speaker"); return SCRIPT_CONTINUE; } //---------------------------------------------------------------------- trigger OnObjectMenuRequest(obj_id player, menu_info item) { //Yanked distance check //if (getDistance(player, self) > distanceMax) // return SCRIPT_CONTINUE; if (!isMob(self)) { item.addRootMenu(menu_info_types.ITEM_USE, transition.getZoneTransitionString(self)); } return SCRIPT_CONTINUE; } trigger OnObjectMenuSelect(obj_id player, int item) { if ( item == menu_info_types.ITEM_USE) { utils.dismountRiderJetpackCheck(player); transition.zonePlayer(self, player); utils.dismountRiderJetpackCheck(player); } return SCRIPT_CONTINUE; } trigger OnClusterWideDataResponse(string manage_name, string name, int request_id, string[] element_name_list, dictionary[] data, int lock_key) { string transit = getStringObjVar(self, "zoneLine"); resizeable obj_id[] building_ids = new obj_id[0]; resizeable int[] zone_population = new int[0]; string destination = dataTableGetString(dataTable, transit, "destination"); string[] parse = split(destination, ':'); for (int i = 0; i < data.length; i++) { dictionary dungeon = data[i]; building_ids = utils.addElement(building_ids, dungeon.getObjId("building_id")); zone_population = utils.addElement(zone_population, dungeon.getInt("population")); } if (parse.length < 1 || data.length < 1) { obj_id player = utils.getObjIdScriptVar(self, "playerId"); sendSystemMessage(player, zone_unavailable); releaseClusterWideDataLock(manage_name, lock_key); return SCRIPT_CONTINUE; } doLogging("OnCWDResponse", "transit, destination, parse[0], parse[1], parse[2]"); doLogging("OnCWDResponse", transit+", "+destination+", "+parse[0]+", "+parse[1]+", "+parse[2]); doLogging("OnCWDResponse", "building_ids[0] = "+building_ids[0]); releaseClusterWideDataLock(manage_name, lock_key); handleListBoxZoneSelect(self, parse, building_ids, zone_population); return SCRIPT_CONTINUE; } void handleListBoxZoneSelect(obj_id self, string[] parsedList, resizeable obj_id[] building_ids, resizeable int[] zone_population) { obj_id player = utils.getObjIdScriptVar(self, "playerId"); string[] zoneList = new string[building_ids.length]; int k = 1; for(int i = 0;i 0) { for (int q = 0;q