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.buff; import script.library.chat; import script.library.collection; import script.library.conversation; import script.library.static_item; import script.library.utils; public class mtp_meatlump_wine extends script.base_script { public mtp_meatlump_wine() { } public static String c_stringFile = "conversation/mtp_meatlump_wine"; public boolean mtp_meatlump_wine_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean mtp_meatlump_wine_condition_hasLockoutBuff(obj_id player, obj_id npc) throws InterruptedException { if (buff.hasBuff(player, "mtp_wine_lockout")) { return false; } return true; } public boolean mtp_meatlump_wine_condition_readyForTurnIn(obj_id player, obj_id npc) throws InterruptedException { if (hasCompletedCollectionSlot(player, "meatlump_wine_juicer_slot") && !hasCompletedCollection(player, "col_meatlump_wine_01")) { return true; } return false; } public boolean mtp_meatlump_wine_condition_wineCollectionComplete_01(obj_id player, obj_id npc) throws InterruptedException { if (hasCompletedCollection(player, "col_meatlump_wine_01")) { return false; } if (hasCompletedCollectionSlotPrereq(player, "meatlump_wine_juicer_slot") && !hasCompletedCollection(player, "col_meatlump_wine_01")) { return false; } return true; } public boolean mtp_meatlump_wine_condition_wineCollectionComplete_02(obj_id player, obj_id npc) throws InterruptedException { if (hasCompletedCollection(player, "col_meatlump_wine_01")) { return true; } return false; } public void mtp_meatlump_wine_action_grantWineCollection(obj_id player, obj_id npc) throws InterruptedException { if (!hasCompletedCollectionSlotPrereq(player, "meatlump_wine_juicer_slot")) { modifyCollectionSlotValue(player, "meatlump_wine_starter_slot", 1); } } public void mtp_meatlump_wine_action_resetWineCollection(obj_id player, obj_id npc) throws InterruptedException { if (hasCompletedCollection(player, "col_meatlump_wine_01")) { collection.removeCompletedCollection(player, "col_meatlump_wine_01"); modifyCollectionSlotValue(player, "meatlump_wine_starter_slot", 1); } } public void mtp_meatlump_wine_action_finishWineCollection(obj_id player, obj_id npc) throws InterruptedException { if (hasCompletedCollectionSlot(player, "meatlump_wine_starter_slot") && hasCompletedCollectionSlot(player, "meatlump_wine_juicer_slot")) { modifyCollectionSlotValue(player, "meatlump_wine_finish_slot", 1); buff.applyBuff(player, "mtp_wine_lockout"); } } public int mtp_meatlump_wine_handleBranch1(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_15")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_36"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_28")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_37"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (mtp_meatlump_wine_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_38"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_55"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_56"); } utils.setScriptVar(player, "conversation.mtp_meatlump_wine.branchId", 3); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_35")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_40"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (mtp_meatlump_wine_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_41"); } utils.setScriptVar(player, "conversation.mtp_meatlump_wine.branchId", 8); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_59")) { if (mtp_meatlump_wine_condition_hasLockoutBuff(player, npc)) { string_id message = new string_id(c_stringFile, "s_60"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (mtp_meatlump_wine_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_62"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_66"); } utils.setScriptVar(player, "conversation.mtp_meatlump_wine.branchId", 15); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } if (!mtp_meatlump_wine_condition_hasLockoutBuff(player, npc)) { string_id message = new string_id(c_stringFile, "s_70"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (mtp_meatlump_wine_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.mtp_meatlump_wine.branchId", 18); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_76")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { mtp_meatlump_wine_action_finishWineCollection(player, npc); string_id message = new string_id(c_stringFile, "s_78"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (mtp_meatlump_wine_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.mtp_meatlump_wine.branchId", 20); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int mtp_meatlump_wine_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_38")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_39"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (mtp_meatlump_wine_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_53"); } utils.setScriptVar(player, "conversation.mtp_meatlump_wine.branchId", 4); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_55")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_57"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_56")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_58"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int mtp_meatlump_wine_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_53")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_54"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int mtp_meatlump_wine_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_41")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_42"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (mtp_meatlump_wine_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_44"); } utils.setScriptVar(player, "conversation.mtp_meatlump_wine.branchId", 9); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int mtp_meatlump_wine_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_43")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_46"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_44")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_45"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (mtp_meatlump_wine_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_47"); } utils.setScriptVar(player, "conversation.mtp_meatlump_wine.branchId", 11); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int mtp_meatlump_wine_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_47")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_48"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (mtp_meatlump_wine_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_49"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_50"); } utils.setScriptVar(player, "conversation.mtp_meatlump_wine.branchId", 12); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int mtp_meatlump_wine_handleBranch12(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_49")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { mtp_meatlump_wine_action_grantWineCollection(player, npc); string_id message = new string_id(c_stringFile, "s_51"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_50")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_52"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int mtp_meatlump_wine_handleBranch15(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_62")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { mtp_meatlump_wine_action_resetWineCollection(player, npc); string_id message = new string_id(c_stringFile, "s_64"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_66")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_68"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int mtp_meatlump_wine_handleBranch18(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_72")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_74"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int mtp_meatlump_wine_handleBranch20(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_80")) { if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_82"); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int OnInitialize(obj_id self) throws InterruptedException { if ((!isTangible(self)) || (isPlayer(self))) { detachScript(self, "conversation.mtp_meatlump_wine"); } setCondition(self, CONDITION_CONVERSABLE); return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { setCondition(self, CONDITION_CONVERSABLE); 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.mtp_meatlump_wine"); 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 (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_13"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (mtp_meatlump_wine_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } boolean hasResponse2 = false; if (mtp_meatlump_wine_condition_wineCollectionComplete_01(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse2 = true; } boolean hasResponse3 = false; if (mtp_meatlump_wine_condition_wineCollectionComplete_02(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse3 = true; } boolean hasResponse4 = false; if (mtp_meatlump_wine_condition_readyForTurnIn(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse4 = true; } if (hasResponse) { int responseIndex = 0; string_id responses[] = new string_id[numberOfResponses]; if (hasResponse0) { responses[responseIndex++] = new string_id(c_stringFile, "s_15"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_28"); } if (hasResponse2) { responses[responseIndex++] = new string_id(c_stringFile, "s_35"); } if (hasResponse3) { responses[responseIndex++] = new string_id(c_stringFile, "s_59"); } if (hasResponse4) { responses[responseIndex++] = new string_id(c_stringFile, "s_76"); } utils.setScriptVar(player, "conversation.mtp_meatlump_wine.branchId", 1); npcStartConversation(player, npc, "mtp_meatlump_wine", 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("mtp_meatlump_wine")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); if (branchId == 1 && mtp_meatlump_wine_handleBranch1(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 3 && mtp_meatlump_wine_handleBranch3(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 4 && mtp_meatlump_wine_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 8 && mtp_meatlump_wine_handleBranch8(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 9 && mtp_meatlump_wine_handleBranch9(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 11 && mtp_meatlump_wine_handleBranch11(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 12 && mtp_meatlump_wine_handleBranch12(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 15 && mtp_meatlump_wine_handleBranch15(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 18 && mtp_meatlump_wine_handleBranch18(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 20 && mtp_meatlump_wine_handleBranch20(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.mtp_meatlump_wine.branchId"); return SCRIPT_CONTINUE; } }