mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
593 lines
16 KiB
Plaintext
593 lines
16 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// jabba.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.groundquests;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/jabba";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean jabba_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean jabba_condition_finishedBibsQuest (obj_id player, obj_id npc)
|
|
{
|
|
if (groundquests.hasCompletedQuest (player, "quest/jabba_bib_fortuna_v2") || getIntObjVar (player, "theme_park_jabba") > 14)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean jabba_condition_killingDelrice (obj_id player, obj_id npc)
|
|
{
|
|
if (groundquests.isTaskActive (player, "quest/jabba_the_hutt_v2", "killDelriceCapreese"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean jabba_condition_killingTyrok (obj_id player, obj_id npc)
|
|
{
|
|
if (groundquests.isTaskActive (player, "quest/jabba_the_hutt_v2", "killTyrok"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean jabba_condition_killingAssaultTeam (obj_id player, obj_id npc)
|
|
{
|
|
if (groundquests.isTaskActive (player, "quest/jabba_the_hutt_v2", "ValarianAssaultTeam"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean jabba_condition_returningToJabba (obj_id player, obj_id npc)
|
|
{
|
|
if (groundquests.isTaskActive (player, "quest/jabba_the_hutt_v2", "returnToJabba"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean jabba_condition_finishedJabbasQuest (obj_id player, obj_id npc)
|
|
{
|
|
if (groundquests.hasCompletedQuest (player, "quest/jabba_the_hutt_v2"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean jabba_condition_onHeadStartJabba (obj_id player, obj_id npc)
|
|
{
|
|
|
|
int questId1 = questGetQuestId("quest/legacy_head_start");
|
|
int ground = groundquests.getTaskId(questId1, "legacy_head_start_e1");
|
|
|
|
|
|
boolean onTask = (questIsTaskActive(questId1, ground, player));
|
|
|
|
return onTask;
|
|
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void jabba_action_grantJabbasQuest (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.grantQuest (player, "quest/jabba_the_hutt_v2");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void jabba_action_sendCompletedJabbaSignal (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "finishedKilling");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void jabba_action_grantEV9D9 (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "legacy_head_start_launch_e11");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void jabba_action_clearPointer (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "found_jabba");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int jabba_handleBranch1 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Good to see you again. Perhaps we can work together again in the future.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I need to ask of some droid parts that you purchased from Watto.
|
|
if (response == "s_37")
|
|
{
|
|
//-- [NOTE]
|
|
if (jabba_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Ah yes. EV-9D9 wanted it for her research.
|
|
string_id message = new string_id (c_stringFile, "s_38");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: May I talk to this servant of yours?
|
|
boolean hasResponse0 = false;
|
|
if (jabba_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_39");
|
|
|
|
utils.setScriptVar (player, "conversation.jabba.branchId", 2);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.jabba.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int jabba_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Ah yes. EV-9D9 wanted it for her research.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: May I talk to this servant of yours?
|
|
if (response == "s_39")
|
|
{
|
|
//-- [NOTE]
|
|
if (jabba_condition__defaultCondition (player, npc))
|
|
{
|
|
jabba_action_grantEV9D9 (player, npc);
|
|
|
|
//-- NPC: Yes, you have my leave to do so.
|
|
string_id message = new string_id (c_stringFile, "s_40");
|
|
utils.removeScriptVar (player, "conversation.jabba.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int jabba_handleBranch8 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I knew you were my kind of scum. Are you prepared to go back to work?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Ready and willing.
|
|
if (response == "s_28")
|
|
{
|
|
//-- [NOTE]
|
|
if (jabba_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Good. Valarian has been frothing at the mouth for revenge, due to your past work. Let's keep her anger rising.
|
|
string_id message = new string_id (c_stringFile, "s_30");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Tell me what to do, mighty Jabba.
|
|
boolean hasResponse0 = false;
|
|
if (jabba_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_32");
|
|
|
|
utils.setScriptVar (player, "conversation.jabba.branchId", 9);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.jabba.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I need some time to myself.
|
|
if (response == "s_36")
|
|
{
|
|
//-- [NOTE]
|
|
if (jabba_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Then go, get out of my sight before I think of something to do to you.
|
|
string_id message = new string_id (c_stringFile, "s_42");
|
|
utils.removeScriptVar (player, "conversation.jabba.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int jabba_handleBranch9 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Good. Valarian has been frothing at the mouth for revenge, due to your past work. Let's keep her anger rising.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Tell me what to do, mighty Jabba.
|
|
if (response == "s_32")
|
|
{
|
|
//-- [NOTE]
|
|
if (jabba_condition__defaultCondition (player, npc))
|
|
{
|
|
jabba_action_grantJabbasQuest (player, npc);
|
|
|
|
//-- NPC: Valarian has been bringing in off-world specialists to try to compete with my organization. The first is a spice trading specialist named Delrice Capreese. Eliminate this specialist.
|
|
string_id message = new string_id (c_stringFile, "s_34");
|
|
utils.removeScriptVar (player, "conversation.jabba.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.jabba");
|
|
|
|
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.jabba");
|
|
|
|
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 (jabba_condition_finishedJabbasQuest (player, npc))
|
|
{
|
|
//-- NPC: Good to see you again. Perhaps we can work together again in the future.
|
|
string_id message = new string_id (c_stringFile, "s_4");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I need to ask of some droid parts that you purchased from Watto.
|
|
boolean hasResponse0 = false;
|
|
if (jabba_condition_onHeadStartJabba (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_37");
|
|
|
|
utils.setScriptVar (player, "conversation.jabba.branchId", 1);
|
|
|
|
npcStartConversation (player, npc, "jabba", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (jabba_condition_returningToJabba (player, npc))
|
|
{
|
|
jabba_action_sendCompletedJabbaSignal (player, npc);
|
|
|
|
//-- NPC: Ah, I see you've returned, just like I asked. I hope that we can work together again in the future. For now, avail yourself of my hospitality, but watch yourself. There are no second chances around here.
|
|
string_id message = new string_id (c_stringFile, "s_10");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (jabba_condition_killingAssaultTeam (player, npc))
|
|
{
|
|
//-- NPC: Why are you here talking to me? Infiltrate Valarian's command bunker and eliminate her hired goons.
|
|
string_id message = new string_id (c_stringFile, "s_45");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (jabba_condition_killingTyrok (player, npc))
|
|
{
|
|
//-- NPC: Why does Valarian's brute still draw breath?
|
|
string_id message = new string_id (c_stringFile, "s_22");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (jabba_condition_killingDelrice (player, npc))
|
|
{
|
|
//-- NPC: Has Valarian's spice fiend been eliminated? Why not?
|
|
string_id message = new string_id (c_stringFile, "s_24");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (jabba_condition_finishedBibsQuest (player, npc))
|
|
{
|
|
jabba_action_clearPointer (player, npc);
|
|
|
|
//-- NPC: I knew you were my kind of scum. Are you prepared to go back to work?
|
|
string_id message = new string_id (c_stringFile, "s_26");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Ready and willing.
|
|
boolean hasResponse0 = false;
|
|
if (jabba_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I need some time to myself.
|
|
boolean hasResponse1 = false;
|
|
if (jabba_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_36");
|
|
|
|
utils.setScriptVar (player, "conversation.jabba.branchId", 8);
|
|
|
|
npcStartConversation (player, npc, "jabba", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (jabba_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Don't bother me with your petty problems, or I'll let the Rancor deal with you, personally.
|
|
string_id message = new string_id (c_stringFile, "s_44");
|
|
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 != "jabba")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.jabba.branchId");
|
|
|
|
if (branchId == 1 && jabba_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 2 && jabba_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 8 && jabba_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 9 && jabba_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.jabba.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|