Files
dsrc/sku.0/sys.server/compiled/game/script/player/species_innate.script
T
2013-09-10 23:17:15 -07:00

304 lines
7.7 KiB
Plaintext

/**
* Copyright (c)2000-2002 Sony Online Entertainment Inc.
* All Rights Reserved
*
* Title: alarm_clock.script
* Description: Allows the player to set a messaged alarm at a given time interval.
* @author Ben Hanson
* @version $Revision:$
*/
/***** INCLUDES ********************************************************/
include library.innate;
include library.cmd;
include library.prose;
/***** CONSTANTS *******************************************************/
const string SCRIPT_ME = "player.species_innate";
const string_id SID_NONE = new string_id("innate", "none");
const string_id SID_VALID_INNATE_PARAMS = new string_id("innate", "valid_innate_params");
const string_id SID_NOT_VALID_PARAM_INNATE = new string_id("innate", "not_valid_param_innate");
const string_id SID_INNATE_ABILITY_FAILED = new string_id("innate", "innate_ability_failed");
/***** TRIGGERS ********************************************************/
trigger OnInitialize()
{
if ( hasObjVar(self, innate.VAR_INNATE_BASE) )
{
obj_var_list ovl = getObjVarList(self, innate.VAR_INNATE_BASE);
if ( ovl != null )
{
int now = getGameTime();
int maxStamp = now + (2*innate.ONE_HOUR);
int numItems = ovl.getNumItems();
for ( int i = 0; i < numItems; i++ )
{
obj_var ov = ovl.getObjVar(i);
if ( ov.getIntData() > maxStamp )
setObjVar(self, innate.VAR_INNATE_BASE + "." + ov.getName(), now-innate.ONE_HOUR);
}
}
}
return SCRIPT_CONTINUE;
}
trigger OnAttach()
{
int species = getSpecies(self);
switch ( species )
{
case SPECIES_BOTHAN:
grantSkill(self, "species_bothan");
grantSkill(self, "social_language_basic_speak");
grantSkill(self, "social_language_basic_comprehend");
grantSkill(self, "social_language_bothan_speak");
grantSkill(self, "social_language_bothan_comprehend");
grantSkill(self, "social_language_wookiee_comprehend");
break;
case SPECIES_HUMAN:
grantSkill(self, "species_human");
grantSkill(self, "social_language_basic_speak");
grantSkill(self, "social_language_basic_comprehend");
grantSkill(self, "social_language_wookiee_comprehend");
break;
case SPECIES_MON_CALAMARI:
grantSkill(self, "species_moncal");
grantSkill(self, "social_language_basic_speak");
grantSkill(self, "social_language_basic_comprehend");
grantSkill(self, "social_language_moncalamari_speak");
grantSkill(self, "social_language_moncalamari_comprehend");
grantSkill(self, "social_language_wookiee_comprehend");
break;
case SPECIES_RODIAN:
grantSkill(self, "species_rodian");
grantSkill(self, "social_language_basic_speak");
grantSkill(self, "social_language_basic_comprehend");
grantSkill(self, "social_language_rodian_speak");
grantSkill(self, "social_language_rodian_comprehend");
grantSkill(self, "social_language_wookiee_comprehend");
break;
case SPECIES_TRANDOSHAN:
grantSkill(self, "species_trandoshan");
grantSkill(self, "social_language_basic_speak");
grantSkill(self, "social_language_basic_comprehend");
grantSkill(self, "social_language_trandoshan_speak");
grantSkill(self, "social_language_trandoshan_comprehend");
grantSkill(self, "social_language_wookiee_comprehend");
break;
case SPECIES_TWILEK:
grantSkill(self, "species_twilek");
grantSkill(self, "social_language_basic_speak");
grantSkill(self, "social_language_basic_comprehend");
grantSkill(self, "social_language_twilek_speak");
grantSkill(self, "social_language_twilek_comprehend");
grantSkill(self, "social_language_lekku_speak");
grantSkill(self, "social_language_lekku_comprehend");
grantSkill(self, "social_language_wookiee_comprehend");
break;
case SPECIES_WOOKIEE:
grantSkill(self, "species_wookiee");
grantSkill(self, "social_language_basic_comprehend");
grantSkill(self, "social_language_wookiee_speak");
grantSkill(self, "social_language_wookiee_comprehend");
break;
case SPECIES_ZABRAK:
grantSkill(self, "species_zabrak");
grantSkill(self, "social_language_basic_speak");
grantSkill(self, "social_language_basic_comprehend");
grantSkill(self, "social_language_zabrak_speak");
grantSkill(self, "social_language_zabrak_comprehend");
grantSkill(self, "social_language_wookiee_comprehend");
break;
case SPECIES_ITHORIAN:
grantSkill(self, "species_ithorian");
grantSkill(self, "social_language_basic_speak");
grantSkill(self, "social_language_basic_comprehend");
grantSkill(self, "social_language_ithorian_speak");
grantSkill(self, "social_language_ithorian_comprehend");
grantSkill(self, "social_language_wookiee_comprehend");
break;
case SPECIES_SULLUSTAN:
grantSkill(self, "species_sullustan");
grantSkill(self, "social_language_basic_speak");
grantSkill(self, "social_language_basic_comprehend");
grantSkill(self, "social_language_sullustan_speak");
grantSkill(self, "social_language_sullustan_comprehend");
grantSkill(self, "social_language_wookiee_comprehend");
break;
default:
detachScript(self, SCRIPT_ME);
break;
}
return SCRIPT_CONTINUE;
}
/***** MESSAGEHANDLERS *************************************************/
/***** COMMANDHANDLERS *************************************************/
commandHandler cmdInnate()
{
if ( (params == null) || (params.equals("")) )
{
//do innate command status
string msg = "";
string[] skillMods = getSkillStatModListingForPlayer(self);
if ( (skillMods != null) && (skillMods.length > 0) )
{
for ( int i = 0; i < skillMods.length; i++ )
{
if ( skillMods[i].startsWith("private_innate_") )
{
string[] s = split(skillMods[i], '_');
msg += s[s.length - 1] + ", ";
}
}
}
prose_package ppValidInnate = prose.getPackage(SID_VALID_INNATE_PARAMS);
if ( (msg == null) || (msg.equals("")) )
{
prose.setTO(ppValidInnate, SID_NONE);
}
else
{
if ( msg.endsWith(", ") )
{
msg = msg.substring(0, msg.length() - 2);
}
prose.setTO(ppValidInnate, msg);
}
sendSystemMessageProse(self, ppValidInnate);
return SCRIPT_CONTINUE;
}
string cmd = innate.parseInnateCommand(params);
if ( cmd == null )
{
prose_package ppNotValid = prose.getPackage(SID_NOT_VALID_PARAM_INNATE);
prose.setTO(ppNotValid, params);
sendSystemMessageProse(self, ppNotValid);
return SCRIPT_CONTINUE;
}
else
{
int modval = getSkillStatMod(self, "private_innate_" + cmd);
if ( modval > 0 )
{
if ( cmd.equals(innate.REGEN) )
{
queueCommand(self, ##"regeneration", null, "", COMMAND_PRIORITY_DEFAULT);
return SCRIPT_CONTINUE;
}
else if ( cmd.equals(innate.ROAR) )
{
queueCommand(self, ##"wookieeRoar", null, "", COMMAND_PRIORITY_DEFAULT);
return SCRIPT_CONTINUE;
}
else if ( cmd.equals(innate.EQUIL) )
{
queueCommand(self, ##"equilibrium", null, "", COMMAND_PRIORITY_DEFAULT);
return SCRIPT_CONTINUE;
}
else if ( cmd.equals(innate.VIT) )
{
queueCommand(self, ##"vitalize", null, "", COMMAND_PRIORITY_DEFAULT);
return SCRIPT_CONTINUE;
}
}
}
prose_package pp = prose.getPackage(innate.PROSE_INNATE_NA, cmd);
sendSystemMessageProse(self, pp);
return SCRIPT_CONTINUE;
}
commandHandler cmdInnateFail()
{
sendSystemMessage(self, SID_INNATE_ABILITY_FAILED);
return SCRIPT_CONTINUE;
}
commandHandler cmdRegeneration()
{
int mod = getSkillStatMod(self, "private_innate_regeneration");
if ( mod == 1 )
{
innate.regeneration();
}
return SCRIPT_CONTINUE;
}
commandHandler cmdVitalize()
{
int mod = getSkillStatMod(self, "private_innate_vitalize");
if ( mod == 1 )
{
innate.vitalize();
}
return SCRIPT_CONTINUE;
}
commandHandler cmdEquilibrium()
{
int mod = getSkillStatMod(self, "private_innate_equilibrium");
if ( mod == 1 )
{
innate.equilibrium();
}
return SCRIPT_CONTINUE;
}
/***** FUNCTIONS *************************************************/