SHOW:
|
|
- or go back to the newest paste.
| 1 | diff --git a/config/head/other.properties b/config/head/other.properties | |
| 2 | index 4f3e6a7..c672d3c 100644 | |
| 3 | --- a/config/head/other.properties | |
| 4 | +++ b/config/head/other.properties | |
| 5 | @@ -239,4 +239,42 @@ | |
| 6 | ClickTask = 50 | |
| 7 | ||
| 8 | # Crit announce | |
| 9 | GMShowCritAnnouncerName = False | |
| 10 | ||
| 11 | + | |
| 12 | +# ---------------------- | |
| 13 | +# Augment Custom Items - | |
| 14 | +# ---------------------- | |
| 15 | +# Augment weapon with active or passive skill. | |
| 16 | +# True = Enable / False = Disable | |
| 17 | +AugmentCustomItem = True | |
| 18 | + | |
| 19 | +# Augment Active Items: | |
| 20 | +AugmentActiveCheerCustomItemID = 13001 | |
| 21 | +AugmentActiveBlessBodyCustomItemID = 13002 | |
| 22 | +AugmentActiveBlessSoulCustomItemID = 13003 | |
| 23 | +AugmentActiveMightCustomItemID = 13004 | |
| 24 | +AugmentActiveEmpowerCustomItemID = 13005 | |
| 25 | +AugmentActiveDuelMightCustomItemID = 13006 | |
| 26 | +AugmentActiveShieldCustomItemID = 13007 | |
| 27 | +AugmentActiveMagicBarrierCustomItemID = 13008 | |
| 28 | +AugmentActiveAgilityCustomItemID = 13009 | |
| 29 | +AugmentActiveGuidanceCustomItemID = 13010 | |
| 30 | +AugmentActiveFocusCustomItemID = 13011 | |
| 31 | +AugmentActiveWildMagicCustomItemID = 13012 | |
| 32 | + | |
| 33 | +AugmentActiveRecallCustomItemID = 13013 | |
| 34 | +AugmentActiveUnlockCustomItemID = 13014 | |
| 35 | +AugmentActiveCelestShieldCustomItemID = 13015 | |
| 36 | +AugmentActiveHealCustomItemID = 13016 | |
| 37 | + | |
| 38 | +# Augment Passive Items: | |
| 39 | +AugmentPassiveMightCustomItemID = 13021 | |
| 40 | +AugmentPassiveEmpowerCustomItemID = 13022 | |
| 41 | +AugmentPassiveDuelMightCustomItemID = 13023 | |
| 42 | +AugmentPassiveShieldCustomItemID = 13024 | |
| 43 | +AugmentPassiveMagicBarrierCustomItemID = 13025 | |
| 44 | +AugmentPassiveAgilityCustomItemID = 13026 | |
| 45 | +AugmentPassiveGuidanceCustomItemID = 13027 | |
| 46 | +AugmentPassiveFocusCustomItemID = 13028 | |
| 47 | +AugmentPassiveWildMagicCustomItemID = 13029 | |
| 48 | + | |
| 49 | diff --git a/head-src/com/l2jfrozen/Config.java b/head-src/com/l2jfrozen/Config.java | |
| 50 | index f06695a..4fb05a5 100644 | |
| 51 | --- a/head-src/com/l2jfrozen/Config.java | |
| 52 | +++ b/head-src/com/l2jfrozen/Config.java | |
| 53 | @@ -1835,7 +1835,35 @@ | |
| 54 | public static String CHAT_FILTER_CHARS; | |
| 55 | public static String CHAT_FILTER_PUNISHMENT; | |
| 56 | public static ArrayList<String> FILTER_LIST = new ArrayList<>(); | |
| 57 | + //AugmentCustomItem | |
| 58 | + public static boolean AUGMENT_CUSTOM_ITEM; | |
| 59 | + public static int AUGMENT_ACTIVE_CHEER_CUSTOM_ITEM_ID; | |
| 60 | + public static int AUGMENT_ACTIVE_BLESS_BODY_CUSTOM_ITEM_ID; | |
| 61 | + public static int AUGMENT_ACTIVE_BLESS_SOUL_CUSTOM_ITEM_ID; | |
| 62 | + public static int AUGMENT_ACTIVE_MIGHT_CUSTOM_ITEM_ID; | |
| 63 | + public static int AUGMENT_ACTIVE_EMPOWER_CUSTOM_ITEM_ID; | |
| 64 | + public static int AUGMENT_ACTIVE_DUEL_MIGHT_CUSTOM_ITEM_ID; | |
| 65 | + public static int AUGMENT_ACTIVE_SHIELD_CUSTOM_ITEM_ID; | |
| 66 | + public static int AUGMENT_ACTIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID; | |
| 67 | + public static int AUGMENT_ACTIVE_AGILITY_CUSTOM_ITEM_ID; | |
| 68 | + public static int AUGMENT_ACTIVE_GUIDANCE_CUSTOM_ITEM_ID; | |
| 69 | + public static int AUGMENT_ACTIVE_FOCUS_CUSTOM_ITEM_ID; | |
| 70 | + public static int AUGMENT_ACTIVE_WILD_MAGIC_CUSTOM_ITEM_ID; | |
| 71 | ||
| 72 | + public static int AUGMENT_ACTIVE_RECALL_CUSTOM_ITEM_ID; | |
| 73 | + public static int AUGMENT_ACTIVE_UNLOCK_CUSTOM_ITEM_ID; | |
| 74 | + public static int AUGMENT_ACTIVE_CELEST_SHIELD_CUSTOM_ITEM_ID; | |
| 75 | + public static int AUGMENT_ACTIVE_HEAL_CUSTOM_ITEM_ID; | |
| 76 | + | |
| 77 | + public static int AUGMENT_PASSIVE_MIGHT_CUSTOM_ITEM_ID; | |
| 78 | + public static int AUGMENT_PASSIVE_EMPOWER_CUSTOM_ITEM_ID; | |
| 79 | + public static int AUGMENT_PASSIVE_DUEL_MIGHT_CUSTOM_ITEM_ID; | |
| 80 | + public static int AUGMENT_PASSIVE_SHIELD_CUSTOM_ITEM_ID; | |
| 81 | + public static int AUGMENT_PASSIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID; | |
| 82 | + public static int AUGMENT_PASSIVE_AGILITY_CUSTOM_ITEM_ID; | |
| 83 | + public static int AUGMENT_PASSIVE_GUIDANCE_CUSTOM_ITEM_ID; | |
| 84 | + public static int AUGMENT_PASSIVE_FOCUS_CUSTOM_ITEM_ID; | |
| 85 | + public static int AUGMENT_PASSIVE_WILD_MAGIC_CUSTOM_ITEM_ID; | |
| 86 | public static int FS_TIME_ATTACK; | |
| 87 | public static int FS_TIME_COOLDOWN; | |
| 88 | public static int FS_TIME_ENTRY; | |
| 89 | @@ -1857,7 +1885,33 @@ | |
| 90 | final InputStream is = new FileInputStream(new File(OTHER)); | |
| 91 | otherSettings.load(is); | |
| 92 | is.close(); | |
| 93 | - | |
| 94 | + /**AugmentCustomItem **/ | |
| 95 | + AUGMENT_CUSTOM_ITEM = Boolean.parseBoolean(otherSettings.getProperty("AugmentCustomItem", "true"));
| |
| 96 | + AUGMENT_ACTIVE_CHEER_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveCheerCustomItemID", "13001"));
| |
| 97 | + AUGMENT_ACTIVE_BLESS_BODY_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveBlessBodyCustomItemID", "13002"));
| |
| 98 | + AUGMENT_ACTIVE_BLESS_SOUL_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveBlessSoulCustomItemID", "13003"));
| |
| 99 | + AUGMENT_ACTIVE_MIGHT_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveMightCustomItemID", "13004"));
| |
| 100 | + AUGMENT_ACTIVE_EMPOWER_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveEmpowerCustomItemID", "13005"));
| |
| 101 | + AUGMENT_ACTIVE_DUEL_MIGHT_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveDuelMightCustomItemID", "13006"));
| |
| 102 | + AUGMENT_ACTIVE_SHIELD_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveShieldCustomItemID", "13007"));
| |
| 103 | + AUGMENT_ACTIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveMagicBarrierCustomItemID", "13008"));
| |
| 104 | + AUGMENT_ACTIVE_AGILITY_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveAgilityCustomItemID", "13009"));
| |
| 105 | + AUGMENT_ACTIVE_GUIDANCE_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveGuidanceCustomItemID", "13010"));
| |
| 106 | + AUGMENT_ACTIVE_FOCUS_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveFocusCustomItemID", "13011"));
| |
| 107 | + AUGMENT_ACTIVE_WILD_MAGIC_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveWildMagicCustomItemID", "13012"));
| |
| 108 | + AUGMENT_ACTIVE_RECALL_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveRecallCustomItemID", "13013"));
| |
| 109 | + AUGMENT_ACTIVE_UNLOCK_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveUnlockCustomItemID", "13014"));
| |
| 110 | + AUGMENT_ACTIVE_CELEST_SHIELD_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveCelestShieldCustomItemID", "13015"));
| |
| 111 | + AUGMENT_ACTIVE_HEAL_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentActiveHealCustomItemID", "13016"));
| |
| 112 | + AUGMENT_PASSIVE_MIGHT_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveMightCustomItemID", "13021"));
| |
| 113 | + AUGMENT_PASSIVE_EMPOWER_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveEmpowerCustomItemID", "13022"));
| |
| 114 | + AUGMENT_PASSIVE_DUEL_MIGHT_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveDuelMightCustomItemID", "13023"));
| |
| 115 | + AUGMENT_PASSIVE_SHIELD_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveShieldCustomItemID", "13024"));
| |
| 116 | + AUGMENT_PASSIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveMagicBarrierCustomItemID", "13025"));
| |
| 117 | + AUGMENT_PASSIVE_AGILITY_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveAgilityCustomItemID", "13026"));
| |
| 118 | + AUGMENT_PASSIVE_GUIDANCE_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveGuidanceCustomItemID", "13027"));
| |
| 119 | + AUGMENT_PASSIVE_FOCUS_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveFocusCustomItemID", "13028"));
| |
| 120 | + AUGMENT_PASSIVE_WILD_MAGIC_CUSTOM_ITEM_ID = Integer.parseInt(otherSettings.getProperty("AugmentPassiveWildMagicCustomItemID", "13029"));
| |
| 121 | DEEPBLUE_DROP_RULES = Boolean.parseBoolean(otherSettings.getProperty("UseDeepBlueDropRules", "True"));
| |
| 122 | ALLOW_GUARDS = Boolean.valueOf(otherSettings.getProperty("AllowGuards", "False"));
| |
| 123 | EFFECT_CANCELING = Boolean.valueOf(otherSettings.getProperty("CancelLesserEffect", "True"));
| |
| 124 | diff --git a/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java b/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java | |
| 125 | index 8d90e65..978443e 100644 | |
| 126 | --- a/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java | |
| 127 | +++ b/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java | |
| 128 | @@ -25,8 +25,11 @@ | |
| 129 | ||
| 130 | import org.apache.log4j.Logger; | |
| 131 | ||
| 132 | +import com.l2jfrozen.Config; | |
| 133 | import com.l2jfrozen.gameserver.GameServer; | |
| 134 | import com.l2jfrozen.gameserver.handler.itemhandlers.AioItem; | |
| 135 | +import com.l2jfrozen.gameserver.handler.itemhandlers.AugmentActiveCustomItem; | |
| 136 | +import com.l2jfrozen.gameserver.handler.itemhandlers.AugmentPassiveCustomItem; | |
| 137 | import com.l2jfrozen.gameserver.handler.itemhandlers.BeastSoulShot; | |
| 138 | import com.l2jfrozen.gameserver.handler.itemhandlers.BeastSpice; | |
| 139 | import com.l2jfrozen.gameserver.handler.itemhandlers.BeastSpiritShot; | |
| 140 | @@ -138,6 +141,16 @@ | |
| 141 | private ItemHandler() | |
| 142 | {
| |
| 143 | _datatable = new TreeMap<>(); | |
| 144 | + if(Config.AUGMENT_CUSTOM_ITEM) | |
| 145 | + {
| |
| 146 | + registerItemHandler(new AugmentActiveCustomItem()); | |
| 147 | + registerItemHandler(new AugmentPassiveCustomItem()); | |
| 148 | + LOGGER.info("ItemHandler: AugmentCustomItem is Enable.");
| |
| 149 | + } | |
| 150 | + else | |
| 151 | + {
| |
| 152 | + LOGGER.info("ItemHandler: AugmentCustomItem is Disable.");
| |
| 153 | + } | |
| 154 | registerItemHandler(new NewbieRenewal()); | |
| 155 | registerItemHandler(new CleanPk()); | |
| 156 | registerItemHandler(new Skin1()); | |
| 157 | diff --git a/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentActiveCustomItem.java b/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentActiveCustomItem.java | |
| 158 | new file mode 100644 | |
| 159 | index 0000000..62e2881 | |
| 160 | --- /dev/null | |
| 161 | +++ b/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentActiveCustomItem.java | |
| 162 | @@ -0,0 +1,233 @@ | |
| 163 | +package com.l2jfrozen.gameserver.handler.itemhandlers; | |
| 164 | + | |
| 165 | +import java.sql.Connection; | |
| 166 | +import java.sql.PreparedStatement; | |
| 167 | + | |
| 168 | +import org.apache.log4j.Logger; | |
| 169 | + | |
| 170 | +import com.l2jfrozen.Config; | |
| 171 | +import com.l2jfrozen.gameserver.handler.IItemHandler; | |
| 172 | +import com.l2jfrozen.gameserver.model.Inventory; | |
| 173 | +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance; | |
| 174 | +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; | |
| 175 | +import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance; | |
| 176 | +import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed; | |
| 177 | +import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage; | |
| 178 | +import com.l2jfrozen.gameserver.network.serverpackets.SocialAction; | |
| 179 | +import com.l2jfrozen.util.CloseUtil; | |
| 180 | +import com.l2jfrozen.util.database.L2DatabaseFactory; | |
| 181 | + | |
| 182 | +/** | |
| 183 | + * @author Gabriel Fleck | |
| 184 | + */ | |
| 185 | +public class AugmentActiveCustomItem implements IItemHandler | |
| 186 | +{
| |
| 187 | + private static final Logger LOGGER = Logger.getLogger(AugmentActiveCustomItem.class); | |
| 188 | + private static final int ITEM_IDS[] = | |
| 189 | + {
| |
| 190 | + Config.AUGMENT_ACTIVE_CHEER_CUSTOM_ITEM_ID, | |
| 191 | + Config.AUGMENT_ACTIVE_BLESS_BODY_CUSTOM_ITEM_ID, | |
| 192 | + Config.AUGMENT_ACTIVE_BLESS_SOUL_CUSTOM_ITEM_ID, | |
| 193 | + Config.AUGMENT_ACTIVE_MIGHT_CUSTOM_ITEM_ID, | |
| 194 | + Config.AUGMENT_ACTIVE_EMPOWER_CUSTOM_ITEM_ID, | |
| 195 | + Config.AUGMENT_ACTIVE_DUEL_MIGHT_CUSTOM_ITEM_ID, | |
| 196 | + Config.AUGMENT_ACTIVE_SHIELD_CUSTOM_ITEM_ID, | |
| 197 | + Config.AUGMENT_ACTIVE_AGILITY_CUSTOM_ITEM_ID, | |
| 198 | + Config.AUGMENT_ACTIVE_GUIDANCE_CUSTOM_ITEM_ID, | |
| 199 | + Config.AUGMENT_ACTIVE_FOCUS_CUSTOM_ITEM_ID, | |
| 200 | + Config.AUGMENT_ACTIVE_WILD_MAGIC_CUSTOM_ITEM_ID, | |
| 201 | + Config.AUGMENT_ACTIVE_RECALL_CUSTOM_ITEM_ID, | |
| 202 | + Config.AUGMENT_ACTIVE_UNLOCK_CUSTOM_ITEM_ID, | |
| 203 | + Config.AUGMENT_ACTIVE_CELEST_SHIELD_CUSTOM_ITEM_ID, | |
| 204 | + Config.AUGMENT_ACTIVE_HEAL_CUSTOM_ITEM_ID | |
| 205 | + }; | |
| 206 | + | |
| 207 | + @Override | |
| 208 | + public void useItem(L2PlayableInstance playable, L2ItemInstance item) | |
| 209 | + {
| |
| 210 | + if (!(playable instanceof L2PcInstance)) | |
| 211 | + return; | |
| 212 | + | |
| 213 | + final int itemId = item.getItemId(); | |
| 214 | + L2PcInstance activeChar = (L2PcInstance) playable; | |
| 215 | + | |
| 216 | + if (activeChar.isInCombat() && activeChar.isInDuel()) | |
| 217 | + {
| |
| 218 | + activeChar.sendMessage("This item cannot be used in combat or duel mode.");
| |
| 219 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 220 | + return; | |
| 221 | + } | |
| 222 | + if (activeChar.isRegisteredInCTFEvent() && activeChar.isRegisteredInDMEvent() | |
| 223 | + && activeChar.isRegisteredInFunEvent() && activeChar.isRegisteredInTVTEvent() | |
| 224 | + && activeChar.isInFunEvent() && activeChar.isInOlympiadMode() && activeChar.isinTownWar()) | |
| 225 | + {
| |
| 226 | + activeChar.sendMessage("This item cannot be used in Events.");
| |
| 227 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 228 | + return; | |
| 229 | + } | |
| 230 | + if (activeChar.isRunning() && activeChar.isSitting() && activeChar.isFlying()) | |
| 231 | + {
| |
| 232 | + activeChar.sendMessage("This item cannot be used while running, sitting or flying.");
| |
| 233 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 234 | + return; | |
| 235 | + } | |
| 236 | + if (activeChar.isCastingNow() && activeChar.isAway() | |
| 237 | + && activeChar.isConfused() && activeChar.isStunned() | |
| 238 | + && activeChar.isDead() && activeChar.isAlikeDead()) | |
| 239 | + {
| |
| 240 | + activeChar.sendMessage("This item cannot be used at this time.");
| |
| 241 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 242 | + return; | |
| 243 | + } | |
| 244 | + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null) | |
| 245 | + {
| |
| 246 | + activeChar.sendMessage("You have to equip a weapon.");
| |
| 247 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 248 | + return; | |
| 249 | + } | |
| 250 | + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isAugmented()) | |
| 251 | + {
| |
| 252 | + activeChar.sendMessage("The weapon is already augmented, change it.");
| |
| 253 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 254 | + return; | |
| 255 | + } | |
| 256 | + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isHeroItem()) | |
| 257 | + {
| |
| 258 | + activeChar.sendMessage("This weapon is hero, change it.");
| |
| 259 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 260 | + return; | |
| 261 | + } | |
| 262 | + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isShadowItem()) | |
| 263 | + {
| |
| 264 | + activeChar.sendMessage("This weapon is Shadow, change it.");
| |
| 265 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 266 | + return; | |
| 267 | + } | |
| 268 | + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isCupidBow()) | |
| 269 | + {
| |
| 270 | + activeChar.sendMessage("This weapon is Cupid Bow, change it.");
| |
| 271 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 272 | + return; | |
| 273 | + } | |
| 274 | + | |
| 275 | + | |
| 276 | + if (itemId == Config.AUGMENT_ACTIVE_CHEER_CUSTOM_ITEM_ID) | |
| 277 | + {
| |
| 278 | + Augment(activeChar,16197,3131,10); | |
| 279 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_CHEER_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 280 | + } | |
| 281 | + else if (itemId == Config.AUGMENT_ACTIVE_BLESS_BODY_CUSTOM_ITEM_ID) | |
| 282 | + {
| |
| 283 | + Augment(activeChar,16199,3124,10); | |
| 284 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_BLESS_BODY_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 285 | + } | |
| 286 | + else if (itemId == Config.AUGMENT_ACTIVE_BLESS_SOUL_CUSTOM_ITEM_ID) | |
| 287 | + {
| |
| 288 | + Augment(activeChar,16200,3128,10); | |
| 289 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_BLESS_SOUL_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 290 | + } | |
| 291 | + else if (itemId == Config.AUGMENT_ACTIVE_MIGHT_CUSTOM_ITEM_ID) | |
| 292 | + {
| |
| 293 | + Augment(activeChar,16206,3132,10); | |
| 294 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_MIGHT_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 295 | + } | |
| 296 | + else if (itemId == Config.AUGMENT_ACTIVE_EMPOWER_CUSTOM_ITEM_ID) | |
| 297 | + {
| |
| 298 | + Augment(activeChar,16196,3133,10); | |
| 299 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_EMPOWER_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 300 | + } | |
| 301 | + else if (itemId == Config.AUGMENT_ACTIVE_DUEL_MIGHT_CUSTOM_ITEM_ID) | |
| 302 | + {
| |
| 303 | + Augment(activeChar,16211,3134,10); | |
| 304 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_DUEL_MIGHT_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 305 | + } | |
| 306 | + else if (itemId == Config.AUGMENT_ACTIVE_SHIELD_CUSTOM_ITEM_ID) | |
| 307 | + {
| |
| 308 | + Augment(activeChar,16208,3135,10); | |
| 309 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_SHIELD_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 310 | + } | |
| 311 | + else if (itemId == Config.AUGMENT_ACTIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID) | |
| 312 | + {
| |
| 313 | + Augment(activeChar,16201,3136,10); | |
| 314 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 315 | + } | |
| 316 | + else if (itemId == Config.AUGMENT_ACTIVE_AGILITY_CUSTOM_ITEM_ID) | |
| 317 | + {
| |
| 318 | + Augment(activeChar,16181,3139,10); | |
| 319 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_AGILITY_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 320 | + } | |
| 321 | + else if (itemId == Config.AUGMENT_ACTIVE_GUIDANCE_CUSTOM_ITEM_ID) | |
| 322 | + {
| |
| 323 | + Augment(activeChar,16190,3140,10); | |
| 324 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_GUIDANCE_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 325 | + } | |
| 326 | + else if (itemId == Config.AUGMENT_ACTIVE_FOCUS_CUSTOM_ITEM_ID) | |
| 327 | + {
| |
| 328 | + Augment(activeChar,16289,3241,10); | |
| 329 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_FOCUS_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 330 | + } | |
| 331 | + else if (itemId == Config.AUGMENT_ACTIVE_WILD_MAGIC_CUSTOM_ITEM_ID) | |
| 332 | + {
| |
| 333 | + Augment(activeChar,16294,3142,10); | |
| 334 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_WILD_MAGIC_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 335 | + } | |
| 336 | + else if (itemId == Config.AUGMENT_ACTIVE_RECALL_CUSTOM_ITEM_ID) | |
| 337 | + {
| |
| 338 | + Augment(activeChar,16292,3147,1); | |
| 339 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_RECALL_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 340 | + } | |
| 341 | + else if (itemId == Config.AUGMENT_ACTIVE_UNLOCK_CUSTOM_ITEM_ID) | |
| 342 | + {
| |
| 343 | + Augment(activeChar,16234,3155,10); | |
| 344 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_UNLOCK_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 345 | + } | |
| 346 | + else if (itemId == Config.AUGMENT_ACTIVE_CELEST_SHIELD_CUSTOM_ITEM_ID) | |
| 347 | + {
| |
| 348 | + Augment(activeChar,16293,3158,1); | |
| 349 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_CELEST_SHIELD_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 350 | + } | |
| 351 | + else if (itemId == Config.AUGMENT_ACTIVE_HEAL_CUSTOM_ITEM_ID) | |
| 352 | + {
| |
| 353 | + Augment(activeChar,16195,3123,10); | |
| 354 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_ACTIVE_HEAL_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 355 | + } | |
| 356 | + | |
| 357 | + } | |
| 358 | + | |
| 359 | + private static void Augment(L2PcInstance player, int attributes, int skill, int level) | |
| 360 | + {
| |
| 361 | + L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND); | |
| 362 | + Connection con = null; | |
| 363 | + try | |
| 364 | + {
| |
| 365 | + con = L2DatabaseFactory.getInstance().getConnection(); | |
| 366 | + PreparedStatement statement = con.prepareStatement("REPLACE INTO augmentations VALUES(?,?,?,?)");
| |
| 367 | + statement.setInt(1, item.getObjectId()); | |
| 368 | + statement.setInt(2, attributes*65536+1); | |
| 369 | + statement.setInt(3, skill); | |
| 370 | + statement.setInt(4, level); | |
| 371 | + statement.executeUpdate(); | |
| 372 | + player.sendMessage("Succesfully augmented. You have to relog now.");
| |
| 373 | + player.sendPacket(new ExShowScreenMessage("Succesfully augmented. You have to relog now.", 10000));
| |
| 374 | + player.broadcastPacket(new SocialAction(player.getObjectId(), 16)); | |
| 375 | + statement.close(); | |
| 376 | + } | |
| 377 | + catch (final Exception e) | |
| 378 | + {
| |
| 379 | + if (Config.ENABLE_ALL_EXCEPTIONS) | |
| 380 | + e.printStackTrace(); | |
| 381 | + | |
| 382 | + LOGGER.info("Could not augment item: "+item.getObjectId()+" ", e);
| |
| 383 | + } | |
| 384 | + finally | |
| 385 | + {
| |
| 386 | + CloseUtil.close(con); | |
| 387 | + } | |
| 388 | + } | |
| 389 | + | |
| 390 | + @Override | |
| 391 | + public int[] getItemIds() | |
| 392 | + {
| |
| 393 | + return ITEM_IDS; | |
| 394 | + } | |
| 395 | +} | |
| 396 | \ No newline at end of file | |
| 397 | diff --git a/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentPassiveCustomItem.java b/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentPassiveCustomItem.java | |
| 398 | new file mode 100644 | |
| 399 | index 0000000..7ae939c | |
| 400 | --- /dev/null | |
| 401 | +++ b/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/AugmentPassiveCustomItem.java | |
| 402 | @@ -0,0 +1,191 @@ | |
| 403 | +package com.l2jfrozen.gameserver.handler.itemhandlers; | |
| 404 | + | |
| 405 | +import java.sql.Connection; | |
| 406 | +import java.sql.PreparedStatement; | |
| 407 | + | |
| 408 | +import org.apache.log4j.Logger; | |
| 409 | + | |
| 410 | +import com.l2jfrozen.Config; | |
| 411 | +import com.l2jfrozen.gameserver.handler.IItemHandler; | |
| 412 | +import com.l2jfrozen.gameserver.model.Inventory; | |
| 413 | +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance; | |
| 414 | +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; | |
| 415 | +import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance; | |
| 416 | +import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed; | |
| 417 | +import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage; | |
| 418 | +import com.l2jfrozen.gameserver.network.serverpackets.SocialAction; | |
| 419 | +import com.l2jfrozen.util.CloseUtil; | |
| 420 | +import com.l2jfrozen.util.database.L2DatabaseFactory; | |
| 421 | + | |
| 422 | +/** | |
| 423 | + * @author Gabriel Fleck | |
| 424 | + */ | |
| 425 | +public class AugmentPassiveCustomItem implements IItemHandler | |
| 426 | +{
| |
| 427 | + private static final Logger LOGGER = Logger.getLogger(AugmentPassiveCustomItem.class); | |
| 428 | + private static final int ITEM_IDS[] = | |
| 429 | + {
| |
| 430 | + Config.AUGMENT_PASSIVE_MIGHT_CUSTOM_ITEM_ID, | |
| 431 | + Config.AUGMENT_PASSIVE_EMPOWER_CUSTOM_ITEM_ID, | |
| 432 | + Config.AUGMENT_PASSIVE_DUEL_MIGHT_CUSTOM_ITEM_ID, | |
| 433 | + Config.AUGMENT_PASSIVE_SHIELD_CUSTOM_ITEM_ID, | |
| 434 | + Config.AUGMENT_PASSIVE_AGILITY_CUSTOM_ITEM_ID, | |
| 435 | + Config.AUGMENT_PASSIVE_GUIDANCE_CUSTOM_ITEM_ID, | |
| 436 | + Config.AUGMENT_PASSIVE_FOCUS_CUSTOM_ITEM_ID, | |
| 437 | + Config.AUGMENT_PASSIVE_WILD_MAGIC_CUSTOM_ITEM_ID | |
| 438 | + }; | |
| 439 | + | |
| 440 | + @Override | |
| 441 | + public void useItem(L2PlayableInstance playable, L2ItemInstance item) | |
| 442 | + {
| |
| 443 | + if (!(playable instanceof L2PcInstance)) | |
| 444 | + return; | |
| 445 | + | |
| 446 | + final int itemId = item.getItemId(); | |
| 447 | + L2PcInstance activeChar = (L2PcInstance) playable; | |
| 448 | + | |
| 449 | + if (activeChar.isInCombat() && activeChar.isInDuel()) | |
| 450 | + {
| |
| 451 | + activeChar.sendMessage("This item cannot be used in combat or duel mode.");
| |
| 452 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 453 | + return; | |
| 454 | + } | |
| 455 | + if (activeChar.isRegisteredInCTFEvent() && activeChar.isRegisteredInDMEvent() | |
| 456 | + && activeChar.isRegisteredInFunEvent() && activeChar.isRegisteredInTVTEvent() | |
| 457 | + && activeChar.isInFunEvent() && activeChar.isInOlympiadMode() && activeChar.isinTownWar()) | |
| 458 | + {
| |
| 459 | + activeChar.sendMessage("This item cannot be used in Events.");
| |
| 460 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 461 | + return; | |
| 462 | + } | |
| 463 | + if (activeChar.isRunning() && activeChar.isSitting() && activeChar.isFlying()) | |
| 464 | + {
| |
| 465 | + activeChar.sendMessage("This item cannot be used while running, sitting or flying.");
| |
| 466 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 467 | + return; | |
| 468 | + } | |
| 469 | + if (activeChar.isCastingNow() && activeChar.isAway() | |
| 470 | + && activeChar.isConfused() && activeChar.isStunned() | |
| 471 | + && activeChar.isDead() && activeChar.isAlikeDead()) | |
| 472 | + {
| |
| 473 | + activeChar.sendMessage("This item cannot be used at this time.");
| |
| 474 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 475 | + return; | |
| 476 | + } | |
| 477 | + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null) | |
| 478 | + {
| |
| 479 | + activeChar.sendMessage("You have to equip a weapon.");
| |
| 480 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 481 | + return; | |
| 482 | + } | |
| 483 | + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isAugmented()) | |
| 484 | + {
| |
| 485 | + activeChar.sendMessage("The weapon is already augmented, change it.");
| |
| 486 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 487 | + return; | |
| 488 | + } | |
| 489 | + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isHeroItem()) | |
| 490 | + {
| |
| 491 | + activeChar.sendMessage("This weapon is hero, change it.");
| |
| 492 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 493 | + return; | |
| 494 | + } | |
| 495 | + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isShadowItem()) | |
| 496 | + {
| |
| 497 | + activeChar.sendMessage("This weapon is Shadow, change it.");
| |
| 498 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 499 | + return; | |
| 500 | + } | |
| 501 | + if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isCupidBow()) | |
| 502 | + {
| |
| 503 | + activeChar.sendMessage("This weapon is Cupid Bow, change it.");
| |
| 504 | + activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
| 505 | + return; | |
| 506 | + } | |
| 507 | + | |
| 508 | + | |
| 509 | + if (itemId == Config.AUGMENT_PASSIVE_MIGHT_CUSTOM_ITEM_ID) | |
| 510 | + {
| |
| 511 | + Augment(activeChar,16283,3240,10); | |
| 512 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_MIGHT_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 513 | + } | |
| 514 | + else if (itemId == Config.AUGMENT_PASSIVE_EMPOWER_CUSTOM_ITEM_ID) | |
| 515 | + {
| |
| 516 | + Augment(activeChar,16281,3241,10); | |
| 517 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_EMPOWER_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 518 | + } | |
| 519 | + else if (itemId == Config.AUGMENT_PASSIVE_DUEL_MIGHT_CUSTOM_ITEM_ID) | |
| 520 | + {
| |
| 521 | + Augment(activeChar,16285,3243,10); | |
| 522 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_DUEL_MIGHT_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 523 | + } | |
| 524 | + else if (itemId == Config.AUGMENT_PASSIVE_SHIELD_CUSTOM_ITEM_ID) | |
| 525 | + {
| |
| 526 | + Augment(activeChar,16284,3244,10); | |
| 527 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_SHIELD_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 528 | + } | |
| 529 | + else if (itemId == Config.AUGMENT_PASSIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID) | |
| 530 | + {
| |
| 531 | + Augment(activeChar,16282,3245,10); | |
| 532 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_MAGIC_BARRIER_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 533 | + } | |
| 534 | + else if (itemId == Config.AUGMENT_PASSIVE_AGILITY_CUSTOM_ITEM_ID) | |
| 535 | + {
| |
| 536 | + Augment(activeChar,16332,3247,10); | |
| 537 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_AGILITY_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 538 | + } | |
| 539 | + else if (itemId == Config.AUGMENT_PASSIVE_GUIDANCE_CUSTOM_ITEM_ID) | |
| 540 | + {
| |
| 541 | + Augment(activeChar,16335,3248,10); | |
| 542 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_GUIDANCE_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 543 | + } | |
| 544 | + else if (itemId == Config.AUGMENT_PASSIVE_FOCUS_CUSTOM_ITEM_ID) | |
| 545 | + {
| |
| 546 | + Augment(activeChar,16333,3249,10); | |
| 547 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_FOCUS_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 548 | + } | |
| 549 | + else if (itemId == Config.AUGMENT_PASSIVE_WILD_MAGIC_CUSTOM_ITEM_ID) | |
| 550 | + {
| |
| 551 | + Augment(activeChar,16336,3250,10); | |
| 552 | + playable.destroyItemByItemId("Consume", Config.AUGMENT_PASSIVE_WILD_MAGIC_CUSTOM_ITEM_ID, 1, activeChar, true);
| |
| 553 | + } | |
| 554 | + | |
| 555 | + } | |
| 556 | + | |
| 557 | + private static void Augment(L2PcInstance player, int attributes, int skill, int level) | |
| 558 | + {
| |
| 559 | + L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND); | |
| 560 | + Connection con = null; | |
| 561 | + try | |
| 562 | + {
| |
| 563 | + con = L2DatabaseFactory.getInstance().getConnection(); | |
| 564 | + PreparedStatement statement = con.prepareStatement("REPLACE INTO augmentations VALUES(?,?,?,?)");
| |
| 565 | + statement.setInt(1, item.getObjectId()); | |
| 566 | + statement.setInt(2, attributes*65536+1); | |
| 567 | + statement.setInt(3, skill); | |
| 568 | + statement.setInt(4, level); | |
| 569 | + statement.executeUpdate(); | |
| 570 | + player.sendMessage("Succesfully augmented. You have to relog now.");
| |
| 571 | + player.sendPacket(new ExShowScreenMessage("Succesfully augmented. You have to relog now.", 10000));
| |
| 572 | + player.broadcastPacket(new SocialAction(player.getObjectId(), 16)); | |
| 573 | + statement.close(); | |
| 574 | + } | |
| 575 | + catch (final Exception e) | |
| 576 | + {
| |
| 577 | + if (Config.ENABLE_ALL_EXCEPTIONS) | |
| 578 | + e.printStackTrace(); | |
| 579 | + | |
| 580 | + LOGGER.info("Could not augment item: "+item.getObjectId()+" ", e);
| |
| 581 | + } | |
| 582 | + finally | |
| 583 | + {
| |
| 584 | + CloseUtil.close(con); | |
| 585 | + } | |
| 586 | + } | |
| 587 | + | |
| 588 | + @Override | |
| 589 | + public int[] getItemIds() | |
| 590 | + {
| |
| 591 | + return ITEM_IDS; | |
| 592 | + } | |
| 593 | +} | |
| 594 | \ No newline at end of file | |
| 595 |