Update relations when needed at broadcastCharInfo method.

Thanks to DebiaN.
This commit is contained in:
MobiusDevelopment 2021-10-24 13:33:45 +00:00
parent 7c4f31076d
commit 3be891c5e0
2 changed files with 32 additions and 0 deletions

View File

@ -4219,6 +4219,22 @@ public class PlayerInstance extends Playable
{
player.sendPacket(charInfo);
}
// Update relation.
final int relation = getRelation(player);
final boolean isAutoAttackable = isAutoAttackable(player);
final RelationCache oldrelation = getKnownRelations().get(player.getObjectId());
if ((oldrelation == null) || (oldrelation.getRelation() != relation) || (oldrelation.isAutoAttackable() != isAutoAttackable))
{
final RelationChanged rc = new RelationChanged();
rc.addRelation(this, relation, isAutoAttackable);
if (hasSummon())
{
player.sendPacket(new RelationChanged(_summon, getRelation(player), isAutoAttackable(player)));
}
player.sendPacket(rc);
getKnownRelations().put(player.getObjectId(), new RelationCache(relation, isAutoAttackable));
}
}
});
}

View File

@ -4109,6 +4109,22 @@ public class PlayerInstance extends Playable
{
player.sendPacket(charInfo);
}
// Update relation.
final int relation = getRelation(player);
final boolean isAutoAttackable = isAutoAttackable(player);
final RelationCache oldrelation = getKnownRelations().get(player.getObjectId());
if ((oldrelation == null) || (oldrelation.getRelation() != relation) || (oldrelation.isAutoAttackable() != isAutoAttackable))
{
final RelationChanged rc = new RelationChanged();
rc.addRelation(this, relation, isAutoAttackable);
if (hasSummon())
{
player.sendPacket(new RelationChanged(_summon, getRelation(player), isAutoAttackable(player)));
}
player.sendPacket(rc);
getKnownRelations().put(player.getObjectId(), new RelationCache(relation, isAutoAttackable));
}
}
});
}