package script.conversation; import script.library.*; import script.*; public class npe_boba_fett extends script.base_script { public npe_boba_fett() { } public static String c_stringFile = "conversation/npe_boba_fett"; public boolean npe_boba_fett_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean npe_boba_fett_condition_isAtLeastLevel5(obj_id player, obj_id npc) throws InterruptedException { int level = getLevel(player); if (level >= 5) { return true; } else { return false; } } public boolean npe_boba_fett_condition_wantsBH(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isQuestActiveOrComplete(player, "npe_pointer_bounty_template"); } public boolean npe_boba_fett_condition_questComplete(obj_id player, obj_id npc) throws InterruptedException { return groundquests.hasCompletedQuest(player, "npe_boba"); } public boolean npe_boba_fett_condition_busy(obj_id player, obj_id npc) throws InterruptedException { return (groundquests.isTaskActive(player, "npe_boba", 0) && npe_boba_fett_condition_isBHTemplate(player, npc)); } public boolean npe_boba_fett_condition_finishedFinalTask(obj_id player, obj_id npc) throws InterruptedException { return groundquests.isTaskActive(player, "npe_boba", "return"); } public boolean npe_boba_fett_condition_isBHTemplate(obj_id player, obj_id npc) throws InterruptedException { return utils.isProfession(player, utils.BOUNTY_HUNTER); } public void npe_boba_fett_action_giveBHQuest(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "npe_boba"); groundquests.sendSignal(player, "found_bounty_hunter"); if (!hasObjVar(player, npe.QUEST_REWORK_VAR)) { setObjVar(player, npe.QUEST_REWORK_VAR, npe.QUEST_ENUMERATION); } } public void npe_boba_fett_action_giveReward(obj_id player, obj_id npc) throws InterruptedException { setObjVar(player, "npe.finishedTemplate", 1); groundquests.sendSignal(player, "npe_boba_signal"); groundquests.grantQuest(player, "npe_pointer_secretary"); } public void npe_boba_fett_action_giveSecretaryPointer(obj_id player, obj_id npc) throws InterruptedException { groundquests.grantQuest(player, "npe_pointer_secretary"); } public void npe_boba_fett_action_facePlayer(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); } public void npe_boba_fett_action_leaveStation(obj_id player, obj_id npc) throws InterruptedException { string_id stfPrompt = new string_id("npe", "exit_station_prompt"); string_id stfTitle = new string_id("npe", "exit_station"); String prompt = utils.packStringId(stfPrompt); String title = utils.packStringId(stfTitle); int pid = sui.msgbox(player, player, prompt, sui.OK_CANCEL, title, 0, "handTransfer"); } public int npe_boba_fett_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_40")) { if (npe_boba_fett_condition_isAtLeastLevel5(player, npc)) { string_id message = new string_id(c_stringFile, "s_41"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_boba_fett_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (npe_boba_fett_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_43"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_54"); } utils.setScriptVar(player, "conversation.npe_boba_fett.branchId", 4); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } if (npe_boba_fett_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_38"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_boba_fett_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.npe_boba_fett.branchId", 7); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_boba_fett_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_43")) { if (npe_boba_fett_condition__defaultCondition(player, npc)) { npe_boba_fett_action_leaveStation(player, npc); string_id message = new string_id(c_stringFile, "s_53"); utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_54")) { if (npe_boba_fett_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "backhand_threaten"); string_id message = new string_id(c_stringFile, "s_56"); utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_boba_fett_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_39")) { if (npe_boba_fett_condition__defaultCondition(player, npc)) { npe_boba_fett_action_giveSecretaryPointer(player, npc); string_id message = new string_id(c_stringFile, "s_45"); utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_boba_fett_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_46")) { doAnimationAction(player, "feed_creature_medium"); if (npe_boba_fett_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "pound_fist_palm"); string_id message = new string_id(c_stringFile, "s_47"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_boba_fett_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_83"); } utils.setScriptVar(player, "conversation.npe_boba_fett.branchId", 10); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_boba_fett_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_83")) { if (npe_boba_fett_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_84"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_boba_fett_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (npe_boba_fett_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_85"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_48"); } utils.setScriptVar(player, "conversation.npe_boba_fett.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_boba_fett_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_85")) { if (npe_boba_fett_condition__defaultCondition(player, npc)) { npe_boba_fett_action_giveReward(player, npc); string_id message = new string_id(c_stringFile, "s_86"); utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_48")) { if (npe_boba_fett_condition__defaultCondition(player, npc)) { npe_boba_fett_action_giveReward(player, npc); string_id message = new string_id(c_stringFile, "s_49"); utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_boba_fett_handleBranch14(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_34")) { if (npe_boba_fett_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "mock"); string_id message = new string_id(c_stringFile, "s_36"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_boba_fett_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_50"); } utils.setScriptVar(player, "conversation.npe_boba_fett.branchId", 15); prose_package pp = new prose_package(); pp.stringId = message; pp.actor.set(player); pp.target.set(npc); npcSpeak(player, pp); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); prose_package pp = new prose_package(); pp.stringId = message; pp.actor.set(player); pp.target.set(npc); npcEndConversationWithMessage(player, pp); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_boba_fett_handleBranch15(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_50")) { if (npe_boba_fett_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "rub_chin_thoughtful"); string_id message = new string_id(c_stringFile, "s_52"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_boba_fett_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_59"); } utils.setScriptVar(player, "conversation.npe_boba_fett.branchId", 16); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_boba_fett_handleBranch16(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_59")) { if (npe_boba_fett_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "nod"); npe_boba_fett_action_giveBHQuest(player, npc); string_id message = new string_id(c_stringFile, "s_61"); utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_boba_fett_handleBranch18(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_80")) { if (npe_boba_fett_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_82"); utils.removeScriptVar(player, "conversation.npe_boba_fett.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.npe_boba_fett"); } setCondition(self, CONDITION_CONVERSABLE); setInvulnerable(self, true); setName(self, "Boba Fett (Bounty Hunter)"); ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL); return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { setCondition(self, CONDITION_CONVERSABLE); setInvulnerable(self, true); setName(self, "Boba Fett (Bounty Hunter)"); ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL); 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.npe_boba_fett"); 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 (!npe_boba_fett_condition_isBHTemplate(player, npc)) { npe_boba_fett_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_69"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (npe_boba_fett_condition_busy(player, npc)) { npe_boba_fett_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_42"); chat.chat(npc, player, message); return SCRIPT_CONTINUE; } if (npe_boba_fett_condition_questComplete(player, npc)) { npe_boba_fett_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_76"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_boba_fett_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.npe_boba_fett.branchId", 3); npcStartConversation(player, npc, "npe_boba_fett", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (npe_boba_fett_condition_finishedFinalTask(player, npc)) { npe_boba_fett_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_44"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_boba_fett_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_46"); } utils.setScriptVar(player, "conversation.npe_boba_fett.branchId", 9); npcStartConversation(player, npc, "npe_boba_fett", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (npe_boba_fett_condition_wantsBH(player, npc)) { npe_boba_fett_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_32"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_boba_fett_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_34"); } utils.setScriptVar(player, "conversation.npe_boba_fett.branchId", 14); npcStartConversation(player, npc, "npe_boba_fett", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (npe_boba_fett_condition__defaultCondition(player, npc)) { npe_boba_fett_action_facePlayer(player, npc); string_id message = new string_id(c_stringFile, "s_78"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_boba_fett_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_80"); } utils.setScriptVar(player, "conversation.npe_boba_fett.branchId", 18); npcStartConversation(player, npc, "npe_boba_fett", 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("npe_boba_fett")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.npe_boba_fett.branchId"); if (branchId == 3 && npe_boba_fett_handleBranch3(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 4 && npe_boba_fett_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 7 && npe_boba_fett_handleBranch7(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && npe_boba_fett_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && npe_boba_fett_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && npe_boba_fett_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 14 && npe_boba_fett_handleBranch14(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 15 && npe_boba_fett_handleBranch15(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 16 && npe_boba_fett_handleBranch16(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 18 && npe_boba_fett_handleBranch18(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.npe_boba_fett.branchId"); return SCRIPT_CONTINUE; } }