Ensoul rework/fixes.

Contributed by Mathael.
This commit is contained in:
MobiusDev 2016-06-13 17:02:32 +00:00
parent 64347d719b
commit 24b3b00918
2 changed files with 12 additions and 25 deletions

View File

@ -988,9 +988,12 @@ public class PcInventory extends Inventory
{ {
item.giveSkillsToOwner(); item.giveSkillsToOwner();
item.applyEnchantStats(); item.applyEnchantStats();
if (item.isEquipped())
{
item.applySpecialAbilities(); item.applySpecialAbilities();
} }
} }
}
/** /**
* Reduce the number of arrows/bolts owned by the L2PcInstance and send it Server->Client Packet InventoryUpdate or ItemList (to unequip if the last arrow was consumed). * Reduce the number of arrows/bolts owned by the L2PcInstance and send it Server->Client Packet InventoryUpdate or ItemList (to unequip if the last arrow was consumed).

View File

@ -53,7 +53,7 @@ public class RequestItemEnsoul implements IClientIncomingPacket
_options = new EnsoulItemOption[options]; _options = new EnsoulItemOption[options];
for (int i = 0; i < options; i++) 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 position = packet.readC();
final int soulCrystalObjectId = packet.readD(); final int soulCrystalObjectId = packet.readD();
final int soulCrystalOption = packet.readD(); final int soulCrystalOption = packet.readD();
@ -188,41 +188,25 @@ public class RequestItemEnsoul implements IClientIncomingPacket
ItemHolder fee; ItemHolder fee;
if (itemOption.getType() == 1) if (itemOption.getType() == 1)
{ {
// Normal Soul Crystal
fee = EnsoulData.getInstance().getEnsoulFee(item.getItem().getCrystalType(), position); fee = EnsoulData.getInstance().getEnsoulFee(item.getItem().getCrystalType(), position);
if ((itemOption.getPosition() == 1) || (itemOption.getPosition() == 2)) if ((itemOption.getPosition() == 1) || (itemOption.getPosition() == 2))
{ {
if (item.getSpecialAbility(position) != null) 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); 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) else if (itemOption.getType() == 2)
{
// Mystic Soul Crystal
fee = EnsoulData.getInstance().getEnsoulFee(item.getItem().getCrystalType(), position);
if (itemOption.getPosition() == 1)
{
if (item.getAdditionalSpecialAbility(position) != null)
{ {
fee = EnsoulData.getInstance().getResoulFee(item.getItem().getCrystalType(), position); fee = EnsoulData.getInstance().getResoulFee(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 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;
} }
} }
} }
@ -234,7 +218,7 @@ public class RequestItemEnsoul implements IClientIncomingPacket
if (fee == null) 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; continue;
} }