New client logic for RelationChanged attackable information.

This commit is contained in:
MobiusDevelopment 2019-07-10 05:20:18 +00:00
parent 54ca76668d
commit 9a8db7c814
8 changed files with 144 additions and 48 deletions

View File

@ -4145,17 +4145,17 @@ public final class PlayerInstance extends Playable
if ((oldrelation == null) || (oldrelation != relation)) if ((oldrelation == null) || (oldrelation != relation))
{ {
final RelationChanged rc = new RelationChanged(); final RelationChanged rc = new RelationChanged();
rc.addRelation(this, relation, isAutoAttackable(player)); rc.addRelation(this, relation, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
final Summon pet = getPet(); final Summon pet = getPet();
if (pet != null) if (pet != null)
{ {
rc.addRelation(pet, relation, isAutoAttackable(player)); rc.addRelation(pet, relation, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable(player))); getServitors().values().forEach(s -> rc.addRelation(s, relation, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc); player.sendPacket(rc);
@ -6400,16 +6400,16 @@ public final class PlayerInstance extends Playable
if ((oldrelation == null) || (oldrelation != relation)) if ((oldrelation == null) || (oldrelation != relation))
{ {
final RelationChanged rc = new RelationChanged(); final RelationChanged rc = new RelationChanged();
rc.addRelation(this, relation, isAutoAttackable(player)); rc.addRelation(this, relation, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc.addRelation(_pet, relation, isAutoAttackable(player)); rc.addRelation(_pet, relation, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable(player))); getServitors().values().forEach(s -> rc.addRelation(s, relation, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc); player.sendPacket(rc);
@ -10437,6 +10437,12 @@ public final class PlayerInstance extends Playable
{ {
sendPacket(new ExStartScenePlayer(_movieHolder.getMovie())); sendPacket(new ExStartScenePlayer(_movieHolder.getMovie()));
} }
// send info to nearby players
World.getInstance().forEachVisibleObject(this, PlayerInstance.class, player ->
{
sendInfo(player);
});
} }
@Override @Override
@ -12271,32 +12277,32 @@ public final class PlayerInstance extends Playable
final int relation1 = getRelation(player); final int relation1 = getRelation(player);
final RelationChanged rc1 = new RelationChanged(); final RelationChanged rc1 = new RelationChanged();
rc1.addRelation(this, relation1, isAutoAttackable(player)); rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc1.addRelation(_pet, relation1, isAutoAttackable(player)); rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc1.addRelation(s, relation1, isAutoAttackable(player))); getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc1); player.sendPacket(rc1);
final int relation2 = player.getRelation(this); final int relation2 = player.getRelation(this);
final RelationChanged rc2 = new RelationChanged(); final RelationChanged rc2 = new RelationChanged();
rc2.addRelation(player, relation2, player.isAutoAttackable(this)); rc2.addRelation(player, relation2, !player.isInsideZone(ZoneId.PEACE));
if (player.hasSummon()) if (player.hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc2.addRelation(_pet, relation2, player.isAutoAttackable(this)); rc2.addRelation(_pet, relation2, !player.isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc2.addRelation(s, relation2, player.isAutoAttackable(this))); getServitors().values().forEach(s -> rc2.addRelation(s, relation2, !player.isInsideZone(ZoneId.PEACE)));
} }
} }
sendPacket(rc2); sendPacket(rc2);

View File

@ -63,6 +63,15 @@ public class PeaceZone extends ZoneType
{ {
creature.setInsideZone(ZoneId.NO_STORE, true); creature.setInsideZone(ZoneId.NO_STORE, true);
} }
// Send player info to nearby players.
if (creature.isPlayer())
{
World.getInstance().forEachVisibleObject(creature, PlayerInstance.class, nearby ->
{
creature.sendInfo(nearby);
});
}
} }
@Override @Override
@ -77,6 +86,15 @@ public class PeaceZone extends ZoneType
{ {
creature.setInsideZone(ZoneId.NO_STORE, false); creature.setInsideZone(ZoneId.NO_STORE, false);
} }
// Send player info to nearby players.
if (creature.isPlayer())
{
World.getInstance().forEachVisibleObject(creature, PlayerInstance.class, nearby ->
{
creature.sendInfo(nearby);
});
}
} }
@Override @Override

View File

@ -4146,17 +4146,17 @@ public final class PlayerInstance extends Playable
if ((oldrelation == null) || (oldrelation != relation)) if ((oldrelation == null) || (oldrelation != relation))
{ {
final RelationChanged rc = new RelationChanged(); final RelationChanged rc = new RelationChanged();
rc.addRelation(this, relation, isAutoAttackable(player)); rc.addRelation(this, relation, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
final Summon pet = getPet(); final Summon pet = getPet();
if (pet != null) if (pet != null)
{ {
rc.addRelation(pet, relation, isAutoAttackable(player)); rc.addRelation(pet, relation, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable(player))); getServitors().values().forEach(s -> rc.addRelation(s, relation, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc); player.sendPacket(rc);
@ -6401,16 +6401,16 @@ public final class PlayerInstance extends Playable
if ((oldrelation == null) || (oldrelation != relation)) if ((oldrelation == null) || (oldrelation != relation))
{ {
final RelationChanged rc = new RelationChanged(); final RelationChanged rc = new RelationChanged();
rc.addRelation(this, relation, isAutoAttackable(player)); rc.addRelation(this, relation, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc.addRelation(_pet, relation, isAutoAttackable(player)); rc.addRelation(_pet, relation, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable(player))); getServitors().values().forEach(s -> rc.addRelation(s, relation, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc); player.sendPacket(rc);
@ -10443,6 +10443,12 @@ public final class PlayerInstance extends Playable
{ {
sendPacket(new ExStartScenePlayer(_movieHolder.getMovie())); sendPacket(new ExStartScenePlayer(_movieHolder.getMovie()));
} }
// send info to nearby players
World.getInstance().forEachVisibleObject(this, PlayerInstance.class, player ->
{
sendInfo(player);
});
} }
@Override @Override
@ -12277,32 +12283,32 @@ public final class PlayerInstance extends Playable
final int relation1 = getRelation(player); final int relation1 = getRelation(player);
final RelationChanged rc1 = new RelationChanged(); final RelationChanged rc1 = new RelationChanged();
rc1.addRelation(this, relation1, isAutoAttackable(player)); rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc1.addRelation(_pet, relation1, isAutoAttackable(player)); rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc1.addRelation(s, relation1, isAutoAttackable(player))); getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc1); player.sendPacket(rc1);
final int relation2 = player.getRelation(this); final int relation2 = player.getRelation(this);
final RelationChanged rc2 = new RelationChanged(); final RelationChanged rc2 = new RelationChanged();
rc2.addRelation(player, relation2, player.isAutoAttackable(this)); rc2.addRelation(player, relation2, !player.isInsideZone(ZoneId.PEACE));
if (player.hasSummon()) if (player.hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc2.addRelation(_pet, relation2, player.isAutoAttackable(this)); rc2.addRelation(_pet, relation2, !player.isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc2.addRelation(s, relation2, player.isAutoAttackable(this))); getServitors().values().forEach(s -> rc2.addRelation(s, relation2, !player.isInsideZone(ZoneId.PEACE)));
} }
} }
sendPacket(rc2); sendPacket(rc2);

View File

@ -63,6 +63,15 @@ public class PeaceZone extends ZoneType
{ {
creature.setInsideZone(ZoneId.NO_STORE, true); creature.setInsideZone(ZoneId.NO_STORE, true);
} }
// Send player info to nearby players.
if (creature.isPlayer())
{
World.getInstance().forEachVisibleObject(creature, PlayerInstance.class, nearby ->
{
creature.sendInfo(nearby);
});
}
} }
@Override @Override
@ -77,6 +86,15 @@ public class PeaceZone extends ZoneType
{ {
creature.setInsideZone(ZoneId.NO_STORE, false); creature.setInsideZone(ZoneId.NO_STORE, false);
} }
// Send player info to nearby players.
if (creature.isPlayer())
{
World.getInstance().forEachVisibleObject(creature, PlayerInstance.class, nearby ->
{
creature.sendInfo(nearby);
});
}
} }
@Override @Override

View File

@ -4122,17 +4122,17 @@ public final class PlayerInstance extends Playable
if ((oldrelation == null) || (oldrelation != relation)) if ((oldrelation == null) || (oldrelation != relation))
{ {
final RelationChanged rc = new RelationChanged(); final RelationChanged rc = new RelationChanged();
rc.addRelation(this, relation, isAutoAttackable(player)); rc.addRelation(this, relation, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
final Summon pet = getPet(); final Summon pet = getPet();
if (pet != null) if (pet != null)
{ {
rc.addRelation(pet, relation, isAutoAttackable(player)); rc.addRelation(pet, relation, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable(player))); getServitors().values().forEach(s -> rc.addRelation(s, relation, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc); player.sendPacket(rc);
@ -6373,16 +6373,16 @@ public final class PlayerInstance extends Playable
if ((oldrelation == null) || (oldrelation != relation)) if ((oldrelation == null) || (oldrelation != relation))
{ {
final RelationChanged rc = new RelationChanged(); final RelationChanged rc = new RelationChanged();
rc.addRelation(this, relation, isAutoAttackable(player)); rc.addRelation(this, relation, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc.addRelation(_pet, relation, isAutoAttackable(player)); rc.addRelation(_pet, relation, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable(player))); getServitors().values().forEach(s -> rc.addRelation(s, relation, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc); player.sendPacket(rc);
@ -10375,6 +10375,12 @@ public final class PlayerInstance extends Playable
{ {
sendPacket(new ExStartScenePlayer(_movieHolder.getMovie())); sendPacket(new ExStartScenePlayer(_movieHolder.getMovie()));
} }
// send info to nearby players
World.getInstance().forEachVisibleObject(this, PlayerInstance.class, player ->
{
sendInfo(player);
});
} }
@Override @Override
@ -12126,32 +12132,32 @@ public final class PlayerInstance extends Playable
final int relation1 = getRelation(player); final int relation1 = getRelation(player);
final RelationChanged rc1 = new RelationChanged(); final RelationChanged rc1 = new RelationChanged();
rc1.addRelation(this, relation1, isAutoAttackable(player)); rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc1.addRelation(_pet, relation1, isAutoAttackable(player)); rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc1.addRelation(s, relation1, isAutoAttackable(player))); getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc1); player.sendPacket(rc1);
final int relation2 = player.getRelation(this); final int relation2 = player.getRelation(this);
final RelationChanged rc2 = new RelationChanged(); final RelationChanged rc2 = new RelationChanged();
rc2.addRelation(player, relation2, player.isAutoAttackable(this)); rc2.addRelation(player, relation2, !player.isInsideZone(ZoneId.PEACE));
if (player.hasSummon()) if (player.hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc2.addRelation(_pet, relation2, player.isAutoAttackable(this)); rc2.addRelation(_pet, relation2, !player.isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc2.addRelation(s, relation2, player.isAutoAttackable(this))); getServitors().values().forEach(s -> rc2.addRelation(s, relation2, !player.isInsideZone(ZoneId.PEACE)));
} }
} }
sendPacket(rc2); sendPacket(rc2);

View File

@ -63,6 +63,15 @@ public class PeaceZone extends ZoneType
{ {
creature.setInsideZone(ZoneId.NO_STORE, true); creature.setInsideZone(ZoneId.NO_STORE, true);
} }
// Send player info to nearby players.
if (creature.isPlayer())
{
World.getInstance().forEachVisibleObject(creature, PlayerInstance.class, nearby ->
{
creature.sendInfo(nearby);
});
}
} }
@Override @Override
@ -77,6 +86,15 @@ public class PeaceZone extends ZoneType
{ {
creature.setInsideZone(ZoneId.NO_STORE, false); creature.setInsideZone(ZoneId.NO_STORE, false);
} }
// Send player info to nearby players.
if (creature.isPlayer())
{
World.getInstance().forEachVisibleObject(creature, PlayerInstance.class, nearby ->
{
creature.sendInfo(nearby);
});
}
} }
@Override @Override

View File

@ -4122,17 +4122,17 @@ public final class PlayerInstance extends Playable
if ((oldrelation == null) || (oldrelation != relation)) if ((oldrelation == null) || (oldrelation != relation))
{ {
final RelationChanged rc = new RelationChanged(); final RelationChanged rc = new RelationChanged();
rc.addRelation(this, relation, isAutoAttackable(player)); rc.addRelation(this, relation, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
final Summon pet = getPet(); final Summon pet = getPet();
if (pet != null) if (pet != null)
{ {
rc.addRelation(pet, relation, isAutoAttackable(player)); rc.addRelation(pet, relation, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable(player))); getServitors().values().forEach(s -> rc.addRelation(s, relation, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc); player.sendPacket(rc);
@ -6373,16 +6373,16 @@ public final class PlayerInstance extends Playable
if ((oldrelation == null) || (oldrelation != relation)) if ((oldrelation == null) || (oldrelation != relation))
{ {
final RelationChanged rc = new RelationChanged(); final RelationChanged rc = new RelationChanged();
rc.addRelation(this, relation, isAutoAttackable(player)); rc.addRelation(this, relation, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc.addRelation(_pet, relation, isAutoAttackable(player)); rc.addRelation(_pet, relation, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable(player))); getServitors().values().forEach(s -> rc.addRelation(s, relation, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc); player.sendPacket(rc);
@ -10375,6 +10375,12 @@ public final class PlayerInstance extends Playable
{ {
sendPacket(new ExStartScenePlayer(_movieHolder.getMovie())); sendPacket(new ExStartScenePlayer(_movieHolder.getMovie()));
} }
// send info to nearby players
World.getInstance().forEachVisibleObject(this, PlayerInstance.class, player ->
{
sendInfo(player);
});
} }
@Override @Override
@ -12126,32 +12132,32 @@ public final class PlayerInstance extends Playable
final int relation1 = getRelation(player); final int relation1 = getRelation(player);
final RelationChanged rc1 = new RelationChanged(); final RelationChanged rc1 = new RelationChanged();
rc1.addRelation(this, relation1, isAutoAttackable(player)); rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE));
if (hasSummon()) if (hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc1.addRelation(_pet, relation1, isAutoAttackable(player)); rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc1.addRelation(s, relation1, isAutoAttackable(player))); getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE)));
} }
} }
player.sendPacket(rc1); player.sendPacket(rc1);
final int relation2 = player.getRelation(this); final int relation2 = player.getRelation(this);
final RelationChanged rc2 = new RelationChanged(); final RelationChanged rc2 = new RelationChanged();
rc2.addRelation(player, relation2, player.isAutoAttackable(this)); rc2.addRelation(player, relation2, !player.isInsideZone(ZoneId.PEACE));
if (player.hasSummon()) if (player.hasSummon())
{ {
if (_pet != null) if (_pet != null)
{ {
rc2.addRelation(_pet, relation2, player.isAutoAttackable(this)); rc2.addRelation(_pet, relation2, !player.isInsideZone(ZoneId.PEACE));
} }
if (hasServitors()) if (hasServitors())
{ {
getServitors().values().forEach(s -> rc2.addRelation(s, relation2, player.isAutoAttackable(this))); getServitors().values().forEach(s -> rc2.addRelation(s, relation2, !player.isInsideZone(ZoneId.PEACE)));
} }
} }
sendPacket(rc2); sendPacket(rc2);

View File

@ -63,6 +63,15 @@ public class PeaceZone extends ZoneType
{ {
creature.setInsideZone(ZoneId.NO_STORE, true); creature.setInsideZone(ZoneId.NO_STORE, true);
} }
// Send player info to nearby players.
if (creature.isPlayer())
{
World.getInstance().forEachVisibleObject(creature, PlayerInstance.class, nearby ->
{
creature.sendInfo(nearby);
});
}
} }
@Override @Override
@ -77,6 +86,15 @@ public class PeaceZone extends ZoneType
{ {
creature.setInsideZone(ZoneId.NO_STORE, false); creature.setInsideZone(ZoneId.NO_STORE, false);
} }
// Send player info to nearby players.
if (creature.isPlayer())
{
World.getInstance().forEachVisibleObject(creature, PlayerInstance.class, nearby ->
{
creature.sendInfo(nearby);
});
}
} }
@Override @Override