Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/collections_collector.script
T
2013-09-10 23:17:15 -07:00

1333 lines
41 KiB
Plaintext

// ======================================================================
//
// collections_collector.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.collection;
include library.static_item;
include library.sui;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/collections_collector";
// ======================================================================
// Script Conditions
// ======================================================================
boolean collections_collector_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_cantGetMore (obj_id player, obj_id npc)
{
if(hasObjVar(npc, "collection.columnName"))
{
string columnName = getStringObjVar(npc, "collection.columnName");
return collection.checkMaxActive(player, npc, columnName);
}
return false;
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_noMoreCollections (obj_id player, obj_id npc)
{
if(hasObjVar(npc, "collection.columnName"))
{
string columnName = getStringObjVar(npc, "collection.columnName");
return collection.npcHasMoreCollections(player, npc, columnName);
}
return false;
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_hasCollectionsToRemove (obj_id player, obj_id npc)
{
if(hasObjVar(npc, "collection.columnName"))
{
string columnName = getStringObjVar(npc, "collection.columnName");
return collection.npcHasCollectionsToRemove(player, npc, columnName);
}
return false;
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_collectorHintEndor (obj_id player, obj_id npc)
{
string planetName = getCurrentSceneName();
//sendSystemMessageTestingOnly(player, planetName);
if(planetName.equals("endor"))
{
return false;
}
return true;
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_collectorHintTatooine (obj_id player, obj_id npc)
{
string planetName = getCurrentSceneName();
//sendSystemMessageTestingOnly(player, planetName);
if(planetName.equals("tatooine"))
{
return false;
}
return true;
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_collectorHintYavin4 (obj_id player, obj_id npc)
{
string planetName = getCurrentSceneName();
//sendSystemMessageTestingOnly(player, planetName);
if(planetName.equals("yavin4"))
{
return false;
}
return true;
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_collectorHintAurilia (obj_id player, obj_id npc)
{
string planetName = getCurrentSceneName();
int playerLevel = getLevel(player);
//sendSystemMessageTestingOnly(player, planetName);
if(planetName.equals("dathomir") || playerLevel < 70)
{
return false;
}
return true;
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_durniPhotoConvoStart (obj_id player, obj_id npc)
{
//Conversation start - Player will not get if he has
//started the collection, or if the collection is complete.
return !hasCompletedCollectionSlot(player, "photo_durni_activation");
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_durniPhotoActive (obj_id player, obj_id npc)
{
//Collection is active - not complete - and activation slot granted already.
if(hasCompletedCollectionSlot(player, "photo_durni_activation") && !hasCompletedCollection(player, "col_photo_durni_01"))
{
//Show this conversation
return true;
}
//Dont show conversation.
return false;
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_completedSlots_hasCamera (obj_id player, obj_id npc)
{
obj_id camera = utils.getStaticItemInInventory(player, "col_photo_camera_02_01");
//Check all 4 Durni Collection Slots - if they are complete - return true.
if(hasCompletedCollectionSlot(player, "photo_durni_vehement_warrior_01") && hasCompletedCollectionSlot(player, "photo_durni_01") &&
hasCompletedCollectionSlot(player, "photo_durni_fiendish_01") && hasCompletedCollectionSlot(player, "photo_crazed_durni_01") &&
isIdValid(camera))
{
//All slots complete(except the final slot that grants reward) and has camera to return
return true;
}
//Player still has work to do - don't show this dialog
return false;
}
// ----------------------------------------------------------------------
boolean collections_collector_condition_completedSlots_noCamera (obj_id player, obj_id npc)
{
obj_id camera = utils.getStaticItemInInventory(player, "col_photo_camera_02_01");
//Check all 4 Durni Collection Slots - if they are complete - return true.
if(hasCompletedCollectionSlot(player, "photo_durni_vehement_warrior_01") && hasCompletedCollectionSlot(player, "photo_durni_01") &&
hasCompletedCollectionSlot(player, "photo_durni_fiendish_01") && hasCompletedCollectionSlot(player, "photo_crazed_durni_01") &&
!isIdValid(camera))
{
//All slots complete(except the final slot that grants reward) and does NOT have the camera
return true;
}
//Player still has work to do - or does not have camera to return.
return false;
}
// ======================================================================
// Script Actions
// ======================================================================
void collections_collector_action_showRemovalSui (obj_id player, obj_id npc)
{
if(hasObjVar(npc, "collection.columnName"))
{
string columnName = getStringObjVar(npc, "collection.columnName");
collection.showNpcCollectionsRemoval(player, npc, columnName);
}
}
// ----------------------------------------------------------------------
void collections_collector_action_showCollectionSui (obj_id player, obj_id npc)
{
if(hasObjVar(npc, "collection.columnName"))
{
string columnName = getStringObjVar(npc, "collection.columnName");
collection.showNpcCollections(player, npc, columnName);
}
}
// ----------------------------------------------------------------------
void collections_collector_action_grantDurniCamera (obj_id player, obj_id npc)
{
//player has not completed collection - and has not activated it yet.
if(!hasCompletedCollection(player, "col_photo_durni_01") && !hasCompletedCollectionSlot(player, "photo_durni_activation"))
{
//Give the player a camera - he will take the pictures with it to complete the collection
obj_id itemId = static_item.createNewItemFunction("col_photo_camera_02_01", player);
//make sure the camera was created correctly. If not - don't start the collection.
if(isValidId(itemId) || exists(itemId))
{
CustomerServiceLog("Collection: ", "Player " + getFirstName(player) + "(" + player + ") received " + "col_photo_camera_02_01" + "(" + itemId + ") " + "for the 'col_photo_durni_01' collection.");
//Item Creation(Camera) successful - start the collection
modifyCollectionSlotValue(player, "photo_durni_activation", 1);
}
}
}
// ----------------------------------------------------------------------
void collections_collector_action_completeDurniCollection (obj_id player, obj_id npc)
{
obj_id camera = utils.getStaticItemInInventory(player, "col_photo_camera_02_01");
//All Slots are completed(Except for final rewarding slot)
if(hasCompletedCollectionSlot(player, "photo_durni_vehement_warrior_01") && hasCompletedCollectionSlot(player, "photo_durni_01") &&
hasCompletedCollectionSlot(player, "photo_durni_fiendish_01") && hasCompletedCollectionSlot(player, "photo_crazed_durni_01") &&
isIdValid(camera))
{
//grant him the final slot needed - this will complete the collection and grant the reward.
modifyCollectionSlotValue(player, "photo_durni_completion", 1);
//Player should now have the completed collection - if so, delete his camera.
if(hasCompletedCollection(player, "col_photo_durni_01"))
{
//destroy the camera - the player no longer has any need for it.
detachScript(camera, "item.special.nodestroy");
destroyObject(camera);
CustomerServiceLog("Collection: ", "Player " + getFirstName(player) + "(" + player + ") completed the 'col_photo_durni_01' collection. " + "item 'col_photo_camera_02_01'" + "(" + camera + ") " + "was deleted. *****This deletion is required to finish the collection!*****");
}
}
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int collections_collector_handleBranch1 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: I've spent my entire life collecting different things throughout the Galaxy. I am in search of a few final things to complete my work. Are you interested in helping?
//-- [RESPONSE NOTE]
//-- PLAYER: Sounds great. What do you have in mind?
if (response == "s_20")
{
//-- [NOTE]
if (!collections_collector_condition_noMoreCollections (player, npc))
{
//-- NPC: I dont have any more tasks for you at the moment. However, you may want to check back periodically. I'm always thinking of new things to collect.
string_id message = new string_id (c_stringFile, "s_22");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (collections_collector_condition_cantGetMore (player, npc))
{
//-- NPC: You have enough tasks for now. Finish the tasks I gave to you, then we can see about giving you some more.
string_id message = new string_id (c_stringFile, "s_29");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: Well, let's see. I have various tasks to choose from. However, in order to keep things organized, I can only give you two tasks at a time.
string_id message = new string_id (c_stringFile, "s_18");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Let me see what you have available. I'll help with whatever I can.
boolean hasResponse0 = false;
if (collections_collector_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I have plenty to keep me busy at the moment. I'll come back when I have less to do.
boolean hasResponse1 = false;
if (collections_collector_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_28");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_33");
utils.setScriptVar (player, "conversation.collections_collector.branchId", 4);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Is there a way to remove a collection that you gave me?
if (response == "s_16")
{
//-- [NOTE]
if (collections_collector_condition_hasCollectionsToRemove (player, npc))
{
//-- NPC: I'd rather have you complete the collection. However, I can remove the collection for you if you wish.
string_id message = new string_id (c_stringFile, "s_19");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: hmm...Ok, I really can't complete it right now, so let's remove it.
boolean hasResponse0 = false;
if (collections_collector_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: There's no way am I losing the progress I've made for this collection! Thanks, but i think i'll finish it.
boolean hasResponse1 = false;
if (collections_collector_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_25");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_32");
utils.setScriptVar (player, "conversation.collections_collector.branchId", 7);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: You don't have any Collections active that I gave you.
string_id message = new string_id (c_stringFile, "s_38");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Do you know of any other collectors that need help?
if (response == "s_39")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: Oh, yes, I have a few friends that are collectors as well. They sometimes help me finish up a collection if they have extra items that will help.
string_id message = new string_id (c_stringFile, "s_40");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Do they offer collections as well? If so, can you point me to them?
boolean hasResponse0 = false;
if (collections_collector_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.collections_collector.branchId", 11);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I'm here concerning the photography collection.
if (response == "s_69")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: Are you finished?
string_id message = new string_id (c_stringFile, "s_70");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes, I'm all done. Here's the camera, thanks for letting me use it.
boolean hasResponse0 = false;
if (collections_collector_condition_completedSlots_hasCamera (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: No, not finished yet.
boolean hasResponse1 = false;
if (collections_collector_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: Yes, I'm all done but I don't have the camera with me...
boolean hasResponse2 = false;
if (collections_collector_condition_completedSlots_noCamera (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_71");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_72");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_73");
utils.setScriptVar (player, "conversation.collections_collector.branchId", 17);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Someone mentioned you may have a new collection I would be interested in. Is this true?
if (response == "s_68")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: Ahh, yes I do. As you may have noticed, the Durni populations have been decreasing at an alarming rate in recent years.
string_id message = new string_id (c_stringFile, "s_78");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: What does that have to do with collecting?
boolean hasResponse0 = false;
if (collections_collector_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.collections_collector.branchId", 21);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: No, I am just passing through.
if (response == "s_88")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: If you change your mind, I could always use some help. Just come back and see me when you have more time.
string_id message = new string_id (c_stringFile, "s_90");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int collections_collector_handleBranch4 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Well, let's see. I have various tasks to choose from. However, in order to keep things organized, I can only give you two tasks at a time.
//-- [RESPONSE NOTE]
//-- PLAYER: Let me see what you have available. I'll help with whatever I can.
if (response == "s_28")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
collections_collector_action_showCollectionSui (player, npc);
//-- NPC: Here's what I have available. You can choose any two tasks from the list.
string_id message = new string_id (c_stringFile, "s_31");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I have plenty to keep me busy at the moment. I'll come back when I have less to do.
if (response == "s_33")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: Just let know know. I'll be here for a while.
string_id message = new string_id (c_stringFile, "s_35");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int collections_collector_handleBranch7 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: I'd rather have you complete the collection. However, I can remove the collection for you if you wish.
//-- [RESPONSE NOTE]
//-- PLAYER: hmm...Ok, I really can't complete it right now, so let's remove it.
if (response == "s_25")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
collections_collector_action_showRemovalSui (player, npc);
//-- NPC: Here's a list of collections you received from me. Again, if you delete the collection you will lose all progress that you have made.
string_id message = new string_id (c_stringFile, "s_27");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: There's no way am I losing the progress I've made for this collection! Thanks, but i think i'll finish it.
if (response == "s_32")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: Good Luck on finishing the collection.
string_id message = new string_id (c_stringFile, "s_36");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int collections_collector_handleBranch11 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Oh, yes, I have a few friends that are collectors as well. They sometimes help me finish up a collection if they have extra items that will help.
//-- [RESPONSE NOTE]
//-- PLAYER: Do they offer collections as well? If so, can you point me to them?
if (response == "s_41")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: Sure thing, I'm sure they'd be happy to see new faces interested in finding rare items.
string_id message = new string_id (c_stringFile, "s_42");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Direct me to the Endor Collector, please.
boolean hasResponse0 = false;
if (collections_collector_condition_collectorHintEndor (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I'd like to visit your friend on Yavin4.
boolean hasResponse1 = false;
if (collections_collector_condition_collectorHintYavin4 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: Aurilia, that's on Dathomir, correct? How do I get there?
boolean hasResponse2 = false;
if (collections_collector_condition_collectorHintAurilia (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
//-- PLAYER: Tatooine, yes! I love the dry heat!
boolean hasResponse3 = false;
if (collections_collector_condition_collectorHintTatooine (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse3 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_44");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_47");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_52");
if (hasResponse3)
responses [responseIndex++] = new string_id (c_stringFile, "s_56");
utils.setScriptVar (player, "conversation.collections_collector.branchId", 12);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int collections_collector_handleBranch12 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Sure thing, I'm sure they'd be happy to see new faces interested in finding rare items.
//-- [RESPONSE NOTE]
//-- PLAYER: Direct me to the Endor Collector, please.
if (response == "s_44")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: Ah, one of my best friends and a great collector.
string_id message = new string_id (c_stringFile, "s_48");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I'd like to visit your friend on Yavin4.
if (response == "s_47")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: Sure thing, he's located around the Mining Outpost on Yavin4.
string_id message = new string_id (c_stringFile, "s_50");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Aurilia, that's on Dathomir, correct? How do I get there?
if (response == "s_52")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: It sure is. You can get there by going to the Science Outpost on Dathomir and heading SE. You'll know you've arrive when you reach a dense fog.
string_id message = new string_id (c_stringFile, "s_54");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Tatooine, yes! I love the dry heat!
if (response == "s_56")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: She's located in Mos Eisley. Very talented, and a great teacher. When you see her, tell her I said 'Hello'.
string_id message = new string_id (c_stringFile, "s_58");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int collections_collector_handleBranch17 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Are you finished?
//-- [RESPONSE NOTE]
//-- PLAYER: Yes, I'm all done. Here's the camera, thanks for letting me use it.
if (response == "s_71")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
collections_collector_action_completeDurniCollection (player, npc);
//-- NPC: Great Photos! Here's your reward. Now, if you'll excuse me, I need to put these in an album.
string_id message = new string_id (c_stringFile, "s_74");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: No, not finished yet.
if (response == "s_72")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: Go ahead and finish up, then return to me for your reward.
string_id message = new string_id (c_stringFile, "s_75");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Yes, I'm all done but I don't have the camera with me...
if (response == "s_73")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: I need the camera in order to get the pictures from it. Go get the camera and return to me.
string_id message = new string_id (c_stringFile, "s_76");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int collections_collector_handleBranch21 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Ahh, yes I do. As you may have noticed, the Durni populations have been decreasing at an alarming rate in recent years.
//-- [RESPONSE NOTE]
//-- PLAYER: What does that have to do with collecting?
if (response == "s_80")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
//-- NPC: I'd like to get a set of pictures of the different species of durni just in case they do end up going extinct. Would you be willing to help?
string_id message = new string_id (c_stringFile, "s_82");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I sure will, what do you need me to do?
boolean hasResponse0 = false;
if (collections_collector_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_84");
utils.setScriptVar (player, "conversation.collections_collector.branchId", 22);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int collections_collector_handleBranch22 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: I'd like to get a set of pictures of the different species of durni just in case they do end up going extinct. Would you be willing to help?
//-- [RESPONSE NOTE]
//-- PLAYER: I sure will, what do you need me to do?
if (response == "s_84")
{
//-- [NOTE]
if (collections_collector_condition__defaultCondition (player, npc))
{
collections_collector_action_grantDurniCamera (player, npc);
//-- NPC: Take this camera, it has plenty of film. Go out and take as many pictures of Durni as you can, then return to me once you are finished.
string_id message = new string_id (c_stringFile, "s_86");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
//const string SID_CONFIRM_DELETE_TITLE = "@collection:confirm_delete_title";
//const string SID_CONFIRM_DELETE_TITLE = "@collection:confirm_delete_prompt";
const string PID_NAME = "collection_npc";
messageHandler handleCollectionNpc()
{
int btn = sui.getIntButtonPressed(params);
int idx = sui.getListboxSelectedRow(params);
obj_id player = sui.getPlayerId(params);
if(btn == sui.BP_CANCEL || idx < 0)
{
sui.removePid(player, PID_NAME);
return SCRIPT_CONTINUE;
}
if(!sui.hasPid(player, PID_NAME))
{
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_OK)
{
if(hasObjVar(self, "collection.columnName"))
{
string[] availableCollections = utils.getStringArrayScriptVar(player, "collection.allCollections");
string selectedCollection = availableCollections[idx];
collection.findAndGrantSlot(player, self, selectedCollection);
sui.removePid(player, PID_NAME);
}
}
return SCRIPT_CONTINUE;
}
messageHandler handleCollectionRemoval()
{
int btn = sui.getIntButtonPressed(params);
int idx = sui.getListboxSelectedRow(params);
obj_id player = sui.getPlayerId(params);
if(btn == sui.BP_CANCEL || idx < 0)
{
sui.removePid(player, PID_NAME);
return SCRIPT_CONTINUE;
}
if(!sui.hasPid(player, PID_NAME))
{
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_OK)
{
if(hasObjVar(self, "collection.columnName"))
{
string[] availableCollections = utils.getStringArrayScriptVar(player, "collection.allCollections");
string selectedCollection = availableCollections[idx];
utils.setScriptVar(player, "collection.selectedToDelete", selectedCollection);
int pid = sui.msgbox(self, player, "@collection:confirm_delete_prompt", sui.YES_NO, "@collection:confirm_delete_title", "handlePlayerConfirmedCollectionDelete");
sui.setPid(player, pid, PID_NAME);
}
}
return SCRIPT_CONTINUE;
}
messageHandler handlePlayerConfirmedCollectionDelete()
{
int btn = sui.getIntButtonPressed(params);
obj_id player = sui.getPlayerId(params);
if(btn == sui.BP_CANCEL)
{
sui.removePid(player, PID_NAME);
return SCRIPT_CONTINUE;
}
if(!sui.hasPid(player, PID_NAME))
{
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_OK)
{
if(utils.hasScriptVar(player, "collection.selectedToDelete"))
{
string selectedCollection = utils.getStringScriptVar(player, "collection.selectedToDelete");
collection.removeCollection(player, selectedCollection);
sui.removePid(player, PID_NAME);
}
}
return SCRIPT_CONTINUE;
}
trigger OnInitialize ()
{
if ((!isTangible (self)) || (isPlayer (self)))
detachScript(self, "conversation.collections_collector");
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.collections_collector");
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 (collections_collector_condition__defaultCondition (player, npc))
{
doAnimationAction (player, "pose_proudly");
//-- NPC: I've spent my entire life collecting different things throughout the Galaxy. I am in search of a few final things to complete my work. Are you interested in helping?
string_id message = new string_id (c_stringFile, "s_10");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Sounds great. What do you have in mind?
boolean hasResponse0 = false;
if (collections_collector_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Is there a way to remove a collection that you gave me?
boolean hasResponse1 = false;
if (collections_collector_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: Do you know of any other collectors that need help?
boolean hasResponse2 = false;
if (collections_collector_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
//-- PLAYER: I'm here concerning the photography collection.
boolean hasResponse3 = false;
if (collections_collector_condition_durniPhotoActive (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse3 = true;
}
//-- PLAYER: Someone mentioned you may have a new collection I would be interested in. Is this true?
boolean hasResponse4 = false;
if (collections_collector_condition_durniPhotoConvoStart (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse4 = true;
}
//-- PLAYER: No, I am just passing through.
boolean hasResponse5 = false;
if (collections_collector_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse5 = 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_16");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_39");
if (hasResponse3)
responses [responseIndex++] = new string_id (c_stringFile, "s_69");
if (hasResponse4)
responses [responseIndex++] = new string_id (c_stringFile, "s_68");
if (hasResponse5)
responses [responseIndex++] = new string_id (c_stringFile, "s_88");
utils.setScriptVar (player, "conversation.collections_collector.branchId", 1);
npcStartConversation (player, npc, "collections_collector", 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 != "collections_collector")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.collections_collector.branchId");
if (branchId == 1 && collections_collector_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 4 && collections_collector_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 7 && collections_collector_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 11 && collections_collector_handleBranch11 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 12 && collections_collector_handleBranch12 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 17 && collections_collector_handleBranch17 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 21 && collections_collector_handleBranch21 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 22 && collections_collector_handleBranch22 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.collections_collector.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================