}
try
{
GArray<L2Player> full_updated = new GArray<L2Player>();
GArray<L2Player> members = party.getPartyMembers();
PartyMemberPosition just_updated = new PartyMemberPosition();
int[] lastpos;
for(L2Player member : members)
{
if(member == null)
{
continue;
}
synchronized(lastpositions)
{
lastpos = lastpositions.get(new Integer(member.getObjectId()));
if(lastpos == null)
{
just_updated.add(member);
full_updated.add(member);
lastpositions.put(member.getObjectId(), new int[]
{
member.getX(), member.getY(), member.getZ()
});
}
else if(member.getDistance(lastpos[0], lastpos[1], lastpos[2]) > 256) //TODO подкорректировать
{
just_updated.add(member);
lastpos[0] = member.getX();
lastpos[1] = member.getY();
lastpos[2] = member.getZ();
}
}
}
// посылаем изменения позиций старым членам пати
if(just_updated.size() > 0)
{
for(L2Player member : members)
{
if(!full_updated.contains(member))
{
member.sendPacket(just_updated);
}
}
}
// посылаем полный список позиций новым членам пати
if(full_updated.size() > 0)
{
just_updated = new PartyMemberPosition().add(members);
for(L2Player member : full_updated)
{
member.sendPacket(just_updated);
}
full_updated.clear();