package script.conversation; import script.library.ai_lib; import script.library.chat; import script.library.groundquests; import script.library.utils; import script.*; public class tatooine_entha_ankwee extends script.base_script { public tatooine_entha_ankwee() { } public static String c_stringFile = "conversation/tatooine_entha_ankwee"; public boolean tatooine_entha_ankwee_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean tatooine_entha_ankwee_condition_onMeetAnkwee(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "tatooine_espa_pod_retrieval_v2", "tat_espa_pod_retrieval_e1"); } public boolean tatooine_entha_ankwee_condition_completedQuest(obj_id player, obj_id npc) throws InterruptedException { return groundquests.hasCompletedQuest(player, "tatooine_espa_pod_retrieval_v2"); } public boolean tatooine_entha_ankwee_condition_onGotoDraknus(obj_id player, obj_id npc) throws InterruptedException { return groundquests.hasCompletedTask(player, "tatooine_espa_pod_retrieval_v2", "tat_espa_pod_retrieval_e1"); } public boolean tatooine_entha_ankwee_condition_onRacing(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "tatooine_espa_pod_retrieval_v2", "tat_espa_pod_retrieval_e2"); } public boolean tatooine_entha_ankwee_condition_onReturnAnKwee(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "tatooine_espa_pod_retrieval_v2", "tat_espa_pod_retrieval_e3"); } public boolean tatooine_entha_ankwee_condition_onTalkAnKwee(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "tatooine_espa_pod_retrieval_v2", "tat_espa_pod_retrieval_e3"); } public void tatooine_entha_ankwee_action_grantGotoDraknus(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "tatooine_entha_goto_draknus"); } public void tatooine_entha_ankwee_action_signalPod(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "tat_espa_pod_retrieval_e3"); } public void tatooine_entha_ankwee_action_signalTalkAnKwee(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "tat_espa_pod_retrieval_e1"); } public int tatooine_entha_ankwee_handleBranch1(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_95")) { doAnimationAction(player, "shrug_hands"); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "shake_head_no"); string_id message = new string_id(c_stringFile, "s_96"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_97"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 2); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_entha_ankwee_handleBranch2(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_97")) { doAnimationAction(player, "nod"); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "nod_head_once"); string_id message = new string_id(c_stringFile, "s_98"); utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_entha_ankwee_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_91")) { doAnimationAction(player, "explain"); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "nod_head_once"); tatooine_entha_ankwee_action_signalPod(player, npc); string_id message = new string_id(c_stringFile, "s_92"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_93"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 5); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_entha_ankwee_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_93")) { doAnimationAction(player, "thank"); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "wave_finger_warning"); string_id message = new string_id(c_stringFile, "s_94"); utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_entha_ankwee_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_89")) { doAnimationAction(player, "nod"); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "wave1"); tatooine_entha_ankwee_action_grantGotoDraknus(player, npc); string_id message = new string_id(c_stringFile, "s_90"); utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_entha_ankwee_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_87")) { doAnimationAction(player, "shake_head_disgust"); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { tatooine_entha_ankwee_action_grantGotoDraknus(player, npc); string_id message = new string_id(c_stringFile, "s_88"); utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_entha_ankwee_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_79")) { doAnimationAction(player, "explain"); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "shrug_hands"); string_id message = new string_id(c_stringFile, "s_80"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_81"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 12); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_entha_ankwee_handleBranch12(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_81")) { doAnimationAction(player, "explain"); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_82"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_83"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 13); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_entha_ankwee_handleBranch13(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_83")) { doAnimationAction(player, "nod_head_once"); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "cough_polite"); string_id message = new string_id(c_stringFile, "s_84"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_85"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 14); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_entha_ankwee_handleBranch14(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_85")) { doAnimationAction(player, "nod_head_once"); tatooine_entha_ankwee_action_signalTalkAnKwee(player, npc); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { tatooine_entha_ankwee_action_grantGotoDraknus(player, npc); string_id message = new string_id(c_stringFile, "s_86"); utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_entha_ankwee_handleBranch16(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_77")) { doAnimationAction(player, "shake_head_no"); if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "thank"); string_id message = new string_id(c_stringFile, "s_78"); utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int OnInitialize(obj_id self) throws InterruptedException { if ((!isTangible(self)) || (isPlayer(self))) { detachScript(self, "conversation.tatooine_entha_ankwee"); } 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.tatooine_entha_ankwee"); 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 (tatooine_entha_ankwee_condition_completedQuest(player, npc)) { doAnimationAction(npc, "explain"); string_id message = new string_id(c_stringFile, "s_76"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_95"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 1); npcStartConversation(player, npc, "tatooine_entha_ankwee", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (tatooine_entha_ankwee_condition_onTalkAnKwee(player, npc)) { doAnimationAction(npc, "applause_polite"); string_id message = new string_id(c_stringFile, "s_75"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_91"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 4); npcStartConversation(player, npc, "tatooine_entha_ankwee", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (tatooine_entha_ankwee_condition_onRacing(player, npc)) { doAnimationAction(npc, "explain"); string_id message = new string_id(c_stringFile, "s_71"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_89"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 7); npcStartConversation(player, npc, "tatooine_entha_ankwee", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (tatooine_entha_ankwee_condition_onGotoDraknus(player, npc)) { doAnimationAction(player, "shrug_hands"); string_id message = new string_id(c_stringFile, "s_72"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_87"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 9); npcStartConversation(player, npc, "tatooine_entha_ankwee", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (tatooine_entha_ankwee_condition_onMeetAnkwee(player, npc)) { doAnimationAction(npc, "shrug_shoulders"); string_id message = new string_id(c_stringFile, "s_73"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_79"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 11); npcStartConversation(player, npc, "tatooine_entha_ankwee", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (tatooine_entha_ankwee_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "explain"); string_id message = new string_id(c_stringFile, "s_74"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_entha_ankwee_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_77"); } utils.setScriptVar(player, "conversation.tatooine_entha_ankwee.branchId", 16); npcStartConversation(player, npc, "tatooine_entha_ankwee", 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("tatooine_entha_ankwee")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); if (branchId == 1 && tatooine_entha_ankwee_handleBranch1(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 2 && tatooine_entha_ankwee_handleBranch2(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 4 && tatooine_entha_ankwee_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 5 && tatooine_entha_ankwee_handleBranch5(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 7 && tatooine_entha_ankwee_handleBranch7(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && tatooine_entha_ankwee_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && tatooine_entha_ankwee_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 12 && tatooine_entha_ankwee_handleBranch12(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 13 && tatooine_entha_ankwee_handleBranch13(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 14 && tatooine_entha_ankwee_handleBranch14(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 16 && tatooine_entha_ankwee_handleBranch16(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.tatooine_entha_ankwee.branchId"); return SCRIPT_CONTINUE; } }