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.utils; public class tatooine_espa_peggin extends script.base_script { public tatooine_espa_peggin() { } public static String c_stringFile = "conversation/tatooine_espa_peggin"; public boolean tatooine_espa_peggin_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean tatooine_espa_peggin_condition_onPegginTask(obj_id player, obj_id npc) throws InterruptedException { return (groundquests.isTaskActive(player, "quest/tatooine_espa_body_building", "tat_espa_body_building_e1") || groundquests.isTaskActive(player, "quest/tatooine_espa_body_building_2", "tat_espa_body_building_e1") || groundquests.isTaskActive(player, "quest/tatooine_espa_body_building_v2", "tat_espa_body_building_e1")); } public boolean tatooine_espa_peggin_condition_bodyOnTask(obj_id player, obj_id npc) throws InterruptedException { return (groundquests.isTaskActive(player, "quest/tatooine_espa_body_building", "tat_espa_body_building_e2") || groundquests.isTaskActive(player, "quest/tatooine_espa_body_building", "tat_espa_body_building_e3") || groundquests.isTaskActive(player, "quest/tatooine_espa_body_building", "tat_espa_body_building_e4") || groundquests.isTaskActive(player, "quest/tatooine_espa_body_building_2", "tat_espa_body_building_e2") || groundquests.isTaskActive(player, "quest/tatooine_espa_body_building_2", "tat_espa_body_building_e3") || groundquests.isTaskActive(player, "quest/tatooine_espa_body_building_2", "tat_espa_body_building_e4") || groundquests.isTaskActive(player, "quest/tatooine_espa_body_building_v2", "tat_espa_body_building_e2") || groundquests.isTaskActive(player, "quest/tatooine_espa_body_building_v2", "tat_espa_body_building_e3") || groundquests.isTaskActive(player, "quest/tatooine_espa_body_building_v2", "tat_espa_body_building_e4")); } public boolean tatooine_espa_peggin_condition_bodyQuestComplete(obj_id player, obj_id npc) throws InterruptedException { return (groundquests.hasCompletedQuest(player, "quest/tatooine_eisley_body_building") || groundquests.hasCompletedQuest(player, "quest/tatooine_eisley_body_building_2") || groundquests.hasCompletedQuest(player, "quest/tatooine_eisley_body_building_v2")); } public void tatooine_espa_peggin_action_signalPegginTask(obj_id player, obj_id npc) throws InterruptedException { groundquests.sendSignal(player, "tat_espa_body_building_e1"); } public int tatooine_espa_peggin_handleBranch1(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_63")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_64"); utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_54")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_56"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_60"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 4); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_55")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_57"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_58"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 6); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_60")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_61"); utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_58")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_59"); utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_18")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_20"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_22"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 9); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_22")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_24"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_27"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 10); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_27")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_29"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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.tatooine_espa_peggin.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_31")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { tatooine_espa_peggin_action_signalPegginTask(player, npc); string_id message = new string_id(c_stringFile, "s_33"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_35"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 12); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch12(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_35")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_37"); utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch14(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_41")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_43"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_45"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 15); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_53")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_66"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_68"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 18); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_76")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_78"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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.tatooine_espa_peggin.branchId", 21); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_88")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_90"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_92"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 24); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch15(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_45")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_47"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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.tatooine_espa_peggin.branchId", 16); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch16(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_49")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_51"); utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch18(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_68")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_70"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_72"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 19); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch19(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_72")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_74"); utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch21(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_80")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_82"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_84"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 22); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch22(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_84")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_86"); utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch24(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_92")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_94"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_96"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 25); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int tatooine_espa_peggin_handleBranch25(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_96")) { if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_98"); utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.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.tatooine_espa_peggin"); } setCondition(self, CONDITION_CONVERSABLE); setCondition(self, CONDITION_INTERESTING); setInvulnerable(self, true); ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL); return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { setCondition(self, CONDITION_CONVERSABLE); setCondition(self, CONDITION_INTERESTING); setInvulnerable(self, true); 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.tatooine_espa_peggin"); 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 (tatooine_espa_peggin_condition_bodyQuestComplete(player, npc)) { string_id message = new string_id(c_stringFile, "s_62"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_63"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 1); npcStartConversation(player, npc, "tatooine_espa_peggin", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (tatooine_espa_peggin_condition_bodyOnTask(player, npc)) { string_id message = new string_id(c_stringFile, "s_25"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (tatooine_espa_peggin_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_54"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_55"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 3); npcStartConversation(player, npc, "tatooine_espa_peggin", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (tatooine_espa_peggin_condition_onPegginTask(player, npc)) { string_id message = new string_id(c_stringFile, "s_16"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_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_18"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 8); npcStartConversation(player, npc, "tatooine_espa_peggin", message, responses); } else { chat.chat(npc, player, message); } return SCRIPT_CONTINUE; } if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_39"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (tatooine_espa_peggin_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse2 = true; } boolean hasResponse3 = false; if (tatooine_espa_peggin_condition__defaultCondition(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_41"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_53"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_76"); } if (hasResponse3) { responses[responseIndex++] = new string_id(c_stringFile, "s_88"); } utils.setScriptVar(player, "conversation.tatooine_espa_peggin.branchId", 14); npcStartConversation(player, npc, "tatooine_espa_peggin", 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("tatooine_espa_peggin")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); if (branchId == 1 && tatooine_espa_peggin_handleBranch1(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 3 && tatooine_espa_peggin_handleBranch3(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 4 && tatooine_espa_peggin_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 6 && tatooine_espa_peggin_handleBranch6(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 8 && tatooine_espa_peggin_handleBranch8(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && tatooine_espa_peggin_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 10 && tatooine_espa_peggin_handleBranch10(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && tatooine_espa_peggin_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 12 && tatooine_espa_peggin_handleBranch12(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 14 && tatooine_espa_peggin_handleBranch14(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 15 && tatooine_espa_peggin_handleBranch15(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 16 && tatooine_espa_peggin_handleBranch16(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 18 && tatooine_espa_peggin_handleBranch18(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 19 && tatooine_espa_peggin_handleBranch19(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 21 && tatooine_espa_peggin_handleBranch21(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 22 && tatooine_espa_peggin_handleBranch22(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 24 && tatooine_espa_peggin_handleBranch24(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 25 && tatooine_espa_peggin_handleBranch25(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.tatooine_espa_peggin.branchId"); return SCRIPT_CONTINUE; } }