mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-03 03:15:55 -04:00
73 lines
2.0 KiB
Java
73 lines
2.0 KiB
Java
package script.item.medicine;
|
|
|
|
import script.*;
|
|
import script.base_class.*;
|
|
import script.combat_engine.*;
|
|
import java.util.Arrays;
|
|
import java.util.Hashtable;
|
|
import java.util.Vector;
|
|
import script.base_script;
|
|
|
|
import script.library.buff;
|
|
import script.library.sui;
|
|
import script.library.utils;
|
|
import script.library.healing;
|
|
|
|
public class stimpack_pet extends script.base_script
|
|
{
|
|
public stimpack_pet()
|
|
{
|
|
}
|
|
public int OnGetAttributes(obj_id self, obj_id player, String[] names, String[] attribs) throws InterruptedException
|
|
{
|
|
int idx = utils.getValidAttributeIndex(names);
|
|
if (idx == -1)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (hasObjVar(self, "healing.power"))
|
|
{
|
|
names[idx] = "healing_power";
|
|
float value = getIntObjVar(self, "healing.power");
|
|
attribs[idx] = "" + value;
|
|
idx++;
|
|
if (idx >= names.length)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
names[idx] = "count";
|
|
int value = getCount(self);
|
|
attribs[idx] = "" + value;
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
|
{
|
|
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;
|
|
}
|
|
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
|
{
|
|
if (isDead(player) || isIncapacitated(player))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (buff.hasBuff(player, "feign_death"))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (item == menu_info_types.ITEM_USE)
|
|
{
|
|
healing.useHealPetItem(player, getLookAtTarget(player), self);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|