package script.conversation; import script.*; import script.library.ai_lib; import script.library.chat; import script.library.money; import script.library.utils; public class npe_brochure extends script.base_script { public npe_brochure() { } public static String c_stringFile = "conversation/npe_brochure"; public boolean npe_brochure_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean npe_brochure_condition_has100(obj_id player, obj_id npc) throws InterruptedException { int cash = getTotalMoney(player); if (cash >= 100) { return true; } return false; } public boolean npe_brochure_condition_has50(obj_id player, obj_id npc) throws InterruptedException { int cash = getTotalMoney(player); if (cash >= 50) { return true; } return false; } public boolean npe_brochure_condition_hasBought(obj_id player, obj_id npc) throws InterruptedException { return hasObjVar(player, "npe.boughtBrochure"); } public void npe_brochure_action_payNPC50(obj_id player, obj_id npc) throws InterruptedException { int cash = getTotalMoney(player); if (cash >= 50) { dictionary params = new dictionary(); money.requestPayment(player, npc, 50, "pass_fail", params, true); setObjVar(player, "npe.boughtBrochure", true); } } public void npe_brochure_action_payNPC100(obj_id player, obj_id npc) throws InterruptedException { int cash = getTotalMoney(player); if (cash >= 100) { dictionary params = new dictionary(); money.requestPayment(player, npc, 100, "pass_fail", params, true); setObjVar(player, "npe.boughtBrochure", true); } } public void npe_brochure_action_giveWaypointStation(obj_id player, obj_id npc) throws InterruptedException { String BROCHURE = "object/tangible/space/story_loot/loot_npe_travel_brochure.iff"; if (isIdValid(player)) { obj_id playerInv = getObjectInSlot(player, "inventory"); if (isIdValid(playerInv)) { obj_id item = createObject(BROCHURE, playerInv, ""); sendSystemMessage(player, new string_id("npe", "brochure")); } } obj_id[] waypoints = getWaypointsInDatapad(player); boolean theyHave = false; for (obj_id waypoint1 : waypoints) { String myName = getWaypointName(waypoint1); if (myName.equals("Station Gamma")) { theyHave = true; } } if (theyHave == false) { location emergence = new location(663, -1002, 2039, "space_ord_mantell", null); obj_id waypoint = createWaypointInDatapad(player, emergence); setWaypointName(waypoint, "Station Gamma"); setWaypointColor(waypoint, "space"); setWaypointVisible(waypoint, true); setWaypointActive(waypoint, true); } } public void npe_brochure_action_faceToNoob(obj_id player, obj_id npc) throws InterruptedException { faceTo(npc, player); } public int npe_brochure_handleBranch1(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_110")) { if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_111"); utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_9")) { if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_11"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_13"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 4); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_57")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "shoo"); string_id message = new string_id(c_stringFile, "s_59"); utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_61")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "shrug_shoulders"); string_id message = new string_id(c_stringFile, "s_63"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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.npe_brochure.branchId", 17); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_13")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "explain"); string_id message = new string_id(c_stringFile, "s_15"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_17"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 5); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_17")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "dream"); string_id message = new string_id(c_stringFile, "s_19"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_condition_has50(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (npe_brochure_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (!npe_brochure_condition_has50(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_21"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_31"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_53"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 6); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_21")) { npe_brochure_action_payNPC50(player, npc); if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "wave1"); string_id message = new string_id(c_stringFile, "s_23"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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.npe_brochure.branchId", 7); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_31")) { if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_33"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_condition_has100(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (!npe_brochure_condition_has100(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_35"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_47"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 10); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_53")) { if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_55"); utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_25")) { if (npe_brochure_condition__defaultCondition(player, npc)) { npe_brochure_action_giveWaypointStation(player, npc); string_id message = new string_id(c_stringFile, "s_27"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_49"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 8); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_49")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "laugh"); string_id message = new string_id(c_stringFile, "s_50"); utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_35")) { npe_brochure_action_payNPC100(player, npc); if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_37"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_brochure.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_47")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "shrug_shoulders"); string_id message = new string_id(c_stringFile, "s_51"); utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_39")) { if (npe_brochure_condition__defaultCondition(player, npc)) { npe_brochure_action_giveWaypointStation(player, npc); string_id message = new string_id(c_stringFile, "s_41"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_43"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 12); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch12(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_43")) { if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_45"); utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch17(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_65")) { if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_67"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_69"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 18); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch18(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_69")) { if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_71"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (npe_brochure_condition_has50(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (!npe_brochure_condition_has50(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_73"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_97"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_112"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 19); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch19(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_73")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "poke"); string_id message = new string_id(c_stringFile, "s_75"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_77"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 20); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_97")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "wave1"); npe_brochure_action_payNPC50(player, npc); string_id message = new string_id(c_stringFile, "s_99"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_101"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 26); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_112")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "shoo"); string_id message = new string_id(c_stringFile, "s_114"); utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch20(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_77")) { if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_79"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_condition_has100(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (!npe_brochure_condition_has100(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_81"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_93"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 21); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch21(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_81")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "laugh"); string_id message = new string_id(c_stringFile, "s_83"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_85"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 22); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_93")) { if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_95"); utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch22(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_85")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "point_right"); npe_brochure_action_giveWaypointStation(player, npc); string_id message = new string_id(c_stringFile, "s_87"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_89"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 23); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch23(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_89")) { if (npe_brochure_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_91"); utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch26(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_101")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "point_right"); npe_brochure_action_giveWaypointStation(player, npc); string_id message = new string_id(c_stringFile, "s_103"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_105"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 27); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.npe_brochure.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int npe_brochure_handleBranch27(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_105")) { if (npe_brochure_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "laugh"); string_id message = new string_id(c_stringFile, "s_107"); utils.removeScriptVar(player, "conversation.npe_brochure.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_brochure"); } setCondition(self, CONDITION_CONVERSABLE); setName(self, "Delo (Travel Agent)"); setInvulnerable(self, true); return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { setCondition(self, CONDITION_CONVERSABLE); setName(self, "Delo (Travel Agent)"); setInvulnerable(self, true); 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_brochure"); 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_brochure_condition_hasBought(player, npc)) { string_id message = new string_id(c_stringFile, "s_109"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_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_110"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 1); npcStartConversation(player, npc, "npe_brochure", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (npe_brochure_condition__defaultCondition(player, npc)) { npe_brochure_action_faceToNoob(player, npc); string_id message = new string_id(c_stringFile, "s_7"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (npe_brochure_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (npe_brochure_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (npe_brochure_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_9"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_57"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_61"); } utils.setScriptVar(player, "conversation.npe_brochure.branchId", 3); npcStartConversation(player, npc, "npe_brochure", 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_brochure")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.npe_brochure.branchId"); if (branchId == 1 && npe_brochure_handleBranch1(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 3 && npe_brochure_handleBranch3(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 4 && npe_brochure_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 5 && npe_brochure_handleBranch5(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 6 && npe_brochure_handleBranch6(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 7 && npe_brochure_handleBranch7(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 8 && npe_brochure_handleBranch8(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && npe_brochure_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && npe_brochure_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 12 && npe_brochure_handleBranch12(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 17 && npe_brochure_handleBranch17(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 18 && npe_brochure_handleBranch18(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 19 && npe_brochure_handleBranch19(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 20 && npe_brochure_handleBranch20(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 21 && npe_brochure_handleBranch21(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 22 && npe_brochure_handleBranch22(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 23 && npe_brochure_handleBranch23(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 26 && npe_brochure_handleBranch26(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 27 && npe_brochure_handleBranch27(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_brochure.branchId"); return SCRIPT_CONTINUE; } }