Fixed an issue where items with uses weren't being consumed

Fixed #970
Fixed #964
This commit is contained in:
Ziggeh
2014-06-30 16:18:34 +02:00
parent 6d3b5a52ec
commit dc6f5460a6
+11 -7
View File
@@ -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";