Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config/head/other.properties b/config/head/other.properties
- index 4f3e6a7..c672d3c 100644
- --- a/config/head/other.properties
- +++ b/config/head/other.properties
- @@ -239,4 +239,42 @@
- ClickTask = 50
- # Crit announce
- GMShowCritAnnouncerName = False
- +
- +# ----------------------
- +# Augment Custom Items -
- +# ----------------------
- +# Augment weapon with active or passive skill.
- +# True = Enable / False = Disable
- +AugmentCustomItem = True
- +
- +# Augment Active Items:
- +AugmentActiveCheerCustomItemID = 13001
- +AugmentActiveBlessBodyCustomItemID = 13002
- +AugmentActiveBlessSoulCustomItemID = 13003
- +AugmentActiveMightCustomItemID = 13004
- +AugmentActiveEmpowerCustomItemID = 13005
- +AugmentActiveDuelMightCustomItemID = 13006
- +AugmentActiveShieldCustomItemID = 13007
- +AugmentActiveMagicBarrierCustomItemID = 13008
- +AugmentActiveAgilityCustomItemID = 13009
- +AugmentActiveGuidanceCustomItemID = 13010
- +AugmentActiveFocusCustomItemID = 13011
- +AugmentActiveWildMagicCustomItemID = 13012
- +
- +AugmentActiveRecallCustomItemID = 13013
- +AugmentActiveUnlockCustomItemID = 13014
- +AugmentActiveCelestShieldCustomItemID = 13015
- +AugmentActiveHealCustomItemID = 13016
- +
- +# Augment Passive Items:
- +AugmentPassiveMightCustomItemID = 13021
- +AugmentPassiveEmpowerCustomItemID = 13022
- +AugmentPassiveDuelMightCustomItemID = 13023
- +AugmentPassiveShieldCustomItemID = 13024
- +AugmentPassiveMagicBarrierCustomItemID = 13025
- +AugmentPassiveAgilityCustomItemID = 13026
- +AugmentPassiveGuidanceCustomItemID = 13027
- +AugmentPassiveFocusCustomItemID = 13028
- +AugmentPassiveWildMagicCustomItemID = 13029
- +
- diff --git a/head-src/com/l2jfrozen/Config.java b/head-src/com/l2jfrozen/Config.java
- index f06695a..4fb05a5 100644
- --- a/head-src/com/l2jfrozen/Config.java
- +++ b/head-src/com/l2jfrozen/Config.java
- @@ -1835,7 +1835,35 @@
- public static String CHAT_FILTER_CHARS;
- public static String CHAT_FILTER_PUNISHMENT;
- public static ArrayList<String> FILTER_LIST = new ArrayList<>();
- + //AugmentCustomItem
- + public static boolean AUGMENT_CUSTOM_ITEM;
- + public static int AUGMENT_ACTIVE_CHEER_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_BLESS_BODY_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_BLESS_SOUL_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_MIGHT_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_EMPOWER_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_DUEL_MIGHT_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_SHIELD_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_AGILITY_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_GUIDANCE_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_FOCUS_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_WILD_MAGIC_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_RECALL_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_UNLOCK_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_CELEST_SHIELD_CUSTOM_ITEM_ID;
- + public static int AUGMENT_ACTIVE_HEAL_CUSTOM_ITEM_ID;
- +
- + public static int AUGMENT_PASSIVE_MIGHT_CUSTOM_ITEM_ID;
- + public static int AUGMENT_PASSIVE_EMPOWER_CUSTOM_ITEM_ID;
- + public static int AUGMENT_PASSIVE_DUEL_MIGHT_CUSTOM_ITEM_ID;
- + public static int AUGMENT_PASSIVE_SHIELD_CUSTOM_ITEM_ID;
- + public static int AUGMENT_PASSIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID;
- + public static int AUGMENT_PASSIVE_AGILITY_CUSTOM_ITEM_ID;
- + public static int AUGMENT_PASSIVE_GUIDANCE_CUSTOM_ITEM_ID;
- + public static int AUGMENT_PASSIVE_FOCUS_CUSTOM_ITEM_ID;
- + public static int AUGMENT_PASSIVE_WILD_MAGIC_CUSTOM_ITEM_ID;
- public static int FS_TIME_ATTACK;
- public static int FS_TIME_COOLDOWN;
- public static int FS_TIME_ENTRY;
- @@ -1857,7 +1885,33 @@
- final InputStream is = new FileInputStream(new File(OTHER));
- otherSettings.load(is);
- is.close();
- -
- + /**AugmentCustomItem **/
- + AUGMENT_CUSTOM_ITEM = Boolean.parseBoolean(otherSettings.getProperty("AugmentCustomItem", "true"));
- + AUGMENT_ACTIVE_CHEER_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveCheerCustomItemID", "13001"));
- + AUGMENT_ACTIVE_BLESS_BODY_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveBlessBodyCustomItemID", "13002"));
- + AUGMENT_ACTIVE_BLESS_SOUL_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveBlessSoulCustomItemID", "13003"));
- + AUGMENT_ACTIVE_MIGHT_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveMightCustomItemID", "13004"));
- + AUGMENT_ACTIVE_EMPOWER_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveEmpowerCustomItemID", "13005"));
- + AUGMENT_ACTIVE_DUEL_MIGHT_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveDuelMightCustomItemID", "13006"));
- + AUGMENT_ACTIVE_SHIELD_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveShieldCustomItemID", "13007"));
- + AUGMENT_ACTIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveMagicBarrierCustomItemID", "13008"));
- + AUGMENT_ACTIVE_AGILITY_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveAgilityCustomItemID", "13009"));
- + AUGMENT_ACTIVE_GUIDANCE_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveGuidanceCustomItemID", "13010"));
- + AUGMENT_ACTIVE_FOCUS_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveFocusCustomItemID", "13011"));
- + AUGMENT_ACTIVE_WILD_MAGIC_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveWildMagicCustomItemID", "13012"));
- + AUGMENT_ACTIVE_RECALL_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveRecallCustomItemID", "13013"));
- + AUGMENT_ACTIVE_UNLOCK_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveUnlockCustomItemID", "13014"));
- + AUGMENT_ACTIVE_CELEST_SHIELD_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveCelestShieldCustomItemID", "13015"));
- + AUGMENT_ACTIVE_HEAL_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveHealCustomItemID", "13016"));
- + AUGMENT_PASSIVE_MIGHT_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveMightCustomItemID", "13021"));
- + AUGMENT_PASSIVE_EMPOWER_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveEmpowerCustomItemID", "13022"));
- + AUGMENT_PASSIVE_DUEL_MIGHT_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveDuelMightCustomItemID", "13023"));
- + AUGMENT_PASSIVE_SHIELD_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveShieldCustomItemID", "13024"));
- + AUGMENT_PASSIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveMagicBarrierCustomItemID", "13025"));
- + AUGMENT_PASSIVE_AGILITY_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveAgilityCustomItemID", "13026"));
- + AUGMENT_PASSIVE_GUIDANCE_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveGuidanceCustomItemID", "13027"));
- + AUGMENT_PASSIVE_FOCUS_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveFocusCustomItemID", "13028"));
- + AUGMENT_PASSIVE_WILD_MAGIC_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveWildMagicCustomItemID", "13029"));
- DEEPBLUE_DROP_RULES = Boolean.parseBoolean(otherSettings.getProperty("UseDeepBlueDropRules", "True"));
- ALLOW_GUARDS = Boolean.valueOf(otherSettings.getProperty("AllowGuards", "False"));
- EFFECT_CANCELING = Boolean.valueOf(otherSettings.getProperty("CancelLesserEffect", "True"));
- diff --git a/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java b/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
- index 8d90e65..978443e 100644
- --- a/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
- +++ b/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
- @@ -25,8 +25,11 @@
- import org.apache.log4j.Logger;
- +import com.l2jfrozen.Config;
- import com.l2jfrozen.gameserver.GameServer;
- import com.l2jfrozen.gameserver.handler.itemhandlers.AioItem;
- +import com.l2jfrozen.gameserver.handler.itemhandlers.AugmentActiveCustomItem;
- +import com.l2jfrozen.gameserver.handler.itemhandlers.AugmentPassiveCustomItem;
- import com.l2jfrozen.gameserver.handler.itemhandlers.BeastSoulShot;
- import com.l2jfrozen.gameserver.handler.itemhandlers.BeastSpice;
- import com.l2jfrozen.gameserver.handler.itemhandlers.BeastSpiritShot;
- @@ -138,6 +141,16 @@
- private ItemHandler()
- {
- _datatable = new TreeMap<>();
- + if(Config.AUGMENT_CUSTOM_ITEM)
- + {
- + registerItemHandler(new AugmentActiveCustomItem());
- + registerItemHandler(new AugmentPassiveCustomItem());
- + LOGGER.info("ItemHandler: AugmentCustomItem is Enable.");
- + }
- + else
- + {
- + LOGGER.info("ItemHandler: AugmentCustomItem is Disable.");
- + }
- registerItemHandler(new NewbieRenewal());
- registerItemHandler(new CleanPk());
- registerItemHandler(new Skin1());
- diff --git a/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentActiveCustomItem.java b/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentActiveCustomItem.java
- new file mode 100644
- index 0000000..62e2881
- --- /dev/null
- +++ b/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentActiveCustomItem.java
- @@ -0,0 +1,233 @@
- +package com.l2jfrozen.gameserver.handler.itemhandlers;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +
- +import org.apache.log4j.Logger;
- +
- +import com.l2jfrozen.Config;
- +import com.l2jfrozen.gameserver.handler.IItemHandler;
- +import com.l2jfrozen.gameserver.model.Inventory;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
- +import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
- +import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage;
- +import com.l2jfrozen.gameserver.network.serverpackets.SocialAction;
- +import com.l2jfrozen.util.CloseUtil;
- +import com.l2jfrozen.util.database.L2DatabaseFactory;
- +
- +/**
- + * @author Gabriel Fleck
- + */
- +public class AugmentActiveCustomItem implements IItemHandler
- +{
- + private static final Logger LOGGER = Logger.getLogger(AugmentActiveCustomItem.class);
- + private static final int ITEM_IDS[] =
- + {
- + Config.AUGMENT_ACTIVE_CHEER_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_BLESS_BODY_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_BLESS_SOUL_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_MIGHT_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_EMPOWER_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_DUEL_MIGHT_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_SHIELD_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_AGILITY_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_GUIDANCE_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_FOCUS_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_WILD_MAGIC_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_RECALL_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_UNLOCK_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_CELEST_SHIELD_CUSTOM_ITEM_ID,
- + Config.AUGMENT_ACTIVE_HEAL_CUSTOM_ITEM_ID
- + };
- +
- + @Override
- + public void useItem(L2PlayableInstance playable, L2ItemInstance item)
- + {
- + if (!(playable instanceof L2PcInstance))
- + return;
- +
- + final int itemId = item.getItemId();
- + L2PcInstance activeChar = (L2PcInstance) playable;
- +
- + if (activeChar.isInCombat() && activeChar.isInDuel())
- + {
- + activeChar.sendMessage("This item cannot be used in combat or duel mode.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.isRegisteredInCTFEvent() && activeChar.isRegisteredInDMEvent()
- + && activeChar.isRegisteredInFunEvent() && activeChar.isRegisteredInTVTEvent()
- + && activeChar.isInFunEvent() && activeChar.isInOlympiadMode() && activeChar.isinTownWar())
- + {
- + activeChar.sendMessage("This item cannot be used in Events.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.isRunning() && activeChar.isSitting() && activeChar.isFlying())
- + {
- + activeChar.sendMessage("This item cannot be used while running, sitting or flying.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.isCastingNow() && activeChar.isAway()
- + && activeChar.isConfused() && activeChar.isStunned()
- + && activeChar.isDead() && activeChar.isAlikeDead())
- + {
- + activeChar.sendMessage("This item cannot be used at this time.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null)
- + {
- + activeChar.sendMessage("You have to equip a weapon.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isAugmented())
- + {
- + activeChar.sendMessage("The weapon is already augmented, change it.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isHeroItem())
- + {
- + activeChar.sendMessage("This weapon is hero, change it.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isShadowItem())
- + {
- + activeChar.sendMessage("This weapon is Shadow, change it.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isCupidBow())
- + {
- + activeChar.sendMessage("This weapon is Cupid Bow, change it.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- +
- + if (itemId == Config.AUGMENT_ACTIVE_CHEER_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16197,3131,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_CHEER_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_BLESS_BODY_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16199,3124,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_BLESS_BODY_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_BLESS_SOUL_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16200,3128,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_BLESS_SOUL_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_MIGHT_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16206,3132,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_MIGHT_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_EMPOWER_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16196,3133,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_EMPOWER_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_DUEL_MIGHT_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16211,3134,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_DUEL_MIGHT_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_SHIELD_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16208,3135,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_SHIELD_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16201,3136,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_AGILITY_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16181,3139,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_AGILITY_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_GUIDANCE_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16190,3140,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_GUIDANCE_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_FOCUS_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16289,3241,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_FOCUS_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_WILD_MAGIC_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16294,3142,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_WILD_MAGIC_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_RECALL_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16292,3147,1);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_RECALL_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_UNLOCK_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16234,3155,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_UNLOCK_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_CELEST_SHIELD_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16293,3158,1);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_CELEST_SHIELD_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_ACTIVE_HEAL_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16195,3123,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_HEAL_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- +
- + }
- +
- + private static void Augment(L2PcInstance player, int attributes, int skill, int level)
- + {
- + L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
- + Connection con = null;
- + try
- + {
- + con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("REPLACE INTO augmentations VALUES(?,?,?,?)");
- + statement.setInt(1, item.getObjectId());
- + statement.setInt(2, attributes*65536+1);
- + statement.setInt(3, skill);
- + statement.setInt(4, level);
- + statement.executeUpdate();
- + player.sendMessage("Succesfully augmented. You have to relog now.");
- + player.sendPacket(new ExShowScreenMessage("Succesfully augmented. You have to relog now.", 10000));
- + player.broadcastPacket(new SocialAction(player.getObjectId(), 16));
- + statement.close();
- + }
- + catch (final Exception e)
- + {
- + if (Config.ENABLE_ALL_EXCEPTIONS)
- + e.printStackTrace();
- +
- + LOGGER.info("Could not augment item: "+item.getObjectId()+" ", e);
- + }
- + finally
- + {
- + CloseUtil.close(con);
- + }
- + }
- +
- + @Override
- + public int[] getItemIds()
- + {
- + return ITEM_IDS;
- + }
- +}
- \ No newline at end of file
- diff --git a/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentPassiveCustomItem.java b/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentPassiveCustomItem.java
- new file mode 100644
- index 0000000..7ae939c
- --- /dev/null
- +++ b/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentPassiveCustomItem.java
- @@ -0,0 +1,191 @@
- +package com.l2jfrozen.gameserver.handler.itemhandlers;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +
- +import org.apache.log4j.Logger;
- +
- +import com.l2jfrozen.Config;
- +import com.l2jfrozen.gameserver.handler.IItemHandler;
- +import com.l2jfrozen.gameserver.model.Inventory;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
- +import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
- +import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage;
- +import com.l2jfrozen.gameserver.network.serverpackets.SocialAction;
- +import com.l2jfrozen.util.CloseUtil;
- +import com.l2jfrozen.util.database.L2DatabaseFactory;
- +
- +/**
- + * @author Gabriel Fleck
- + */
- +public class AugmentPassiveCustomItem implements IItemHandler
- +{
- + private static final Logger LOGGER = Logger.getLogger(AugmentPassiveCustomItem.class);
- + private static final int ITEM_IDS[] =
- + {
- + Config.AUGMENT_PASSIVE_MIGHT_CUSTOM_ITEM_ID,
- + Config.AUGMENT_PASSIVE_EMPOWER_CUSTOM_ITEM_ID,
- + Config.AUGMENT_PASSIVE_DUEL_MIGHT_CUSTOM_ITEM_ID,
- + Config.AUGMENT_PASSIVE_SHIELD_CUSTOM_ITEM_ID,
- + Config.AUGMENT_PASSIVE_AGILITY_CUSTOM_ITEM_ID,
- + Config.AUGMENT_PASSIVE_GUIDANCE_CUSTOM_ITEM_ID,
- + Config.AUGMENT_PASSIVE_FOCUS_CUSTOM_ITEM_ID,
- + Config.AUGMENT_PASSIVE_WILD_MAGIC_CUSTOM_ITEM_ID
- + };
- +
- + @Override
- + public void useItem(L2PlayableInstance playable, L2ItemInstance item)
- + {
- + if (!(playable instanceof L2PcInstance))
- + return;
- +
- + final int itemId = item.getItemId();
- + L2PcInstance activeChar = (L2PcInstance) playable;
- +
- + if (activeChar.isInCombat() && activeChar.isInDuel())
- + {
- + activeChar.sendMessage("This item cannot be used in combat or duel mode.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.isRegisteredInCTFEvent() && activeChar.isRegisteredInDMEvent()
- + && activeChar.isRegisteredInFunEvent() && activeChar.isRegisteredInTVTEvent()
- + && activeChar.isInFunEvent() && activeChar.isInOlympiadMode() && activeChar.isinTownWar())
- + {
- + activeChar.sendMessage("This item cannot be used in Events.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.isRunning() && activeChar.isSitting() && activeChar.isFlying())
- + {
- + activeChar.sendMessage("This item cannot be used while running, sitting or flying.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.isCastingNow() && activeChar.isAway()
- + && activeChar.isConfused() && activeChar.isStunned()
- + && activeChar.isDead() && activeChar.isAlikeDead())
- + {
- + activeChar.sendMessage("This item cannot be used at this time.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null)
- + {
- + activeChar.sendMessage("You have to equip a weapon.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isAugmented())
- + {
- + activeChar.sendMessage("The weapon is already augmented, change it.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isHeroItem())
- + {
- + activeChar.sendMessage("This weapon is hero, change it.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isShadowItem())
- + {
- + activeChar.sendMessage("This weapon is Shadow, change it.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isCupidBow())
- + {
- + activeChar.sendMessage("This weapon is Cupid Bow, change it.");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- +
- + if (itemId == Config.AUGMENT_PASSIVE_MIGHT_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16283,3240,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_MIGHT_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_PASSIVE_EMPOWER_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16281,3241,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_EMPOWER_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_PASSIVE_DUEL_MIGHT_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16285,3243,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_DUEL_MIGHT_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_PASSIVE_SHIELD_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16284,3244,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_SHIELD_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_PASSIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16282,3245,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_PASSIVE_AGILITY_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16332,3247,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_AGILITY_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_PASSIVE_GUIDANCE_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16335,3248,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_GUIDANCE_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_PASSIVE_FOCUS_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16333,3249,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_FOCUS_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- + else if (itemId == Config.AUGMENT_PASSIVE_WILD_MAGIC_CUSTOM_ITEM_ID)
- + {
- + Augment(activeChar,16336,3250,10);
- + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_WILD_MAGIC_CUSTOM_ITEM_ID, 1, activeChar, true);
- + }
- +
- + }
- +
- + private static void Augment(L2PcInstance player, int attributes, int skill, int level)
- + {
- + L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
- + Connection con = null;
- + try
- + {
- + con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("REPLACE INTO augmentations VALUES(?,?,?,?)");
- + statement.setInt(1, item.getObjectId());
- + statement.setInt(2, attributes*65536+1);
- + statement.setInt(3, skill);
- + statement.setInt(4, level);
- + statement.executeUpdate();
- + player.sendMessage("Succesfully augmented. You have to relog now.");
- + player.sendPacket(new ExShowScreenMessage("Succesfully augmented. You have to relog now.", 10000));
- + player.broadcastPacket(new SocialAction(player.getObjectId(), 16));
- + statement.close();
- + }
- + catch (final Exception e)
- + {
- + if (Config.ENABLE_ALL_EXCEPTIONS)
- + e.printStackTrace();
- +
- + LOGGER.info("Could not augment item: "+item.getObjectId()+" ", e);
- + }
- + finally
- + {
- + CloseUtil.close(con);
- + }
- + }
- +
- + @Override
- + public int[] getItemIds()
- + {
- + return ITEM_IDS;
- + }
- +}
- \ No newline at end of file
Add Comment
Please, Sign In to add comment