mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-10-19 10:03:01 -04:00
who isn't sick of converting the freaking scripts? this negates the need
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
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.utils;
|
||||
import script.library.healing;
|
||||
|
||||
public class enhancer extends script.base_script
|
||||
{
|
||||
public enhancer()
|
||||
{
|
||||
}
|
||||
public static final string_id CANNOT_USE_ITEM = new string_id("base_player", "cannot_use_item");
|
||||
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 (utils.getContainingPlayer(self) != player || !hasObjVar(self, "commandName"))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String command = getStringObjVar(self, "commandName");
|
||||
if (!hasCommand(player, command))
|
||||
{
|
||||
healing.sendMedicalSpam(player, CANNOT_USE_ITEM, COMBAT_RESULT_MEDICAL);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (item == menu_info_types.ITEM_USE)
|
||||
{
|
||||
int commandCrc = getStringCrc(toLower(command));
|
||||
queueCommand(player, commandCrc, getLookAtTarget(player), "" + self, COMMAND_PRIORITY_NORMAL);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
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.enhancement"))
|
||||
{
|
||||
names[idx] = "enhancer_power";
|
||||
attribs[idx] = "" + Math.floor(getFloatObjVar(self, "healing.enhancement"));
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user