PartyMemberPosition.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.network.serverpackets;
  16. import java.util.Map;
  17. import javolution.util.FastMap;
  18. import com.l2jserver.gameserver.model.L2Party;
  19. import com.l2jserver.gameserver.model.Location;
  20. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  21. /**
  22. * @author zabbix
  23. *
  24. */
  25. public class PartyMemberPosition extends L2GameServerPacket
  26. {
  27. Map<Integer, Location> locations = new FastMap<Integer, Location>();
  28. public PartyMemberPosition(L2Party party)
  29. {
  30. reuse(party);
  31. }
  32. public void reuse(L2Party party)
  33. {
  34. locations.clear();
  35. for (L2PcInstance member : party.getPartyMembers())
  36. {
  37. if (member == null)
  38. continue;
  39. locations.put(member.getObjectId(), new Location(member));
  40. }
  41. }
  42. @Override
  43. protected void writeImpl()
  44. {
  45. writeC(0xba);
  46. writeD(locations.size());
  47. for (Map.Entry<Integer, Location> entry : locations.entrySet())
  48. {
  49. Location loc = entry.getValue();
  50. writeD(entry.getKey());
  51. writeD(loc.getX());
  52. writeD(loc.getY());
  53. writeD(loc.getZ());
  54. }
  55. }
  56. @Override
  57. public String getType()
  58. {
  59. return "[S] ba PartyMemberPosition";
  60. }
  61. }