Fixed sell item exploit.
This commit is contained in:
@@ -130,13 +130,20 @@ public class CastleWarehouse extends Folk
|
||||
@Override
|
||||
public void onBypassFeedback(Player player, String command)
|
||||
{
|
||||
if (player.getActiveEnchantItem() != null)
|
||||
if ((player.getActiveEnchantItem() != null) || (player.getActiveTradeList() != null))
|
||||
{
|
||||
LOGGER.info("Player " + player.getName() + " trying to use enchant exploit, ban this player!");
|
||||
player.closeNetConnection();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getPrivateStoreType() != 0) || player.isInStoreMode())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEMS_CANNOT_BE_DISCARDED_WHILE_IN_PRIVATE_STORE_STATUS);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (command.startsWith("WithdrawP"))
|
||||
{
|
||||
showRetrieveWindow(player);
|
||||
|
@@ -132,10 +132,12 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
|
||||
// Set online status
|
||||
player.setOnlineStatus(true);
|
||||
|
||||
player.setRunning(); // running is default
|
||||
player.standUp(); // standing is default
|
||||
player.broadcastKarma(); // include UserInfo
|
||||
// running is default
|
||||
player.setRunning();
|
||||
// standing is default
|
||||
player.standUp();
|
||||
// include UserInfo
|
||||
player.broadcastKarma();
|
||||
|
||||
// Engage and notify Partner
|
||||
if (Config.ALLOW_WEDDING)
|
||||
@@ -237,7 +239,7 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
player.getMacroses().sendUpdate();
|
||||
|
||||
// Send packets info
|
||||
player.sendPacket(new ClientSetTime()); // SetClientTime
|
||||
player.sendPacket(new ClientSetTime());
|
||||
player.sendPacket(new UserInfo(player));
|
||||
player.sendPacket(new HennaInfo(player));
|
||||
player.sendPacket(new FriendList(player));
|
||||
@@ -271,8 +273,6 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
|
||||
PetitionManager.getInstance().checkPetitionMessages(player);
|
||||
|
||||
// Send user info again .. just like the real client
|
||||
// sendPacket(ui);
|
||||
if ((player.getClanId() != 0) && (player.getClan() != null))
|
||||
{
|
||||
player.sendPacket(new PledgeShowMemberListAll(player.getClan(), player));
|
||||
|
@@ -56,6 +56,12 @@ public class RequestDropItem implements IClientIncomingPacket
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
// Flood protect drop to avoid packet lag
|
||||
if (!client.getFloodProtectors().canDropItem())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = client.getPlayer();
|
||||
if ((player == null) || player.isDead())
|
||||
{
|
||||
@@ -75,12 +81,6 @@ public class RequestDropItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
// Flood protect drop to avoid packet lag
|
||||
if (!client.getFloodProtectors().canDropItem())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Item item = player.getInventory().getItemByObjectId(_objectId);
|
||||
if ((item == null) || (_count == 0) || !player.validateItemManipulation(_objectId, "drop"))
|
||||
{
|
||||
@@ -107,6 +107,12 @@ public class RequestDropItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow if it's flying
|
||||
if (player.isFlying())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_count > item.getCount())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DISCARDED);
|
||||
|
@@ -27,6 +27,7 @@ import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.item.type.WeaponType;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.EnchantResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ItemList;
|
||||
@@ -132,7 +133,8 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
||||
if (player.getActiveTradeList() != null)
|
||||
{
|
||||
player.cancelActiveTrade();
|
||||
player.sendMessage("Your trade canceled");
|
||||
player.sendMessage("Your trade was cancelled.");
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -141,6 +143,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
player.setActiveEnchantItem(null);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -150,6 +153,20 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getPrivateStoreType() != 0) || player.isInStoreMode())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEMS_CANNOT_BE_DISCARDED_WHILE_IN_PRIVATE_STORE_STATUS);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getActiveWarehouse() != null) || (player.getActiveTradeList() != null))
|
||||
{
|
||||
player.sendMessage("You can't enchant items when you got active warehouse or active trade.");
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final Item item = player.getInventory().getItemByObjectId(_objectId);
|
||||
Item scroll = player.getActiveEnchantItem();
|
||||
player.setActiveEnchantItem(null);
|
||||
|
@@ -25,6 +25,7 @@ import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.Fisherman;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.Merchant;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item.ItemLocation;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
@@ -139,10 +140,9 @@ public class RequestSellItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
Item item = player.checkItemManipulation(objectId, count, "sell");
|
||||
|
||||
// Check Item
|
||||
if ((item == null) || !item.getItem().isSellable())
|
||||
final Item item = player.checkItemManipulation(objectId, count, "sell");
|
||||
if ((item == null) || !item.getItem().isSellable() || (item.getItemLocation() != ItemLocation.INVENTORY))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item.ItemLocation;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
/**
|
||||
@@ -41,6 +42,7 @@ public class SellList implements IClientOutgoingPacket
|
||||
for (Item item : _player.getInventory().getItems())
|
||||
{
|
||||
if ((item != null) && !item.isEquipped() && // Not equipped
|
||||
(item.getItemLocation() == ItemLocation.INVENTORY) && // exploit fix
|
||||
item.getItem().isSellable() && // Item is sellable
|
||||
(item.getItem().getItemId() != 57) && // Adena is not sellable
|
||||
((_player.getPet() == null) || // Pet not summoned or
|
||||
|
@@ -27,6 +27,7 @@ import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManorManager.CropProcure;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item.ItemLocation;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
public class SellListProcure implements IClientOutgoingPacket
|
||||
@@ -46,7 +47,7 @@ public class SellListProcure implements IClientOutgoingPacket
|
||||
for (CropProcure c : _procureList)
|
||||
{
|
||||
final Item item = _player.getInventory().getItemByItemId(c.getId());
|
||||
if ((item != null) && (c.getAmount() > 0))
|
||||
if ((item != null) && (c.getAmount() > 0) && (item.getItemLocation() == ItemLocation.INVENTORY))
|
||||
{
|
||||
_sellList.put(item, c.getAmount());
|
||||
}
|
||||
|
Reference in New Issue
Block a user