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

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!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...