include library.beast_lib; include library.utils; include library.colors; include library.space_dungeon; include library.stealth; include library.attrib; include library.prose; const string MESSAGE_SESSION = "messageTo.session"; const string WP_OBJECT = "object/tangible/ground_spawning/patrol_waypoint.iff"; const string PARENT = "parent"; const string ARRAY_CHILDREN = "parent.tempChildren"; const string TEMP_OBJECT = "tempObject"; const string WP_NAME = "wp_name"; const boolean LOGGING = false; //************************ //Quest Signals const string UPLINK_WIN_SIGNAL ="mustafar_uplink_established"; const string DECREPIT_ENTER_SIGNAL ="mustafar_factory_found"; const string DECREPIT_WIN_SIGNAL ="mustafar_factory_fixed"; const string ARMY_WIN_SIGNAL ="mustafar_droidarmy_victory"; const string WORKING_ENTER_SIGNAL ="mustafar_droidfactory_final"; const string WORKING_WIN_SIGNAL ="mustafar_droidfactory_shutdown"; const string VOLCANO_ENTER_SIGNAL ="volcano_arena_pilot"; const string VOLCANO_WIN_SIGNAL ="volcano_arena_victory"; //************************* //Decrepit Droid Factory const string DECREPIT_STF = "mustafar/decrepit_droid_factory"; const string_id SID_NOT_LOCKED = new string_id(DECREPIT_STF, "decrepit_not_locked"); const string_id SID_ACCESS_GRANTED = new string_id(DECREPIT_STF, "access_granted"); const string DECREPIT_MAIN_HALL = "mainroom27"; const string DECREPIT_ONE_TWO_STAIR = "hall2"; const string DECREPIT_TWO_THREE_STAIR = "hall5"; const string DECREPIT_TRAP_ROOM = "smallroom4"; const string DECREPIT_PRE_TRAP_ROOM = "smallroom5"; const string DECREPIT_ENVIRONMENTAL = "smallroom12"; const string DECREPIT_FIRE_CELL_EXIT = "hall15"; const string DECREPIT_FINAL_ROOM = "centralroom28"; const string[] FIRE_CELLS = {"mediumroom10","smallroom11","smallroom12","hall13"}; const string SECOND_ACCESS_BASE = "second_floor_access"; const string ACCESS_CODE = SECOND_ACCESS_BASE+".code"; const string RESET_CODE = SECOND_ACCESS_BASE+".reset"; const int RESET_TIMER = 20; const int SENSOR_RESET_TIME = 4; const string TRAP_STATE = "trap_state"; const string SENSOR_STATE = "sensor_state"; const string FIRE_CELL_STATE = "fire_cell_state"; const string POWER_CORE_STATE = "power_core_state"; const string GUARDIAN_LOCK_STATE = "guardian_lock_state"; const string DECREPIT_VICTORY_STATE = "decrepit_victory_state"; //********************************** //Working Droid Factory const string WORKING_STF = "mustafar/working_droid_factory"; const string_id TWINS_RESPAWN = new string_id (WORKING_STF, "twin_respawn"); const string_id TWINS_DEFEATED = new string_id (WORKING_STF, "twin_defeated"); const string_id TWINS_LOCK_ACTIVE = new string_id (WORKING_STF, "access_denied"); const string_id TWINS_KILL_CLUE = new string_id (WORKING_STF, "twin_kill_clue"); const string_id WORKING_DEVISTATOR_DEFEATED = new string_id (WORKING_STF, "devistator_defeated"); const string_id WORKING_INHIBITOR_NOCHARGE = new string_id (WORKING_STF, "inhibitor_lost_charge"); const string_id WORKING_INHIBITOR_RECHARGE = new string_id (WORKING_STF, "inhibitor_recharging"); const string_id WORKING_INHIBITOR_INACTIVE = new string_id (WORKING_STF, "inhibitor_inactive"); const string_id WORKING_INHIBITOR_COLLECT = new string_id (WORKING_STF, "inhibitor_collect"); const string_id WORKING_INHIBITOR_TAKEN = new string_id (WORKING_STF, "inhibitor_taken"); const string_id WORKING_RRU_OP_CLUE = new string_id (WORKING_STF, "rru_clue"); const string_id WORKING_RRU_INACTIVE = new string_id (WORKING_STF, "rru_inactive"); const string_id WORKING_RRU_ACTIVE = new string_id (WORKING_STF, "rru_active"); const string_id WORKING_RRU_FALTER = new string_id (WORKING_STF, "rru_falter"); const string_id WORKING_RRU_RECHARGE = new string_id (WORKING_STF, "rru_recharge"); const string_id WORKING_MDE_DEFEATED = new string_id (WORKING_STF, "mde_defeated"); const string_id WORKING_MDE_TAUNT = new string_id (WORKING_STF, "mde_taunt"); const string_id WORKING_DOOM_DEFEATED = new string_id (WORKING_STF, "doom_defeated"); const string_id WORKING_DOOM_FAILURE = new string_id (WORKING_STF, "doom_failure"); const string_id WORKING_HK47_TAUNT = new string_id (WORKING_STF, "hk47_taunt"); const string_id WORKING_DUALITY_APPLY = new string_id (WORKING_STF, "duality_applied"); const string_id WORKING_IMBALANCE_APPLY = new string_id (WORKING_STF, "imbalance_applied"); const string_id WORKING_IMBALANCE_FADE = new string_id (WORKING_STF, "imbalance_fade"); const string_id WORKING_OBSERVER_DETONATE = new string_id (WORKING_STF, "observer_detonate"); const string WORKING_MAIN_HALL = "mainroom27"; const string WORKING_ONE_TWO_STAIR = "hall2"; const string WORKING_TWO_THREE_STAIR = "hall7"; const string WORKING_DE_HALL = "hall13"; const string WORKING_MASTER_CONTROL = "centralroom28"; const string WORKING_CLONER_EXIT = "mdeClonerExit"; const string OBJECT_INHIBITOR = "object/tangible/dungeon/mustafar/working_droid_factory/inhibitor_storage.iff"; const string OBJECT_REACTIVE_REPAIR = "object/tangible/dungeon/mustafar/working_droid_factory/reactive_repair_module.iff"; const string OBJECT_DE_CLONER = "object/tangible/dungeon/mustafar/working_droid_factory/rapid_assembly_station.iff"; const string OBJECT_DECTRUCT_PILE = "object/tangible/dungeon/mustafar/working_droid_factory/radioactive_pile.iff"; const string WORKING_AUREK_KILLED = "isAurekKilled"; const string WORKING_BESH_KILLED = "isBeshKilled"; const string WORKING_AUREK_BESH_ENGAGED = "isAurekBeckEngaged"; const string AUREK_HEALTH = "health.aurek"; const string BESH_HEALTH = "health.besh"; const string WORKING_DEVISTATOR_KILLED = "isDevistatorKilled"; const string WORKING_DEVISTATOR_ENGAGED = "isDevistatorEngaged"; const string WORKING_INHIBITOR_TRACKER = "currentInhibitorSession"; const string WORKING_RRU_STATE = "rapidRepairUnitState"; const string WORKING_MDE_KILLED = "isMasterDroidEngineerKilled"; const string WORKING_MDE_ENGAGED = "isMdeEngaged"; const string WORKING_MDE_MOB = "isMdeMob"; const string WORKING_ASSEMBLY_STAGE = "eventStage"; const string WORKING_MDE_REVIVED = "wasRevived"; const string WORKING_POWER_SHUT_DOWN = "isPowerCoreOff"; const string WORKING_DOOM_BRINGER_KILLED = "isDoomBringerKilled"; const string WORKING_ACTIVE_HOD = "doom.activeHandOfDoom"; const string WORKING_PRIMARY_HAND = "doom.primaryHand"; const string WORKING_HOD_TARGET = "doom.objectiveTarget"; const string WORKING_HK_SPAWNED = "hk.isSpawned"; const string WORKING_HK_BOMB = "hk.isDetonated"; const string WORKING_AUREKBESH_KILL_TIME = "aurekBeshKillTime"; const int WORKING_AUREKBESH_RESPAWN_DELAY = 15; const boolean WORKING_LOGGING = false; //************************************** //Uplink Cave const boolean UPLINK_LOGGING = false; const string UPLINK_STF = "mustafar/uplink_cave"; const string UPLINK_VICTORY_STATE = "isUplinkEstablished"; const string UPLINK_DATA = "datatables/dungeon/mustafar_trials/link_establish/link_event_data.iff"; const string RELAY_OBJECT = "object/tangible/dungeon/mustafar/uplink_trial/relay_object.iff"; const string UPLINK_ESTABLISH_EFFECT = "blah.cef"; const string UPLINK_ROOM = "mainroom"; const string UPLINK_ACTIVE = "isUplinkTrialActive"; const string_id UPLINK_FOREMAN_SPAWN = new string_id(UPLINK_STF, "foreman_spawn"); //*************************************** //Droid Battlefield const boolean VALLEY_LOGGING = false; const string VALLEY_DATA = "datatables/dungeon/mustafar_trials/valley_battlefield/valley_event_data.iff"; const string BATTLEFIELD_VICTORY_STATE = "armyDefeated"; const string BATTLEFIELD_DROID_ARMY = "isArmy"; const string BATTLEFIELD_MINER = "isMiner"; const string BATTLEFIELD_COMMANDER_KILLED = "isCommanderKilled"; const string BATTLEFIELD_GENERATOR_DESTROYED = "isGeneratorDestoryed"; const string BATTLEFIELD_COMMANDER_LOGIC = "assaultFinal"; const string BATTLEFIELD_DROID_CORPSE = "droidCorpse"; const string BATTLEFIELD_STF = "mustafar/valley_battlefield"; const string_id BATTLEFIELD_GENERATOR_DEAD = new string_id(BATTLEFIELD_STF, "generator_destroyed"); const string_id BATTLEFIELD_COMMANDER_DIED = new string_id(BATTLEFIELD_STF, "commander_killed"); const string_id BATTLEFIELD_CMNDR_INTRO = new string_id(BATTLEFIELD_STF, "commander_intro"); const string_id BATTLEFIELD_WIN_MESSAGE = new string_id(BATTLEFIELD_STF, "battlefield_win_message"); const string_id BATTLEFIELD_LOSE_MESSAGE = new string_id(BATTLEFIELD_STF, "battlefield_lose_message"); const string_id BATTLEFIELD_LOSE_1 = new string_id(BATTLEFIELD_STF, "about_to_lose_1"); const string_id BATTLEFIELD_LOSE_2 = new string_id(BATTLEFIELD_STF, "about_to_lose_2"); const string_id BATTLEFIELD_LOSE_3 = new string_id(BATTLEFIELD_STF, "about_to_lose_3"); const int BATTLEFIELD_WAVE_DELAY = 150; const int BATTLEFIELD_COMM_REZ_DELAY = 18; //*************************************** //Volcano Battlefield const boolean VOLCANO_LOGGING = false; const string VOLCANO_STF = "mustafar/volcano_battlefield"; const string_id VOLCANO_TASKMASTER_STRENGTHEN = new string_id(VOLCANO_STF, "taskmaster_strengthen"); const string_id VOLCANO_CYM_BEETLE_NOTIFY = new string_id(VOLCANO_STF, "four_summon_add"); const string_id VOLCANO_OPP_ADD_NOTIFY = new string_id(VOLCANO_STF, "five_summon_trio"); const string_id VOLCANO_OPP_MIDGUARD = new string_id(VOLCANO_STF, "five_summon_midguard"); const string_id VOLCANO_HK_SUMMON_AK = new string_id(VOLCANO_STF, "hk_summon_walker"); const string_id VOLCANO_HK_TAUNT = new string_id(VOLCANO_STF, "hk_prefight_taunt"); const string VOLCANO_THREE_IS_BOSS = "isCommander"; const string VOLCANO_THREE_IS_CORPSE = "isCorpse"; const string VOLCANO_FOUR_IS_BEETLE = "isKubazaBeetle"; const string VOLCANO_FINAL_IS_CORPSE = "isCorpse"; //********************************************** //Sher Kar const boolean MONSTER_LOGGING = false; const string MONSTER_DATA ="datatables/dungeon/mustafar_trials/sher_kar/sher_kar_data"; const string MONSTER_STF = "mustafar/sher_kar"; const string MONSTER_AREA = "r1"; const string MONSTER_WP = "spawn_point"; const string MONSTER_SHER_KAR = "sherKar.id"; const string MONSTER_KARLING = "som_sherkar_karling"; const string MONSTER_PRAETORIAN = "som_sherkar_praetorian"; const string MONSTER_SYMBIOT = "som_sherkar_symbiot"; const string_id MONSTER_ENRAGE_WARNING = new string_id(MONSTER_STF, "enrage_warning"); const string_id MONSTER_SK_DEFEATED = new string_id(MONSTER_STF, "sk_defeated"); //**************************************** //Client Effects const string SND_POWERUP = "clienteffect/snd_forcefield_powerup.cef"; const string SND_POWERDOWN = "clienteffect/snd_forcefield_powerdown.cef"; const string PRT_CYM_DISEASE = "clienteffect/mus_cym_disease.cef"; const string PRT_CYM_POISON = "clienteffect/mus_cym_poison.cef"; const string PRT_DROID_HEAL = "clienteffect/mus_droid_heal.cef"; const string PRT_DROID_REVIVE = "clienteffect/mus_droid_revive.cef"; const string PRT_RELAY_ACTIVATE = "clienteffect/mus_relay_activate.cef"; const string PRT_RELAY_CREATE = "clienteffect/mus_relay_create.cef"; const string PRT_KUBAZA_EXPLODE = "clienteffect/exp_ap_landmine.cef"; const string PRT_KUBAZA_WARNING = "clienteffect/mus_kubaza_warning.cef"; const string PRT_INVULN_SHIELD = "appearance/pt_flash_shield.prt"; const string PRT_TRAP_STUN = "clienteffect/mus_relay_activate.cef"; const string PRT_WORKING_REPAIR_REZ = "clienteffect/mus_relay_create.cef"; const string PRT_WORKING_REPAIR_COMPILE = "clienteffect/mus_relay_create.cef"; const string PRT_WORKING_DUALITY_EXPLOSION = "appearance/pt_cmndo_shock_grenade5.prt"; const string PRT_WORKING_HK_BOOM_1 = "clienteffect/avatar_explosion_01.cef"; const string PRT_WORKING_HK_BOOM_2 = "clienteffect/avatar_explosion_02.cef"; const string PRT_WORKING_HK_BOOM_3 = "clienteffect/avatar_room_explosion.cef"; const string PRT_VOLCANO_WAVE_PRE = "appearance/pt_blast_wave_build_up.prt"; const string PRT_VOLCANO_WAVE_EXE = "appearance/pt_blast_wave.prt"; const string PRT_VOLCANO_AIR_PRE = "appearance/pt_rocket_barrage_wind_up.prt"; const string PRT_VOLCANO_AIR_EXE = "appearance/pt_rocket_barrage.prt"; const string PRT_VOLCANO_CONE_PRE = "appearance/pt_large_beam_warm_up.prt"; const string PRT_VOLCANO_CONE_EXE = "appearance/pt_large_beam.prt"; const string PRT_VOLCANO_YT_LANDING = "appearance/must_smoke_plume01.prt"; const string PRT_SHER_KAR_CAVE_IN = "clienteffect/cave_in_roof.cef"; //******************************************** //Sound Files const string MUS_BATTLEFIELD_DROID_ARMY_INTRO = "sound/mus_mustafar_droid_invasion_intro.snd"; const string MUS_VOLCANO_HK_INTRO = "sound/mus_mustafar_hk47_intro.snd"; const string MUS_MUST_QUEST_WIN = "sound/mus_mustafar_quest_success.snd"; const string MUS_MUST_QUEST_FAIL = "sound/mus_mustafar_quest_fail.snd"; //***************************************** //Script HP values const int HP_DECREPIT_COLONEL = 145000; const int HP_DECREPIT_GUARDIAN = 185250; const int HP_WORKING_AUREK_BESH = 448220; const int HP_WORKING_DEVISTATOR = 635425; const int HP_WORKING_MDE = 385225; const int HP_WORKING_FIXER_ONE = 855965; const int HP_WORKING_DOOM_HAND = 125000; const int HP_WORKING_DOOM_BRINGER = 705385; const int HP_DOOM_TARGET = 200000; const int HP_WORKING_ASSEMBLY = 50000; const int HP_BATTLEFIELD_GENERATOR = 65000; const int HP_VOLCANO_ONE_GUARD = 65000; const int HP_VOLCANO_ONE_BOSS = 545000; const int HP_VOLCANO_TWO_GUARD = 95250; const int HP_VOLCANO_TWO_BOSS = 655280; const int HP_VOLCANO_THREE_GUARD = 33500; const int HP_VOLCANO_THREE_RISEN = 60250; const int HP_VOLCANO_THREE_BOSS = 655250; const int HP_VOLCANO_FOUR_GUARD = 3000; const int HP_VOLCANO_FOUR_BOSS = 950485; const int HP_VOLCANO_FIVE_GUARD = 50000; const int HP_VOLCANO_FIVE_MIDGUARD = 100000; const int HP_VOLCANO_FIVE_BOSS = 220000; const int HP_VOLCANO_HK_SOLDIER = 14000; const int HP_VOLCANO_HK_SQUAD_LEADER = 20000; const int HP_VOLCANO_HK_RISEN_GUARD = 22525; const int HP_VOLCANO_HK_BEETLE = 9000; const int HP_VOLCANO_HK_SEPTIPOD = 75250; const int HP_VOLCANO_HK_CWW = 55855; const int HP_VOLCANO_HK47 = 545852; const int HP_SHER_KAR = 885000; const int HP_SHER_KAR_CONSORT = 225000; const int HP_SHER_KARLING = 65400; const int HP_SHER_KAR_PRAETORIAN = 120000; const int HP_SHER_KAR_LIFESAPPER = 95000; //*********************************************************** // Heroic Axkva HP Values const int HP_AKXVA_NANDINA = 245440; const int HP_AXKVA_GORVO = 614525; const int HP_AXKVA_LILLI_HI = 599258; const int HP_AXKVA_KIMARU = 818125; const int HP_AXKVA_SUIN = 1012400; const int HP_AXKVA = 1305858; //*********************************************************** // Heroic Exar Kun const int HP_EXAR_OPEN = 515325; const int HP_EXAR_MINDER = 623145; const int HP_EXAR_LURESH = 355245; const int HP_EXAR_VINRITH = 255454; const int HP_EXAR_CLOSED = 1485235; //*********************************************************** // Heroic Wampa Valley const int HP_UNCLE_JOE = 818125; const int HP_JOES_ADDS = 355325; //*********************************************************** //Dungeon lockout timers const int TIME_UPLINK_WIN = 60*60*2; // 2 hours const int TIME_DECREPIT_ADD = 60*90*1; // 1.5 hours const int TIME_DECREPIT_WIN = 60*60*3; // 3 hours const int TIME_BATTLEFIELD_WIN = 60*60*3; // 3 hours const int TIME_WORKING_ADD = 60*60*2; // 2 hours const int TIME_WORKING_WIN = 60*60*6; // 6 hours const int TIME_VOLCANO_ADD = 60*60*2; // 2 hours const int TIME_VOLCANO_WIN = 60*60*12; // 12 hours const int TIME_MONSTER_WIN = 60*60*20; // 20 hours //************************ //Heroic Encounter Items/Rewards const string [] HEROIC_TOKENS = { "item_heroic_token_axkva_01_01", // 0 "item_heroic_token_tusken_01_01", // 1 "item_heroic_token_ig88_01_01", // 2 "item_heroic_token_black_sun_01_01", // 3 "item_heroic_token_exar_01_01", // 4 "item_heroic_token_echo_base_01_01", // 5 "item_battlefield_rebel_token_massassi_isle", // 6 "item_battlefield_imperial_token_massassi_isle", // 7 "item_battlefield_rebel_token_battlefield2", // 8 "item_battlefield_imperial_token_battlefield2", // 9 "item_battlefield_rebel_token_battlefield3", // 10 "item_battlefield_imperial_token_battlefield3", // 11 "item_battlefield_rebel_token_battlefield4", // 12 "item_battlefield_imperial_token_battlefield4", // 13 "item_pgc_token_01", // 14 "item_pgc_token_02", // 15 "item_pgc_token_03", // 16 "item_gcw_rebel_token", // 17 "item_gcw_imperial_token", // 18 "item_token_duty_space_01_01" // 19 }; const int NUM_HEROIC_TOKEN_TYPES = 20; //********************************************** //Heroic Constants const string KIMARU_HATE_LIST = "kimaru_hate_list"; //Sequencer Controller WP Data const string WP_DATA = "nearPoint"; const string PROT_CHILD = "protected_data"; const string PROT_CHILD_ARRAY = "protected_data.child_array"; const string PROT_CHILD_KEY_LIST = "protected_data.key_list"; const string PATROL_PATH_FULL_DATA = "all_instance_patrol_path"; const string SEQUENCER_PATH_DATA = "sequencer_path_data"; //************************************************* // Heroic Token Box - The Box of Achievements const string SPACE_DUTY_TOKEN = "item_token_duty_space_01_01"; // Set up an int array with a size equal to the number of heroic encounters. void initializeBox(obj_id self) { int[] tokenTypes = new int[trial.NUM_HEROIC_TOKEN_TYPES]; for(int i = 0; i < trial.NUM_HEROIC_TOKEN_TYPES; i++) { tokenTypes[i] = 0; } setObjVar(self, "item.set.tokens_held", tokenTypes); return; } // Make sure array size is same as number of heroic encounters. Increase array size if it grew. void verifyBox(obj_id self) { int[] tokenTypes = getIntArrayObjVar(self, "item.set.tokens_held"); // Should never happen but in case it does. if(tokenTypes == null) { initializeBox(self); } // The number grew else if(tokenTypes.length < trial.NUM_HEROIC_TOKEN_TYPES) { int[] newTokenTypes = new int[trial.NUM_HEROIC_TOKEN_TYPES]; // so increase size of the array for(int i = 0; i < trial.NUM_HEROIC_TOKEN_TYPES; i++) { newTokenTypes[i] = 0; } // and copy the old data over. for(int i = 0; i < tokenTypes.length; i++) { newTokenTypes[i] = tokenTypes[i]; } setObjVar(self, "item.set.tokens_held", newTokenTypes); } return; } //************************************************* // Decrepit Droid Factory string generateNewKeyCode(obj_id dungeon) { int code = rand(100000,999999); string stringCode = Integer.toString(code); int endTime = getGameTime() + RESET_TIMER; utils.setScriptVar(dungeon, ACCESS_CODE, stringCode); utils.setScriptVar(dungeon, RESET_CODE, endTime); messageTo(dungeon, "codeResetOccured", null, 0, false); return stringCode; } string initializeCode(obj_id dungeon) { int code = 0; string stringCode = Integer.toString(code); int endTime = 0; utils.setScriptVar(dungeon, ACCESS_CODE, stringCode); utils.setScriptVar(dungeon, RESET_CODE, endTime); return stringCode; } string getKeyCode(obj_id dungeon) { dungeon = getTop(dungeon); if (!utils.hasScriptVar(dungeon, ACCESS_CODE)) return generateNewKeyCode(dungeon); else return utils.getStringScriptVar(dungeon, ACCESS_CODE); } int getResetTime(obj_id dungeon) { dungeon = getTop(dungeon); if (!utils.hasScriptVar(dungeon, RESET_CODE)) { generateNewKeyCode(dungeon); return utils.getIntScriptVar(dungeon, RESET_CODE); } else return utils.getIntScriptVar(dungeon, RESET_CODE); } void doCountdownTimerFlyText(obj_id terminal, int timer) { dictionary dict = new dictionary(); switch (timer) { case 10: showFlyText( terminal, new string_id(DECREPIT_STF, "ten"), 1.0f, colors.GREEN ); dict.put("timer", 9); messageTo(terminal, "showStatusFlyText", dict, 1, false); return; case 9: showFlyText( terminal, new string_id(DECREPIT_STF, "nine"), 1.0f, colors.GREEN ); dict.put("timer", 8); messageTo(terminal, "showStatusFlyText", dict, 1, false); return; case 8: showFlyText( terminal, new string_id(DECREPIT_STF, "eight"), 1.0f, colors.GREEN ); dict.put("timer", 7); messageTo(terminal, "showStatusFlyText", dict, 1, false); return; case 7: showFlyText( terminal, new string_id(DECREPIT_STF, "seven"), 1.0f, colors.GREEN ); dict.put("timer", 6); messageTo(terminal, "showStatusFlyText", dict, 1, false); return; case 6: showFlyText( terminal, new string_id(DECREPIT_STF, "six"), 1.0f, colors.GREEN ); dict.put("timer", 5); messageTo(terminal, "showStatusFlyText", dict, 1, false); return; case 5: showFlyText( terminal, new string_id(DECREPIT_STF, "five"), 1.0f, colors.GREEN ); dict.put("timer", 4); messageTo(terminal, "showStatusFlyText", dict, 1, false); return; case 4: showFlyText( terminal, new string_id(DECREPIT_STF, "four"), 1.0f, colors.GREEN ); dict.put("timer", 3); messageTo(terminal, "showStatusFlyText", dict, 1, false); return; case 3: showFlyText( terminal, new string_id(DECREPIT_STF, "three"), 1.0f, colors.GREEN ); dict.put("timer", 2); messageTo(terminal, "showStatusFlyText", dict, 1, false); return; case 2: showFlyText( terminal, new string_id(DECREPIT_STF, "two"), 1.0f, colors.GREEN ); dict.put("timer", 1); messageTo(terminal, "showStatusFlyText", dict, 1, false); return; case 1: showFlyText( terminal, new string_id(DECREPIT_STF, "one"), 1.0f, colors.GREEN ); dict.put("timer", 0); messageTo(terminal, "showStatusFlyText", dict, 1, false); return; } } boolean isTrapActive(obj_id dungeon) { dungeon = getTop(dungeon); boolean triggered = true; if (utils.hasScriptVar(dungeon, TRAP_STATE)) return utils.getBooleanScriptVar(dungeon, TRAP_STATE); else return false; } boolean isTrapPrimed(obj_id dungeon) { dungeon = getTop(dungeon); obj_id[] sensors = getObjectsInDungeonWithScript(dungeon, "theme_park.dungeon.mustafar_trials.decrepit_droid_factory.trap_terminal_scanner"); if (sensors == null || sensors.length == 0) { doLogging("isTrapPrimed", "Sensor list was null or empty"); return false; } boolean primed = false; for (int i=0;i 0) { for (int k=0; k 0) return convertedArray; else return null; } /** * Gets a list of non incapped players and pets in a dungeon * obj_id dungeon Dungeon to get the player list for * * return obj_id[] Array of valid targets **/ obj_id[] getValidTargetsInDungeon(obj_id dungeon) { obj_id[] players = getPlayersInDungeon(dungeon); obj_id[] pets = getObjectsInDungeonWithScript(dungeon, "ai.pet"); resizeable obj_id[] validTargets = new obj_id[0]; if (players != null && players.length > 0) { for (int i=0;i 0) { for (int q=0;q 0) { for (int k=0;k 0) { for (int k=0;k 0) { for (int k=0;k 0) { for (int k=0;k 0) { for (int k=0;k 0) { for (int k=0;k 0) { for (int k=0;k 0) { for (int i=0;i 0) { for (int k=0;k -1 ; q--) { newPpl.add(ppl[q]); } for (int r=0;r 0) { dictionary path_data = utils.hasScriptVar(kitParent, trial.SEQUENCER_PATH_DATA) ? utils.getDictionaryScriptVar(kitParent, trial.SEQUENCER_PATH_DATA) : null; if (path_data != null && !path_data.isEmpty()) utils.setScriptVar(npc, trial.SEQUENCER_PATH_DATA, utils.getDictionaryScriptVar(kitParent, trial.SEQUENCER_PATH_DATA)); setObjVar(npc, "patrol_path", patrol); setHibernationDelay(npc, 3600.0f); removeObjVar(npc, gcw.GCW_ENTERTAINMENT_FLAG); aiEquipPrimaryWeapon(npc); } else { //defensive position: mark NPC as entertainment npc utils.setScriptVar(patrolPoint, gcw.GCW_NPC_SCRIPTVAR_FLAG, npc); } attachScript(npc, "systems.dungeon_sequencer.ai_controller"); return npc; } boolean addNonInstanceFactionParticipant(obj_id who, obj_id target) { if(!isIdValid(who) || !exists(who) || !isPlayer(who) || !isIdValid(target) || !exists(target)) { return false; } //If the egg is not in a construction or combat phase, don't do anything. if(gcw.getGcwCityInvasionPhase(target) <= 0) { return false; } obj_id parent = trial.getParent(target); if(!isIdValid(parent) || !exists(parent)) { return false; } obj_id lastParent = null; while(!hasScript(parent, "systems.dungeon_sequencer.sequence_controller") && parent != lastParent) { lastParent = parent; parent = trial.getParent(parent); if(!isIdValid(parent) || !exists(parent)) { return false; } } string participantScriptVar = ""; if(factions.isRebelorRebelHelper(who)) { participantScriptVar = "gcw.rebel.participants"; } else if(factions.isImperialorImperialHelper(who)) { participantScriptVar = "gcw.imperial.participants"; } if(participantScriptVar == null || participantScriptVar.length() < 1) { CustomerServiceLog("gcw_city_invasion", "trial.addNonInstanceFactionParticipant: Player: "+who+" did not have the faction affiliation needed to be added to a participant list."); return false; } resizeable obj_id[] sideParticipants = new obj_id[0]; if(utils.hasScriptVar(parent, participantScriptVar)) { sideParticipants = utils.getResizeableObjIdArrayScriptVar(parent, participantScriptVar); if(sideParticipants != null && utils.isElementInArray(sideParticipants, who)) { CustomerServiceLog("gcw_city_invasion", "trial.addNonInstanceFactionParticipant: Player: "+who+" was already on the list as a paricipant so the operation was aborted."); return false; } } utils.addElement(sideParticipants, who); utils.setScriptVar(parent, participantScriptVar, sideParticipants); CustomerServiceLog("gcw_city_invasion", "trial.addNonInstanceFactionParticipant: Player: "+who+" has been added as a valid participant of the GCW city invasion for city object: "+parent); return true; } boolean removeNonInstanceFactionParticipant(obj_id who, obj_id target) { if(!isIdValid(who) || !exists(who) || !isPlayer(who) || !isIdValid(target) || !exists(target)) { return false; } obj_id parent = trial.getParent(target); if(!isIdValid(parent) || !exists(parent)) { return false; } obj_id lastParent = null; while(!hasScript(parent, "systems.dungeon_sequencer.sequence_controller") && parent != lastParent) { lastParent = parent; parent = trial.getParent(parent); if(!isIdValid(parent) || !exists(parent)) { return false; } } string participantScriptVar = ""; if(factions.isRebelorRebelHelper(who)) { participantScriptVar = "gcw.rebel.participants"; } else if(factions.isImperialorImperialHelper(who)) { participantScriptVar = "gcw.imperial.participants"; } if(participantScriptVar == null || participantScriptVar.length() < 1) { return false; } resizeable obj_id[] sideParticipants = new obj_id[0]; if(utils.hasScriptVar(parent, participantScriptVar)) { sideParticipants = utils.getResizeableObjIdArrayScriptVar(parent, participantScriptVar); if(sideParticipants != null && !utils.isElementInArray(sideParticipants, who)) { return false; } } utils.removeElement(sideParticipants, who); if(sideParticipants.length == 0) { utils.removeScriptVar(parent, participantScriptVar); CustomerServiceLog("gcw_city_invasion", "trial.removeNonInstanceFactionParticipant: Player: "+who+" has been REMOVED as a valid participant of the GCW city invasion for city object: "+parent); return true; } else if(utils.setScriptVar(parent, participantScriptVar, sideParticipants)) { CustomerServiceLog("gcw_city_invasion", "trial.removeNonInstanceFactionParticipant: Player: "+who+" has been REMOVED as a valid participant of the GCW city invasion for city object: "+parent); return true; } LOG("participant_credit", "removeNonInstanceFactionParticipant failed to set script var"); return false; } boolean isNonInstanceFactionParticipant(obj_id who, obj_id target) { if(!isIdValid(who) || !exists(who) || !isPlayer(who) || !isIdValid(target) || !exists(target)) { return false; } obj_id parent = trial.getParent(target); if(!isIdValid(parent) || !exists(parent)) { return false; } obj_id lastParent = null; while(!hasScript(parent, "systems.dungeon_sequencer.sequence_controller") && parent != lastParent) { lastParent = parent; parent = trial.getParent(parent); if(!isIdValid(parent) || !exists(parent)) { return false; } } string participantScriptVar = ""; if(factions.isRebelorRebelHelper(who)) { participantScriptVar = "gcw.rebel.participants"; } else if(factions.isImperialorImperialHelper(who)) { participantScriptVar = "gcw.imperial.participants"; } if(participantScriptVar == null || participantScriptVar.length() < 1) { return false; } resizeable obj_id[] sideParticipants = new obj_id[0]; if(utils.hasScriptVar(parent, participantScriptVar)) { sideParticipants = utils.getResizeableObjIdArrayScriptVar(parent, participantScriptVar); if(sideParticipants != null && !utils.isElementInArray(sideParticipants, who)) { return false; } for(int i = 0; i < sideParticipants.length; i++) { if(!isValidId(sideParticipants[i])) { continue; } if(sideParticipants[i] != who) { continue; } return true; } } return false; } resizeable obj_id[] getNonInstanceFactionParticipants(obj_id sequencer, int faction) { if(!isIdValid(sequencer) || !exists(sequencer)) { CustomerServiceLog("gcw_city_invasion", "trial.getNonInstanceFactionParticipants: Sequencer was invalid. Returning NULL."); return null; } if(!hasScript(sequencer, "systems.dungeon_sequencer.sequence_controller")) { CustomerServiceLog("gcw_city_invasion", "trial.getNonInstanceFactionParticipants: Sequencer did not have the sequence controller script. Returning NULL."); return null; } string participantScriptVar = ""; if(factions.FACTION_FLAG_REBEL == faction) { participantScriptVar = "gcw.rebel.participants"; } else if(factions.FACTION_FLAG_IMPERIAL == faction) { participantScriptVar = "gcw.imperial.participants"; } if(participantScriptVar == null || participantScriptVar.length() <= 0) { CustomerServiceLog("gcw_city_invasion", "trial.getNonInstanceFactionParticipants: Participant list not found. Returning NULL."); return null; } if(utils.hasScriptVar(sequencer, participantScriptVar)) { return utils.getResizeableObjIdArrayScriptVar(sequencer, participantScriptVar); } CustomerServiceLog("gcw_city_invasion", "trial.getNonInstanceFactionParticipants: Participant list not found. Returning NULL."); return null; } void clearNonInstanceFactionParticipants(obj_id sequencer) { if(!isIdValid(sequencer) || !exists(sequencer)) { CustomerServiceLog("gcw_city_invasion", "trial.clearNonInstanceFactionParticipants: Sequencer invalid. Aborting."); return; } if(!hasScript(sequencer, "systems.dungeon_sequencer.sequence_controller")) { CustomerServiceLog("gcw_city_invasion", "trial.clearNonInstanceFactionParticipants: Sequencer did not have sequence controller script. Aborting."); return; } utils.removeScriptVar(sequencer, "gcw.rebel.participants"); utils.removeScriptVar(sequencer, "gcw.imperial.participants"); } boolean purchaseTokenItem(obj_id player, int price, string tokenName) { // Attempt to make the item in their inventory. if(!isIdValid(player) || !exists(player) || price < 0 || tokenName == null || tokenName.length() <= 0) { return false; } obj_id[] inventoryContents = getInventoryAndEquipment(player); if(inventoryContents == null || inventoryContents.length <= 0) { return false; } int tokensOwed = price; // Destroy tokens boolean foundTokenHolderBox = false; for(int i = 0; i < inventoryContents.length; i++) { if(!isIdValid(inventoryContents[i]) || !exists(inventoryContents[i])) { continue; } string itemName = getStaticItemName(inventoryContents[i]); if (itemName != null && itemName != "") { if(itemName.equals(tokenName)) { if(getCount(inventoryContents[i]) > 1) { if(getCount(inventoryContents[i]) > tokensOwed) { setCount(inventoryContents[i], (getCount(inventoryContents[i]) - tokensOwed)); tokensOwed = 0; } else { tokensOwed = tokensOwed - getCount(inventoryContents[i]); destroyObject(inventoryContents[i]); } } else { destroyObject(inventoryContents[i]); tokensOwed--; } } // Virtual tokens. if(!foundTokenHolderBox && itemName.equals("item_heroic_token_box_01_01")) { foundTokenHolderBox = true; int vTokens = 0; if(hasObjVar(inventoryContents[i], "item.set.tokens_held")) { int[] virtualTokens = getIntArrayObjVar(inventoryContents[i], "item.set.tokens_held"); int t = -1; for(int k = 0; k < HEROIC_TOKENS.length; k++) { if(HEROIC_TOKENS[k].equals(tokenName)) { t = k; vTokens = virtualTokens[t]; } } if(t > -1) { if(vTokens > tokensOwed) { vTokens = vTokens - tokensOwed; virtualTokens[t] = vTokens; tokensOwed = 0; } else { tokensOwed = tokensOwed - vTokens; virtualTokens[t] = 0; } setObjVar(inventoryContents[i], "item.set.tokens_held", virtualTokens); } } } } } if(tokensOwed == 0) { return true; } return false; } // Space Duty - Get token price int getSpaceDutyTokenPrice(int level) { int price = level * 5; price = price + 50; return price; } int getTokenTotal(obj_id player, string token) { int tokenCount = 0; if(!isIdValid(player) || !exists(player) || token == null || token.length() <= 0) { return 0; } obj_id[] inventoryContents = getInventoryAndEquipment(player); if(inventoryContents == null || inventoryContents.length <= 0) { return 0; } boolean foundTokenHolderBox = false; for(int i = 0; i < inventoryContents.length; i++) { if(!isIdValid(inventoryContents[i]) || !exists(inventoryContents[i])) { continue; } string itemName = getStaticItemName(inventoryContents[i]); if (itemName != null && itemName != "") { // Physical tokens. if(itemName.equals(token)) { if(getCount(inventoryContents[i]) > 1) { tokenCount = tokenCount + getCount(inventoryContents[i]); } else { tokenCount++; } } // Virtual tokens. if(!foundTokenHolderBox && itemName.equals("item_heroic_token_box_01_01")) { foundTokenHolderBox = true; trial.verifyBox(inventoryContents[i]); int t = 0; if(hasObjVar(inventoryContents[i], "item.set.tokens_held")) { int[] virtualTokenArray = getIntArrayObjVar(inventoryContents[i], "item.set.tokens_held"); for(int k = 0; k < trial.HEROIC_TOKENS.length; k++) { if(trial.HEROIC_TOKENS[k].equals(token)) { t = k; } } tokenCount = tokenCount+virtualTokenArray[t]; } } } } return tokenCount; }