package script.conversation; import script.*; import script.base_class.*; import script.combat_engine.*; import java.util.Arrays; import java.util.Hashtable; import java.util.Vector; import script.base_script; import script.library.ai_lib; import script.library.chat; import script.library.content; import script.library.conversation; import script.library.groundquests; import script.library.utils; public class wod_ns_sage extends script.base_script { public wod_ns_sage() { } public static String c_stringFile = "conversation/wod_ns_sage"; public boolean wod_ns_sage_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean wod_ns_sage_condition_hasPreqComplete(obj_id player, obj_id npc) throws InterruptedException { if ((hasObjVar(player, "wod_prologue_quests")) && (groundquests.hasCompletedQuest(player, "wod_rubina_goto_ns")) && (!groundquests.hasCompletedQuest(player, "wod_ns_repair_alter_01"))) { return true; } return false; } public boolean wod_ns_sage_condition_onReturnAlter01NS(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_ns_repair_alter_01", "returnToSage"); } public boolean wod_ns_sage_condition_onReturnAlter02NS(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_ns_repair_alter_02", "returnToSage"); } public boolean wod_ns_sage_condition_onReturnAlter04NS(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_ns_repair_alter_04", "returnToSage"); } public boolean wod_ns_sage_condition_onReturnAlter03NS(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_ns_repair_alter_03", "returnToSage"); } public boolean wod_ns_sage_condition_IsSM(obj_id player, obj_id npc) throws InterruptedException { if (!hasObjVar(player, "wod_prologue_quests")) { return false; } int status = getIntObjVar(player, "wod_prologue_quests"); if (status < 1) { return true; } return false; } public boolean wod_ns_sage_condition_IsIndifferent(obj_id player, obj_id npc) throws InterruptedException { if (!hasObjVar(player, "wod_prologue_quests")) { return false; } int status = getIntObjVar(player, "wod_prologue_quests"); if ((status > 0) && (status < 8)) { return true; } return false; } public boolean wod_ns_sage_condition_IsNoTrader(obj_id player, obj_id npc) throws InterruptedException { if (content.isCrafter(player)) { return false; } return true; } public boolean wod_ns_sage_condition_hasQuestActive(obj_id player, obj_id npc) throws InterruptedException { return questIsQuestActive(questGetQuestId("quest/wod_ns_repair_alter_01"), player) || questIsQuestActive(questGetQuestId("quest/wod_ns_repair_alter_02"), player) || questIsQuestActive(questGetQuestId("quest/wod_ns_repair_alter_03"), player) || questIsQuestActive(questGetQuestId("quest/wod_ns_repair_alter_04"), player) || questIsQuestActive(questGetQuestId("quest/wod_sm_repair_alter_01"), player) || questIsQuestActive(questGetQuestId("quest/wod_sm_repair_alter_02"), player) || questIsQuestActive(questGetQuestId("quest/wod_sm_repair_alter_03"), player) || questIsQuestActive(questGetQuestId("quest/wod_sm_repair_alter_04"), player); } public boolean wod_ns_sage_condition_hasCompletedAlter04NS(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_ns_repair_alter_04", "returnToSage") || groundquests.hasCompletedQuest(player, "wod_ns_repair_alter_04"); } public boolean wod_ns_sage_condition_hasCompletedAlter03NS(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_ns_repair_alter_03", "returnToSage") || groundquests.hasCompletedQuest(player, "wod_ns_repair_alter_03"); } public boolean wod_ns_sage_condition_hasCompletedAlter02NS(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_ns_repair_alter_02", "returnToSage") || groundquests.hasCompletedQuest(player, "wod_ns_repair_alter_02"); } public boolean wod_ns_sage_condition_hasCompletedAlter01NS(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_ns_repair_alter_01", "returnToSage") || groundquests.hasCompletedQuest(player, "wod_ns_repair_alter_01"); } public void wod_ns_sage_action_grantTPAlter01NS(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "quest/wod_ns_repair_alter_01"); } public void wod_ns_sage_action_grantTPAlter02NS(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "quest/wod_ns_repair_alter_02"); } public void wod_ns_sage_action_grantTPAlter03NS(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "quest/wod_ns_repair_alter_03"); } public void wod_ns_sage_action_grantTPAlter04NS(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "quest/wod_ns_repair_alter_04"); } public void wod_ns_sage_action_sendReturnedSignalAlter01NS(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "returnToSage"); } public void wod_ns_sage_action_sendReturnedSignalAlter02NS(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "returnToSage"); } public void wod_ns_sage_action_sendReturnedSignalAlter03NS(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "returnToSage"); } public void wod_ns_sage_action_sendReturnedSignalAlter04NS(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "returnToSage"); } public int wod_ns_sage_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_39")) { wod_ns_sage_action_sendReturnedSignalAlter01NS(player, npc); if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_74"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_ns_sage_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_76"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_80"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 24); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_76")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { wod_ns_sage_action_grantTPAlter02NS(player, npc); string_id message = new string_id(c_stringFile, "s_67"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_80")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_82"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_114")) { wod_ns_sage_action_sendReturnedSignalAlter02NS(player, npc); if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_94"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_ns_sage_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_87"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_91"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 21); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_87")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { wod_ns_sage_action_grantTPAlter03NS(player, npc); string_id message = new string_id(c_stringFile, "s_89"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_91")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_93"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_115")) { wod_ns_sage_action_sendReturnedSignalAlter03NS(player, npc); if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_125"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_ns_sage_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_129"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_137"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 18); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_129")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { wod_ns_sage_action_grantTPAlter04NS(player, npc); string_id message = new string_id(c_stringFile, "s_133"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_137")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_139"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_116")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_148"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_150"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_150")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { wod_ns_sage_action_sendReturnedSignalAlter04NS(player, npc); string_id message = new string_id(c_stringFile, "s_152"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch13(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_99")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_101"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_103"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 14); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch14(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_103")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_105"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_107"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 15); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch15(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_107")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_109"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch18(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_129")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { wod_ns_sage_action_grantTPAlter04NS(player, npc); string_id message = new string_id(c_stringFile, "s_133"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_137")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_139"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch21(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_87")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { wod_ns_sage_action_grantTPAlter03NS(player, npc); string_id message = new string_id(c_stringFile, "s_89"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_91")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_93"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch24(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_76")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { wod_ns_sage_action_grantTPAlter02NS(player, npc); string_id message = new string_id(c_stringFile, "s_67"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_80")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_82"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch27(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_53")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_55"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_57"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 28); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch28(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_57")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_59"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_ns_sage_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_61"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_69"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 29); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch29(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_61")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_63"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_65"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 30); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_69")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_71"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_ns_sage_handleBranch30(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_65")) { if (wod_ns_sage_condition__defaultCondition(player, npc)) { wod_ns_sage_action_grantTPAlter01NS(player, npc); string_id message = new string_id(c_stringFile, "s_67"); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int OnInitialize(obj_id self) throws InterruptedException { if ((!isTangible(self)) || (isPlayer(self))) { detachScript(self, "conversation.wod_ns_sage"); } 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.wod_ns_sage"); 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 (wod_ns_sage_condition_IsSM(player, npc)) { string_id message = new string_id(c_stringFile, "s_5"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_IsIndifferent(player, npc)) { string_id message = new string_id(c_stringFile, "s_7"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_IsNoTrader(player, npc)) { string_id message = new string_id(c_stringFile, "s_14"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_onReturnAlter01NS(player, npc)) { string_id message = new string_id(c_stringFile, "s_37"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_39"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 4); npcStartConversation(player, npc, "wod_ns_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_onReturnAlter02NS(player, npc)) { string_id message = new string_id(c_stringFile, "s_110"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_114"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 6); npcStartConversation(player, npc, "wod_ns_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_onReturnAlter03NS(player, npc)) { string_id message = new string_id(c_stringFile, "s_111"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_115"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 8); npcStartConversation(player, npc, "wod_ns_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_onReturnAlter04NS(player, npc)) { string_id message = new string_id(c_stringFile, "s_112"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_116"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 10); npcStartConversation(player, npc, "wod_ns_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_hasQuestActive(player, npc)) { string_id message = new string_id(c_stringFile, "s_96"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_99"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 13); npcStartConversation(player, npc, "wod_ns_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_hasCompletedAlter04NS(player, npc)) { string_id message = new string_id(c_stringFile, "s_113"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_hasCompletedAlter03NS(player, npc)) { string_id message = new string_id(c_stringFile, "s_125"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_ns_sage_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_129"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_137"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 18); npcStartConversation(player, npc, "wod_ns_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_hasCompletedAlter02NS(player, npc)) { string_id message = new string_id(c_stringFile, "s_94"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_ns_sage_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_87"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_91"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 21); npcStartConversation(player, npc, "wod_ns_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_hasCompletedAlter01NS(player, npc)) { string_id message = new string_id(c_stringFile, "s_74"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_ns_sage_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_76"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_80"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 24); npcStartConversation(player, npc, "wod_ns_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_ns_sage_condition_hasPreqComplete(player, npc)) { string_id message = new string_id(c_stringFile, "s_49"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_ns_sage_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_53"); } utils.setScriptVar(player, "conversation.wod_ns_sage.branchId", 27); npcStartConversation(player, npc, "wod_ns_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_ns_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_97"); 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("wod_ns_sage")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.wod_ns_sage.branchId"); if (branchId == 4 && wod_ns_sage_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 5 && wod_ns_sage_handleBranch5(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 6 && wod_ns_sage_handleBranch6(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 7 && wod_ns_sage_handleBranch7(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 8 && wod_ns_sage_handleBranch8(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && wod_ns_sage_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && wod_ns_sage_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && wod_ns_sage_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 13 && wod_ns_sage_handleBranch13(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 14 && wod_ns_sage_handleBranch14(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 15 && wod_ns_sage_handleBranch15(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 18 && wod_ns_sage_handleBranch18(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 21 && wod_ns_sage_handleBranch21(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 24 && wod_ns_sage_handleBranch24(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 27 && wod_ns_sage_handleBranch27(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 28 && wod_ns_sage_handleBranch28(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 29 && wod_ns_sage_handleBranch29(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 30 && wod_ns_sage_handleBranch30(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.wod_ns_sage.branchId"); return SCRIPT_CONTINUE; } }