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.groundquests; import script.library.prose; import script.library.static_item; import script.library.utils; public class aurilia_rohak extends script.base_script { public aurilia_rohak() { } public static String c_stringFile = "conversation/aurilia_rohak"; public boolean aurilia_rohak_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean aurilia_rohak_condition_axkva_min_intro_01(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "axkva_min_intro", "axkva_min_intro_01"); } public boolean aurilia_rohak_condition_axkva_min_intro_02(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "axkva_min_intro", "axkva_min_intro_02"); } public boolean aurilia_rohak_condition_axkva_min_intro_04(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "axkva_min_intro", "axkva_min_intro_04"); } public boolean aurilia_rohak_condition_axkva_min_intro_06(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "axkva_min_intro", "axkva_min_intro_06"); } public boolean aurilia_rohak_condition_notCompletedTokenBox(obj_id player, obj_id npc) throws InterruptedException { return !groundquests.isQuestActiveOrComplete(player, "rohak_token_box"); } public void aurilia_rohak_action_axkva_min_intro_02_signal(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "axkva_min_intro_02"); } public void aurilia_rohak_action_axkva_min_intro_04_signal(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "axkva_min_intro_04"); } public void aurilia_rohak_action_axkva_min_intro_06_signal(obj_id player, obj_id npc) throws InterruptedException { String axkvaMinShardsString = "item_axkva_min_shards_04_01"; obj_id inv = getObjectInSlot(player, "inventory"); if (isIdValid(inv)) { obj_id axkvaMinShard = static_item.createNewItemFunction(axkvaMinShardsString, inv); string_id message = new string_id("quest/ground/system_message", "placed_in_inventory_plural"); string_id name = getNameStringId(axkvaMinShard); prose_package pp = prose.getPackage(message, player, player); prose.setTO(pp, name); sendSystemMessageProse(player, pp); groundquests.sendSignal(player, "axkva_min_intro_06"); } return; } public void aurilia_rohak_action_giveTokenBoxQuest(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "rohak_token_box"); } public int aurilia_rohak_handleBranch1(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_25")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_27"); utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int aurilia_rohak_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_32")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_34"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (aurilia_rohak_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_36"); } utils.setScriptVar(player, "conversation.aurilia_rohak.branchId", 4); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int aurilia_rohak_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_36")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_38"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (aurilia_rohak_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_40"); } utils.setScriptVar(player, "conversation.aurilia_rohak.branchId", 5); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int aurilia_rohak_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_40")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { aurilia_rohak_action_axkva_min_intro_04_signal(player, npc); string_id message = new string_id(c_stringFile, "s_42"); utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int aurilia_rohak_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_26")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { aurilia_rohak_action_giveTokenBoxQuest(player, npc); string_id message = new string_id(c_stringFile, "s_39"); utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_41")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_43"); utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_35")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_29"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (aurilia_rohak_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_31"); } utils.setScriptVar(player, "conversation.aurilia_rohak.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_37")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_30"); utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int aurilia_rohak_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_28")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_29"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (aurilia_rohak_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_31"); } utils.setScriptVar(player, "conversation.aurilia_rohak.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_24")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_30"); utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int aurilia_rohak_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_31")) { if (aurilia_rohak_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "rub_chin_thoughtful"); aurilia_rohak_action_axkva_min_intro_02_signal(player, npc); string_id message = new string_id(c_stringFile, "s_33"); utils.removeScriptVar(player, "conversation.aurilia_rohak.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.aurilia_rohak"); } 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.aurilia_rohak"); 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 (aurilia_rohak_condition_axkva_min_intro_06(player, npc)) { aurilia_rohak_action_axkva_min_intro_06_signal(player, npc); string_id message = new string_id(c_stringFile, "s_9"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (aurilia_rohak_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.aurilia_rohak.branchId", 1); npcStartConversation(player, npc, "aurilia_rohak", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (aurilia_rohak_condition_axkva_min_intro_04(player, npc)) { doAnimationAction(npc, "explain"); string_id message = new string_id(c_stringFile, "s_10"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (aurilia_rohak_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.aurilia_rohak.branchId", 3); npcStartConversation(player, npc, "aurilia_rohak", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (aurilia_rohak_condition_notCompletedTokenBox(player, npc)) { string_id message = new string_id(c_stringFile, "s_23"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (aurilia_rohak_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (aurilia_rohak_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (aurilia_rohak_condition_axkva_min_intro_02(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse2 = true; } boolean hasResponse3 = false; if (aurilia_rohak_condition_axkva_min_intro_01(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse3 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_26"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_41"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_35"); } if (hasResponse3) { responses[responseIndex++] = new string_id(c_stringFile, "s_37"); } utils.setScriptVar(player, "conversation.aurilia_rohak.branchId", 7); npcStartConversation(player, npc, "aurilia_rohak", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (aurilia_rohak_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_18"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (aurilia_rohak_condition_axkva_min_intro_02(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (aurilia_rohak_condition_axkva_min_intro_01(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_28"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_24"); } utils.setScriptVar(player, "conversation.aurilia_rohak.branchId", 10); npcStartConversation(player, npc, "aurilia_rohak", message, responses); } else { 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("aurilia_rohak")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.aurilia_rohak.branchId"); if (branchId == 1 && aurilia_rohak_handleBranch1(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 3 && aurilia_rohak_handleBranch3(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 4 && aurilia_rohak_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 5 && aurilia_rohak_handleBranch5(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 7 && aurilia_rohak_handleBranch7(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && aurilia_rohak_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && aurilia_rohak_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.aurilia_rohak.branchId"); return SCRIPT_CONTINUE; } }