// ====================================================================== // // generic_broker_2.script // Copyright 2004, Sony Online Entertainment // All Rights Reserved. // // Created with SwgConversationEditor 1.36 - DO NOT EDIT THIS AUTO-GENERATED FILE! // // ====================================================================== // ====================================================================== // Library Includes // ====================================================================== include library.ai_lib; include library.chat; include library.factions; include library.groundquests; include library.money; include library.smuggler; include library.utils; // ====================================================================== // Script Constants // ====================================================================== string c_stringFile = "conversation/generic_broker_2"; // ====================================================================== // Script Conditions // ====================================================================== boolean generic_broker_2_condition__defaultCondition (obj_id player, obj_id npc) { return true; } // ---------------------------------------------------------------------- boolean generic_broker_2_condition_isNonSmuggler (obj_id player, obj_id npc) { if(utils.getPlayerProfession(player) != utils.SMUGGLER) { return true; } return false; } // ---------------------------------------------------------------------- boolean generic_broker_2_condition_isDoingMission (obj_id player, obj_id npc) { if (groundquests.isDoingSmugglerMission(player)) { return true; } return false; } // ---------------------------------------------------------------------- boolean generic_broker_2_condition_missionTierRequirement (obj_id player, obj_id npc) { float underworldFaction = factions.getFactionStanding( player, "underworld" ); if (smuggler.getSmuggleTier(underworldFaction) == 2) { return true; } return false; } // ---------------------------------------------------------------------- boolean generic_broker_2_condition_hasMissionFunds (obj_id player, obj_id npc) { if (money.hasFunds(player, money.MT_TOTAL, smuggler.TIER_2_GENERIC_FRONT_COST)) { return true; } return false; } // ---------------------------------------------------------------------- boolean generic_broker_2_condition_hasSomeContraband (obj_id player, obj_id npc) { if (smuggler.hasIllicitContraband(player)) { return true; } return false; } // ---------------------------------------------------------------------- boolean generic_broker_2_condition_hasMissionContraband (obj_id player, obj_id npc) { if (smuggler.hasIllicitMissionContraband(player)) { return true; } return false; } // ====================================================================== // Script Actions // ====================================================================== void generic_broker_2_action_startGiveQuest (obj_id player, obj_id npc) { money.requestPayment(player, npc, smuggler.TIER_2_GENERIC_FRONT_COST, "none", null, true); groundquests.requestGrantQuest(player, "quest/smuggle_generic_2", true); } // ---------------------------------------------------------------------- void generic_broker_2_action_givePointerQuest (obj_id player, obj_id npc) { float underworldFaction = factions.getFactionStanding( player, "underworld" ); int missionTier = smuggler.getSmuggleTier(underworldFaction); string pointerQuest = ""; switch (missionTier) { case 1: pointerQuest = "quest/smuggle_pointer_generic_1"; break; case 2: pointerQuest = "quest/smuggle_pointer_generic_2"; break; case 3: pointerQuest = "quest/smuggle_pointer_generic_3"; break; case 4: pointerQuest = "quest/smuggle_pointer_generic_4"; break; case 5: pointerQuest = "quest/smuggle_pointer_generic_5"; break; default: break; } if (!groundquests.isQuestActive(player, pointerQuest)) { groundquests.requestGrantQuest(player, pointerQuest, true); } } // ---------------------------------------------------------------------- void generic_broker_2_action_giveIllicitPointerQuest (obj_id player, obj_id npc) { float underworldFaction = factions.getFactionStanding( player, "underworld" ); int smuggleTier = smuggler.getSmuggleTier(underworldFaction); string illicitContraband = smuggler.getIllicitMissionContrabandSmugglerTier(player, smuggleTier); int illicitTier = smuggler.getIllicitContrabandTier(illicitContraband); string pointerQuest = ""; switch (illicitTier) { case 1: pointerQuest = "quest/smuggle_pointer_illicit_1"; break; case 2: pointerQuest = "quest/smuggle_pointer_illicit_2"; break; case 3: pointerQuest = "quest/smuggle_pointer_illicit_3"; break; case 4: pointerQuest = "quest/smuggle_pointer_illicit_4"; break; case 5: pointerQuest = "quest/smuggle_pointer_illicit_5"; break; default: break; } if (!groundquests.isQuestActive(player, pointerQuest)) { groundquests.requestGrantQuest(player, pointerQuest, true); } } // ====================================================================== // Script %TO Tokens // ====================================================================== // ====================================================================== // Script %DI Tokens // ====================================================================== int generic_broker_2_tokenDI_frontMoney (obj_id player, obj_id npc) { return (smuggler.TIER_2_GENERIC_FRONT_COST); } // ====================================================================== // Script %DF Tokens // ====================================================================== // ====================================================================== // handleBranch Functions // ====================================================================== int generic_broker_2_handleBranch3 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: If you're looking to do some more smuggling, you need to talk to one of my associates. //-- [RESPONSE NOTE] //-- PLAYER: Associates? Please tell me who I need to contact. if (response == "s_16") { //-- [NOTE] if (generic_broker_2_condition__defaultCondition (player, npc)) { generic_broker_2_action_givePointerQuest (player, npc); //-- NPC: Tell em I said you were OK. string_id message = new string_id (c_stringFile, "s_20"); utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Not right now. if (response == "s_18") { //-- [NOTE] if (generic_broker_2_condition__defaultCondition (player, npc)) { //-- NPC: Well the underworld has many contacts throughout the galaxy. If you ever need to be pointed in the right direction, come back and see me again. string_id message = new string_id (c_stringFile, "s_19"); utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int generic_broker_2_handleBranch6 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I have some merchandise that needs to be delivered fast. You want to make a quick buck? //-- [RESPONSE NOTE] //-- PLAYER: Yes. if (response == "s_17") { //-- [NOTE] if (generic_broker_2_condition__defaultCondition (player, npc)) { //-- NPC: I will need %DI credits front money before I hand over the goods. string_id message = new string_id (c_stringFile, "s_22"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: OK. boolean hasResponse0 = false; if (generic_broker_2_condition_hasMissionFunds (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Not right now. boolean hasResponse1 = false; if (generic_broker_2_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.generic_broker_2.branchId", 7); prose_package pp = new prose_package (); pp.stringId = message; pp.actor.set (player); pp.target.set (npc); pp.digitInteger = generic_broker_2_tokenDI_frontMoney (player, npc); npcSpeak (player, pp); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); prose_package pp = new prose_package (); pp.stringId = message; pp.actor.set (player); pp.target.set (npc); pp.digitInteger = generic_broker_2_tokenDI_frontMoney (player, npc); npcEndConversationWithMessage (player, pp); } return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: No. if (response == "s_32") { //-- [NOTE] if (generic_broker_2_condition__defaultCondition (player, npc)) { //-- NPC: Ah well, your loss. string_id message = new string_id (c_stringFile, "s_34"); utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: I have some contraband I found. if (response == "s_36") { //-- [NOTE] if (!generic_broker_2_condition_hasMissionContraband (player, npc)) { //-- NPC: Some of my associates deal with distribution of these items. You will need at least 5 to make enough for a shipment. When you have collected at least 5 of the same type, I will direct you to an associate that would be interested. string_id message = new string_id (c_stringFile, "s_38"); utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (generic_broker_2_condition_hasMissionContraband (player, npc)) { //-- NPC: I see you have collected enough contraband. You will need to take it to one of my associates. string_id message = new string_id (c_stringFile, "s_40"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Who do I take the contraband to? boolean hasResponse0 = false; if (generic_broker_2_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Not right now. boolean hasResponse1 = false; if (generic_broker_2_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_42"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_46"); utils.setScriptVar (player, "conversation.generic_broker_2.branchId", 12); npcSpeak (player, message); npcSetConversationResponses (player, responses); } else { utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); npcEndConversationWithMessage (player, message); } return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int generic_broker_2_handleBranch7 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I will need %DI credits front money before I hand over the goods. //-- [RESPONSE NOTE] //-- PLAYER: OK. if (response == "s_24") { generic_broker_2_action_startGiveQuest (player, npc); //-- [NOTE] if (generic_broker_2_condition__defaultCondition (player, npc)) { //-- NPC: You do not have much time. Good luck and watch your back! string_id message = new string_id (c_stringFile, "s_26"); utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Not right now. if (response == "s_28") { //-- [NOTE] if (generic_broker_2_condition__defaultCondition (player, npc)) { //-- NPC: Ah well, your loss. string_id message = new string_id (c_stringFile, "s_30"); utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- int generic_broker_2_handleBranch12 (obj_id player, obj_id npc, string_id response) { //-- [BRANCH NOTE] //-- NPC: I see you have collected enough contraband. You will need to take it to one of my associates. //-- [RESPONSE NOTE] //-- PLAYER: Who do I take the contraband to? if (response == "s_42") { //-- [NOTE] if (generic_broker_2_condition__defaultCondition (player, npc)) { generic_broker_2_action_giveIllicitPointerQuest (player, npc); //-- NPC: Tell em I said you were ok. string_id message = new string_id (c_stringFile, "s_44"); utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } //-- [RESPONSE NOTE] //-- PLAYER: Not right now. if (response == "s_46") { //-- [NOTE] if (generic_broker_2_condition__defaultCondition (player, npc)) { //-- NPC: Come back and talk to me when you're ready for this assignment. string_id message = new string_id (c_stringFile, "s_48"); utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); npcEndConversationWithMessage (player, message); return SCRIPT_CONTINUE; } } return SCRIPT_DEFAULT; } // ---------------------------------------------------------------------- // ====================================================================== // User Script Triggers // ====================================================================== trigger OnInitialize () { if ((!isTangible (self)) || (isPlayer (self))) detachScript(self, "conversation.generic_broker_2"); setCondition (self, CONDITION_CONVERSABLE); return SCRIPT_CONTINUE; } trigger OnAttach () { setCondition (self, CONDITION_CONVERSABLE); return SCRIPT_CONTINUE; } trigger OnObjectMenuRequest (obj_id player, menu_info menuInfo) { int menu = menuInfo.addRootMenu (menu_info_types.CONVERSE_START, null); menu_info_data menuInfoData = menuInfo.getMenuItemById (menu); menuInfoData.setServerNotify (false); setCondition (self, CONDITION_CONVERSABLE); groundquests.sendSignal(player, "ogdenPointer"); return SCRIPT_CONTINUE; } trigger OnIncapacitated (obj_id killer) { clearCondition (self, CONDITION_CONVERSABLE); detachScript (self, "conversation.generic_broker_2"); return SCRIPT_CONTINUE; } // ====================================================================== // Script Triggers // ====================================================================== //-- This function should move to base_class.java boolean npcStartConversation(obj_id player, obj_id npc, string convoName, string_id greetingId, prose_package greetingProse, string_id[] responses) { Object[] objects = new Object[responses.length]; System.arraycopy(responses, 0, objects, 0, responses.length); return npcStartConversation(player, npc, convoName, greetingId, greetingProse, objects); } // ---------------------------------------------------------------------- trigger OnStartNpcConversation (obj_id player) { obj_id npc = self; if (ai_lib.isInCombat (npc) || ai_lib.isInCombat (player)) return SCRIPT_OVERRIDE; //-- [NOTE] if (generic_broker_2_condition_isNonSmuggler (player, npc)) { //-- NPC: We have nothing to discuss. string_id message = new string_id (c_stringFile, "s_4"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (generic_broker_2_condition_isDoingMission (player, npc)) { //-- NPC: I see you currently have an assignment. My customers do not like to be kept waiting. Finish your current delivery and then come see me. string_id message = new string_id (c_stringFile, "s_6"); chat.chat (npc, player, message); return SCRIPT_CONTINUE; } //-- [NOTE] if (!generic_broker_2_condition_missionTierRequirement (player, npc)) { //-- NPC: If you're looking to do some more smuggling, you need to talk to one of my associates. string_id message = new string_id (c_stringFile, "s_8"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Associates? Please tell me who I need to contact. boolean hasResponse0 = false; if (generic_broker_2_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: Not right now. boolean hasResponse1 = false; if (generic_broker_2_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_16"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_18"); utils.setScriptVar (player, "conversation.generic_broker_2.branchId", 3); npcStartConversation (player, npc, "generic_broker_2", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } //-- [NOTE] if (generic_broker_2_condition__defaultCondition (player, npc)) { //-- NPC: I have some merchandise that needs to be delivered fast. You want to make a quick buck? string_id message = new string_id (c_stringFile, "s_14"); int numberOfResponses = 0; boolean hasResponse = false; //-- PLAYER: Yes. boolean hasResponse0 = false; if (generic_broker_2_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse0 = true; } //-- PLAYER: No. boolean hasResponse1 = false; if (generic_broker_2_condition__defaultCondition (player, npc)) { ++numberOfResponses; hasResponse = true; hasResponse1 = true; } //-- PLAYER: I have some contraband I found. boolean hasResponse2 = false; if (generic_broker_2_condition_hasSomeContraband (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_17"); if (hasResponse1) responses [responseIndex++] = new string_id (c_stringFile, "s_32"); if (hasResponse2) responses [responseIndex++] = new string_id (c_stringFile, "s_36"); utils.setScriptVar (player, "conversation.generic_broker_2.branchId", 6); npcStartConversation (player, npc, "generic_broker_2", message, responses); } else { chat.chat (npc, player, message); } return SCRIPT_CONTINUE; } chat.chat (npc, "Error: All conditions for OnStartNpcConversation were false."); return SCRIPT_CONTINUE; } // ---------------------------------------------------------------------- trigger OnNpcConversationResponse (string conversationId, obj_id player, string_id response) { if (conversationId != "generic_broker_2") return SCRIPT_CONTINUE; obj_id npc = self; int branchId = utils.getIntScriptVar (player, "conversation.generic_broker_2.branchId"); if (branchId == 3 && generic_broker_2_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 6 && generic_broker_2_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 7 && generic_broker_2_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; if (branchId == 12 && generic_broker_2_handleBranch12 (player, npc, response) == SCRIPT_CONTINUE) return SCRIPT_CONTINUE; chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse."); utils.removeScriptVar (player, "conversation.generic_broker_2.branchId"); return SCRIPT_CONTINUE; } // ======================================================================