package script.conversation; import script.library.ai_lib; import script.library.chat; import script.library.collection; import script.library.utils; import script.*; public class bounty_check_reset extends script.base_script { public bounty_check_reset() { } public static String c_stringFile = "conversation/bounty_check_reset"; public boolean bounty_check_reset_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException { return true; } public boolean bounty_check_reset_condition_bountyHunter(obj_id player, obj_id npc) throws InterruptedException { return utils.isProfession(player, utils.BOUNTY_HUNTER); } public boolean bounty_check_reset_condition_completedCollection(obj_id player, obj_id npc) throws InterruptedException { return hasCompletedCollection(player, "bounty_check_kill"); } public void bounty_check_reset_action_resetCollection(obj_id player, obj_id npc) throws InterruptedException { collection.removeCompletedCollection(player, "bounty_check_kill"); } public int bounty_check_reset_handleBranch1(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_6")) { doAnimationAction(player, "shrug_shoulders"); if (bounty_check_reset_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "shake_head_no"); string_id message = new string_id(c_stringFile, "s_8"); utils.removeScriptVar(player, "conversation.bounty_check_reset.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_10")) { if (bounty_check_reset_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "nod_head_once"); string_id message = new string_id(c_stringFile, "s_12"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bounty_check_reset_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bounty_check_reset_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_14"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_16"); } utils.setScriptVar(player, "conversation.bounty_check_reset.branchId", 3); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.bounty_check_reset.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bounty_check_reset_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_14")) { doAnimationAction(player, "nod_head_once"); if (bounty_check_reset_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "shake_head_no"); string_id message = new string_id(c_stringFile, "s_8"); utils.removeScriptVar(player, "conversation.bounty_check_reset.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } if (response.equals("s_16")) { doAnimationAction(player, "nod_head_once"); if (bounty_check_reset_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "rub_chin_thoughtful"); string_id message = new string_id(c_stringFile, "s_18"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bounty_check_reset_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bounty_check_reset_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_20"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_32"); } utils.setScriptVar(player, "conversation.bounty_check_reset.branchId", 4); 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.bounty_check_reset.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 bounty_check_reset_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_20")) { doAnimationAction(player, "nod"); if (bounty_check_reset_condition__defaultCondition(player, npc)) { string_id message = new string_id(c_stringFile, "s_22"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bounty_check_reset_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bounty_check_reset_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_24"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_28"); } utils.setScriptVar(player, "conversation.bounty_check_reset.branchId", 5); npcSpeak(player, message); npcSetConversationResponses(player, responses); } else { utils.removeScriptVar(player, "conversation.bounty_check_reset.branchId"); npcEndConversationWithMessage(player, message); } return SCRIPT_CONTINUE; } } if (response.equals("s_32")) { doAnimationAction(player, "shake_head_no"); if (bounty_check_reset_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "nod"); string_id message = new string_id(c_stringFile, "s_34"); utils.removeScriptVar(player, "conversation.bounty_check_reset.branchId"); npcEndConversationWithMessage(player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } public int bounty_check_reset_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException { if (response.equals("s_24")) { doAnimationAction(player, "nod_head_once"); if (bounty_check_reset_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "goodbye"); doAnimationAction(player, "goodbye"); bounty_check_reset_action_resetCollection(player, npc); string_id message = new string_id(c_stringFile, "s_26"); utils.removeScriptVar(player, "conversation.bounty_check_reset.branchId"); prose_package pp = new prose_package(); pp.stringId = message; pp.actor.set(player); pp.target.set(npc); npcEndConversationWithMessage(player, pp); return SCRIPT_CONTINUE; } } if (response.equals("s_28")) { if (bounty_check_reset_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "nod"); string_id message = new string_id(c_stringFile, "s_30"); utils.removeScriptVar(player, "conversation.bounty_check_reset.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.bounty_check_reset"); } setCondition(self, CONDITION_CONVERSABLE); obj_id cup1 = createObject("object/tangible/item/con_drinking_glass_01.iff", self, ""); equip(cup1, self); return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { setCondition(self, CONDITION_CONVERSABLE); obj_id cup1 = createObject("object/tangible/item/con_drinking_glass_01.iff", self, ""); equip(cup1, self); 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.bounty_check_reset"); 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 (bounty_check_reset_condition_bountyHunter(player, npc)) { doAnimationAction(npc, "greet"); doAnimationAction(player, "greet"); string_id message = new string_id(c_stringFile, "s_4"); int numberOfResponses = 0; boolean hasResponse = false; boolean hasResponse0 = false; if (bounty_check_reset_condition__defaultCondition(player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } boolean hasResponse1 = false; if (bounty_check_reset_condition_completedCollection(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_6"); } if (hasResponse1) { responses[responseIndex++] = new string_id(c_stringFile, "s_10"); } utils.setScriptVar(player, "conversation.bounty_check_reset.branchId", 1); prose_package pp = new prose_package(); pp.stringId = message; pp.actor.set(player); pp.target.set(npc); npcStartConversation(player, npc, "bounty_check_reset", null, pp, responses); } else { prose_package pp = new prose_package(); pp.stringId = message; pp.actor.set(player); pp.target.set(npc); chat.chat(npc, player, null, null, pp); } return SCRIPT_CONTINUE; } if (bounty_check_reset_condition__defaultCondition(player, npc)) { doAnimationAction(npc, "threaten"); string_id message = new string_id(c_stringFile, "s_36"); 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("bounty_check_reset")) { return SCRIPT_CONTINUE; } obj_id npc = self; int branchId = utils.getIntScriptVar(player, "conversation.bounty_check_reset.branchId"); if (branchId == 1 && bounty_check_reset_handleBranch1(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 3 && bounty_check_reset_handleBranch3(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 4 && bounty_check_reset_handleBranch4(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } if (branchId == 5 && bounty_check_reset_handleBranch5(player, npc, response) == SCRIPT_CONTINUE) { return SCRIPT_CONTINUE; } chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar(player, "conversation.bounty_check_reset.branchId"); return SCRIPT_CONTINUE; } }