ExReplyDominionInfo.java 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.CastleManager;
  18. import com.l2jserver.gameserver.instancemanager.TerritoryWarManager;
  19. import com.l2jserver.gameserver.instancemanager.TerritoryWarManager.Territory;
  20. /**
  21. *
  22. * @author JIV
  23. */
  24. public class ExReplyDominionInfo extends L2GameServerPacket
  25. {
  26. /**
  27. * @see com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket#getType()
  28. */
  29. // private static Logger _log = Logger.getLogger(ExReplyDominionInfo.class.getName());
  30. private int _warTime = (int) (TerritoryWarManager.getInstance().getTWStartTimeInMillis() / 1000);
  31. /**
  32. * @see com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket#writeImpl()
  33. */
  34. @Override
  35. protected void writeImpl()
  36. {
  37. writeC(0xfe);
  38. writeH(0x92);
  39. FastList<Territory> territoryList = TerritoryWarManager.getInstance().getAllTerritories();
  40. writeD(territoryList.size()); // Territory Count
  41. for (Territory t : territoryList)
  42. {
  43. writeD(t.getTerritoryId()); // Territory Id
  44. writeS(CastleManager.getInstance().getCastleById(t.getCastleId()).getName().toLowerCase() + "_dominion"); // territory name
  45. writeS(t.getOwnerClan().getName());
  46. writeD(t.getOwnedWardIds().size()); // Emblem Count
  47. for(int i:t.getOwnedWardIds())
  48. writeD(i); // Emblem ID - should be in for loop for emblem count
  49. writeD(_warTime);
  50. }
  51. }
  52. @Override
  53. public String getType()
  54. {
  55. return "[S] FE:92 ExReplyDominionInfo";
  56. }
  57. }