/** * Copyright (c) ©2000-2002 Sony Online Entertainment Inc. * All Rights Reserved * * Title: systems.beast.enzyme.script * Description: * @author jbenjamin * @version $Revision: 1.1$ */ //Script on Enzymes include library.incubator include library.utils; //constants trigger OnInitialize() { if(hasObjVar(self, incubator.ENZYME_COLOR_OBJVAR)) { messageTo(self, "rename_enzyme", null, 1.0f, false); } return SCRIPT_CONTINUE; } void renameEnzyme(obj_id which) { string name = ""; if(hasObjVar(which, incubator.ENZYME_COLOR_OBJVAR)) { int colorIndex = getIntObjVar(which, incubator.ENZYME_COLOR_OBJVAR); if(colorIndex >= incubator.ENZYME_COLORS.length) return; name = incubator.ENZYME_COLORS[colorIndex]; if(name != "" && name.length() > 0) { if(getGameObjectType(which) == GOT_misc_enzyme_isomerase) setName(which, name + " Isomerase Enzyme"); else if(getGameObjectType(which) == GOT_misc_enzyme_lyase) setName(which, name + " Lyase Enzyme"); } } } messageHandler rename_enzyme() { renameEnzyme(self); return SCRIPT_CONTINUE; } trigger OnAttach() { messageTo(self, "handleInitializeValues", null, 1, false); return SCRIPT_CONTINUE; } trigger OnObjectMenuRequest(obj_id player, menu_info mi) { return SCRIPT_CONTINUE; } trigger OnObjectMenuSelect(obj_id player, int item) { 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) && incubator.isStatEnzyme(self)) { names[idx] = "bm_random_stats"; int attrib = incubator.getEnzymeRandomStats(self); if(attrib != 0) { attribs[idx] = "" + attrib; idx++; if (idx >= names.length) return SCRIPT_CONTINUE; } } if (exists(self) && incubator.isStatEnzyme(self)) { names[idx] = "bm_stat_name"; String attrib = incubator.getEnzymeFreeStat(self); if(!attrib.equals("") && attrib != null) { attribs[idx] = "" + attrib; idx++; if (idx >= names.length) return SCRIPT_CONTINUE; } } if (exists(self) && incubator.isSkillEnzyme(self)) { names[idx] = "bm_skill_points"; float attrib = incubator.getEnzymeSkillPoints(self); attribs[idx] = "" + attrib; idx++; if (idx >= names.length) return SCRIPT_CONTINUE; } if (exists(self) && incubator.isQualityEnzyme(self)) { names[idx] = "quality"; float attrib = incubator.getEnzymeQuality(self); attrib = utils.roundFloatByDecimal(attrib); attribs[idx] = "" + attrib + "%"; idx++; if (idx >= names.length) return SCRIPT_CONTINUE; } if(exists(self) && hasObjVar(self, incubator.ENZYME_COLOR_OBJVAR)) { names[idx] = "enzyme_color"; int colorIndex = getIntObjVar(self, incubator.ENZYME_COLOR_OBJVAR); string attrib = incubator.ENZYME_COLORS[colorIndex]; attribs[idx] = "" + attrib; idx++; if (idx >= names.length) return SCRIPT_CONTINUE; } return SCRIPT_CONTINUE; } messageHandler handleInitializeValues () { renameEnzyme(self); //if we already have the objvar, we need to just bail out //more than likely this is because of CTS if(hasObjVar(self, incubator.ENZYME_QUALITY_OBJVAR) || hasObjVar(self, incubator.ENZYME_RANDOM_STATS_OBJVAR) || hasObjVar(self, incubator.ENZYME_FREE_STAT_OBJVAR)) { if(hasObjVar(self, "collection_enzyme")) removeObjVar(self,"collection_enzyme"); return SCRIPT_CONTINUE; } incubator.initializeEnzymes(self); incubator.awardEnzymeCollection(self); return SCRIPT_CONTINUE; } trigger OnTransferred(obj_id sourceContainer, obj_id destContainer, obj_id transferer) { incubator.awardEnzymeCollection(self); return SCRIPT_CONTINUE; }