diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index fa520bfb88..b7d251f4aa 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -12108,45 +12108,38 @@ public final class L2PcInstance extends L2Playable } final int relation1 = getRelation(activeChar); + final RelationChanged rc1 = new RelationChanged(); + rc1.addRelation(this, relation1, isAutoAttackable(activeChar)); + if (hasSummon()) + { + final L2Summon pet = getPet(); + if (pet != null) + { + rc1.addRelation(pet, relation1, isAutoAttackable(activeChar)); + } + if (hasServitors()) + { + getServitors().values().forEach(s -> rc1.addRelation(s, relation1, isAutoAttackable(activeChar))); + } + } + activeChar.sendPacket(rc1); + final int relation2 = activeChar.getRelation(this); - Integer oldrelation = getKnownRelations().get(activeChar.getObjectId()); - if ((oldrelation != null) && (oldrelation != relation1)) + final RelationChanged rc2 = new RelationChanged(); + rc2.addRelation(activeChar, relation2, activeChar.isAutoAttackable(this)); + if (activeChar.hasSummon()) { - final RelationChanged rc = new RelationChanged(); - rc.addRelation(this, relation1, isAutoAttackable(activeChar)); - if (hasSummon()) + final L2Summon pet = getPet(); + if (pet != null) { - final L2Summon pet = getPet(); - if (pet != null) - { - rc.addRelation(pet, relation1, isAutoAttackable(activeChar)); - } - if (hasServitors()) - { - getServitors().values().forEach(s -> rc.addRelation(s, relation1, isAutoAttackable(activeChar))); - } + rc2.addRelation(pet, relation2, activeChar.isAutoAttackable(this)); } - activeChar.sendPacket(rc); - } - oldrelation = activeChar.getKnownRelations().get(getObjectId()); - if ((oldrelation != null) && (oldrelation != relation2) && activeChar.isVisibleFor(this)) - { - final RelationChanged rc = new RelationChanged(); - rc.addRelation(activeChar, relation2, activeChar.isAutoAttackable(this)); - if (activeChar.hasSummon()) + if (hasServitors()) { - final L2Summon pet = getPet(); - if (pet != null) - { - rc.addRelation(pet, relation2, activeChar.isAutoAttackable(this)); - } - if (hasServitors()) - { - getServitors().values().forEach(s -> rc.addRelation(s, relation2, activeChar.isAutoAttackable(this))); - } + getServitors().values().forEach(s -> rc2.addRelation(s, relation2, activeChar.isAutoAttackable(this))); } - sendPacket(rc); } + sendPacket(rc2); switch (getPrivateStoreType()) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index abe2fc1497..0ba5f048dc 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -12108,45 +12108,38 @@ public final class L2PcInstance extends L2Playable } final int relation1 = getRelation(activeChar); + final RelationChanged rc1 = new RelationChanged(); + rc1.addRelation(this, relation1, isAutoAttackable(activeChar)); + if (hasSummon()) + { + final L2Summon pet = getPet(); + if (pet != null) + { + rc1.addRelation(pet, relation1, isAutoAttackable(activeChar)); + } + if (hasServitors()) + { + getServitors().values().forEach(s -> rc1.addRelation(s, relation1, isAutoAttackable(activeChar))); + } + } + activeChar.sendPacket(rc1); + final int relation2 = activeChar.getRelation(this); - Integer oldrelation = getKnownRelations().get(activeChar.getObjectId()); - if ((oldrelation != null) && (oldrelation != relation1)) + final RelationChanged rc2 = new RelationChanged(); + rc2.addRelation(activeChar, relation2, activeChar.isAutoAttackable(this)); + if (activeChar.hasSummon()) { - final RelationChanged rc = new RelationChanged(); - rc.addRelation(this, relation1, isAutoAttackable(activeChar)); - if (hasSummon()) + final L2Summon pet = getPet(); + if (pet != null) { - final L2Summon pet = getPet(); - if (pet != null) - { - rc.addRelation(pet, relation1, isAutoAttackable(activeChar)); - } - if (hasServitors()) - { - getServitors().values().forEach(s -> rc.addRelation(s, relation1, isAutoAttackable(activeChar))); - } + rc2.addRelation(pet, relation2, activeChar.isAutoAttackable(this)); } - activeChar.sendPacket(rc); - } - oldrelation = activeChar.getKnownRelations().get(getObjectId()); - if ((oldrelation != null) && (oldrelation != relation2) && activeChar.isVisibleFor(this)) - { - final RelationChanged rc = new RelationChanged(); - rc.addRelation(activeChar, relation2, activeChar.isAutoAttackable(this)); - if (activeChar.hasSummon()) + if (hasServitors()) { - final L2Summon pet = getPet(); - if (pet != null) - { - rc.addRelation(pet, relation2, activeChar.isAutoAttackable(this)); - } - if (hasServitors()) - { - getServitors().values().forEach(s -> rc.addRelation(s, relation2, activeChar.isAutoAttackable(this))); - } + getServitors().values().forEach(s -> rc2.addRelation(s, relation2, activeChar.isAutoAttackable(this))); } - sendPacket(rc); } + sendPacket(rc2); switch (getPrivateStoreType()) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 667c95e8fb..8ebba7f4d9 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -12119,45 +12119,38 @@ public final class L2PcInstance extends L2Playable } final int relation1 = getRelation(activeChar); + final RelationChanged rc1 = new RelationChanged(); + rc1.addRelation(this, relation1, isAutoAttackable(activeChar)); + if (hasSummon()) + { + final L2Summon pet = getPet(); + if (pet != null) + { + rc1.addRelation(pet, relation1, isAutoAttackable(activeChar)); + } + if (hasServitors()) + { + getServitors().values().forEach(s -> rc1.addRelation(s, relation1, isAutoAttackable(activeChar))); + } + } + activeChar.sendPacket(rc1); + final int relation2 = activeChar.getRelation(this); - Integer oldrelation = getKnownRelations().get(activeChar.getObjectId()); - if ((oldrelation != null) && (oldrelation != relation1)) + final RelationChanged rc2 = new RelationChanged(); + rc2.addRelation(activeChar, relation2, activeChar.isAutoAttackable(this)); + if (activeChar.hasSummon()) { - final RelationChanged rc = new RelationChanged(); - rc.addRelation(this, relation1, isAutoAttackable(activeChar)); - if (hasSummon()) + final L2Summon pet = getPet(); + if (pet != null) { - final L2Summon pet = getPet(); - if (pet != null) - { - rc.addRelation(pet, relation1, isAutoAttackable(activeChar)); - } - if (hasServitors()) - { - getServitors().values().forEach(s -> rc.addRelation(s, relation1, isAutoAttackable(activeChar))); - } + rc2.addRelation(pet, relation2, activeChar.isAutoAttackable(this)); } - activeChar.sendPacket(rc); - } - oldrelation = activeChar.getKnownRelations().get(getObjectId()); - if ((oldrelation != null) && (oldrelation != relation2) && activeChar.isVisibleFor(this)) - { - final RelationChanged rc = new RelationChanged(); - rc.addRelation(activeChar, relation2, activeChar.isAutoAttackable(this)); - if (activeChar.hasSummon()) + if (hasServitors()) { - final L2Summon pet = getPet(); - if (pet != null) - { - rc.addRelation(pet, relation2, activeChar.isAutoAttackable(this)); - } - if (hasServitors()) - { - getServitors().values().forEach(s -> rc.addRelation(s, relation2, activeChar.isAutoAttackable(this))); - } + getServitors().values().forEach(s -> rc2.addRelation(s, relation2, activeChar.isAutoAttackable(this))); } - sendPacket(rc); } + sendPacket(rc2); switch (getPrivateStoreType()) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 4ae8d0d141..b573905bf9 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -12081,45 +12081,38 @@ public final class L2PcInstance extends L2Playable } final int relation1 = getRelation(activeChar); + final RelationChanged rc1 = new RelationChanged(); + rc1.addRelation(this, relation1, isAutoAttackable(activeChar)); + if (hasSummon()) + { + final L2Summon pet = getPet(); + if (pet != null) + { + rc1.addRelation(pet, relation1, isAutoAttackable(activeChar)); + } + if (hasServitors()) + { + getServitors().values().forEach(s -> rc1.addRelation(s, relation1, isAutoAttackable(activeChar))); + } + } + activeChar.sendPacket(rc1); + final int relation2 = activeChar.getRelation(this); - Integer oldrelation = getKnownRelations().get(activeChar.getObjectId()); - if ((oldrelation != null) && (oldrelation != relation1)) + final RelationChanged rc2 = new RelationChanged(); + rc2.addRelation(activeChar, relation2, activeChar.isAutoAttackable(this)); + if (activeChar.hasSummon()) { - final RelationChanged rc = new RelationChanged(); - rc.addRelation(this, relation1, isAutoAttackable(activeChar)); - if (hasSummon()) + final L2Summon pet = getPet(); + if (pet != null) { - final L2Summon pet = getPet(); - if (pet != null) - { - rc.addRelation(pet, relation1, isAutoAttackable(activeChar)); - } - if (hasServitors()) - { - getServitors().values().forEach(s -> rc.addRelation(s, relation1, isAutoAttackable(activeChar))); - } + rc2.addRelation(pet, relation2, activeChar.isAutoAttackable(this)); } - activeChar.sendPacket(rc); - } - oldrelation = activeChar.getKnownRelations().get(getObjectId()); - if ((oldrelation != null) && (oldrelation != relation2) && activeChar.isVisibleFor(this)) - { - final RelationChanged rc = new RelationChanged(); - rc.addRelation(activeChar, relation2, activeChar.isAutoAttackable(this)); - if (activeChar.hasSummon()) + if (hasServitors()) { - final L2Summon pet = getPet(); - if (pet != null) - { - rc.addRelation(pet, relation2, activeChar.isAutoAttackable(this)); - } - if (hasServitors()) - { - getServitors().values().forEach(s -> rc.addRelation(s, relation2, activeChar.isAutoAttackable(this))); - } + getServitors().values().forEach(s -> rc2.addRelation(s, relation2, activeChar.isAutoAttackable(this))); } - sendPacket(rc); } + sendPacket(rc2); switch (getPrivateStoreType()) {