mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-09-12 23:45:12 -04:00
100 lines
2.8 KiB
Plaintext
100 lines
2.8 KiB
Plaintext
/**********************************************************************
|
|
|
|
*
|
|
* Title: newbie_medicine
|
|
* Description: Initializes newbie medicines.
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
/***** INCLUDES ********************************************************/
|
|
include library.consumable;
|
|
include library.healing;
|
|
include library.utils;
|
|
|
|
/***** CONSTANTS *******************************************************/
|
|
|
|
|
|
/***** TRIGGERS ********************************************************/
|
|
trigger OnAttach()
|
|
{
|
|
if (hasObjVar(self, consumable.VAR_CONSUMABLE_BASE))
|
|
removeObjVar(self, consumable.VAR_CONSUMABLE_BASE);
|
|
|
|
string template = getTemplateName(self);
|
|
string attribute = "";
|
|
int charges = 1;
|
|
if (template.equals("object/tangible/medicine/newbie_medpack_damage.iff"))
|
|
{
|
|
charges = 5;
|
|
attribute = "damage";
|
|
}
|
|
else if (template.equals("object/tangible/medicine/newbie_medpack_wound_action.iff"))
|
|
{
|
|
attribute = "action";
|
|
}
|
|
else if (template.equals("object/tangible/medicine/newbie_medpack_wound_health.iff"))
|
|
{
|
|
attribute = "health";
|
|
}
|
|
else
|
|
{
|
|
LOG("LOG_CHANNEL", "newbie_medicine::OnAttach -- illegal template for " + self);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
LOG("LOG_CHANNEL", "attribute ->" + attribute);
|
|
resizeable attrib_mod[] am = new attrib_mod[0];
|
|
if (attribute.equals("damage"))
|
|
{
|
|
attrib_mod tmp = new attrib_mod(0, 0, 0.0f, 0.0f, 0.0f);
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
tmp = utils.createHealDamageAttribMod(i * 3, 50);
|
|
am = utils.addElement(am, tmp);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
int attrib_type = healing.stringToAttribute(attribute.toUpperCase());
|
|
if (attrib_type == -1)
|
|
{
|
|
LOG("LOG_CHANNEL", "newbie_medicine::OnAttach -- illegal attribute type for " + self);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
attrib_mod tmp = new attrib_mod(0, 0, 0.0f, 0.0f, 0.0f);
|
|
tmp = utils.createHealWoundAttribMod(attrib_type, 10);
|
|
am = utils.addElement(am, tmp);
|
|
}
|
|
|
|
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
|
setObjVar(self, consumable.VAR_CONSUMABLE_MEDICINE, true);
|
|
setCount(self, charges);
|
|
//setObjVar(self, consumable.VAR_CONSUMABLE_CHARGES, charges);
|
|
|
|
// Set all stomachs to zero since we aren't currently using the stomach for medicine
|
|
int[] stomach = {0, 0, 0};
|
|
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
|
|
|
// Add in skill mod required data
|
|
string[] skill_mod = {"healing_ability"};
|
|
setObjVar(self, consumable.VAR_SKILL_MOD_REQUIRED, skill_mod);
|
|
|
|
// Add in min mod value data
|
|
int[] skill_mod_min = {5};
|
|
setObjVar(self, consumable.VAR_SKILL_MOD_MIN, skill_mod_min);
|
|
|
|
detachScript(self, "item.comestible.newbie_medicine");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
/***** MESSAGEHANDLERS *************************************************/
|
|
|
|
|
|
/***** COMMANDHANDLERS *************************************************/
|
|
|
|
|
|
/***** FUNCTIONS *******************************************************/
|
|
|