Jump to content
  • 0

No epic at olympiad!


Question

Posted

I want a player with epic to be unable to participate at olympiad.

 

Well i tried this out in UseItem.java

 

  if (activeChar.isInOlympiadMode()== true && itemId == ID || itemId == ID || )

            {

                activeChar.sendMessage("dont use this in oly dumbass!");

return;

            }

 

not working

 

then i tried it in olympiad.java

 

                                (wpn.getItemId() >= 6611 && wpn.getItemId() <= 6621) ||

                                wpn.getItemId() == 6842 || wpn.getItemId() == 9450 || wpn.getItemId() == 9451 ||

wpn.getItemId() == 9452 || wpn.getItemId() == 9453 || wpn.getItemId() == 9454 ||

wpn.getItemId() == 9455 || wpn.getItemId() == 9456 || wpn.getItemId() == 9457 ||

wpn.getItemId() == 9458 || wpn.getItemId() == 9459 || wpn.getItemId() == 9460 ||

wpn.getItemId() == 9461 || wpn.getItemId() == 9462

                            )

                        )

                    {

 

not working again.Any help would be great.k thanks

Recommended Posts

  • 0
Posted

hmm will be test this :) :)

Stop spamming i am asking for help here!There's nothing to test

  • 0
Posted

well a good idea will be to make a new itemhandler

 

i did not tested.. and i am not sure about the return; but replay if u tested it and it works or not.. (for l2jfree ofc)

 

 

noOlyitems.java

/*
* 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 net.sf.l2j.gameserver.handler.itemhandlers;

import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
import net.sf.l2j.gameserver.network.serverpackets.Olympiad;
import net.sf.l2j.gameserver.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.serverpackets.InventoryUpdate;


/*
* @author zunix
*
*/

public class noOlyitems implements IItemHandler
{
private static final int	ITEM_IDS[]	=
										{ 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 
										6620, 6621, 6842, 9450, 9451, 9452, 9453, 9454, 9455, 9
										456, 9457, 9458, 9459, 9460, 9461, 9462 };

public void useItem(L2PlayableInstance playable, L2ItemInstance item)
{
        if (activeChar.isInOlympiadMode() && item.isEquipped())
            {
               activeChar.sendMessage("dont use this in oly dumbass!");
               return;
            L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInBodySlotAndRecord(item.getItem().getBodyPart());
            InventoryUpdate iu = new InventoryUpdate();
            for (L2ItemInstance element : unequiped) {
                activeChar.checkSSMatch(null, element);
                iu.addModifiedItem(element);
             }
            activeChar.sendPacket(iu);
}

public int[] getItemIds()
{
	return ITEM_IDS;
}
}

  • 0
Posted

Ok i created a file named noOlyitems.java here src\main\java\net\sf\l2j\gameserver\handler\itemhandlers

and i added your code..Well i'll see if this will work in some minutes and i'll post result here.

 

EDIT:

The result_failure..

 

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[35,66] '}' expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[36,14] illegal start of type

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[36,15] <identifier> expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[36,21] <identifier> expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[36,26] illegal start of type

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[36,27] <identifier> expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[36,33] <identifier> expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[36,38] illegal start of type

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[36,39] <identifier> expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[36,45] <identifier> expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[38,8] class, interface, or enum expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[43,15] class, interface, or enum expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[44,12] class, interface, or enum expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[45,12] class, interface, or enum expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[46,12] class, interface, or enum expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[48,16] class, interface, or enum expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[49,13] class, interface, or enum expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[51,1] class, interface, or enum expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[53,8] class, interface, or enum expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\handler\itemhandlers\noOlyitems.java:[56,1] class, interface, or enum expected

  • 0
Posted

if (activeChar.isInOlympiadMode()== true && itemId == ID || itemId == ID || )
              {
                  activeChar.sendMessage("dont use this in oly dumbass!");
              return;
              }

 

that should work. but you said it does not. tho this will work only if people tried to use this item. not if he is already wearing it. try a code to remove all players items when he move to olympiad stadium.

 

 

EDIT:

 

what about this in UseItem.java

 

   

 if(activeChar.isInOlympiadMode() && (bodyPart == 16384 || bodyPart == 256 || bodyPart == 128) && item.isHeroItem() || item.isOlyRestrictedItem())
            {
                activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_CANT_BE_EQUIPPED_FOR_THE_OLYMPIAD_EVENT));
                return;
            }

 

just add the items you need and tell me.

  • 0
Posted

The problem with this code

if (activeChar.isInOlympiadMode()== true && itemId == ID || itemId == ID || )

              {

                  activeChar.sendMessage("dont use this in oly dumbass!");

              return;

              }

 

is that even if they are not in olympiad and they try to equip epic they have the msg dont use this in oly dumbass!

 

now about your code..where should i put all the ids (they are 3 sets)

  • 0
Posted

try add in my code || bodypart= your_id . not sure but just try it.

 

like

 

if(activeChar.isInOlympiadMode() && (bodyPart == 16384 || bodyPart == 256 || bodyPart == 128 || bodypart == your_id) && item.isHeroItem() || item.isOlyRestrictedItem())
           {
               activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_CANT_BE_EQUIPPED_FOR_THE_OLYMPIAD_EVENT));
               return;
           }

 

 

hm what about that config in altsettings.properties

 

# Restrict same item in olympiad. ItemID's need to be separated whit comma (ex. 1,200,350)

AltOlyRestrictedItems = 0

  • 0
Posted

I can't find anywhere in altsettings this

 

# Restrict same item in olympiad. ItemID's need to be separated whit comma (ex. 1,200,350)

AltOlyRestrictedItems = 0

 

EDIT:

I added your code in useitem after it code

 

            {

                SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED);

sm.addItemName(item);

                getClient().getActiveChar().sendPacket(sm);

                sm = null;

                return;

            }

 

and i have the following error

 

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,105] ')' expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,115] illegal start of expression

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,117] ';' expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,123] illegal start of expression

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,134] ';' expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,305] illegal start of expression

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,303] not a statement

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,307] illegal start of expression

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,314] ';' expected

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,328] not a statement

D:\workspace\L2_GameServer_IL\src\main\java\net\sf\l2j\gameserver\clientpackets\UseItem.java:[173,357] ';' expected

  • 0
Posted

[code]if(activeChar.isInOlympiadMode() && (bodyPart == 16384 || bodyPart == 256 || bodyPart == 128 || bodypart == your_id) && item.isHeroItem() || item.isOlyRestrictedItem())
           {
               activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_CANT_BE_EQUIPPED_FOR_THE_OLYMPIAD_EVENT));
               return;
           }

 

here is my useitem.java

 

public class UseItem extends L2GameClientPacket

{

/* member class not found */

class WeaponEquipTask {}

 

 

public UseItem()

{

}

 

protected void readImpl()

{

_objectId = readD();

_unknown = readD();

}

 

protected void runImpl()

{

L2PcInstance activeChar = ((L2GameClient)getClient()).getActiveChar();

if(activeChar == null)

return;

if(!FloodProtector.getInstance().tryPerformAction(activeChar.getObjectId().intValue(), 0))

return;

if(activeChar.getPrivateStoreType() != 0)

{

activeChar.sendPacket(SystemMessageId.CANNOT_TRADE_DISCARD_DROP_ITEM_WHILE_IN_SHOPMODE);

activeChar.sendPacket(ActionFailed.STATIC_PACKET);

return;

}

if(activeChar.getActiveTradeList() != null)

{

activeChar.sendPacket(SystemMessageId.CANNOT_PICKUP_OR_USE_ITEM_WHILE_TRADING);

activeChar.sendPacket(ActionFailed.STATIC_PACKET);

return;

}

L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);

if(item == null)

return;

if(item.isWear())

return;

if(item.getItem().getType2() == 3)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_QUEST_ITEMS));

return;

}

int itemId = item.getItemId();

if(!Config.ALT_GAME_KARMA_PLAYER_CAN_TELEPORT && activeChar.getKarma() > 0 && (itemId == 736 || itemId == 1538 || itemId == 1829 || itemId == 1830 || itemId == 3958 || itemId == 5858 || itemId == 5859 || itemId == 6663 || itemId == 6664 || itemId >= 7117 && itemId <= 7135 || itemId >= 7554 && itemId <= 7559 || itemId == 7618 || itemId == 7619 || itemId == 10129 || itemId == 10130))

return;

L2Clan cl = activeChar.getClan();

if((cl == null || cl.getHasCastle() == 0) && itemId == 7015 && Config.CASTLE_SHIELD)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if((cl == null || cl.getHasHideout() == 0) && itemId == 6902 && Config.CLANHALL_SHIELD)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(itemId >= 7860 && itemId <= 7879 && Config.APELLA_ARMORS && (cl == null || activeChar.getPledgeClass() < 5))

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(itemId >= 7850 && itemId <= 7859 && Config.OATH_ARMORS && cl == null)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(itemId == 6841 && Config.CASTLE_CROWN && (cl == null || cl.getHasCastle() == 0 || !activeChar.isClanLeader()))

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(Config.CASTLE_CIRCLETS && (itemId >= 6834 && itemId <= 6840 || itemId == 8182 || itemId == 8183))

{

if(cl == null)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

int circletId = CastleManager.getInstance().getCircletByCastleId(cl.getHasCastle());

if(activeChar.getSubPledgeType() == -1 || circletId != itemId)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

}

if((itemId >= 9391 && itemId <= 9415 || itemId == 10169) && activeChar.isSubClassActive())

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(activeChar.getPkKills() > 0 && item.getItemId() >= 7816 && item.getItemId() <= 7831)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_UNABLE_TO_EQUIP_THIS_ITEM_WHEN_YOUR_PK_COUNT_IS_GREATER_THAN_OR_EQUAL_TO_ONE));

return;

}

if(itemId == 57)

return;

if(activeChar.isFishing() && (itemId < 6535 || itemId > 6540))

{

SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_DO_WHILE_FISHING_3);

sendPacket(sm);

return;

}

if(activeChar.isDead())

{

SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED);

sm.addItemName(item);

sendPacket(sm);

return;

}

if(item.getItem().isForWolf() || item.getItem().isForGreatWolf() || item.getItem().isForHatchling() || item.getItem().isForStrider() || item.getItem().isForBabyPet())

{

SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_EQUIP_PET_ITEM);

sm.addItemName(item);

((L2GameClient)getClient()).getActiveChar().sendPacket(sm);

sm = null;

return;

}

if(_log.isDebugEnabled())

_log.debug((new StringBuilder()).append(activeChar.getObjectId()).append(": use item ").append(_objectId).toString());

if(item.isEquipable())

{

if(activeChar.isDisarmed())

return;

if(!((L2Equip)item.getItem()).allowEquip(activeChar))

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(activeChar.isKamaelic())

{

if(item.getItemType() == L2ArmorType.HEAVY)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(item.getItemType() == L2ArmorType.MAGIC)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(item.getItemType() == L2WeaponType.NONE)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

} else

{

if(item.getItemType() == L2WeaponType.CROSSBOW)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(item.getItemType() == L2WeaponType.RAPIER)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(item.getItemType() == L2WeaponType.ANCIENT_SWORD)

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

}

if(activeChar.isStunned() || activeChar.isSleeping() || activeChar.isParalyzed() || activeChar.isAlikeDead())

{

activeChar.sendMessage("Your status does not allow you to do that.");

return;

}

int bodyPart = item.getItem().getBodyPart();

if(bodyPart == 16384 || bodyPart == 256 || bodyPart == 128)

{

if(activeChar.isCastingNow())

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_ITEM_WHILE_USING_MAGIC));

return;

}

if(activeChar.isMounted() || activeChar._inEventCTF && activeChar._haveFlagCTF)

{

if(activeChar._inEventCTF && activeChar._haveFlagCTF)

activeChar.sendMessage("This item can not be equipped when you have the flag.");

return;

}

}

if(activeChar.isDisarmed() && (bodyPart == 16384 || bodyPart == 256 || bodyPart == 128))

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));

return;

}

if(activeChar.isCursedWeaponEquipped() && (bodyPart == 16384 || bodyPart == 256 || bodyPart == 128 || itemId == 6408))

return;

if(activeChar.isAttackingNow())

{

ThreadPoolManager.getInstance().scheduleGeneral(new WeaponEquipTask(item, activeChar), (activeChar.getAttackEndTime() - GameTimeController.getGameTicks()) * 100);

return;

}

if(itemId == 9819)

return;

if(activeChar.isInOlympiadMode() && (bodyPart == 16384 || bodyPart == 256 || bodyPart == 128) && item.isHeroItem() || item.isOlyRestrictedItem())

{

activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_CANT_BE_EQUIPPED_FOR_THE_OLYMPIAD_EVENT));

return;

}

if(!activeChar.isHero() && !activeChar.isGM() && item.isHeroItem() && Config.ALT_STRICT_HERO_SYSTEM)

return;

activeChar.useEquippableItem(item, true);

} else

{

L2Weapon weaponItem = activeChar.getActiveWeaponItem();

int itemid = item.getItemId();

if(itemid == 4393)

{

activeChar.sendPacket(new ShowCalculator(4393));

} else

{

if(weaponItem != null && weaponItem.getItemType() == L2WeaponType.ROD && (itemid >= 6519 && itemid <= 6527 || itemid >= 7610 && itemid <= 7613 || itemid >= 7807 && itemid <= 7809 || itemid >= 8484 && itemid <= 8486 || itemid >= 8505 && itemid <= 8513))

{

activeChar.getInventory().setPaperdollItem(10, item);

activeChar.broadcastUserInfo();

ItemList il = new ItemList(activeChar, false);

sendPacket(il);

return;

}

IItemHandler handler = ItemHandler.getInstance().getItemHandler(itemId);

if(handler != null)

handler.useItem(activeChar, item);

else

if(_log.isDebugEnabled())

_log.debug((new StringBuilder()).append("No item handler registered for item ID ").append(itemId).append(".").toString());

}

}

}

 

public String getType()

{

return "[C] 14 UseItem";

}

 

private static final Log _log = LogFactory.getLog(com/l2jfree/gameserver/network/clientpackets/UseItem.getName());

private static final String _C__14_USEITEM = "[C] 14 UseItem";

private int _objectId;

private int _unknown;

 

}[/code]

 

this code is already in your UseItem.java. just add bodypart= you_id. no need to add the same code twice.

 

there is not such a variavle in your altsettings? wait what pack you are using? let me guess l2j?

  • 0
Posted

I am using L2Jfree and my UseItem.java is no way similar to yours ;D take a look on mine

 

/*

* 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 2, 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, write to the Free Software

* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA

* 02111-1307, USA.

*

* http://www.gnu.org/copyleft/gpl.html

*/

package net.sf.l2j.gameserver.clientpackets;

 

import java.util.Arrays;

 

import net.sf.l2j.Config;

import net.sf.l2j.gameserver.ai.CtrlIntention;

import net.sf.l2j.gameserver.handler.IItemHandler;

import net.sf.l2j.gameserver.handler.ItemHandler;

import net.sf.l2j.gameserver.model.Inventory;

import net.sf.l2j.gameserver.model.L2ItemInstance;

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

import net.sf.l2j.gameserver.network.SystemMessageId;

import net.sf.l2j.gameserver.serverpackets.ActionFailed;

import net.sf.l2j.gameserver.serverpackets.EtcStatusUpdate;

import net.sf.l2j.gameserver.serverpackets.InventoryUpdate;

import net.sf.l2j.gameserver.serverpackets.ItemList;

import net.sf.l2j.gameserver.serverpackets.ShowCalculator;

import net.sf.l2j.gameserver.serverpackets.SystemMessage;

import net.sf.l2j.gameserver.serverpackets.UserInfo;

import net.sf.l2j.gameserver.templates.L2Item;

import net.sf.l2j.gameserver.templates.L2Weapon;

import net.sf.l2j.gameserver.templates.L2WeaponType;

import net.sf.l2j.gameserver.util.FloodProtector;

 

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

/**

* This class ...

*

* @version $Revision: 1.18.2.7.2.9 $ $Date: 2005/03/27 15:29:30 $

*/

public class UseItem extends L2GameClientPacket

{

    private final static Log _log = LogFactory.getLog(UseItem.class.getName());

    private static final String _C__14_USEITEM = "[C] 14 UseItem";

 

    private int _objectId;

 

    /**

    * packet type id 0x14

    * format:      cd

    * @param decrypt

    */

    @Override

    protected void readImpl()

    {

        _objectId = readD();

    }

 

    @Override

    protected void runImpl()

    {

 

        L2PcInstance activeChar = getClient().getActiveChar();

       

        if (activeChar == null)

            return;

       

        // Flood protect UseItem

        if (!FloodProtector.getInstance().tryPerformAction(activeChar.getObjectId(), FloodProtector.PROTECTED_USEITEM))

        return;

 

        if (activeChar.getPrivateStoreType() != 0)

        {

            activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_TRADE_DISCARD_DROP_ITEM_WHILE_IN_SHOPMODE));

            activeChar.sendPacket(new ActionFailed());

            return;

        }

 

        // NOTE: disabled due to deadlocks

//        synchronized (activeChar.getInventory())

//      {

            L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);

 

            if (item == null)

                return;

 

if (item.isWear())

{

// No unequipping wear-items

return;

}

 

int itemId = item.getItemId();

/*

* Alt game - Karma punishment // SOE

* 736  Scroll of Escape

* 1538  Blessed Scroll of Escape

* 1829  Scroll of Escape: Clan Hall

* 1830  Scroll of Escape: Castle

* 3958  L2Day - Blessed Scroll of Escape

* 5858  Blessed Scroll of Escape: Clan Hall

* 5859  Blessed Scroll of Escape: Castle

* 6663  Scroll of Escape: Orc Village

* 6664  Scroll of Escape: Silenos Village

* 7117  Scroll of Escape to Talking Island

* 7118  Scroll of Escape to Elven Village

* 7119  Scroll of Escape to Dark Elf Village

* 7120  Scroll of Escape to Orc Village

* 7121  Scroll of Escape to Dwarven Village

* 7122  Scroll of Escape to Gludin Village

* 7123  Scroll of Escape to the Town of Gludio

* 7124  Scroll of Escape to the Town of Dion

* 7125  Scroll of Escape to Floran

* 7126  Scroll of Escape to Giran Castle Town

* 7127  Scroll of Escape to Hardin's Private Academy

* 7128  Scroll of Escape to Heine

* 7129  Scroll of Escape to the Town of Oren

* 7130  Scroll of Escape to Ivory Tower

* 7131  Scroll of Escape to Hunters Village 

* 7132  Scroll of Escape to Aden Castle Town

* 7133  Scroll of Escape to the Town of Goddard

* 7134  Scroll of Escape to the Rune Township

* 7135  Scroll of Escape to the Town of Schuttgart.

* 7554  Scroll of Escape to Talking Island

* 7555  Scroll of Escape to Elven Village

* 7556  Scroll of Escape to Dark Elf Village

* 7557  Scroll of Escape to Orc Village

* 7558  Scroll of Escape to Dwarven Village

* 7559  Scroll of Escape to Giran Castle Town

* 7618  Scroll of Escape - Ketra Orc Village

* 7619  Scroll of Escape - Varka Silenos Village

*/

if (!Config.ALT_GAME_KARMA_PLAYER_CAN_TELEPORT && activeChar.getKarma() > 0

&& (itemId == 736 || itemId == 1538 || itemId == 1829 || itemId == 1830

|| itemId == 3958 || itemId == 5858 || itemId == 5859 || itemId == 6663

|| itemId == 6664 || (itemId >= 7117 && itemId <= 7135)

|| (itemId >= 7554 && itemId <= 7559) || itemId == 7618 || itemId == 7619))

return;

 

            // Items that cannot be used

if (itemId == 57)

                return;

           

            if (activeChar.isFishing() && (itemId < 6535 || itemId > 6540))

            {

                // You cannot do anything else while fishing

                SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_DO_WHILE_FISHING_3);

                getClient().getActiveChar().sendPacket(sm);

                sm = null;

                return;

            }

           

            // Char cannot use item when dead

            if (activeChar.isDead())

            {

                SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED);

sm.addItemName(item);

                getClient().getActiveChar().sendPacket(sm);

                sm = null;

                return;

            }

           

            // Char cannot use pet items

            if (item.getItem().isForWolf() || item.getItem().isForHatchling() || item.getItem().isForStrider() || item.getItem().isForBabyPet())

            {

            SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_EQUIP_PET_ITEM); // You cannot equip a pet item.

sm.addItemName(item);

                getClient().getActiveChar().sendPacket(sm);

                sm = null;

                return;

            }

           

            if (_log.isDebugEnabled())

                _log.debug(activeChar.getObjectId() + ": use item " + _objectId);

 

            if (item.isEquipable())

            {

            // No unequipping/equipping while the player is in special conditions

if (activeChar.isStunned() || activeChar.isSleeping() || activeChar.isParalyzed()

|| activeChar.isAlikeDead())

{

activeChar.sendMessage("Your status does not allow you to do that.");

return;

}

 

int bodyPart = item.getItem().getBodyPart();

 

// Prevent player to remove the weapon on special conditions

                if ((activeChar.isAttackingNow() || activeChar.isCastingNow() || activeChar.isMounted() || (activeChar._inEventCTF && activeChar._haveFlagCTF))

                        && (bodyPart == L2Item.SLOT_LR_HAND

                            || bodyPart == L2Item.SLOT_L_HAND

                            || bodyPart == L2Item.SLOT_R_HAND))

                {

                    if (activeChar._inEventCTF && activeChar._haveFlagCTF)

                    activeChar.sendMessage("This item can not be equipped when you have the flag.");

                return;

                }

               

                // Don't allow weapon/shield equipment if a cursed weapon is equiped

                if (activeChar.isCursedWeaponEquiped()

                      && ((bodyPart == L2Item.SLOT_LR_HAND

                              || bodyPart == L2Item.SLOT_L_HAND

                              || bodyPart == L2Item.SLOT_R_HAND)

                      || itemId == 6408)) // Don't allow to put formal wear

                {

                  return;

                }

               

                activeChar.abortCast();

                if (activeChar.getAI().getIntention() == CtrlIntention.AI_INTENTION_CAST)

                    activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);

 

                // Don't allow weapon/shield hero equipment during Olympiads

                if (activeChar.isInOlympiadMode()

                        && (

                                bodyPart == L2Item.SLOT_LR_HAND

                                || bodyPart == L2Item.SLOT_L_HAND

                                || bodyPart == L2Item.SLOT_R_HAND

                            )

                        && (

                                (item.getItemId() >= 6611 && item.getItemId() <= 6621) ||

                                item.getItemId() == 6842

                            )

                    )

                {

                    return;

                }

 

                // Equip or unEquip

                L2ItemInstance[] items = null;

                boolean isEquiped = item.isEquipped();

                SystemMessage sm = null;

            L2ItemInstance old = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);

            if (old == null)

            old = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

 

            activeChar.checkSSMatch(item, old);

 

            if (isEquiped)

                {

                  if (item.getEnchantLevel() > 0)

                  {

                      sm = new SystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED);

                      sm.addNumber(item.getEnchantLevel());

                      sm.addItemName(item);

                  }

                  else

                  {

                      sm = new SystemMessage(SystemMessageId.S1_DISARMED);

                      sm.addItemName(item);

                  }

                  activeChar.sendPacket(sm);

 

                  // Remove augementation boni on unequip

            if (item.isAugmented())

            item.getAugmentation().removeBoni(activeChar);

                 

              switch(item.getEquipSlot())

              {

              case 1:

              bodyPart = L2Item.SLOT_L_EAR;

              break;

              case 2:

              bodyPart = L2Item.SLOT_R_EAR;

              break;

              case 4:

              bodyPart = L2Item.SLOT_L_FINGER;

              break;

              case 5:

              bodyPart = L2Item.SLOT_R_FINGER;

              break;

              default:

              break;

              }

 

                  items = activeChar.getInventory().unEquipItemInBodySlotAndRecord(bodyPart);

                }

            else

                {

                int tempBodyPart = item.getItem().getBodyPart();

                L2ItemInstance tempItem = activeChar.getInventory().getPaperdollItemByL2ItemId(tempBodyPart);

               

                // remove augmentation stats for replaced items

                // currently weapons only..

                if (tempItem != null && tempItem.isAugmented())

                tempItem.getAugmentation().removeBoni(activeChar);

               

                //check if the item replaces a wear-item

                if (tempItem != null && tempItem.isWear())

                {

                // dont allow an item to replace a wear-item

                return;

                }

                else if (tempBodyPart == 0x4000) // left+right hand equipment

                {

                // this may not remove left OR right hand equipment

                tempItem = activeChar.getInventory().getPaperdollItem(7);

                if (tempItem != null && tempItem.isWear()) return;

               

                tempItem = activeChar.getInventory().getPaperdollItem(8);

                if (tempItem != null && tempItem.isWear()) return;

                }

                else if (tempBodyPart == 0x8000) // fullbody armor

                {

                // this may not remove chest or leggins

                tempItem = activeChar.getInventory().getPaperdollItem(10);

                if (tempItem != null && tempItem.isWear()) return;

               

                tempItem = activeChar.getInventory().getPaperdollItem(11);

                if (tempItem != null && tempItem.isWear()) return;

                }

 

if (item.getEnchantLevel() > 0)

{

sm = new SystemMessage(SystemMessageId.S1_S2_EQUIPPED);

sm.addNumber(item.getEnchantLevel());

sm.addItemName(item);

}

else

{

sm = new SystemMessage(SystemMessageId.S1_EQUIPPED);

sm.addItemName(item);

}

activeChar.sendPacket(sm);

 

            // Apply augementation boni on equip

            if (item.isAugmented())

            item.getAugmentation().applyBoni(activeChar);

           

items = activeChar.getInventory().equipItemAndRecord(item);

 

            // Consume mana - will start a task if required; returns if item is not a shadow item

            item.decreaseMana(false);

                }

                sm = null;

 

                activeChar.refreshExpertisePenalty();

               

                if (item.getItem().getType2() == L2Item.TYPE2_WEAPON)

                    activeChar.checkIfWeaponIsAllowed();

 

                activeChar.abortAttack();

 

activeChar.sendPacket(new EtcStatusUpdate(activeChar));

// if an "invisible" item has changed (Jewels, helmet),

// we dont need to send broadcast packet to all other users

if (!((item.getItem().getBodyPart()&L2Item.SLOT_HEAD)>0

|| (item.getItem().getBodyPart()&L2Item.SLOT_NECK)>0

|| (item.getItem().getBodyPart()&L2Item.SLOT_L_EAR)>0

|| (item.getItem().getBodyPart()&L2Item.SLOT_R_EAR)>0

|| (item.getItem().getBodyPart()&L2Item.SLOT_L_FINGER)>0

|| (item.getItem().getBodyPart()&L2Item.SLOT_R_FINGER)>0

)) {

activeChar.broadcastUserInfo();

InventoryUpdate iu = new InventoryUpdate();

iu.addItems(Arrays.asList(items));

activeChar.sendPacket(iu);

} else if ((item.getItem().getBodyPart()&L2Item.SLOT_HEAD)>0) {

InventoryUpdate iu = new InventoryUpdate();

iu.addItems(Arrays.asList(items));

activeChar.sendPacket(iu);

activeChar.sendPacket(new UserInfo(activeChar));

} else {

// because of complicated jewels problem i'm forced to resend the item list :(

activeChar.sendPacket(new ItemList(activeChar,true));

activeChar.sendPacket(new UserInfo(activeChar));

}

            }

            else

            {

                L2Weapon weaponItem = activeChar.getActiveWeaponItem();

                int itemid = item.getItemId();

                //_log.debug("item not equipable id:"+ item.getItemId());

                if (itemid == 4393)

                {

                    activeChar.sendPacket(new ShowCalculator(4393));

                }

                else if ((weaponItem != null && weaponItem.getItemType() == L2WeaponType.ROD)

                        && ((itemid >= 6519 && itemid <= 6527) || (itemid >= 7610 && itemid <= 7613) || (itemid >= 7807 && itemid <= 7809) || (itemid >= 8484 && itemid <= 8486) || (itemid >= 8505 && itemid <= 8513)))

                {

                    activeChar.getInventory().setPaperdollItem(Inventory.PAPERDOLL_LHAND, item);

                    activeChar.broadcastUserInfo();

                    // Send a Server->Client packet ItemList to this L2PcINstance to update left hand equipement

                    ItemList il = new ItemList(activeChar, false);

                    sendPacket(il);

                    return;

                }

                else

                {

                    IItemHandler handler = ItemHandler.getInstance().getItemHandler(itemId);

                   

                    if (handler == null)

                        _log.debug("No item handler registered for item ID " + itemId + ".");

                    else

                        handler.useItem(activeChar, item);

                }

            }

//      }

    }

 

    @Override

    public String getType()

    {

        return _C__14_USEITEM;

    }

}

 

  • 0
Posted

hmmm. ok then. locate that code in your java file:

 

if (activeChar.isInOlympiadMode()
                        && (
                                bodyPart == L2Item.SLOT_LR_HAND
                                || bodyPart == L2Item.SLOT_L_HAND
                                || bodyPart == L2Item.SLOT_R_HAND
                            )
                        && (
                                (item.getItemId() >= 6611 && item.getItemId() <= 6621) ||
                                item.getItemId() == 6842
                            )
                    )
                {
                    return;
                }

 

and do the same for all your items.

item.getItemId() == 6611 || item.getItemId() == 6621) || item.getItemId() == 6842

and add as much as you want. hope this will work Oo

  • 0
Posted

A new problem just come out.As i edited useitem.java is impossible for them to equip epic inside olympiad..But i stuck on 1 thing.It's possible for them to have epic equiped from before and then in olympiad epic doesn't get unequiped.I know i have to edit the olympiad.java and i successed removing a weapon when someone teleports to the olympiad stadium,but i can't success on making an armor possible when somebody teleports to get removed.I edited olympiad java this way

                                wpn.getItemId() == 6842 || wpn.getItemId() == 9450 ||

                                wpn.getItemId() == 9451 || wpn.getItemId() == 9452 ||

                                wpn.getItemId() == 9453 || wpn.getItemId() == 9454 ||

                                wpn.getItemId() == 9455 || wpn.getItemId() == 9456 ||

                                wpn.getItemId() == 9457 || wpn.getItemId() == 9458 ||

                                wpn.getItemId() == 9459 || wpn.getItemId() == 9460 ||

                                wpn.getItemId() == 9461 || wpn.getItemId() == 9462 ||

 

to make it impossible wear epic (ids~>9450-9462) but after this edit i have to edit one more thing..above of them this code

                    L2ItemInstance wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

                    if (wpn == null) wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);

 

i added the following code

 

                     wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD);

                                     wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES);

                                     wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);

                     wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS);

                                     wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET);

 

but again epic is not unequiped when somebody teleports.Guess what!I need help :P.

I am sure that the problem is at the above code as the PAPERDOLL_RHAND and PAPERDOLL_LRHAND are working perfectly.So i think i am mistaken at the code..

 

  • 0
Posted

where did you added the command to unequip the items when going to olympiad? try add it here (not sure but ok, i am trying:P)

 

L2PCinstance.java

 

public final void onTeleported()
{
	super.onTeleported();

	getKnownList().updateKnownObjects();

	if ((Config.PLAYER_SPAWN_PROTECTION > 0) && !isInOlympiadMode())
		setProtection(true);

	// Modify the position of the tamed beast if necessary (normal pets are handled by super...though
	// L2PcInstance is the only class that actually has pets!!! )
	if (getTrainedBeast() != null)
	{
		getTrainedBeast().getAI().stopFollow();
		getTrainedBeast().teleToLocation(getPosition().getX() + Rnd.get(-100, 100), getPosition().getY() + Rnd.get(-100, 100), getPosition().getZ(), false);
		getTrainedBeast().getAI().startFollow(this);
	}
	// Modify the position of the pet if necessary
	L2Summon pet = getPet();
	if (pet != null)
	{
		pet.setFollowStatus(false);
		pet.teleToLocation(getPosition().getX() + Rnd.get(-100, 100), getPosition().getY() + Rnd.get(-100, 100), getPosition().getZ(), false);
		((L2SummonAI)getPet().getAI()).setStartFollowController(true);
		pet.setFollowStatus(true);
		sendPacket(new PetInfo(pet));
		pet.updateEffectIcons(true);
	}
}

 

and add:

 

if (isInOlympiadMode())
commands here;
commands here;

  • 0
Posted

It seems to be ok but you don't give me the commands.You just write commands here and i have no idea what i have to put there :D

  • 0
Posted

hmmm. i dont know whats the exact command. but i think it will be something like this:

 

activeChar.getInventory().unEquipItemInBodySlotAndRecord(slot);

 

but dunno what to add in (slot); Oo

  • 0
Posted

Well i don't think i have to edit L2PcInstance cause i managed to make a weapon unequipable and when someone teleports at olympiad stadium to get removed.So i am making an error at the code i poste at this reply-> http://www.maxcheaters.com/forum/index.php?topic=39066.msg267586#msg267586

 

if i just could fix this!!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Hello guys I wanna buy some  Lessons for an L2J Developer
    • Let me give you something for inspiration and get you addicted to bot AI     And a siege 😛     What I have notice helps a lot the LLM to act real, is to give it a real-persons background. So for each LLM in the context beggining, besides the L2 facts, give it a real-life back story "You are a 67 years old retired nurse who plays Lineage 2 while her husband reads his newspaper, you are calm, collected but get mad if insulted". But that makes for a creative bot but its repetitive. So what you can also do, is pick random 20 news sites and for each bot every 2-3 days, initialize a context that is affected by the "news" the bot reads in the "real world".  So for example there's Iran - US war ok ? You take the news, put it in an LLM and ask it, extract the "abstract feelings" that this news piece invokes into you without mentioning anything related to the news. Then you take the result and inject it to the bots LLM prompt after its backstory.  This leads to some VERY human-like behavior from bots. 
    • 🚀 Telonyx Contest Platform Telegram Native Giveaway & Contest System for Modern Communities 💎 White-Label • Self-Hosted • Telegram Mini App • Monetization Ready 🧠 Product Overview Telonyx Contest Platform is a production-ready Telegram Mini App system designed for running modern contests, giveaways and engagement campaigns directly inside Telegram. It replaces outdated bot-based mechanics with a fully interactive application experience — no commands, no chat spam, no external websites. Users interact with a clean, fast and mobile-first interface inside Telegram. ⚡ Core Experience Participants can: • 🚀 instantly join contests inside Telegram Mini App • 🎁 view prizes and participation rules • 📊 track real-time contest status • ✅ verify task completion automatically • 🏆 receive winner results and notifications • 💰 participate in free or paid campaigns Everything is fully native to Telegram. 🧩 Key Platform Capabilities 🎯 Contest Engine • advanced contest creation system • multiple winners and reward tiers • scheduled launches and auto-finish logic • contest duplication and templates • real-time participant tracking • flexible rule configuration 📱 Mini App Interface • modern Telegram Mini App UX • mobile-first optimized layout • fast loading and smooth transitions • participant counter & live status • prize showcase system • one-click participation flow 🔎 Task Verification System Automated validation of participation rules: • Telegram channel subscriptions • sponsor channel requirements • multi-channel verification logic • YouTube subscription checks • TikTok task validation ❌ Zero manual moderation required 🛡 Anti-Fraud & Security Layer • duplicate entry prevention • bot detection system • CAPTCHA integration • rule enforcement engine • participation integrity checks 🏆 Automated Winner Selection • fully automated draw system • transparent winner selection logic • instant result publishing • winner notification system • historical archive of all contests 💎 Telegram Stars Monetization • optional paid participation via Telegram Stars • native Telegram checkout integration • flexible entry pricing per campaign • direct monetization of engagement traffic 🌍 Multi-Language Architecture Built with localization in mind. Supported out of the box: • 🇬🇧 English • 🇷🇺 Russian • 🇺🇦 Ukrainian • 🇹🇷 Turkish • 🇪🇸 Spanish • 🇵🇹 Portuguese • ➕ extensible language system for custom localization All UI layers, notifications and admin panel can be fully translated per deployment. 🎯 Ideal Use Cases 🎮 Gaming Projects / Lineage II Servers • pre-launch hype campaigns • donation reward giveaways • VIP / premium account distribution • promo code campaigns • server opening events 🎥 Streamers & Creators • subscriber engagement campaigns • live stream giveaways • audience growth funnels • partnership promotions 🌐 Communities & Brands • automated engagement systems • viral marketing campaigns • audience retention mechanics 🏗 Architecture & Deployment • Telegram Mini App frontend • FastAPI backend architecture • PostgreSQL database layer • Redis caching system • Docker-based deployment • WebSocket real-time updates • REST API integration layer 📦 Self-hosted deployment — full control over infrastructure and data 🎨 White-Label & Customization Each installation can be fully customized: • complete UI/UX rebranding • project-specific visual identity • custom engagement mechanics • referral & viral systems • loyalty & progression systems • seasonal campaign modules • custom API integrations   💡 Why This Platform Traditional contest bots are limited, noisy and inefficient. Telonyx Contest Platform is a modern engagement layer for Telegram ecosystems — combining UX, automation and monetization in one system. ✔ Higher participation rate ✔ Lower friction ✔ Direct revenue via Telegram Stars ✔ Full control via self-hosted deployment 💼 Commercial Model • Single License (Self-Hosted Deployment) • White-Label Branding Rights • Optional Custom Development • Installation & Setup Service 📩 Contact For demo access, licensing details or custom implementation: @se1dhe @telonyx_dev  
    • https://discord.gg/acvqx9rbhy Added intelligent agent that reads scripts and config and provides infos to players regarding gameplay Like where to farm/max enchants etc etc   Added auto translate to En/ES/BR htmls without api
    • The core strength of Novproxy Perfectly unlock overseas AI large models: 100% pure residential IP, perfectly bypassing various strict risk controls such as ChatGPT, Claude, Midjourney, etc. This is an essential tool for parents to train AI on weekends and during work! Available in 195+ countries/regions worldwide: covering an extremely wide range. Whether it's setting up accounts for cross-border e-commerce, conducting overseas web crawling, or conducting network gray-scale tests, it can all be handled easily. Ultra-fast concurrency: Real residential network, stable and non-blocking, high-concurrency business can also run at full capacity.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..