mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-09-30 16:12:59 -04:00
104 lines
2.2 KiB
Plaintext
104 lines
2.2 KiB
Plaintext
/**
|
|
* Copyright (c)2000-2002 Sony Online Entertainment Inc.
|
|
* All Rights Reserved
|
|
*
|
|
* Title: stimpack script
|
|
* Description: script for handling stimpacks
|
|
* @author $Author:$tblair
|
|
* @version $Revision:$
|
|
*/
|
|
|
|
include library.buff;
|
|
include library.sui;
|
|
include library.utils;
|
|
include library.healing;
|
|
|
|
const string_id SID_ITEM_LEVEL_TOO_LOW = new string_id("healing", "item_level_too_low");
|
|
|
|
|
|
|
|
|
|
trigger OnGetAttributes (obj_id player, string[] names, string[] attribs)
|
|
{
|
|
int idx = utils.getValidAttributeIndex(names);
|
|
if (idx == -1)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (hasObjVar(self, "healing.power"))
|
|
{
|
|
names[idx] = "healing_power";
|
|
int value = getIntObjVar(self, "healing.power");
|
|
attribs[idx] = "" + value;
|
|
idx++;
|
|
if (idx >= names.length)
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (hasObjVar(self, "healing.combat_level_required"))
|
|
{
|
|
names[idx] = "healing_combat_level_required";
|
|
int value = getIntObjVar(self, "healing.combat_level_required");
|
|
attribs[idx] = "" + value;
|
|
idx++;
|
|
if (idx >= names.length)
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
|
|
|
|
names[idx] = "count";
|
|
int value = getCount(self);
|
|
attribs[idx] = "" + value;
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
if (canManipulate(player, self, true, true, 15, true))
|
|
{
|
|
menu_info_data mid = mi.getMenuItemByType(menu_info_types.ITEM_USE);
|
|
if ( mid != null )
|
|
{
|
|
mid.setServerNotify(true);
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
if(isDead(player) || isIncapacitated(player))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if(buff.hasBuff(player, "feign_death"))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( item == menu_info_types.ITEM_USE)
|
|
{
|
|
int level = getLevel(player);
|
|
int requiredLevel = getIntObjVar(self, "healing.combat_level_required");
|
|
if(level < requiredLevel)
|
|
{
|
|
sendSystemMessage(player, SID_ITEM_LEVEL_TOO_LOW);
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
else
|
|
{
|
|
if (hasObjVar(self, "healing.pool"))
|
|
{
|
|
int attrib = getIntObjVar(self, "healing.pool");
|
|
boolean worked = healing.useHealDamageItem(player, self, attrib);
|
|
}
|
|
else
|
|
{
|
|
boolean worked = healing.useHealDamageItem(player, self);
|
|
}
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|