Advertisement
Guest User

patch56

a guest
Sep 14th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 58.75 KB | None | 0 0
  1. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/ai/L2AttackableAI.java b/L2JHellasC/java/com/l2jhellas/gameserver/ai/L2AttackableAI.java
  2. index 1260c75..fd8dca1 100644
  3. --- a/L2JHellasC/java/com/l2jhellas/gameserver/ai/L2AttackableAI.java
  4. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/ai/L2AttackableAI.java
  5. @@ -84,7 +84,7 @@
  6. if (player.isGM() && !player.getAccessLevel().canTakeAggro())
  7. return false;
  8.  
  9. - if (player.isRecentFakeDeath())
  10. + if (player.isRecentFakeDeath() || player.isDead())
  11. return false;
  12.  
  13. if (!(me.isRaid()) && !(me.canSeeThroughSilentMove()) && player.isSilentMoving())
  14. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSoulShot.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSoulShot.java
  15. index 0eb22ae..ced9b61 100644
  16. --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSoulShot.java
  17. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSoulShot.java
  18. @@ -83,7 +83,7 @@
  19. }
  20.  
  21. activeOwner.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PET_USES_S1).addItemName(itemId));
  22. - Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(activePet, activePet, 2033, 1, 0, 0), 800);
  23. + Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(activePet, activePet, 2033, 1, 0, 0), 700);
  24. }
  25.  
  26. @Override
  27. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSpice.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSpice.java
  28. index d0505ad..849dc6a 100644
  29. --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSpice.java
  30. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSpice.java
  31. @@ -31,18 +31,9 @@
  32. activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
  33. return;
  34. }
  35. -
  36. - int skillId = 0;
  37. - switch (item.getItemId())
  38. - {
  39. - case 6643:
  40. - skillId = 2188;
  41. - break;
  42. - case 6644:
  43. - skillId = 2189;
  44. - break;
  45. - }
  46. -
  47. +
  48. + int skillId = item.getItemId() == 6643 ? 2188 : item.getItemId() == 6644 ? 2189 : 0;
  49. +
  50. final L2Skill skill = SkillTable.getInstance().getInfo(skillId, 1);
  51. if (skill != null)
  52. activeChar.useMagic(skill, false, false);
  53. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSpiritShot.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSpiritShot.java
  54. index 7a3f1c0..52150a2 100644
  55. --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSpiritShot.java
  56. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BeastSpiritShot.java
  57. @@ -89,7 +89,7 @@
  58. }
  59.  
  60. activeOwner.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PET_USES_S1).addItemName(itemId));
  61. - Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(activePet, activePet, ((itemId == 6646) ? 2008 : 2009), 1, 0, 0), 800);
  62. + Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(activePet, activePet, ((itemId == 6646) ? 2008 : 2009), 1, 0, 0), 700);
  63. }
  64.  
  65. @Override
  66. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BlessedSpiritShot.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BlessedSpiritShot.java
  67. index 8e0d26c..4ac9554 100644
  68. --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BlessedSpiritShot.java
  69. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/BlessedSpiritShot.java
  70. @@ -105,7 +105,7 @@
  71.  
  72. // Send message to client
  73. activeChar.sendPacket(SystemMessageId.ENABLED_SPIRITSHOT);
  74. - Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, SKILL_IDS[weaponGrade.getId()], 1, 0, 0), 600);
  75. + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, SKILL_IDS[weaponGrade.getId()], 1, 0, 0), 500);
  76. }
  77.  
  78. @Override
  79. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/CharChangePotions.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/CharChangePotions.java
  80. index ffd5f3a..4608515 100644
  81. --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/CharChangePotions.java
  82. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/CharChangePotions.java
  83. @@ -50,6 +50,9 @@
  84. return;
  85. }
  86.  
  87. + if (!activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  88. + return;
  89. +
  90. switch (itemId)
  91. {
  92. case 5235:
  93. @@ -96,19 +99,9 @@
  94. break;
  95. }
  96.  
  97. - // Create a summon effect!
  98. - MagicSkillUse MSU = new MagicSkillUse(playable, activeChar, 2003, 1, 1, 0);
  99. - activeChar.broadcastPacket(MSU, 1500);
  100. -
  101. - // Update the changed stat for the character in the DB.
  102. activeChar.store();
  103. -
  104. - // Remove the item from inventory.
  105. - activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
  106. -
  107. - // Broadcast the changes to the char and all those nearby.
  108. - UserInfo ui = new UserInfo(activeChar);
  109. - activeChar.broadcastPacket(ui, 1500);
  110. + activeChar.broadcastPacket(new MagicSkillUse(playable, activeChar, 2003, 1, 1, 0), 1500);
  111. + activeChar.broadcastPacket(new UserInfo(activeChar), 1500);
  112. }
  113.  
  114. @Override
  115. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/MapForestOfTheDead.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/MapForestOfTheDead.java
  116. index 20dd899..21bc9a4 100644
  117. --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/MapForestOfTheDead.java
  118. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/MapForestOfTheDead.java
  119. @@ -21,12 +21,9 @@
  120. public void useItem(L2Playable playable, L2ItemInstance item)
  121. {
  122. if (!(playable instanceof L2PcInstance))
  123. - {
  124. return;
  125. - }
  126.  
  127. - int itemId = item.getItemId();
  128. - if (itemId == 7063)
  129. + if (item.getItemId() == 7063)
  130. {
  131. NpcHtmlMessage html = new NpcHtmlMessage(5);
  132. StringBuilder map = new StringBuilder("<html><title>Map - Forest of the Dead</title>");
  133. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Potions.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Potions.java
  134. index 03581ed..017b4dc 100644
  135. --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Potions.java
  136. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Potions.java
  137. @@ -10,7 +10,6 @@
  138. import com.l2jhellas.gameserver.model.actor.instance.L2PetInstance;
  139. import com.l2jhellas.gameserver.model.actor.item.L2ItemInstance;
  140. import com.l2jhellas.gameserver.network.SystemMessageId;
  141. -import com.l2jhellas.gameserver.network.serverpackets.ActionFailed;
  142. import com.l2jhellas.gameserver.network.serverpackets.SystemMessage;
  143. import com.l2jhellas.gameserver.skills.SkillTable;
  144.  
  145. @@ -138,13 +137,7 @@
  146. activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
  147. return;
  148. }
  149. -
  150. - if (activeChar.isAllSkillsDisabled())
  151. - {
  152. - activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  153. - return;
  154. - }
  155. -
  156. +
  157. if (!Config.ALLOW_POTS_IN_PVP)
  158. {
  159. if (activeChar.getPvpFlag() != 0)
  160. @@ -449,9 +442,7 @@
  161. // custom pot durations...
  162. if (e.getTaskTime() > (e.getSkill().getBuffDuration() * 67) / 100000)
  163. return true;
  164. - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_PREPARED_FOR_REUSE);
  165. - sm.addItemName(itemId);
  166. - activeChar.sendPacket(sm);
  167. + activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_PREPARED_FOR_REUSE).addItemName(itemId));
  168. return false;
  169. }
  170. }
  171. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Primeval.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Primeval.java
  172. index 13ba377..77d3dcd 100644
  173. --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Primeval.java
  174. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Primeval.java
  175. @@ -29,17 +29,11 @@
  176. L2PcInstance activeChar;
  177.  
  178. if (playable instanceof L2PcInstance)
  179. - {
  180. activeChar = (L2PcInstance) playable;
  181. - }
  182. else if (playable instanceof L2PetInstance)
  183. - {
  184. activeChar = ((L2PetInstance) playable).getOwner();
  185. - }
  186. else
  187. - {
  188. return;
  189. - }
  190.  
  191. if (activeChar.isInOlympiadMode())
  192. {
  193. @@ -53,26 +47,17 @@
  194. return;
  195. }
  196.  
  197. + if (!activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  198. + return;
  199. +
  200. int itemId = item.getItemId();
  201. - L2Skill skill = null;
  202.  
  203. - switch (itemId)
  204. - {
  205. - case 8786:
  206. - skill = SkillTable.getInstance().getInfo(2305, 1);
  207. - break;
  208. - // Springant's Fruit need correct skill id (effect primeval potions is a temp fix).
  209. - case 8787:
  210. - skill = SkillTable.getInstance().getInfo(2305, 1);
  211. - break;
  212. - default:
  213. - }
  214. -
  215. + L2Skill skill = itemId == 8786 ? SkillTable.getInstance().getInfo(2305, 1)
  216. + // Springant's Fruit need correct skill id (effect primeval potions is a temp fix).
  217. + : itemId == 8787 ? SkillTable.getInstance().getInfo(2305, 1) : null;
  218. +
  219. if (skill != null)
  220. - {
  221. activeChar.doCast(skill);
  222. - playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
  223. - }
  224. }
  225.  
  226. @Override
  227. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/SoulShots.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/SoulShots.java
  228. index 31923bc..01ff8f7 100644
  229. --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/SoulShots.java
  230. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/SoulShots.java
  231. @@ -98,7 +98,7 @@
  232.  
  233. // Send message to client
  234. activeChar.sendPacket(SystemMessageId.ENABLED_SOULSHOT);
  235. - Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, SKILL_IDS[weaponGrade.getId()], 1, 0, 0), 600);
  236. + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, SKILL_IDS[weaponGrade.getId()], 1, 0, 0), 500);
  237. }
  238.  
  239. @Override
  240. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/SpiritShot.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/SpiritShot.java
  241. index 716a812..589404e 100644
  242. --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/SpiritShot.java
  243. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/SpiritShot.java
  244. @@ -94,7 +94,7 @@
  245.  
  246. // Send message to client
  247. activeChar.sendPacket(SystemMessageId.ENABLED_SPIRITSHOT);
  248. - Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, SKILL_IDS[weaponGrade.getId()], 1, 0, 0), 600);
  249. + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, SKILL_IDS[weaponGrade.getId()], 1, 0, 0), 500);
  250. }
  251.  
  252. @Override
  253. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/instancemanager/ItemsOnGroundManager.java b/L2JHellasC/java/com/l2jhellas/gameserver/instancemanager/ItemsOnGroundManager.java
  254. index 5ca11d8..59a6c6a 100644
  255. --- a/L2JHellasC/java/com/l2jhellas/gameserver/instancemanager/ItemsOnGroundManager.java
  256. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/instancemanager/ItemsOnGroundManager.java
  257. @@ -29,7 +29,7 @@
  258. return;
  259. _items = new ArrayList<>();
  260. if (Config.SAVE_DROPPED_ITEM_INTERVAL > 0)
  261. - ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new storeInDb(), Config.SAVE_DROPPED_ITEM_INTERVAL, Config.SAVE_DROPPED_ITEM_INTERVAL);
  262. + ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new saveTask(), Config.SAVE_DROPPED_ITEM_INTERVAL, Config.SAVE_DROPPED_ITEM_INTERVAL);
  263. }
  264.  
  265. public static final ItemsOnGroundManager getInstance()
  266. @@ -56,79 +56,72 @@
  267. if (!Config.SAVE_DROPPED_ITEM)
  268. return;
  269.  
  270. + _items.clear();
  271. +
  272. // if DestroyPlayerDroppedItem was previously false, items curently protected will be added to ItemsAutoDestroy
  273. if (Config.DESTROY_DROPPED_PLAYER_ITEM)
  274. {
  275. - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  276. + String str = null;
  277. + if (!Config.DESTROY_EQUIPABLE_PLAYER_ITEM) // Recycle Misc
  278. + str = "UPDATE itemsonground SET drop_time=? WHERE drop_time=-1 AND equipable=0";
  279. + else if (Config.DESTROY_EQUIPABLE_PLAYER_ITEM) // Recycle All
  280. + str = "UPDATE itemsonground SET drop_time=? WHERE drop_time=-1";
  281. +
  282. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  283. + PreparedStatement ps = con.prepareStatement(str))
  284. {
  285. - String str = null;
  286. - if (!Config.DESTROY_EQUIPABLE_PLAYER_ITEM) // Recycle Misc
  287. - str = "UPDATE itemsonground SET drop_time=? WHERE drop_time=-1 AND equipable=0";
  288. - else if (Config.DESTROY_EQUIPABLE_PLAYER_ITEM) // Recycle All
  289. - str = "UPDATE itemsonground SET drop_time=? WHERE drop_time=-1";
  290. -
  291. - PreparedStatement statement = con.prepareStatement(str);
  292. - statement.setLong(1, System.currentTimeMillis());
  293. - statement.execute();
  294. - statement.close();
  295. + ps.setLong(1, System.currentTimeMillis());
  296. + ps.execute();
  297. }
  298. catch (SQLException e)
  299. {
  300. _log.warning(ItemsOnGroundManager.class.getName() + ": error while updating table ItemsOnGround ");
  301. if (Config.DEVELOPER)
  302. e.printStackTrace();
  303. - }
  304. + }
  305. }
  306.  
  307. // Add items to world
  308. - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  309. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  310. + PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground"))
  311. {
  312. - Statement s = con.createStatement();
  313. - ResultSet result;
  314. - int count = 0;
  315. - result = s.executeQuery("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground");
  316. - while (result.next())
  317. + try (ResultSet rs = ps.executeQuery())
  318. {
  319. - L2ItemInstance item = new L2ItemInstance(result.getInt(1), result.getInt(2));
  320. - L2World.getInstance().storeObject(item);
  321. - if (item.isStackable() && result.getInt(3) > 1) // this check and..
  322. - item.setCount(result.getInt(3));
  323. - if (result.getInt(4) > 0) // this, are really necessary?
  324. - item.setEnchantLevel(result.getInt(4));
  325. - item.getPosition().setWorldPosition(result.getInt(5), result.getInt(6), result.getInt(7));
  326. - item.getPosition().setWorldRegion(L2World.getInstance().getRegion(item.getPosition().getWorldPosition()));
  327. - item.getWorldRegion().addVisibleObject(item);
  328. - item.setDropTime(result.getLong(8));
  329. - if (result.getLong(8) == -1)
  330. - item.setProtected(true);
  331. - else
  332. - item.setProtected(false);
  333. - item.setIsVisible(true);
  334. - L2World.getInstance().addVisibleObject(item, item.getWorldRegion());
  335. - _items.add(item);
  336. - count++;
  337. - // add to ItemsAutoDestroy only items not protected
  338. - if (!Config.LIST_PROTECTED_ITEMS.contains(item.getItemId()))
  339. + while (rs.next())
  340. {
  341. - if (result.getLong(8) > -1)
  342. + L2ItemInstance item = new L2ItemInstance(rs.getInt(1), rs.getInt(2));
  343. +
  344. + L2World.getInstance().storeObject(item);
  345. +
  346. + if (item.isStackable() && rs.getInt(3) > 1) // this check and..
  347. + item.setCount(rs.getInt(3));
  348. + if (rs.getInt(4) > 0) // this, are really necessary?
  349. + item.setEnchantLevel(rs.getInt(4));
  350. +
  351. + item.getPosition().setWorldPosition(rs.getInt(5),rs.getInt(6),rs.getInt(7));
  352. + item.getPosition().setWorldRegion(L2World.getInstance().getRegion(item.getPosition().getWorldPosition()));
  353. + item.getWorldRegion().addVisibleObject(item);
  354. + item.setDropTime(rs.getLong(8));
  355. + item.setProtected(rs.getLong(8) == -1 ? true : false);
  356. + item.setIsVisible(true);
  357. + L2World.getInstance().addVisibleObject(item, item.getWorldRegion());
  358. + _items.add(item);
  359. +
  360. + // add to ItemsAutoDestroy only items not protected
  361. + if (!Config.LIST_PROTECTED_ITEMS.contains(item.getItemId()))
  362. {
  363. - if (Config.AUTODESTROY_ITEM_AFTER > 0)
  364. - ItemsAutoDestroy.getInstance().addItem(item);
  365. + if (rs.getLong(8) > -1 && Config.AUTODESTROY_ITEM_AFTER > 0)
  366. + ItemsAutoDestroy.getInstance().addItem(item);
  367. }
  368. }
  369. }
  370. - result.close();
  371. - s.close();
  372. - if (count > 0)
  373. - _log.info(ItemsOnGroundManager.class.getSimpleName() + ": restored " + count + " items.");
  374. - else
  375. - _log.info(ItemsOnGroundManager.class.getSimpleName() + ": Initializing ItemsOnGroundManager.");
  376. +
  377. + _log.info(ItemsOnGroundManager.class.getSimpleName() + ": Initializing ItemsOnGroundManager.");
  378. }
  379. - catch (SQLException e)
  380. + catch (Exception e)
  381. {
  382. _log.warning(ItemsOnGroundManager.class.getName() + ": error while loading ItemsOnGround ");
  383. - if (Config.DEVELOPER)
  384. - e.printStackTrace();
  385. + e.printStackTrace();
  386. }
  387.  
  388. if (Config.EMPTY_DROPPED_ITEM_TABLE_AFTER_LOAD)
  389. @@ -149,7 +142,7 @@
  390.  
  391. public void saveInDb()
  392. {
  393. - new storeInDb().run();
  394. + storeInDb();
  395. }
  396.  
  397. public void cleanUp()
  398. @@ -159,41 +152,49 @@
  399.  
  400. public void emptyTable()
  401. {
  402. - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  403. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  404. + Statement s = con.createStatement())
  405. {
  406. - PreparedStatement del = con.prepareStatement("DELETE FROM itemsonground");
  407. - del.execute();
  408. - del.close();
  409. + s.executeUpdate("DELETE FROM itemsonground");
  410. }
  411. - catch (SQLException e)
  412. + catch (Exception e)
  413. {
  414. _log.warning(ItemsOnGroundManager.class.getName() + ": error while cleaning table ItemsOnGround ");
  415. - if (Config.DEVELOPER)
  416. - e.printStackTrace();
  417. }
  418. }
  419. -
  420. - protected class storeInDb extends Thread
  421. +
  422. + protected class saveTask implements Runnable
  423. {
  424. @Override
  425. public void run()
  426. {
  427. - if (!Config.SAVE_DROPPED_ITEM)
  428. - return;
  429. -
  430. - emptyTable();
  431. -
  432. - if (_items.isEmpty())
  433. - return;
  434. -
  435. + storeInDb();
  436. + }
  437. + }
  438. +
  439. + private synchronized void storeInDb()
  440. + {
  441. + if (!Config.SAVE_DROPPED_ITEM)
  442. + return;
  443. +
  444. + emptyTable();
  445. +
  446. + if (_items.isEmpty())
  447. + return;
  448. +
  449. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  450. + PreparedStatement statement = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES (?,?,?,?,?,?,?,?,?)"))
  451. + {
  452. for (L2ItemInstance item : _items)
  453. {
  454. + if (item == null)
  455. + continue;
  456. +
  457. if (CursedWeaponsManager.getInstance().isCursed(item.getItemId()))
  458. - continue; // Cursed Items not saved to ground, prevent double save
  459. -
  460. - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  461. + continue;
  462. +
  463. + try
  464. {
  465. - PreparedStatement statement = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES (?,?,?,?,?,?,?,?,?)");
  466. statement.setInt(1, item.getObjectId());
  467. statement.setInt(2, item.getItemId());
  468. statement.setInt(3, item.getCount());
  469. @@ -201,27 +202,20 @@
  470. statement.setInt(5, item.getX());
  471. statement.setInt(6, item.getY());
  472. statement.setInt(7, item.getZ());
  473. -
  474. - if (item.isProtected())
  475. - statement.setLong(8, -1); // item will be protected
  476. - else
  477. - statement.setLong(8, item.getDropTime()); // item will be added to ItemsAutoDestroy
  478. - if (item.isEquipable())
  479. - statement.setLong(9, 1); // set equipable
  480. - else
  481. - statement.setLong(9, 0);
  482. - statement.execute();
  483. - statement.close();
  484. + statement.setLong(8, item.isProtected() ? -1 : item.getDropTime());
  485. + statement.setLong(9, item.isEquipable() ? 1 : 0);
  486. }
  487. - catch (SQLException e)
  488. - {
  489. + catch (Exception e)
  490. + {
  491. _log.warning(ItemsOnGroundManager.class.getName() + ": error while inserting into table ItemsOnGround ");
  492. - if (Config.DEVELOPER)
  493. - e.printStackTrace();
  494. + e.printStackTrace();
  495. }
  496. }
  497. - if (Config.DEBUG)
  498. - _log.config(ItemsOnGroundManager.class.getName() + ": " + _items.size() + " items on ground saved.");
  499. + }
  500. + catch (SQLException e)
  501. + {
  502. + _log.warning(ItemsOnGroundManager.class.getName() + ": error while storing items on groun ");
  503. + e.printStackTrace();
  504. }
  505. }
  506. }
  507. \ No newline at end of file
  508. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/instancemanager/MercTicketManager.java b/L2JHellasC/java/com/l2jhellas/gameserver/instancemanager/MercTicketManager.java
  509. index d95afc7..0f2177b 100644
  510. --- a/L2JHellasC/java/com/l2jhellas/gameserver/instancemanager/MercTicketManager.java
  511. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/instancemanager/MercTicketManager.java
  512. @@ -40,192 +40,28 @@
  513.  
  514. private List<L2ItemInstance> _droppedTickets; // to keep track of items on the ground
  515.  
  516. - // TODO move all these values into siege.ini
  517. // max tickets per merc type = 10 + (castleid * 2)?
  518. // max ticker per castle = 40 + (castleid * 20)?
  519. private static final int[] MAX_MERC_PER_TYPE =
  520. - {
  521. - 10,
  522. - 10,
  523. - 10,
  524. - 10,
  525. - 10,
  526. - 10,
  527. - 10,
  528. - 10,
  529. - 10,
  530. - 10,
  531. - 10,
  532. - 10,
  533. - 10,
  534. - 10,
  535. - 10,
  536. - 10,
  537. - 10,
  538. - 10,
  539. - 10,
  540. - 10, // Gludio
  541. - 15,
  542. - 15,
  543. - 15,
  544. - 15,
  545. - 15,
  546. - 15,
  547. - 15,
  548. - 15,
  549. - 15,
  550. - 15,
  551. - 15,
  552. - 15,
  553. - 15,
  554. - 15,
  555. - 15,
  556. - 15,
  557. - 15,
  558. - 15,
  559. - 15,
  560. - 15, // Dion
  561. - 10,
  562. - 10,
  563. - 10,
  564. - 10,
  565. - 10,
  566. - 10,
  567. - 10,
  568. - 10,
  569. - 10,
  570. - 10,
  571. - 10,
  572. - 10,
  573. - 10,
  574. - 10,
  575. - 10,
  576. - 10,
  577. - 10,
  578. - 10,
  579. - 10,
  580. - 10, // Giran
  581. - 10,
  582. - 10,
  583. - 10,
  584. - 10,
  585. - 10,
  586. - 10,
  587. - 10,
  588. - 10,
  589. - 10,
  590. - 10,
  591. - 10,
  592. - 10,
  593. - 10,
  594. - 10,
  595. - 10,
  596. - 10,
  597. - 10,
  598. - 10,
  599. - 10,
  600. - 10, // Oren
  601. - 20,
  602. - 20,
  603. - 20,
  604. - 20,
  605. - 20,
  606. - 20,
  607. - 20,
  608. - 20,
  609. - 20,
  610. - 20,
  611. - 20,
  612. - 20,
  613. - 20,
  614. - 20,
  615. - 20,
  616. - 20,
  617. - 20,
  618. - 20,
  619. - 20,
  620. - 20, // Aden
  621. - 20,
  622. - 20,
  623. - 20,
  624. - 20,
  625. - 20,
  626. - 20,
  627. - 20,
  628. - 20,
  629. - 20,
  630. - 20,
  631. - 20,
  632. - 20,
  633. - 20,
  634. - 20,
  635. - 20,
  636. - 20,
  637. - 20,
  638. - 20,
  639. - 20,
  640. - 20, // Innadril
  641. - 20,
  642. - 20,
  643. - 20,
  644. - 20,
  645. - 20,
  646. - 20,
  647. - 20,
  648. - 20,
  649. - 20,
  650. - 20,
  651. - 20,
  652. - 20,
  653. - 20,
  654. - 20,
  655. - 20,
  656. - 20,
  657. - 20,
  658. - 20,
  659. - 20,
  660. - 20, // Goddard
  661. - 20,
  662. - 20,
  663. - 20,
  664. - 20,
  665. - 20,
  666. - 20,
  667. - 20,
  668. - 20,
  669. - 20,
  670. - 20,
  671. - 20,
  672. - 20,
  673. - 20,
  674. - 20,
  675. - 20,
  676. - 20,
  677. - 20,
  678. - 20,
  679. - 20,
  680. - 20, // Rune
  681. - 20,
  682. - 20,
  683. - 20,
  684. - 20,
  685. - 20,
  686. - 20,
  687. - 20,
  688. - 20,
  689. - 20,
  690. - 20,
  691. - 20,
  692. - 20,
  693. - 20,
  694. - 20,
  695. - 20,
  696. - 20,
  697. - 20,
  698. - 20,
  699. - 20,
  700. - 20
  701. - // Schuttgart
  702. + {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  703. + 10, // Gludio
  704. + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
  705. + 15, 15, 15, // Dion
  706. + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  707. + 10, 10, 10, // Giran
  708. + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  709. + 10, 10, 10, // Oren
  710. + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
  711. + 20, 20, 20, // Aden
  712. + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
  713. + 20, 20, 20, // Innadril
  714. + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
  715. + 20, 20, 20, // Goddard
  716. + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
  717. + 20, 20, 20, // Rune
  718. + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
  719. + 20, 20, 20
  720. + // Schuttgart
  721. };
  722. private static final int[] MERCS_MAX_PER_CASTLE =
  723. {
  724. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/model/L2Skill.java b/L2JHellasC/java/com/l2jhellas/gameserver/model/L2Skill.java
  725. index c0fa064..efd3328 100644
  726. --- a/L2JHellasC/java/com/l2jhellas/gameserver/model/L2Skill.java
  727. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/model/L2Skill.java
  728. @@ -10,6 +10,7 @@
  729. import com.l2jhellas.gameserver.enums.ZoneId;
  730. import com.l2jhellas.gameserver.enums.items.L2ArmorType;
  731. import com.l2jhellas.gameserver.enums.player.ClassId;
  732. +import com.l2jhellas.gameserver.enums.player.Position;
  733. import com.l2jhellas.gameserver.enums.skills.HeroSkills;
  734. import com.l2jhellas.gameserver.enums.skills.L2SkillTargetType;
  735. import com.l2jhellas.gameserver.enums.skills.L2SkillType;
  736. @@ -1379,14 +1380,18 @@
  737. };
  738.  
  739. int radius = getSkillRadius();
  740. - for (L2Object obj : L2World.getInstance().getVisibleObjects(activeChar, L2Object.class, radius))
  741. + for (L2Character obj : L2World.getInstance().getVisibleObjects(activeChar, L2Character.class, radius))
  742. {
  743. if (obj == null)
  744. continue;
  745. +
  746. if (!Util.checkIfInRange(radius, activeChar, obj, true))
  747. continue;
  748.  
  749. - if (obj instanceof L2Attackable && obj != target)
  750. + final Position position = Position.getPosition(activeChar,obj);
  751. + final boolean isFront = position != Position.BACK;
  752. +
  753. + if (isFront && obj instanceof L2Attackable && obj != target)
  754. targetList.add((L2Character) obj);
  755.  
  756. if (targetList.size() == 0)
  757. @@ -1396,8 +1401,6 @@
  758. }
  759. }
  760. return targetList.toArray(new L2Character[targetList.size()]);
  761. - // TODO multiface targets all around right now. need it to just get targets
  762. - // the character is facing.
  763. }
  764. case TARGET_PARTY:
  765. {
  766. @@ -1532,23 +1535,26 @@
  767. {
  768. // Get all visible objects in a spheric area near the L2Character
  769. // Get Clan Members
  770. - for (L2Object newTarget : L2World.getInstance().getVisibleObjects(activeChar, L2Object.class, radius))
  771. + for (L2PcInstance newTarget : L2World.getInstance().getVisibleObjects(activeChar, L2PcInstance.class, radius))
  772. {
  773. - if (newTarget == null || !(newTarget instanceof L2PcInstance))
  774. + if (newTarget == null)
  775. continue;
  776. - if ((((L2PcInstance) newTarget).getAllyId() == 0 || ((L2PcInstance) newTarget).getAllyId() != player.getAllyId()) && (((L2PcInstance) newTarget).getClan() == null || ((L2PcInstance) newTarget).getClanId() != player.getClanId()))
  777. +
  778. + if ((newTarget.getAllyId() == 0 || (newTarget.getAllyId() != player.getAllyId()) && newTarget.getClan() == null || newTarget.getClanId() != player.getClanId()))
  779. continue;
  780. +
  781. if (player.isInDuel() && (player.getDuelId() != ((L2PcInstance) newTarget).getDuelId() || (player.getParty() != null && !player.getParty().getPartyMembers().contains(newTarget))))
  782. continue;
  783.  
  784. if (targetType == L2SkillTargetType.TARGET_CORPSE_ALLY)
  785. {
  786. - if (!((L2PcInstance) newTarget).isDead())
  787. + if (!newTarget.isDead())
  788. continue;
  789. +
  790. if (getSkillType() == L2SkillType.RESURRECT)
  791. {
  792. // check target is not in a active siege zone
  793. - if (((L2PcInstance) newTarget).isInsideZone(ZoneId.SIEGE))
  794. + if (newTarget.isInsideZone(ZoneId.SIEGE))
  795. continue;
  796. }
  797. }
  798. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/L2Character.java b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/L2Character.java
  799. index a02fcfa..5b20c6d 100644
  800. --- a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/L2Character.java
  801. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/L2Character.java
  802. @@ -436,6 +436,12 @@
  803.  
  804. if (TargetPlayer != null)
  805. {
  806. + if(TargetPlayer.getAppearance().getInvisible())
  807. + {
  808. + player.sendPacket(ActionFailed.STATIC_PACKET);
  809. + return;
  810. + }
  811. +
  812. if(player.isInFunEvent() && TargetPlayer.isInFunEvent() && !EventManager.getInstance().canAttack(player,TargetPlayer))
  813. {
  814. player.sendPacket(ActionFailed.STATIC_PACKET);
  815. @@ -471,7 +477,7 @@
  816. }
  817.  
  818. if(player != null && stopMov)
  819. - stopMove(null);
  820. + player.stopMove(null);
  821.  
  822. // Get the active weapon instance (always equipped in the right hand)
  823. L2ItemInstance weaponInst = getActiveWeaponInstance();
  824. @@ -878,53 +884,51 @@
  825. }
  826.  
  827. public void doCast(L2Skill skill)
  828. - {
  829. + {
  830. if (skill == null)
  831. {
  832. getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
  833. return;
  834. }
  835.  
  836. - if (isSkillDisabled(skill.getId()))
  837. + if(!skill.isPotion())
  838. {
  839. - if (this instanceof L2PcInstance)
  840. + if (isSkillDisabled(skill.getId()))
  841. {
  842. - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_PREPARED_FOR_REUSE);
  843. - sm.addSkillName(skill.getId(), skill.getLevel());
  844. - sendPacket(sm);
  845. + if (isPlayer())
  846. + sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_PREPARED_FOR_REUSE).addSkillName(skill.getId(), skill.getLevel()));
  847. +
  848. + return;
  849. }
  850.  
  851. - return;
  852. + // Check if the skill is a magic spell and if the L2Character is not muted
  853. + if (skill.isMagic() && isMuted())
  854. + {
  855. + getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
  856. + return;
  857. + }
  858. +
  859. + // Check if the skill is psychical and if the L2Character is not psychical_muted
  860. + if (!skill.isMagic() && isPsychicalMuted())
  861. + {
  862. + getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
  863. + return;
  864. + }
  865. }
  866.  
  867. - // Check if the skill is a magic spell and if the L2Character is not muted
  868. - if (skill.isMagic() && isMuted() && !skill.isPotion())
  869. - {
  870. - getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
  871. - return;
  872. - }
  873. -
  874. - // Check if the skill is psychical and if the L2Character is not psychical_muted
  875. - if (!skill.isMagic() && isPsychicalMuted() && !skill.isPotion())
  876. - {
  877. - getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
  878. - return;
  879. - }
  880. -
  881. - if (this instanceof L2PcInstance)
  882. + if (isPlayer())
  883. {
  884. L2PcInstance player = (L2PcInstance) this;
  885.  
  886. if (player.getTarget() != null && player.getTarget() == player && skill.getSkillType() == L2SkillType.CHARGEDAM)
  887. return;
  888. - }
  889. -
  890. - // Can't use Hero and resurrect skills during Olympiad
  891. - if (this instanceof L2PcInstance && ((L2PcInstance) this).isInOlympiadMode() && (skill.isHeroSkill() || skill.getSkillType() == L2SkillType.RESURRECT))
  892. - {
  893. - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THIS_SKILL_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
  894. - sendPacket(sm);
  895. - return;
  896. +
  897. + // Can't use Hero and resurrect skills during Olympiad
  898. + if (player.isInOlympiadMode() && (skill.isHeroSkill() || skill.getSkillType() == L2SkillType.RESURRECT))
  899. + {
  900. + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THIS_SKILL_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT));
  901. + return;
  902. + }
  903. }
  904.  
  905. // prevent casting signets to peace zone
  906. @@ -945,9 +949,7 @@
  907. canCast = false;
  908. if (!canCast)
  909. {
  910. - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
  911. - sm.addSkillName(skill);
  912. - sendPacket(sm);
  913. + sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED).addSkillName(skill));
  914. return;
  915. }
  916. }
  917. @@ -961,7 +963,7 @@
  918. {
  919. target = (L2Character) targets[0];
  920.  
  921. - if (this instanceof L2PcInstance && target instanceof L2PcInstance && target.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK)
  922. + if (isPlayer() && target.isPlayer() && target.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK)
  923. {
  924. if (skill.getSkillType() == L2SkillType.BUFF || skill.getSkillType() == L2SkillType.HOT || skill.getSkillType() == L2SkillType.HEAL || skill.getSkillType() == L2SkillType.HEAL_PERCENT || skill.getSkillType() == L2SkillType.MANAHEAL || skill.getSkillType() == L2SkillType.MANAHEAL_PERCENT || skill.getSkillType() == L2SkillType.BALANCE_LIFE)
  925. target.setLastBuffer(this);
  926. @@ -1081,13 +1083,9 @@
  927. broadcastPacket(!skill.isPotion() ? new MagicSkillUse(this, target, displayId, level, hitTime, reuseDelay, false) : new MagicSkillUse(this, target, displayId, level, 0, 0));
  928.  
  929. // Send a system message USE_S1 to the L2Character
  930. - if (this instanceof L2PcInstance && magicId != 1312)
  931. - {
  932. - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.USE_S1);
  933. - sm.addSkillName(magicId, skill.getLevel());
  934. - sendPacket(sm);
  935. - }
  936. -
  937. + if (isPlayer() && magicId != 1312)
  938. + sendPacket(SystemMessage.getSystemMessage(SystemMessageId.USE_S1).addSkillName(magicId, skill.getLevel()));
  939. +
  940. // Skill reuse check
  941. if (reuseDelay > 30000 && !skillMastery)
  942. addTimeStamp(skill.getId(), reuseDelay);
  943. @@ -1393,7 +1391,7 @@
  944. {
  945. return _allSkillsDisabled || isImmobileUntilAttacked() || isStunned() || isSleeping() || isParalyzed();
  946. }
  947. -
  948. +
  949. public boolean isAttackingDisabled()
  950. {
  951. return isImmobileUntilAttacked() || isStunned() || isSleeping() || _attackEndTime > GameTimeController.getInstance().getGameTicks() || isFakeDeath() || isParalyzed();
  952. @@ -2682,7 +2680,7 @@
  953.  
  954. // cancels the skill hit scheduled task
  955. enableAllSkills(); // re-enables the skills
  956. - if (this instanceof L2PcInstance)
  957. + if (isPlayer())
  958. getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); // setting
  959. // back
  960. // previous
  961. @@ -3986,10 +3984,7 @@
  962. }
  963. targets = targetList.toArray(new L2Character[targetList.size()]);
  964. }
  965. -
  966. - // Ensure that a cast is in progress
  967. - // Check if player is using fake death.
  968. - // Potions can be used while faking death.
  969. +
  970. if (!isCastingNow() || (isAlikeDead() && !skill.isPotion()))
  971. {
  972. _skillCast = null;
  973. @@ -4180,11 +4175,11 @@
  974. {
  975. getAI().clientStartAutoAttack();
  976.  
  977. - if (target instanceof L2PcInstance)
  978. + if (target.isPlayer())
  979. {
  980. ((L2PcInstance) target).getAI().clientStartAutoAttack();
  981.  
  982. - player = null;
  983. + L2PcInstance player = null;
  984.  
  985. if (this instanceof L2PcInstance)
  986. player = (L2PcInstance) this;
  987. @@ -4333,7 +4328,7 @@
  988. default: // Launch weapon Special ability skill effect if available
  989. if (getActiveWeaponItem() != null && !target.isDead())
  990. {
  991. - if (this instanceof L2PcInstance && getActiveWeaponItem().getSkillEffects(this, target, skill).length > 0)
  992. + if (isPlayer() && getActiveWeaponItem().getSkillEffects(this, target, skill).length > 0)
  993. sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_ACTIVATED).addSkillName(skill));
  994. }
  995.  
  996. @@ -4400,7 +4395,7 @@
  997. }
  998. else
  999. {
  1000. - if (target instanceof L2PcInstance)
  1001. + if (target.isPlayer())
  1002. {
  1003. // Casting non offensive skill on player with pvp flag set or with karma
  1004. if (!(target.equals(this) || target.equals(player)) && (((L2PcInstance) target).getPvpFlag() > 0 || ((L2PcInstance) target).getKarma() > 0))
  1005. @@ -5081,7 +5076,6 @@
  1006. getAI().stopAITask();
  1007. }
  1008.  
  1009. - private L2PcInstance player;
  1010.  
  1011. public final void stopEffectsOnDamage(boolean awake)
  1012. {
  1013. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2EventBossInstance.java b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2EventBossInstance.java
  1014. index bcd2800..92453e4 100644
  1015. --- a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2EventBossInstance.java
  1016. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2EventBossInstance.java
  1017. @@ -34,22 +34,10 @@
  1018. @Override
  1019. public void reduceCurrentHp(double damage, L2Character attacker, boolean awake)
  1020. {
  1021. - if (IsInSocialAction() || isInvul())
  1022. + if (isInvul())
  1023. return;
  1024.  
  1025. super.reduceCurrentHp(damage, attacker, awake);
  1026. - }
  1027. -
  1028. - protected boolean _isInSocialAction = false;
  1029. -
  1030. - public boolean IsInSocialAction()
  1031. - {
  1032. - return _isInSocialAction;
  1033. - }
  1034. -
  1035. - public void setIsInSocialAction(boolean value)
  1036. - {
  1037. - _isInSocialAction = value;
  1038. }
  1039.  
  1040. @Override
  1041. @@ -79,22 +67,10 @@
  1042. }
  1043. return true;
  1044. }
  1045. -
  1046. - @Override
  1047. - public void doAttack(L2Character target,boolean stopMov)
  1048. - {
  1049. - if (_isInSocialAction)
  1050. - return;
  1051.  
  1052. - super.doAttack(target,true);
  1053. - }
  1054. -
  1055. @Override
  1056. public void doCast(L2Skill skill)
  1057. {
  1058. - if (_isInSocialAction)
  1059. - return;
  1060. -
  1061. super.doCast(skill);
  1062. }
  1063.  
  1064. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/Inventory.java b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/Inventory.java
  1065. index e52d351..0aebe93 100644
  1066. --- a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/Inventory.java
  1067. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/Inventory.java
  1068. @@ -3,7 +3,6 @@
  1069. import java.sql.Connection;
  1070. import java.sql.PreparedStatement;
  1071. import java.sql.ResultSet;
  1072. -import java.sql.SQLException;
  1073. import java.util.ArrayList;
  1074. import java.util.List;
  1075. import java.util.Objects;
  1076. @@ -1152,71 +1151,66 @@
  1077. return getItemByItemId(arrowsId);
  1078. }
  1079.  
  1080. +
  1081. @Override
  1082. public void restore()
  1083. {
  1084. - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  1085. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  1086. + PreparedStatement ps = con.prepareStatement("SELECT object_id, item_id, count, enchant_level, loc, loc_data, price_sell, price_buy, custom_type1, custom_type2, mana_left FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
  1087. {
  1088. - PreparedStatement statement = con.prepareStatement("SELECT object_id FROM items WHERE owner_id=? AND (loc=? OR loc=?) " + "ORDER BY object_id DESC");
  1089. - statement.setInt(1, getOwner().getObjectId());
  1090. - statement.setString(2, getBaseLocation().name());
  1091. - statement.setString(3, getEquipLocation().name());
  1092. - ResultSet inv = statement.executeQuery();
  1093. + ps.setInt(1, getOwnerId());
  1094. + ps.setString(2, getBaseLocation().name());
  1095. + ps.setString(3, getEquipLocation().name());
  1096.  
  1097. - L2ItemInstance item;
  1098. - while (inv.next())
  1099. + try (ResultSet rs = ps.executeQuery())
  1100. {
  1101. - int objectId = inv.getInt(1);
  1102. - item = L2ItemInstance.restoreFromDb(objectId);
  1103. - if (item == null)
  1104. - continue;
  1105. -
  1106. - if (L2World.getInstance().findObject(inv.getInt("object_id")) != null)
  1107. + while (rs.next())
  1108. {
  1109. - _log.warning(Inventory.class.getSimpleName() + ": Item: " + item.getObjectId() + " Has duplied on world and cannot be load");
  1110. - L2World.getInstance().removeObject(item);
  1111. - if (getOwner() instanceof L2PcInstance)
  1112. + // Restore the item.
  1113. + int objectId = rs.getInt(1);
  1114. + final L2ItemInstance item = L2ItemInstance.restoreFromDb(getOwnerId(), rs);
  1115. +
  1116. + if (item == null)
  1117. + continue;
  1118. +
  1119. + if (L2World.getInstance().findObject(objectId) != null)
  1120. + {
  1121. + _log.warning(Inventory.class.getSimpleName() + ": Item: " + item.getObjectId() + " Has duplied on world and cannot be load");
  1122. + L2World.getInstance().removeObject(item);
  1123. + if (getOwner() instanceof L2PcInstance)
  1124. + {
  1125. + final L2PcInstance player = (L2PcInstance) getOwner();
  1126. + player.closeNetConnection(false);
  1127. + }
  1128. + continue;
  1129. + }
  1130. +
  1131. + if (getOwner().isPlayer())
  1132. {
  1133. final L2PcInstance player = (L2PcInstance) getOwner();
  1134. - player.closeNetConnection(false);
  1135. - }
  1136. - continue;
  1137. - }
  1138. -
  1139. - if (getOwner() instanceof L2PcInstance)
  1140. - {
  1141. - final L2PcInstance player = (L2PcInstance) getOwner();
  1142. -
  1143. - if (!player.isGM())
  1144. - {
  1145. - if (!player.isHero())
  1146. +
  1147. + if (!player.isGM())
  1148. {
  1149. - int itemId = item.getItemId();
  1150. - if ((itemId >= 6611 && itemId <= 6621) || itemId == 6842)
  1151. + if (!player.isHero() && item.isHeroItem())
  1152. item.setLocation(ItemLocation.INVENTORY);
  1153. }
  1154. }
  1155. +
  1156. + L2World.getInstance().storeObject(item);
  1157. +
  1158. + // If stackable item is found in inventory just add to current quantity
  1159. + if (item.isStackable() && getItemByItemId(item.getItemId()) != null)
  1160. + addItem("Restore", item, null, getOwner());
  1161. + else
  1162. + addItem(item);
  1163. }
  1164. -
  1165. - L2World.getInstance().storeObject(item);
  1166. -
  1167. - // If stackable item is found in inventory just add to current quantity
  1168. - if (item.isStackable() && getItemByItemId(item.getItemId()) != null)
  1169. - addItem("Restore", item, null, getOwner());
  1170. - else
  1171. - addItem(item);
  1172. }
  1173. -
  1174. - inv.close();
  1175. - statement.close();
  1176. - refreshWeight();
  1177. }
  1178. - catch (SQLException e)
  1179. + catch (Exception e)
  1180. {
  1181. - _log.warning(Inventory.class.getName() + ": Could not restore inventory : ");
  1182. - if (Config.DEVELOPER)
  1183. - e.printStackTrace();
  1184. + _log.warning("Owner id : " + getOwnerId() + ", Could not restore inventory : " + e);
  1185. }
  1186. + refreshWeight();
  1187. }
  1188.  
  1189. public void reloadEquippedItems()
  1190. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/ItemContainer.java b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/ItemContainer.java
  1191. index 755d7dd..e606d81 100644
  1192. --- a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/ItemContainer.java
  1193. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/ItemContainer.java
  1194. @@ -3,7 +3,6 @@
  1195. import java.sql.Connection;
  1196. import java.sql.PreparedStatement;
  1197. import java.sql.ResultSet;
  1198. -import java.sql.SQLException;
  1199. import java.util.Collection;
  1200. import java.util.LinkedList;
  1201. import java.util.Map;
  1202. @@ -408,41 +407,38 @@
  1203. }
  1204.  
  1205. public void restore()
  1206. - {
  1207. - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  1208. + {
  1209. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  1210. + PreparedStatement ps = con.prepareStatement("SELECT object_id, item_id, count, enchant_level, loc, loc_data, price_sell, price_buy, custom_type1, custom_type2, mana_left FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
  1211. {
  1212. - PreparedStatement statement = con.prepareStatement("SELECT object_id FROM items WHERE owner_id=? AND (loc=?) " + "ORDER BY object_id DESC");
  1213. - statement.setInt(1, getOwnerId());
  1214. - statement.setString(2, getBaseLocation().name());
  1215. - ResultSet inv = statement.executeQuery();
  1216. + ps.setInt(1, getOwnerId());
  1217. + ps.setString(2, getBaseLocation().name());
  1218.  
  1219. - L2ItemInstance item;
  1220. - while (inv.next())
  1221. + try (ResultSet rs = ps.executeQuery())
  1222. {
  1223. - int objectId = inv.getInt(1);
  1224. - item = L2ItemInstance.restoreFromDb(objectId);
  1225. - if (item == null)
  1226. - continue;
  1227. -
  1228. - L2World.getInstance().storeObject(item);
  1229. -
  1230. - // If stackable item is found in inventory just add to current quantity
  1231. - if (item.isStackable() && getItemByItemId(item.getItemId()) != null)
  1232. - addItem("Restore", item, null, getOwner());
  1233. - else
  1234. - addItem(item);
  1235. + while (rs.next())
  1236. + {
  1237. + // Restore the item.
  1238. + final L2ItemInstance item = L2ItemInstance.restoreFromDb(getOwnerId(), rs);
  1239. + if (item == null)
  1240. + continue;
  1241. +
  1242. + // Add the item to world objects list.
  1243. + L2World.getInstance().storeObject(item);
  1244. +
  1245. + // If stackable item is found in inventory just add to current quantity
  1246. + if (item.isStackable() && getItemByItemId(item.getItemId()) != null)
  1247. + addItem("Restore", item, null, getOwner());
  1248. + else
  1249. + addItem(item);
  1250. + }
  1251. }
  1252. -
  1253. - inv.close();
  1254. - statement.close();
  1255. - refreshWeight();
  1256. }
  1257. - catch (SQLException e)
  1258. + catch (Exception e)
  1259. {
  1260. - _log.warning(ItemContainer.class.getName() + ": could not restore container");
  1261. - if (Config.DEVELOPER)
  1262. - e.printStackTrace();
  1263. - }
  1264. + _log.warning(ItemContainer.class.getName() + ": could not restore container: "+e);
  1265. + }
  1266. + refreshWeight();
  1267. }
  1268.  
  1269. public boolean validateCapacity(int slots)
  1270. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/L2ItemInstance.java b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/L2ItemInstance.java
  1271. index 9cc7f67..23a6560 100644
  1272. --- a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/L2ItemInstance.java
  1273. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/item/L2ItemInstance.java
  1274. @@ -369,7 +369,7 @@
  1275. {
  1276. return ((!isEquipped()) // Not equipped
  1277. && (getItem().getType2() != 3) // Not Quest Item
  1278. - && (getItem().getType2() != 4 || getItem().getType1() != 1) // TODO: what does this mean?
  1279. + && (getItem().getType2() != 4 || getItem().getType1() != 1) // what does this mean?
  1280. && (player.getPet() == null || getObjectId() != player.getPet().getControlItemId()) // Not Control item of currently summoned pet
  1281. && (player.getActiveEnchantItem() != this) // Not momentarily used enchant scroll
  1282. && (allowAdena || getItemId() != 57) && (player.getCurrentSkill() == null || player.getCurrentSkill().getSkill().getItemConsumeId() != getItemId()) && (isTradeable()));
  1283. @@ -666,99 +666,82 @@
  1284. }
  1285. }
  1286.  
  1287. - public static L2ItemInstance restoreFromDb(int objectId)
  1288. + public static L2ItemInstance restoreFromDb(int ownerId, ResultSet rs)
  1289. {
  1290. L2ItemInstance inst = null;
  1291. -
  1292. - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  1293. + int objectId = 0;
  1294. + try
  1295. {
  1296. - PreparedStatement statement = con.prepareStatement("SELECT owner_id, object_id, item_id, count, enchant_level, loc, loc_data, price_sell, price_buy, custom_type1, custom_type2, mana_left FROM items WHERE object_id = ?");
  1297. - statement.setInt(1, objectId);
  1298. - ResultSet rs = statement.executeQuery();
  1299. - if (rs.next())
  1300. + objectId = rs.getInt(1);
  1301. + int item_id = rs.getInt("item_id");
  1302. + int count = rs.getInt("count");
  1303. + ItemLocation loc = ItemLocation.valueOf(rs.getString("loc"));
  1304. + int loc_data = rs.getInt("loc_data");
  1305. + int enchant_level = rs.getInt("enchant_level");
  1306. + int custom_type1 = rs.getInt("custom_type1");
  1307. + int custom_type2 = rs.getInt("custom_type2");
  1308. + int price_sell = rs.getInt("price_sell");
  1309. + int price_buy = rs.getInt("price_buy");
  1310. + int manaLeft = rs.getInt("mana_left");
  1311. +
  1312. + L2Item item = ItemTable.getInstance().getTemplate(item_id);
  1313. +
  1314. + if (item == null)
  1315. + return null;
  1316. +
  1317. + inst = new L2ItemInstance(objectId, item);
  1318. + inst._existsInDb = true;
  1319. + inst._storedInDb = true;
  1320. + inst._ownerId = ownerId;
  1321. + inst._count = count;
  1322. + inst._enchantLevel = enchant_level;
  1323. + inst._type1 = custom_type1;
  1324. + inst._type2 = custom_type2;
  1325. + inst._loc = loc;
  1326. + inst._locData = loc_data;
  1327. + inst._priceSell = price_sell;
  1328. + inst._priceBuy = price_buy;
  1329. +
  1330. + // Setup life time for shadow weapons
  1331. + inst._mana = manaLeft;
  1332. +
  1333. + // consume 1 mana
  1334. + if (inst._mana > 0 && inst.getLocation() == ItemLocation.PAPERDOLL)
  1335. + inst.decreaseMana(false);
  1336. +
  1337. + // if mana left is 0 delete this item
  1338. + if (inst._mana == 0)
  1339. {
  1340. - int owner_id = rs.getInt("owner_id");
  1341. - int item_id = rs.getInt("item_id");
  1342. - int count = rs.getInt("count");
  1343. - ItemLocation loc = ItemLocation.valueOf(rs.getString("loc"));
  1344. - int loc_data = rs.getInt("loc_data");
  1345. - int enchant_level = rs.getInt("enchant_level");
  1346. - int custom_type1 = rs.getInt("custom_type1");
  1347. - int custom_type2 = rs.getInt("custom_type2");
  1348. - int price_sell = rs.getInt("price_sell");
  1349. - int price_buy = rs.getInt("price_buy");
  1350. - int manaLeft = rs.getInt("mana_left");
  1351. - L2Item item = ItemTable.getInstance().getTemplate(item_id);
  1352. - if (item == null)
  1353. - {
  1354. - _log.severe("Item item_id=" + item_id + " not known, object_id=" + objectId);
  1355. - rs.close();
  1356. - statement.close();
  1357. - return null;
  1358. - }
  1359. - inst = new L2ItemInstance(objectId, item);
  1360. - inst._existsInDb = true;
  1361. - inst._storedInDb = true;
  1362. - inst._ownerId = owner_id;
  1363. - inst._count = count;
  1364. - inst._enchantLevel = enchant_level;
  1365. - inst._type1 = custom_type1;
  1366. - inst._type2 = custom_type2;
  1367. - inst._loc = loc;
  1368. - inst._locData = loc_data;
  1369. - inst._priceSell = price_sell;
  1370. - inst._priceBuy = price_buy;
  1371. -
  1372. - // Setup life time for shadow weapons
  1373. - inst._mana = manaLeft;
  1374. -
  1375. - // consume 1 mana
  1376. - if (inst._mana > 0 && inst.getLocation() == ItemLocation.PAPERDOLL)
  1377. - inst.decreaseMana(false);
  1378. -
  1379. - // if mana left is 0 delete this item
  1380. - if (inst._mana == 0)
  1381. - {
  1382. - inst.removeFromDb();
  1383. - rs.close();
  1384. - statement.close();
  1385. - return null;
  1386. - }
  1387. - else if (inst._mana > 0 && inst.getLocation() == ItemLocation.PAPERDOLL)
  1388. - inst.scheduleConsumeManaTask();
  1389. -
  1390. - rs.close();
  1391. - statement.close();
  1392. - }
  1393. - else
  1394. - {
  1395. - _log.severe("Item object_id=" + objectId + " not found");
  1396. - rs.close();
  1397. - statement.close();
  1398. + inst.removeFromDb();
  1399. return null;
  1400. }
  1401. - rs.close();
  1402. - statement.close();
  1403. -
  1404. - // load augmentation
  1405. - statement = con.prepareStatement("SELECT attributes,skill,level FROM augmentations WHERE item_id=?");
  1406. - statement.setInt(1, objectId);
  1407. - rs = statement.executeQuery();
  1408. - if (rs.next())
  1409. + else if (inst._mana > 0 && inst.getLocation() == ItemLocation.PAPERDOLL)
  1410. + inst.scheduleConsumeManaTask();
  1411. +
  1412. + // load weapon augmentation
  1413. + if (inst.isWeapon() && inst.isEquipable())
  1414. {
  1415. - inst._augmentation = new L2Augmentation(inst, rs.getInt("attributes"), rs.getInt("skill"), rs.getInt("level"), false);
  1416. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  1417. + PreparedStatement ps = con.prepareStatement("SELECT attributes,skill,level FROM augmentations WHERE item_id=?"))
  1418. + {
  1419. + ps.setInt(1, inst.getObjectId());
  1420. +
  1421. + try (ResultSet rsa = ps.executeQuery())
  1422. + {
  1423. + if (rsa.next())
  1424. + inst._augmentation = new L2Augmentation(inst, rsa.getInt("attributes"), rsa.getInt("skill"), rsa.getInt("level"), false);
  1425. + }
  1426. + }
  1427. + catch (Exception e)
  1428. + {
  1429. + _log.severe(L2ItemInstance.class.getName() + ": Couldn't restore augmentation for " + objectId + " from DB:" + e);
  1430. + }
  1431. }
  1432. -
  1433. - rs.close();
  1434. - statement.close();
  1435. -
  1436. +
  1437. }
  1438. catch (Exception e)
  1439. - {
  1440. -
  1441. - _log.severe(L2ItemInstance.class.getName() + ": Could not restore item " + objectId + " from DB:");
  1442. - if (Config.DEVELOPER)
  1443. - e.printStackTrace();
  1444. + {
  1445. + _log.severe(L2ItemInstance.class.getName() + ": Could not restore item " + objectId + " from DB:" +e);
  1446. }
  1447. return inst;
  1448. }
  1449. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/FinishRotating.java b/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/FinishRotating.java
  1450. index e8cd5e4..2c2007d 100644
  1451. --- a/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/FinishRotating.java
  1452. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/FinishRotating.java
  1453. @@ -1,5 +1,6 @@
  1454. package com.l2jhellas.gameserver.network.clientpackets;
  1455.  
  1456. +import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
  1457. import com.l2jhellas.gameserver.network.serverpackets.StopRotation;
  1458.  
  1459. public final class FinishRotating extends L2GameClientPacket
  1460. @@ -20,10 +21,10 @@
  1461. @Override
  1462. protected void runImpl()
  1463. {
  1464. - if (getClient().getActiveChar() == null)
  1465. - return;
  1466. - StopRotation sr = new StopRotation(getClient().getActiveChar().getObjectId(), _degree, 0);
  1467. - getClient().getActiveChar().broadcastPacket(sr);
  1468. + final L2PcInstance player = getClient().getActiveChar();
  1469. +
  1470. + if (player != null)
  1471. + player.broadcastPacket(new StopRotation(player.getObjectId(), _degree, 0));
  1472. }
  1473.  
  1474. @Override
  1475. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/network/serverpackets/Attack.java b/L2JHellasC/java/com/l2jhellas/gameserver/network/serverpackets/Attack.java
  1476. index c22cdc3..9e276fa 100644
  1477. --- a/L2JHellasC/java/com/l2jhellas/gameserver/network/serverpackets/Attack.java
  1478. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/network/serverpackets/Attack.java
  1479. @@ -16,7 +16,6 @@
  1480. private final boolean _soulshot;
  1481. private final int _ssGrade;
  1482. private final Location _attackerLoc;
  1483. - private final Location _targetLoc;
  1484. private final List<Hit> _hits = new ArrayList<>();
  1485.  
  1486. public Attack(L2Character attacker, L2Character target, boolean useShots, int ssGrade)
  1487. @@ -25,7 +24,6 @@
  1488. _soulshot = useShots;
  1489. _ssGrade = ssGrade;
  1490. _attackerLoc = new Location(attacker.getX(), attacker.getY(), attacker.getZ());
  1491. - _targetLoc = new Location(target.getX(), target.getY(), target.getZ());
  1492. }
  1493.  
  1494. public void addHit(L2Character target, int damage, boolean miss, boolean crit, byte shld)
  1495. @@ -63,14 +61,13 @@
  1496. writeD(_attackerLoc.getZ());
  1497.  
  1498. writeH(_hits.size() - 1);
  1499. - while (it.hasNext())
  1500. + if(_hits.size() > 1)
  1501. {
  1502. - writeHit(it.next());
  1503. + while (it.hasNext())
  1504. + {
  1505. + writeHit(it.next());
  1506. + }
  1507. }
  1508. -
  1509. - writeD(_targetLoc.getX());
  1510. - writeD(_targetLoc.getY());
  1511. - writeD(_targetLoc.getZ());
  1512. }
  1513.  
  1514. @Override
  1515. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/scrips/quests/ai/group/L2AttackableAIScript.java b/L2JHellasC/java/com/l2jhellas/gameserver/scrips/quests/ai/group/L2AttackableAIScript.java
  1516. index 3313b46..7fe2f51 100644
  1517. --- a/L2JHellasC/java/com/l2jhellas/gameserver/scrips/quests/ai/group/L2AttackableAIScript.java
  1518. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/scrips/quests/ai/group/L2AttackableAIScript.java
  1519. @@ -56,7 +56,7 @@
  1520.  
  1521. if (skillAggroPoints > 0)
  1522. {
  1523. - if (attackable.hasAI() && (attackable.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK))
  1524. + if (!attackable.isDead() && attackable.hasAI() && (attackable.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK))
  1525. {
  1526. L2Object npcTarget = attackable.getTarget();
  1527. for (L2Object skillTarget : targets)
  1528. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/skills/effects/EffectCharge.java b/L2JHellasC/java/com/l2jhellas/gameserver/skills/effects/EffectCharge.java
  1529. index f1c15c4..9811a1c 100644
  1530. --- a/L2JHellasC/java/com/l2jhellas/gameserver/skills/effects/EffectCharge.java
  1531. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/skills/effects/EffectCharge.java
  1532. @@ -15,12 +15,10 @@
  1533. {
  1534. super(env, template);
  1535. numCharges = 1;
  1536. - if (env.target instanceof L2PcInstance)
  1537. + if (env.target.isPlayer())
  1538. {
  1539. env.target.sendPacket(new EtcStatusUpdate((L2PcInstance) env.target));
  1540. - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.FORCE_INCREASED_TO_S1);
  1541. - sm.addNumber(numCharges);
  1542. - getEffected().sendPacket(sm);
  1543. + getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FORCE_INCREASED_TO_S1).addNumber(numCharges));
  1544. }
  1545. }
  1546.  
  1547. diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/templates/L2Weapon.java b/L2JHellasC/java/com/l2jhellas/gameserver/templates/L2Weapon.java
  1548. index 2603c64..fecd3f8 100644
  1549. --- a/L2JHellasC/java/com/l2jhellas/gameserver/templates/L2Weapon.java
  1550. +++ b/L2JHellasC/java/com/l2jhellas/gameserver/templates/L2Weapon.java
  1551. @@ -2,7 +2,6 @@
  1552.  
  1553. import java.io.IOException;
  1554. import java.util.ArrayList;
  1555. -import java.util.Collection;
  1556. import java.util.List;
  1557.  
  1558. import com.l2jhellas.gameserver.enums.items.L2WeaponType;
  1559. @@ -10,7 +9,6 @@
  1560. import com.l2jhellas.gameserver.handler.ISkillHandler;
  1561. import com.l2jhellas.gameserver.handler.SkillHandler;
  1562. import com.l2jhellas.gameserver.model.L2Effect;
  1563. -import com.l2jhellas.gameserver.model.L2Object;
  1564. import com.l2jhellas.gameserver.model.L2Skill;
  1565. import com.l2jhellas.gameserver.model.L2World;
  1566. import com.l2jhellas.gameserver.model.actor.L2Character;
  1567. @@ -264,25 +262,15 @@
  1568. skill.useSkill(caster, targets);
  1569.  
  1570. // notify quests of a skill use
  1571. - if (caster instanceof L2PcInstance)
  1572. + if (caster.isPlayer())
  1573. {
  1574. // Mobs in range 1000 see spell
  1575. -
  1576. - final Collection<L2Object> objs = L2World.getInstance().getVisibleObjects(caster, L2Object.class, 1000);
  1577. - // synchronized (caster.getKnownList().getKnownObjects())
  1578. + L2World.getInstance().forEachVisibleObjectInRange(caster, L2Npc.class, 1000, npcMob ->
  1579. {
  1580. - for (L2Object spMob : objs)
  1581. - {
  1582. - if (spMob instanceof L2Npc)
  1583. - {
  1584. - L2Npc npcMob = (L2Npc) spMob;
  1585. -
  1586. - if (npcMob.getTemplate().getEventQuests(QuestEventType.ON_SKILL_SEE) != null)
  1587. - for (Quest quest : npcMob.getTemplate().getEventQuests(QuestEventType.ON_SKILL_SEE))
  1588. - quest.notifySkillSee(npcMob, (L2PcInstance) caster, _skillsOnCast[0], targets, false);// XXX not sure of this
  1589. - }
  1590. - }
  1591. - }
  1592. + if (npcMob != null && npcMob.getTemplate().getEventQuests(QuestEventType.ON_SKILL_SEE) != null)
  1593. + for (Quest quest : npcMob.getTemplate().getEventQuests(QuestEventType.ON_SKILL_SEE))
  1594. + quest.notifySkillSee(npcMob, (L2PcInstance) caster, _skillsOnCast[0], targets, false);
  1595. + });
  1596. }
  1597. }
  1598. catch (IOException e)
  1599. diff --git a/L2JHellasC/java/com/l2jhellas/util/Broadcast.java b/L2JHellasC/java/com/l2jhellas/util/Broadcast.java
  1600. index 1f17137..0c26fdb 100644
  1601. --- a/L2JHellasC/java/com/l2jhellas/util/Broadcast.java
  1602. +++ b/L2JHellasC/java/com/l2jhellas/util/Broadcast.java
  1603. @@ -44,7 +44,7 @@
  1604.  
  1605. public static void toSelfAndKnownPlayers(L2Character character, L2GameServerPacket mov)
  1606. {
  1607. - if (character instanceof L2PcInstance)
  1608. + if (character.isPlayer())
  1609. character.sendPacket(mov);
  1610.  
  1611. toKnownPlayers(character, mov);
  1612. @@ -55,7 +55,7 @@
  1613. if (radius < 0)
  1614. radius = 600;
  1615.  
  1616. - if (character instanceof L2PcInstance)
  1617. + if (character.isPlayer())
  1618. character.sendPacket(mov);
  1619.  
  1620. L2World.getInstance().forEachVisibleObjectInRange(character, L2PcInstance.class, radius, player ->
  1621. @@ -70,7 +70,7 @@
  1622. if (radiusSq < 0)
  1623. radiusSq = 360000;
  1624.  
  1625. - if (character instanceof L2PcInstance)
  1626. + if (character.isPlayer())
  1627. character.sendPacket(mov);
  1628.  
  1629. for (L2PcInstance player : L2World.getInstance().getVisibleObjects(character, L2PcInstance.class))
  1630. @@ -93,7 +93,7 @@
  1631. {
  1632. for (L2Object object : region.getVisibleObjects().values())
  1633. {
  1634. - if (object instanceof L2PcInstance)
  1635. + if (object.isPlayer())
  1636. {
  1637. final L2PcInstance player = (L2PcInstance) object;
  1638.  
  1639. diff --git a/L2JHellasD/data/stats/skills/0400-0499.xml b/L2JHellasD/data/stats/skills/0400-0499.xml
  1640. index 8f2a840..ea4ccc6 100644
  1641. --- a/L2JHellasD/data/stats/skills/0400-0499.xml
  1642. +++ b/L2JHellasD/data/stats/skills/0400-0499.xml
  1643. @@ -871,25 +871,21 @@
  1644. </for>
  1645. </skill>
  1646. <skill id="441" levels="1" name="Force Meditation">
  1647. - <!-- Guess ... notdone ... needs core -->
  1648. - <table name="#pDef"> 0.2 </table>
  1649. - <table name="#hhot"> 60 </table>
  1650. - <table name="#mhot"> 10 </table>
  1651. - <set name="operateType" val="OP_ACTIVE" />
  1652. - <set name="skillType" val="BUFF" />
  1653. - <set name="target" val="TARGET_SELF" />
  1654. - <set name="hitTime" val="2000" />
  1655. - <set name="reuseDelay" val="1200000" />
  1656. - <set name="castRange" val="-1" />
  1657. - <set name="effectRange" val="-1" />
  1658. - <set name="negateId" val="441" />
  1659. - <set name="needCharges" val="3" />
  1660. + <set name="mpConsume" val="0"/>
  1661. + <set name="target" val="TARGET_SELF"/>
  1662. + <set name="reuseDelay" val="300000"/>
  1663. + <set name="hitTime" val="2000"/>
  1664. + <set name="skillType" val="CHARGE_EFFECT"/>
  1665. + <set name="isMagic" val="true"/>
  1666. + <set name="operateType" val="OP_ACTIVE"/>
  1667. + <set name="num_charges" val="3"/>
  1668. + <set name="charge_skill_id" val="50"/> <!-- Focused Force -->
  1669. <for>
  1670. - <effect count="1" name="ImmobileUntilAttacked" time="120" val="0">
  1671. - <mul order="0x30" stat="pDef" val="#pDef" />
  1672. + <effect count="1" name="ImmobileUntilAttacked" time="30" val="0">
  1673. + <mul order="0x30" stat="pDef" val="0.2"/>
  1674. + <mul order="0x30" stat="regMp" val="10"/>
  1675. + <mul order="0x30" stat="regHp" val="15"/>
  1676. </effect>
  1677. - <effect count="40" name="HealOverTime" time="3" noicon="1" val="#hhot" />
  1678. - <effect count="40" name="ManaHealOverTime" time="3" noicon="1" val="#mhot" />
  1679. </for>
  1680. </skill>
  1681. <skill id="442" levels="1" name="Sonic Barrier">
  1682.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement