From 496643309110acad3227dff34d1e1d65e28c26ea Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 11 Jul 2015 21:02:06 +0000 Subject: [PATCH] -Fix bug when character w\o weapon can't attack. -Update HpCpHeal effect & fix system msg typo. Contributed by NviX. --- .../handlers/effecthandlers/HpCpHeal.java | 32 +++++++++--------- .../gameserver/model/stats/Formulas.java | 33 +++++++++++++------ 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/trunk/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java b/trunk/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java index b0899936ee..13d0cb41ed 100644 --- a/trunk/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java +++ b/trunk/dist/game/data/scripts/handlers/effecthandlers/HpCpHeal.java @@ -130,7 +130,7 @@ public final class HpCpHeal extends AbstractEffect { target.sendPacket(SystemMessageId.REJUVENATING_HP); } - else + else if (healAmount != 0) { if (activeChar.isPlayer() && (activeChar != target)) { @@ -152,21 +152,21 @@ public final class HpCpHeal extends AbstractEffect if (amount != 0) { target.setCurrentCp(amount + target.getCurrentCp()); - } - - if (activeChar.isPlayer() && (activeChar != target)) - { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_CP_HAS_BEEN_RESTORED_BY_C1); - sm.addString(activeChar.getName()); - sm.addInt((int) amount); - target.sendPacket(sm); - } - else - { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED); - sm.addInt((int) healAmount); - target.sendPacket(sm); + + if (activeChar.isPlayer() && (activeChar != target)) + { + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_CP_HAS_BEEN_RESTORED_BY_C1); + sm.addString(activeChar.getName()); + sm.addInt((int) amount); + target.sendPacket(sm); + } + else + { + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_HAS_BEEN_RESTORED); + sm.addInt((int) amount); + target.sendPacket(sm); + } } } } -} +} \ No newline at end of file diff --git a/trunk/java/com/l2jserver/gameserver/model/stats/Formulas.java b/trunk/java/com/l2jserver/gameserver/model/stats/Formulas.java index bcf38f025e..7a1f4a9dcf 100644 --- a/trunk/java/com/l2jserver/gameserver/model/stats/Formulas.java +++ b/trunk/java/com/l2jserver/gameserver/model/stats/Formulas.java @@ -714,6 +714,7 @@ public final class Formulas // Add soulshot boost. double ssBoost; + double ssEnchBonus = 0; if (attacker.isPlayer()) { double rubyBonus = 0; @@ -729,10 +730,13 @@ public final class Formulas { rubyBonus = 0.075; } - double ssEnchBonus = attacker.getActiveWeaponInstance().getEnchantLevel() * 0.007; - if (ssEnchBonus > 0.21) + if (attacker.getActiveWeaponInstance() != null) { - ssEnchBonus = 0.21; + ssEnchBonus = attacker.getActiveWeaponInstance().getEnchantLevel() * 0.007; + if (ssEnchBonus > 0.21) + { + ssEnchBonus = 0.21; + } } ssBoost = ss ? (2 + rubyBonus + ssEnchBonus) : 1; } @@ -900,6 +904,7 @@ public final class Formulas if (attacker.isPlayer()) { double sapphireBonus = 0; + double ssEnchBonus = 0; if ((attacker.getInventory().getItemByItemId(38931) != null) && (attacker.getInventory().getItemByItemId(38931).isEquipped())) { sapphireBonus = 0.2; @@ -912,10 +917,13 @@ public final class Formulas { sapphireBonus = 0.075; } - double ssEnchBonus = attacker.getActiveWeaponInstance().getEnchantLevel() * 0.007; - if (ssEnchBonus > 0.21) + if (attacker.getActiveWeaponInstance() != null) { - ssEnchBonus = 0.21; + ssEnchBonus = attacker.getActiveWeaponInstance().getEnchantLevel() * 0.007; + if (ssEnchBonus > 0.21) + { + ssEnchBonus = 0.21; + } } mAtk *= bss ? (4 + sapphireBonus + ssEnchBonus) : sps ? (2 + sapphireBonus + ssEnchBonus) : 1; } @@ -1554,6 +1562,7 @@ public final class Formulas if (attacker.isPlayer()) { double sapphireBonus = 0; + double ssEnchBonus = 0; if ((attacker.getInventory().getItemByItemId(38931) != null) && (attacker.getInventory().getItemByItemId(38931).isEquipped())) { sapphireBonus = 0.2; @@ -1566,10 +1575,13 @@ public final class Formulas { sapphireBonus = 0.075; } - double ssEnchBonus = attacker.getActiveWeaponInstance().getEnchantLevel() * 0.007; - if (ssEnchBonus > 0.21) + if (attacker.getActiveWeaponInstance() != null) { - ssEnchBonus = 0.21; + ssEnchBonus = attacker.getActiveWeaponInstance().getEnchantLevel() * 0.007; + if (ssEnchBonus > 0.21) + { + ssEnchBonus = 0.21; + } } mAtk *= bss ? (4 + sapphireBonus + ssEnchBonus) : sps ? (2 + sapphireBonus + ssEnchBonus) : 1; } @@ -2138,7 +2150,8 @@ public final class Formulas } /** - * Calculates karma gain upon playable kill.
Updated to High Five on 10.09.2014 by Zealar tested in retail. + * Calculates karma gain upon playable kill.
+ * Updated to High Five on 10.09.2014 by Zealar tested in retail. * @param pkCount * @param isSummon * @return karma points that will be added to the player.