From 3e14f78f7161efe396ec8ce9ece35e35fb32867f Mon Sep 17 00:00:00 2001 From: Gnacik <Gnacik@users.noreply.github.com> Date: Sun, 10 Jan 2010 08:33:57 +0000 Subject: [PATCH] JAVA: Sshot code update, thanks JiV --- .../handlers/itemhandlers/BeastSoulShot.java | 18 ++++-------------- .../handlers/itemhandlers/BeastSpiritShot.java | 18 ++++-------------- .../itemhandlers/BlessedSpiritShot.java | 12 +----------- .../handlers/itemhandlers/SoulShots.java | 12 +----------- .../handlers/itemhandlers/SpiritShot.java | 12 +----------- 5 files changed, 11 insertions(+), 61 deletions(-) diff --git a/datapack_development/data/scripts/handlers/itemhandlers/BeastSoulShot.java b/datapack_development/data/scripts/handlers/itemhandlers/BeastSoulShot.java index 43def5e317..fc783ebf1e 100644 --- a/datapack_development/data/scripts/handlers/itemhandlers/BeastSoulShot.java +++ b/datapack_development/data/scripts/handlers/itemhandlers/BeastSoulShot.java @@ -21,7 +21,6 @@ import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PetInstance; import com.l2jserver.gameserver.network.SystemMessageId; -import com.l2jserver.gameserver.network.serverpackets.ExAutoSoulShot; import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.util.Broadcast; @@ -75,7 +74,8 @@ public class BeastSoulShot implements IItemHandler if (!(shotCount > shotConsumption)) { // Not enough Soulshots to use. - activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SOULSHOTS_FOR_PET)); + if (!activeOwner.disableAutoShot(itemId)) + activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SOULSHOTS_FOR_PET)); return; } @@ -104,18 +104,8 @@ public class BeastSoulShot implements IItemHandler // If the player doesn't have enough beast soulshot remaining, remove any auto soulshot task. if (!activeOwner.destroyItemWithoutTrace("Consume", item.getObjectId(), shotConsumption, null, false)) { - if (activeOwner.getAutoSoulShot().containsKey(itemId)) - { - activeOwner.removeAutoSoulShot(itemId); - activeOwner.sendPacket(new ExAutoSoulShot(itemId, 0)); - - SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED); - sm.addString(item.getItem().getName()); - activeOwner.sendPacket(sm); - return; - } - - activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SOULSHOTS)); + if (!activeOwner.disableAutoShot(itemId)) + activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SOULSHOTS_FOR_PET)); return; } diff --git a/datapack_development/data/scripts/handlers/itemhandlers/BeastSpiritShot.java b/datapack_development/data/scripts/handlers/itemhandlers/BeastSpiritShot.java index cd30f83b62..97a79aae9c 100644 --- a/datapack_development/data/scripts/handlers/itemhandlers/BeastSpiritShot.java +++ b/datapack_development/data/scripts/handlers/itemhandlers/BeastSpiritShot.java @@ -21,7 +21,6 @@ import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PetInstance; import com.l2jserver.gameserver.network.SystemMessageId; -import com.l2jserver.gameserver.network.serverpackets.ExAutoSoulShot; import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.util.Broadcast; @@ -72,7 +71,8 @@ public class BeastSpiritShot implements IItemHandler if (!(shotCount > shotConsumption)) { // Not enough SpiritShots to use. - activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITHOTS_FOR_PET)); + if (!activeOwner.disableAutoShot(itemId)) + activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITHOTS_FOR_PET)); return; } @@ -107,18 +107,8 @@ public class BeastSpiritShot implements IItemHandler if (!activeOwner.destroyItemWithoutTrace("Consume", item.getObjectId(), shotConsumption, null, false)) { - if (activeOwner.getAutoSoulShot().containsKey(itemId)) - { - activeOwner.removeAutoSoulShot(itemId); - activeOwner.sendPacket(new ExAutoSoulShot(itemId, 0)); - - SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED); - sm.addString(item.getItem().getName()); - activeOwner.sendPacket(sm); - return; - } - - activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS)); + if (!activeOwner.disableAutoShot(itemId)) + activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITHOTS_FOR_PET)); return; } diff --git a/datapack_development/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java b/datapack_development/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java index fcc7be2825..7202ef354a 100644 --- a/datapack_development/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java +++ b/datapack_development/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java @@ -19,7 +19,6 @@ import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.model.actor.L2Playable; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; -import com.l2jserver.gameserver.network.serverpackets.ExAutoSoulShot; import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.templates.item.L2Item; @@ -107,16 +106,7 @@ public class BlessedSpiritShot implements IItemHandler // Consume Blessed SpiritShot if player has enough of them if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false)) { - if (activeChar.getAutoSoulShot().containsKey(itemId)) - { - activeChar.removeAutoSoulShot(itemId); - activeChar.sendPacket(new ExAutoSoulShot(itemId, 0)); - - SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED); - sm.addString(item.getItem().getName()); - activeChar.sendPacket(sm); - } - else + if (!activeChar.disableAutoShot(itemId)) activeChar.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS)); return; } diff --git a/datapack_development/data/scripts/handlers/itemhandlers/SoulShots.java b/datapack_development/data/scripts/handlers/itemhandlers/SoulShots.java index ec7f12c6f4..639f8c05db 100644 --- a/datapack_development/data/scripts/handlers/itemhandlers/SoulShots.java +++ b/datapack_development/data/scripts/handlers/itemhandlers/SoulShots.java @@ -19,7 +19,6 @@ import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.model.actor.L2Playable; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; -import com.l2jserver.gameserver.network.serverpackets.ExAutoSoulShot; import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.skills.Stats; @@ -112,16 +111,7 @@ public class SoulShots implements IItemHandler if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), SSCount, null, false)) { - if (activeChar.getAutoSoulShot().containsKey(itemId)) - { - activeChar.removeAutoSoulShot(itemId); - activeChar.sendPacket(new ExAutoSoulShot(itemId, 0)); - - SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED); - sm.addString(item.getItem().getName()); - activeChar.sendPacket(sm); - } - else + if (!activeChar.disableAutoShot(itemId)) activeChar.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SOULSHOTS)); return; } diff --git a/datapack_development/data/scripts/handlers/itemhandlers/SpiritShot.java b/datapack_development/data/scripts/handlers/itemhandlers/SpiritShot.java index 96ff9f223b..2f01f48173 100644 --- a/datapack_development/data/scripts/handlers/itemhandlers/SpiritShot.java +++ b/datapack_development/data/scripts/handlers/itemhandlers/SpiritShot.java @@ -19,7 +19,6 @@ import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.model.actor.L2Playable; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; -import com.l2jserver.gameserver.network.serverpackets.ExAutoSoulShot; import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.templates.item.L2Item; @@ -105,16 +104,7 @@ public class SpiritShot implements IItemHandler // Consume Spirit shot if player has enough of them if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false)) { - if (activeChar.getAutoSoulShot().containsKey(itemId)) - { - activeChar.removeAutoSoulShot(itemId); - activeChar.sendPacket(new ExAutoSoulShot(itemId, 0)); - - SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED); - sm.addString(item.getItem().getName()); - activeChar.sendPacket(sm); - } - else + if (!activeChar.disableAutoShot(itemId)) activeChar.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS)); return; } -- GitLab