AgitDecoInfo.java 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /*
  2. * Copyright (C) 2004-2015 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.network.serverpackets;
  20. import com.l2jserver.gameserver.model.entity.ClanHall;
  21. import com.l2jserver.gameserver.model.entity.ClanHall.ClanHallFunction;
  22. import com.l2jserver.gameserver.model.entity.clanhall.AuctionableHall;
  23. /**
  24. * @author Steuf
  25. */
  26. public class AgitDecoInfo extends L2GameServerPacket
  27. {
  28. private final AuctionableHall _clanHall;
  29. public AgitDecoInfo(AuctionableHall ClanHall)
  30. {
  31. _clanHall = ClanHall;
  32. }
  33. //@formatter:off
  34. /*
  35. * Packet send, must be confirmed
  36. writeC(0xf7);
  37. writeD(0); // clanhall id
  38. writeC(0); // FUNC_RESTORE_HP (Fireplace)
  39. writeC(0); // FUNC_RESTORE_MP (Carpet)
  40. writeC(0); // FUNC_RESTORE_MP (Statue)
  41. writeC(0); // FUNC_RESTORE_EXP (Chandelier)
  42. writeC(0); // FUNC_TELEPORT (Mirror)
  43. writeC(0); // Crytal
  44. writeC(0); // Curtain
  45. writeC(0); // FUNC_ITEM_CREATE (Magic Curtain)
  46. writeC(0); // FUNC_SUPPORT
  47. writeC(0); // FUNC_SUPPORT (Flag)
  48. writeC(0); // Front Platform
  49. writeC(0); // FUNC_ITEM_CREATE
  50. writeD(0);
  51. writeD(0);
  52. */
  53. //@formatter:on
  54. @Override
  55. protected final void writeImpl()
  56. {
  57. writeC(0xfd);
  58. writeD(_clanHall.getId()); // clanhall id
  59. // FUNC_RESTORE_HP
  60. ClanHallFunction function = _clanHall.getFunction(ClanHall.FUNC_RESTORE_HP);
  61. if ((function == null) || (function.getLvl() == 0))
  62. {
  63. writeC(0);
  64. }
  65. else if (((_clanHall.getGrade() == 0) && (function.getLvl() < 220)) || ((_clanHall.getGrade() == 1) && (function.getLvl() < 160)) || ((_clanHall.getGrade() == 2) && (function.getLvl() < 260)) || ((_clanHall.getGrade() == 3) && (function.getLvl() < 300)))
  66. {
  67. writeC(1);
  68. }
  69. else
  70. {
  71. writeC(2);
  72. }
  73. // FUNC_RESTORE_MP
  74. function = _clanHall.getFunction(ClanHall.FUNC_RESTORE_MP);
  75. if ((function == null) || (function.getLvl() == 0))
  76. {
  77. writeC(0);
  78. writeC(0);
  79. }
  80. else if ((((_clanHall.getGrade() == 0) || (_clanHall.getGrade() == 1)) && (function.getLvl() < 25)) || ((_clanHall.getGrade() == 2) && (function.getLvl() < 30)) || ((_clanHall.getGrade() == 3) && (function.getLvl() < 40)))
  81. {
  82. writeC(1);
  83. writeC(1);
  84. }
  85. else
  86. {
  87. writeC(2);
  88. writeC(2);
  89. }
  90. // FUNC_RESTORE_EXP
  91. function = _clanHall.getFunction(ClanHall.FUNC_RESTORE_EXP);
  92. if ((function == null) || (function.getLvl() == 0))
  93. {
  94. writeC(0);
  95. }
  96. else if (((_clanHall.getGrade() == 0) && (function.getLvl() < 25)) || ((_clanHall.getGrade() == 1) && (function.getLvl() < 30)) || ((_clanHall.getGrade() == 2) && (function.getLvl() < 40)) || ((_clanHall.getGrade() == 3) && (function.getLvl() < 50)))
  97. {
  98. writeC(1);
  99. }
  100. else
  101. {
  102. writeC(2);
  103. }
  104. // FUNC_TELEPORT
  105. function = _clanHall.getFunction(ClanHall.FUNC_TELEPORT);
  106. if ((function == null) || (function.getLvl() == 0))
  107. {
  108. writeC(0);
  109. }
  110. else if (function.getLvl() < 2)
  111. {
  112. writeC(1);
  113. }
  114. else
  115. {
  116. writeC(2);
  117. }
  118. writeC(0);
  119. // CURTAINS
  120. function = _clanHall.getFunction(ClanHall.FUNC_DECO_CURTAINS);
  121. if ((function == null) || (function.getLvl() == 0))
  122. {
  123. writeC(0);
  124. }
  125. else if (function.getLvl() <= 1)
  126. {
  127. writeC(1);
  128. }
  129. else
  130. {
  131. writeC(2);
  132. }
  133. // FUNC_ITEM_CREATE
  134. function = _clanHall.getFunction(ClanHall.FUNC_ITEM_CREATE);
  135. if ((function == null) || (function.getLvl() == 0))
  136. {
  137. writeC(0);
  138. }
  139. else if (((_clanHall.getGrade() == 0) && (function.getLvl() < 2)) || (function.getLvl() < 3))
  140. {
  141. writeC(1);
  142. }
  143. else
  144. {
  145. writeC(2);
  146. }
  147. // FUNC_SUPPORT
  148. function = _clanHall.getFunction(ClanHall.FUNC_SUPPORT);
  149. if ((function == null) || (function.getLvl() == 0))
  150. {
  151. writeC(0);
  152. writeC(0);
  153. }
  154. else if (((_clanHall.getGrade() == 0) && (function.getLvl() < 2)) || ((_clanHall.getGrade() == 1) && (function.getLvl() < 4)) || ((_clanHall.getGrade() == 2) && (function.getLvl() < 5)) || ((_clanHall.getGrade() == 3) && (function.getLvl() < 8)))
  155. {
  156. writeC(1);
  157. writeC(1);
  158. }
  159. else
  160. {
  161. writeC(2);
  162. writeC(2);
  163. }
  164. // Front Plateform
  165. function = _clanHall.getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM);
  166. if ((function == null) || (function.getLvl() == 0))
  167. {
  168. writeC(0);
  169. }
  170. else if (function.getLvl() <= 1)
  171. {
  172. writeC(1);
  173. }
  174. else
  175. {
  176. writeC(2);
  177. }
  178. // FUNC_ITEM_CREATE
  179. function = _clanHall.getFunction(ClanHall.FUNC_ITEM_CREATE);
  180. if ((function == null) || (function.getLvl() == 0))
  181. {
  182. writeC(0);
  183. }
  184. else if (((_clanHall.getGrade() == 0) && (function.getLvl() < 2)) || (function.getLvl() < 3))
  185. {
  186. writeC(1);
  187. }
  188. else
  189. {
  190. writeC(2);
  191. }
  192. writeD(0);
  193. writeD(0);
  194. }
  195. }