mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-10-17 08:02:55 -04:00
638 lines
19 KiB
Plaintext
638 lines
19 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// padawan_politician_01.script
|
|
// Copyright 2004, Sony Online Entertainment
|
|
// All Rights Reserved.
|
|
//
|
|
// Created with SwgConversationEditor 1.34 - DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.chat;
|
|
include library.jedi_trials;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/padawan_politician_01";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean padawan_politician_01_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean padawan_politician_01_condition_acceptedQuest (obj_id player, obj_id npc)
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if ( player == trialPlayer )
|
|
{
|
|
return hasObjVar(player, "jedi_trials.padawan_trials.temp.acceptedTask");
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean padawan_politician_01_condition_isTrialPlayer (obj_id player, obj_id npc)
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if ( player == trialPlayer )
|
|
{
|
|
string trialName = jedi_trials.getJediTrialName(player);
|
|
|
|
if ( trialName != null && trialName.equals("politician") )
|
|
{
|
|
return !hasObjVar(npc, "padawan_trials.playerFailed");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean padawan_politician_01_condition_targetWasEliminated (obj_id player, obj_id npc)
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if ( player == trialPlayer )
|
|
{
|
|
return hasObjVar(player, "jedi_trials.padawan_trials.temp.killedTarget");
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean padawan_politician_01_condition_completedSuccess (obj_id player, obj_id npc)
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if ( player == trialPlayer )
|
|
{
|
|
string trialName = jedi_trials.getJediTrialName(player);
|
|
|
|
if ( trialName != null && !trialName.equals("politician") )
|
|
{
|
|
return hasObjVar(npc, "padawan_trials.playerSucceeded");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void padawan_politician_01_action_questFailure (obj_id player, obj_id npc)
|
|
{
|
|
setObjVar(npc, "padawan_trials.playerFailed", true);
|
|
|
|
messageTo(player, "handleQuestFailure", null, 1, false);
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void padawan_politician_01_action_questSuccess (obj_id player, obj_id npc)
|
|
{
|
|
setObjVar(npc, "padawan_trials.playerSucceeded", true);
|
|
|
|
messageTo(player, "handleTrialComplete", null, 1, false);
|
|
return;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void padawan_politician_01_action_sendToNextNpc (obj_id player, obj_id npc)
|
|
{
|
|
setObjVar(npc, "padawan_trials.playerAccepted", true);
|
|
setObjVar(player, "jedi_trials.padawan_trials.temp.acceptedTask", true);
|
|
messageTo(player, "handleSetSecondLoc", null, 1, false);
|
|
return;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int padawan_politician_01_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE] After player has destroyed the 'Bandit Camp'.
|
|
//-- NPC: Has the bloodseeker mite been taken care of?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes, it has.
|
|
if (response == "s_dc3b8fc5")
|
|
{
|
|
//-- [NOTE] Quest complete.
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "applause_polite");
|
|
|
|
padawan_politician_01_action_questSuccess (player, npc);
|
|
|
|
//-- NPC: Excellent, thank you for your services friend.
|
|
string_id message = new string_id (c_stringFile, "s_4fc89968");
|
|
utils.removeScriptVar (player, "conversation.padawan_politician_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int padawan_politician_01_handleBranch4 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE] If player returns before taking care of the bandits.
|
|
//-- NPC: That was quick... did you make the countryside a safer place?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Not yet, but believe me they will.
|
|
if (response == "s_d30e03d9")
|
|
{
|
|
//-- [NOTE]
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "nod_head_multiple");
|
|
|
|
//-- NPC: Excellent. Such enthusiasm in one's work is always a pleasure to behold.
|
|
string_id message = new string_id (c_stringFile, "s_e6b7fdc0");
|
|
utils.removeScriptVar (player, "conversation.padawan_politician_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I decided to make myself a safer place. Go deal with it yourself.
|
|
if (response == "s_99bdf01")
|
|
{
|
|
//-- [NOTE]
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "shake_head_no");
|
|
|
|
padawan_politician_01_action_questFailure (player, npc);
|
|
|
|
//-- NPC: That's a real shame.
|
|
string_id message = new string_id (c_stringFile, "s_59b59b84");
|
|
utils.removeScriptVar (player, "conversation.padawan_politician_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int padawan_politician_01_handleBranch7 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Hello there, you are a perfect match for a quick and dirty job I need done to help the citizens of this fair city.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What kind of quick and dirty job are we talking about?
|
|
if (response == "s_60ba5013")
|
|
{
|
|
//-- [NOTE]
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "explain");
|
|
|
|
//-- NPC: As folks in these parts know, more than our fair share of predators roam the area outside of the city limits. What I need you to do my bright eyed adventuring friend is head out into this untamed region and destroy a bloodseeker mite that has been causing no end of trouble.
|
|
string_id message = new string_id (c_stringFile, "s_10204c5e");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Of course. Give me the location, and consider it done.
|
|
boolean hasResponse0 = false;
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Fight your own battles. And find someone who cares.
|
|
boolean hasResponse1 = false;
|
|
if (padawan_politician_01_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_6299309e");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_de8ec7cf");
|
|
|
|
utils.setScriptVar (player, "conversation.padawan_politician_01.branchId", 8);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.padawan_politician_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Keep your problems to yourself. What makes you think I'd care.
|
|
if (response == "s_82367ff2")
|
|
{
|
|
//-- [NOTE]
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "shake_head_no");
|
|
|
|
padawan_politician_01_action_questFailure (player, npc);
|
|
|
|
//-- NPC: That's a real shame.
|
|
string_id message = new string_id (c_stringFile, "s_c61129a3");
|
|
utils.removeScriptVar (player, "conversation.padawan_politician_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int padawan_politician_01_handleBranch8 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: As folks in these parts know, more than our fair share of predators roam the area outside of the city limits. What I need you to do my bright eyed adventuring friend is head out into this untamed region and destroy a bloodseeker mite that has been causing no end of trouble.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Of course. Give me the location, and consider it done.
|
|
if (response == "s_6299309e")
|
|
{
|
|
//-- [NOTE]
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "nod_head_multiple");
|
|
|
|
padawan_politician_01_action_sendToNextNpc (player, npc);
|
|
|
|
//-- NPC: Ahh, just as stup.. err. brave as I suspected.
|
|
string_id message = new string_id (c_stringFile, "s_e01d17e1");
|
|
utils.removeScriptVar (player, "conversation.padawan_politician_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Fight your own battles. And find someone who cares.
|
|
if (response == "s_de8ec7cf")
|
|
{
|
|
//-- [NOTE]
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "shake_head_no");
|
|
|
|
padawan_politician_01_action_questFailure (player, npc);
|
|
|
|
//-- NPC: That's a real shame.
|
|
string_id message = new string_id (c_stringFile, "s_18");
|
|
utils.removeScriptVar (player, "conversation.padawan_politician_01.branchId");
|
|
|
|
chat.chat (npc, player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.padawan_politician_01");
|
|
|
|
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.padawan_politician_01");
|
|
|
|
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 (padawan_politician_01_condition_completedSuccess (player, npc))
|
|
{
|
|
doAnimationAction (npc, "pose_proudly");
|
|
|
|
//-- NPC: Ah good. My election into office is almost certainly assured once I take credit for... er... I mean, let the people know about the service you've provided.
|
|
string_id message = new string_id (c_stringFile, "s_dbf5765a");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE] After player has destroyed the 'Bandit Camp'.
|
|
if (padawan_politician_01_condition_targetWasEliminated (player, npc))
|
|
{
|
|
//-- NPC: Has the bloodseeker mite been taken care of?
|
|
string_id message = new string_id (c_stringFile, "s_59b6aab3");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes, it has.
|
|
boolean hasResponse0 = false;
|
|
if (padawan_politician_01_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_dc3b8fc5");
|
|
|
|
utils.setScriptVar (player, "conversation.padawan_politician_01.branchId", 2);
|
|
|
|
npcStartConversation (player, npc, "padawan_politician_01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE] If player returns before taking care of the bandits.
|
|
if (padawan_politician_01_condition_acceptedQuest (player, npc))
|
|
{
|
|
//-- NPC: That was quick... did you make the countryside a safer place?
|
|
string_id message = new string_id (c_stringFile, "s_4eb51131");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Not yet, but believe me they will.
|
|
boolean hasResponse0 = false;
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I decided to make myself a safer place. Go deal with it yourself.
|
|
boolean hasResponse1 = false;
|
|
if (padawan_politician_01_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_d30e03d9");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_99bdf01");
|
|
|
|
utils.setScriptVar (player, "conversation.padawan_politician_01.branchId", 4);
|
|
|
|
npcStartConversation (player, npc, "padawan_politician_01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (padawan_politician_01_condition_isTrialPlayer (player, npc))
|
|
{
|
|
doAnimationAction (npc, "wave1");
|
|
|
|
//-- NPC: Hello there, you are a perfect match for a quick and dirty job I need done to help the citizens of this fair city.
|
|
string_id message = new string_id (c_stringFile, "s_e16a4410");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What kind of quick and dirty job are we talking about?
|
|
boolean hasResponse0 = false;
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Keep your problems to yourself. What makes you think I'd care.
|
|
boolean hasResponse1 = false;
|
|
if (padawan_politician_01_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_60ba5013");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_82367ff2");
|
|
|
|
utils.setScriptVar (player, "conversation.padawan_politician_01.branchId", 7);
|
|
|
|
npcStartConversation (player, npc, "padawan_politician_01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (padawan_politician_01_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Greetings and be welcome. Remember my motto: voting once is nice; voting often is better.
|
|
string_id message = new string_id (c_stringFile, "s_badba8f2");
|
|
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 != "padawan_politician_01")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.padawan_politician_01.branchId");
|
|
|
|
if (branchId == 2 && padawan_politician_01_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 4 && padawan_politician_01_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 7 && padawan_politician_01_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 8 && padawan_politician_01_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.padawan_politician_01.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|