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

94 lines
2.2 KiB
Plaintext

/**
* Copyright (c) ©2000-2002 Sony Online Entertainment Inc.
* All Rights Reserved
*
* Title: systems.beast.dna.script
* Description:
* @author jbenjamin
* @version $Revision: 1$
*/
//Script on Enzymes
include library.beast_lib;
include library.incubator
include library.utils;
//constants
const string_id SID_GOD_DNA_DATA = new string_id("incubator", "GODMODE_ADD_DATA");
const string_id SID_GOD_FIX = new string_id("incubator", "GODMODE_FIX_DATA");
trigger OnAttach()
{
messageTo(self, "handleInitializeValues", null, 1, false);
return SCRIPT_CONTINUE;
}
trigger OnGetAttributes(obj_id player, string[] names, string[] attribs)
{
int idx = utils.getValidAttributeIndex(names);
if (idx == -1)
return SCRIPT_CONTINUE;
if(exists(self))
{
if(incubator.hasDnaQuality(self))
{
names[idx] = "quality";
float attrib = incubator.getDnaQuality(self);
attrib = utils.roundFloatByDecimal(attrib);
attribs[idx] = "" + attrib + "%";
idx++;
if (idx >= names.length)
return SCRIPT_CONTINUE;
}
names[idx] = "bm_template";
string template = incubator.getDnaParentCreature(self);
if(template == null || template.equals(""))
{
names[idx] = "beast_type";
int intTemplate = incubator.getDnaCreatureTemplate(self);
template = incubator.getCreatureTypeFromHashTemplateDna(self, intTemplate);
template = beast_lib.stripBmFromType(template);
}
string attrib = "";
string_id templateId = new string_id("monster_name", template);
if(localize(templateId) == null)
{
templateId = new string_id("mob/creature_names", template);
if(localize(templateId) == null && hasObjVar(self, incubator.DNA_PARENT_TEMPLATE_NAME))
{
templateId = utils.unpackString(getStringObjVar(self, incubator.DNA_PARENT_TEMPLATE_NAME));
if(localize(templateId) == null)
{
attrib = getStringObjVar(self, incubator.DNA_PARENT_TEMPLATE_NAME);
}
}
}
if(localize(templateId) != null)
attrib = localize(templateId);
attribs[idx] = "" + attrib;
idx++;
if (idx >= names.length)
return SCRIPT_CONTINUE;
}
return SCRIPT_CONTINUE;
}
messageHandler handleInitializeValues ()
{
obj_id player = utils.getContainingPlayer(self);
incubator.initializeDna(self, player);
return SCRIPT_CONTINUE;
}