2
0

ExShowOwnthingPos.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 javolution.util.FastList;
  17. import com.l2jserver.gameserver.instancemanager.TerritoryWarManager;
  18. import com.l2jserver.gameserver.model.TerritoryWard;
  19. /**
  20. * Format: (ch) d[dddd]
  21. *
  22. * @author -Gigiikun-
  23. */
  24. public class ExShowOwnthingPos extends L2GameServerPacket
  25. {
  26. private static final String _S__FE_93_EXSHOWOWNTHINGPOS = "[S] FE:93 ExShowOwnthingPos";
  27. public ExShowOwnthingPos()
  28. {
  29. }
  30. /**
  31. * @see com.l2jserver.gameserver.serverpackets.ServerBasePacket#writeImpl()
  32. */
  33. @Override
  34. protected void writeImpl()
  35. {
  36. writeC(0xfe);
  37. writeH(0x93);
  38. if (TerritoryWarManager.getInstance().isTWInProgress())
  39. {
  40. FastList<TerritoryWard> territoryWardList = TerritoryWarManager.getInstance().getAllTerritoryWards();
  41. writeD(territoryWardList.size());
  42. for(TerritoryWard ward : territoryWardList)
  43. {
  44. writeD(ward.getTerritoryId());
  45. if (ward.getNpc() != null)
  46. {
  47. writeD(ward.getNpc().getX());
  48. writeD(ward.getNpc().getY());
  49. writeD(ward.getNpc().getZ());
  50. }
  51. else if (ward.getPlayer() != null)
  52. {
  53. writeD(ward.getPlayer().getX());
  54. writeD(ward.getPlayer().getY());
  55. writeD(ward.getPlayer().getZ());
  56. }
  57. else if (ward.getItemInstance() != null)
  58. {
  59. writeD(ward.getItemInstance().getX());
  60. writeD(ward.getItemInstance().getY());
  61. writeD(ward.getItemInstance().getZ());
  62. }
  63. else
  64. {
  65. writeD(0);
  66. writeD(0);
  67. writeD(0);
  68. }
  69. }
  70. }
  71. else
  72. {
  73. writeD(0);
  74. writeD(0);
  75. }
  76. }
  77. /**
  78. * @see com.l2jserver.gameserver.BasePacket#getType()
  79. */
  80. @Override
  81. public String getType()
  82. {
  83. return _S__FE_93_EXSHOWOWNTHINGPOS;
  84. }
  85. }