Fixed a bug where you could not remove a lightsaber's color crystal

This commit is contained in:
Seefo
2014-05-05 22:42:00 -04:00
parent 8b2aa2a46e
commit 3d128d4cd2
+10 -6
View File
@@ -123,6 +123,8 @@ public class EquipmentService implements INetworkDispatch {
return false;
}
if(item.getTemplate().startsWith("object/weapon/") && item.getTemplate().contains("lightsaber") && item.getAttachment("hasColorCrystal") == null) item.setAttachment("hasColorCrystal", false);
if(item.getAttachment("hasColorCrystal") != null && (Boolean) item.getAttachment("hasColorCrystal") == false)
{
actor.sendSystemMessage("You may not equip a light saber that has no color crystal!", (byte) 0);
@@ -320,7 +322,7 @@ public class EquipmentService implements INetworkDispatch {
if(!item.getTemplate().startsWith("object/tangible/component/weapon/lightsaber/")) return;
if(lightsaber.getAttachment("hasColorCrystal") == null) lightsaber.setAttachment("hasColorCrystal", false);
if(item.getAttributes().containsKey("@obj_attr_n:color") && (Boolean) lightsaber.getAttachment("hasColorCrystal")) return;
if(item.getAttributes().containsKey("@obj_attr_n:color") && (Boolean) lightsaber.getAttachment("hasColorCrystal") && !(targetContainer.getContainer() instanceof CreatureObject)) return;
// Find our tuner
if(item.getAttachment("tunerId") == null) item.setAttachment("tunerId", 0);
@@ -335,6 +337,8 @@ public class EquipmentService implements INetworkDispatch {
else item.getContainer().transferTo(actor, targetContainer, item);
// Calculate attributes
lightsaber.setAttachment("hasColorCrystal", false);
lightsaberInventory.viewChildren(lightsaberInventory, false, false, new Traverser()
{
WeaponObject saber;
@@ -342,7 +346,7 @@ public class EquipmentService implements INetworkDispatch {
int minDamageBonus = 0;
int maxDamageBonus = 0;
Boolean hasColorCrystal = false;
Boolean hasColorCrystal = false;
public void process(SWGObject item)
{
@@ -359,10 +363,10 @@ public class EquipmentService implements INetworkDispatch {
saber.setCustomizationVariable("private/alternate_shader_blade", bladeType);
saber.setCustomizationVariable("/private/index_color_blade", bladeColor);
// System.out.println("bladeColorName: " + item.getAttributes().get("@obj_attr_n:color"));
// System.out.println("bladeColor: " + bladeColor);
// System.out.println("bladeType: " + bladeType);
// System.out.println();
// System.out.println("bladeColorName: " + item.getAttributes().get("@obj_attr_n:color"));
// System.out.println("bladeColor: " + bladeColor);
// System.out.println("bladeType: " + bladeType);
// System.out.println();
hasColorCrystal = true;
}