package script.conversation; import script.library.ai_lib; import script.library.chat; import script.library.groundquests; import script.library.utils; import script.*; public class bib_fortuna extends script.base_script { public bib_fortuna() { } public static String c_stringFile = "conversation/bib_fortuna"; public boolean bib_fortuna_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean bib_fortuna_condition_completedBib(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.hasCompletedQuest(player, "quest/jabba_bib_fortuna_v2")) { return true; } return false; } public boolean bib_fortuna_condition_killedRomoVax(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_bib_fortuna_v2", "returnToBib")) { return true; } return false; } public boolean bib_fortuna_condition_killingRomoVax(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_bib_fortuna_v2", "killRomoVax")) { return true; } return false; } public boolean bib_fortuna_condition_takeDisksToBib(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_bib_fortuna_v2", "takeDiskToBib")) { return true; } return false; } public boolean bib_fortuna_condition_dealingWithRomo(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_bib_fortuna_v2", "speakToRomo") || groundquests.isTaskActive(player, "quest/jabba_bib_fortuna_v2", "returnToRomo") || groundquests.isTaskActive(player, "quest/jabba_bib_fortuna_v2", "getRomosDisks")) { return true; } return false; } public boolean bib_fortuna_condition_completedBarada(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.hasCompletedQuest(player, "quest/jabba_barada_v2")) { return true; } return false; } public void bib_fortuna_action_grantBibsQuest(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "quest/jabba_bib_fortuna_v2"); } public void bib_fortuna_action_sendGotDisksSignal(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); groundquests.sendSignal(player, "romosDisksDelivered"); } public void bib_fortuna_action_sendKilledRomoSignal(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); groundquests.sendSignal(player, "romoVaxKilled"); groundquests.grantQuest(player, "pointer_jabba"); } public void bib_fortuna_action_clearPointer(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); groundquests.sendSignal(player, "found_bib"); } public void bib_fortuna_action_facePlayer(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); } public int bib_fortuna_handleBranch2(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_75")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { bib_fortuna_action_sendKilledRomoSignal(player, npc); string_id message = new string_id(c_stringFile, "s_76"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bib_fortuna_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_39")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { bib_fortuna_action_sendGotDisksSignal(player, npc); string_id message = new string_id(c_stringFile, "s_40"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bib_fortuna_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_20")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_22"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_24")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { bib_fortuna_action_grantBibsQuest(player, npc); string_id message = new string_id(c_stringFile, "s_26"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_28")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_30"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bib_fortuna_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_32"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_58"); } utils.setScriptVar(player, "conversation.bib_fortuna.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bib_fortuna_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_32")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_34"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bib_fortuna_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_36"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_46"); } utils.setScriptVar(player, "conversation.bib_fortuna.branchId", 12); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_58")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_60"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse2 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_62"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_64"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_66"); } utils.setScriptVar(player, "conversation.bib_fortuna.branchId", 16); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bib_fortuna_handleBranch12(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_36")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_38"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bib_fortuna_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_42"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_44"); } utils.setScriptVar(player, "conversation.bib_fortuna.branchId", 13); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_46")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_48"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bib_fortuna_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_50"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_52"); } utils.setScriptVar(player, "conversation.bib_fortuna.branchId", 14); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bib_fortuna_handleBranch13(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_42")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_22"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_44")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { bib_fortuna_action_grantBibsQuest(player, npc); string_id message = new string_id(c_stringFile, "s_26"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bib_fortuna_handleBranch14(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_50")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_22"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_52")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_54"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bib_fortuna_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_56"); } utils.setScriptVar(player, "conversation.bib_fortuna.branchId", 15); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bib_fortuna_handleBranch15(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_56")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { bib_fortuna_action_grantBibsQuest(player, npc); string_id message = new string_id(c_stringFile, "s_26"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bib_fortuna_handleBranch16(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_62")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { bib_fortuna_action_grantBibsQuest(player, npc); string_id message = new string_id(c_stringFile, "s_26"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_64")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_22"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_66")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_68"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bib_fortuna_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_70"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_72"); } utils.setScriptVar(player, "conversation.bib_fortuna.branchId", 17); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bib_fortuna_handleBranch17(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_70")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { bib_fortuna_action_grantBibsQuest(player, npc); string_id message = new string_id(c_stringFile, "s_26"); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_72")) { if (bib_fortuna_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_22"); utils.removeScriptVar(player, "conversation.bib_fortuna.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.bib_fortuna"); } setCondition(self, CONDITION_CONVERSABLE); setCondition(self, CONDITION_INTERESTING); return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { setCondition(self, CONDITION_CONVERSABLE); setCondition(self, CONDITION_INTERESTING); return SCRIPT_CONTINUE; } public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info menuInfo) throws InterruptedException { int menu = menuInfo.addRootMenu(menu_info_types.CONVERSE_START, null); menu_info_data menuInfoData = menuInfo.getMenuItemById(menu); menuInfoData.setServerNotify(false); setCondition(self, CONDITION_CONVERSABLE); return SCRIPT_CONTINUE; } public int OnIncapacitated(obj_id self, obj_id killer) throws InterruptedException { clearCondition(self, CONDITION_CONVERSABLE); detachScript(self, "conversation.bib_fortuna"); 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 (bib_fortuna_condition_completedBib(player, npc)) { bib_fortuna_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_4"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (bib_fortuna_condition_killedRomoVax(player, npc)) { string_id message = new string_id(c_stringFile, "s_6"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bib_fortuna_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_75"); } utils.setScriptVar(player, "conversation.bib_fortuna.branchId", 2); npcStartConversation(player, npc, "bib_fortuna", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (bib_fortuna_condition_killingRomoVax(player, npc)) { bib_fortuna_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_10"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (bib_fortuna_condition_takeDisksToBib(player, npc)) { string_id message = new string_id(c_stringFile, "s_12"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bib_fortuna_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.bib_fortuna.branchId", 5); npcStartConversation(player, npc, "bib_fortuna", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (bib_fortuna_condition_dealingWithRomo(player, npc)) { bib_fortuna_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_16"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (bib_fortuna_condition_completedBarada(player, npc)) { bib_fortuna_action_clearPointer(player, npc); string_id message = new string_id(c_stringFile, "s_18"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (bib_fortuna_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse2 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_20"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_24"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_28"); } utils.setScriptVar(player, "conversation.bib_fortuna.branchId", 8); npcStartConversation(player, npc, "bib_fortuna", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (bib_fortuna_condition__defaultCondition(player, npc)) { bib_fortuna_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_74"); 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("bib_fortuna")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.bib_fortuna.branchId"); if (branchId == 2 && bib_fortuna_handleBranch2(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 5 && bib_fortuna_handleBranch5(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 8 && bib_fortuna_handleBranch8(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && bib_fortuna_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 12 && bib_fortuna_handleBranch12(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 13 && bib_fortuna_handleBranch13(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 14 && bib_fortuna_handleBranch14(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 15 && bib_fortuna_handleBranch15(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 16 && bib_fortuna_handleBranch16(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 17 && bib_fortuna_handleBranch17(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.bib_fortuna.branchId"); return SCRIPT_CONTINUE; } }