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

774 lines
24 KiB
Plaintext

// ======================================================================
//
// village_quharek.script
// Copyright 2003, Sony Online Entertainment
// All Rights Reserved.
//
// DO NOT EDIT THIS AUTO-GENERATED FILE. PLEASE USE THE CONVERATION EDITOR!
//
// ======================================================================
// ======================================================================
// Library Includes
// ======================================================================
include library.ai_lib;
include library.chat;
include library.fs_dyn_village;
include library.fs_quests;
include library.quests;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/village_quharek";
// ======================================================================
// Script Conditions
// ======================================================================
boolean village_quharek_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean village_quharek_condition_phase1_givequest (obj_id player, obj_id npc)
{
obj_id master = getObjIdObjVar(npc, "village_master");
if(!isIdValid(master))
return false;
if (!fs_quests.isVillageEligible(player))
return false;
if (fs_quests.hasQuestAccepted(player))
return false;
int phase = fs_dyn_village.getCurrentPhaseAuth(master);
if(phase != 1)
return false;
return true;
}
// ----------------------------------------------------------------------
boolean village_quharek_condition_phase1_inprogress (obj_id player, obj_id npc)
{
obj_id master = getObjIdObjVar(npc, "village_master");
if(!isIdValid(master))
return false;
int phase = fs_dyn_village.getCurrentPhaseAuth(master);
if(phase != 1)
return false;
if(hasObjVar(player, "quest.fs_crafting1.inprogress"))
return true;
return false;
}
// ----------------------------------------------------------------------
boolean village_quharek_condition_phase1_complete (obj_id player, obj_id npc)
{
obj_id master = getObjIdObjVar(npc, "village_master");
if(!isIdValid(master))
return false;
int phase = fs_dyn_village.getCurrentPhaseAuth(master);
if(phase != 1)
return false;
if(quests.isComplete("fs_craft_puzzle_quest_03", player))
return true;
return false;
}
// ----------------------------------------------------------------------
boolean village_quharek_condition_accepted_quest (obj_id player, obj_id npc)
{
if(fs_quests.hasQuestAccepted(player))
return true;
return false;
}
// ----------------------------------------------------------------------
boolean village_quharek_condition_not_eligible (obj_id player, obj_id npc)
{
if(!fs_quests.isVillageEligible(player))
return true;
return false;
}
// ----------------------------------------------------------------------
boolean village_quharek_condition_wrong_phase (obj_id player, obj_id npc)
{
obj_id master = getObjIdObjVar(npc, "village_master");
if(!isIdValid(master))
return false;
int phase = fs_dyn_village.getCurrentPhaseAuth(master);
if(phase != 1)
return true;
return false;
}
// ----------------------------------------------------------------------
boolean village_quharek_condition_completed_quest (obj_id player, obj_id npc)
{
if(fs_quests.hasQuestCompleted(player))
return true;
return false;
}
// ======================================================================
// Script Actions
// ======================================================================
void village_quharek_action_phase1_activate (obj_id player, obj_id npc)
{
obj_id master = getObjIdObjVar(npc, "village_master");
if(isIdValid(master))
setObjVar(player, "quest.fs_crafting1.master", master);
setObjVar(player, "quest.fs_crafting1.inprogress", 1);
setObjVar(player, "quest.fs_craft_puzzle_quest_01.parameter", 4.0f);
setObjVar(player, "quest.fs_craft_puzzle_quest_02.parameter", 7.0f);
attachScript(player, "quest.force_sensitive.fs_crafting1_player");
quests.activate("fs_craft_puzzle_quest_00", player, null);
fs_quests.setQuestAccepted(player);
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isMob (self)) || (isPlayer (self)))
detachScript(self, "npc.conversation.village_quharek");
ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
if(!fs_dyn_village.getRegisteredObjIdFromClusterWideData(fs_dyn_village.CLUSTER_OBJID_KEY_MASTER, "handleMasterIdResponse", self))
messageTo(self, "handleMasterIdRequestRetry", null, 120.0f, false);
return SCRIPT_CONTINUE;
}
trigger OnAttach ()
{
setCondition (self, CONDITION_CONVERSABLE);
ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
if(!fs_dyn_village.getRegisteredObjIdFromClusterWideData(fs_dyn_village.CLUSTER_OBJID_KEY_MASTER, "handleMasterIdResponse", self))
messageTo(self, "handleMasterIdRequestRetry", null, 120.0f, false);
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, "npc.conversation.village_quharek");
return SCRIPT_CONTINUE;
}
messageHandler handleMasterIdResponse() {
obj_id master = params.getObjId(fs_dyn_village.CLUSTER_OBJID_KEY_MASTER);
if(isIdValid(master))
setObjVar(self, "village_master", master);
else
messageTo(self, "handleMasterIdRequestRetry", null, 120.0f, false);
return SCRIPT_CONTINUE;
}
messageHandler handleMasterIdRequestRetry() {
if(!fs_dyn_village.getRegisteredObjIdFromClusterWideData(fs_dyn_village.CLUSTER_OBJID_KEY_MASTER, "handleMasterIdResponse", self))
messageTo(self, "handleMasterIdRequestRetry", null, 120.0f, false);
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)
{
if (ai_lib.isInCombat (self) || ai_lib.isInCombat (player))
return SCRIPT_OVERRIDE;
//-- [NOTE]
if (village_quharek_condition_not_eligible (player, self))
{
//-- NPC: What are you doing here? You shouldn't be here!
string_id message = new string_id (c_stringFile, "s_fae10418");
chat.chat (self, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (village_quharek_condition_phase1_complete (player, self))
{
//-- NPC: Hey! You got that all fixed up, didn't you? And just in time. You're all right, you know that?
string_id message = new string_id (c_stringFile, "s_be3bc184");
chat.chat (self, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (village_quharek_condition_phase1_inprogress (player, self))
{
//-- NPC: What are you waiting for? Go get that sensor array repaired!
string_id message = new string_id (c_stringFile, "s_16cc0ae1");
chat.chat (self, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (village_quharek_condition_phase1_givequest (player, self))
{
//-- NPC: You there! Are you handy with a set of tools?
string_id message = new string_id (c_stringFile, "s_ebabb0f8");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes, I suppose I am.
boolean hasResponse0 = false;
if (village_quharek_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Not really no.
boolean hasResponse1 = false;
if (village_quharek_condition__defaultCondition (player, self))
{
++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_4beb938f");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_f474ed78");
setObjVar (player, "conversation.village_quharek.branchId", 4);
npcStartConversation (player, self, "village_quharek", message, responses);
}
else
{
chat.chat (self, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (village_quharek_condition_completed_quest (player, self))
{
//-- NPC: Say, I know you. They tell me you've been a great help. Good job.
string_id message = new string_id (c_stringFile, "s_f1a421d");
chat.chat (self, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (village_quharek_condition_accepted_quest (player, self))
{
//-- NPC: You there! Are you handy with a set of tools? Eh... looks like you're too busy to help me anyway. Nevermind.
string_id message = new string_id (c_stringFile, "s_faf1fbe4");
chat.chat (self, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (village_quharek_condition_wrong_phase (player, self))
{
//-- NPC: What's going on here? I'm all confused! I don't know what's going on!
string_id message = new string_id (c_stringFile, "s_e05cc4d4");
chat.chat (self, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (village_quharek_condition__defaultCondition (player, self))
{
//-- NPC: Master... I must find the master.
string_id message = new string_id (c_stringFile, "s_6a934b47");
chat.chat (self, message);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnStartNpcConversation were false.");
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnNpcConversationResponse (string conversationId, obj_id player, string_id response)
{
if (conversationId != "village_quharek")
return SCRIPT_CONTINUE;
int branchId = getIntObjVar (player, "conversation.village_quharek.branchId");
//-- [BRANCH NOTE]
//-- NPC: You there! Are you handy with a set of tools?
//-- [RESPONSE NOTE]
//-- PLAYER: Yes, I suppose I am.
if (branchId == 4 && response == "s_4beb938f")
{
//-- [NOTE]
if (village_quharek_condition__defaultCondition (player, self))
{
//-- NPC: Great. Our sensor array was damaged in the last attack on this village by the Sith Shadows. It needs to be repaired, but unfortunately, our chief engineer was also killed in the attack.
string_id message = new string_id (c_stringFile, "s_b2dd509a");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: You want me to take a look at the sensor array?
boolean hasResponse0 = false;
if (village_quharek_condition__defaultCondition (player, self))
{
++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_8abf86da");
setObjVar (player, "conversation.village_quharek.branchId", 5);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
removeObjVar (player, "conversation.village_quharek.branchId");
npcSpeak (player, message);
npcEndConversation (player);
}
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'You there! Are you handy with a set of tools?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: You there! Are you handy with a set of tools?
//-- [RESPONSE NOTE]
//-- PLAYER: Not really no.
if (branchId == 4 && response == "s_f474ed78")
{
//-- [NOTE]
if (village_quharek_condition__defaultCondition (player, self))
{
//-- NPC: Alright, well if you see someone who is... send 'em over.
string_id message = new string_id (c_stringFile, "s_5ec4a1e");
removeObjVar (player, "conversation.village_quharek.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'You there! Are you handy with a set of tools?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Great. Our sensor array was damaged in the last attack on this village by the Sith Shadows. It needs to be repaired, but unfortunately, our chief engineer was also killed in the attack.
//-- [RESPONSE NOTE]
//-- PLAYER: You want me to take a look at the sensor array?
if (branchId == 5 && response == "s_8abf86da")
{
//-- [NOTE]
if (village_quharek_condition__defaultCondition (player, self))
{
//-- NPC: That's it exactly. You catch on quick. If you will, take a look at the damage, see what needs to be repaired, and fix it up for us.
string_id message = new string_id (c_stringFile, "s_9cdcc110");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I think that I can handle that.
boolean hasResponse0 = false;
if (village_quharek_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: That doesn't sound like something that I can do.
boolean hasResponse1 = false;
if (village_quharek_condition__defaultCondition (player, self))
{
++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_9ae334e4");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_c9f1dbdc");
setObjVar (player, "conversation.village_quharek.branchId", 6);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
removeObjVar (player, "conversation.village_quharek.branchId");
npcSpeak (player, message);
npcEndConversation (player);
}
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Great. Our sensor array was damaged in the last attack on this village by the Sith Shadows. It needs to be repaired, but unfortunately, our chief engineer was also killed in the attack.' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: That's it exactly. You catch on quick. If you will, take a look at the damage, see what needs to be repaired, and fix it up for us.
//-- [RESPONSE NOTE]
//-- PLAYER: I think that I can handle that.
if (branchId == 6 && response == "s_9ae334e4")
{
//-- [NOTE]
if (village_quharek_condition__defaultCondition (player, self))
{
//-- NPC: Good show! If you help us out with this, I will help you learn to use the Force to enhance your assembly skills.
string_id message = new string_id (c_stringFile, "s_27808b0b");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes, I will go repair the sensor array.
boolean hasResponse0 = false;
if (village_quharek_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: On second thought, I don't think that I can help you.
boolean hasResponse1 = false;
if (village_quharek_condition__defaultCondition (player, self))
{
++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_8459377a");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_75cdc0ad");
setObjVar (player, "conversation.village_quharek.branchId", 7);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
removeObjVar (player, "conversation.village_quharek.branchId");
npcSpeak (player, message);
npcEndConversation (player);
}
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'That's it exactly. You catch on quick. If you will, take a look at the damage, see what needs to be repaired, and fix it up for us.' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: That's it exactly. You catch on quick. If you will, take a look at the damage, see what needs to be repaired, and fix it up for us.
//-- [RESPONSE NOTE]
//-- PLAYER: That doesn't sound like something that I can do.
if (branchId == 6 && response == "s_c9f1dbdc")
{
//-- [NOTE]
if (village_quharek_condition__defaultCondition (player, self))
{
//-- NPC: That's a shame. If you find someone who can... send 'em over.
string_id message = new string_id (c_stringFile, "s_8d878ba7");
removeObjVar (player, "conversation.village_quharek.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'That's it exactly. You catch on quick. If you will, take a look at the damage, see what needs to be repaired, and fix it up for us.' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Good show! If you help us out with this, I will help you learn to use the Force to enhance your assembly skills.
//-- [RESPONSE NOTE]
//-- PLAYER: Yes, I will go repair the sensor array.
if (branchId == 7 && response == "s_8459377a")
{
//-- [NOTE]
if (village_quharek_condition__defaultCondition (player, self))
{
//-- NPC: Of course you understand that this job will take a while, and if you agree to fix this thing, you won't be able to help anyone else with anything for a while, right?
string_id message = new string_id (c_stringFile, "s_e26f0607");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: That sounds fine to me.
boolean hasResponse0 = false;
if (village_quharek_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Oh, in that case I'd rather not do it.
boolean hasResponse1 = false;
if (village_quharek_condition__defaultCondition (player, self))
{
++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_ac061a6f");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_a4a9c8e0");
setObjVar (player, "conversation.village_quharek.branchId", 8);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
removeObjVar (player, "conversation.village_quharek.branchId");
npcSpeak (player, message);
npcEndConversation (player);
}
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Good show! If you help us out with this, I will help you learn to use the Force to enhance your assembly skills.' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Good show! If you help us out with this, I will help you learn to use the Force to enhance your assembly skills.
//-- [RESPONSE NOTE]
//-- PLAYER: On second thought, I don't think that I can help you.
if (branchId == 7 && response == "s_75cdc0ad")
{
//-- [NOTE]
if (village_quharek_condition__defaultCondition (player, self))
{
//-- NPC: That's a shame. If you find someone who can... send 'em over.
string_id message = new string_id (c_stringFile, "s_8d878ba7");
removeObjVar (player, "conversation.village_quharek.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Good show! If you help us out with this, I will help you learn to use the Force to enhance your assembly skills.' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Of course you understand that this job will take a while, and if you agree to fix this thing, you won't be able to help anyone else with anything for a while, right?
//-- [RESPONSE NOTE]
//-- PLAYER: That sounds fine to me.
if (branchId == 8 && response == "s_ac061a6f")
{
//-- [NOTE]
if (village_quharek_condition__defaultCondition (player, self))
{
village_quharek_action_phase1_activate (player, self);
//-- NPC: Good! You'd better get to work then. The sooner we get that thing back online, the better!
string_id message = new string_id (c_stringFile, "s_1b7f8e6d");
removeObjVar (player, "conversation.village_quharek.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Of course you understand that this job will take a while, and if you agree to fix this thing, you won't be able to help anyone else with anything for a while, right?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Of course you understand that this job will take a while, and if you agree to fix this thing, you won't be able to help anyone else with anything for a while, right?
//-- [RESPONSE NOTE]
//-- PLAYER: Oh, in that case I'd rather not do it.
if (branchId == 8 && response == "s_a4a9c8e0")
{
//-- [NOTE]
if (village_quharek_condition__defaultCondition (player, self))
{
//-- NPC: That's a shame. If you find someone who will... send 'em over.
string_id message = new string_id (c_stringFile, "s_52acc0");
removeObjVar (player, "conversation.village_quharek.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Of course you understand that this job will take a while, and if you agree to fix this thing, you won't be able to help anyone else with anything for a while, right?' were false.");
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
removeObjVar (player, "conversation.village_quharek.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================