Помогите пожалуйста сюда запихнуть проверку на комбат зону (чтобы итем нельзя было юзануть, пока дерёшься)
Code
/* * 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 */
public class FBuff implements IItemHandler { protected static final Logger _log = Logger.getLogger(Potions.class.getName()); private static final int[] ITEM_IDS = {1163};
private int _herbstask = 0;
private class HerbTask implements Runnable { private L2PcInstance _activeChar; private int _magicId; private int _level; HerbTask(L2PcInstance activeChar, int magicId, int level) { _activeChar = activeChar; _magicId = magicId; _level = level; } public void run() { try { usePotion(_activeChar, _magicId, _level); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } } } public synchronized void useItem(L2PlayableInstance playable, L2ItemInstance item) { L2PcInstance activeChar; if (playable instanceof L2PcInstance) activeChar = (L2PcInstance) playable; else if (playable instanceof L2PetInstance) activeChar = ((L2PetInstance) playable).getOwner(); else return; if (activeChar.isInOlympiadMode()) { activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVA ILABLE_FOR_THE_OLYMPIAD_EVENT)); return; } if (activeChar.isAllSkillsDisabled()) { activeChar.sendPacket(new ActionFailed()); return; }
/* * 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 */
public class FBuff implements IItemHandler { protected static final Logger _log = Logger.getLogger(Potions.class.getName()); private static final int[] ITEM_IDS = {1163};
private int _herbstask = 0;
private class HerbTask implements Runnable { private L2PcInstance _activeChar; private int _magicId; private int _level; HerbTask(L2PcInstance activeChar, int magicId, int level) { _activeChar = activeChar; _magicId = magicId; _level = level; } public void run() { try { usePotion(_activeChar, _magicId, _level); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } } } public synchronized void useItem(L2PlayableInstance playable, L2ItemInstance item) { L2PcInstance activeChar; if (playable instanceof L2PcInstance) activeChar = (L2PcInstance) playable; else if (playable instanceof L2PetInstance) activeChar = ((L2PetInstance) playable).getOwner(); else return; if (activeChar.isInOlympiadMode()) { activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVA ILABLE_FOR_THE_OLYMPIAD_EVENT)); return; } if (activeChar.isInCombat() && !activeChar.isGM()) { activeChar.sendMessage("You in combat mode now."); return; } if (activeChar.isAllSkillsDisabled()) { activeChar.sendPacket(new ActionFailed()); return; }
Этот метод дает проверку на НЕ гма. т.е. Если чар не гм, и использует вещь в бою, то писать месандж, затем вернуть значение)
Это 3 литра спирта и спрайта пол ведра
if (AttackStanceTaskManager.getInstance().getAttackStanceTask(activeChar)) { activeChar.sendMessage("Package will reject, a fighting zone!"); return; }
Сообщение отредактировал sashaskate - Пятница, 03.09.2010, 07:20