Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_Mobius_6.0_Fafurion
- Index: java/org/l2jmobius/gameserver/network/serverpackets/ExItemAnnounce.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/serverpackets/ExItemAnnounce.java (nonexistent)
- +++ java/org/l2jmobius/gameserver/network/serverpackets/ExItemAnnounce.java (working copy)
- @@ -0,0 +1,54 @@
- +/*
- + * This file is part of the L2J Mobius project.
- + *
- + * This program is free software: you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation, either version 3 of the License, or
- + * (at your option) any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package org.l2jmobius.gameserver.network.serverpackets;
- +
- +import org.l2jmobius.commons.network.PacketWriter;
- +import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
- +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.network.OutgoingPackets;
- +
- +/**
- + * @author NviX
- + */
- +public class ExItemAnnounce implements IClientOutgoingPacket
- +{
- + private final ItemInstance _item;
- + private final PlayerInstance _player;
- +
- + /**
- + * @param item
- + */
- + public ExItemAnnounce(ItemInstance item, PlayerInstance player)
- + {
- + _item = item;
- + _player = player;
- + }
- +
- +
- + @Override
- + public boolean write(PacketWriter packet)
- + {
- + OutgoingPackets.EX_ITEM_ANNOUNCE.writeId(packet);
- + packet.writeC(0x00); // item icon
- + packet.writeString(_player.getName()); // name of player
- + packet.writeD(_item.getId()); // item id
- + packet.writeD(_item.getEnchantLevel()); // enchant level
- + packet.writeC(0x00); // name of item
- + return true;
- + }
- +
- +}
- \ No newline at end of file
- Index: java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java
- ===================================================================
- --- java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java (revision 5961)
- +++ java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java (working copy)
- @@ -1,463 +1,465 @@
- -/*
- - * This file is part of the L2J Mobius project.
- - *
- - * This program is free software: you can redistribute it and/or modify
- - * it under the terms of the GNU General Public License as published by
- - * the Free Software Foundation, either version 3 of the License, or
- - * (at your option) any later version.
- - *
- - * This program is distributed in the hope that it will be useful,
- - * but WITHOUT ANY WARRANTY; without even the implied warranty of
- - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- - * General Public License for more details.
- - *
- - * You should have received a copy of the GNU General Public License
- - * along with this program. If not, see <http://www.gnu.org/licenses/>.
- - */
- -package org.l2jmobius.gameserver.network.clientpackets;
- -
- -import java.util.logging.Logger;
- -
- -import org.l2jmobius.Config;
- -import org.l2jmobius.commons.network.PacketReader;
- -import org.l2jmobius.commons.util.Rnd;
- -import org.l2jmobius.gameserver.data.xml.impl.EnchantItemData;
- -import org.l2jmobius.gameserver.enums.ItemSkillType;
- -import org.l2jmobius.gameserver.enums.UserInfoType;
- -import org.l2jmobius.gameserver.model.World;
- -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.model.actor.request.EnchantItemRequest;
- -import org.l2jmobius.gameserver.model.items.Item;
- -import org.l2jmobius.gameserver.model.items.enchant.EnchantResultType;
- -import org.l2jmobius.gameserver.model.items.enchant.EnchantScroll;
- -import org.l2jmobius.gameserver.model.items.enchant.EnchantSupportItem;
- -import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
- -import org.l2jmobius.gameserver.model.skills.CommonSkill;
- -import org.l2jmobius.gameserver.model.skills.Skill;
- -import org.l2jmobius.gameserver.network.GameClient;
- -import org.l2jmobius.gameserver.network.SystemMessageId;
- -import org.l2jmobius.gameserver.network.serverpackets.EnchantResult;
- -import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
- -import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
- -import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
- -import org.l2jmobius.gameserver.util.Util;
- -
- -public class RequestEnchantItem implements IClientIncomingPacket
- -{
- - protected static final Logger LOGGER_ENCHANT = Logger.getLogger("enchant.items");
- -
- - private int _objectId;
- - private int _supportId;
- -
- - @Override
- - public boolean read(GameClient client, PacketReader packet)
- - {
- - _objectId = packet.readD();
- - _supportId = packet.readD();
- - return true;
- - }
- -
- - @Override
- - public void run(GameClient client)
- - {
- - final PlayerInstance player = client.getPlayer();
- - if (player == null)
- - {
- - return;
- - }
- -
- - final EnchantItemRequest request = player.getRequest(EnchantItemRequest.class);
- - if ((request == null) || request.isProcessing())
- - {
- - return;
- - }
- -
- - request.setEnchantingItem(_objectId);
- - request.setProcessing(true);
- -
- - if (!player.isOnline() || client.isDetached())
- - {
- - player.removeRequest(request.getClass());
- - return;
- - }
- -
- - if (player.isProcessingTransaction() || player.isInStoreMode())
- - {
- - client.sendPacket(SystemMessageId.YOU_CANNOT_ENCHANT_WHILE_OPERATING_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
- - player.removeRequest(request.getClass());
- - return;
- - }
- -
- - final ItemInstance item = request.getEnchantingItem();
- - final ItemInstance scroll = request.getEnchantingScroll();
- - final ItemInstance support = request.getSupportItem();
- - if ((item == null) || (scroll == null))
- - {
- - player.removeRequest(request.getClass());
- - return;
- - }
- -
- - // template for scroll
- - final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
- - if (scrollTemplate == null)
- - {
- - return;
- - }
- -
- - // template for support item, if exist
- - EnchantSupportItem supportTemplate = null;
- - if (support != null)
- - {
- - if (support.getObjectId() != _supportId)
- - {
- - player.removeRequest(request.getClass());
- - return;
- - }
- - supportTemplate = EnchantItemData.getInstance().getSupportItem(support);
- - }
- -
- - // first validation check - also over enchant check
- - if (!scrollTemplate.isValid(item, supportTemplate) || (Config.DISABLE_OVER_ENCHANTING && (item.getEnchantLevel() == scrollTemplate.getMaxEnchantLevel())))
- - {
- - client.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
- - player.removeRequest(request.getClass());
- - client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- - return;
- - }
- -
- - // fast auto-enchant cheat check
- - if ((request.getTimestamp() == 0) || ((System.currentTimeMillis() - request.getTimestamp()) < 2000))
- - {
- - Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " use autoenchant program ", Config.DEFAULT_PUNISH);
- - player.removeRequest(request.getClass());
- - client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- - return;
- - }
- -
- - // attempting to destroy scroll
- - if (player.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, player, item) == null)
- - {
- - client.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
- - Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to enchant with a scroll he doesn't have", Config.DEFAULT_PUNISH);
- - player.removeRequest(request.getClass());
- - client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- - return;
- - }
- -
- - // attempting to destroy support if exist
- - if (support != null)
- - {
- - if (player.getInventory().destroyItem("Enchant", support.getObjectId(), 1, player, item) == null)
- - {
- - client.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
- - Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to enchant with a support item he doesn't have", Config.DEFAULT_PUNISH);
- - player.removeRequest(request.getClass());
- - client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- - return;
- - }
- - }
- -
- - final InventoryUpdate iu = new InventoryUpdate();
- - synchronized (item)
- - {
- - // last validation check
- - if ((item.getOwnerId() != player.getObjectId()) || (item.isEnchantable() == 0))
- - {
- - client.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
- - player.removeRequest(request.getClass());
- - client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- - return;
- - }
- -
- - final EnchantResultType resultType = scrollTemplate.calculateSuccess(player, item, supportTemplate);
- - switch (resultType)
- - {
- - case ERROR:
- - {
- - client.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
- - player.removeRequest(request.getClass());
- - client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- - break;
- - }
- - case SUCCESS:
- - {
- - final Item it = item.getItem();
- - // Increase enchant level only if scroll's base template has chance, some armors can success over +20 but they shouldn't have increased.
- - if (scrollTemplate.getChance(player, item) > 0)
- - {
- - if (scrollTemplate.isGiant())
- - {
- - if (((supportTemplate != null) && (supportTemplate.getId() == 23785)) || ((supportTemplate != null) && (supportTemplate.getId() == 23786))) // Lesser Giant's Lucky Enchant Stones. Increase from +2 to +4
- - {
- - item.setEnchantLevel(Math.min(item.getEnchantLevel() + 2 + Rnd.get(3), scrollTemplate.getMaxEnchantLevel()));
- - }
- - else
- - {
- - item.setEnchantLevel(Math.min(item.getEnchantLevel() + 1 + Rnd.get(3), scrollTemplate.getMaxEnchantLevel()));
- - }
- - }
- - else
- - {
- - item.setEnchantLevel(item.getEnchantLevel() + 1);
- - }
- - item.updateDatabase();
- - }
- - client.sendPacket(new EnchantResult(EnchantResult.SUCCESS, item));
- -
- - if (Config.LOG_ITEM_ENCHANTS)
- - {
- - if (item.getEnchantLevel() > 0)
- - {
- - if (support == null)
- - {
- - LOGGER_ENCHANT.info("Success, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- - }
- - else
- - {
- - LOGGER_ENCHANT.info("Success, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- - }
- - }
- - else if (support == null)
- - {
- - LOGGER_ENCHANT.info("Success, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- - }
- - else
- - {
- - LOGGER_ENCHANT.info("Success, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- - }
- - }
- -
- - // announce the success
- - final int minEnchantAnnounce = item.isArmor() ? 6 : 7;
- - final int maxEnchantAnnounce = item.isArmor() ? 0 : 15;
- - if ((item.getEnchantLevel() == minEnchantAnnounce) || (item.getEnchantLevel() == maxEnchantAnnounce))
- - {
- - final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_SUCCESSFULLY_ENCHANTED_A_S2_S3);
- - sm.addString(player.getName());
- - sm.addInt(item.getEnchantLevel());
- - sm.addItemName(item);
- - player.broadcastPacket(sm);
- -
- - final Skill skill = CommonSkill.FIREWORK.getSkill();
- - if (skill != null)
- - {
- - player.broadcastPacket(new MagicSkillUse(player, player, skill.getId(), skill.getLevel(), skill.getHitTime(), skill.getReuseDelay()));
- - }
- - }
- -
- - if (item.isEquipped())
- - {
- - if (item.isArmor())
- - {
- - it.forEachSkill(ItemSkillType.ON_ENCHANT, holder ->
- - {
- - // add skills bestowed from +4 armor
- - if (item.getEnchantLevel() >= holder.getValue())
- - {
- - player.addSkill(holder.getSkill(), false);
- - player.sendSkillList();
- - }
- - });
- - }
- - player.broadcastUserInfo(); // update user info
- - }
- - break;
- - }
- - case FAILURE:
- - {
- - if (scrollTemplate.isSafe())
- - {
- - // safe enchant - remain old value
- - client.sendPacket(SystemMessageId.ENCHANT_FAILED_THE_ENCHANT_VALUE_FOR_THE_CORRESPONDING_ITEM_WILL_BE_EXACTLY_RETAINED);
- - client.sendPacket(new EnchantResult(EnchantResult.SAFE_FAIL, item));
- -
- - if (Config.LOG_ITEM_ENCHANTS)
- - {
- - if (item.getEnchantLevel() > 0)
- - {
- - if (support == null)
- - {
- - LOGGER_ENCHANT.info("Safe Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- - }
- - else
- - {
- - LOGGER_ENCHANT.info("Safe Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- - }
- - }
- - else if (support == null)
- - {
- - LOGGER_ENCHANT.info("Safe Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- - }
- - else
- - {
- - LOGGER_ENCHANT.info("Safe Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- - }
- - }
- - }
- - else
- - {
- - // unequip item on enchant failure to avoid item skills stack
- - if (item.isEquipped())
- - {
- - if (item.getEnchantLevel() > 0)
- - {
- - final SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2_HAS_BEEN_UNEQUIPPED);
- - sm.addInt(item.getEnchantLevel());
- - sm.addItemName(item);
- - client.sendPacket(sm);
- - }
- - else
- - {
- - final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HAS_BEEN_UNEQUIPPED);
- - sm.addItemName(item);
- - client.sendPacket(sm);
- - }
- -
- - final ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(item.getLocationSlot());
- - for (ItemInstance itm : unequiped)
- - {
- - iu.addModifiedItem(itm);
- - }
- -
- - player.sendInventoryUpdate(iu);
- - player.broadcastUserInfo();
- - }
- -
- - if (scrollTemplate.isBlessed() || ((supportTemplate != null) && supportTemplate.isBlessed()))
- - {
- - // blessed enchant - clear enchant value
- - client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
- -
- - item.setEnchantLevel(0);
- - item.updateDatabase();
- - client.sendPacket(new EnchantResult(EnchantResult.BLESSED_FAIL, 0, 0));
- -
- - if (Config.LOG_ITEM_ENCHANTS)
- - {
- - if (item.getEnchantLevel() > 0)
- - {
- - if (support == null)
- - {
- - LOGGER_ENCHANT.info("Blessed Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- - }
- - else
- - {
- - LOGGER_ENCHANT.info("Blessed Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- - }
- - }
- - else if (support == null)
- - {
- - LOGGER_ENCHANT.info("Blessed Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- - }
- - else
- - {
- - LOGGER_ENCHANT.info("Blessed Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- - }
- - }
- - }
- - else
- - {
- - // enchant failed, destroy item
- - final int crystalId = item.getItem().getCrystalItemId();
- - int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
- - if (count < 1)
- - {
- - count = 1;
- - }
- -
- - if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
- - {
- - // unable to destroy item, cheater ?
- - Util.handleIllegalPlayerAction(player, "Unable to delete item on enchant failure from player " + player.getName() + ", possible cheater !", Config.DEFAULT_PUNISH);
- - player.removeRequest(request.getClass());
- - client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- -
- - if (Config.LOG_ITEM_ENCHANTS)
- - {
- - if (item.getEnchantLevel() > 0)
- - {
- - if (support == null)
- - {
- - LOGGER_ENCHANT.info("Unable to destroy, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- - }
- - else
- - {
- - LOGGER_ENCHANT.info("Unable to destroy, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- - }
- - }
- - else if (support == null)
- - {
- - LOGGER_ENCHANT.info("Unable to destroy, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- - }
- - else
- - {
- - LOGGER_ENCHANT.info("Unable to destroy, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- - }
- - }
- - return;
- - }
- -
- - World.getInstance().removeObject(item);
- - ItemInstance crystals = null;
- - if (crystalId != 0)
- - {
- - crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
- -
- - final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
- - sm.addItemName(crystals);
- - sm.addLong(count);
- - client.sendPacket(sm);
- - }
- -
- - if (!Config.FORCE_INVENTORY_UPDATE)
- - {
- - if (crystals != null)
- - {
- - iu.addItem(crystals);
- - }
- - }
- -
- - if (crystalId == 0)
- - {
- - client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
- - }
- - else
- - {
- - client.sendPacket(new EnchantResult(EnchantResult.FAIL, crystalId, count));
- - }
- -
- - if (Config.LOG_ITEM_ENCHANTS)
- - {
- - if (item.getEnchantLevel() > 0)
- - {
- - if (support == null)
- - {
- - LOGGER_ENCHANT.info("Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- - }
- - else
- - {
- - LOGGER_ENCHANT.info("Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- - }
- - }
- - else if (support == null)
- - {
- - LOGGER_ENCHANT.info("Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- - }
- - else
- - {
- - LOGGER_ENCHANT.info("Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- - }
- - }
- - }
- - }
- - break;
- - }
- - }
- -
- - player.sendItemList();
- -
- - request.setProcessing(false);
- - player.broadcastUserInfo(UserInfoType.ENCHANTLEVEL);
- - }
- - }
- -}
- +/*
- + * This file is part of the L2J Mobius project.
- + *
- + * This program is free software: you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation, either version 3 of the License, or
- + * (at your option) any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package org.l2jmobius.gameserver.network.clientpackets;
- +
- +import java.util.logging.Logger;
- +
- +import org.l2jmobius.Config;
- +import org.l2jmobius.commons.network.PacketReader;
- +import org.l2jmobius.commons.util.Rnd;
- +import org.l2jmobius.gameserver.data.xml.impl.EnchantItemData;
- +import org.l2jmobius.gameserver.enums.ItemSkillType;
- +import org.l2jmobius.gameserver.enums.UserInfoType;
- +import org.l2jmobius.gameserver.model.World;
- +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- +import org.l2jmobius.gameserver.model.actor.request.EnchantItemRequest;
- +import org.l2jmobius.gameserver.model.items.Item;
- +import org.l2jmobius.gameserver.model.items.enchant.EnchantResultType;
- +import org.l2jmobius.gameserver.model.items.enchant.EnchantScroll;
- +import org.l2jmobius.gameserver.model.items.enchant.EnchantSupportItem;
- +import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
- +import org.l2jmobius.gameserver.model.skills.CommonSkill;
- +import org.l2jmobius.gameserver.model.skills.Skill;
- +import org.l2jmobius.gameserver.network.GameClient;
- +import org.l2jmobius.gameserver.network.SystemMessageId;
- +import org.l2jmobius.gameserver.network.serverpackets.EnchantResult;
- +import org.l2jmobius.gameserver.network.serverpackets.ExItemAnnounce;
- +import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
- +import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
- +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
- +import org.l2jmobius.gameserver.util.Util;
- +
- +public class RequestEnchantItem implements IClientIncomingPacket
- +{
- + protected static final Logger LOGGER_ENCHANT = Logger.getLogger("enchant.items");
- +
- + private int _objectId;
- + private int _supportId;
- +
- + @Override
- + public boolean read(GameClient client, PacketReader packet)
- + {
- + _objectId = packet.readD();
- + _supportId = packet.readD();
- + return true;
- + }
- +
- + @Override
- + public void run(GameClient client)
- + {
- + final PlayerInstance player = client.getPlayer();
- + if (player == null)
- + {
- + return;
- + }
- +
- + final EnchantItemRequest request = player.getRequest(EnchantItemRequest.class);
- + if ((request == null) || request.isProcessing())
- + {
- + return;
- + }
- +
- + request.setEnchantingItem(_objectId);
- + request.setProcessing(true);
- +
- + if (!player.isOnline() || client.isDetached())
- + {
- + player.removeRequest(request.getClass());
- + return;
- + }
- +
- + if (player.isProcessingTransaction() || player.isInStoreMode())
- + {
- + client.sendPacket(SystemMessageId.YOU_CANNOT_ENCHANT_WHILE_OPERATING_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
- + player.removeRequest(request.getClass());
- + return;
- + }
- +
- + final ItemInstance item = request.getEnchantingItem();
- + final ItemInstance scroll = request.getEnchantingScroll();
- + final ItemInstance support = request.getSupportItem();
- + if ((item == null) || (scroll == null))
- + {
- + player.removeRequest(request.getClass());
- + return;
- + }
- +
- + // template for scroll
- + final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
- + if (scrollTemplate == null)
- + {
- + return;
- + }
- +
- + // template for support item, if exist
- + EnchantSupportItem supportTemplate = null;
- + if (support != null)
- + {
- + if (support.getObjectId() != _supportId)
- + {
- + player.removeRequest(request.getClass());
- + return;
- + }
- + supportTemplate = EnchantItemData.getInstance().getSupportItem(support);
- + }
- +
- + // first validation check - also over enchant check
- + if (!scrollTemplate.isValid(item, supportTemplate) || (Config.DISABLE_OVER_ENCHANTING && (item.getEnchantLevel() == scrollTemplate.getMaxEnchantLevel())))
- + {
- + client.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
- + player.removeRequest(request.getClass());
- + client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- + return;
- + }
- +
- + // fast auto-enchant cheat check
- + if ((request.getTimestamp() == 0) || ((System.currentTimeMillis() - request.getTimestamp()) < 2000))
- + {
- + Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " use autoenchant program ", Config.DEFAULT_PUNISH);
- + player.removeRequest(request.getClass());
- + client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- + return;
- + }
- +
- + // attempting to destroy scroll
- + if (player.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, player, item) == null)
- + {
- + client.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
- + Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to enchant with a scroll he doesn't have", Config.DEFAULT_PUNISH);
- + player.removeRequest(request.getClass());
- + client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- + return;
- + }
- +
- + // attempting to destroy support if exist
- + if (support != null)
- + {
- + if (player.getInventory().destroyItem("Enchant", support.getObjectId(), 1, player, item) == null)
- + {
- + client.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
- + Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to enchant with a support item he doesn't have", Config.DEFAULT_PUNISH);
- + player.removeRequest(request.getClass());
- + client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- + return;
- + }
- + }
- +
- + final InventoryUpdate iu = new InventoryUpdate();
- + synchronized (item)
- + {
- + // last validation check
- + if ((item.getOwnerId() != player.getObjectId()) || (item.isEnchantable() == 0))
- + {
- + client.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
- + player.removeRequest(request.getClass());
- + client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- + return;
- + }
- +
- + final EnchantResultType resultType = scrollTemplate.calculateSuccess(player, item, supportTemplate);
- + switch (resultType)
- + {
- + case ERROR:
- + {
- + client.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
- + player.removeRequest(request.getClass());
- + client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- + break;
- + }
- + case SUCCESS:
- + {
- + final Item it = item.getItem();
- + // Increase enchant level only if scroll's base template has chance, some armors can success over +20 but they shouldn't have increased.
- + if (scrollTemplate.getChance(player, item) > 0)
- + {
- + if (scrollTemplate.isGiant())
- + {
- + if (((supportTemplate != null) && (supportTemplate.getId() == 23785)) || ((supportTemplate != null) && (supportTemplate.getId() == 23786))) // Lesser Giant's Lucky Enchant Stones. Increase from +2 to +4
- + {
- + item.setEnchantLevel(Math.min(item.getEnchantLevel() + 2 + Rnd.get(3), scrollTemplate.getMaxEnchantLevel()));
- + }
- + else
- + {
- + item.setEnchantLevel(Math.min(item.getEnchantLevel() + 1 + Rnd.get(3), scrollTemplate.getMaxEnchantLevel()));
- + }
- + }
- + else
- + {
- + item.setEnchantLevel(item.getEnchantLevel() + 1);
- + }
- + item.updateDatabase();
- + }
- + client.sendPacket(new EnchantResult(EnchantResult.SUCCESS, item));
- +
- + if (Config.LOG_ITEM_ENCHANTS)
- + {
- + if (item.getEnchantLevel() > 0)
- + {
- + if (support == null)
- + {
- + LOGGER_ENCHANT.info("Success, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- + }
- + else
- + {
- + LOGGER_ENCHANT.info("Success, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- + }
- + }
- + else if (support == null)
- + {
- + LOGGER_ENCHANT.info("Success, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- + }
- + else
- + {
- + LOGGER_ENCHANT.info("Success, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- + }
- + }
- +
- + // announce the success
- + final int minEnchantAnnounce = item.isArmor() ? 10 : 15;
- + final int maxEnchantAnnounce = item.isArmor() ? 0 : 30;
- + if ((item.getEnchantLevel() >= minEnchantAnnounce) || (item.getEnchantLevel() == maxEnchantAnnounce))
- + {
- + final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_SUCCESSFULLY_ENCHANTED_A_S2_S3);
- + sm.addString(player.getName());
- + sm.addInt(item.getEnchantLevel());
- + sm.addItemName(item);
- + player.broadcastPacket(sm);
- + player.broadcastPacket(new ExItemAnnounce(item, player));
- +
- + final Skill skill = CommonSkill.FIREWORK.getSkill();
- + if (skill != null)
- + {
- + player.broadcastPacket(new MagicSkillUse(player, player, skill.getId(), skill.getLevel(), skill.getHitTime(), skill.getReuseDelay()));
- + }
- + }
- +
- + if (item.isEquipped())
- + {
- + if (item.isArmor())
- + {
- + it.forEachSkill(ItemSkillType.ON_ENCHANT, holder ->
- + {
- + // add skills bestowed from +4 armor
- + if (item.getEnchantLevel() >= holder.getValue())
- + {
- + player.addSkill(holder.getSkill(), false);
- + player.sendSkillList();
- + }
- + });
- + }
- + player.broadcastUserInfo(); // update user info
- + }
- + break;
- + }
- + case FAILURE:
- + {
- + if (scrollTemplate.isSafe())
- + {
- + // safe enchant - remain old value
- + client.sendPacket(SystemMessageId.ENCHANT_FAILED_THE_ENCHANT_VALUE_FOR_THE_CORRESPONDING_ITEM_WILL_BE_EXACTLY_RETAINED);
- + client.sendPacket(new EnchantResult(EnchantResult.SAFE_FAIL, item));
- +
- + if (Config.LOG_ITEM_ENCHANTS)
- + {
- + if (item.getEnchantLevel() > 0)
- + {
- + if (support == null)
- + {
- + LOGGER_ENCHANT.info("Safe Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- + }
- + else
- + {
- + LOGGER_ENCHANT.info("Safe Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- + }
- + }
- + else if (support == null)
- + {
- + LOGGER_ENCHANT.info("Safe Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- + }
- + else
- + {
- + LOGGER_ENCHANT.info("Safe Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- + }
- + }
- + }
- + else
- + {
- + // unequip item on enchant failure to avoid item skills stack
- + if (item.isEquipped())
- + {
- + if (item.getEnchantLevel() > 0)
- + {
- + final SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2_HAS_BEEN_UNEQUIPPED);
- + sm.addInt(item.getEnchantLevel());
- + sm.addItemName(item);
- + client.sendPacket(sm);
- + }
- + else
- + {
- + final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HAS_BEEN_UNEQUIPPED);
- + sm.addItemName(item);
- + client.sendPacket(sm);
- + }
- +
- + final ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(item.getLocationSlot());
- + for (ItemInstance itm : unequiped)
- + {
- + iu.addModifiedItem(itm);
- + }
- +
- + player.sendInventoryUpdate(iu);
- + player.broadcastUserInfo();
- + }
- +
- + if (scrollTemplate.isBlessed() || ((supportTemplate != null) && supportTemplate.isBlessed()))
- + {
- + // blessed enchant - clear enchant value
- + client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
- +
- + item.setEnchantLevel(0);
- + item.updateDatabase();
- + client.sendPacket(new EnchantResult(EnchantResult.BLESSED_FAIL, 0, 0));
- +
- + if (Config.LOG_ITEM_ENCHANTS)
- + {
- + if (item.getEnchantLevel() > 0)
- + {
- + if (support == null)
- + {
- + LOGGER_ENCHANT.info("Blessed Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- + }
- + else
- + {
- + LOGGER_ENCHANT.info("Blessed Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- + }
- + }
- + else if (support == null)
- + {
- + LOGGER_ENCHANT.info("Blessed Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- + }
- + else
- + {
- + LOGGER_ENCHANT.info("Blessed Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- + }
- + }
- + }
- + else
- + {
- + // enchant failed, destroy item
- + final int crystalId = item.getItem().getCrystalItemId();
- + int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
- + if (count < 1)
- + {
- + count = 1;
- + }
- +
- + if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
- + {
- + // unable to destroy item, cheater ?
- + Util.handleIllegalPlayerAction(player, "Unable to delete item on enchant failure from player " + player.getName() + ", possible cheater !", Config.DEFAULT_PUNISH);
- + player.removeRequest(request.getClass());
- + client.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
- +
- + if (Config.LOG_ITEM_ENCHANTS)
- + {
- + if (item.getEnchantLevel() > 0)
- + {
- + if (support == null)
- + {
- + LOGGER_ENCHANT.info("Unable to destroy, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- + }
- + else
- + {
- + LOGGER_ENCHANT.info("Unable to destroy, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- + }
- + }
- + else if (support == null)
- + {
- + LOGGER_ENCHANT.info("Unable to destroy, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- + }
- + else
- + {
- + LOGGER_ENCHANT.info("Unable to destroy, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- + }
- + }
- + return;
- + }
- +
- + World.getInstance().removeObject(item);
- + ItemInstance crystals = null;
- + if (crystalId != 0)
- + {
- + crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
- +
- + final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
- + sm.addItemName(crystals);
- + sm.addLong(count);
- + client.sendPacket(sm);
- + }
- +
- + if (!Config.FORCE_INVENTORY_UPDATE)
- + {
- + if (crystals != null)
- + {
- + iu.addItem(crystals);
- + }
- + }
- +
- + if (crystalId == 0)
- + {
- + client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
- + }
- + else
- + {
- + client.sendPacket(new EnchantResult(EnchantResult.FAIL, crystalId, count));
- + }
- +
- + if (Config.LOG_ITEM_ENCHANTS)
- + {
- + if (item.getEnchantLevel() > 0)
- + {
- + if (support == null)
- + {
- + LOGGER_ENCHANT.info("Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- + }
- + else
- + {
- + LOGGER_ENCHANT.info("Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- + }
- + }
- + else if (support == null)
- + {
- + LOGGER_ENCHANT.info("Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
- + }
- + else
- + {
- + LOGGER_ENCHANT.info("Fail, Character:" + player.getName() + " [" + player.getObjectId() + "] Account:" + player.getAccountName() + " IP:" + player.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
- + }
- + }
- + }
- + }
- + break;
- + }
- + }
- +
- + player.sendItemList();
- +
- + request.setProcessing(false);
- + player.broadcastUserInfo(UserInfoType.ENCHANTLEVEL);
- + }
- + }
- +}
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement