mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
168 lines
4.9 KiB
Plaintext
168 lines
4.9 KiB
Plaintext
include library.utils;
|
|
include library.ai_lib;
|
|
include library.chat;
|
|
include ai.ai_combat;
|
|
include library.badge;
|
|
include library.prose;
|
|
|
|
const string CONVO_FILE = "theme_park/warren/warren";
|
|
const string SYSTEM_MESSAGES = "theme_park/warren/warren_system_messages";
|
|
const string PASSKEYCODE = "object/tangible/mission/quest_item/warren_passkey_s01.iff";
|
|
|
|
trigger OnAttach()
|
|
{
|
|
setCondition( self, CONDITION_CONVERSABLE );
|
|
|
|
setName( self, "" );
|
|
setName( self, new string_id ( "theme_park/warren/warren_system_messages", "name_mirla" ));
|
|
setInvulnerable( self, true );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
int mnu = mi.addRootMenu (menu_info_types.CONVERSE_START, null);
|
|
menu_info_data mdata = mi.getMenuItemById(mnu);
|
|
mdata.setServerNotify(false);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnStartNpcConversation (obj_id speaker)
|
|
{
|
|
if ( ai_lib.isInCombat( self ) || ai_lib.isInCombat( speaker ) || ai_lib.aiIsDead( self ) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.setChatMood( self, chat.MOOD_SCARED );
|
|
|
|
//already did this:
|
|
if ( badge.hasBadge( speaker, "warren_compassion" ) )
|
|
{
|
|
//if you have taken down teraud:
|
|
if ( badge.hasBadge( speaker, "warren_hero" ) )
|
|
chat.chat( self, new string_id( CONVO_FILE, "mirla_done" ) );//You're a peach!
|
|
else
|
|
chat.chat( self, new string_id( CONVO_FILE, "mirla_get_teraud" ) );//Collect evidence against Teraud!
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
faceToBehavior( self, speaker );
|
|
string_id greeting = new string_id (CONVO_FILE, "mirla_start");//What?
|
|
string_id response[] = new string_id [1];
|
|
response[0] = new string_id (CONVO_FILE, "mirla_reply_1");//What's wrong?
|
|
npcStartConversation (speaker, self, CONVO_FILE, greeting, response);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnNpcConversationResponse(string convo, obj_id player, string_id response)
|
|
{
|
|
if ( !convo.equals( CONVO_FILE ) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
npcRemoveConversationResponse(player, response );
|
|
|
|
if ( response.getAsciiId().equals("mirla_reply_1"))//What's wrong?
|
|
{
|
|
string_id message = new string_id (CONVO_FILE, "mirla_1");//the warren
|
|
npcSpeak( player, message );
|
|
if ( hasLetter( player ) )
|
|
npcAddConversationResponse( player, new string_id( CONVO_FILE, "mirla_1_reply_1" ));//I have some bad news
|
|
|
|
npcAddConversationResponse( player, new string_id( CONVO_FILE, "mirla_1_reply_2" ));//I'm sure he's fine
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if ( response.getAsciiId().equals("mirla_1_reply_1"))//Bad news
|
|
{
|
|
string_id message = new string_id (CONVO_FILE, "mirla_2");//Waaaaah
|
|
npcSpeak( player, message );
|
|
if ( takeLetter( player ) )
|
|
badge.grantBadge(player, "warren_compassion");
|
|
|
|
npcAddConversationResponse( player, new string_id( CONVO_FILE, "mirla_2_reply_1" ));//I will
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if ( response.getAsciiId().equals("mirla_1_reply_2"))//I'm sure he's fine
|
|
{
|
|
string_id message = new string_id (CONVO_FILE, "mirla_3");//I've got a bad feeling about this, piss off
|
|
npcSpeak( player, message );
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if ( response.getAsciiId().equals("mirla_2_reply_1"))//I will
|
|
{
|
|
string_id message = new string_id (CONVO_FILE, "mirla_4");//You'll need a password
|
|
npcSpeak( player, message );
|
|
npcAddConversationResponse( player, new string_id( CONVO_FILE, "mirla_4_reply_1" ));//What is it?
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if ( response.getAsciiId().equals("mirla_4_reply_1"))//What is it?
|
|
{
|
|
prose_package pp = prose.getPackage( new string_id( SYSTEM_MESSAGES, "mirla_password" ), getCellPassword( self ));
|
|
npcSpeak( player, pp );
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnIncapacitated( obj_id killer )
|
|
{
|
|
obj_id warren = getObjIdObjVar( self, "warren.bldg" );
|
|
messageTo( warren, "handleMirlaDied", null, 5, false );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
boolean hasLetter( obj_id player )
|
|
{
|
|
//debugSpeakMsg( player, "being checked");
|
|
obj_id pInv = utils.getInventoryContainer( player );
|
|
obj_id[] contents = getContents( pInv );
|
|
if ( contents == null )
|
|
{
|
|
//debugSpeakMsg( player, "no inventory" );
|
|
return false;
|
|
}
|
|
|
|
for ( int i = 0; i < contents.length; i++ )
|
|
{
|
|
if ( getTemplateName( contents[i] ).equals( "object/tangible/mission/quest_item/warren_farewell_letter.iff" ))
|
|
{
|
|
return true;
|
|
}
|
|
//debugSpeakMsg( player, getTemplateName( contents[i] ));
|
|
}
|
|
return false;
|
|
}
|
|
|
|
boolean takeLetter( obj_id player )
|
|
{
|
|
obj_id pInv = utils.getInventoryContainer( player );
|
|
obj_id[] contents = getContents( pInv );
|
|
if ( contents == null )
|
|
{
|
|
//debugSpeakMsg( player, "you got nothing" );
|
|
return false;
|
|
}
|
|
|
|
for ( int i = 0; i < contents.length; i++ )
|
|
{
|
|
if ( getTemplateName( contents[i] ).equals( "object/tangible/mission/quest_item/warren_farewell_letter.iff" ) )
|
|
{
|
|
destroyObject( contents[i] );
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
string getCellPassword( obj_id npc )
|
|
{
|
|
obj_id bldg = getTopMostContainer( npc );
|
|
return getStringObjVar( bldg, "warren.cellPassword" );
|
|
}
|
|
|