mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
1103 lines
37 KiB
Plaintext
1103 lines
37 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// junk_dealer_generic.script
|
|
// Copyright 2004, Sony Online Entertainment
|
|
// All Rights Reserved.
|
|
//
|
|
// Created with SwgConversationEditor 1.37 - DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.chat;
|
|
include library.conversation;
|
|
include library.smuggler;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/junk_dealer_generic";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean junk_dealer_generic_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean junk_dealer_generic_condition_check_inv (obj_id player, obj_id npc)
|
|
{
|
|
return smuggler.checkInventory(player, npc);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean junk_dealer_generic_condition_hasNoInv (obj_id player, obj_id npc)
|
|
{
|
|
boolean hasNoInvRoom = false;
|
|
obj_id playerInv = utils.getInventoryContainer(player);
|
|
if ( isIdValid(playerInv) )
|
|
{
|
|
int free_space = getVolumeFree(playerInv);
|
|
if (free_space < 1 )
|
|
{
|
|
hasNoInvRoom = true;
|
|
}
|
|
}
|
|
return hasNoInvRoom;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean junk_dealer_generic_condition_checkForKit (obj_id player, obj_id npc)
|
|
{
|
|
obj_id[] objContents = utils.getContents(player, true);
|
|
|
|
if( objContents != null )
|
|
{
|
|
for( int intI = 0; intI<objContents.length; intI++ )
|
|
{
|
|
string strItemTemplate = getTemplateName(objContents[intI]);
|
|
if( strItemTemplate=="object/tangible/loot/collectible/kits/orange_rug_kit.iff")
|
|
{
|
|
return false;
|
|
}
|
|
else if (strItemTemplate=="object/tangible/loot/collectible/kits/blue_rug_kit.iff")
|
|
{
|
|
return false;
|
|
}
|
|
else if (strItemTemplate=="object/tangible/loot/collectible/kits/gong_kit.iff")
|
|
{
|
|
return false;
|
|
}
|
|
else if (strItemTemplate=="object/tangible/loot/collectible/kits/light_table_kit.iff")
|
|
{
|
|
return false;
|
|
}
|
|
else if (strItemTemplate=="object/tangible/loot/collectible/kits/sculpture_kit.iff")
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean junk_dealer_generic_condition_checkForKitToo (obj_id player, obj_id npc)
|
|
{
|
|
obj_id[] objContents = utils.getContents(player, true);
|
|
|
|
if( objContents != null )
|
|
{
|
|
for( int intI = 0; intI<objContents.length; intI++ )
|
|
{
|
|
string strItemTemplate = getTemplateName(objContents[intI]);
|
|
if( strItemTemplate=="object/tangible/loot/collectible/kits/orange_rug_kit.iff")
|
|
{
|
|
return true;
|
|
}
|
|
else if (strItemTemplate=="object/tangible/loot/collectible/kits/blue_rug_kit.iff")
|
|
{
|
|
return true;
|
|
}
|
|
else if (strItemTemplate=="object/tangible/loot/collectible/kits/gong_kit.iff")
|
|
{
|
|
return true;
|
|
}
|
|
else if (strItemTemplate=="object/tangible/loot/collectible/kits/light_table_kit.iff")
|
|
{
|
|
return true;
|
|
}
|
|
else if (strItemTemplate=="object/tangible/loot/collectible/kits/sculpture_kit.iff")
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean junk_dealer_generic_condition_hasBuyBackItems (obj_id player, obj_id npc)
|
|
{
|
|
obj_id[] listOfBuyBacks = smuggler.getBuyBackItemsInContainer(player);
|
|
return listOfBuyBacks != null && listOfBuyBacks.length > 0;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean junk_dealer_generic_condition_checkBuyBackContainer (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
if(!smuggler.hasBuyBackContainer(player))
|
|
{
|
|
junk_dealer_generic_action_createBuyBackContainer(player, npc);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void junk_dealer_generic_action_start_dealing (obj_id player, obj_id npc)
|
|
{
|
|
dictionary params = new dictionary();
|
|
params.put("player", player);
|
|
|
|
messageTo(npc, "startDealing", params, 0.0f, false);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void junk_dealer_generic_action_face_to (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void junk_dealer_generic_action_giveOrange (obj_id player, obj_id npc)
|
|
{
|
|
obj_id playerInv = getObjectInSlot( player, "inventory" );
|
|
if(isIdValid(playerInv))
|
|
{
|
|
obj_id item = createObject( "object/tangible/loot/collectible/kits/orange_rug_kit.iff", playerInv, "" );
|
|
}
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void junk_dealer_generic_action_giveBlue (obj_id player, obj_id npc)
|
|
{
|
|
obj_id playerInv = getObjectInSlot( player, "inventory" );
|
|
if(isIdValid(playerInv))
|
|
{
|
|
obj_id item = createObject( "object/tangible/loot/collectible/kits/blue_rug_kit.iff", playerInv, "" );
|
|
}
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void junk_dealer_generic_action_giveGong (obj_id player, obj_id npc)
|
|
{
|
|
obj_id playerInv = getObjectInSlot( player, "inventory" );
|
|
if(isIdValid(playerInv))
|
|
{
|
|
obj_id item = createObject( "object/tangible/loot/collectible/kits/gong_kit.iff", playerInv, "" );
|
|
}
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void junk_dealer_generic_action_giveSculpture (obj_id player, obj_id npc)
|
|
{
|
|
obj_id playerInv = getObjectInSlot( player, "inventory" );
|
|
if(isIdValid(playerInv))
|
|
{
|
|
obj_id item = createObject( "object/tangible/loot/collectible/kits/sculpture_kit.iff", playerInv, "" );
|
|
}
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void junk_dealer_generic_action_giveTable (obj_id player, obj_id npc)
|
|
{
|
|
obj_id playerInv = getObjectInSlot( player, "inventory" );
|
|
if(isIdValid(playerInv))
|
|
{
|
|
obj_id item = createObject( "object/tangible/loot/collectible/kits/light_table_kit.iff", playerInv, "" );
|
|
}
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void junk_dealer_generic_action_startBuyBack (obj_id player, obj_id npc)
|
|
{
|
|
dictionary params = new dictionary();
|
|
params.put("player", player);
|
|
|
|
messageTo(npc, "startBuyBack", params, 0.0f, false);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void junk_dealer_generic_action_createBuyBackContainer (obj_id player, obj_id npc)
|
|
{
|
|
if(!isValidId(smuggler.createBuyBackControlDeviceOnPlayer(player)))
|
|
{
|
|
CustomerServiceLog("Junk_Dealer: ", "junk_dealer_generic conversation - Player (OID: " + player + ") did not get his buy back container set up properly.");
|
|
}
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void junk_dealer_generic_action_startFlagNoSale (obj_id player, obj_id npc)
|
|
{
|
|
dictionary params = new dictionary();
|
|
params.put("player", player);
|
|
|
|
messageTo(npc, "startFlaggingItemsNoSale", params, 0.0f, false);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int junk_dealer_generic_handleBranch1 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Welcome traveler. I am a buyer of goods that most would deem as junk. If you are interested I will look through what you have to offer and set a price for anything that I wish to buy. I also have come across some other items of interest that I am looking to get rid of.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I sold you something I actually needed. Can I buy it back?
|
|
if (response == "s_43")
|
|
{
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
//-- NPC: Looks like your inventory is full. Come back when you make some room.
|
|
string_id message = new string_id (c_stringFile, "s_47");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
junk_dealer_generic_action_startBuyBack (player, npc);
|
|
|
|
//-- NPC: Of course! All you need to do is give me back the credits. What was the item?
|
|
string_id message = new string_id (c_stringFile, "s_44");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I have some things that you might be interested in.
|
|
if (response == "s_54fab04f")
|
|
{
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
junk_dealer_generic_action_start_dealing (player, npc);
|
|
|
|
//-- NPC: Alright, let me see what you are offering.
|
|
string_id message = new string_id (c_stringFile, "s_84a67771");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: How can I mark items so you know what to buy and not to buy?
|
|
if (response == "s_48")
|
|
{
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
junk_dealer_generic_action_startFlagNoSale (player, npc);
|
|
|
|
//-- NPC: Just select an item in this list to toggle the items sellable or no sell.
|
|
string_id message = new string_id (c_stringFile, "s_50");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I am sorry but I don't think I have anything you would want.
|
|
if (response == "s_cd7a3f41")
|
|
{
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: That is too bad. Remember to come visit me in the future if you happen to come across anything I would be interested in.
|
|
string_id message = new string_id (c_stringFile, "s_4bd9d15e");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What sort of items do you have that you are looking to get rid of?
|
|
if (response == "s_3aa18b2d")
|
|
{
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: An inventor recently sold me and my fellow junk dealers a large quantity of these special kits that were supposed to revolutionize crafting. Unfortunately, they are useless without the special components that they are designed to use.
|
|
string_id message = new string_id (c_stringFile, "s_d9e6b751");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Why don't you just get some of the special components?
|
|
boolean hasResponse0 = false;
|
|
if (junk_dealer_generic_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_6d53d062");
|
|
|
|
utils.setScriptVar (player, "conversation.junk_dealer_generic.branchId", 7);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int junk_dealer_generic_handleBranch7 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: An inventor recently sold me and my fellow junk dealers a large quantity of these special kits that were supposed to revolutionize crafting. Unfortunately, they are useless without the special components that they are designed to use.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Why don't you just get some of the special components?
|
|
if (response == "s_6d53d062")
|
|
{
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Apparently this inventor had them all on a shipment that was coming in from the core worlds. As luck would have it the shipment was hijacked en route and all the components were lost to pirates. This caused the inventor to go out of business, leaving all of us stuck with these useless kits.
|
|
string_id message = new string_id (c_stringFile, "s_e29f48dc");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What good would a useless kit do me?
|
|
boolean hasResponse0 = false;
|
|
if (junk_dealer_generic_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_324b9b0f");
|
|
|
|
utils.setScriptVar (player, "conversation.junk_dealer_generic.branchId", 8);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int junk_dealer_generic_handleBranch8 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Apparently this inventor had them all on a shipment that was coming in from the core worlds. As luck would have it the shipment was hijacked en route and all the components were lost to pirates. This caused the inventor to go out of business, leaving all of us stuck with these useless kits.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What good would a useless kit do me?
|
|
if (response == "s_324b9b0f")
|
|
{
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: You seem to be the adventurous sort so I figured that you might be able to find the parts. I mean they had to go somewhere, although my guess is that they are probably all over the galaxy by now.
|
|
string_id message = new string_id (c_stringFile, "s_12fe83a6");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Hmmmm, well how much do you want for these kits?
|
|
boolean hasResponse0 = false;
|
|
if (junk_dealer_generic_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_e1a103e5");
|
|
|
|
utils.setScriptVar (player, "conversation.junk_dealer_generic.branchId", 9);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int junk_dealer_generic_handleBranch9 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: You seem to be the adventurous sort so I figured that you might be able to find the parts. I mean they had to go somewhere, although my guess is that they are probably all over the galaxy by now.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Hmmmm, well how much do you want for these kits?
|
|
if (response == "s_e1a103e5")
|
|
{
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: I just want them gone. They are taking up valuable space in my inventory so I will just give you one of each type if you want.
|
|
string_id message = new string_id (c_stringFile, "s_4d65752");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Ok sounds good. What sort of kits do you have?
|
|
boolean hasResponse0 = false;
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: No thanks, I don't think that I need any of those kits.
|
|
boolean hasResponse1 = false;
|
|
if (junk_dealer_generic_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_d347bee3");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_b60b73f8");
|
|
|
|
utils.setScriptVar (player, "conversation.junk_dealer_generic.branchId", 10);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int junk_dealer_generic_handleBranch10 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I just want them gone. They are taking up valuable space in my inventory so I will just give you one of each type if you want.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Ok sounds good. What sort of kits do you have?
|
|
if (response == "s_d347bee3")
|
|
{
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition_checkForKit (player, npc))
|
|
{
|
|
//-- NPC: Well let's see here. I have one that makes an orange rug, one that makes a blue rug, one that can make a Nabooian sculpture, one that makes a table, and one that makes some sort of model gong. I will only give you one kit at a time so if you want another you are going to have to get rid of the one you currently have first.
|
|
string_id message = new string_id (c_stringFile, "s_3fc7eb45");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Let me have one of those orange rug kits.
|
|
boolean hasResponse0 = false;
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I will take one of the blue rug kits.
|
|
boolean hasResponse1 = false;
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
|
|
//-- PLAYER: I think I would like one of those model gong kits.
|
|
boolean hasResponse2 = false;
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse2 = true;
|
|
}
|
|
|
|
//-- PLAYER: Let me have one that makes the table.
|
|
boolean hasResponse3 = false;
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse3 = true;
|
|
}
|
|
|
|
//-- PLAYER: I think I will try out the one that makes the sculpture.
|
|
boolean hasResponse4 = false;
|
|
if (junk_dealer_generic_condition__defaultCondition (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_ee977dee");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_8f39769");
|
|
|
|
if (hasResponse2)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_fe657cdd");
|
|
|
|
if (hasResponse3)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_9ede4b84");
|
|
|
|
if (hasResponse4)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_87c5851b");
|
|
|
|
utils.setScriptVar (player, "conversation.junk_dealer_generic.branchId", 11);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition_checkForKitToo (player, npc))
|
|
{
|
|
//-- NPC: It would appear that you already have one of these kits. I know I really want to get rid of all these kits but I just can't be handing them all out at once. You never know when they might be worth something.
|
|
string_id message = new string_id (c_stringFile, "s_3df21ea0");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: No thanks, I don't think that I need any of those kits.
|
|
if (response == "s_b60b73f8")
|
|
{
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Can't say that I blame you for not taking one. It's sad that I can't even give them away. If I ever see that inventor again I am going to make him really sorry.
|
|
string_id message = new string_id (c_stringFile, "s_3633b5a5");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int junk_dealer_generic_handleBranch11 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Well let's see here. I have one that makes an orange rug, one that makes a blue rug, one that can make a Nabooian sculpture, one that makes a table, and one that makes some sort of model gong. I will only give you one kit at a time so if you want another you are going to have to get rid of the one you currently have first.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Let me have one of those orange rug kits.
|
|
if (response == "s_ee977dee")
|
|
{
|
|
//-- [NOTE]
|
|
if (!junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
junk_dealer_generic_action_giveOrange (player, npc);
|
|
|
|
//-- NPC: Ok, here you go. I guess in order to make it work you need to add ten special components to the kit. When you examine a kit, it has a list of what you need in order to complete the kit. It also has a read-out of whether it currently has a component or not. Oh, and if you do happen to make anything useful with that kit, I might be interested in buying that from you.
|
|
string_id message = new string_id (c_stringFile, "s_14efaaa2");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
//-- NPC: I am sorry but you do not have any space in your inventory for me to give you a kit. Maybe you should clear out some room and talk to me again if you are still interested.
|
|
string_id message = new string_id (c_stringFile, "s_5b10c0b9");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I will take one of the blue rug kits.
|
|
if (response == "s_8f39769")
|
|
{
|
|
//-- [NOTE]
|
|
if (!junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
junk_dealer_generic_action_giveBlue (player, npc);
|
|
|
|
//-- NPC: Ok, here you go. I guess in order to make it work you need to add ten special components to the kit. When you examine a kit, it has a list of what you need in order to complete the kit. It also has a read-out of whether it currently has a component or not. Oh, and if you do happen to make anything useful with that kit, I might be interested in buying that from you.
|
|
string_id message = new string_id (c_stringFile, "s_27");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
//-- NPC: I am sorry but you do not have any space in your inventory for me to give you a kit. Maybe you should clear out some room and talk to me again if you are still interested.
|
|
string_id message = new string_id (c_stringFile, "s_29");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I think I would like one of those model gong kits.
|
|
if (response == "s_fe657cdd")
|
|
{
|
|
//-- [NOTE]
|
|
if (!junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
junk_dealer_generic_action_giveGong (player, npc);
|
|
|
|
//-- NPC: Ok, here you go. I guess in order to make it work you need to add ten special components to the kit. When you examine a kit, it has a list of what you need in order to complete the kit. It also has a read-out of whether it currently has a component or not. Oh, and if you do happen to make anything useful with that kit, I might be interested in buying that from you.
|
|
string_id message = new string_id (c_stringFile, "s_32");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
//-- NPC: I am sorry but you do not have any space in your inventory for me to give you a kit. Maybe you should clear out some room and talk to me again if you are still interested.
|
|
string_id message = new string_id (c_stringFile, "s_34");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Let me have one that makes the table.
|
|
if (response == "s_9ede4b84")
|
|
{
|
|
//-- [NOTE]
|
|
if (!junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
junk_dealer_generic_action_giveTable (player, npc);
|
|
|
|
//-- NPC: Ok, here you go. I guess in order to make it work you need to add ten special components to the kit. When you examine a kit, it has a list of what you need in order to complete the kit. It also has a read-out of whether it currently has a component or not. Oh, and if you do happen to make anything useful with that kit, I might be interested in buying that from you.
|
|
string_id message = new string_id (c_stringFile, "s_37");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
//-- NPC: I am sorry but you do not have any space in your inventory for me to give you a kit. Maybe you should clear out some room and talk to me again if you are still interested.
|
|
string_id message = new string_id (c_stringFile, "s_39");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I think I will try out the one that makes the sculpture.
|
|
if (response == "s_87c5851b")
|
|
{
|
|
//-- [NOTE]
|
|
if (!junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
junk_dealer_generic_action_giveSculpture (player, npc);
|
|
|
|
//-- NPC: Ok, here you go. I guess in order to make it work you need to add ten special components to the kit. When you examine a kit, it has a list of what you need in order to complete the kit. It also has a read-out of whether it currently has a component or not. Oh, and if you do happen to make anything useful with that kit, I might be interested in buying that from you.
|
|
string_id message = new string_id (c_stringFile, "s_42");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (junk_dealer_generic_condition_hasNoInv (player, npc))
|
|
{
|
|
//-- NPC: I am sorry but you do not have any space in your inventory for me to give you a kit. Maybe you should clear out some room and talk to me again if you are still interested.
|
|
string_id message = new string_id (c_stringFile, "s_49");
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.junk_dealer_generic");
|
|
|
|
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);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnIncapacitated (obj_id killer)
|
|
{
|
|
clearCondition (self, CONDITION_CONVERSABLE);
|
|
detachScript (self, "conversation.junk_dealer_generic");
|
|
|
|
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 (junk_dealer_generic_condition_checkBuyBackContainer (player, npc))
|
|
{
|
|
junk_dealer_generic_action_face_to (player, npc);
|
|
|
|
//-- NPC: Welcome traveler. I am a buyer of goods that most would deem as junk. If you are interested I will look through what you have to offer and set a price for anything that I wish to buy. I also have come across some other items of interest that I am looking to get rid of.
|
|
string_id message = new string_id (c_stringFile, "s_bef51e38");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I sold you something I actually needed. Can I buy it back?
|
|
boolean hasResponse0 = false;
|
|
if (junk_dealer_generic_condition_hasBuyBackItems (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I have some things that you might be interested in.
|
|
boolean hasResponse1 = false;
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
|
|
//-- PLAYER: How can I mark items so you know what to buy and not to buy?
|
|
boolean hasResponse2 = false;
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse2 = true;
|
|
}
|
|
|
|
//-- PLAYER: I am sorry but I don't think I have anything you would want.
|
|
boolean hasResponse3 = false;
|
|
if (junk_dealer_generic_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse3 = true;
|
|
}
|
|
|
|
//-- PLAYER: What sort of items do you have that you are looking to get rid of?
|
|
boolean hasResponse4 = false;
|
|
if (junk_dealer_generic_condition_check_inv (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_43");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_54fab04f");
|
|
|
|
if (hasResponse2)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_48");
|
|
|
|
if (hasResponse3)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_cd7a3f41");
|
|
|
|
if (hasResponse4)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_3aa18b2d");
|
|
|
|
utils.setScriptVar (player, "conversation.junk_dealer_generic.branchId", 1);
|
|
|
|
npcStartConversation (player, npc, "junk_dealer_generic", 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 != "junk_dealer_generic")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
if (branchId == 1 && junk_dealer_generic_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 7 && junk_dealer_generic_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 8 && junk_dealer_generic_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 9 && junk_dealer_generic_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 10 && junk_dealer_generic_handleBranch10 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 11 && junk_dealer_generic_handleBranch11 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.junk_dealer_generic.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|