package script.conversation; import script.library.ai_lib; import script.library.chat; import script.library.groundquests; import script.library.utils; import script.*; public class npe_medic_wounded2 extends script.base_script { public npe_medic_wounded2() { } public static String c_stringFile = "conversation/npe_medic_wounded2"; public boolean npe_medic_wounded2_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean npe_medic_wounded2_condition_hasNotHealed(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "npe_medic2", "npe_medic2_heal"); } public boolean npe_medic_wounded2_condition_isBackWithToxin(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "npe_medic2", "return_technician"); } public boolean npe_medic_wounded2_condition_allHealed(obj_id player, obj_id npc) throws InterruptedException { return (groundquests.hasCompletedTask(player, "npe_medic2", "return_technician") || groundquests.hasCompletedQuest(player, "npe_medic2")); } public boolean npe_medic_wounded2_condition_wasHealed1(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "npe_medic2", "talk_technician"); } public void npe_medic_wounded2_action_sendSignalHealed(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "npe_medic_heal_worker_1"); return; } public void npe_medic_wounded2_action_facePlayer(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); } public void npe_medic_wounded2_action_sendSignalGoBack(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "npe_technician1"); } public void npe_medic_wounded2_action_sendSignalToxinDone(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "npe_technician2"); } public int npe_medic_wounded2_handleBranch1(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_29")) { if (npe_medic_wounded2_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_30"); utils.removeScriptVar(player, "conversation.npe_medic_wounded2.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_medic_wounded2_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_25")) { if (npe_medic_wounded2_condition__defaultCondition(player, npc)) { npe_medic_wounded2_action_sendSignalToxinDone(player, npc); string_id message = new string_id(c_stringFile, "s_27"); utils.removeScriptVar(player, "conversation.npe_medic_wounded2.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_medic_wounded2_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_24")) { if (npe_medic_wounded2_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_26"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_medic_wounded2_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.npe_medic_wounded2.branchId", 6); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_medic_wounded2.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_medic_wounded2_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_13")) { if (npe_medic_wounded2_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_15"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_medic_wounded2_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_18"); } utils.setScriptVar(player, "conversation.npe_medic_wounded2.branchId", 7); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_medic_wounded2.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_medic_wounded2_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_18")) { if (npe_medic_wounded2_condition__defaultCondition(player, npc)) { npe_medic_wounded2_action_sendSignalGoBack(player, npc); string_id message = new string_id(c_stringFile, "s_20"); utils.removeScriptVar(player, "conversation.npe_medic_wounded2.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_medic_wounded2_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_32")) { if (npe_medic_wounded2_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_34"); utils.removeScriptVar(player, "conversation.npe_medic_wounded2.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.npe_medic_wounded2"); } setCondition(self, CONDITION_CONVERSABLE); setInvulnerable(self, true); setName(self, "Injured Technician"); ai_lib.setCustomIdleAnimation(self, "npc_dead_03"); return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { setCondition(self, CONDITION_CONVERSABLE); setInvulnerable(self, true); setName(self, "Injured Technician"); ai_lib.setCustomIdleAnimation(self, "npc_dead_03"); 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.npe_medic_wounded2"); 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 (npe_medic_wounded2_condition_allHealed(player, npc)) { string_id message = new string_id(c_stringFile, "s_28"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_medic_wounded2_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_29"); } utils.setScriptVar(player, "conversation.npe_medic_wounded2.branchId", 1); npcStartConversation(player, npc, "npe_medic_wounded2", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (npe_medic_wounded2_condition_isBackWithToxin(player, npc)) { string_id message = new string_id(c_stringFile, "s_23"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_medic_wounded2_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_25"); } utils.setScriptVar(player, "conversation.npe_medic_wounded2.branchId", 3); npcStartConversation(player, npc, "npe_medic_wounded2", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (npe_medic_wounded2_condition_wasHealed1(player, npc)) { string_id message = new string_id(c_stringFile, "s_16"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_medic_wounded2_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_24"); } utils.setScriptVar(player, "conversation.npe_medic_wounded2.branchId", 5); npcStartConversation(player, npc, "npe_medic_wounded2", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (npe_medic_wounded2_condition_hasNotHealed(player, npc)) { string_id message = new string_id(c_stringFile, "s_22"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_medic_wounded2_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_32"); } utils.setScriptVar(player, "conversation.npe_medic_wounded2.branchId", 9); npcStartConversation(player, npc, "npe_medic_wounded2", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (npe_medic_wounded2_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_40"); 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("npe_medic_wounded2")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.npe_medic_wounded2.branchId"); if (branchId == 1 && npe_medic_wounded2_handleBranch1(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 3 && npe_medic_wounded2_handleBranch3(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 5 && npe_medic_wounded2_handleBranch5(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 6 && npe_medic_wounded2_handleBranch6(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 7 && npe_medic_wounded2_handleBranch7(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && npe_medic_wounded2_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.npe_medic_wounded2.branchId"); return SCRIPT_CONTINUE; } }