Agathion bracelet unequip listener and UserInfo improvement.

This commit is contained in:
MobiusDev 2018-07-29 01:09:36 +00:00
parent 67465014b0
commit d88a350a5c
2 changed files with 40 additions and 2 deletions

View File

@ -716,6 +716,34 @@ public abstract class Inventory extends ItemContainer
}
}
private static final class AgathionBraceletListener implements PaperdollListener
{
private static AgathionBraceletListener instance = new AgathionBraceletListener();
public static AgathionBraceletListener getInstance()
{
return instance;
}
@Override
public void notifyUnequiped(int slot, L2ItemInstance item, Inventory inventory)
{
if (item.getItem().getBodyPart() == L2Item.SLOT_L_BRACELET)
{
inventory.unEquipItemInSlot(PAPERDOLL_AGATHION1);
inventory.unEquipItemInSlot(PAPERDOLL_AGATHION2);
inventory.unEquipItemInSlot(PAPERDOLL_AGATHION3);
inventory.unEquipItemInSlot(PAPERDOLL_AGATHION4);
inventory.unEquipItemInSlot(PAPERDOLL_AGATHION5);
}
}
@Override
public void notifyEquiped(int slot, L2ItemInstance item, Inventory inventory)
{
}
}
/**
* Constructor of the inventory
*/
@ -731,6 +759,7 @@ public abstract class Inventory extends ItemContainer
addPaperdollListener(ItemSkillsListener.getInstance());
addPaperdollListener(BraceletListener.getInstance());
addPaperdollListener(BroochListener.getInstance());
addPaperdollListener(AgathionBraceletListener.getInstance());
}
// common

View File

@ -330,8 +330,17 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
packet.writeC(0x00);
packet.writeC(0x00);
packet.writeC(0x00);
packet.writeC(_activeChar.getInventory().getAgathionSlots());
packet.writeC(_activeChar.getInventory().getAgathionSlots() - 1);
if (_activeChar.getInventory().getAgathionSlots() > 0)
{
packet.writeC(0x01);
packet.writeC(_activeChar.getInventory().getAgathionSlots() - 1);
}
else
{
packet.writeC(0x00);
packet.writeC(0x00);
}
}
if (containsMask(UserInfoType.MOVEMENTS))