AgitDecoInfo.java 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 com.l2jserver.gameserver.model.entity.ClanHall;
  17. import com.l2jserver.gameserver.model.entity.ClanHall.ClanHallFunction;
  18. /**
  19. *
  20. * @author Steuf
  21. */
  22. public class AgitDecoInfo extends L2GameServerPacket
  23. {
  24. private static final String _S__F7_AGITDECOINFO = "[S] fd AgitDecoInfo";
  25. private ClanHall _clanHall;
  26. private ClanHallFunction _function;
  27. public AgitDecoInfo(ClanHall ClanHall){
  28. _clanHall = ClanHall;
  29. }
  30. /*
  31. * Packet send, must be confirmed
  32. writeC(0xf7);
  33. writeD(0); // clanhall id
  34. writeC(0); // FUNC_RESTORE_HP (Fireplace)
  35. writeC(0); // FUNC_RESTORE_MP (Carpet)
  36. writeC(0); // FUNC_RESTORE_MP (Statue)
  37. writeC(0); // FUNC_RESTORE_EXP (Chandelier)
  38. writeC(0); // FUNC_TELEPORT (Mirror)
  39. writeC(0); // Crytal
  40. writeC(0); // Curtain
  41. writeC(0); // FUNC_ITEM_CREATE (Magic Curtain)
  42. writeC(0); // FUNC_SUPPORT
  43. writeC(0); // FUNC_SUPPORT (Flag)
  44. writeC(0); // Front Platform
  45. writeC(0); // FUNC_ITEM_CREATE
  46. writeD(0);
  47. writeD(0);
  48. */
  49. @Override
  50. protected final void writeImpl(){
  51. writeC(0xfd);
  52. writeD(_clanHall.getId()); // clanhall id
  53. //FUNC_RESTORE_HP
  54. _function = _clanHall.getFunction(ClanHall.FUNC_RESTORE_HP);
  55. if(_function == null || _function.getLvl() == 0)
  56. writeC(0);
  57. else if((_clanHall.getGrade() == 0 && _function.getLvl() < 220) || (_clanHall.getGrade() == 1 && _function.getLvl() < 160) ||
  58. (_clanHall.getGrade() == 2 && _function.getLvl() < 260) || (_clanHall.getGrade() == 3 && _function.getLvl() < 300))
  59. writeC(1);
  60. else
  61. writeC(2);
  62. //FUNC_RESTORE_MP
  63. _function = _clanHall.getFunction(ClanHall.FUNC_RESTORE_MP);
  64. if(_function == null || _function.getLvl() == 0){
  65. writeC(0);
  66. writeC(0);
  67. }else if(((_clanHall.getGrade() == 0 || _clanHall.getGrade() == 1) && _function.getLvl() < 25) ||
  68. (_clanHall.getGrade() == 2 && _function.getLvl() < 30) || (_clanHall.getGrade() == 3 && _function.getLvl() < 40)){
  69. writeC(1);
  70. writeC(1);
  71. }else {
  72. writeC(2);
  73. writeC(2);
  74. }
  75. //FUNC_RESTORE_EXP
  76. _function = _clanHall.getFunction(ClanHall.FUNC_RESTORE_EXP);
  77. if(_function == null || _function.getLvl() == 0)
  78. writeC(0);
  79. else if((_clanHall.getGrade() == 0 && _function.getLvl() < 25) || (_clanHall.getGrade() == 1 && _function.getLvl() < 30) ||
  80. (_clanHall.getGrade() == 2 && _function.getLvl() < 40) || (_clanHall.getGrade() == 3 && _function.getLvl() < 50))
  81. writeC(1);
  82. else
  83. writeC(2);
  84. // FUNC_TELEPORT
  85. _function = _clanHall.getFunction(ClanHall.FUNC_TELEPORT);
  86. if(_function == null || _function.getLvl() == 0)
  87. writeC(0);
  88. else if(_function.getLvl() < 2)
  89. writeC(1);
  90. else
  91. writeC(2);
  92. writeC(0);
  93. //CURTAINS
  94. _function = _clanHall.getFunction(ClanHall.FUNC_DECO_CURTAINS);
  95. if(_function == null || _function.getLvl() == 0)
  96. writeC(0);
  97. else if(_function.getLvl() <= 1)
  98. writeC(1);
  99. else
  100. writeC(2);
  101. //FUNC_ITEM_CREATE
  102. _function = _clanHall.getFunction(ClanHall.FUNC_ITEM_CREATE);
  103. if(_function == null || _function.getLvl() == 0)
  104. writeC(0);
  105. else if((_clanHall.getGrade() == 0 && _function.getLvl() < 2) || _function.getLvl() < 3)
  106. writeC(1);
  107. else
  108. writeC(2);
  109. // FUNC_SUPPORT
  110. _function = _clanHall.getFunction(ClanHall.FUNC_SUPPORT);
  111. if(_function == null || _function.getLvl() == 0){
  112. writeC(0);
  113. writeC(0);
  114. }else if((_clanHall.getGrade() == 0 && _function.getLvl() < 2) || (_clanHall.getGrade() == 1 && _function.getLvl() < 4) ||
  115. (_clanHall.getGrade() == 2 && _function.getLvl() < 5) || (_clanHall.getGrade() == 3 && _function.getLvl() < 8)){
  116. writeC(1);
  117. writeC(1);
  118. }else{
  119. writeC(2);
  120. writeC(2);
  121. }
  122. //Front Plateform
  123. _function = _clanHall.getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM);
  124. if(_function == null || _function.getLvl() == 0)
  125. writeC(0);
  126. else if(_function.getLvl() <= 1)
  127. writeC(1);
  128. else
  129. writeC(2);
  130. //FUNC_ITEM_CREATE
  131. _function = _clanHall.getFunction(ClanHall.FUNC_ITEM_CREATE);
  132. if(_function == null || _function.getLvl() == 0)
  133. writeC(0);
  134. else if((_clanHall.getGrade() == 0 && _function.getLvl() < 2) || _function.getLvl() < 3)
  135. writeC(1);
  136. else
  137. writeC(2);
  138. writeD(0);
  139. writeD(0);
  140. }
  141. @Override
  142. public String getType()
  143. {
  144. return _S__F7_AGITDECOINFO;
  145. }
  146. }