package script.conversation; import script.library.ai_lib; import script.library.chat; import script.library.groundquests; import script.library.utils; import script.*; public class delivery_sickle extends script.base_script { public delivery_sickle() { } public static String c_stringFile = "conversation/delivery_sickle"; public boolean delivery_sickle_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean delivery_sickle_condition_noAntivirus(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); return (!groundquests.hasCompletedQuest(player, "outbreak_quest_01_imperial") && !groundquests.hasCompletedQuest(player, "outbreak_quest_01_rebel") && !groundquests.hasCompletedQuest(player, "outbreak_quest_01_neutral")); } public boolean delivery_sickle_condition_hasNotFoundBeta(obj_id player, obj_id npc) throws InterruptedException { return !hasCompletedCollectionSlot(player, "exp_icon_deathtroopers_camp_delta"); } public boolean delivery_sickle_condition_neverDelivered(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); return (!groundquests.isQuestActiveOrComplete(player, "camp_gamma_delivery_01")); } public boolean delivery_sickle_condition_hasMeetingTask(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "camp_gamma_delivery_01", "getBeastGamma"); } public boolean delivery_sickle_condition_hasEscortTask(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "camp_gamma_delivery_01", "escortTaskGamma"); } public boolean delivery_sickle_condition_hasDeliveredBefore(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isQuestActiveOrComplete(player, "camp_gamma_delivery_01"); } public boolean delivery_sickle_condition_tooLowLevel(obj_id player, obj_id npc) throws InterruptedException { return getLevel(player) < 40; } public void delivery_sickle_action_giveQuest(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); if (groundquests.hasCompletedQuest(player, "camp_gamma_delivery_01")) { delivery_sickle_action_clearDeliveryQuest(player, npc); } groundquests.grantQuest(player, "camp_gamma_delivery_01"); } public void delivery_sickle_action_clearDeliveryQuest(obj_id player, obj_id npc) throws InterruptedException { groundquests.clearQuest(player, "camp_gamma_delivery_01"); } public int delivery_sickle_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_96")) { if (delivery_sickle_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "explain"); string_id message = new string_id(c_stringFile, "s_97"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (delivery_sickle_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_13"); } utils.setScriptVar(player, "conversation.delivery_sickle.branchId", 7); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int delivery_sickle_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_13")) { if (delivery_sickle_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_17"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (delivery_sickle_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_19"); } utils.setScriptVar(player, "conversation.delivery_sickle.branchId", 8); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int delivery_sickle_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_19")) { if (delivery_sickle_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_21"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (delivery_sickle_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_23"); } utils.setScriptVar(player, "conversation.delivery_sickle.branchId", 9); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int delivery_sickle_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_23")) { if (delivery_sickle_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_25"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (delivery_sickle_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_27"); } utils.setScriptVar(player, "conversation.delivery_sickle.branchId", 10); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int delivery_sickle_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_27")) { if (delivery_sickle_condition__defaultCondition(player, npc)) { delivery_sickle_action_giveQuest(player, npc); string_id message = new string_id(c_stringFile, "s_29"); utils.removeScriptVar(player, "conversation.delivery_sickle.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int delivery_sickle_handleBranch12(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_33")) { if (delivery_sickle_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_35"); utils.removeScriptVar(player, "conversation.delivery_sickle.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.delivery_sickle"); } 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.delivery_sickle"); 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 (delivery_sickle_condition_noAntivirus(player, npc)) { string_id message = new string_id(c_stringFile, "s_7"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (delivery_sickle_condition_tooLowLevel(player, npc)) { string_id message = new string_id(c_stringFile, "s_37"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (delivery_sickle_condition_hasNotFoundBeta(player, npc)) { string_id message = new string_id(c_stringFile, "s_10"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (delivery_sickle_condition_hasEscortTask(player, npc)) { delivery_sickle_action_clearDeliveryQuest(player, npc); string_id message = new string_id(c_stringFile, "s_16"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (delivery_sickle_condition_hasMeetingTask(player, npc)) { string_id message = new string_id(c_stringFile, "s_15"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (delivery_sickle_condition_neverDelivered(player, npc)) { doAnimationAction(npc, "thumb_up"); string_id message = new string_id(c_stringFile, "s_73"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (delivery_sickle_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_96"); } utils.setScriptVar(player, "conversation.delivery_sickle.branchId", 6); npcStartConversation(player, npc, "delivery_sickle", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (delivery_sickle_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_31"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (delivery_sickle_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_33"); } utils.setScriptVar(player, "conversation.delivery_sickle.branchId", 12); npcStartConversation(player, npc, "delivery_sickle", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (delivery_sickle_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_60"); 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("delivery_sickle")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.delivery_sickle.branchId"); if (branchId == 6 && delivery_sickle_handleBranch6(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 7 && delivery_sickle_handleBranch7(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 8 && delivery_sickle_handleBranch8(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && delivery_sickle_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && delivery_sickle_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 12 && delivery_sickle_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.delivery_sickle.branchId"); return SCRIPT_CONTINUE; } }