Jump to content

herneh

Members
  • Posts

    10
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

About herneh

Profile Information

  • Gender
    Not Telling

herneh's Achievements

Newbie

Newbie (1/16)

0

Reputation

  1. funciona perfecto! it works perfect
  2. perfect! txz
  3. it seems to be a fun evento! txz for sharein'!
  4. cool! txz for sharein'!
  5. good share!
  6. Here it is!!! i got it! ;) I dunno if it right but works! in L2PcInstance for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++) { - L2ItemInstance equippedItem = getInventory().getPaperdollItem(i); - if (equippedItem != null && (!equippedItem.getItem().checkCondition(this, this, false) - || (isInOlympiadMode() && equippedItem.isOlyRestrictedItem()))) + L2ItemInstance equippedItem = getInventory().getPaperdollItem(i); + if (equippedItem != null && (!equippedItem.getItem().checkCondition(this, this, false) + || (isInOlympiadMode() || (TvTEvent.isPlayerParticipant(getObjectId()) && equippedItem.isOlyRestrictedItem())))) { getInventory().unEquipItemInSlot(i); And of course I added the item 20399 in restrictions olimpyad.properties Txz man for helping me and guied me ;)
  7. I used to "work" with java when I had gracia 1 so as u've noticed Im not an expert in java, but i'm pretty sure that the code might be in TvTEventTeleporter.java I couldnt find the unequip section in olympiad.java :S here's my tvteventteleported.java perhaps i'm wrong cause i dont know too much about java, but i thing it shud be here the uneequip command /* * 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 com.l2jserver.gameserver.model.entity; import com.l2jserver.Config; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.util.Rnd; public class TvTEventTeleporter implements Runnable { /** The instance of the player to teleport */ private L2PcInstance _playerInstance = null; /** Coordinates of the spot to teleport to */ private int[] _coordinates = new int[3]; /** Admin removed this player from event */ private boolean _adminRemove = false; /** * Initialize the teleporter and start the delayed task<br><br> * * @param playerInstance as L2PcInstance<br> * @param coordinates as int[]<br> * @param fastShedule as boolean<br> * @param adminRemove as boolean<br> */ public TvTEventTeleporter(L2PcInstance playerInstance, int[] coordinates, boolean fastSchedule, boolean adminRemove) { _playerInstance = playerInstance; _coordinates = coordinates; _adminRemove = adminRemove; long delay = (TvTEvent.isStarted() ? Config.TVT_EVENT_RESPAWN_TELEPORT_DELAY : Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY) * 1000; ThreadPoolManager.getInstance().scheduleGeneral(this, fastSchedule ? 0 : delay); } /** * The task method to teleport the player<br> * 1. Unsummon pet if there is one<br> * 2. Remove all effects<br> * 3. Revive and full heal the player<br> * 4. Teleport the player<br> * 5. Broadcast status and user info<br><br> * * @see java.lang.Runnable#run()<br> */ public void run() { if (_playerInstance == null) return; L2Summon summon = _playerInstance.getPet(); if (summon != null) summon.unSummon(_playerInstance); if (Config.TVT_EVENT_EFFECTS_REMOVAL == 0 || (Config.TVT_EVENT_EFFECTS_REMOVAL == 1 && (_playerInstance.getTeam() == 0 || (_playerInstance.isInDuel() && _playerInstance.getDuelState() != Duel.DUELSTATE_INTERRUPTED)))) _playerInstance.stopAllEffectsExceptThoseThatLastThroughDeath(); if (_playerInstance.isInDuel()) _playerInstance.setDuelState(Duel.DUELSTATE_INTERRUPTED); int TvTInstance = TvTEvent.getTvTEventInstance(); if (TvTInstance != 0) { if (TvTEvent.isStarted() && !_adminRemove) { _playerInstance.setInstanceId(TvTInstance); } else { _playerInstance.setInstanceId(0); } } else { _playerInstance.setInstanceId(0); } _playerInstance.doRevive(); _playerInstance.teleToLocation( _coordinates[ 0 ] + Rnd.get(101)-50, _coordinates[ 1 ] + Rnd.get(101)-50, _coordinates[ 2 ], false ); if (TvTEvent.isStarted() && !_adminRemove) _playerInstance.setTeam(TvTEvent.getParticipantTeamId(_playerInstance.getObjectId()) + 1); else _playerInstance.setTeam(0); _playerInstance.setCurrentCp(_playerInstance.getMaxCp()); _playerInstance.setCurrentHp(_playerInstance.getMaxHp()); _playerInstance.setCurrentMp(_playerInstance.getMaxMp()); _playerInstance.broadcastStatusUpdate(); _playerInstance.broadcastUserInfo(); } } Here I found the item restriction unequip for the olympiads, is in L2PcInstance, I tried to add the same for tvtevent but nothing happned =( i'm a total newbie in java I know I know! public void checkItemRestriction() { for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++) { L2ItemInstance equippedItem = getInventory().getPaperdollItem(i); if (equippedItem != null && (!equippedItem.getItem().checkCondition(this, this, false) || (isInOlympiadMode() && equippedItem.isOlyRestrictedItem()))) { getInventory().unEquipItemInSlot(i); InventoryUpdate iu = new InventoryUpdate(); iu.addModifiedItem(equippedItem); sendPacket(iu); SystemMessage sm = null; if (equippedItem.getItem().getBodyPart() == L2Item.SLOT_BACK) { sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CLOAK_REMOVED_BECAUSE_ARMOR_SET_REMOVED)); return; } if (equippedItem.getEnchantLevel() > 0) { sm = SystemMessage.getSystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED); sm.addNumber(equippedItem.getEnchantLevel()); sm.addItemName(equippedItem); } else { sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISARMED); sm.addItemName(equippedItem); } sendPacket(sm); } } }
  8. I really apreciate wat u did man! It worked!!! TXZZZZZZZZZZZZZZZZZZZ if (TvTEvent.isPlayerParticipant(activeChar.getObjectId()) && TvTEvent.isStarted() && _itemId == 20399) { return; } :) I'm going to ask you for a final question... If I want to UNEQUIP this item, when i'm being teletransported to TvTEvent, I would have modify TvTEvent.java right? smth like unequip item when being teletransported to olympiad stadium?
  9. /* * 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 com.l2jserver.gameserver.network.clientpackets; import java.util.logging.Logger; import com.l2jserver.Config; import com.l2jserver.gameserver.GameTimeController; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.handler.IItemHandler; import com.l2jserver.gameserver.handler.ItemHandler; import com.l2jserver.gameserver.instancemanager.FortSiegeManager; import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.base.Race; import com.l2jserver.gameserver.model.itemcontainer.Inventory; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.ItemList; import com.l2jserver.gameserver.network.serverpackets.ShowCalculator; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.templates.item.L2ArmorType; import com.l2jserver.gameserver.templates.item.L2Item; import com.l2jserver.gameserver.templates.item.L2Weapon; import com.l2jserver.gameserver.templates.item.L2WeaponType; /** * This class ... * * @version $Revision: 1.18.2.7.2.9 $ $Date: 2005/03/27 15:29:30 $ */ public final class UseItem extends L2GameClientPacket { private static Logger _log = Logger.getLogger(UseItem.class.getName()); private static final String _C__14_USEITEM = "[C] 14 UseItem"; private int _objectId; private boolean _ctrlPressed; private int _itemId; /** Weapon Equip Task */ public static class WeaponEquipTask implements Runnable { L2ItemInstance item; L2PcInstance activeChar; public WeaponEquipTask(L2ItemInstance it, L2PcInstance character){ item = it; activeChar = character; } @Override public void run() { //If character is still engaged in strike we should not change weapon if (activeChar.isAttackingNow()) return; // Equip or unEquip activeChar.useEquippableItem(item, false); } } @Override protected void readImpl() { _objectId = readD(); _ctrlPressed = readD() != 0; } @Override protected void runImpl() { L2PcInstance activeChar = getClient().getActiveChar(); if (activeChar == null) return; // Flood protect UseItem if (!getClient().getFloodProtectors().getUseItem().tryPerformAction("use item")) return; if (activeChar.getPrivateStoreType() != 0) { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_TRADE_DISCARD_DROP_ITEM_WHILE_IN_SHOPMODE)); activeChar.sendPacket(ActionFailed.STATIC_PACKET); return; } if (activeChar.getActiveTradeList() != null) activeChar.cancelActiveTrade(); // cannot use items during Fear (possible more abnormal states?) if (activeChar.isAfraid()) { // no sysmsg activeChar.sendPacket(ActionFailed.STATIC_PACKET); return; } // NOTE: disabled due to deadlocks // synchronized (activeChar.getInventory()) // { L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId); if (item == null) return; if (item.getItem().getType2() == L2Item.TYPE2_QUEST) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CANNOT_USE_QUEST_ITEMS); activeChar.sendPacket(sm); sm = null; return; } _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 * 10129 Scroll of Escape : Fortress * 10130 Blessed Scroll of Escape : Fortress */ if (!Config.ALT_GAME_KARMA_PLAYER_CAN_TELEPORT && activeChar.getKarma() > 0) { switch (_itemId) { case 736: case 1538: case 1829: case 1830: case 3958: case 5858: case 5859: case 6663: case 6664: case 7554: case 7555: case 7556: case 7557: case 7558: case 7559: case 7618: case 7619: case 10129: case 10130: return; } if (_itemId >= 7117 && _itemId <= 7135) return; } + if (_itemid == 20399 && player.isInTvt()) (isInTvt is not a method :S) i tried to + if (_itemId == 20399 && activeChar.isPlayerParticipant(getObjectId())) (but the method objectid is undefined in useitem.java :S) if (activeChar.isFishing() && (_itemId < 6535 || _itemId > 6540)) { // You cannot do anything else while fishing SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CANNOT_DO_WHILE_FISHING_3); getClient().getActiveChar().sendPacket(sm); sm = null; return; } // Char cannot use item when dead if (activeChar.isDead()) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED); sm.addItemName(item); getClient().getActiveChar().sendPacket(sm); sm = null; return; } // No UseItem is allowed while the player is in special conditions if (activeChar.isStunned() || activeChar.isSleeping() || activeChar.isParalyzed() || activeChar.isAlikeDead() || activeChar.isAfraid() || activeChar.isCastingNow()) { return; } // Char cannot use pet items /*if ((item.getItem() instanceof L2Armor && item.getItem().getItemType() == L2ArmorType.PET) || (item.getItem() instanceof L2Weapon && item.getItem().getItemType() == L2WeaponType.PET) ) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CANNOT_EQUIP_PET_ITEM); // You cannot equip a pet item. sm.addItemName(item); getClient().getActiveChar().sendPacket(sm); sm = null; return; }*/ if (!activeChar.getInventory().canManipulateWithItemId(item.getItemId())) { activeChar.sendMessage("Cannot use this item."); return; } if (Config.DEBUG) _log.finest(activeChar.getObjectId() + ": use item " + _objectId); if (!item.isEquipped()) { if (!item.getItem().checkCondition(activeChar, activeChar, true)) { return; } } if (item.isEquipable()) { // Don't allow hero equipment and restricted items during Olympiad if (activeChar.isInOlympiadMode() && (item.isHeroItem() || item.isOlyRestrictedItem())) { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THIS_ITEM_CANT_BE_EQUIPPED_FOR_THE_OLYMPIAD_EVENT)); return; } switch (item.getItem().getBodyPart()) { case L2Item.SLOT_LR_HAND: case L2Item.SLOT_L_HAND: case L2Item.SLOT_R_HAND: { // prevent players to equip weapon while wearing combat flag if (activeChar.getActiveWeaponItem() != null && activeChar.getActiveWeaponItem().getItemId() == 9819) { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_EQUIP_ITEM_DUE_TO_BAD_CONDITION)); return; } // Prevent player to remove the weapon on special conditions if (activeChar.isCastingNow() || activeChar.isCastingSimultaneouslyNow()) { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_USE_ITEM_WHILE_USING_MAGIC)); return; } if (activeChar.isMounted()) { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_EQUIP_ITEM_DUE_TO_BAD_CONDITION)); return; } if (activeChar.isDisarmed()) { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_EQUIP_ITEM_DUE_TO_BAD_CONDITION)); return; } // Don't allow weapon/shield equipment if a cursed weapon is equiped if (activeChar.isCursedWeaponEquipped()) return; // Don't allow other Race to Wear Kamael exclusive Weapons. if (!item.isEquipped() && item.getItem() instanceof L2Weapon && !activeChar.isGM()) { L2Weapon wpn = (L2Weapon)item.getItem(); switch (activeChar.getRace()) { case Kamael: { switch (wpn.getItemType()) { case NONE: activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_EQUIP_ITEM_DUE_TO_BAD_CONDITION)); return; } break; } case Human: case Dwarf: case Elf: case DarkElf: case Orc: { switch (wpn.getItemType()) { case RAPIER: case CROSSBOW: case ANCIENTSWORD: activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_EQUIP_ITEM_DUE_TO_BAD_CONDITION)); return; } break; } } } break; } case L2Item.SLOT_CHEST: case L2Item.SLOT_BACK: case L2Item.SLOT_GLOVES: case L2Item.SLOT_FEET: case L2Item.SLOT_HEAD: case L2Item.SLOT_FULL_ARMOR: case L2Item.SLOT_LEGS: { if (activeChar.getRace() == Race.Kamael && (item.getItem().getItemType() == L2ArmorType.HEAVY ||item.getItem().getItemType() == L2ArmorType.MAGIC)) { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_EQUIP_ITEM_DUE_TO_BAD_CONDITION)); return; } break; } case L2Item.SLOT_DECO: { if (!item.isEquipped() && activeChar.getInventory().getMaxTalismanCount() == 0) { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_EQUIP_ITEM_DUE_TO_BAD_CONDITION)); return; } } } if (activeChar.isCursedWeaponEquipped() && _itemId == 6408) // Don't allow to put formal wear return; if (activeChar.isAttackingNow()) { ThreadPoolManager.getInstance().scheduleGeneral( new WeaponEquipTask(item,activeChar), (activeChar.getAttackEndTime()-GameTimeController.getGameTicks())*GameTimeController.MILLIS_IN_TICK); return; } // Equip or unEquip if (FortSiegeManager.getInstance().isCombat(item.getItemId())) return; //no message else if (activeChar.isCombatFlagEquipped()) 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.FISHINGROD) && ((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(item.getEtcItem()); if (handler == null) { if (Config.DEBUG) _log.warning("No item handler registered for item ID " + item.getItemId() + "."); } else handler.useItem(activeChar, item, _ctrlPressed); } } // } } @Override public String getType() { return _C__14_USEITEM; } @Override protected boolean triggersOnActionRequest() { return !Config.SPAWN_PROTECTION_ALLOWED_ITEMS.contains(_itemId); } } i have no idea how to put in the corect way! txz to reply, but nothing happened
  10. Hello there developers! my name is herneh, Rev: L2Jserver Freya I would like to restrict an item while in events "tvt" in this particular case, the item is "20399 labored Hat Blessed Body" i tried all I could but I havent got it yet! thats why I need your hel, I know that it would be an easy question for you, but i tried modifiing UseItem.java, TvTEvent.java adding the item restriction and I still didnt get it. I would be apreciate wheter you give me a clue or a solution Txz to all developers! Bye (EDIT) the revision
×
×
  • Create New...