From 24b3b00918454dd35e299c003c0b4658836cedae Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 13 Jun 2016 17:02:32 +0000 Subject: [PATCH] Ensoul rework/fixes. Contributed by Mathael. --- .../model/itemcontainer/PcInventory.java | 5 ++- .../ensoul/RequestItemEnsoul.java | 32 +++++-------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/trunk/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/trunk/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java index 403acc9ad6..9b4f5e7b3a 100644 --- a/trunk/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java +++ b/trunk/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java @@ -988,7 +988,10 @@ public class PcInventory extends Inventory { item.giveSkillsToOwner(); item.applyEnchantStats(); - item.applySpecialAbilities(); + if (item.isEquipped()) + { + item.applySpecialAbilities(); + } } } diff --git a/trunk/java/com/l2jmobius/gameserver/network/clientpackets/ensoul/RequestItemEnsoul.java b/trunk/java/com/l2jmobius/gameserver/network/clientpackets/ensoul/RequestItemEnsoul.java index 4ca46fa445..ae74b0fb95 100644 --- a/trunk/java/com/l2jmobius/gameserver/network/clientpackets/ensoul/RequestItemEnsoul.java +++ b/trunk/java/com/l2jmobius/gameserver/network/clientpackets/ensoul/RequestItemEnsoul.java @@ -53,7 +53,7 @@ public class RequestItemEnsoul implements IClientIncomingPacket _options = new EnsoulItemOption[options]; for (int i = 0; i < options; i++) { - final int type = packet.readC(); + final int type = packet.readC(); // 1 = normal ; 2 = mystic final int position = packet.readC(); final int soulCrystalObjectId = packet.readD(); final int soulCrystalOption = packet.readD(); @@ -188,41 +188,25 @@ public class RequestItemEnsoul implements IClientIncomingPacket ItemHolder fee; if (itemOption.getType() == 1) { + // Normal Soul Crystal fee = EnsoulData.getInstance().getEnsoulFee(item.getItem().getCrystalType(), position); if ((itemOption.getPosition() == 1) || (itemOption.getPosition() == 2)) { if (item.getSpecialAbility(position) != null) { - //LOGGER.warning("Player: " + player + " attempting to ensoul item option add but he's actually trying to replace!"); fee = EnsoulData.getInstance().getResoulFee(item.getItem().getCrystalType(), position); } } - else if (itemOption.getPosition() == 3) - { - if (item.getAdditionalSpecialAbility(position) != null) - { - LOGGER.warning("Player: " + player + " attempting to ensoul special item option add but he's actually trying to replace!"); - continue; - } - } } else if (itemOption.getType() == 2) { - fee = EnsoulData.getInstance().getResoulFee(item.getItem().getCrystalType(), position); - if ((itemOption.getPosition() == 1) || (itemOption.getPosition() == 2)) + // Mystic Soul Crystal + fee = EnsoulData.getInstance().getEnsoulFee(item.getItem().getCrystalType(), position); + if (itemOption.getPosition() == 1) { - if (item.getSpecialAbility(position) == null) + if (item.getAdditionalSpecialAbility(position) != null) { - LOGGER.warning("Player: " + player + " attempting to ensoul item option replace but he's actually trying to add!"); - continue; - } - } - else if (itemOption.getPosition() == 3) - { - if (item.getAdditionalSpecialAbility(position) == null) - { - LOGGER.warning("Player: " + player + " attempting to ensoul special item option replace but he's actually trying to add!"); - continue; + fee = EnsoulData.getInstance().getResoulFee(item.getItem().getCrystalType(), position); } } } @@ -234,7 +218,7 @@ public class RequestItemEnsoul implements IClientIncomingPacket if (fee == null) { - LOGGER.warning("Player: " + player + " attempting to ensoul item option that doesn't exists!"); + LOGGER.warning("Player: " + player + " attempting to ensoul item option that doesn't exists! (unknown fee)"); continue; }