package script.conversation; import script.library.ai_lib; import script.library.chat; import script.library.groundquests; import script.library.utils; import script.*; public class ephant_mon extends script.base_script { public ephant_mon() { } public static String c_stringFile = "conversation/ephant_mon"; public boolean ephant_mon_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean ephant_mon_condition_finishedReeYees(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.hasCompletedQuest(player, "quest/jabba_ree_yees_v2")) { return true; } return false; } public boolean ephant_mon_condition_killingTheSennex(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_ephant_mon", "killingTheSennex")) { return true; } return false; } public boolean ephant_mon_condition_killingTheSlaveMasters(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_ephant_mon", "killingTheSlaveMasters")) { return true; } return false; } public boolean ephant_mon_condition_collectingKeyChips(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_ephant_mon", "collectingKeyChips")) { return true; } return false; } public boolean ephant_mon_condition_wipingTheDatabank(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_ephant_mon", "wipingTheDatabank")) { return true; } return false; } public boolean ephant_mon_condition_returnToEphantMon(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_ephant_mon", "returnToEphantMon")) { return true; } return false; } public boolean ephant_mon_condition_finishedEphantMon(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.hasCompletedQuest(player, "quest/jabba_ephant_mon")) { return true; } return false; } public void ephant_mon_action_grantEphantMonQuest(obj_id player, obj_id npc) throws InterruptedException { groundquests.requestGrantQuest(player, "quest/jabba_ephant_mon"); } public void ephant_mon_action_endEphantMonQuest(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); groundquests.sendSignal(player, "ephantMonSignal"); groundquests.grantQuest(player, "pointer_porcellus"); } public void ephant_mon_action_clearPointer(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "found_ephant"); faceTo(npc, player); } public void ephant_mon_action_facePlayer(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); } public int ephant_mon_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_18")) { if (ephant_mon_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_20"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ephant_mon_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (ephant_mon_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_22"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_27"); } utils.setScriptVar(player, "conversation.ephant_mon.branchId", 8); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_42")) { if (ephant_mon_condition__defaultCondition(player, npc)) { ephant_mon_action_grantEphantMonQuest(player, npc); string_id message = new string_id(c_stringFile, "s_50"); utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_52")) { if (ephant_mon_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_54"); utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int ephant_mon_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_22")) { if (ephant_mon_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_41"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ephant_mon_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (ephant_mon_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_55"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_56"); } utils.setScriptVar(player, "conversation.ephant_mon.branchId", 9); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_27")) { if (ephant_mon_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_29"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ephant_mon_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.ephant_mon.branchId", 10); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int ephant_mon_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_55")) { if (ephant_mon_condition__defaultCondition(player, npc)) { ephant_mon_action_grantEphantMonQuest(player, npc); string_id message = new string_id(c_stringFile, "s_50"); utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_56")) { if (ephant_mon_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_54"); utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int ephant_mon_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_31")) { if (ephant_mon_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_33"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ephant_mon_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_43"); } utils.setScriptVar(player, "conversation.ephant_mon.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int ephant_mon_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_43")) { if (ephant_mon_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_44"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ephant_mon_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_45"); } utils.setScriptVar(player, "conversation.ephant_mon.branchId", 12); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int ephant_mon_handleBranch12(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_45")) { if (ephant_mon_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_46"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ephant_mon_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (ephant_mon_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_47"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_48"); } utils.setScriptVar(player, "conversation.ephant_mon.branchId", 13); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int ephant_mon_handleBranch13(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_47")) { if (ephant_mon_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_54"); utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_48")) { if (ephant_mon_condition__defaultCondition(player, npc)) { ephant_mon_action_grantEphantMonQuest(player, npc); string_id message = new string_id(c_stringFile, "s_50"); utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int OnInitialize(obj_id self) throws InterruptedException { if ((!isMob(self)) || (isPlayer(self))) { detachScript(self, "conversation.ephant_mon"); } setCondition(self, CONDITION_CONVERSABLE); setCondition(self, CONDITION_INTERESTING); return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { setCondition(self, CONDITION_CONVERSABLE); setCondition(self, CONDITION_INTERESTING); 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.ephant_mon"); 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 (ephant_mon_condition_finishedEphantMon(player, npc)) { ephant_mon_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_9"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ephant_mon_condition_returnToEphantMon(player, npc)) { ephant_mon_action_endEphantMonQuest(player, npc); string_id message = new string_id(c_stringFile, "s_5"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ephant_mon_condition_wipingTheDatabank(player, npc)) { ephant_mon_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_7"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ephant_mon_condition_collectingKeyChips(player, npc)) { ephant_mon_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_10"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ephant_mon_condition_killingTheSlaveMasters(player, npc)) { ephant_mon_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_12"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ephant_mon_condition_killingTheSennex(player, npc)) { ephant_mon_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_14"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ephant_mon_condition_finishedReeYees(player, npc)) { ephant_mon_action_clearPointer(player, npc); string_id message = new string_id(c_stringFile, "s_16"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ephant_mon_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (ephant_mon_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (ephant_mon_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_18"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_42"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_52"); } utils.setScriptVar(player, "conversation.ephant_mon.branchId", 7); npcStartConversation(player, npc, "ephant_mon", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (ephant_mon_condition__defaultCondition(player, npc)) { ephant_mon_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_58"); 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("ephant_mon")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.ephant_mon.branchId"); if (branchId == 7 && ephant_mon_handleBranch7(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 8 && ephant_mon_handleBranch8(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && ephant_mon_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && ephant_mon_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && ephant_mon_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 12 && ephant_mon_handleBranch12(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 13 && ephant_mon_handleBranch13(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.ephant_mon.branchId"); return SCRIPT_CONTINUE; } }