package script.conversation; import script.library.*; import script.*; public class station_rodian_base extends script.base_script { public station_rodian_base() { } public static String c_stringFile = "conversation/station_rodian_base"; public boolean station_rodian_base_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean station_rodian_base_condition_hasWon_assassinations(obj_id player, obj_id npc) throws InterruptedException { return (space_quest.hasReceivedReward(player, "assassinate", "ep3_kash_station_assassinate_neutral") || space_quest.hasReceivedReward(player, "assassinate", "ep3_kash_station_assassinate_rebel") || space_quest.hasReceivedReward(player, "assassinate", "ep3_kash_station_assassinate_imperial")); } public boolean station_rodian_base_condition_isTooFar(obj_id player, obj_id npc) throws InterruptedException { space_combat.playCombatTauntSound(player); obj_id containingShip = space_transition.getContainingShip(player); return (getDistance(npc, containingShip) > space_transition.STATION_COMM_MAX_DISTANCE); } public void station_rodian_base_action_grantDuty_destroy(obj_id player, obj_id npc) throws InterruptedException { space_quest.grantQuest(player, "destroy_duty", "ep3_kash_station_destroy_duty_rodian"); } public int station_rodian_base_handleBranch2(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_180")) { if (station_rodian_base_condition_hasWon_assassinations(player, npc)) { string_id message = new string_id(c_stringFile, "s_185"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (station_rodian_base_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_186"); } utils.setScriptVar(player, "conversation.station_rodian_base.branchId", 3); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } if (station_rodian_base_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_199"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (station_rodian_base_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_200"); } utils.setScriptVar(player, "conversation.station_rodian_base.branchId", 10); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_rodian_base_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_186")) { if (station_rodian_base_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_188"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (station_rodian_base_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (station_rodian_base_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (station_rodian_base_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse2 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_189"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_190"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_191"); } utils.setScriptVar(player, "conversation.station_rodian_base.branchId", 4); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_rodian_base_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_189")) { if (station_rodian_base_condition__defaultCondition(player, npc)) { station_rodian_base_action_grantDuty_destroy(player, npc); string_id message = new string_id(c_stringFile, "s_194"); utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); return SCRIPT_CONTINUE; } } if (response.equals("s_190")) { if (station_rodian_base_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_193"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (station_rodian_base_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (station_rodian_base_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_195"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_196"); } utils.setScriptVar(player, "conversation.station_rodian_base.branchId", 6); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } if (response.equals("s_191")) { if (station_rodian_base_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_192"); utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_rodian_base_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_195")) { if (station_rodian_base_condition__defaultCondition(player, npc)) { station_rodian_base_action_grantDuty_destroy(player, npc); string_id message = new string_id(c_stringFile, "s_198"); utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); return SCRIPT_CONTINUE; } } if (response.equals("s_196")) { if (station_rodian_base_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_197"); utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_rodian_base_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_200")) { if (station_rodian_base_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_201"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (station_rodian_base_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_203"); } utils.setScriptVar(player, "conversation.station_rodian_base.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_rodian_base_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_203")) { if (station_rodian_base_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_207"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (station_rodian_base_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_209"); } utils.setScriptVar(player, "conversation.station_rodian_base.branchId", 12); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_rodian_base_handleBranch12(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_209")) { if (station_rodian_base_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_211"); utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); chat.chat(npc, player, message); npcEndConversation(player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int OnInitialize(obj_id self) throws InterruptedException { setCondition(self, CONDITION_CONVERSABLE); return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { setCondition(self, CONDITION_CONVERSABLE); return SCRIPT_CONTINUE; } public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info menuInfo) throws InterruptedException { int menu = menuInfo.addRootMenu(menu_info_types.CONVERSE_START, null); menu_info_data menuInfoData = menuInfo.getMenuItemById(menu); menuInfoData.setServerNotify(false); setCondition(self, CONDITION_CONVERSABLE); return SCRIPT_CONTINUE; } public int OnIncapacitated(obj_id self, obj_id killer) throws InterruptedException { clearCondition(self, CONDITION_CONVERSABLE); detachScript(self, "conversation.station_rodian_base"); return SCRIPT_CONTINUE; } public boolean npcStartConversation(obj_id player, obj_id npc, String convoName, string_id greetingId, prose_package greetingProse, string_id[] responses) throws InterruptedException { Object[] objects = new Object[responses.length]; System.arraycopy(responses, 0, objects, 0, responses.length); return npcStartConversation(player, npc, convoName, greetingId, greetingProse, objects); } public int OnStartNpcConversation(obj_id self, obj_id player) throws InterruptedException { obj_id npc = self; if (ai_lib.isInCombat(npc) || ai_lib.isInCombat(player)) { return SCRIPT_OVERRIDE; } if (station_rodian_base_condition_isTooFar(player, npc)) { string_id message = new string_id(c_stringFile, "s_204"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (station_rodian_base_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_578"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (station_rodian_base_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_180"); } utils.setScriptVar(player, "conversation.station_rodian_base.branchId", 2); npcStartConversation(player, npc, "station_rodian_base", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } chat.chat(npc, "Error: All conditions for OnStartNpcConversation were false."); return SCRIPT_CONTINUE; } public int OnNpcConversationResponse(obj_id self, String conversationId, obj_id player, string_id response) throws InterruptedException { if (!conversationId.equals("station_rodian_base")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.station_rodian_base.branchId"); if (branchId == 2 && station_rodian_base_handleBranch2(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 3 && station_rodian_base_handleBranch3(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 4 && station_rodian_base_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 6 && station_rodian_base_handleBranch6(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && station_rodian_base_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && station_rodian_base_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 12 && station_rodian_base_handleBranch12(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.station_rodian_base.branchId"); return SCRIPT_CONTINUE; } }