List<L2GameServerPacket> addInfo = new ArrayList<>(4 + (_members.size() * 4));
List<L2GameServerPacket> pplayer = new ArrayList<>(20);
pplayer.add(new PartySmallWindowAll(this, player));
pplayer.add(new SystemMessage(SystemMessage.YOU_HAVE_JOINED_S1S_PARTY).addName(leader));
addInfo.add(new SystemMessage(SystemMessage.S1_HAS_JOINED_THE_PARTY).addName(player));
addInfo.add(new PartySpelled(player, true));
for (Summon summon : player.getSummonList())
{
addInfo.add(new ExPartyPetWindowAdd(summon));
addInfo.add(new PartySpelled(summon, true));
}
PartyMemberPosition pmp = new PartyMemberPosition();
List<L2GameServerPacket> pmember;
for (Player member : _members)
{
if (member != player)
{
pmember = new ArrayList<>(addInfo.size() + 4);
pmember.addAll(addInfo);
if (_members.size() == 2)
{
pmember.add(new PartySmallWindowAll(this, member));
}
else
{
pmember.add(new PartySmallWindowAdd(member, player, getLootDistribution()));
}
pmember.add(new PartyMemberPosition().add(player));
pmember.add(RelationChanged.update(member, player, member));
member.sendPacket(pmember);
pplayer.add(new PartySpelled(member, true));
for (Summon summon : member.getSummonList())
{
pplayer.add(new PartySpelled(summon, true));
}
pplayer.add(RelationChanged.update(player, member, player));
pmp.add(member);
}
}