Applying new augments should remove existing.

Contributed by nasseka.
This commit is contained in:
MobiusDevelopment 2022-05-05 22:28:13 +00:00
parent 4c5d91459f
commit 48a4fd6443
2 changed files with 24 additions and 26 deletions

View File

@ -59,6 +59,17 @@ public class ExApplyVariationOption implements IClientIncomingPacket
final int option1Id = augment.getOption1Id();
final int option2Id = augment.getOption2Id();
// Unequip item.
final InventoryUpdate iu = new InventoryUpdate();
if (targetItem.isEquipped())
{
for (Item itm : player.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot()))
{
iu.addModifiedItem(itm);
}
player.broadcastUserInfo();
}
if ((targetItem.getObjectId() != _enchantedObjectId) || (_option1 != option1Id) || (_option2 != option2Id))
{
player.sendPacket(new ApplyVariationOption(0, 0, 0, 0));
@ -73,21 +84,9 @@ public class ExApplyVariationOption implements IClientIncomingPacket
targetItem.setAugmentation(augment, true);
// Unequip item.
final InventoryUpdate iu = new InventoryUpdate();
if (targetItem.isEquipped())
{
for (Item itm : player.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot()))
{
iu.addModifiedItem(itm);
}
player.broadcastUserInfo();
}
iu.addModifiedItem(targetItem);
player.sendInventoryUpdate(iu);
player.removeRequest(VariationRequest.class);
player.sendPacket(new ApplyVariationOption(1, _enchantedObjectId, _option1, _option2));
player.removeRequest(VariationRequest.class);
}
}

View File

@ -59,6 +59,17 @@ public class ExApplyVariationOption implements IClientIncomingPacket
final int option1Id = augment.getOption1Id();
final int option2Id = augment.getOption2Id();
// Unequip item.
final InventoryUpdate iu = new InventoryUpdate();
if (targetItem.isEquipped())
{
for (Item itm : player.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot()))
{
iu.addModifiedItem(itm);
}
player.broadcastUserInfo();
}
if ((targetItem.getObjectId() != _enchantedObjectId) || (_option1 != option1Id) || (_option2 != option2Id))
{
player.sendPacket(new ApplyVariationOption(0, 0, 0, 0));
@ -73,21 +84,9 @@ public class ExApplyVariationOption implements IClientIncomingPacket
targetItem.setAugmentation(augment, true);
// Unequip item.
final InventoryUpdate iu = new InventoryUpdate();
if (targetItem.isEquipped())
{
for (Item itm : player.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot()))
{
iu.addModifiedItem(itm);
}
player.broadcastUserInfo();
}
iu.addModifiedItem(targetItem);
player.sendInventoryUpdate(iu);
player.removeRequest(VariationRequest.class);
player.sendPacket(new ApplyVariationOption(1, _enchantedObjectId, _option1, _option2));
player.removeRequest(VariationRequest.class);
}
}