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

86 lines
2.3 KiB
Plaintext

/**
* Copyright (c) ©2004 Sony Online Entertainment Inc.
* All Rights Reserved
*
* Title: item.component.component_attribs.script
* Description: sets up attribute text for a component object when it is examined
* @author $Steve Jakab$
* @version $Revision: 0$
*/
include library.craftinglib;
include library.utils;
/**
* Called when a player requests info about an object. The trigger should fill
* in a localization name and attribute value for each attribute it wants
* the player to know about.
*
* @param self the object being queried
* @param player the player requesting the attributes
* @param names localization name of the attributes
* @param attribs value of the attributes
*/
trigger OnGetAttributes(obj_id player, string[] names, string[] attribs)
{
if ( names == null || attribs == null || names.length != attribs.length )
return SCRIPT_CONTINUE;
int i = getFirstFreeIndex(names);
if (i != -1 && i < names.length)
{
float complexity = getComplexity(self);
if ( complexity >= 0 )
{
names[i] = "@crafting:complexity";
attribs[i] = "" + complexity;
++i;
}
obj_var_list componentData = getObjVarList(self, craftinglib.COMPONENT_ATTRIBUTE_OBJVAR_NAME);
if ( componentData != null )
{
int count = componentData.getNumItems();
for ( int j = 0; j < count; ++j )
{
obj_var component = componentData.getObjVar(j);
if ( component != null && component.getData() != null )
{
names[i] = "@crafting:" + component.getName();
attribs[i] = component.getData().toString();
++i;
}
}
}
}
return SCRIPT_CONTINUE;
}
trigger OnInitialize()
{
// CU conversion fixes hackery
string template = getTemplateName(self);
string[] needToBeFixed = new string[]
{
"object/tangible/component/armor/armor_layer_nightsister.iff",
"object/tangible/component/armor/feather_peko_albatross.iff",
"object/tangible/component/armor/armor_layer_ris.iff"
};
if(utils.getElementPositionInArray(needToBeFixed, template) > -1)
{
// attribute.bonus.0 needs to be an Int rather than a Float
float val = getFloatObjVar(self, "attribute.bonus.0");
if(val != 0)
{
int intVal = (int)val;
removeObjVar(self, "attribute.bonus.0");
setObjVar(self, "attribute.bonus.0", intVal);
}
}
return SCRIPT_CONTINUE;
}