package script.conversation; import script.library.*; import script.*; public class station_indie_slaver extends script.base_script { public station_indie_slaver() { } public static String c_stringFile = "conversation/station_indie_slaver"; public boolean station_indie_slaver_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean station_indie_slaver_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_indie_slaver_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_indie_slaver_action_grantduty_recovery(obj_id player, obj_id npc) throws InterruptedException { space_quest.grantQuest(player, "recovery_duty", "ep3_indie_slavers_recovery"); } public int station_indie_slaver_handleBranch2(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_180")) { if (station_indie_slaver_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_indie_slaver_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_indie_slaver.branchId", 3); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_indie_slaver.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } if (station_indie_slaver_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_indie_slaver_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_indie_slaver.branchId", 9); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_indie_slaver.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_indie_slaver_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_186")) { if (station_indie_slaver_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_indie_slaver_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_190"); } utils.setScriptVar(player, "conversation.station_indie_slaver.branchId", 4); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_indie_slaver.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_indie_slaver_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_190")) { if (station_indie_slaver_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_indie_slaver_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_31"); } utils.setScriptVar(player, "conversation.station_indie_slaver.branchId", 5); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_indie_slaver.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_indie_slaver_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_31")) { if (station_indie_slaver_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_32"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (station_indie_slaver_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (station_indie_slaver_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_33"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_36"); } utils.setScriptVar(player, "conversation.station_indie_slaver.branchId", 6); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_indie_slaver.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_indie_slaver_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_33")) { if (station_indie_slaver_condition__defaultCondition(player, npc)) { station_indie_slaver_action_grantduty_recovery(player, npc); string_id message = new string_id(c_stringFile, "s_34"); utils.removeScriptVar(player, "conversation.station_indie_slaver.branchId"); chat.chat(npc, player, message); npcEndConversation(player); return SCRIPT_CONTINUE; } } if (response.equals("s_36")) { if (station_indie_slaver_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_38"); utils.removeScriptVar(player, "conversation.station_indie_slaver.branchId"); chat.chat(npc, player, message); npcEndConversation(player); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_indie_slaver_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_200")) { if (station_indie_slaver_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_indie_slaver_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_indie_slaver.branchId", 10); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_indie_slaver.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_indie_slaver_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_203")) { if (station_indie_slaver_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_indie_slaver_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_indie_slaver.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.station_indie_slaver.branchId"); chat.chat(npc, player, message); npcEndConversation(player); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int station_indie_slaver_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_209")) { if (station_indie_slaver_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_211"); utils.removeScriptVar(player, "conversation.station_indie_slaver.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_indie_slaver"); 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_indie_slaver_condition_isTooFar(player, npc)) { string_id message = new string_id(c_stringFile, "s_204"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (station_indie_slaver_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_indie_slaver_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_indie_slaver.branchId", 2); npcStartConversation(player, npc, "station_indie_slaver", 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_indie_slaver")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.station_indie_slaver.branchId"); if (branchId == 2 && station_indie_slaver_handleBranch2(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 3 && station_indie_slaver_handleBranch3(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 4 && station_indie_slaver_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 5 && station_indie_slaver_handleBranch5(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 6 && station_indie_slaver_handleBranch6(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && station_indie_slaver_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && station_indie_slaver_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && station_indie_slaver_handleBranch11(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_indie_slaver.branchId"); return SCRIPT_CONTINUE; } }