package script.conversation; import script.library.ai_lib; import script.library.chat; import script.library.groundquests; import script.library.utils; import script.*; public class ree_yees extends script.base_script { public ree_yees() { } public static String c_stringFile = "conversation/ree_yees"; public boolean ree_yees_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean ree_yees_condition_completedReeYees(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.hasCompletedQuest(player, "quest/jabba_ree_yees_v2")) { return true; } return false; } public boolean ree_yees_condition_collectingBell(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_ree_yees_v2", "collectingBell")) { return true; } return false; } public boolean ree_yees_condition_readyToFinish(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_ree_yees_v2", "completedMission")) { return true; } return false; } public boolean ree_yees_condition_collectingBook(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_ree_yees_v2", "collectingBook")) { return true; } return false; } public boolean ree_yees_condition_collectingCandle(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.isTaskActive(player, "quest/jabba_ree_yees_v2", "collectingCandle")) { return true; } return false; } public boolean ree_yees_condition_completedReelo(obj_id player, obj_id npc) throws InterruptedException { if (groundquests.hasCompletedQuest(player, "quest/jabba_reelo_baruk")) { return true; } return false; } public void ree_yees_action_grantReeYeesQuest(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "quest/jabba_ree_yees_v2"); return; } public void ree_yees_action_sendCompletedSignal(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "reeYeesSaysYoureAWinner"); groundquests.grantQuest(player, "pointer_ephant_mon"); faceTo(npc, player); return; } public void ree_yees_action_clearPointer(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "found_ree_yees"); faceTo(npc, player); } public void ree_yees_action_facePlayer(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); } public int ree_yees_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_56")) { if (ree_yees_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_58"); utils.removeScriptVar(player, "conversation.ree_yees.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_60")) { if (ree_yees_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_62"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ree_yees_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (ree_yees_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_64"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_66"); } utils.setScriptVar(player, "conversation.ree_yees.branchId", 8); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.ree_yees.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_82")) { if (ree_yees_condition__defaultCondition(player, npc)) { ree_yees_action_grantReeYeesQuest(player, npc); string_id message = new string_id(c_stringFile, "s_84"); utils.removeScriptVar(player, "conversation.ree_yees.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int ree_yees_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_64")) { if (ree_yees_condition__defaultCondition(player, npc)) { ree_yees_action_grantReeYeesQuest(player, npc); string_id message = new string_id(c_stringFile, "s_84"); utils.removeScriptVar(player, "conversation.ree_yees.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_66")) { if (ree_yees_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_68"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ree_yees_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_70"); } utils.setScriptVar(player, "conversation.ree_yees.branchId", 9); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.ree_yees.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int ree_yees_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_70")) { if (ree_yees_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_72"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ree_yees_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_74"); } utils.setScriptVar(player, "conversation.ree_yees.branchId", 10); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.ree_yees.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int ree_yees_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_74")) { if (ree_yees_condition__defaultCondition(player, npc)) { ree_yees_action_grantReeYeesQuest(player, npc); string_id message = new string_id(c_stringFile, "s_28"); utils.removeScriptVar(player, "conversation.ree_yees.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.ree_yees"); } 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.ree_yees"); 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 (ree_yees_condition_completedReeYees(player, npc)) { ree_yees_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_4"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ree_yees_condition_readyToFinish(player, npc)) { ree_yees_action_sendCompletedSignal(player, npc); string_id message = new string_id(c_stringFile, "s_86"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ree_yees_condition_collectingCandle(player, npc)) { ree_yees_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_44"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ree_yees_condition_collectingBook(player, npc)) { ree_yees_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_34"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ree_yees_condition_collectingBell(player, npc)) { ree_yees_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_20"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (ree_yees_condition_completedReelo(player, npc)) { ree_yees_action_clearPointer(player, npc); string_id message = new string_id(c_stringFile, "s_54"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (ree_yees_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (ree_yees_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (ree_yees_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_56"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_60"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_82"); } utils.setScriptVar(player, "conversation.ree_yees.branchId", 6); npcStartConversation(player, npc, "ree_yees", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (ree_yees_condition__defaultCondition(player, npc)) { ree_yees_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_85"); 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("ree_yees")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.ree_yees.branchId"); if (branchId == 6 && ree_yees_handleBranch6(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 8 && ree_yees_handleBranch8(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && ree_yees_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && ree_yees_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.ree_yees.branchId"); return SCRIPT_CONTINUE; } }