mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-15 00:07:39 -04:00
Fixed an issue where items with uses weren't being consumed
Fixed #970 Fixed #964
This commit is contained in:
@@ -732,8 +732,7 @@ public class ObjectService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
public void useObject(CreatureObject creature, final SWGObject object) {
|
||||
System.out.println("creature " + creature);
|
||||
System.out.println("object " + object);
|
||||
|
||||
if (creature == null || object == null) {
|
||||
return;
|
||||
}
|
||||
@@ -819,7 +818,7 @@ public class ObjectService implements INetworkDispatch {
|
||||
//shirt.setIntAttribute(effectName, powerValue);
|
||||
shirt.setAttachment("PUPEffectName", effectName);
|
||||
shirt.setAttachment("PUPEffectValue", powerValue);
|
||||
|
||||
|
||||
}
|
||||
if (object.getTemplate().equals(powerUpTemplate3)){
|
||||
// weapon
|
||||
@@ -906,22 +905,27 @@ public class ObjectService implements INetworkDispatch {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
if (object instanceof TangibleObject) {
|
||||
TangibleObject item = (TangibleObject) object;
|
||||
int uses = item.getUses();
|
||||
|
||||
if (uses > 0) {
|
||||
item.setUses(uses--);
|
||||
item.setUses(uses - 1);
|
||||
|
||||
if (item.getUses() == 0) {
|
||||
destroyObject(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (object.getStringAttribute("proc_name") != null) {
|
||||
core.buffService.addBuffToCreature(creature, object.getStringAttribute("proc_name").replace("@ui_buff:", ""), creature);
|
||||
String buffName = object.getStringAttribute("proc_name").replace("@ui_buff:", "");
|
||||
|
||||
if (object.getAttachment("alternateBuffName") != null)
|
||||
buffName = (String) object.getAttachment("alternateBuffName");
|
||||
|
||||
core.buffService.addBuffToCreature(creature, buffName, creature);
|
||||
}
|
||||
|
||||
String filePath = "scripts/" + template.split("shared_" , 2)[0].replace("shared_", "") + template.split("shared_" , 2)[1].replace(".iff", "") + ".py";
|
||||
|
||||
Reference in New Issue
Block a user