Перейти к содержанию
Авторизация  

Банки невидимости!!


Описание

При выпивании банки становитесь невидимыми. При этом можно атаковать. Эффект длится 30 минут. <br />Требуются исходники.

Находим:

target.onAction(activeChar);     }

После добавляем:

//Invisible Character can't attack         if (activeChar.getAppearance().getInvisible() && !activeChar.isGM())        return;

Создаем файл: /java/sf/net/l2j/gameserver/handler/itemhandlers/InvisiblePotion.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 .

 

*/

 

package net.sf.l2j.gameserver.handler.itemhandlers;

 

 

 

 

 

import net.sf.l2j.Config;

 

import net.sf.l2j.gameserver.ThreadPoolManager;

 

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

 

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

 

import net.sf.l2j.gameserver.model.entity.events.CTF;

 

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

 

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

 

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

 

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

 

 

 

 

 

/**

 

* @author `Аллигаторы®™

 

*

 

*/

 

 

 

 

 

public class InvisiblePotion implements IItemHandler

 

{

 

private static final int[] ITEM_IDS = { 9996 }; //Item ID

 

 

 

private static final int INVISIBLE_POTION_SKILL = 9007; //Skill ID

 

 

 

private static final int EFFECT_DURATION = 1200000; // 20 mins, 20 * 60 * 1000 = 1200000

 

 

 

 

 

public void useItem(L2PlayableInstance playable, L2ItemInstance item)

 

{

 

if (!(playable instanceof L2PcInstance))

 

return;

 

L2PcInstance activeChar = (L2PcInstance) playable;

 

if (activeChar.isHero())

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if (activeChar.isConfused())

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if (activeChar.isSilentMoving())

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if (activeChar.isDead())

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if (activeChar.isAlikeDead())

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if (activeChar.isFestivalParticipant())

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if (activeChar.isInFunEvent())

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if (activeChar.inObserverMode())

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if (activeChar.isInOlympiadMode())

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if (activeChar.getPvpFlag() != 0)

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if (activeChar.isCastingNow())

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

if ((activeChar._inEventCTF && CTF._started && !Config.CTF_ALLOW_POTIONS))

 

{

 

activeChar.sendPacket(new ActionFailed());

 

}

 

 

 

 

 

MagicSkillUser MSU = new MagicSkillUser(playable, playable, 9007, 1, 0, 0);

 

activeChar.sendPacket(MSU);

 

activeChar.broadcastPacket(MSU);

 

 

 

 

 

activeChar.getAppearance().setInvisible();

 

activeChar.broadcastUserInfo();

 

activeChar.decayMe();

 

activeChar.spawnMe();

 

activeChar.sendMessage("You Are Now Invisible " + EFFECT_DURATION / 1000 / 60 + " min."); //Выводит сообщение в чат.

 

activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);

 

 

 

 

 

InvisiblePotionStop mp = new InvisiblePotionStop(playable);

 

ThreadPoolManager.getInstance().scheduleEffect(mp, EFFECT_DURATION);

 

}

 

 

 

 

 

public class InvisiblePotionStop implements Runnable

 

{

 

private L2PlayableInstance _playable;

 

 

 

 

 

public InvisiblePotionStop(L2PlayableInstance playable)

 

{

 

_playable = playable;

 

}

 

 

 

 

 

public void run()

 

{

 

try

 

{

 

if (!(_playable instanceof L2PcInstance))

 

return;

 

 

 

 

 

((L2PcInstance) _playable).getAppearance().setVisible();

 

((L2PcInstance) _playable).sendMessage("You Are Now Visable!");

 

((L2PcInstance) _playable).broadcastUserInfo();

 

}

 

catch (Throwable t)

 

{

 

}

 

}

 

}

 

 

 

 

 

public int[] getItemIds()

 

{

 

return ITEM_IDS;

 

}

 

}

 

 

Открываем: /java/net/sf/l2j/gameserver/handler/ItemHandler.java

 

Добавляем импорты:

import net.sf.l2j.gameserver.handler.itemhandlers.InvisiblePotion;

Ниже добавим:

registerItemHandler(new InvisiblePotion())

Открываем:

 

/java/net/sf/l2j/Config.java

 

Добавляем:

// Invisible Potions    public static boolean CTF_ALLOW_POTIONS; public static int CTF_EFFECT_DURATION_POTIONS;

Найдем:

Properties altSettings  = new Properties();                InputStream is          = new FileInputStream(new File(ALT_SETTINGS_FILE));                 altSettings.load(is);                is.close();

И добавим:

// Invisible Potions                 CTF_ALLOW_POTIONS = Boolean.parseBoolean(l2jmodsSettings.getProperty("CTFAllowPotions", "False"));                CTF_EFFECT_DURATION_POTIONS = Integer.parseInt(l2jmodsSettings.getProperty("CTFAllowPotionsDuration", "1200000"));//Defaults 20 Min.

Откроем конфиг altsettings и добавим туда:

# Invisible potions. Defaults FalseCTFAllowPotions = False # EFFECTDURATION Default 1200000 / 20 min. 20 * 60 * 1000 = 1200000 millisecondsCTFAllowPotionsDuration = 1200000

Добавим скил:

<skill id="9007" levels="1" name="Invisible Potion">   <set name="target" val="TARGET_NONE"/>  <set name="skillType" val="NOTDONE"/>  <set name="operateType" val="OP_ACTIVE"/>  <set name="castRange" val="-1"/>  <for>  </for></skill>

Добавить предмет в базу:

INSERT INTO `etcitem` (`item_id`,`name`,`crystallizable`,`item_type`,`weight`,`consume_type`,`material`,`crystal_type`,`duration`,`price`,`crystal_count`,`sellable`,`dropable`,`destroyable`,`tradeable`,`oldname`,`oldtype`)VALUES ('9996','Invisible Potion','false','potion','180','stackable','liquid','none','-1','80','0','true','true','true','true','InterludeItem','potion');

 

Ну и естественно добавить нужные записи в клиент, для отображения банок, ну и на юзание скила.

Вроде не чего не упустил, скомпилиться должно без проблем.

 

Compiele Log

 

Buildfile: D:\workspace\l2j_pp\l2jpp_core\build.xmlcompile:

 

[javac] Compiling 2 source files to D:\workspace\l2j_pp\l2jpp_core\build\classes

 

jar:

 

[jar] Building jar: D:\workspace\l2j_pp\l2jpp_core\build\l2jpp.jar

 

[copy] Copying 1 file to D:\workspace\l2j_pp\l2jpp_core\build\dist\libraries

 

dist:

 

[zip] Building zip: D:\workspace\l2j_pp\l2jpp_core\build\L2J_PP.zip

 

BUILD SUCCESSFUL

 

Total time: 4 second



Рекомендуемые комментарии

Комментариев нет

×
×
  • Создать...