mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-29 23:15:55 -04:00
246 lines
6.7 KiB
Plaintext
246 lines
6.7 KiB
Plaintext
/**
|
|
* Copyright (c) ©2003 Sony Online Entertainment Inc.
|
|
* All Rights Reserved
|
|
*
|
|
* Title: sarlacc.script
|
|
* Description: sarlacc
|
|
* @author $Author:$
|
|
* @version $Revision: #1 $
|
|
*/
|
|
|
|
//------------------------------------------------
|
|
// Includes
|
|
//------------------------------------------------
|
|
|
|
include library.utils;
|
|
include library.dot;
|
|
include library.buff;
|
|
|
|
//------------------------------------------------
|
|
// Constants
|
|
//------------------------------------------------
|
|
|
|
const string_id SID_EXTRACT_BILE = new string_id("mob/sarlacc", "extract_bile");
|
|
const string_id SID_BILE_FAIL = new string_id("mob/sarlacc", "bile_fail");
|
|
const string_id SID_BILE_SUCCESS = new string_id("mob/sarlacc", "bile_success");
|
|
const string_id SID_BILE_ALREADY = new string_id("mob/sarlacc", "bile_already");
|
|
const string_id SID_SARLACC_ERUPT = new string_id("mob/sarlacc", "sarlacc_erupt");
|
|
const string_id SID_SARLACC_POISON = new string_id("mob/sarlacc", "sarlacc_poison");
|
|
const string_id SID_SARLACC_DOT = new string_id("mob/sarlacc", "sarlacc_dot");
|
|
|
|
const string BILE_OBJECT = "object/tangible/loot/quest/quest_item_sarlacc_bile_jar.iff";
|
|
|
|
//------------------------------------------------
|
|
// OnInitialize
|
|
//------------------------------------------------
|
|
|
|
trigger OnInitialize()
|
|
{
|
|
if ( !hasTriggerVolume( self, "sarlaccBreach" ) )
|
|
createTriggerVolume( "sarlaccBreach", 30.f, true );
|
|
if ( !hasTriggerVolume( self, "sarlaccPreBreach" ) )
|
|
createTriggerVolume( "sarlaccPreBreach", 60.f, true );
|
|
|
|
messageTo( self, "poisonArea", null, 300, false );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// OnAttach
|
|
//------------------------------------------------
|
|
/*
|
|
trigger OnAttach()
|
|
{
|
|
if ( !hasTriggerVolume( self, "sarlaccBreach" ) )
|
|
createTriggerVolume( "sarlaccBreach", 30.f, true );
|
|
if ( !hasTriggerVolume( self, "sarlaccPreBreach" ) )
|
|
createTriggerVolume( "sarlaccPreBreach", 60.f, true );
|
|
|
|
messageTo( self, "poisonArea", null, 300, false );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
*/
|
|
//------------------------------------------------
|
|
// OnTriggerVolumeEntered
|
|
//------------------------------------------------
|
|
|
|
trigger OnTriggerVolumeEntered( string volumeName, obj_id whoTriggeredMe )
|
|
{
|
|
if ( volumeName == "sarlaccBreach" )
|
|
{
|
|
// Only players.
|
|
if ( !isPlayer( whoTriggeredMe ) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
// Play the effect.
|
|
if ( !utils.hasScriptVar( self, "bile.eject" ) )
|
|
{
|
|
playClientEffectLoc( whoTriggeredMe, "clienteffect/cr_sarlacc_erupt.cef", getLocation(self), 3f );
|
|
|
|
// Send a message to players in the radius. "The sarlacc has erupted!"
|
|
obj_id[] contents = getTriggerVolumeContents( self, "sarlaccBreach" );
|
|
if ( contents != null )
|
|
{
|
|
for ( int i=0; i<contents.length; i++ )
|
|
{
|
|
if ( isPlayer( contents[i] ) )
|
|
sendSystemMessage( contents[i], SID_SARLACC_ERUPT );
|
|
}
|
|
}
|
|
}
|
|
|
|
// Don't play the effect again for 10 seconds.
|
|
utils.setScriptVar( self, "bile.eject", 1 );
|
|
messageTo( self, "resetBileEject", null, 10.f, false );
|
|
|
|
// Coveralls. Treated Protective Coveralls to be exact.
|
|
int diseaseResist = getEnhancedSkillStatisticModifierUncapped(whoTriggeredMe, "resistance_disease");
|
|
|
|
if(diseaseResist < 24)
|
|
{
|
|
if(buff.applyBuff(whoTriggeredMe, "sarlaccSnare", 300) );
|
|
{
|
|
sendSystemMessage( whoTriggeredMe, SID_SARLACC_DOT );
|
|
}
|
|
}
|
|
}
|
|
else if ( volumeName == "sarlaccPreBreach" )
|
|
{
|
|
// Only players.
|
|
if ( !isPlayer( whoTriggeredMe ) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
// Send them a message.
|
|
sendSystemMessage( whoTriggeredMe, SID_SARLACC_POISON );
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// resetBileEject
|
|
//------------------------------------------------
|
|
|
|
messageHandler resetBileEject()
|
|
{
|
|
utils.removeScriptVar( self, "bile.eject" );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// poisonArea
|
|
//------------------------------------------------
|
|
|
|
messageHandler poisonArea()
|
|
{
|
|
// Check for players in our radius.
|
|
int playerHint = 0;
|
|
if ( !utils.hasScriptVar( self, "bile.eject" ) )
|
|
{
|
|
int bile = 0;
|
|
obj_id[] contents = getTriggerVolumeContents( self, "sarlaccBreach" );
|
|
if ( contents != null )
|
|
{
|
|
for ( int i=0; i<contents.length; i++ )
|
|
{
|
|
if ( isPlayer( contents[i] ) )
|
|
{
|
|
playerHint = 1;
|
|
if ( bile == 0 )
|
|
{
|
|
bile = 1;
|
|
playClientEffectLoc( contents[i], "clienteffect/cr_sarlacc_erupt.cef", getLocation(self), 3f );
|
|
}
|
|
// Coveralls. Treated Protective Coveralls to be exact.
|
|
int diseaseResist = getEnhancedSkillStatisticModifierUncapped(contents[i], "resistance_disease");
|
|
|
|
if(diseaseResist < 24)
|
|
{
|
|
if(buff.applyBuff(contents[i], "sarlaccSnare", 300) );
|
|
{
|
|
sendSystemMessage( contents[i], SID_SARLACC_DOT );
|
|
}
|
|
}
|
|
sendSystemMessage( contents[i], SID_SARLACC_ERUPT );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( playerHint == 1 )
|
|
messageTo( self, "poisonArea", null, 60+rand(60), false );
|
|
else
|
|
messageTo( self, "poisonArea", null, 120, false );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// OnObjectMenuRequest
|
|
//------------------------------------------------
|
|
|
|
trigger OnObjectMenuRequest( obj_id player, menu_info mi )
|
|
{
|
|
mi.addRootMenu( menu_info_types.SERVER_MENU1, SID_EXTRACT_BILE );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// OnObjectMenuSelect
|
|
//------------------------------------------------
|
|
|
|
trigger OnObjectMenuSelect( obj_id player, int item )
|
|
{
|
|
// Player wants to extract bile.
|
|
if ( item == menu_info_types.SERVER_MENU1 )
|
|
{
|
|
// Check to see if the player already has some bile.
|
|
obj_id[] items = getInventoryAndEquipment( player );
|
|
if ( items != null )
|
|
{
|
|
for ( int i=0; i<items.length; i++ )
|
|
{
|
|
if ( getTemplateName( items[i] ).compareTo( BILE_OBJECT ) == 0 )
|
|
{
|
|
sendSystemMessage( player, SID_BILE_ALREADY );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Check to see if bile can be extracted.
|
|
if ( utils.hasScriptVar( self, "bile.taken" ) )
|
|
{
|
|
// Bile was recently taken.
|
|
sendSystemMessage( player, SID_BILE_FAIL );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// Allow the player to take some bile.
|
|
sendSystemMessage( player, SID_BILE_SUCCESS );
|
|
obj_id pInv = utils.getInventoryContainer( player );
|
|
if ( isIdValid( pInv ) )
|
|
createObject( BILE_OBJECT, pInv, "" );
|
|
|
|
// Set us up so that more bile can't be taken for 2 minutes.
|
|
utils.setScriptVar( self, "bile.taken", 1 );
|
|
messageTo( self, "resetBile", null, 300, false );
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// resetBile
|
|
//------------------------------------------------
|
|
|
|
messageHandler resetBile()
|
|
{
|
|
utils.removeScriptVar( self, "bile.taken" );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
} |