• Scheduled Server Maintenance | Friday 7 November

    Our hardware provider has scheduled RAM maintenance to address the recent server instability. Work is expected by 17:00 Central European time.

    Brief downtime or interruptions may occur while the faulty memory modules are replaced. We apologise for the recent disruption and appreciate your patience.


    Special thanks to our sponsor, HyperFilter!

    We keep our community safe. They keep our servers safe. Running your own game servers? Keep them protected with HyperFilter.

Java Anti-Phx Enchant L2J 

Status
Not open for further replies.
Newbie Spellweaver
Joined
Feb 20, 2008
Messages
34
Reaction score
0
For interlude L2J Free servers or any pack we all know phx helps u to enchant ur gear 100% cus if u brake it or succeed ur item is in wh...

Well with a little help from L2J server and me you can use this code to fix the problem :P

in net.sf.l2j.gameserver.clientpackets you will find SendWareHouseDepositList.java
open it then add after imports finsih this lines:
Code:
import net.sf.l2j.gameserver.util.IllegalPlayerAction;
import net.sf.l2j.gameserver.util.Util;

after that: ( add it on line 103 or after, if u don't understand look down at the noobish way to do it xD )
Code:
}
       
        if (player.getActiveEnchantItem() != null)
        {
           Util.handleIllegalPlayerAction(player,"Mofo "+player.getName()+" tried to use phx and got BANED! Peace :-h", IllegalPlayerAction.PUNISH_KICKBAN);
           return;
        }
If u dont understand what i said with the lines find
Code:
        // Alt game - Karma punishment
        if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && player.getKarma() > 0) return;
put the anti-phx enchant code above it, and ur done

I think i explain it in the way only an idiot cant understand XD
Have Fun now :)
 
Re: [Share] Java Anti-Phx Enchant

My SendWareHouseDepositList.java COde:
Plase very help me..

PHP:
package net.sf.l2j.gameserver.clientpackets;

import java.nio.ByteBuffer;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.Shutdown;
import net.sf.l2j.gameserver.model.*;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.L2GameClient;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.serverpackets.*;
import net.sf.l2j.gameserver.templates.L2EtcItemType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

// Referenced classes of package net.sf.l2j.gameserver.clientpackets:
//            L2GameClientPacket

public class SendWareHouseDepositList extends L2GameClientPacket
{

    public SendWareHouseDepositList()
    {
    }

    protected void readImpl()
    {
        _count = readD();
        if(_count < 0 || _count * 8 > _buf.remaining() || _count > Config.MAX_ITEM_IN_PACKET)
            _count = 0;
        _items = new int[_count * 2];
        for(int i = 0; i < _count; i++)
        {
            int objectId = readD();
            _items[i * 2 + 0] = objectId;
            long cnt = readD();
            if(cnt > 0x7fffffffL || cnt < 0L)
            {
                _count = 0;
                _items = null;
                return;
            }
            _items[i * 2 + 1] = (int)cnt;
        }

    }

    protected void runImpl()
    {
        L2PcInstance player = ((L2GameClient)getClient()).getActiveChar();
        if(player == null)
            return;
        ItemContainer warehouse = player.getActiveWarehouse();
        if(warehouse == null)
            return;
        net.sf.l2j.gameserver.model.actor.instance.L2FolkInstance manager = player.getLastFolkNPC();
        if(Config.SAFE_REBOOT && Config.SAFE_REBOOT_DISABLE_TRANSACTION && Shutdown.getCounterInstance() != null && Shutdown.getCounterInstance().getCountdown() <= Config.SAFE_REBOOT_TIME)
        {
            player.sendMessage("Transactions are not allowed during restart/shutdown.");
            sendPacket(new ActionFailed());
            return;
        }
        if((manager == null || !player.isInsideRadius(manager, 150, false, false)) && !player.isGM())
            return;
        if((warehouse instanceof ClanWarehouse) && Config.GM_DISABLE_TRANSACTION && player.getAccessLevel() >= Config.GM_TRANSACTION_MIN && player.getAccessLevel() <= Config.GM_TRANSACTION_MAX)
        {
            player.sendMessage("Transactions are disabled for your access level.");
            sendPacket(new ActionFailed());
            return;
        }
        if(!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && player.getKarma() > 0)
            return;
        int fee = _count * 30;
        int currentAdena = player.getAdena();
        int slots = 0;
        for(int i = 0; i < _count; i++)
        {
            int objectId = _items[i * 2 + 0];
            int count = _items[i * 2 + 1];
            L2ItemInstance item = player.checkItemManipulation(objectId, count, "deposit");
            if(item == null)
            {
                _log.warn((new StringBuilder()).append("Error depositing a warehouse object for char ").append(player.getName()).append(" (validity check)").toString());
                _items[i * 2 + 0] = 0;
                _items[i * 2 + 1] = 0;
                continue;
            }
            if(Config.ALT_STRICT_HERO_SYSTEM && item.isHeroitem())
                continue;
            if((warehouse instanceof ClanWarehouse) && !item.isTradeable() || item.getItemType() == L2EtcItemType.QUEST)
                return;
            if(item.getItemId() == 57)
                currentAdena -= count;
            if(!item.isStackable())
            {
                slots += count;
                continue;
            }
            if(warehouse.getItemByItemId(item.getItemId()) == null)
                slots++;
        }

        if(!warehouse.validateCapacity(slots))
        {
            sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
            return;
        }
        if(currentAdena < fee || !player.reduceAdena("Warehouse", fee, player.getLastFolkNPC(), false))
        {
            sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
            return;
        }
        InventoryUpdate playerIU = Config.FORCE_INVENTORY_UPDATE ? null : new InventoryUpdate();
        for(int i = 0; i < _count; i++)
        {
            int objectId = _items[i * 2 + 0];
            int count = _items[i * 2 + 1];
            if(objectId == 0 && count == 0)
                continue;
            L2ItemInstance oldItem = player.getInventory().getItemByObjectId(objectId);
            if(oldItem == null)
            {
                _log.warn((new StringBuilder()).append("Error depositing a warehouse object for char ").append(player.getName()).append(" (olditem == null)").toString());
                continue;
            }
            if(Config.ALT_STRICT_HERO_SYSTEM && oldItem.isHeroitem())
                continue;
            L2ItemInstance newItem = player.getInventory().transferItem((warehouse instanceof ClanWarehouse) ? "ClanWarehouse" : "Warehouse", objectId, count, warehouse, player, player.getLastFolkNPC());
            if(newItem == null)
            {
                _log.warn((new StringBuilder()).append("Error depositing a warehouse object for char ").append(player.getName()).append(" (newitem == null)").toString());
                continue;
            }
            if(playerIU == null)
                continue;
            if(oldItem.getCount() > 0 && oldItem != newItem)
                playerIU.addModifiedItem(oldItem);
            else
                playerIU.addRemovedItem(oldItem);
        }

        if(playerIU != null)
            player.sendPacket(playerIU);
        else
            player.sendPacket(new ItemList(player, false));
        StatusUpdate su = new StatusUpdate(player.getObjectId());
        su.addAttribute(14, player.getCurrentLoad());
        player.sendPacket(su);
    }

    public String getType()
    {
        return "[C] 31 SendWareHouseDepositList";
    }

    private static final String _C__31_SENDWAREHOUSEDEPOSITLIST = "[C] 31 SendWareHouseDepositList";
    private static final Log _log = LogFactory.getLog(net/sf/l2j/gameserver/clientpackets/SendWareHouseDepositList.getName());
    private int _count;
    private int _items[];

}
 
Re: [Share] Java Anti-Phx Enchant

Well, I don't really understand what you're trying to say. So basically you disable the use of phx (phx = Haplex?) and whenever someone uses it he'll get kick banned instantly?
 
Re: [Share] Java Anti-Phx Enchant


*****.

package net.sf.l2j.gameserver.clientpackets;

import java.nio.ByteBuffer;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.Shutdown;
import net.sf.l2j.gameserver.model.*;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.L2GameClient;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.serverpackets.*;
import net.sf.l2j.gameserver.templates.L2EtcItemType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import net.sf.l2j.gameserver.util.IllegalPlayerAction;
import net.sf.l2j.gameserver.util.Util;


// Referenced classes of package net.sf.l2j.gameserver.clientpackets:
// L2GameClientPacket

public class SendWareHouseDepositList extends L2GameClientPacket
{

public SendWareHouseDepositList()
{
}

protected void readImpl()
{
_count = readD();
if(_count < 0 || _count * 8 > _buf.remaining() || _count > Config.MAX_ITEM_IN_PACKET)
_count = 0;
_items = new int[_count * 2];
for(int i = 0; i < _count; i++)
{
int objectId = readD();
_items[i * 2 + 0] = objectId;
long cnt = readD();
if(cnt > 0x7fffffffL || cnt < 0L)
{
_count = 0;
_items = null;
return;
}
_items[i * 2 + 1] = (int)cnt;
}

}

protected void runImpl()
{
L2PcInstance player = ((L2GameClient)getClient()).getActiveChar();
if(player == null)
return;
ItemContainer warehouse = player.getActiveWarehouse();
if(warehouse == null)
return;
net.sf.l2j.gameserver.model.actor.instance.L2FolkInstance manager = player.getLastFolkNPC();
if(Config.SAFE_REBOOT && Config.SAFE_REBOOT_DISABLE_TRANSACTION && Shutdown.getCounterInstance() != null && Shutdown.getCounterInstance().getCountdown() <= Config.SAFE_REBOOT_TIME)
{
player.sendMessage("Transactions are not allowed during restart/shutdown.");
sendPacket(new ActionFailed());
return;
}
if((manager == null || !player.isInsideRadius(manager, 150, false, false)) && !player.isGM())
return;
if((warehouse instanceof ClanWarehouse) && Config.GM_DISABLE_TRANSACTION && player.getAccessLevel() >= Config.GM_TRANSACTION_MIN && player.getAccessLevel() <= Config.GM_TRANSACTION_MAX)
{
player.sendMessage("Transactions are disabled for your access level.");
sendPacket(new ActionFailed());
return;
}
if(!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && player.getKarma() > 0)
return;
}

if (player.getActiveEnchantItem() != null)
{
Util.handleIllegalPlayerAction(player,"Mofo "+player.getName()+" tried to use phx and got BANED! Peace :-h", IllegalPlayerAction.PUNISH_KICKBAN);
return;
}

int fee = _count * 30;
int currentAdena = player.getAdena();
int slots = 0;
for(int i = 0; i < _count; i++)
{
int objectId = _items[i * 2 + 0];
int count = _items[i * 2 + 1];
L2ItemInstance item = player.checkItemManipulation(objectId, count, "deposit");
if(item == null)
{
_log.warn((new StringBuilder()).append("Error depositing a warehouse object for char ").append(player.getName()).append(" (validity check)").toString());
_items[i * 2 + 0] = 0;
_items[i * 2 + 1] = 0;
continue;
}
if(Config.ALT_STRICT_HERO_SYSTEM && item.isHeroitem())
continue;
if((warehouse instanceof ClanWarehouse) && !item.isTradeable() || item.getItemType() == L2EtcItemType.QUEST)
return;
if(item.getItemId() == 57)
currentAdena -= count;
if(!item.isStackable())
{
slots += count;
continue;
}
if(warehouse.getItemByItemId(item.getItemId()) == null)
slots++;
}

if(!warehouse.validateCapacity(slots))
{
sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
return;
}
if(currentAdena < fee || !player.reduceAdena("Warehouse", fee, player.getLastFolkNPC(), false))
{
sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
return;
}
InventoryUpdate playerIU = Config.FORCE_INVENTORY_UPDATE ? null : new InventoryUpdate();
for(int i = 0; i < _count; i++)
{
int objectId = _items[i * 2 + 0];
int count = _items[i * 2 + 1];
if(objectId == 0 && count == 0)
continue;
L2ItemInstance oldItem = player.getInventory().getItemByObjectId(objectId);
if(oldItem == null)
{
_log.warn((new StringBuilder()).append("Error depositing a warehouse object for char ").append(player.getName()).append(" (olditem == null)").toString());
continue;
}
if(Config.ALT_STRICT_HERO_SYSTEM && oldItem.isHeroitem())
continue;
L2ItemInstance newItem = player.getInventory().transferItem((warehouse instanceof ClanWarehouse) ? "ClanWarehouse" : "Warehouse", objectId, count, warehouse, player, player.getLastFolkNPC());
if(newItem == null)
{
_log.warn((new StringBuilder()).append("Error depositing a warehouse object for char ").append(player.getName()).append(" (newitem == null)").toString());
continue;
}
if(playerIU == null)
continue;
if(oldItem.getCount() > 0 && oldItem != newItem)
playerIU.addModifiedItem(oldItem);
else
playerIU.addRemovedItem(oldItem);
}

if(playerIU != null)
player.sendPacket(playerIU);
else
player.sendPacket(new ItemList(player, false));
StatusUpdate su = new StatusUpdate(player.getObjectId());
su.addAttribute(14, player.getCurrentLoad());
player.sendPacket(su);
}

public String getType()
{
return "[C] 31 SendWareHouseDepositList";
}

private static final String _C__31_SENDWAREHOUSEDEPOSITLIST = "[C] 31 SendWareHouseDepositList";
private static final Log _log = LogFactory.getLog(net/sf/l2j/gameserver/clientpackets/SendWareHouseDepositList.getName());
private int _count;
private int _items[];

}

Shame On You.
 
Re: [Share] Java Anti-Phx Enchant

Very thx.

But how reconvert .java to .class ?
 
Re: [Share] Java Anti-Phx Enchant

Very thx.

But how reconvert .java to .class ?

Why do you have to be so noob?
Best thing for you: Shut down your server and play another.

You can compile it with JAVAC compiler. After that you have to extract and recompile core..
In a nooby way you have to resync SRC ex: l2jfree some revision, i think yours is Interlude.
Make changes in java and recompile.
 
Re: [Share] Java Anti-Phx Enchant

sorry i am a total noob who is asking a real dum question where is this net.sf.l2j.gameserver.clientpackets? xD Thank You
 
Status
Not open for further replies.
Back