mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
419 lines
12 KiB
Plaintext
419 lines
12 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// npe_brawler_officer.script
|
|
// Copyright 2004, Sony Online Entertainment
|
|
// All Rights Reserved.
|
|
//
|
|
// Created with SwgConversationEditor 1.35 - 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/npe_brawler_officer";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean npe_brawler_officer_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_brawler_officer_condition_isTaskActiveStory3 (obj_id player, obj_id npc)
|
|
{
|
|
return (groundquests.hasCompletedTask(player, "npe_brawler_3", "signal") &&
|
|
!groundquests.hasCompletedQuest(player, "npe_brawler_3"));
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_brawler_officer_condition_isTaskActiveBoxes (obj_id player, obj_id npc)
|
|
{
|
|
return (groundquests.hasCompletedTask(player, "npe_brawler_3", "boxes") &&
|
|
!groundquests.hasCompletedQuest(player, "npe_brawler_3"));
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_brawler_officer_condition_hasCompletedTaskBoxes (obj_id player, obj_id npc)
|
|
{
|
|
return (groundquests.hasCompletedTask(player, "npe_brawler_3", "boxes") &&
|
|
!groundquests.hasCompletedQuest(player, "npe_brawler_3"));
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean npe_brawler_officer_condition_hasCompletedBoxes (obj_id player, obj_id npc)
|
|
{
|
|
return groundquests.hasCompletedQuest(player, "npe_brawler_3");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void npe_brawler_officer_action_giveSignalBoxes (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "signal");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void npe_brawler_officer_action_giveSignalReward (obj_id player, obj_id npc)
|
|
{
|
|
groundquests.sendSignal(player, "officerreward");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int npe_brawler_officer_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Ah, finally. Thanks for helping gather the supplies. I know it wasn't easy. Here, take this. I hope you find it useful in your adventures.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Thank you.
|
|
if (response == "s_12")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_brawler_officer_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_brawler_officer_action_giveSignalReward (player, npc);
|
|
|
|
//-- NPC: No problem. I'll be sure to let Rydel know of your good deed.
|
|
string_id message = new string_id (c_stringFile, "s_13");
|
|
utils.removeScriptVar (player, "conversation.npe_brawler_officer.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_brawler_officer_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Are you here to help us with the supplies?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes. I'm Rydel's student.
|
|
if (response == "s_16")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_brawler_officer_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Ah, yes. Good ol' Rydel. Well, glad you're here. Get in there, and get those supplies back. We need them!
|
|
string_id message = new string_id (c_stringFile, "s_18");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I'm on it!
|
|
boolean hasResponse0 = false;
|
|
if (npe_brawler_officer_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_20");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_brawler_officer.branchId", 6);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar (player, "conversation.npe_brawler_officer.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int npe_brawler_officer_handleBranch6 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Ah, yes. Good ol' Rydel. Well, glad you're here. Get in there, and get those supplies back. We need them!
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'm on it!
|
|
if (response == "s_20")
|
|
{
|
|
//-- [NOTE]
|
|
if (npe_brawler_officer_condition__defaultCondition (player, npc))
|
|
{
|
|
npe_brawler_officer_action_giveSignalBoxes (player, npc);
|
|
|
|
//-- NPC: Good. You there! Get back to work!
|
|
string_id message = new string_id (c_stringFile, "s_22");
|
|
utils.removeScriptVar (player, "conversation.npe_brawler_officer.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.npe_brawler_officer");
|
|
setInvulnerable( self, true );
|
|
setName( self, "Officer Dreryn");
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
setInvulnerable( self, true );
|
|
setName( self, "Officer Dreryn");
|
|
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.npe_brawler_officer");
|
|
|
|
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 (npe_brawler_officer_condition_hasCompletedBoxes (player, npc))
|
|
{
|
|
//-- NPC: We're still good here. We don't need any of your heroics today.
|
|
string_id message = new string_id (c_stringFile, "s_11");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_brawler_officer_condition_hasCompletedTaskBoxes (player, npc))
|
|
{
|
|
//-- NPC: Ah, finally. Thanks for helping gather the supplies. I know it wasn't easy. Here, take this. I hope you find it useful in your adventures.
|
|
string_id message = new string_id (c_stringFile, "s_10");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Thank you.
|
|
boolean hasResponse0 = false;
|
|
if (npe_brawler_officer_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_12");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_brawler_officer.branchId", 2);
|
|
|
|
npcStartConversation (player, npc, "npe_brawler_officer", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_brawler_officer_condition_isTaskActiveBoxes (player, npc))
|
|
{
|
|
//-- NPC: Look, we need those supplies as soon as possible! Get going!
|
|
string_id message = new string_id (c_stringFile, "s_9");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_brawler_officer_condition_isTaskActiveStory3 (player, npc))
|
|
{
|
|
//-- NPC: Are you here to help us with the supplies?
|
|
string_id message = new string_id (c_stringFile, "s_14");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes. I'm Rydel's student.
|
|
boolean hasResponse0 = false;
|
|
if (npe_brawler_officer_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_16");
|
|
|
|
utils.setScriptVar (player, "conversation.npe_brawler_officer.branchId", 5);
|
|
|
|
npcStartConversation (player, npc, "npe_brawler_officer", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (npe_brawler_officer_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "nod");
|
|
|
|
//-- NPC: Citizen, move along. We're transferring precious cargo here. Nothing to be concerned about.
|
|
string_id message = new string_id (c_stringFile, "s_24");
|
|
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 != "npe_brawler_officer")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.npe_brawler_officer.branchId");
|
|
|
|
if (branchId == 2 && npe_brawler_officer_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && npe_brawler_officer_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 6 && npe_brawler_officer_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.npe_brawler_officer.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|