mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-01-17 00:05:07 -05:00
Added scripting to support usage of the character respec reset device vet reward
This commit is contained in:
42
sku.0/sys.server/compiled/game/script/systems/veteran_reward/character_respec_reset_device.java
Normal file → Executable file
42
sku.0/sys.server/compiled/game/script/systems/veteran_reward/character_respec_reset_device.java
Normal file → Executable file
@@ -1,4 +1,38 @@
|
||||
package script.systems.veteran_reward;
|
||||
|
||||
public class character_respec_reset_device {
|
||||
}
|
||||
package script.systems.veteran_reward;
|
||||
|
||||
import script.menu_info;
|
||||
import script.menu_info_types;
|
||||
import script.obj_id;
|
||||
|
||||
public class character_respec_reset_device extends script.base_script {
|
||||
|
||||
public character_respec_reset_device() {}
|
||||
|
||||
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info item) throws InterruptedException {
|
||||
item.addRootMenu(menu_info_types.ITEM_USE, null);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
||||
{
|
||||
if (item == menu_info_types.ITEM_USE)
|
||||
{
|
||||
// There is no way to know who the owner of this item is... expect that the container it is in is owned by the player.
|
||||
if(!hasObjVar(player, "respecDeviceUsed")) {
|
||||
if(getOwner(getTopMostContainer(self)) == player) {
|
||||
// ok to reset respec.
|
||||
if(destroyObject(self)) {
|
||||
setObjVar(player, "respecDeviceUsed", 1);
|
||||
setObjVar(player, "respecsBought", 0);
|
||||
sendSystemMessage(player, "Your Respect Counter has been reset to zero.", null);
|
||||
};
|
||||
} else {
|
||||
sendSystemMessage(player, "You are not the owner of this device.", null);
|
||||
}
|
||||
} else {
|
||||
sendSystemMessage(player, "Your Respec Counter has already been reset on this character.", null);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user