diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java index c315af3a35..1a985910dc 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java @@ -63,7 +63,6 @@ public class BeastSoulShot implements IItemHandler final List aliveServitor = playable.getServitors().values().stream().filter(s -> !s.isDead()).collect(Collectors.toList()); if ((pet == null) && aliveServitor.isEmpty()) { - activeOwner.sendMessage("asdas"); activeOwner.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET_OR_SERVITOR_SAD_ISN_T_IT); return false; } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/Fishing.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/Fishing.java index d0b69fa3e9..7cf4a5b44f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/Fishing.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/Fishing.java @@ -245,14 +245,18 @@ public class Fishing } double chance = baitData.getChance(); - if (_player.isChargedShot(ShotType.FISH_SOULSHOTS)) + final boolean isCharged = _player.isChargedShot(ShotType.FISH_SOULSHOTS); + if (isCharged) { - chance *= 1.25; // +25 % chance to win - _player.setChargedShot(ShotType.FISH_SOULSHOTS, false); + chance *= 1.50; // +50 % chance to win } if (Rnd.get(0, 100) <= chance) { + if (isCharged) + { + _player.setChargedShot(ShotType.FISH_SOULSHOTS, false); + } reelIn(FishingEndReason.WIN, true); } else diff --git a/L2J_Mobius_2.5_Underground/dist/game/config/Character.ini b/L2J_Mobius_2.5_Underground/dist/game/config/Character.ini index fb34413cfb..ddaa169ab3 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/config/Character.ini +++ b/L2J_Mobius_2.5_Underground/dist/game/config/Character.ini @@ -806,10 +806,6 @@ ExpertisePenalty = True # Default: True StoreCharUiSettings = True -# Enable automatic Shot usage on player login or weapon equipped. -# Default: True -EnableAutoShots = True - # Character name restriction # Disallow characters to have a name which contains the words. # Split them with ",". Example: announcements,announce... diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Summon.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Summon.java index 5650302d2d..179b65f3d7 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Summon.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Summon.java @@ -112,7 +112,5 @@ public final class Summon extends AbstractEffect summon.setShowSummonAnimation(true); summon.setRunning(); summon.spawnMe(); - - player.handleAutoShots(false); } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java index e86bb9078a..64e253b2bd 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java @@ -103,7 +103,5 @@ public final class SummonMulti extends AbstractEffect summon.setShowSummonAnimation(true); summon.setRunning(); summon.spawnMe(); - - player.handleAutoShots(false); } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java index c315af3a35..25f6828048 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java @@ -63,7 +63,6 @@ public class BeastSoulShot implements IItemHandler final List aliveServitor = playable.getServitors().values().stream().filter(s -> !s.isDead()).collect(Collectors.toList()); if ((pet == null) && aliveServitor.isEmpty()) { - activeOwner.sendMessage("asdas"); activeOwner.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET_OR_SERVITOR_SAD_ISN_T_IT); return false; } @@ -121,7 +120,7 @@ public class BeastSoulShot implements IItemHandler { if (!pet.isChargedShot(ShotType.SOULSHOTS)) { - pet.setChargedShot(ShotType.SOULSHOTS, true); + pet.chargeShot(ShotType.SOULSHOTS); // Visual effect change if player has equipped Ruby lvl 3 or higher if (activeOwner.getActiveRubyJewel() != null) { @@ -138,7 +137,7 @@ public class BeastSoulShot implements IItemHandler { if (!s.isChargedShot(ShotType.SOULSHOTS)) { - s.setChargedShot(ShotType.SOULSHOTS, true); + s.chargeShot(ShotType.SOULSHOTS); // Visual effect change if player has equipped Ruby lvl 3 or higher if (activeOwner.getActiveRubyJewel() != null) { diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java index 765194563e..de1917d42f 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java @@ -122,7 +122,7 @@ public class BeastSpiritShot implements IItemHandler { if (!pet.isChargedShot(shotType)) { - pet.setChargedShot(shotType, true); + pet.chargeShot(shotType); // Visual effect change if player has equipped Sapphire lvl 3 or higher if (activeOwner.getActiveShappireJewel() != null) { @@ -139,7 +139,7 @@ public class BeastSpiritShot implements IItemHandler { if (!s.isChargedShot(shotType)) { - s.setChargedShot(shotType, true); + s.chargeShot(shotType); // Visual effect change if player has equipped Sapphire lvl 3 or higher if (activeOwner.getActiveShappireJewel() != null) { diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java index b8a223f1d4..a053b95a9d 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java @@ -104,7 +104,7 @@ public class BlessedSoulShots implements IItemHandler return false; } // Charge soul shot - weaponInst.setChargedShot(ShotType.BLESSED_SOULSHOTS, true); + activeChar.chargeShot(ShotType.BLESSED_SOULSHOTS); } finally { diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java index f8b9a187dc..9800a7e664 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java @@ -94,7 +94,7 @@ public class BlessedSpiritShot implements IItemHandler } // Charge Spirit shot - activeChar.setChargedShot(ShotType.SPIRITSHOTS, true); + activeChar.chargeShot(ShotType.SPIRITSHOTS); // Send message to client if (!activeChar.getAutoSoulShot().contains(item.getId())) diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/FishShots.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/FishShots.java index d03dafbb52..5c5598ea69 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/FishShots.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/FishShots.java @@ -75,7 +75,7 @@ public class FishShots implements IItemHandler return false; } - activeChar.setChargedShot(ShotType.FISH_SOULSHOTS, true); + activeChar.chargeShot(ShotType.FISH_SOULSHOTS); activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false); final L2Object oldTarget = activeChar.getTarget(); activeChar.setTarget(activeChar); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java index a052bc2fa8..05c1ac3f7d 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java @@ -101,7 +101,7 @@ public class SoulShots implements IItemHandler return false; } // Charge soul shot - weaponInst.setChargedShot(ShotType.SOULSHOTS, true); + activeChar.chargeShot(ShotType.SOULSHOTS); } finally { diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java index 008665fc04..ddf0402d2b 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java @@ -94,7 +94,7 @@ public class SpiritShot implements IItemHandler } // Charge Spirit shot - activeChar.setChargedShot(ShotType.SPIRITSHOTS, true); + activeChar.chargeShot(ShotType.SPIRITSHOTS); // Send message to client if (!activeChar.getAutoSoulShot().contains(item.getId())) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java index 4dd1dae5c7..3a3e58903f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java @@ -283,7 +283,6 @@ public final class Config public static boolean EXPERTISE_PENALTY; public static boolean STORE_RECIPE_SHOPLIST; public static boolean STORE_UI_SETTINGS; - public static boolean ENABLE_AUTO_SHOTS; public static String[] FORBIDDEN_NAMES; public static boolean SILENCE_MODE_EXCLUDE; public static boolean SHOW_GOD_VIDEO_INTRO; @@ -1680,7 +1679,6 @@ public final class Config EXPERTISE_PENALTY = Character.getBoolean("ExpertisePenalty", true); STORE_RECIPE_SHOPLIST = Character.getBoolean("StoreRecipeShopList", false); STORE_UI_SETTINGS = Character.getBoolean("StoreCharUiSettings", true); - ENABLE_AUTO_SHOTS = Character.getBoolean("EnableAutoShots", true); FORBIDDEN_NAMES = Character.getString("ForbiddenNames", "").split(","); SILENCE_MODE_EXCLUDE = Character.getBoolean("SilenceModeExclude", false); SHOW_GOD_VIDEO_INTRO = Character.getBoolean("GoDVideoIntro", true); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/Fishing.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/Fishing.java index d0b69fa3e9..edbfe1412c 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/Fishing.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/Fishing.java @@ -247,8 +247,7 @@ public class Fishing double chance = baitData.getChance(); if (_player.isChargedShot(ShotType.FISH_SOULSHOTS)) { - chance *= 1.25; // +25 % chance to win - _player.setChargedShot(ShotType.FISH_SOULSHOTS, false); + chance *= 1.5; // +50 % chance to win } if (Rnd.get(0, 100) <= chance) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Object.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Object.java index 16c28a08d1..459660c7ca 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Object.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Object.java @@ -21,7 +21,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.handler.ActionHandler; import com.l2jmobius.gameserver.handler.ActionShiftHandler; import com.l2jmobius.gameserver.handler.IActionHandler; @@ -454,35 +453,6 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab return false; } - /** - * Check if current object has charged shot. - * @param type of the shot to be checked. - * @return {@code true} if the object has charged shot - */ - public boolean isChargedShot(ShotType type) - { - return false; - } - - /** - * Charging shot into the current object. - * @param type of the shot to be charged. - * @param charged - */ - public void setChargedShot(ShotType type, boolean charged) - { - } - - /** - * Try to recharge a shot. - * @param physical skill are using Soul shots. - * @param magical skill are using Spirit shots. - * @param fish - */ - public void rechargeShots(boolean physical, boolean magical, boolean fish) - { - } - /** * @param * @param script diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java index ca7e45e2b7..6de66b34db 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -21,6 +21,7 @@ import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ACTIVE; import java.lang.ref.WeakReference; import java.util.Collection; import java.util.Collections; +import java.util.EnumSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -269,6 +270,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe /** A map holding info about basic property mesmerizing system. */ private volatile Map _basicPropertyResists; + /** A set containing the shot types currently charged. */ + private Set _chargedShots = EnumSet.noneOf(ShotType.class); + /** * Creates a creature. * @param template the creature template @@ -3861,7 +3865,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe else { // If we didn't miss the hit, discharge the shoulshots, if any - setChargedShot(isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS, false); + unchargeShot(isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS); } // Check Raidboss attack @@ -5533,4 +5537,37 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe { return calculateDistance(target, true, false); } + + public boolean isChargedShot(ShotType type) + { + return _chargedShots.contains(type); + } + + /** + * @param type of the shot to charge + * @return {@code true} if there was no shot of this type charged before, {@code false} otherwise. + */ + public boolean chargeShot(ShotType type) + { + return _chargedShots.add(type); + } + + /** + * @param type of the shot to uncharge + * @return {@code true} if there was a charged shot of this type, {@code false} otherwise. + */ + public boolean unchargeShot(ShotType type) + { + return _chargedShots.remove(type); + } + + public void unchargeAllShots() + { + _chargedShots = EnumSet.noneOf(ShotType.class); + } + + public void rechargeShots(boolean physical, boolean magic, boolean fish) + { + // Dummy method to be overriden. + } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 744af6f9da..96801d3313 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -137,7 +137,6 @@ public class L2Npc extends L2Character private int _spiritshotamount = 0; private int _displayEffect = 0; - private int _shotsMask = 0; private int _killingBlowWeaponId; private int _cloneObjId; // Used in NpcInfo packet to clone the specified player. @@ -1301,25 +1300,6 @@ public class L2Npc extends L2Character return WalkingManager.getInstance().isRegistered(this); } - @Override - public boolean isChargedShot(ShotType type) - { - return (_shotsMask & type.getMask()) == type.getMask(); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - if (charged) - { - _shotsMask |= type.getMask(); - } - else - { - _shotsMask &= ~type.getMask(); - } - } - @Override public void rechargeShots(boolean physical, boolean magic, boolean fish) { @@ -1331,7 +1311,7 @@ public class L2Npc extends L2Character } _soulshotamount--; Broadcast.toSelfAndKnownPlayersInRadius(this, new MagicSkillUse(this, this, 2154, 1, 0, 0), 600); - setChargedShot(ShotType.SOULSHOTS, true); + chargeShot(ShotType.SOULSHOTS); } if (magic && (_spiritshotamount > 0)) @@ -1342,7 +1322,7 @@ public class L2Npc extends L2Character } _spiritshotamount--; Broadcast.toSelfAndKnownPlayersInRadius(this, new MagicSkillUse(this, this, 2061, 1, 0, 0), 600); - setChargedShot(ShotType.SPIRITSHOTS, true); + chargeShot(ShotType.SPIRITSHOTS); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index d58adad4db..dab0c5323a 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.data.xml.impl.ExperienceData; import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.handler.ItemHandler; @@ -77,7 +76,6 @@ public abstract class L2Summon extends L2Playable private boolean _follow = true; private boolean _previousFollowStatus = true; protected boolean _restoreSummon = true; - private int _shotsMask = 0; private int _summonPoints = 0; // @formatter:off @@ -1026,25 +1024,6 @@ public abstract class L2Summon extends L2Playable return true; } - @Override - public boolean isChargedShot(ShotType type) - { - return (_shotsMask & type.getMask()) == type.getMask(); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - if (charged) - { - _shotsMask |= type.getMask(); - } - else - { - _shotsMask &= ~type.getMask(); - } - } - @Override public void rechargeShots(boolean physical, boolean magic, boolean fish) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 007e010cdf..72aedab4f3 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -92,7 +92,6 @@ import com.l2jmobius.gameserver.enums.PrivateStoreType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Sex; import com.l2jmobius.gameserver.enums.ShortcutType; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.enums.StatusUpdateType; import com.l2jmobius.gameserver.enums.SubclassInfoType; import com.l2jmobius.gameserver.enums.Team; @@ -13006,23 +13005,6 @@ public final class L2PcInstance extends L2Playable return true; } - @Override - public boolean isChargedShot(ShotType type) - { - final L2ItemInstance weapon = getActiveWeaponInstance(); - return (weapon != null) && weapon.isChargedShot(type); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - final L2ItemInstance weapon = getActiveWeaponInstance(); - if (weapon != null) - { - weapon.setChargedShot(type, charged); - } - } - /** * @param skillId the display skill Id * @return the custom skill @@ -13874,93 +13856,6 @@ public final class L2PcInstance extends L2Playable } } - public void handleAutoShots(boolean force) - { - if (getAutoSoulShot().isEmpty() && !force) - { - return; - } - - final L2ItemInstance weapon = getActiveWeaponInstance(); - int soulShotId = 0; - int spiritShotId = 0; - int summonSoulShotId = 0; - int summonSpiritShotId = 0; - - for (L2ItemInstance item : getInventory().getItems(L2ItemInstance::isEtcItem, i -> i.getItemType() == EtcItemType.SOULSHOT)) - { - switch (item.getEtcItem().getDefaultAction()) - { - case SOULSHOT: - { - if ((weapon != null) && (weapon.getItemType() != WeaponType.FISHINGROD) && (weapon.getItem().getCrystalTypePlus() == item.getItem().getCrystalType())) - { - soulShotId = item.getId(); - } - break; - } - case SPIRITSHOT: - { - if ((weapon != null) && (weapon.getItem().getCrystalTypePlus() == item.getItem().getCrystalType())) - { - spiritShotId = item.getId(); - } - break; - } - case SUMMON_SOULSHOT: - { - if (hasSummon()) - { - summonSoulShotId = item.getId(); - } - break; - } - case SUMMON_SPIRITSHOT: - { - if (hasSummon()) - { - summonSpiritShotId = item.getId(); - } - break; - } - case FISHINGSHOT: - { - if ((weapon != null) && (weapon.getItemType() == WeaponType.FISHINGROD) && (weapon.getItem().getCrystalType() == item.getItem().getCrystalType())) - { - soulShotId = item.getId(); - } - break; - } - } - } - - _activeSoulShots.clear(); - - if (soulShotId != 0) - { - addAutoSoulShot(soulShotId); - } - if (spiritShotId != 0) - { - addAutoSoulShot(spiritShotId); - } - if (summonSoulShotId != 0) - { - addAutoSoulShot(summonSoulShotId); - } - if (summonSpiritShotId != 0) - { - addAutoSoulShot(summonSpiritShotId); - } - - sendPacket(new ExAutoSoulShot(soulShotId, true, 0)); - sendPacket(new ExAutoSoulShot(spiritShotId, true, 1)); - sendPacket(new ExAutoSoulShot(summonSoulShotId, true, 2)); - sendPacket(new ExAutoSoulShot(summonSpiritShotId, true, 3)); - - rechargeShots(true, true, true); - } - public GroupType getGroupType() { return isInParty() ? (getParty().isInCommandChannel() ? GroupType.COMMAND_CHANNEL : GroupType.PARTY) : GroupType.NONE; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 9b6ddae51e..177255ec02 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -370,11 +370,6 @@ public abstract class Inventory extends ItemContainer } }); } - - if (item.isWeapon()) - { - player.handleAutoShots(false); - } } // Apply skill, if weapon have "skills on unequip" @@ -388,6 +383,11 @@ public abstract class Inventory extends ItemContainer { player.sendPacket(new SkillCoolTime(player)); } + + if (item.isWeapon()) + { + player.unchargeAllShots(); + } } @Override @@ -399,6 +399,13 @@ public abstract class Inventory extends ItemContainer } final L2PcInstance player = (L2PcInstance) inventory.getOwner(); + + // Any items equipped that result in expertise penalty do not give any skills at all. + if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + { + return; + } + final AtomicBoolean update = new AtomicBoolean(); final AtomicBoolean updateTimestamp = new AtomicBoolean(); @@ -466,11 +473,6 @@ public abstract class Inventory extends ItemContainer { player.sendPacket(new SkillCoolTime(player)); } - - if (item.isWeapon()) - { - player.handleAutoShots(Config.ENABLE_AUTO_SHOTS); - } } } @@ -500,6 +502,12 @@ public abstract class Inventory extends ItemContainer update = true; } + // Very and apply visual set + if (verifyAndApply(player, item, L2ItemInstance::getVisualId)) + { + update = true; + } + if (update) { player.sendSkillList(); @@ -619,6 +627,12 @@ public abstract class Inventory extends ItemContainer remove = true; } + // verify and remove visual set bonus + if (verifyAndRemove(player, item, L2ItemInstance::getVisualId)) + { + remove = true; + } + if (remove) { player.checkItemRestriction(); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java index 9699fbfee1..9450e02823 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java @@ -460,11 +460,6 @@ public class PcInventory extends Inventory actor.sendItemList(false); } - if (item.isEtcItem() && (item.getItemType() == EtcItemType.SOULSHOT)) - { - actor.handleAutoShots(false); - } - // Notify to scripts EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getItem()); } @@ -516,11 +511,6 @@ public class PcInventory extends Inventory actor.sendItemList(false); } - if (item.isEtcItem() && (item.getItemType() == EtcItemType.SOULSHOT)) - { - actor.handleAutoShots(false); - } - // Notify to scripts EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getItem()); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index a2f6ac1d4f..e579b4807d 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -47,7 +47,6 @@ import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.ItemLocation; import com.l2jmobius.gameserver.enums.ItemSkillType; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.idfactory.IdFactory; @@ -176,8 +175,6 @@ public final class L2ItemInstance extends L2Object private final DropProtection _dropProtection = new DropProtection(); - private int _shotsMask = 0; - private final List _enchantOptions = new ArrayList<>(); private final Map _ensoulOptions = new LinkedHashMap<>(3); private final Map _ensoulSpecialOptions = new LinkedHashMap<>(3); @@ -1369,7 +1366,6 @@ public final class L2ItemInstance extends L2Object final InventoryUpdate iu = new InventoryUpdate(); for (L2ItemInstance item : unequiped) { - item.unChargeAllShots(); iu.addModifiedItem(item); } player.sendInventoryUpdate(iu); @@ -1797,7 +1793,6 @@ public final class L2ItemInstance extends L2Object final InventoryUpdate iu = new InventoryUpdate(); for (L2ItemInstance item : unequiped) { - item.unChargeAllShots(); iu.addModifiedItem(item); } player.sendInventoryUpdate(iu); @@ -2047,30 +2042,6 @@ public final class L2ItemInstance extends L2Object } } - @Override - public boolean isChargedShot(ShotType type) - { - return (_shotsMask & type.getMask()) == type.getMask(); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - if (charged) - { - _shotsMask |= type.getMask(); - } - else - { - _shotsMask &= ~type.getMask(); - } - } - - public void unChargeAllShots() - { - _shotsMask = 0; - } - /** * Returns enchant effect object for this item * @return enchanteffect diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java index 9ef03baa0d..16b701ea9a 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java @@ -272,11 +272,7 @@ public abstract class AbstractOlympiadGame player.disableAutoShotsAll(); // Discharge any active shots - final L2ItemInstance item = player.getActiveWeaponInstance(); - if (item != null) - { - item.unChargeAllShots(); - } + player.unchargeAllShots(); // enable skills with cool time <= 15 minutes for (Skill skill : player.getAllSkills()) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/Skill.java index e4882978d7..8ab3e84e85 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/Skill.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/Skill.java @@ -1495,11 +1495,11 @@ public final class Skill implements IIdentifiable { if (useSpiritShot()) { - caster.setChargedShot(caster.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, false); + caster.unchargeShot(caster.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS); } else if (useSoulShot()) { - caster.setChargedShot(caster.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS, false); + caster.unchargeShot(caster.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java index cc1667a637..f6cd5bde92 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java @@ -217,11 +217,11 @@ public class SkillChannelizer implements Runnable // Reduce shots. if (skill.useSpiritShot()) { - _channelizer.setChargedShot(_channelizer.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, false); + _channelizer.unchargeShot(_channelizer.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS); } else { - _channelizer.setChargedShot(_channelizer.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS, false); + _channelizer.unchargeShot(_channelizer.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS); } // Shots are re-charged every cast. diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 3fa17e6ddc..3765dcee5e 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -646,17 +646,11 @@ public class EnterWorld implements IClientIncomingPacket activeChar.sendPacket(new ExOneDayReceiveRewardList(activeChar)); activeChar.sendPacket(ExConnectedTimeAndGettableReward.STATIC_PACKET); - if (Config.ENABLE_AUTO_SHOTS) - { - activeChar.handleAutoShots(true); - } - else - { - activeChar.sendPacket(new ExAutoSoulShot(0, false, 0)); - activeChar.sendPacket(new ExAutoSoulShot(0, false, 1)); - activeChar.sendPacket(new ExAutoSoulShot(0, false, 2)); - activeChar.sendPacket(new ExAutoSoulShot(0, false, 3)); - } + // Handle soulshots, disable all on EnterWorld + activeChar.sendPacket(new ExAutoSoulShot(0, true, 0)); + activeChar.sendPacket(new ExAutoSoulShot(0, true, 1)); + activeChar.sendPacket(new ExAutoSoulShot(0, true, 2)); + activeChar.sendPacket(new ExAutoSoulShot(0, true, 3)); if (Config.HARDWARE_INFO_ENABLED) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java index ef58975edc..f11a357d3e 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java @@ -180,11 +180,7 @@ public final class RequestDropItem implements IClientIncomingPacket if (item.isEquipped()) { - final L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(item.getLocationSlot()); - for (L2ItemInstance itm : unequiped) - { - itm.unChargeAllShots(); - } + activeChar.getInventory().unEquipItemInSlot(item.getLocationSlot()); activeChar.broadcastUserInfo(); activeChar.sendItemList(true); } diff --git a/L2J_Mobius_3.0_Helios/dist/game/config/Character.ini b/L2J_Mobius_3.0_Helios/dist/game/config/Character.ini index fb34413cfb..ddaa169ab3 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/config/Character.ini +++ b/L2J_Mobius_3.0_Helios/dist/game/config/Character.ini @@ -806,10 +806,6 @@ ExpertisePenalty = True # Default: True StoreCharUiSettings = True -# Enable automatic Shot usage on player login or weapon equipped. -# Default: True -EnableAutoShots = True - # Character name restriction # Disallow characters to have a name which contains the words. # Split them with ",". Example: announcements,announce... diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Summon.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Summon.java index 5650302d2d..179b65f3d7 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Summon.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Summon.java @@ -112,7 +112,5 @@ public final class Summon extends AbstractEffect summon.setShowSummonAnimation(true); summon.setRunning(); summon.spawnMe(); - - player.handleAutoShots(false); } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java index e86bb9078a..64e253b2bd 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java @@ -103,7 +103,5 @@ public final class SummonMulti extends AbstractEffect summon.setShowSummonAnimation(true); summon.setRunning(); summon.spawnMe(); - - player.handleAutoShots(false); } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java index c315af3a35..25f6828048 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java @@ -63,7 +63,6 @@ public class BeastSoulShot implements IItemHandler final List aliveServitor = playable.getServitors().values().stream().filter(s -> !s.isDead()).collect(Collectors.toList()); if ((pet == null) && aliveServitor.isEmpty()) { - activeOwner.sendMessage("asdas"); activeOwner.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET_OR_SERVITOR_SAD_ISN_T_IT); return false; } @@ -121,7 +120,7 @@ public class BeastSoulShot implements IItemHandler { if (!pet.isChargedShot(ShotType.SOULSHOTS)) { - pet.setChargedShot(ShotType.SOULSHOTS, true); + pet.chargeShot(ShotType.SOULSHOTS); // Visual effect change if player has equipped Ruby lvl 3 or higher if (activeOwner.getActiveRubyJewel() != null) { @@ -138,7 +137,7 @@ public class BeastSoulShot implements IItemHandler { if (!s.isChargedShot(ShotType.SOULSHOTS)) { - s.setChargedShot(ShotType.SOULSHOTS, true); + s.chargeShot(ShotType.SOULSHOTS); // Visual effect change if player has equipped Ruby lvl 3 or higher if (activeOwner.getActiveRubyJewel() != null) { diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java index 765194563e..de1917d42f 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java @@ -122,7 +122,7 @@ public class BeastSpiritShot implements IItemHandler { if (!pet.isChargedShot(shotType)) { - pet.setChargedShot(shotType, true); + pet.chargeShot(shotType); // Visual effect change if player has equipped Sapphire lvl 3 or higher if (activeOwner.getActiveShappireJewel() != null) { @@ -139,7 +139,7 @@ public class BeastSpiritShot implements IItemHandler { if (!s.isChargedShot(shotType)) { - s.setChargedShot(shotType, true); + s.chargeShot(shotType); // Visual effect change if player has equipped Sapphire lvl 3 or higher if (activeOwner.getActiveShappireJewel() != null) { diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java index b8a223f1d4..a053b95a9d 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java @@ -104,7 +104,7 @@ public class BlessedSoulShots implements IItemHandler return false; } // Charge soul shot - weaponInst.setChargedShot(ShotType.BLESSED_SOULSHOTS, true); + activeChar.chargeShot(ShotType.BLESSED_SOULSHOTS); } finally { diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java index f8b9a187dc..9800a7e664 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java @@ -94,7 +94,7 @@ public class BlessedSpiritShot implements IItemHandler } // Charge Spirit shot - activeChar.setChargedShot(ShotType.SPIRITSHOTS, true); + activeChar.chargeShot(ShotType.SPIRITSHOTS); // Send message to client if (!activeChar.getAutoSoulShot().contains(item.getId())) diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/FishShots.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/FishShots.java index d03dafbb52..5c5598ea69 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/FishShots.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/FishShots.java @@ -75,7 +75,7 @@ public class FishShots implements IItemHandler return false; } - activeChar.setChargedShot(ShotType.FISH_SOULSHOTS, true); + activeChar.chargeShot(ShotType.FISH_SOULSHOTS); activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false); final L2Object oldTarget = activeChar.getTarget(); activeChar.setTarget(activeChar); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java index a052bc2fa8..05c1ac3f7d 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java @@ -101,7 +101,7 @@ public class SoulShots implements IItemHandler return false; } // Charge soul shot - weaponInst.setChargedShot(ShotType.SOULSHOTS, true); + activeChar.chargeShot(ShotType.SOULSHOTS); } finally { diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java index 008665fc04..ddf0402d2b 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java @@ -94,7 +94,7 @@ public class SpiritShot implements IItemHandler } // Charge Spirit shot - activeChar.setChargedShot(ShotType.SPIRITSHOTS, true); + activeChar.chargeShot(ShotType.SPIRITSHOTS); // Send message to client if (!activeChar.getAutoSoulShot().contains(item.getId())) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java index 4dd1dae5c7..3a3e58903f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java @@ -283,7 +283,6 @@ public final class Config public static boolean EXPERTISE_PENALTY; public static boolean STORE_RECIPE_SHOPLIST; public static boolean STORE_UI_SETTINGS; - public static boolean ENABLE_AUTO_SHOTS; public static String[] FORBIDDEN_NAMES; public static boolean SILENCE_MODE_EXCLUDE; public static boolean SHOW_GOD_VIDEO_INTRO; @@ -1680,7 +1679,6 @@ public final class Config EXPERTISE_PENALTY = Character.getBoolean("ExpertisePenalty", true); STORE_RECIPE_SHOPLIST = Character.getBoolean("StoreRecipeShopList", false); STORE_UI_SETTINGS = Character.getBoolean("StoreCharUiSettings", true); - ENABLE_AUTO_SHOTS = Character.getBoolean("EnableAutoShots", true); FORBIDDEN_NAMES = Character.getString("ForbiddenNames", "").split(","); SILENCE_MODE_EXCLUDE = Character.getBoolean("SilenceModeExclude", false); SHOW_GOD_VIDEO_INTRO = Character.getBoolean("GoDVideoIntro", true); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/Fishing.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/Fishing.java index d0b69fa3e9..edbfe1412c 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/Fishing.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/Fishing.java @@ -247,8 +247,7 @@ public class Fishing double chance = baitData.getChance(); if (_player.isChargedShot(ShotType.FISH_SOULSHOTS)) { - chance *= 1.25; // +25 % chance to win - _player.setChargedShot(ShotType.FISH_SOULSHOTS, false); + chance *= 1.5; // +50 % chance to win } if (Rnd.get(0, 100) <= chance) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Object.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Object.java index 16c28a08d1..459660c7ca 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Object.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Object.java @@ -21,7 +21,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.handler.ActionHandler; import com.l2jmobius.gameserver.handler.ActionShiftHandler; import com.l2jmobius.gameserver.handler.IActionHandler; @@ -454,35 +453,6 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab return false; } - /** - * Check if current object has charged shot. - * @param type of the shot to be checked. - * @return {@code true} if the object has charged shot - */ - public boolean isChargedShot(ShotType type) - { - return false; - } - - /** - * Charging shot into the current object. - * @param type of the shot to be charged. - * @param charged - */ - public void setChargedShot(ShotType type, boolean charged) - { - } - - /** - * Try to recharge a shot. - * @param physical skill are using Soul shots. - * @param magical skill are using Spirit shots. - * @param fish - */ - public void rechargeShots(boolean physical, boolean magical, boolean fish) - { - } - /** * @param * @param script diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java index ca7e45e2b7..6de66b34db 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -21,6 +21,7 @@ import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ACTIVE; import java.lang.ref.WeakReference; import java.util.Collection; import java.util.Collections; +import java.util.EnumSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -269,6 +270,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe /** A map holding info about basic property mesmerizing system. */ private volatile Map _basicPropertyResists; + /** A set containing the shot types currently charged. */ + private Set _chargedShots = EnumSet.noneOf(ShotType.class); + /** * Creates a creature. * @param template the creature template @@ -3861,7 +3865,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe else { // If we didn't miss the hit, discharge the shoulshots, if any - setChargedShot(isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS, false); + unchargeShot(isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS); } // Check Raidboss attack @@ -5533,4 +5537,37 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe { return calculateDistance(target, true, false); } + + public boolean isChargedShot(ShotType type) + { + return _chargedShots.contains(type); + } + + /** + * @param type of the shot to charge + * @return {@code true} if there was no shot of this type charged before, {@code false} otherwise. + */ + public boolean chargeShot(ShotType type) + { + return _chargedShots.add(type); + } + + /** + * @param type of the shot to uncharge + * @return {@code true} if there was a charged shot of this type, {@code false} otherwise. + */ + public boolean unchargeShot(ShotType type) + { + return _chargedShots.remove(type); + } + + public void unchargeAllShots() + { + _chargedShots = EnumSet.noneOf(ShotType.class); + } + + public void rechargeShots(boolean physical, boolean magic, boolean fish) + { + // Dummy method to be overriden. + } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 744af6f9da..96801d3313 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -137,7 +137,6 @@ public class L2Npc extends L2Character private int _spiritshotamount = 0; private int _displayEffect = 0; - private int _shotsMask = 0; private int _killingBlowWeaponId; private int _cloneObjId; // Used in NpcInfo packet to clone the specified player. @@ -1301,25 +1300,6 @@ public class L2Npc extends L2Character return WalkingManager.getInstance().isRegistered(this); } - @Override - public boolean isChargedShot(ShotType type) - { - return (_shotsMask & type.getMask()) == type.getMask(); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - if (charged) - { - _shotsMask |= type.getMask(); - } - else - { - _shotsMask &= ~type.getMask(); - } - } - @Override public void rechargeShots(boolean physical, boolean magic, boolean fish) { @@ -1331,7 +1311,7 @@ public class L2Npc extends L2Character } _soulshotamount--; Broadcast.toSelfAndKnownPlayersInRadius(this, new MagicSkillUse(this, this, 2154, 1, 0, 0), 600); - setChargedShot(ShotType.SOULSHOTS, true); + chargeShot(ShotType.SOULSHOTS); } if (magic && (_spiritshotamount > 0)) @@ -1342,7 +1322,7 @@ public class L2Npc extends L2Character } _spiritshotamount--; Broadcast.toSelfAndKnownPlayersInRadius(this, new MagicSkillUse(this, this, 2061, 1, 0, 0), 600); - setChargedShot(ShotType.SPIRITSHOTS, true); + chargeShot(ShotType.SPIRITSHOTS); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index d3f34a4935..8427885746 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.data.xml.impl.ExperienceData; import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.handler.ItemHandler; @@ -77,7 +76,6 @@ public abstract class L2Summon extends L2Playable private boolean _follow = true; private boolean _previousFollowStatus = true; protected boolean _restoreSummon = true; - private int _shotsMask = 0; private int _summonPoints = 0; // @formatter:off @@ -1026,25 +1024,6 @@ public abstract class L2Summon extends L2Playable return true; } - @Override - public boolean isChargedShot(ShotType type) - { - return (_shotsMask & type.getMask()) == type.getMask(); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - if (charged) - { - _shotsMask |= type.getMask(); - } - else - { - _shotsMask &= ~type.getMask(); - } - } - @Override public void rechargeShots(boolean physical, boolean magic, boolean fish) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 3be94a36d8..8f0f11ba2f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -93,7 +93,6 @@ import com.l2jmobius.gameserver.enums.PrivateStoreType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Sex; import com.l2jmobius.gameserver.enums.ShortcutType; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.enums.StatusUpdateType; import com.l2jmobius.gameserver.enums.SubclassInfoType; import com.l2jmobius.gameserver.enums.Team; @@ -13018,23 +13017,6 @@ public final class L2PcInstance extends L2Playable return true; } - @Override - public boolean isChargedShot(ShotType type) - { - final L2ItemInstance weapon = getActiveWeaponInstance(); - return (weapon != null) && weapon.isChargedShot(type); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - final L2ItemInstance weapon = getActiveWeaponInstance(); - if (weapon != null) - { - weapon.setChargedShot(type, charged); - } - } - /** * @param skillId the display skill Id * @return the custom skill @@ -13886,93 +13868,6 @@ public final class L2PcInstance extends L2Playable } } - public void handleAutoShots(boolean force) - { - if (getAutoSoulShot().isEmpty() && !force) - { - return; - } - - final L2ItemInstance weapon = getActiveWeaponInstance(); - int soulShotId = 0; - int spiritShotId = 0; - int summonSoulShotId = 0; - int summonSpiritShotId = 0; - - for (L2ItemInstance item : getInventory().getItems(L2ItemInstance::isEtcItem, i -> i.getItemType() == EtcItemType.SOULSHOT)) - { - switch (item.getEtcItem().getDefaultAction()) - { - case SOULSHOT: - { - if ((weapon != null) && (weapon.getItemType() != WeaponType.FISHINGROD) && (weapon.getItem().getCrystalTypePlus() == item.getItem().getCrystalType())) - { - soulShotId = item.getId(); - } - break; - } - case SPIRITSHOT: - { - if ((weapon != null) && (weapon.getItem().getCrystalTypePlus() == item.getItem().getCrystalType())) - { - spiritShotId = item.getId(); - } - break; - } - case SUMMON_SOULSHOT: - { - if (hasSummon()) - { - summonSoulShotId = item.getId(); - } - break; - } - case SUMMON_SPIRITSHOT: - { - if (hasSummon()) - { - summonSpiritShotId = item.getId(); - } - break; - } - case FISHINGSHOT: - { - if ((weapon != null) && (weapon.getItemType() == WeaponType.FISHINGROD) && (weapon.getItem().getCrystalType() == item.getItem().getCrystalType())) - { - soulShotId = item.getId(); - } - break; - } - } - } - - _activeSoulShots.clear(); - - if (soulShotId != 0) - { - addAutoSoulShot(soulShotId); - } - if (spiritShotId != 0) - { - addAutoSoulShot(spiritShotId); - } - if (summonSoulShotId != 0) - { - addAutoSoulShot(summonSoulShotId); - } - if (summonSpiritShotId != 0) - { - addAutoSoulShot(summonSpiritShotId); - } - - sendPacket(new ExAutoSoulShot(soulShotId, true, 0)); - sendPacket(new ExAutoSoulShot(spiritShotId, true, 1)); - sendPacket(new ExAutoSoulShot(summonSoulShotId, true, 2)); - sendPacket(new ExAutoSoulShot(summonSpiritShotId, true, 3)); - - rechargeShots(true, true, true); - } - public GroupType getGroupType() { return isInParty() ? (getParty().isInCommandChannel() ? GroupType.COMMAND_CHANNEL : GroupType.PARTY) : GroupType.NONE; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 9b6ddae51e..177255ec02 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -370,11 +370,6 @@ public abstract class Inventory extends ItemContainer } }); } - - if (item.isWeapon()) - { - player.handleAutoShots(false); - } } // Apply skill, if weapon have "skills on unequip" @@ -388,6 +383,11 @@ public abstract class Inventory extends ItemContainer { player.sendPacket(new SkillCoolTime(player)); } + + if (item.isWeapon()) + { + player.unchargeAllShots(); + } } @Override @@ -399,6 +399,13 @@ public abstract class Inventory extends ItemContainer } final L2PcInstance player = (L2PcInstance) inventory.getOwner(); + + // Any items equipped that result in expertise penalty do not give any skills at all. + if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + { + return; + } + final AtomicBoolean update = new AtomicBoolean(); final AtomicBoolean updateTimestamp = new AtomicBoolean(); @@ -466,11 +473,6 @@ public abstract class Inventory extends ItemContainer { player.sendPacket(new SkillCoolTime(player)); } - - if (item.isWeapon()) - { - player.handleAutoShots(Config.ENABLE_AUTO_SHOTS); - } } } @@ -500,6 +502,12 @@ public abstract class Inventory extends ItemContainer update = true; } + // Very and apply visual set + if (verifyAndApply(player, item, L2ItemInstance::getVisualId)) + { + update = true; + } + if (update) { player.sendSkillList(); @@ -619,6 +627,12 @@ public abstract class Inventory extends ItemContainer remove = true; } + // verify and remove visual set bonus + if (verifyAndRemove(player, item, L2ItemInstance::getVisualId)) + { + remove = true; + } + if (remove) { player.checkItemRestriction(); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java index 9699fbfee1..9450e02823 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java @@ -460,11 +460,6 @@ public class PcInventory extends Inventory actor.sendItemList(false); } - if (item.isEtcItem() && (item.getItemType() == EtcItemType.SOULSHOT)) - { - actor.handleAutoShots(false); - } - // Notify to scripts EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getItem()); } @@ -516,11 +511,6 @@ public class PcInventory extends Inventory actor.sendItemList(false); } - if (item.isEtcItem() && (item.getItemType() == EtcItemType.SOULSHOT)) - { - actor.handleAutoShots(false); - } - // Notify to scripts EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getItem()); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index a2f6ac1d4f..e579b4807d 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -47,7 +47,6 @@ import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.ItemLocation; import com.l2jmobius.gameserver.enums.ItemSkillType; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.idfactory.IdFactory; @@ -176,8 +175,6 @@ public final class L2ItemInstance extends L2Object private final DropProtection _dropProtection = new DropProtection(); - private int _shotsMask = 0; - private final List _enchantOptions = new ArrayList<>(); private final Map _ensoulOptions = new LinkedHashMap<>(3); private final Map _ensoulSpecialOptions = new LinkedHashMap<>(3); @@ -1369,7 +1366,6 @@ public final class L2ItemInstance extends L2Object final InventoryUpdate iu = new InventoryUpdate(); for (L2ItemInstance item : unequiped) { - item.unChargeAllShots(); iu.addModifiedItem(item); } player.sendInventoryUpdate(iu); @@ -1797,7 +1793,6 @@ public final class L2ItemInstance extends L2Object final InventoryUpdate iu = new InventoryUpdate(); for (L2ItemInstance item : unequiped) { - item.unChargeAllShots(); iu.addModifiedItem(item); } player.sendInventoryUpdate(iu); @@ -2047,30 +2042,6 @@ public final class L2ItemInstance extends L2Object } } - @Override - public boolean isChargedShot(ShotType type) - { - return (_shotsMask & type.getMask()) == type.getMask(); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - if (charged) - { - _shotsMask |= type.getMask(); - } - else - { - _shotsMask &= ~type.getMask(); - } - } - - public void unChargeAllShots() - { - _shotsMask = 0; - } - /** * Returns enchant effect object for this item * @return enchanteffect diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java index 9ef03baa0d..16b701ea9a 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java @@ -272,11 +272,7 @@ public abstract class AbstractOlympiadGame player.disableAutoShotsAll(); // Discharge any active shots - final L2ItemInstance item = player.getActiveWeaponInstance(); - if (item != null) - { - item.unChargeAllShots(); - } + player.unchargeAllShots(); // enable skills with cool time <= 15 minutes for (Skill skill : player.getAllSkills()) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/Skill.java index e4882978d7..8ab3e84e85 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/Skill.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/Skill.java @@ -1495,11 +1495,11 @@ public final class Skill implements IIdentifiable { if (useSpiritShot()) { - caster.setChargedShot(caster.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, false); + caster.unchargeShot(caster.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS); } else if (useSoulShot()) { - caster.setChargedShot(caster.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS, false); + caster.unchargeShot(caster.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java index cc1667a637..f6cd5bde92 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java @@ -217,11 +217,11 @@ public class SkillChannelizer implements Runnable // Reduce shots. if (skill.useSpiritShot()) { - _channelizer.setChargedShot(_channelizer.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, false); + _channelizer.unchargeShot(_channelizer.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS); } else { - _channelizer.setChargedShot(_channelizer.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS, false); + _channelizer.unchargeShot(_channelizer.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS); } // Shots are re-charged every cast. diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 3fa17e6ddc..3765dcee5e 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -646,17 +646,11 @@ public class EnterWorld implements IClientIncomingPacket activeChar.sendPacket(new ExOneDayReceiveRewardList(activeChar)); activeChar.sendPacket(ExConnectedTimeAndGettableReward.STATIC_PACKET); - if (Config.ENABLE_AUTO_SHOTS) - { - activeChar.handleAutoShots(true); - } - else - { - activeChar.sendPacket(new ExAutoSoulShot(0, false, 0)); - activeChar.sendPacket(new ExAutoSoulShot(0, false, 1)); - activeChar.sendPacket(new ExAutoSoulShot(0, false, 2)); - activeChar.sendPacket(new ExAutoSoulShot(0, false, 3)); - } + // Handle soulshots, disable all on EnterWorld + activeChar.sendPacket(new ExAutoSoulShot(0, true, 0)); + activeChar.sendPacket(new ExAutoSoulShot(0, true, 1)); + activeChar.sendPacket(new ExAutoSoulShot(0, true, 2)); + activeChar.sendPacket(new ExAutoSoulShot(0, true, 3)); if (Config.HARDWARE_INFO_ENABLED) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java index ef58975edc..f11a357d3e 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java @@ -180,11 +180,7 @@ public final class RequestDropItem implements IClientIncomingPacket if (item.isEquipped()) { - final L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(item.getLocationSlot()); - for (L2ItemInstance itm : unequiped) - { - itm.unChargeAllShots(); - } + activeChar.getInventory().unEquipItemInSlot(item.getLocationSlot()); activeChar.broadcastUserInfo(); activeChar.sendItemList(true); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Character.ini b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Character.ini index 9475e14088..af9c2b3bdf 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Character.ini +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Character.ini @@ -771,10 +771,6 @@ ExpertisePenalty = True # Default: True StoreCharUiSettings = True -# Enable automatic Shot usage on player login or weapon equipped. -# Default: True -EnableAutoShots = True - # Character name restriction # Disallow characters to have a name which contains the words. # Split them with ",". Example: announcements,announce... diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Summon.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Summon.java index 5650302d2d..179b65f3d7 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Summon.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Summon.java @@ -112,7 +112,5 @@ public final class Summon extends AbstractEffect summon.setShowSummonAnimation(true); summon.setRunning(); summon.spawnMe(); - - player.handleAutoShots(false); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java index e86bb9078a..64e253b2bd 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SummonMulti.java @@ -103,7 +103,5 @@ public final class SummonMulti extends AbstractEffect summon.setShowSummonAnimation(true); summon.setRunning(); summon.spawnMe(); - - player.handleAutoShots(false); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java index c315af3a35..25f6828048 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java @@ -63,7 +63,6 @@ public class BeastSoulShot implements IItemHandler final List aliveServitor = playable.getServitors().values().stream().filter(s -> !s.isDead()).collect(Collectors.toList()); if ((pet == null) && aliveServitor.isEmpty()) { - activeOwner.sendMessage("asdas"); activeOwner.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET_OR_SERVITOR_SAD_ISN_T_IT); return false; } @@ -121,7 +120,7 @@ public class BeastSoulShot implements IItemHandler { if (!pet.isChargedShot(ShotType.SOULSHOTS)) { - pet.setChargedShot(ShotType.SOULSHOTS, true); + pet.chargeShot(ShotType.SOULSHOTS); // Visual effect change if player has equipped Ruby lvl 3 or higher if (activeOwner.getActiveRubyJewel() != null) { @@ -138,7 +137,7 @@ public class BeastSoulShot implements IItemHandler { if (!s.isChargedShot(ShotType.SOULSHOTS)) { - s.setChargedShot(ShotType.SOULSHOTS, true); + s.chargeShot(ShotType.SOULSHOTS); // Visual effect change if player has equipped Ruby lvl 3 or higher if (activeOwner.getActiveRubyJewel() != null) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java index 765194563e..de1917d42f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java @@ -122,7 +122,7 @@ public class BeastSpiritShot implements IItemHandler { if (!pet.isChargedShot(shotType)) { - pet.setChargedShot(shotType, true); + pet.chargeShot(shotType); // Visual effect change if player has equipped Sapphire lvl 3 or higher if (activeOwner.getActiveShappireJewel() != null) { @@ -139,7 +139,7 @@ public class BeastSpiritShot implements IItemHandler { if (!s.isChargedShot(shotType)) { - s.setChargedShot(shotType, true); + s.chargeShot(shotType); // Visual effect change if player has equipped Sapphire lvl 3 or higher if (activeOwner.getActiveShappireJewel() != null) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java index b8a223f1d4..a053b95a9d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BlessedSoulShots.java @@ -104,7 +104,7 @@ public class BlessedSoulShots implements IItemHandler return false; } // Charge soul shot - weaponInst.setChargedShot(ShotType.BLESSED_SOULSHOTS, true); + activeChar.chargeShot(ShotType.BLESSED_SOULSHOTS); } finally { diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java index f8b9a187dc..9800a7e664 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java @@ -94,7 +94,7 @@ public class BlessedSpiritShot implements IItemHandler } // Charge Spirit shot - activeChar.setChargedShot(ShotType.SPIRITSHOTS, true); + activeChar.chargeShot(ShotType.SPIRITSHOTS); // Send message to client if (!activeChar.getAutoSoulShot().contains(item.getId())) diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/FishShots.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/FishShots.java index d03dafbb52..5c5598ea69 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/FishShots.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/FishShots.java @@ -75,7 +75,7 @@ public class FishShots implements IItemHandler return false; } - activeChar.setChargedShot(ShotType.FISH_SOULSHOTS, true); + activeChar.chargeShot(ShotType.FISH_SOULSHOTS); activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false); final L2Object oldTarget = activeChar.getTarget(); activeChar.setTarget(activeChar); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java index a052bc2fa8..05c1ac3f7d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java @@ -101,7 +101,7 @@ public class SoulShots implements IItemHandler return false; } // Charge soul shot - weaponInst.setChargedShot(ShotType.SOULSHOTS, true); + activeChar.chargeShot(ShotType.SOULSHOTS); } finally { diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java index 008665fc04..ddf0402d2b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java @@ -94,7 +94,7 @@ public class SpiritShot implements IItemHandler } // Charge Spirit shot - activeChar.setChargedShot(ShotType.SPIRITSHOTS, true); + activeChar.chargeShot(ShotType.SPIRITSHOTS); // Send message to client if (!activeChar.getAutoSoulShot().contains(item.getId())) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/Config.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/Config.java index 68698d1c36..57096af4f9 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/Config.java @@ -285,7 +285,6 @@ public final class Config public static boolean EXPERTISE_PENALTY; public static boolean STORE_RECIPE_SHOPLIST; public static boolean STORE_UI_SETTINGS; - public static boolean ENABLE_AUTO_SHOTS; public static String[] FORBIDDEN_NAMES; public static boolean SILENCE_MODE_EXCLUDE; public static boolean SHOW_GOD_VIDEO_INTRO; @@ -1618,7 +1617,6 @@ public final class Config EXPERTISE_PENALTY = Character.getBoolean("ExpertisePenalty", true); STORE_RECIPE_SHOPLIST = Character.getBoolean("StoreRecipeShopList", false); STORE_UI_SETTINGS = Character.getBoolean("StoreCharUiSettings", true); - ENABLE_AUTO_SHOTS = Character.getBoolean("EnableAutoShots", true); FORBIDDEN_NAMES = Character.getString("ForbiddenNames", "").split(","); SILENCE_MODE_EXCLUDE = Character.getBoolean("SilenceModeExclude", false); SHOW_GOD_VIDEO_INTRO = Character.getBoolean("GoDVideoIntro", true); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/Fishing.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/Fishing.java index 6559985934..3031278988 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/Fishing.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/Fishing.java @@ -247,8 +247,7 @@ public class Fishing double chance = baitData.getChance(); if (_player.isChargedShot(ShotType.FISH_SOULSHOTS)) { - chance *= 1.25; // +25 % chance to win - _player.setChargedShot(ShotType.FISH_SOULSHOTS, false); + chance *= 1.5; // +50 % chance to win } if (Rnd.get(0, 100) <= chance) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Object.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Object.java index 16c28a08d1..459660c7ca 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Object.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Object.java @@ -21,7 +21,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.handler.ActionHandler; import com.l2jmobius.gameserver.handler.ActionShiftHandler; import com.l2jmobius.gameserver.handler.IActionHandler; @@ -454,35 +453,6 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab return false; } - /** - * Check if current object has charged shot. - * @param type of the shot to be checked. - * @return {@code true} if the object has charged shot - */ - public boolean isChargedShot(ShotType type) - { - return false; - } - - /** - * Charging shot into the current object. - * @param type of the shot to be charged. - * @param charged - */ - public void setChargedShot(ShotType type, boolean charged) - { - } - - /** - * Try to recharge a shot. - * @param physical skill are using Soul shots. - * @param magical skill are using Spirit shots. - * @param fish - */ - public void rechargeShots(boolean physical, boolean magical, boolean fish) - { - } - /** * @param * @param script diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java index ca7e45e2b7..6de66b34db 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -21,6 +21,7 @@ import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ACTIVE; import java.lang.ref.WeakReference; import java.util.Collection; import java.util.Collections; +import java.util.EnumSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -269,6 +270,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe /** A map holding info about basic property mesmerizing system. */ private volatile Map _basicPropertyResists; + /** A set containing the shot types currently charged. */ + private Set _chargedShots = EnumSet.noneOf(ShotType.class); + /** * Creates a creature. * @param template the creature template @@ -3861,7 +3865,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe else { // If we didn't miss the hit, discharge the shoulshots, if any - setChargedShot(isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS, false); + unchargeShot(isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS); } // Check Raidboss attack @@ -5533,4 +5537,37 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe { return calculateDistance(target, true, false); } + + public boolean isChargedShot(ShotType type) + { + return _chargedShots.contains(type); + } + + /** + * @param type of the shot to charge + * @return {@code true} if there was no shot of this type charged before, {@code false} otherwise. + */ + public boolean chargeShot(ShotType type) + { + return _chargedShots.add(type); + } + + /** + * @param type of the shot to uncharge + * @return {@code true} if there was a charged shot of this type, {@code false} otherwise. + */ + public boolean unchargeShot(ShotType type) + { + return _chargedShots.remove(type); + } + + public void unchargeAllShots() + { + _chargedShots = EnumSet.noneOf(ShotType.class); + } + + public void rechargeShots(boolean physical, boolean magic, boolean fish) + { + // Dummy method to be overriden. + } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 744af6f9da..96801d3313 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -137,7 +137,6 @@ public class L2Npc extends L2Character private int _spiritshotamount = 0; private int _displayEffect = 0; - private int _shotsMask = 0; private int _killingBlowWeaponId; private int _cloneObjId; // Used in NpcInfo packet to clone the specified player. @@ -1301,25 +1300,6 @@ public class L2Npc extends L2Character return WalkingManager.getInstance().isRegistered(this); } - @Override - public boolean isChargedShot(ShotType type) - { - return (_shotsMask & type.getMask()) == type.getMask(); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - if (charged) - { - _shotsMask |= type.getMask(); - } - else - { - _shotsMask &= ~type.getMask(); - } - } - @Override public void rechargeShots(boolean physical, boolean magic, boolean fish) { @@ -1331,7 +1311,7 @@ public class L2Npc extends L2Character } _soulshotamount--; Broadcast.toSelfAndKnownPlayersInRadius(this, new MagicSkillUse(this, this, 2154, 1, 0, 0), 600); - setChargedShot(ShotType.SOULSHOTS, true); + chargeShot(ShotType.SOULSHOTS); } if (magic && (_spiritshotamount > 0)) @@ -1342,7 +1322,7 @@ public class L2Npc extends L2Character } _spiritshotamount--; Broadcast.toSelfAndKnownPlayersInRadius(this, new MagicSkillUse(this, this, 2061, 1, 0, 0), 600); - setChargedShot(ShotType.SPIRITSHOTS, true); + chargeShot(ShotType.SPIRITSHOTS); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index d58adad4db..dab0c5323a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.data.xml.impl.ExperienceData; import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.handler.ItemHandler; @@ -77,7 +76,6 @@ public abstract class L2Summon extends L2Playable private boolean _follow = true; private boolean _previousFollowStatus = true; protected boolean _restoreSummon = true; - private int _shotsMask = 0; private int _summonPoints = 0; // @formatter:off @@ -1026,25 +1024,6 @@ public abstract class L2Summon extends L2Playable return true; } - @Override - public boolean isChargedShot(ShotType type) - { - return (_shotsMask & type.getMask()) == type.getMask(); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - if (charged) - { - _shotsMask |= type.getMask(); - } - else - { - _shotsMask &= ~type.getMask(); - } - } - @Override public void rechargeShots(boolean physical, boolean magic, boolean fish) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index e3f9d1803c..eb44a95708 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -92,7 +92,6 @@ import com.l2jmobius.gameserver.enums.PrivateStoreType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Sex; import com.l2jmobius.gameserver.enums.ShortcutType; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.enums.StatusUpdateType; import com.l2jmobius.gameserver.enums.SubclassInfoType; import com.l2jmobius.gameserver.enums.Team; @@ -12980,23 +12979,6 @@ public final class L2PcInstance extends L2Playable return true; } - @Override - public boolean isChargedShot(ShotType type) - { - final L2ItemInstance weapon = getActiveWeaponInstance(); - return (weapon != null) && weapon.isChargedShot(type); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - final L2ItemInstance weapon = getActiveWeaponInstance(); - if (weapon != null) - { - weapon.setChargedShot(type, charged); - } - } - /** * @param skillId the display skill Id * @return the custom skill @@ -13848,93 +13830,6 @@ public final class L2PcInstance extends L2Playable } } - public void handleAutoShots(boolean force) - { - if (getAutoSoulShot().isEmpty() && !force) - { - return; - } - - final L2ItemInstance weapon = getActiveWeaponInstance(); - int soulShotId = 0; - int spiritShotId = 0; - int summonSoulShotId = 0; - int summonSpiritShotId = 0; - - for (L2ItemInstance item : getInventory().getItems(L2ItemInstance::isEtcItem, i -> i.getItemType() == EtcItemType.SOULSHOT)) - { - switch (item.getEtcItem().getDefaultAction()) - { - case SOULSHOT: - { - if ((weapon != null) && (weapon.getItemType() != WeaponType.FISHINGROD) && (weapon.getItem().getCrystalTypePlus() == item.getItem().getCrystalType())) - { - soulShotId = item.getId(); - } - break; - } - case SPIRITSHOT: - { - if ((weapon != null) && (weapon.getItem().getCrystalTypePlus() == item.getItem().getCrystalType())) - { - spiritShotId = item.getId(); - } - break; - } - case SUMMON_SOULSHOT: - { - if (hasSummon()) - { - summonSoulShotId = item.getId(); - } - break; - } - case SUMMON_SPIRITSHOT: - { - if (hasSummon()) - { - summonSpiritShotId = item.getId(); - } - break; - } - case FISHINGSHOT: - { - if ((weapon != null) && (weapon.getItemType() == WeaponType.FISHINGROD) && (weapon.getItem().getCrystalType() == item.getItem().getCrystalType())) - { - soulShotId = item.getId(); - } - break; - } - } - } - - _activeSoulShots.clear(); - - if (soulShotId != 0) - { - addAutoSoulShot(soulShotId); - } - if (spiritShotId != 0) - { - addAutoSoulShot(spiritShotId); - } - if (summonSoulShotId != 0) - { - addAutoSoulShot(summonSoulShotId); - } - if (summonSpiritShotId != 0) - { - addAutoSoulShot(summonSpiritShotId); - } - - sendPacket(new ExAutoSoulShot(soulShotId, true, 0)); - sendPacket(new ExAutoSoulShot(spiritShotId, true, 1)); - sendPacket(new ExAutoSoulShot(summonSoulShotId, true, 2)); - sendPacket(new ExAutoSoulShot(summonSpiritShotId, true, 3)); - - rechargeShots(true, true, true); - } - public GroupType getGroupType() { return isInParty() ? (getParty().isInCommandChannel() ? GroupType.COMMAND_CHANNEL : GroupType.PARTY) : GroupType.NONE; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 9b6ddae51e..177255ec02 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -370,11 +370,6 @@ public abstract class Inventory extends ItemContainer } }); } - - if (item.isWeapon()) - { - player.handleAutoShots(false); - } } // Apply skill, if weapon have "skills on unequip" @@ -388,6 +383,11 @@ public abstract class Inventory extends ItemContainer { player.sendPacket(new SkillCoolTime(player)); } + + if (item.isWeapon()) + { + player.unchargeAllShots(); + } } @Override @@ -399,6 +399,13 @@ public abstract class Inventory extends ItemContainer } final L2PcInstance player = (L2PcInstance) inventory.getOwner(); + + // Any items equipped that result in expertise penalty do not give any skills at all. + if (item.getItem().getCrystalType().getId() > player.getExpertiseLevel()) + { + return; + } + final AtomicBoolean update = new AtomicBoolean(); final AtomicBoolean updateTimestamp = new AtomicBoolean(); @@ -466,11 +473,6 @@ public abstract class Inventory extends ItemContainer { player.sendPacket(new SkillCoolTime(player)); } - - if (item.isWeapon()) - { - player.handleAutoShots(Config.ENABLE_AUTO_SHOTS); - } } } @@ -500,6 +502,12 @@ public abstract class Inventory extends ItemContainer update = true; } + // Very and apply visual set + if (verifyAndApply(player, item, L2ItemInstance::getVisualId)) + { + update = true; + } + if (update) { player.sendSkillList(); @@ -619,6 +627,12 @@ public abstract class Inventory extends ItemContainer remove = true; } + // verify and remove visual set bonus + if (verifyAndRemove(player, item, L2ItemInstance::getVisualId)) + { + remove = true; + } + if (remove) { player.checkItemRestriction(); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java index 9699fbfee1..9450e02823 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java @@ -460,11 +460,6 @@ public class PcInventory extends Inventory actor.sendItemList(false); } - if (item.isEtcItem() && (item.getItemType() == EtcItemType.SOULSHOT)) - { - actor.handleAutoShots(false); - } - // Notify to scripts EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getItem()); } @@ -516,11 +511,6 @@ public class PcInventory extends Inventory actor.sendItemList(false); } - if (item.isEtcItem() && (item.getItemType() == EtcItemType.SOULSHOT)) - { - actor.handleAutoShots(false); - } - // Notify to scripts EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getItem()); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index a2f6ac1d4f..e579b4807d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -47,7 +47,6 @@ import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.ItemLocation; import com.l2jmobius.gameserver.enums.ItemSkillType; -import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.idfactory.IdFactory; @@ -176,8 +175,6 @@ public final class L2ItemInstance extends L2Object private final DropProtection _dropProtection = new DropProtection(); - private int _shotsMask = 0; - private final List _enchantOptions = new ArrayList<>(); private final Map _ensoulOptions = new LinkedHashMap<>(3); private final Map _ensoulSpecialOptions = new LinkedHashMap<>(3); @@ -1369,7 +1366,6 @@ public final class L2ItemInstance extends L2Object final InventoryUpdate iu = new InventoryUpdate(); for (L2ItemInstance item : unequiped) { - item.unChargeAllShots(); iu.addModifiedItem(item); } player.sendInventoryUpdate(iu); @@ -1797,7 +1793,6 @@ public final class L2ItemInstance extends L2Object final InventoryUpdate iu = new InventoryUpdate(); for (L2ItemInstance item : unequiped) { - item.unChargeAllShots(); iu.addModifiedItem(item); } player.sendInventoryUpdate(iu); @@ -2047,30 +2042,6 @@ public final class L2ItemInstance extends L2Object } } - @Override - public boolean isChargedShot(ShotType type) - { - return (_shotsMask & type.getMask()) == type.getMask(); - } - - @Override - public void setChargedShot(ShotType type, boolean charged) - { - if (charged) - { - _shotsMask |= type.getMask(); - } - else - { - _shotsMask &= ~type.getMask(); - } - } - - public void unChargeAllShots() - { - _shotsMask = 0; - } - /** * Returns enchant effect object for this item * @return enchanteffect diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java index 9ef03baa0d..16b701ea9a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/AbstractOlympiadGame.java @@ -272,11 +272,7 @@ public abstract class AbstractOlympiadGame player.disableAutoShotsAll(); // Discharge any active shots - final L2ItemInstance item = player.getActiveWeaponInstance(); - if (item != null) - { - item.unChargeAllShots(); - } + player.unchargeAllShots(); // enable skills with cool time <= 15 minutes for (Skill skill : player.getAllSkills()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/Skill.java index e4882978d7..8ab3e84e85 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/Skill.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/Skill.java @@ -1495,11 +1495,11 @@ public final class Skill implements IIdentifiable { if (useSpiritShot()) { - caster.setChargedShot(caster.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, false); + caster.unchargeShot(caster.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS); } else if (useSoulShot()) { - caster.setChargedShot(caster.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS, false); + caster.unchargeShot(caster.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java index cc1667a637..f6cd5bde92 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java @@ -217,11 +217,11 @@ public class SkillChannelizer implements Runnable // Reduce shots. if (skill.useSpiritShot()) { - _channelizer.setChargedShot(_channelizer.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, false); + _channelizer.unchargeShot(_channelizer.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS); } else { - _channelizer.setChargedShot(_channelizer.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS, false); + _channelizer.unchargeShot(_channelizer.isChargedShot(ShotType.BLESSED_SOULSHOTS) ? ShotType.BLESSED_SOULSHOTS : ShotType.SOULSHOTS); } // Shots are re-charged every cast. diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 3fa17e6ddc..3765dcee5e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -646,17 +646,11 @@ public class EnterWorld implements IClientIncomingPacket activeChar.sendPacket(new ExOneDayReceiveRewardList(activeChar)); activeChar.sendPacket(ExConnectedTimeAndGettableReward.STATIC_PACKET); - if (Config.ENABLE_AUTO_SHOTS) - { - activeChar.handleAutoShots(true); - } - else - { - activeChar.sendPacket(new ExAutoSoulShot(0, false, 0)); - activeChar.sendPacket(new ExAutoSoulShot(0, false, 1)); - activeChar.sendPacket(new ExAutoSoulShot(0, false, 2)); - activeChar.sendPacket(new ExAutoSoulShot(0, false, 3)); - } + // Handle soulshots, disable all on EnterWorld + activeChar.sendPacket(new ExAutoSoulShot(0, true, 0)); + activeChar.sendPacket(new ExAutoSoulShot(0, true, 1)); + activeChar.sendPacket(new ExAutoSoulShot(0, true, 2)); + activeChar.sendPacket(new ExAutoSoulShot(0, true, 3)); if (Config.HARDWARE_INFO_ENABLED) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java index ef58975edc..f11a357d3e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDropItem.java @@ -180,11 +180,7 @@ public final class RequestDropItem implements IClientIncomingPacket if (item.isEquipped()) { - final L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(item.getLocationSlot()); - for (L2ItemInstance itm : unequiped) - { - itm.unChargeAllShots(); - } + activeChar.getInventory().unEquipItemInSlot(item.getLocationSlot()); activeChar.broadcastUserInfo(); activeChar.sendItemList(true); }