Advertisement
CostyKiller

homunculus client packets update

Jun 3rd, 2021
1,245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 63.13 KB | None | 0 0
  1. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusCreateStart.java
  2. ===================================================================
  3. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusCreateStart.java (revision 8809)
  4. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusCreateStart.java (nonexistent)
  5. @@ -1,69 +0,0 @@
  6. -/*
  7. - * This file is part of the L2J Mobius project.
  8. - *
  9. - * This program is free software: you can redistribute it and/or modify
  10. - * it under the terms of the GNU General Public License as published by
  11. - * the Free Software Foundation, either version 3 of the License, or
  12. - * (at your option) any later version.
  13. - *
  14. - * This program is distributed in the hope that it will be useful,
  15. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. - * General Public License for more details.
  18. - *
  19. - * You should have received a copy of the GNU General Public License
  20. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. - */
  22. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  23. -
  24. -import org.l2jmobius.commons.network.PacketReader;
  25. -import org.l2jmobius.commons.util.Chronos;
  26. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  27. -import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  28. -import org.l2jmobius.gameserver.network.GameClient;
  29. -import org.l2jmobius.gameserver.network.SystemMessageId;
  30. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  31. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusBirthInfo;
  32. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusCreateStartResult;
  33. -
  34. -/**
  35. - * @author Mobius
  36. - */
  37. -public class ExHomunculusCreateStart implements IClientIncomingPacket
  38. -{
  39. -   private static final int COST = 1000000;
  40. -  
  41. -   @Override
  42. -   public boolean read(GameClient client, PacketReader packet)
  43. -   {
  44. -       return true;
  45. -   }
  46. -  
  47. -   @Override
  48. -   public void run(GameClient client)
  49. -   {
  50. -       final PlayerInstance player = client.getPlayer();
  51. -       if (player == null)
  52. -       {
  53. -           return;
  54. -       }
  55. -      
  56. -       final int status = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_STATUS, 0);
  57. -       if (status > 0)
  58. -       {
  59. -           return;
  60. -       }
  61. -      
  62. -       if (player.getAdena() < COST)
  63. -       {
  64. -           player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA_2);
  65. -           return;
  66. -       }
  67. -       player.reduceAdena("Homunculus creation", COST, player, true);
  68. -       player.getVariables().set(PlayerVariables.HOMUNCULUS_STATUS, 1);
  69. -       player.getVariables().set(PlayerVariables.HOMUNCULUS_TIME, Chronos.currentTimeMillis() / 1000);
  70. -      
  71. -       client.sendPacket(new ExHomonculusBirthInfo(player));
  72. -       client.sendPacket(new ExHomonculusCreateStartResult(player));
  73. -   }
  74. -}
  75. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusDeleteData.java
  76. ===================================================================
  77. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusDeleteData.java  (revision 8809)
  78. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusDeleteData.java  (nonexistent)
  79. @@ -1,62 +0,0 @@
  80. -/*
  81. - * This file is part of the L2J Mobius project.
  82. - *
  83. - * This program is free software: you can redistribute it and/or modify
  84. - * it under the terms of the GNU General Public License as published by
  85. - * the Free Software Foundation, either version 3 of the License, or
  86. - * (at your option) any later version.
  87. - *
  88. - * This program is distributed in the hope that it will be useful,
  89. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  90. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  91. - * General Public License for more details.
  92. - *
  93. - * You should have received a copy of the GNU General Public License
  94. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  95. - */
  96. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  97. -
  98. -import org.l2jmobius.commons.network.PacketReader;
  99. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  100. -import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  101. -import org.l2jmobius.gameserver.network.GameClient;
  102. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  103. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusBirthInfo;
  104. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
  105. -
  106. -/**
  107. - * @author Mobius
  108. - */
  109. -public class ExHomunculusDeleteData implements IClientIncomingPacket
  110. -{
  111. -   @Override
  112. -   public boolean read(GameClient client, PacketReader packet)
  113. -   {
  114. -       packet.readD(); // Position?
  115. -       return true;
  116. -   }
  117. -  
  118. -   @Override
  119. -   public void run(GameClient client)
  120. -   {
  121. -       final PlayerInstance player = client.getPlayer();
  122. -       if (player == null)
  123. -       {
  124. -           return;
  125. -       }
  126. -      
  127. -       player.getVariables().remove(PlayerVariables.HOMUNCULUS_STATUS);
  128. -       player.getVariables().remove(PlayerVariables.HOMUNCULUS_TIME);
  129. -       player.getVariables().remove(PlayerVariables.HOMUNCULUS_HP);
  130. -       player.getVariables().remove(PlayerVariables.HOMUNCULUS_SP);
  131. -       player.getVariables().remove(PlayerVariables.HOMUNCULUS_VP);
  132. -       player.getVariables().remove(PlayerVariables.HOMUNCULUS_ID);
  133. -       player.getVariables().remove(PlayerVariables.HOMUNCULUS_QUALITY);
  134. -      
  135. -       player.calculateHomunculusBonuses();
  136. -       player.getStat().recalculateStats(true);
  137. -      
  138. -       client.sendPacket(new ExHomonculusList(player));
  139. -       client.sendPacket(new ExHomonculusBirthInfo(player));
  140. -   }
  141. -}
  142. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantExperience.java
  143. ===================================================================
  144. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantExperience.java   (revision 8809)
  145. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantExperience.java   (nonexistent)
  146. @@ -1,47 +0,0 @@
  147. -/*
  148. - * This file is part of the L2J Mobius project.
  149. - *
  150. - * This program is free software: you can redistribute it and/or modify
  151. - * it under the terms of the GNU General Public License as published by
  152. - * the Free Software Foundation, either version 3 of the License, or
  153. - * (at your option) any later version.
  154. - *
  155. - * This program is distributed in the hope that it will be useful,
  156. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  157. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  158. - * General Public License for more details.
  159. - *
  160. - * You should have received a copy of the GNU General Public License
  161. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  162. - */
  163. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  164. -
  165. -import org.l2jmobius.commons.network.PacketReader;
  166. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  167. -import org.l2jmobius.gameserver.network.GameClient;
  168. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  169. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
  170. -
  171. -/**
  172. - * @author Mobius
  173. - */
  174. -public class ExHomunculusEnchantExperience implements IClientIncomingPacket
  175. -{
  176. -   @Override
  177. -   public boolean read(GameClient client, PacketReader packet)
  178. -   {
  179. -       return true;
  180. -   }
  181. -  
  182. -   @Override
  183. -   public void run(GameClient client)
  184. -   {
  185. -       final PlayerInstance player = client.getPlayer();
  186. -       if (player == null)
  187. -       {
  188. -           return;
  189. -       }
  190. -      
  191. -       client.sendPacket(new ExHomonculusList(player));
  192. -   }
  193. -}
  194. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantPoint.java
  195. ===================================================================
  196. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantPoint.java    (revision 8809)
  197. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantPoint.java    (nonexistent)
  198. @@ -1,47 +0,0 @@
  199. -/*
  200. - * This file is part of the L2J Mobius project.
  201. - *
  202. - * This program is free software: you can redistribute it and/or modify
  203. - * it under the terms of the GNU General Public License as published by
  204. - * the Free Software Foundation, either version 3 of the License, or
  205. - * (at your option) any later version.
  206. - *
  207. - * This program is distributed in the hope that it will be useful,
  208. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  209. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  210. - * General Public License for more details.
  211. - *
  212. - * You should have received a copy of the GNU General Public License
  213. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  214. - */
  215. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  216. -
  217. -import org.l2jmobius.commons.network.PacketReader;
  218. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  219. -import org.l2jmobius.gameserver.network.GameClient;
  220. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  221. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
  222. -
  223. -/**
  224. - * @author Mobius
  225. - */
  226. -public class ExHomunculusEnchantPoint implements IClientIncomingPacket
  227. -{
  228. -   @Override
  229. -   public boolean read(GameClient client, PacketReader packet)
  230. -   {
  231. -       return true;
  232. -   }
  233. -  
  234. -   @Override
  235. -   public void run(GameClient client)
  236. -   {
  237. -       final PlayerInstance player = client.getPlayer();
  238. -       if (player == null)
  239. -       {
  240. -           return;
  241. -       }
  242. -      
  243. -       player.sendPacket(new ExHomunculusPointInfo(player));
  244. -   }
  245. -}
  246. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantSkill.java
  247. ===================================================================
  248. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantSkill.java    (revision 8809)
  249. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEnchantSkill.java    (nonexistent)
  250. @@ -1,47 +0,0 @@
  251. -/*
  252. - * This file is part of the L2J Mobius project.
  253. - *
  254. - * This program is free software: you can redistribute it and/or modify
  255. - * it under the terms of the GNU General Public License as published by
  256. - * the Free Software Foundation, either version 3 of the License, or
  257. - * (at your option) any later version.
  258. - *
  259. - * This program is distributed in the hope that it will be useful,
  260. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  261. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  262. - * General Public License for more details.
  263. - *
  264. - * You should have received a copy of the GNU General Public License
  265. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  266. - */
  267. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  268. -
  269. -import org.l2jmobius.commons.network.PacketReader;
  270. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  271. -import org.l2jmobius.gameserver.network.GameClient;
  272. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  273. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
  274. -
  275. -/**
  276. - * @author Mobius
  277. - */
  278. -public class ExHomunculusEnchantSkill implements IClientIncomingPacket
  279. -{
  280. -   @Override
  281. -   public boolean read(GameClient client, PacketReader packet)
  282. -   {
  283. -       return true;
  284. -   }
  285. -  
  286. -   @Override
  287. -   public void run(GameClient client)
  288. -   {
  289. -       final PlayerInstance player = client.getPlayer();
  290. -       if (player == null)
  291. -       {
  292. -           return;
  293. -       }
  294. -      
  295. -       client.sendPacket(new ExHomonculusList(player));
  296. -   }
  297. -}
  298. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEvolve.java
  299. ===================================================================
  300. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEvolve.java  (revision 8809)
  301. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusEvolve.java  (nonexistent)
  302. @@ -1,47 +0,0 @@
  303. -/*
  304. - * This file is part of the L2J Mobius project.
  305. - *
  306. - * This program is free software: you can redistribute it and/or modify
  307. - * it under the terms of the GNU General Public License as published by
  308. - * the Free Software Foundation, either version 3 of the License, or
  309. - * (at your option) any later version.
  310. - *
  311. - * This program is distributed in the hope that it will be useful,
  312. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  313. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  314. - * General Public License for more details.
  315. - *
  316. - * You should have received a copy of the GNU General Public License
  317. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  318. - */
  319. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  320. -
  321. -import org.l2jmobius.commons.network.PacketReader;
  322. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  323. -import org.l2jmobius.gameserver.network.GameClient;
  324. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  325. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
  326. -
  327. -/**
  328. - * @author Mobius
  329. - */
  330. -public class ExHomunculusEvolve implements IClientIncomingPacket
  331. -{
  332. -   @Override
  333. -   public boolean read(GameClient client, PacketReader packet)
  334. -   {
  335. -       return true;
  336. -   }
  337. -  
  338. -   @Override
  339. -   public void run(GameClient client)
  340. -   {
  341. -       final PlayerInstance player = client.getPlayer();
  342. -       if (player == null)
  343. -       {
  344. -           return;
  345. -       }
  346. -      
  347. -       client.sendPacket(new ExHomonculusList(player));
  348. -   }
  349. -}
  350. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInitPoint.java
  351. ===================================================================
  352. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInitPoint.java   (revision 8809)
  353. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInitPoint.java   (nonexistent)
  354. @@ -1,47 +0,0 @@
  355. -/*
  356. - * This file is part of the L2J Mobius project.
  357. - *
  358. - * This program is free software: you can redistribute it and/or modify
  359. - * it under the terms of the GNU General Public License as published by
  360. - * the Free Software Foundation, either version 3 of the License, or
  361. - * (at your option) any later version.
  362. - *
  363. - * This program is distributed in the hope that it will be useful,
  364. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  365. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  366. - * General Public License for more details.
  367. - *
  368. - * You should have received a copy of the GNU General Public License
  369. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  370. - */
  371. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  372. -
  373. -import org.l2jmobius.commons.network.PacketReader;
  374. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  375. -import org.l2jmobius.gameserver.network.GameClient;
  376. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  377. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
  378. -
  379. -/**
  380. - * @author Mobius
  381. - */
  382. -public class ExHomunculusInitPoint implements IClientIncomingPacket
  383. -{
  384. -   @Override
  385. -   public boolean read(GameClient client, PacketReader packet)
  386. -   {
  387. -       return true;
  388. -   }
  389. -  
  390. -   @Override
  391. -   public void run(GameClient client)
  392. -   {
  393. -       final PlayerInstance player = client.getPlayer();
  394. -       if (player == null)
  395. -       {
  396. -           return;
  397. -       }
  398. -      
  399. -       player.sendPacket(new ExHomunculusPointInfo(player));
  400. -   }
  401. -}
  402. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInsert.java
  403. ===================================================================
  404. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInsert.java  (revision 8809)
  405. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusInsert.java  (nonexistent)
  406. @@ -1,149 +0,0 @@
  407. -/*
  408. - * This file is part of the L2J Mobius project.
  409. - *
  410. - * This program is free software: you can redistribute it and/or modify
  411. - * it under the terms of the GNU General Public License as published by
  412. - * the Free Software Foundation, either version 3 of the License, or
  413. - * (at your option) any later version.
  414. - *
  415. - * This program is distributed in the hope that it will be useful,
  416. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  417. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  418. - * General Public License for more details.
  419. - *
  420. - * You should have received a copy of the GNU General Public License
  421. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  422. - */
  423. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  424. -
  425. -import org.l2jmobius.commons.network.PacketReader;
  426. -import org.l2jmobius.commons.util.Chronos;
  427. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  428. -import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  429. -import org.l2jmobius.gameserver.network.GameClient;
  430. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  431. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusBirthInfo;
  432. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusInsertHpSpVp;
  433. -
  434. -/**
  435. - * @author Mobius
  436. - */
  437. -public class ExHomunculusInsert implements IClientIncomingPacket
  438. -{
  439. -   private int _type;
  440. -  
  441. -   @Override
  442. -   public boolean read(GameClient client, PacketReader packet)
  443. -   {
  444. -       _type = packet.readD();
  445. -       return true;
  446. -   }
  447. -  
  448. -   @Override
  449. -   public void run(GameClient client)
  450. -   {
  451. -       final PlayerInstance player = client.getPlayer();
  452. -       if (player == null)
  453. -       {
  454. -           return;
  455. -       }
  456. -      
  457. -       final int time = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_TIME, 0);
  458. -       if (((Chronos.currentTimeMillis() / 1000) - time) < 86400)
  459. -       {
  460. -           player.sendMessage("Waiting time has not passed.");
  461. -           return;
  462. -       }
  463. -      
  464. -       switch (_type)
  465. -       {
  466. -           case 0: // hp
  467. -           {
  468. -               if (player.getCurrentHp() >= 10000)
  469. -               {
  470. -                   player.setCurrentHp(player.getCurrentHp() - 10000);
  471. -                   final int hp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP, 0);
  472. -                   if (hp < 99)
  473. -                   {
  474. -                       player.getVariables().set(PlayerVariables.HOMUNCULUS_HP, hp + 1);
  475. -                   }
  476. -                   else
  477. -                   {
  478. -                       player.getVariables().set(PlayerVariables.HOMUNCULUS_HP, 100);
  479. -                      
  480. -                       final int status = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_STATUS, 0);
  481. -                       if (status == 1)
  482. -                       {
  483. -                           player.getVariables().set(PlayerVariables.HOMUNCULUS_STATUS, 2);
  484. -                       }
  485. -                   }
  486. -                   player.getVariables().set(PlayerVariables.HOMUNCULUS_TIME, Chronos.currentTimeMillis() / 1000);
  487. -               }
  488. -               else
  489. -               {
  490. -                   return;
  491. -               }
  492. -               break;
  493. -           }
  494. -           case 1: // sp
  495. -           {
  496. -               if (player.getSp() >= 5000000000L)
  497. -               {
  498. -                   player.setSp(player.getSp() - 5000000000L);
  499. -                   final int sp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP, 0);
  500. -                   if (sp < 9)
  501. -                   {
  502. -                       player.getVariables().set(PlayerVariables.HOMUNCULUS_SP, sp + 1);
  503. -                   }
  504. -                   else
  505. -                   {
  506. -                       player.getVariables().set(PlayerVariables.HOMUNCULUS_SP, 10);
  507. -                      
  508. -                       final int status = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_STATUS, 0);
  509. -                       if (status == 1)
  510. -                       {
  511. -                           player.getVariables().set(PlayerVariables.HOMUNCULUS_STATUS, 2);
  512. -                       }
  513. -                   }
  514. -                   player.getVariables().set(PlayerVariables.HOMUNCULUS_TIME, Chronos.currentTimeMillis() / 1000);
  515. -               }
  516. -               else
  517. -               {
  518. -                   return;
  519. -               }
  520. -               break;
  521. -           }
  522. -           case 2: // vp
  523. -           {
  524. -               if (player.getVitalityPoints() >= 35000)
  525. -               {
  526. -                   player.setVitalityPoints(player.getVitalityPoints() - 35000, true);
  527. -                   final int vp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP, 0);
  528. -                   if (vp < 4)
  529. -                   {
  530. -                       player.getVariables().set(PlayerVariables.HOMUNCULUS_VP, vp + 1);
  531. -                   }
  532. -                   else
  533. -                   {
  534. -                       player.getVariables().set(PlayerVariables.HOMUNCULUS_VP, 5);
  535. -                      
  536. -                       final int status = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_STATUS, 0);
  537. -                       if (status == 1)
  538. -                       {
  539. -                           player.getVariables().set(PlayerVariables.HOMUNCULUS_STATUS, 2);
  540. -                       }
  541. -                   }
  542. -                   player.getVariables().set(PlayerVariables.HOMUNCULUS_TIME, Chronos.currentTimeMillis() / 1000);
  543. -               }
  544. -               else
  545. -               {
  546. -                   return;
  547. -               }
  548. -               break;
  549. -           }
  550. -       }
  551. -      
  552. -       player.sendPacket(new ExHomunculusInsertHpSpVp(player));
  553. -       player.sendPacket(new ExHomonculusBirthInfo(player));
  554. -   }
  555. -}
  556. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusSummon.java
  557. ===================================================================
  558. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusSummon.java  (revision 8809)
  559. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExHomunculusSummon.java  (nonexistent)
  560. @@ -1,78 +0,0 @@
  561. -/*
  562. - * This file is part of the L2J Mobius project.
  563. - *
  564. - * This program is free software: you can redistribute it and/or modify
  565. - * it under the terms of the GNU General Public License as published by
  566. - * the Free Software Foundation, either version 3 of the License, or
  567. - * (at your option) any later version.
  568. - *
  569. - * This program is distributed in the hope that it will be useful,
  570. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  571. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  572. - * General Public License for more details.
  573. - *
  574. - * You should have received a copy of the GNU General Public License
  575. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  576. - */
  577. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  578. -
  579. -import org.l2jmobius.commons.network.PacketReader;
  580. -import org.l2jmobius.commons.util.Rnd;
  581. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  582. -import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  583. -import org.l2jmobius.gameserver.network.GameClient;
  584. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  585. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
  586. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusSummonResult;
  587. -
  588. -/**
  589. - * @author Mobius
  590. - */
  591. -public class ExHomunculusSummon implements IClientIncomingPacket
  592. -{
  593. -   @Override
  594. -   public boolean read(GameClient client, PacketReader packet)
  595. -   {
  596. -       return true;
  597. -   }
  598. -  
  599. -   @Override
  600. -   public void run(GameClient client)
  601. -   {
  602. -       final PlayerInstance player = client.getPlayer();
  603. -       if (player == null)
  604. -       {
  605. -           return;
  606. -       }
  607. -      
  608. -       final int homunculus = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_ID, 0);
  609. -       if (homunculus == 0)
  610. -       {
  611. -           final int status = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_STATUS, 0);
  612. -           final int hp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP, 0);
  613. -           final int sp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP, 0);
  614. -           final int vp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP, 0);
  615. -           if ((status == 2) && ((hp == 100) || (sp == 10) || (vp == 5)))
  616. -           {
  617. -               player.getVariables().set(PlayerVariables.HOMUNCULUS_ID, 1);
  618. -              
  619. -               int quality = 2;
  620. -               if (Rnd.get(100) < 50)
  621. -               {
  622. -                   quality = 0;
  623. -               }
  624. -               else if (Rnd.get(100) < 30)
  625. -               {
  626. -                   quality = 1;
  627. -               }
  628. -               player.getVariables().set(PlayerVariables.HOMUNCULUS_QUALITY, quality);
  629. -              
  630. -               player.calculateHomunculusBonuses();
  631. -               player.getStat().recalculateStats(true);
  632. -           }
  633. -       }
  634. -      
  635. -       client.sendPacket(new ExHomonculusSummonResult(player));
  636. -       client.sendPacket(new ExHomonculusList(player));
  637. -   }
  638. -}
  639. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomonculusList.java
  640. ===================================================================
  641. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomonculusList.java (revision 8809)
  642. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomonculusList.java (nonexistent)
  643. @@ -1,48 +0,0 @@
  644. -/*
  645. - * This file is part of the L2J Mobius project.
  646. - *
  647. - * This program is free software: you can redistribute it and/or modify
  648. - * it under the terms of the GNU General Public License as published by
  649. - * the Free Software Foundation, either version 3 of the License, or
  650. - * (at your option) any later version.
  651. - *
  652. - * This program is distributed in the hope that it will be useful,
  653. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  654. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  655. - * General Public License for more details.
  656. - *
  657. - * You should have received a copy of the GNU General Public License
  658. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  659. - */
  660. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  661. -
  662. -import org.l2jmobius.commons.network.PacketReader;
  663. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  664. -import org.l2jmobius.gameserver.network.GameClient;
  665. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  666. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusList;
  667. -
  668. -/**
  669. - * @author Mobius
  670. - */
  671. -public class ExRequestHomonculusList implements IClientIncomingPacket
  672. -{
  673. -   @Override
  674. -   public boolean read(GameClient client, PacketReader packet)
  675. -   {
  676. -       packet.readD(); // ?
  677. -       return true;
  678. -   }
  679. -  
  680. -   @Override
  681. -   public void run(GameClient client)
  682. -   {
  683. -       final PlayerInstance player = client.getPlayer();
  684. -       if (player == null)
  685. -       {
  686. -           return;
  687. -       }
  688. -      
  689. -       client.sendPacket(new ExHomonculusList(player));
  690. -   }
  691. -}
  692. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomunculusActivate.java
  693. ===================================================================
  694. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomunculusActivate.java (revision 8809)
  695. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/ExRequestHomunculusActivate.java (nonexistent)
  696. @@ -1,49 +0,0 @@
  697. -/*
  698. - * This file is part of the L2J Mobius project.
  699. - *
  700. - * This program is free software: you can redistribute it and/or modify
  701. - * it under the terms of the GNU General Public License as published by
  702. - * the Free Software Foundation, either version 3 of the License, or
  703. - * (at your option) any later version.
  704. - *
  705. - * This program is distributed in the hope that it will be useful,
  706. - * but WITHOUT ANY WARRANTY; without even the implied warranty of
  707. - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  708. - * General Public License for more details.
  709. - *
  710. - * You should have received a copy of the GNU General Public License
  711. - * along with this program. If not, see <http://www.gnu.org/licenses/>.
  712. - */
  713. -package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  714. -
  715. -import org.l2jmobius.commons.network.PacketReader;
  716. -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  717. -import org.l2jmobius.gameserver.network.GameClient;
  718. -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  719. -import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomonculusActivateResult;
  720. -
  721. -/**
  722. - * @author Mobius
  723. - */
  724. -public class ExRequestHomunculusActivate implements IClientIncomingPacket
  725. -{
  726. -   @Override
  727. -   public boolean read(GameClient client, PacketReader packet)
  728. -   {
  729. -       packet.readD();
  730. -       packet.readC(); // enabled?
  731. -       return true;
  732. -   }
  733. -  
  734. -   @Override
  735. -   public void run(GameClient client)
  736. -   {
  737. -       final PlayerInstance player = client.getPlayer();
  738. -       if (player == null)
  739. -       {
  740. -           return;
  741. -       }
  742. -      
  743. -       client.sendPacket(new ExHomonculusActivateResult(player));
  744. -   }
  745. -}
  746. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExActivateHomunculus.java
  747. ===================================================================
  748. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExActivateHomunculus.java (nonexistent)
  749. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExActivateHomunculus.java (working copy)
  750. @@ -0,0 +1,94 @@
  751. +/*
  752. + * This file is part of the L2J Mobius project.
  753. + *
  754. + * This program is free software: you can redistribute it and/or modify
  755. + * it under the terms of the GNU General Public License as published by
  756. + * the Free Software Foundation, either version 3 of the License, or
  757. + * (at your option) any later version.
  758. + *
  759. + * This program is distributed in the hope that it will be useful,
  760. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  761. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  762. + * General Public License for more details.
  763. + *
  764. + * You should have received a copy of the GNU General Public License
  765. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  766. + */
  767. +package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  768. +
  769. +import org.l2jmobius.commons.network.PacketReader;
  770. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  771. +import org.l2jmobius.gameserver.model.homunculus.Homunculus;
  772. +import org.l2jmobius.gameserver.network.GameClient;
  773. +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  774. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExActivateHomunculusResult;
  775. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
  776. +
  777. +/**
  778. + * @author Mobius
  779. + */
  780. +public class RequestExActivateHomunculus implements IClientIncomingPacket
  781. +{
  782. +   private int _slot;
  783. +   private boolean _activate;
  784. +  
  785. +   @Override
  786. +   public boolean read(GameClient client, PacketReader packet)
  787. +   {
  788. +       _slot = packet.readD();
  789. +       _activate = packet.readC() == 1 ? true : false; // enabled?
  790. +       return true;
  791. +   }
  792. +  
  793. +   @Override
  794. +   public void run(GameClient client)
  795. +   {
  796. +       PlayerInstance activeChar = client.getPlayer();
  797. +       if (activeChar == null)
  798. +       {
  799. +           return;
  800. +       }
  801. +      
  802. +       Homunculus homunculus = activeChar.getHomunculusList().get(_slot);
  803. +       boolean anotherActive = false;
  804. +       int size = activeChar.getHomunculusList().size();
  805. +       if (size > 1)
  806. +       {
  807. +           if (_slot == 0)
  808. +           {
  809. +               if (activeChar.getHomunculusList().get(1).isActive())
  810. +               {
  811. +                   anotherActive = true;
  812. +               }
  813. +           }
  814. +           else
  815. +           {
  816. +               if (activeChar.getHomunculusList().get(0).isActive())
  817. +               {
  818. +                   anotherActive = true;
  819. +               }
  820. +           }
  821. +       }
  822. +      
  823. +       if (anotherActive)
  824. +       {
  825. +           return;
  826. +       }
  827. +       if (!homunculus.isActive() && _activate)
  828. +       {
  829. +           homunculus.setActive(true);
  830. +           activeChar.getHomunculusList().update(homunculus);
  831. +           activeChar.getHomunculusList().refreshStats(true);
  832. +           activeChar.sendPacket(new ExShowHomunculusList(activeChar));
  833. +           activeChar.sendPacket(new ExActivateHomunculusResult(true));
  834. +       }
  835. +       else if (homunculus.isActive() && !_activate)
  836. +       {
  837. +           homunculus.setActive(false);
  838. +           activeChar.getHomunculusList().update(homunculus);
  839. +           activeChar.getHomunculusList().refreshStats(true);
  840. +           activeChar.sendPacket(new ExShowHomunculusList(activeChar));
  841. +           activeChar.sendPacket(new ExActivateHomunculusResult(false));
  842. +       }
  843. +   }
  844. +}
  845. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExDeleteHomunculusData.java
  846. ===================================================================
  847. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExDeleteHomunculusData.java   (nonexistent)
  848. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExDeleteHomunculusData.java   (working copy)
  849. @@ -0,0 +1,57 @@
  850. +/*
  851. + * This file is part of the L2J Mobius project.
  852. + *
  853. + * This program is free software: you can redistribute it and/or modify
  854. + * it under the terms of the GNU General Public License as published by
  855. + * the Free Software Foundation, either version 3 of the License, or
  856. + * (at your option) any later version.
  857. + *
  858. + * This program is distributed in the hope that it will be useful,
  859. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  860. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  861. + * General Public License for more details.
  862. + *
  863. + * You should have received a copy of the GNU General Public License
  864. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  865. + */
  866. +package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  867. +
  868. +import org.l2jmobius.commons.network.PacketReader;
  869. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  870. +import org.l2jmobius.gameserver.model.homunculus.Homunculus;
  871. +import org.l2jmobius.gameserver.network.GameClient;
  872. +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  873. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExDeleteHomunculusDataResult;
  874. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
  875. +
  876. +/**
  877. + * @author Mobius
  878. + */
  879. +public class RequestExDeleteHomunculusData implements IClientIncomingPacket
  880. +{
  881. +   private int _slot;
  882. +  
  883. +   @Override
  884. +   public boolean read(GameClient client, PacketReader packet)
  885. +   {
  886. +       _slot = packet.readD(); // Position?
  887. +       return true;
  888. +   }
  889. +  
  890. +   @Override
  891. +   public void run(GameClient client)
  892. +   {
  893. +       final PlayerInstance player = client.getPlayer();
  894. +       if (player == null)
  895. +       {
  896. +           return;
  897. +       }
  898. +      
  899. +       Homunculus homunculus = player.getHomunculusList().get(_slot);
  900. +       if (player.getHomunculusList().remove(homunculus))
  901. +       {
  902. +           player.sendPacket(new ExDeleteHomunculusDataResult());
  903. +           player.sendPacket(new ExShowHomunculusList(player));
  904. +       }
  905. +   }
  906. +}
  907. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExEnchantHomunculusSkill.java
  908. ===================================================================
  909. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExEnchantHomunculusSkill.java (nonexistent)
  910. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExEnchantHomunculusSkill.java (working copy)
  911. @@ -0,0 +1,73 @@
  912. +/*
  913. + * This file is part of the L2J Mobius project.
  914. + *
  915. + * This program is free software: you can redistribute it and/or modify
  916. + * it under the terms of the GNU General Public License as published by
  917. + * the Free Software Foundation, either version 3 of the License, or
  918. + * (at your option) any later version.
  919. + *
  920. + * This program is distributed in the hope that it will be useful,
  921. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  922. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  923. + * General Public License for more details.
  924. + *
  925. + * You should have received a copy of the GNU General Public License
  926. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  927. + */
  928. +package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  929. +
  930. +import org.l2jmobius.commons.network.PacketReader;
  931. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  932. +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  933. +import org.l2jmobius.gameserver.network.GameClient;
  934. +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  935. +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
  936. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExEnchantHomunculusSkillResult;
  937. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusHPSPVP;
  938. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
  939. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
  940. +
  941. +/**
  942. + * @author Mobius
  943. + */
  944. +public class RequestExEnchantHomunculusSkill implements IClientIncomingPacket
  945. +{
  946. +   private static final int SP_COST = 1_000_000_000;
  947. +   private int _slot, _skillNumber;
  948. +  
  949. +   @Override
  950. +   public boolean read(GameClient client, PacketReader packet)
  951. +   {
  952. +       packet.readD();
  953. +       _slot = packet.readD();
  954. +       _skillNumber = packet.readD();
  955. +       return true;
  956. +   }
  957. +  
  958. +   @Override
  959. +   public void run(GameClient client)
  960. +   {
  961. +       final PlayerInstance player = client.getPlayer();
  962. +       if (player == null)
  963. +       {
  964. +           return;
  965. +       }
  966. +      
  967. +       if (player.getSp() < SP_COST)
  968. +       {
  969. +           return;
  970. +       }
  971. +      
  972. +       int points = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0);
  973. +       if (points < 1)
  974. +       {
  975. +           player.sendPacket(new SystemMessage(SystemMessage.NOT_ENOUGH_UPGRADE_POINTS));
  976. +           return;
  977. +       }
  978. +       player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, points - 1);
  979. +       player.sendPacket(new ExEnchantHomunculusSkillResult(player, _slot, _skillNumber));
  980. +       player.sendPacket(new ExHomunculusHPSPVP(player));
  981. +       player.sendPacket(new ExShowHomunculusList(player));
  982. +       player.sendPacket(new ExHomunculusPointInfo(player));
  983. +   }
  984. +}
  985. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusCreateStart.java
  986. ===================================================================
  987. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusCreateStart.java  (nonexistent)
  988. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusCreateStart.java  (working copy)
  989. @@ -0,0 +1,63 @@
  990. +/*
  991. + * This file is part of the L2J Mobius project.
  992. + *
  993. + * This program is free software: you can redistribute it and/or modify
  994. + * it under the terms of the GNU General Public License as published by
  995. + * the Free Software Foundation, either version 3 of the License, or
  996. + * (at your option) any later version.
  997. + *
  998. + * This program is distributed in the hope that it will be useful,
  999. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1000. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  1001. + * General Public License for more details.
  1002. + *
  1003. + * You should have received a copy of the GNU General Public License
  1004. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  1005. + */
  1006. +package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  1007. +
  1008. +import org.l2jmobius.commons.network.PacketReader;
  1009. +import org.l2jmobius.commons.util.Chronos;
  1010. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  1011. +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  1012. +import org.l2jmobius.gameserver.network.GameClient;
  1013. +import org.l2jmobius.gameserver.network.SystemMessageId;
  1014. +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  1015. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusCreateStartResult;
  1016. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
  1017. +
  1018. +/**
  1019. + * @author Mobius
  1020. + */
  1021. +public class RequestExHomunculusCreateStart implements IClientIncomingPacket
  1022. +{
  1023. +   private static final int COST = 1000000;
  1024. +   private static final long CREATION_TIME = 86400000L;
  1025. +  
  1026. +   @Override
  1027. +   public boolean read(GameClient client, PacketReader packet)
  1028. +   {
  1029. +       return true;
  1030. +   }
  1031. +  
  1032. +   @Override
  1033. +   public void run(GameClient client)
  1034. +   {
  1035. +       final PlayerInstance player = client.getPlayer();
  1036. +       if (player == null)
  1037. +       {
  1038. +           return;
  1039. +       }
  1040. +      
  1041. +       if (player.getAdena() < COST)
  1042. +       {
  1043. +           player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA_2);
  1044. +           return;
  1045. +       }
  1046. +       player.reduceAdena("Homunculus creation", COST, player, true);
  1047. +       player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, Chronos.currentTimeMillis() + CREATION_TIME);
  1048. +      
  1049. +       client.sendPacket(new ExShowHomunculusBirthInfo(player));
  1050. +       client.sendPacket(new ExHomunculusCreateStartResult(player));
  1051. +   }
  1052. +}
  1053. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java
  1054. ===================================================================
  1055. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java   (nonexistent)
  1056. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java   (working copy)
  1057. @@ -0,0 +1,123 @@
  1058. +/*
  1059. + * This file is part of the L2J Mobius project.
  1060. + *
  1061. + * This program is free software: you can redistribute it and/or modify
  1062. + * it under the terms of the GNU General Public License as published by
  1063. + * the Free Software Foundation, either version 3 of the License, or
  1064. + * (at your option) any later version.
  1065. + *
  1066. + * This program is distributed in the hope that it will be useful,
  1067. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1068. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  1069. + * General Public License for more details.
  1070. + *
  1071. + * You should have received a copy of the GNU General Public License
  1072. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  1073. + */
  1074. +package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  1075. +
  1076. +import org.l2jmobius.commons.network.PacketReader;
  1077. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  1078. +import org.l2jmobius.gameserver.model.homunculus.Homunculus;
  1079. +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  1080. +import org.l2jmobius.gameserver.network.GameClient;
  1081. +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  1082. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusEnchantEXPResult;
  1083. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
  1084. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
  1085. +
  1086. +/**
  1087. + * @author Mobius
  1088. + */
  1089. +public class RequestExHomunculusEnchantExp implements IClientIncomingPacket
  1090. +{
  1091. +   private static final int EXP_PER_POINT = 750;
  1092. +   private int _slot;
  1093. +  
  1094. +   @Override
  1095. +   public boolean read(GameClient client, PacketReader packet)
  1096. +   {
  1097. +       _slot = packet.readD();
  1098. +       return true;
  1099. +   }
  1100. +  
  1101. +   @Override
  1102. +   public void run(GameClient client)
  1103. +   {
  1104. +       final PlayerInstance player = client.getPlayer();
  1105. +       if (player == null)
  1106. +       {
  1107. +           return;
  1108. +       }
  1109. +       if (player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) == 0)
  1110. +       {
  1111. +           player.sendPacket(new ExHomunculusEnchantEXPResult(false, false));
  1112. +       }
  1113. +       else
  1114. +       {
  1115. +           int points = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) - 1;
  1116. +           player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, points);
  1117. +           Homunculus homunculus = player.getHomunculusList().get(_slot);
  1118. +           homunculus.setExp(homunculus.getExp() + EXP_PER_POINT);
  1119. +           player.sendPacket(new ExHomunculusPointInfo(player));
  1120. +           switch (homunculus.getLevel())
  1121. +           {
  1122. +               case 1:
  1123. +               {
  1124. +                   if (homunculus.getExp() >= homunculus.getTemplate().getExpToLevel2())
  1125. +                   {
  1126. +                       homunculus.setLevel(2);
  1127. +                       player.sendPacket(new ExHomunculusEnchantEXPResult(true, true));
  1128. +                   }
  1129. +                   else
  1130. +                   {
  1131. +                       player.sendPacket(new ExHomunculusEnchantEXPResult(true, false));
  1132. +                   }
  1133. +                   break;
  1134. +               }
  1135. +               case 2:
  1136. +               {
  1137. +                   if (homunculus.getExp() >= homunculus.getTemplate().getExpToLevel3())
  1138. +                   {
  1139. +                       homunculus.setLevel(3);
  1140. +                       player.sendPacket(new ExHomunculusEnchantEXPResult(true, true));
  1141. +                   }
  1142. +                   else
  1143. +                   {
  1144. +                       player.sendPacket(new ExHomunculusEnchantEXPResult(true, false));
  1145. +                   }
  1146. +                   break;
  1147. +               }
  1148. +               case 3:
  1149. +               {
  1150. +                   if (homunculus.getExp() >= homunculus.getTemplate().getExpToLevel4())
  1151. +                   {
  1152. +                       homunculus.setLevel(4);
  1153. +                       player.sendPacket(new ExHomunculusEnchantEXPResult(true, true));
  1154. +                   }
  1155. +                   else
  1156. +                   {
  1157. +                       player.sendPacket(new ExHomunculusEnchantEXPResult(true, false));
  1158. +                   }
  1159. +                   break;
  1160. +               }
  1161. +               case 4:
  1162. +               {
  1163. +                   if (homunculus.getExp() >= homunculus.getTemplate().getExpToLevel5())
  1164. +                   {
  1165. +                       homunculus.setLevel(5);
  1166. +                       player.sendPacket(new ExHomunculusEnchantEXPResult(true, true));
  1167. +                   }
  1168. +                   else
  1169. +                   {
  1170. +                       player.sendPacket(new ExHomunculusEnchantEXPResult(true, false));
  1171. +                   }
  1172. +                   break;
  1173. +               }
  1174. +           }
  1175. +           player.getHomunculusList().update(homunculus);
  1176. +           player.getHomunculusList().refreshStats(true);
  1177. +           player.sendPacket(new ExShowHomunculusList(player));
  1178. +       }
  1179. +   }
  1180. +}
  1181. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusGetEnchantPoint.java
  1182. ===================================================================
  1183. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusGetEnchantPoint.java  (nonexistent)
  1184. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusGetEnchantPoint.java  (working copy)
  1185. @@ -0,0 +1,110 @@
  1186. +/*
  1187. + * This file is part of the L2J Mobius project.
  1188. + *
  1189. + * This program is free software: you can redistribute it and/or modify
  1190. + * it under the terms of the GNU General Public License as published by
  1191. + * the Free Software Foundation, either version 3 of the License, or
  1192. + * (at your option) any later version.
  1193. + *
  1194. + * This program is distributed in the hope that it will be useful,
  1195. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1196. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  1197. + * General Public License for more details.
  1198. + *
  1199. + * You should have received a copy of the GNU General Public License
  1200. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  1201. + */
  1202. +package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  1203. +
  1204. +import org.l2jmobius.commons.network.PacketReader;
  1205. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  1206. +import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
  1207. +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  1208. +import org.l2jmobius.gameserver.network.GameClient;
  1209. +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  1210. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusGetEnchantPointResult;
  1211. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusHPSPVP;
  1212. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
  1213. +
  1214. +/**
  1215. + * @author Mobius
  1216. + */
  1217. +public class RequestExHomunculusGetEnchantPoint implements IClientIncomingPacket
  1218. +{
  1219. +   private int _type;
  1220. +  
  1221. +   @Override
  1222. +   public boolean read(GameClient client, PacketReader packet)
  1223. +   {
  1224. +       _type = packet.readD();
  1225. +       return true;
  1226. +   }
  1227. +  
  1228. +   @Override
  1229. +   public void run(GameClient client)
  1230. +   {
  1231. +       final PlayerInstance player = client.getPlayer();
  1232. +       if (player == null)
  1233. +       {
  1234. +           return;
  1235. +       }
  1236. +      
  1237. +       if (_type == 0) // mobs
  1238. +       {
  1239. +           int killedMobs = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_KILLED_MOBS, 0);
  1240. +           if (killedMobs < 500)
  1241. +           {
  1242. +               return;
  1243. +           }
  1244. +           int usedKillConverts = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_KILL_CONVERT, 0);
  1245. +           if (usedKillConverts >= 5)
  1246. +           {
  1247. +               return;
  1248. +           }
  1249. +          
  1250. +           int upgradePoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) + 1;
  1251. +           player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, upgradePoints);
  1252. +           player.getVariables().set(PlayerVariables.HOMUNCULUS_KILLED_MOBS, 0);
  1253. +           player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_KILL_CONVERT, usedKillConverts + 1);
  1254. +       }
  1255. +       else if (_type == 1) // vitality
  1256. +       {
  1257. +           int usedVpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_VP_POINTS, 0);
  1258. +           if (usedVpPoints < 2)
  1259. +           {
  1260. +               return;
  1261. +           }
  1262. +           int usedVpConverts = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_VP_CONVERT, 0);
  1263. +           if (usedVpConverts >= 5)
  1264. +           {
  1265. +               return;
  1266. +           }
  1267. +          
  1268. +           int upgradePoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) + 1;
  1269. +           player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, upgradePoints);
  1270. +           player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_VP_POINTS, 0);
  1271. +           player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_VP_CONVERT, usedVpConverts + 1);
  1272. +       }
  1273. +       else if (_type == 2) // vitality consume
  1274. +       {
  1275. +           int usedVpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_VP_POINTS, 0);
  1276. +           if (usedVpPoints >= 2)
  1277. +           {
  1278. +               return;
  1279. +           }
  1280. +          
  1281. +           if (player.getVitalityPoints() >= (PlayerStat.MAX_VITALITY_POINTS / 4))
  1282. +           {
  1283. +               player.setVitalityPoints(player.getVitalityPoints() - (PlayerStat.MAX_VITALITY_POINTS / 4), false);
  1284. +               player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_VP_POINTS, usedVpPoints + 1);
  1285. +           }
  1286. +       }
  1287. +      
  1288. +       if (_type == 2)
  1289. +       {
  1290. +           player.sendPacket(new ExHomunculusHPSPVP(player));
  1291. +       }
  1292. +       player.sendPacket(new ExHomunculusPointInfo(player));
  1293. +       player.sendPacket(new ExHomunculusGetEnchantPointResult(_type));
  1294. +   }
  1295. +}
  1296. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInitPoint.java
  1297. ===================================================================
  1298. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInitPoint.java    (nonexistent)
  1299. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInitPoint.java    (working copy)
  1300. @@ -0,0 +1,79 @@
  1301. +/*
  1302. + * This file is part of the L2J Mobius project.
  1303. + *
  1304. + * This program is free software: you can redistribute it and/or modify
  1305. + * it under the terms of the GNU General Public License as published by
  1306. + * the Free Software Foundation, either version 3 of the License, or
  1307. + * (at your option) any later version.
  1308. + *
  1309. + * This program is distributed in the hope that it will be useful,
  1310. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1311. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  1312. + * General Public License for more details.
  1313. + *
  1314. + * You should have received a copy of the GNU General Public License
  1315. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  1316. + */
  1317. +package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  1318. +
  1319. +import org.l2jmobius.commons.network.PacketReader;
  1320. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  1321. +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  1322. +import org.l2jmobius.gameserver.network.GameClient;
  1323. +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  1324. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusInitPointResult;
  1325. +
  1326. +/**
  1327. + * @author Mobius
  1328. + */
  1329. +public class RequestExHomunculusInitPoint implements IClientIncomingPacket
  1330. +{
  1331. +   private static final int POWERFUL_FISH = 47552;
  1332. +   private static final int FISH_COUNT = 5;
  1333. +   private int _type;
  1334. +  
  1335. +   @Override
  1336. +   public boolean read(GameClient client, PacketReader packet)
  1337. +   {
  1338. +       _type = packet.readD();
  1339. +       return true;
  1340. +   }
  1341. +  
  1342. +   @Override
  1343. +   public void run(GameClient client)
  1344. +   {
  1345. +       final PlayerInstance player = client.getPlayer();
  1346. +       boolean success = false;
  1347. +       if (player == null)
  1348. +       {
  1349. +           return;
  1350. +       }
  1351. +       if (player.getInventory().getItemByItemId(POWERFUL_FISH).getCount() < FISH_COUNT)
  1352. +       {
  1353. +           player.sendPacket(new ExHomunculusInitPointResult(false, _type));
  1354. +           return;
  1355. +       }
  1356. +       if (player.getInventory().getItemByItemId(POWERFUL_FISH).getCount() > FISH_COUNT)
  1357. +       {
  1358. +           player.getInventory().destroyItemByItemId("Homunculus Points", POWERFUL_FISH, FISH_COUNT, player, false);
  1359. +           success = true;
  1360. +       }
  1361. +       if (success)
  1362. +       {
  1363. +           if (_type == 0)
  1364. +           {
  1365. +               player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_KILL_CONVERT, 0);
  1366. +               int usedResetKills = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_RESET_KILLS, 0) + 1;
  1367. +               player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_RESET_KILLS, usedResetKills);
  1368. +           }
  1369. +           else
  1370. +           {
  1371. +               player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_VP_CONVERT, 0);
  1372. +               int usedResetVp = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_USED_RESET_VP, 0) + 1;
  1373. +               player.getVariables().set(PlayerVariables.HOMUNCULUS_USED_RESET_VP, usedResetVp);
  1374. +           }
  1375. +          
  1376. +           player.sendPacket(new ExHomunculusInitPointResult(success, _type));
  1377. +       }
  1378. +   }
  1379. +}
  1380. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInsert.java
  1381. ===================================================================
  1382. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInsert.java   (nonexistent)
  1383. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusInsert.java   (working copy)
  1384. @@ -0,0 +1,108 @@
  1385. +/*
  1386. + * This file is part of the L2J Mobius project.
  1387. + *
  1388. + * This program is free software: you can redistribute it and/or modify
  1389. + * it under the terms of the GNU General Public License as published by
  1390. + * the Free Software Foundation, either version 3 of the License, or
  1391. + * (at your option) any later version.
  1392. + *
  1393. + * This program is distributed in the hope that it will be useful,
  1394. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1395. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  1396. + * General Public License for more details.
  1397. + *
  1398. + * You should have received a copy of the GNU General Public License
  1399. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  1400. + */
  1401. +package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  1402. +
  1403. +import org.l2jmobius.commons.network.PacketReader;
  1404. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  1405. +import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
  1406. +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  1407. +import org.l2jmobius.gameserver.network.GameClient;
  1408. +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  1409. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusHPSPVP;
  1410. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusInsertResult;
  1411. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
  1412. +
  1413. +/**
  1414. + * @author Mobius
  1415. + */
  1416. +public class RequestExHomunculusInsert implements IClientIncomingPacket
  1417. +{
  1418. +   private static final short _hpCost = 10000;
  1419. +   private static final long _spCost = 5_000_000_000L;
  1420. +   private static final int _vpCost = PlayerStat.MAX_VITALITY_POINTS / 4;
  1421. +   private int _type;
  1422. +  
  1423. +   @Override
  1424. +   public boolean read(GameClient client, PacketReader packet)
  1425. +   {
  1426. +       _type = packet.readD();
  1427. +       return true;
  1428. +   }
  1429. +  
  1430. +   @Override
  1431. +   public void run(GameClient client)
  1432. +   {
  1433. +       final PlayerInstance player = client.getPlayer();
  1434. +       if (player == null)
  1435. +       {
  1436. +           return;
  1437. +       }
  1438. +       int hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
  1439. +       int spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
  1440. +       int vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
  1441. +       switch (_type)
  1442. +       {
  1443. +           case 0:
  1444. +           {
  1445. +               if ((player.getCurrentHp() > _hpCost) && (hpPoints < 100))
  1446. +               {
  1447. +                   int newHp = (int) (player.getCurrentHp()) - _hpCost;
  1448. +                   player.setCurrentHp(newHp, true);
  1449. +                   hpPoints += 1;
  1450. +                   player.getVariables().set(PlayerVariables.HOMUNCULUS_HP_POINTS, hpPoints);
  1451. +               }
  1452. +               else
  1453. +               {
  1454. +                   return;
  1455. +               }
  1456. +               break;
  1457. +           }
  1458. +           case 1:
  1459. +           {
  1460. +               if ((player.getSp() >= _spCost) && (spPoints < 10))
  1461. +               {
  1462. +                   player.addExpAndSp(0, -_spCost);
  1463. +                   spPoints += 1;
  1464. +                   player.getVariables().set(PlayerVariables.HOMUNCULUS_SP_POINTS, spPoints);
  1465. +               }
  1466. +               else
  1467. +               {
  1468. +                   return;
  1469. +               }
  1470. +               break;
  1471. +           }
  1472. +           case 2:
  1473. +           {
  1474. +               if ((player.getVitalityPoints() >= _vpCost) && (vpPoints < 5))
  1475. +               {
  1476. +                   int newVitality = player.getVitalityPoints() - _vpCost;
  1477. +                   player.setVitalityPoints(newVitality, true);
  1478. +                   vpPoints += 1;
  1479. +                   player.getVariables().set(PlayerVariables.HOMUNCULUS_VP_POINTS, vpPoints);
  1480. +               }
  1481. +               else
  1482. +               {
  1483. +                   return;
  1484. +               }
  1485. +               break;
  1486. +           }
  1487. +       }
  1488. +       player.sendPacket(new ExShowHomunculusBirthInfo(player));
  1489. +       player.sendPacket(new ExHomunculusHPSPVP(player));
  1490. +       player.sendPacket(new ExHomunculusInsertResult(_type));
  1491. +   }
  1492. +}
  1493. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusSummon.java
  1494. ===================================================================
  1495. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusSummon.java   (nonexistent)
  1496. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusSummon.java   (working copy)
  1497. @@ -0,0 +1,156 @@
  1498. +/*
  1499. + * This file is part of the L2J Mobius project.
  1500. + *
  1501. + * This program is free software: you can redistribute it and/or modify
  1502. + * it under the terms of the GNU General Public License as published by
  1503. + * the Free Software Foundation, either version 3 of the License, or
  1504. + * (at your option) any later version.
  1505. + *
  1506. + * This program is distributed in the hope that it will be useful,
  1507. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1508. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  1509. + * General Public License for more details.
  1510. + *
  1511. + * You should have received a copy of the GNU General Public License
  1512. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  1513. + */
  1514. +package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  1515. +
  1516. +import org.l2jmobius.commons.network.PacketReader;
  1517. +import org.l2jmobius.commons.util.Rnd;
  1518. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  1519. +import org.l2jmobius.gameserver.model.actor.templates.HomunculusTemplate;
  1520. +import org.l2jmobius.gameserver.model.holders.HomunculusHolder;
  1521. +import org.l2jmobius.gameserver.model.homunculus.Homunculus;
  1522. +import org.l2jmobius.gameserver.model.variables.PlayerVariables;
  1523. +import org.l2jmobius.gameserver.network.GameClient;
  1524. +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  1525. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusSummonResult;
  1526. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
  1527. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
  1528. +
  1529. +/**
  1530. + * @author Mobius
  1531. + */
  1532. +public class RequestExHomunculusSummon implements IClientIncomingPacket
  1533. +{
  1534. +   private static int _hpPoints, _spPoints, _vpPoints, _homunculusCreateTime;
  1535. +  
  1536. +   @Override
  1537. +   public boolean read(GameClient client, PacketReader packet)
  1538. +   {
  1539. +       // readC(); // useless.
  1540. +       return true;
  1541. +   }
  1542. +  
  1543. +   @Override
  1544. +   public void run(GameClient client)
  1545. +   {
  1546. +       final PlayerInstance player = client.getPlayer();
  1547. +       if (player == null)
  1548. +       {
  1549. +           return;
  1550. +       }
  1551. +      
  1552. +       _hpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
  1553. +       _spPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
  1554. +       _vpPoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
  1555. +       _homunculusCreateTime = (int) (player.getVariables().getLong(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0) / 1000);
  1556. +      
  1557. +       if (_homunculusCreateTime > 0)
  1558. +       {
  1559. +           if (((System.currentTimeMillis() / 1000) >= _homunculusCreateTime) //
  1560. +               && (_hpPoints == 100) && (_spPoints == 10) && (_vpPoints == 5))
  1561. +           {
  1562. +               int homunculusId = 0;
  1563. +               int chance = Rnd.get(100);
  1564. +               if (chance >= 60) // Basic Homunculus
  1565. +               {
  1566. +                   int chance2 = Rnd.get(100);
  1567. +                   if (chance2 >= 80)
  1568. +                   {
  1569. +                       homunculusId = 1;
  1570. +                   }
  1571. +                   else if (chance2 >= 60)
  1572. +                   {
  1573. +                       homunculusId = 4;
  1574. +                   }
  1575. +                   else if (chance2 >= 40)
  1576. +                   {
  1577. +                       homunculusId = 7;
  1578. +                   }
  1579. +                   else if (chance2 >= 20)
  1580. +                   {
  1581. +                       homunculusId = 10;
  1582. +                   }
  1583. +                   else
  1584. +                   {
  1585. +                       homunculusId = 13;
  1586. +                   }
  1587. +               }
  1588. +               else if (chance >= 10) // Water Homunculus
  1589. +               {
  1590. +                   int chance2 = Rnd.get(100);
  1591. +                   if (chance2 >= 80)
  1592. +                   {
  1593. +                       homunculusId = 2;
  1594. +                   }
  1595. +                   else if (chance2 >= 60)
  1596. +                   {
  1597. +                       homunculusId = 5;
  1598. +                   }
  1599. +                   else if (chance2 >= 40)
  1600. +                   {
  1601. +                       homunculusId = 8;
  1602. +                   }
  1603. +                   else if (chance2 >= 20)
  1604. +                   {
  1605. +                       homunculusId = 11;
  1606. +                   }
  1607. +                   else
  1608. +                   {
  1609. +                       homunculusId = 14;
  1610. +                   }
  1611. +               }
  1612. +               else // Luminous Homunculus
  1613. +               {
  1614. +                   int chance2 = Rnd.get(100);
  1615. +                   if (chance2 >= 80)
  1616. +                   {
  1617. +                       homunculusId = 3;
  1618. +                   }
  1619. +                   else if (chance2 >= 60)
  1620. +                   {
  1621. +                       homunculusId = 6;
  1622. +                   }
  1623. +                   else if (chance2 >= 40)
  1624. +                   {
  1625. +                       homunculusId = 9;
  1626. +                   }
  1627. +                   else if (chance2 >= 20)
  1628. +                   {
  1629. +                       homunculusId = 12;
  1630. +                   }
  1631. +                   else
  1632. +                   {
  1633. +                       homunculusId = 15;
  1634. +                   }
  1635. +               }
  1636. +              
  1637. +               HomunculusTemplate template = HomunculusHolder.getInstance().getHomunculusInfo(homunculusId);
  1638. +               Homunculus homunculus = new Homunculus(template, player.getHomunculusList().size(), 1, 0, 0, 0, 0, 0, 0, false);
  1639. +               if (player.getHomunculusList().add(homunculus))
  1640. +               {
  1641. +                   player.getVariables().set(PlayerVariables.HOMUNCULUS_CREATION_TIME, 0);
  1642. +                   player.getVariables().set(PlayerVariables.HOMUNCULUS_HP_POINTS, 0);
  1643. +                   player.getVariables().set(PlayerVariables.HOMUNCULUS_SP_POINTS, 0);
  1644. +                   player.getVariables().set(PlayerVariables.HOMUNCULUS_VP_POINTS, 0);
  1645. +                  
  1646. +                   player.sendPacket(new ExShowHomunculusBirthInfo(player));
  1647. +                   player.sendPacket(new ExShowHomunculusList(player));
  1648. +                   player.sendPacket(new ExHomunculusSummonResult());
  1649. +               }
  1650. +           }
  1651. +       }
  1652. +   }
  1653. +}
  1654. Index: java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExShowHomunculusInfo.java
  1655. ===================================================================
  1656. --- java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExShowHomunculusInfo.java (nonexistent)
  1657. +++ java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExShowHomunculusInfo.java (working copy)
  1658. @@ -0,0 +1,69 @@
  1659. +/*
  1660. + * This file is part of the L2J Mobius project.
  1661. + *
  1662. + * This program is free software: you can redistribute it and/or modify
  1663. + * it under the terms of the GNU General Public License as published by
  1664. + * the Free Software Foundation, either version 3 of the License, or
  1665. + * (at your option) any later version.
  1666. + *
  1667. + * This program is distributed in the hope that it will be useful,
  1668. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1669. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  1670. + * General Public License for more details.
  1671. + *
  1672. + * You should have received a copy of the GNU General Public License
  1673. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  1674. + */
  1675. +package org.l2jmobius.gameserver.network.clientpackets.homunculus;
  1676. +
  1677. +import org.l2jmobius.commons.network.PacketReader;
  1678. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  1679. +import org.l2jmobius.gameserver.network.GameClient;
  1680. +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
  1681. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
  1682. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
  1683. +import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusList;
  1684. +
  1685. +/**
  1686. + * @author Mobius
  1687. + */
  1688. +public class RequestExShowHomunculusInfo implements IClientIncomingPacket
  1689. +{
  1690. +   private int _type; // 0 - create tab, 1 - manage tab, 2 - get upgrade points menu
  1691. +  
  1692. +   @Override
  1693. +   public boolean read(GameClient client, PacketReader packet)
  1694. +   {
  1695. +       _type = packet.readD();
  1696. +       return true;
  1697. +   }
  1698. +  
  1699. +   @Override
  1700. +   public void run(GameClient client)
  1701. +   {
  1702. +       final PlayerInstance player = client.getPlayer();
  1703. +       if (player == null)
  1704. +       {
  1705. +           return;
  1706. +       }
  1707. +      
  1708. +       switch (_type)
  1709. +       {
  1710. +           case 0:
  1711. +           {
  1712. +               player.sendPacket(new ExShowHomunculusBirthInfo(player));
  1713. +               break;
  1714. +           }
  1715. +           case 1:
  1716. +           {
  1717. +               player.sendPacket(new ExShowHomunculusList(player));
  1718. +               break;
  1719. +           }
  1720. +           case 2:
  1721. +           {
  1722. +               player.sendPacket(new ExHomunculusPointInfo(player));
  1723. +               break;
  1724. +           }
  1725. +       }
  1726. +   }
  1727. +}
  1728.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement