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_sm_sage extends script.base_script { public wod_sm_sage() { } public static String c_stringFile = "conversation/wod_sm_sage"; public boolean wod_sm_sage_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean wod_sm_sage_condition_hasPreqComplete(obj_id player, obj_id npc) throws InterruptedException { if ((hasObjVar(player, "wod_prologue_quests")) && (groundquests.hasCompletedQuest(player, "wod_rubina_goto_sm")) && (!groundquests.hasCompletedQuest(player, "wod_sm_repair_alter_01"))) { return true; } return false; } public boolean wod_sm_sage_condition_onReturnAlter01SM(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_sm_repair_alter_01", "returnToSage"); } public boolean wod_sm_sage_condition_onReturnAlter02SM(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_sm_repair_alter_02", "returnToSage"); } public boolean wod_sm_sage_condition_onReturnAlter03SM(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_sm_repair_alter_03", "returnToSage"); } public boolean wod_sm_sage_condition_onReturnAlter04SM(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_sm_repair_alter_04", "returnToSage"); } public boolean wod_sm_sage_condition_IsNS(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_sm_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_sm_sage_condition_IsNoTrader(obj_id player, obj_id npc) throws InterruptedException { if (content.isCrafter(player)) { return false; } return true; } public boolean wod_sm_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_sm_sage_condition_hasCompletedAlter04SM(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_sm_repair_alter_04", "returnToSage") || groundquests.hasCompletedQuest(player, "wod_sm_repair_alter_04"); } public boolean wod_sm_sage_condition_hasCompletedAlter03SM(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_sm_repair_alter_03", "returnToSage") || groundquests.hasCompletedQuest(player, "wod_sm_repair_alter_03"); } public boolean wod_sm_sage_condition_hasCompletedAlter02SM(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_sm_repair_alter_02", "returnToSage") || groundquests.hasCompletedQuest(player, "wod_sm_repair_alter_02"); } public boolean wod_sm_sage_condition_hasCompletedAlter01SM(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "wod_sm_repair_alter_01", "returnToSage") || groundquests.hasCompletedQuest(player, "wod_sm_repair_alter_01"); } public void wod_sm_sage_action_grantTPAlter01SM(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "quest/wod_sm_repair_alter_01"); } public void wod_sm_sage_action_grantTPAlter02SM(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "quest/wod_sm_repair_alter_02"); } public void wod_sm_sage_action_grantTPAlter03SM(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "quest/wod_sm_repair_alter_03"); } public void wod_sm_sage_action_grantTPAlter04SM(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "quest/wod_sm_repair_alter_04"); } public void wod_sm_sage_action_sendReturnedSignalAlter01SM(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "returnToSage"); } public void wod_sm_sage_action_sendReturnedSignalAlter02SM(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "returnToSage"); } public void wod_sm_sage_action_sendReturnedSignalAlter03SM(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "returnToSage"); } public void wod_sm_sage_action_sendReturnedSignalAlter04SM(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "returnToSage"); } public int wod_sm_sage_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_39")) { wod_sm_sage_action_sendReturnedSignalAlter01SM(player, npc); if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_77"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_sm_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_79"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_83"); } utils.setScriptVar(player, "conversation.wod_sm_sage.branchId", 24); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_79")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { wod_sm_sage_action_grantTPAlter02SM(player, npc); string_id message = new string_id(c_stringFile, "s_67"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_83")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_85"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_114")) { wod_sm_sage_action_sendReturnedSignalAlter02SM(player, npc); if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_89"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_sm_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_91"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_95"); } utils.setScriptVar(player, "conversation.wod_sm_sage.branchId", 21); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_91")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { wod_sm_sage_action_grantTPAlter03SM(player, npc); string_id message = new string_id(c_stringFile, "s_93"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_95")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_101"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_115")) { wod_sm_sage_action_sendReturnedSignalAlter03SM(player, npc); if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_107"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_sm_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_117"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_125"); } utils.setScriptVar(player, "conversation.wod_sm_sage.branchId", 18); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_117")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { wod_sm_sage_action_grantTPAlter04SM(player, npc); string_id message = new string_id(c_stringFile, "s_121"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_125")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_129"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_116")) { wod_sm_sage_action_sendReturnedSignalAlter04SM(player, npc); if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_128"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_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_130"); } utils.setScriptVar(player, "conversation.wod_sm_sage.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_130")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_132"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch13(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_100")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_102"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_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_104"); } utils.setScriptVar(player, "conversation.wod_sm_sage.branchId", 14); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch14(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_104")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_106"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_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_108"); } utils.setScriptVar(player, "conversation.wod_sm_sage.branchId", 15); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch15(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_108")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_67"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch18(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_117")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { wod_sm_sage_action_grantTPAlter04SM(player, npc); string_id message = new string_id(c_stringFile, "s_121"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_125")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_129"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch21(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_91")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { wod_sm_sage_action_grantTPAlter03SM(player, npc); string_id message = new string_id(c_stringFile, "s_93"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_95")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_101"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch24(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_79")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { wod_sm_sage_action_grantTPAlter02SM(player, npc); string_id message = new string_id(c_stringFile, "s_67"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_83")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_85"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch27(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_53")) { if (wod_sm_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_sm_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_sm_sage.branchId", 28); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch28(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_57")) { if (wod_sm_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_sm_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_sm_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_sm_sage.branchId", 29); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch29(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_61")) { if (wod_sm_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_sm_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_sm_sage.branchId", 30); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_69")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_71"); utils.removeScriptVar(player, "conversation.wod_sm_sage.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } public int wod_sm_sage_handleBranch30(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_65")) { if (wod_sm_sage_condition__defaultCondition(player, npc)) { wod_sm_sage_action_grantTPAlter01SM(player, npc); string_id message = new string_id(c_stringFile, "s_67"); utils.removeScriptVar(player, "conversation.wod_sm_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_sm_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_sm_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_sm_sage_condition_IsNS(player, npc)) { string_id message = new string_id(c_stringFile, "s_5"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (wod_sm_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_sm_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_sm_sage_condition_onReturnAlter01SM(player, npc)) { string_id message = new string_id(c_stringFile, "s_37"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_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_sm_sage.branchId", 4); npcStartConversation(player, npc, "wod_sm_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_sm_sage_condition_onReturnAlter02SM(player, npc)) { string_id message = new string_id(c_stringFile, "s_111"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_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_sm_sage.branchId", 6); npcStartConversation(player, npc, "wod_sm_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_sm_sage_condition_onReturnAlter03SM(player, npc)) { string_id message = new string_id(c_stringFile, "s_112"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_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_sm_sage.branchId", 8); npcStartConversation(player, npc, "wod_sm_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_sm_sage_condition_onReturnAlter04SM(player, npc)) { string_id message = new string_id(c_stringFile, "s_113"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_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_sm_sage.branchId", 10); npcStartConversation(player, npc, "wod_sm_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_sm_sage_condition_hasQuestActive(player, npc)) { string_id message = new string_id(c_stringFile, "s_98"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_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_100"); } utils.setScriptVar(player, "conversation.wod_sm_sage.branchId", 13); npcStartConversation(player, npc, "wod_sm_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_sm_sage_condition_hasCompletedAlter04SM(player, npc)) { string_id message = new string_id(c_stringFile, "s_96"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (wod_sm_sage_condition_hasCompletedAlter03SM(player, npc)) { string_id message = new string_id(c_stringFile, "s_107"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_sm_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_117"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_125"); } utils.setScriptVar(player, "conversation.wod_sm_sage.branchId", 18); npcStartConversation(player, npc, "wod_sm_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_sm_sage_condition_hasCompletedAlter02SM(player, npc)) { string_id message = new string_id(c_stringFile, "s_89"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_sm_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_91"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_95"); } utils.setScriptVar(player, "conversation.wod_sm_sage.branchId", 21); npcStartConversation(player, npc, "wod_sm_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_sm_sage_condition_hasCompletedAlter01SM(player, npc)) { string_id message = new string_id(c_stringFile, "s_77"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (wod_sm_sage_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (wod_sm_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_79"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_83"); } utils.setScriptVar(player, "conversation.wod_sm_sage.branchId", 24); npcStartConversation(player, npc, "wod_sm_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_sm_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_sm_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_sm_sage.branchId", 27); npcStartConversation(player, npc, "wod_sm_sage", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (wod_sm_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_sm_sage")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.wod_sm_sage.branchId"); if (branchId == 4 && wod_sm_sage_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 5 && wod_sm_sage_handleBranch5(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 6 && wod_sm_sage_handleBranch6(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 7 && wod_sm_sage_handleBranch7(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 8 && wod_sm_sage_handleBranch8(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && wod_sm_sage_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && wod_sm_sage_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && wod_sm_sage_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 13 && wod_sm_sage_handleBranch13(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 14 && wod_sm_sage_handleBranch14(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 15 && wod_sm_sage_handleBranch15(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 18 && wod_sm_sage_handleBranch18(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 21 && wod_sm_sage_handleBranch21(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 24 && wod_sm_sage_handleBranch24(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 27 && wod_sm_sage_handleBranch27(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 28 && wod_sm_sage_handleBranch28(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 29 && wod_sm_sage_handleBranch29(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 30 && wod_sm_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_sm_sage.branchId"); return SCRIPT_CONTINUE; } }