Jump to content

tensador27

Members
  • Posts

    25
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by tensador27

  1. hello I was looking for something similar to that code in frozen but the closest thing I found was this but I can't find something that says how much slot it shows depending on the class level L2PcInstance /** * Return the number of Henna empty slot of the L2PcInstance.<BR> * <BR> * @return the henna empty slots */ public int getHennaEmptySlots() { int totalSlots = 1 + getClassId().level(); for (int i = 0; i < 3; i++) { if (_henna[i] != null) { totalSlots--; } } if (totalSlots <= 0) { return 0; } return totalSlots; } and something that I forgot to say the npc adds them to the dyes but does not show them in the inventory
  2. does not show the dye bar https://prnt.sc/4988fu Hello, I am adding a new class, everything works fine, but the dye bar is not added where it should be added so that the new class shows the bar.
  3. hello, sorry, the nuisance, I managed to make the npc only see the one who calls them and that they disappear 60 seconds after using the item, I also made it so that they cannot spam the item but I can't get the npc to be automatically deleted when moving the player because I don't know where the player's movement is this is how spawnservitors is public void spawnServitors() { /** The _player. */ final L2PcInstance _player; _player = L2PcInstance.this; InstanceManager.getInstance().createInstance(getObjectId()); L2Spawn servitor; float angle = Rnd.get(1000); int sCount = 4; for (int i = 0; i < sCount; i++) { final L2Spawn npc = servitor = getNpcServitor(i); if (servitor != null) { servitor.setInstanceId(getObjectId()); _player.setInstanceId(_player.getObjectId()); _player.getAppearance().setInvisible(); servitor.setLocx(Math.round(getX() + (float) Math.cos(angle / 1000 * 2 * Math.PI) * 30)); servitor.setLocy(Math.round(getY() + (float) Math.sin(angle / 1000 * 2 * Math.PI) * 65)); servitor.setLocz(getZ()); int heading = (int) Math.round(Math.atan2(getY() - servitor.getLocy(), getX() - servitor.getLocx()) / Math.PI * 32768); if (heading < 0) { heading = 65535 + heading; } servitor.setHeading(heading); if (InstanceManager.getInstance().getInstance(getObjectId()) != null) { servitor.doSpawn(); ThreadPoolManager.getInstance().scheduleGeneral(() -> npc.getLastSpawn().decayMe(), 60000); } if (_player.isMoving() || !isInsideRadius(_player, Config.NPC_MAGIC_GEM_RADIUS, false, false)) { ThreadPoolManager.getInstance().scheduleGeneral(() -> npc.getLastSpawn().decayMe(), 1000); _player.setInstanceId(0); } } angle += 1000 / sCount; } } and this is the part of the item if (!player.getFloodProtectors().getMagicGem().tryPerformAction("Magic Gem")) { return; } if (!GrandBossManager.getInstance().checkIfInZone(null, player) && player.getInstanceId() == 0 && !player.isInsideZone(ZoneId.ZONE_PVP) && (!player.isInsideZone(ZoneId.ZONE_NOSUMMONFRIEND) || !player.isInsideZone(ZoneId.ZONE_TOWN)) && !player.isInOlympiadMode() && !AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && InstanceManager.getInstance().getInstance(player.getObjectId()) == null && player.getPvpFlag() == 0) { player.spawnServitors(); player.sendMessage("You use a Magic Gem."); ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() { @Override public void run() { player.setInstanceId(0); player.getAppearance().setVisible(); } }, 59000); } else { player.sendMessage("You cannot use a Magic Gem right now."); }
  4. Thanks for the help I will try to do it and now it is only that after 60 seconds the npc will be deleted by themselves
  5. Is there something in acis to guide me in attaching the npc to the player?
  6. the first thing to disappear when the player moves
  7. hello i found the magic gem code from the source l2jtenkai and i wanted to try it in interlude but i have some problems I don't know how to make it only be used once to avoid spam and if the player moves the npc disappear I leave a video for you to see https://www.youtube.com/watch?v=BRpk92UzuLc&feature=youtu.be Item MagicGem.java package net.sf.l2j.gameserver.handler.itemhandlers; import net.sf.l2j.A.Instance.InstanceManager; import net.sf.l2j.gameserver.data.xml.SummonItemData; import net.sf.l2j.gameserver.enums.ZoneId; import net.sf.l2j.gameserver.handler.IItemHandler; import net.sf.l2j.gameserver.model.actor.Playable; import net.sf.l2j.gameserver.model.actor.Player; import net.sf.l2j.gameserver.model.holder.IntIntHolder; import net.sf.l2j.gameserver.model.item.instance.ItemInstance; import net.sf.l2j.gameserver.network.SystemMessageId; public class MagicGem implements IItemHandler { @Override public void useItem(Playable playable, ItemInstance item, boolean forceUse) { if (!(playable instanceof Player)) { return; } Player player = (Player) playable; if (player.isSitting()) { player.sendPacket(SystemMessageId.CANT_MOVE_SITTING); return; } if (player.isMoving()) { player.sendPacket(SystemMessageId.CANNOT_EXCHANCE_USED_ITEM); return; } if (player.isInObserverMode()) return; if (player.isAllSkillsDisabled() || player.getCast().isCastingNow()) return; final IntIntHolder sitem = SummonItemData.getInstance().getSummonItem(item.getItemId()); if ((player.getSummon() != null || player.isMounted()) && sitem.getValue() > 0) { player.sendPacket(SystemMessageId.SUMMON_ONLY_ONE); return; } if (player.getAttack().isAttackingNow()) { player.sendPacket(SystemMessageId.YOU_CANNOT_SUMMON_IN_COMBAT); return; } if (player.getInstanceId() == 0 && !player.isInsideZone(ZoneId.PVP) && (!player.isInsideZone(ZoneId.NO_SUMMON_FRIEND) || !player.isInOlympiadMode() && InstanceManager.getInstance().getInstance(player.getObjectId()) == null && player.getPvpFlag() == 0)){ player.spawnServitors(); player.sendMessage("You use a Magic Gem."); } else { player.sendMessage("You cannot use a Magic Gem right now."); } return; } } Player.java public void spawnServitors() { _instance = InstanceManager.getInstance().createInstance(); Spawn servitor; float angle = Rnd.get(1000); int sCount = 4; int lifeTime = 60; for (int i = 0; i < sCount; i++) { servitor = getNpcServitor(i); if (servitor != null) { servitor.setInstanceId(_instance.getId()); servitor.setLoc(Math.round(getX() + (float) Math.cos(angle / 1000 * 2 * Math.PI) * 30), Math.round(getY() + (float) Math.sin(angle / 1000 * 2 * Math.PI) * 30), getZ() + 75, i); int heading = (int) Math .round(Math.atan2(getY() - servitor.getLocY(), getX() - servitor.getLocX()) / Math.PI * 32768); if (heading < 0) { heading = 65535 + heading; } servitor.setHeading(heading); if (_instance != null) { final Npc npc = servitor.doSpawn(); npc.scheduleDespawn(lifeTime * 1000L); } } angle += 1000 / sCount; } } // Magic Gem private Spawn[] _npcServitors = new Spawn[4]; public Spawn getNpcServitor(int id) { if (_npcServitors[id] != null) { return _npcServitors[id]; } Spawn spawn = null; try { NpcTemplate tmpl; switch (id) { case 0: tmpl = NpcData.getInstance().getTemplate(7); break; case 1: tmpl = NpcData.getInstance().getTemplate(50006); break; case 2: tmpl = NpcData.getInstance().getTemplate(30080); break; default: tmpl = NpcData.getInstance().getTemplate(30103); } spawn = new Spawn(tmpl); } catch (Exception e) { e.printStackTrace(); } _npcServitors[id] = spawn; return _npcServitors[id]; } I'd appreciate your help
  8. ConectionPool.java add this private static final CLogger LOGGER = new CLogger(ConnectionPool.class.getName()); + private static ConnectionPool _instance; public static Connection getConnection() throws SQLException { return _source.getConnection(); } + public static ConnectionPool getInstance() + { + if (_instance == null) + { + _instance = new ConnectionPool(); + } + + return _instance; + }
  9. hello i have this only problem in l2jfrozen
  10. with setinvisible could the name be hidden? hello I have a problem with the target issue it works but if the player is gm you can't target another player if (Config.PROTECT_TARGET_ADM_ENABLE) { if (isGM() != player.isGM()) { player.sendPacket(ActionFailed.STATIC_PACKET); player.setTarget(null); return; } } now it works fine only one gm can target another gm if (Config.PROTECT_TARGET_ADM_ENABLE) { if (isGM() && player.isGM() == false) { player.sendPacket(ActionFailed.STATIC_PACKET); return; } }
  11. it works thanks sorry for another question but if I wanted to hide the name of the administrator it would be in that part onAction ? Hello, I remember in an interlude server in which if you passed the mouse over the administrator it showed an effect similar to that of the doors, how could you put that
  12. Hello, how could I make a player unable to target an administrator player?
  13. hello I wanted to add a second value of custom enchant value for a custom scroll or donor I tried it but when using the scroll it keeps using the common value of custom enchant value and I don't know how to make it work thanks anyway enchant config: RequestEnchantItem.java
  14. Excuse me, where do I find that?
  15. hello I have a problem with the level up animation does not appear and I do not know why any idea why it will be? Thanks also
  16. it was tested on a l2jacis 401 https://pastebin.com/deBUmvPp
  17. update code Thanks for the help
  18. hello add this do you think it would work? if(DungeonManager.getInstance().getDungeonParticipants().contains(activeChar.getObjectId())) { L2ItemInstance item = activeChar.addItemDungeon("dungeon reward", itemId, count, null, true); item.setEnchantLevel(25); activeChar.getInventory().equipItemAndRecord(item); PlayerMemo.setVar(activeChar, "delete_temp_item_" + item.getObjectId(), item.getObjectId(), System.currentTimeMillis() + (1000 *60 *60 *5)); InstanceManager.getInstance().getInstance(0); activeChar.setDungeon(null); activeChar.teleToLocation(Config.DUNGEON_SPAWN_X, Config.DUNGEON_SPAWN_Y, Config.DUNGEON_SPAWN_Z, Config.DUNGEON_SPAWN_RND); } else { activeChar.sendMessage("No puedes recibir el premio"); } I also put this if(Dungeon.isRegistered(activeChar)) { L2ItemInstance item = activeChar.addItemDungeon("dungeon reward", itemId, count, null, true); item.setEnchantLevel(25); activeChar.getInventory().equipItemAndRecord(item); PlayerMemo.setVar(activeChar, "delete_temp_item_" + item.getObjectId(), item.getObjectId(), System.currentTimeMillis() + (1000 *60 *60 *5)); InstanceManager.getInstance().getInstance(0); activeChar.setDungeon(null); activeChar.teleToLocation(Config.DUNGEON_SPAWN_X, Config.DUNGEON_SPAWN_Y, Config.DUNGEON_SPAWN_Z, Config.DUNGEON_SPAWN_RND); } and in the dungeon part I put this public static boolean isRegistered(L2PcInstance player) { return DungeonManager.getInstance().getDungeonParticipants().contains(player.getObjectId()); }
  19. any advice or basic guide to improve it thank you very much in the same way
  20. Hello, I bring you the l2jdev dungeon event adapted to l2jfrozen for me video test Update Code: https://pastebin.com/Kc61EPNc sql,html: https://www.mediafire.com/file/7z5v60myf9tf1vn/Dungeon.rar/file I don't know exactly all the credits but I leave the names of the codes I use, sorry if any are missing Credits: Anarchy, Juvenil Walker, Baggos, mkizub, G1ta0, Forsaiken Help:melron
  21. Hello, i want to share this code of an npc buffer that i adapted from fissban. Here I leave a video of how the npc works https://www.youtube.com/watch?v=H6fvw7ZFHAU&list=LL&index=1&ab_channel=L2-Terius Code L2JOrion with configuration by levels 1 to 40 from 40 to 75 and 76 to 80 https://pastebin.com/ZCYN7m5G Code L2JFROZEN /* l2jfrozen Project - www.l2jfrozen.com * * 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 com.l2jfrozen.gameserver.model.actor.instance; import java.util.concurrent.ScheduledFuture; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.ai.CtrlIntention; import com.l2jfrozen.gameserver.datatables.SkillTable; import com.l2jfrozen.gameserver.model.L2Skill; import com.l2jfrozen.gameserver.model.base.ClassId; import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed; import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillUser; import com.l2jfrozen.gameserver.network.serverpackets.MoveToPawn; import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected; import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation; import com.l2jfrozen.gameserver.skills.SkillHolder; import com.l2jfrozen.gameserver.templates.L2NpcTemplate; import com.l2jfrozen.gameserver.thread.ThreadPoolManager; /** * @author fissban * @adaptado tensador */ public class L2TeriusBuffInstance extends L2NpcInstance { private ScheduledFuture<?> _aiTask; @Override public void onAction(L2PcInstance player) { if (this != player.getTarget()) { player.setTarget(this); player.sendPacket(new MyTargetSelected(getObjectId(), 0)); player.sendPacket(new ValidateLocation(this)); } else { if (!canInteract(player)) player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); else { // Rotate the player to face the instance player.sendPacket(new MoveToPawn(player, this, L2NpcInstance.INTERACTION_DISTANCE)); if (hasRandomAnimation()) onRandomAnimation(); showMainWindow(player); // Send ActionFailed to the player in order to avoid he stucks player.sendPacket(ActionFailed.STATIC_PACKET); } } } private void showMainWindow(L2PcInstance player) { NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); html.setFile("data/html/mods/TeriusBuff.htm"); html.replace("%objectId%", String.valueOf(getObjectId())); html.replace("%npcname%", getName()); player.sendPacket(html); } private class TeriusAI implements Runnable { private final L2TeriusBuffInstance _caster; protected TeriusAI(final L2TeriusBuffInstance caster) { _caster = caster; } private final SkillHolder[] FIGHTER_BUFFS = { new SkillHolder(1352, 1), new SkillHolder(1353, 1), new SkillHolder(1415, 1), new SkillHolder(1393, 3), new SkillHolder(1392, 3), new SkillHolder(1191, 3), new SkillHolder(1189, 3), new SkillHolder(1182, 3), new SkillHolder(1392, 3), new SkillHolder(1040, 3), new SkillHolder(1036, 2), new SkillHolder(1062, 2), new SkillHolder(1045, 6), new SkillHolder(1068, 3), new SkillHolder(1035, 4), new SkillHolder(1240, 3), new SkillHolder(1242, 3), new SkillHolder(1077, 3), new SkillHolder(1086, 2), new SkillHolder(1204, 2), new SkillHolder(1268, 4), new SkillHolder(264, 1), new SkillHolder(266, 1), new SkillHolder(267, 1), new SkillHolder(268, 1), new SkillHolder(269, 1), new SkillHolder(304, 1), new SkillHolder(306, 1), new SkillHolder(308, 1), new SkillHolder(270, 1), new SkillHolder(364, 1), new SkillHolder(274, 1), new SkillHolder(275, 1), new SkillHolder(271, 1), new SkillHolder(309, 1), new SkillHolder(307, 1), new SkillHolder(272, 1), new SkillHolder(310, 1), new SkillHolder(1363, 1), new SkillHolder(1388, 3), new SkillHolder(4700, 13), new SkillHolder(1323, 1), }; private final SkillHolder[] MAGE_BUFFS = { new SkillHolder(1352, 1), new SkillHolder(1353, 1), new SkillHolder(1415, 1), new SkillHolder(1393, 3), new SkillHolder(1392, 3), new SkillHolder(1191, 3), new SkillHolder(1189, 3), new SkillHolder(1182, 3), new SkillHolder(1392, 3), new SkillHolder(1040, 3), new SkillHolder(1036, 2), new SkillHolder(1045, 6), new SkillHolder(1048, 6), new SkillHolder(1062, 2), new SkillHolder(1035, 4), new SkillHolder(1085, 3), new SkillHolder(1078, 6), new SkillHolder(1304, 3), new SkillHolder(1243, 6), new SkillHolder(1204, 2), new SkillHolder(1303, 2), new SkillHolder(1259, 4), new SkillHolder(1059, 3), new SkillHolder(266, 1), new SkillHolder(264, 1), new SkillHolder(267, 1), new SkillHolder(306, 1), new SkillHolder(308, 1), new SkillHolder(270, 1), new SkillHolder(268, 1), new SkillHolder(304, 1), new SkillHolder(273, 1), new SkillHolder(307, 1), new SkillHolder(276, 1), new SkillHolder(349, 1), new SkillHolder(277, 1), new SkillHolder(365, 1), new SkillHolder(304, 1), new SkillHolder(1413, 1), new SkillHolder(1389, 3), new SkillHolder(4702, 13), new SkillHolder(1323, 1), }; @Override public void run() { for (final L2PcInstance player : getKnownList().getKnownPlayers().values()) { if (player.isMageClass() && (player.getClassId() != ClassId.overlord) && (player.getClassId() != ClassId.warcryer)) { for (SkillHolder skills : MAGE_BUFFS) { TeriusCast(player, skills.getSkill()); } }else for (SkillHolder skills : FIGHTER_BUFFS) { TeriusCast(player, skills.getSkill()); } } } private boolean TeriusCast(final L2PcInstance player,L2Skill skill) { if (player.isDead() || !player.isVisible() || !isInsideRadius(player, 200, false, false)) return false; if (player.getFirstEffect(skill) == null) { heal(player); SkillTable.getInstance().getInfo(skill.getId(), skill.getLevel()).getEffects(player, player); skill.getEffects(_caster, player, false, false, false); broadcastPacket(new MagicSkillUser(_caster, player, skill.getId(), skill.getLevel(), Config.PROTECTOR_SKILLTIME, 0)); return true; } return false; } } static void heal(L2PcInstance activeChar) { activeChar.setCurrentHp(activeChar.getMaxHp()); activeChar.setCurrentCp(activeChar.getMaxCp()); activeChar.setCurrentMp(activeChar.getMaxMp()); } public L2TeriusBuffInstance(final int objectId, final L2NpcTemplate template) { super(objectId, template); if (_aiTask != null) { _aiTask.cancel(true); } _aiTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new TeriusAI(this), 3000, 3000); } } Code original fissban h5 l2jserver /* * Copyright (C) 2004-2013 L2J DataPack * * This file is part of L2J DataPack. * * L2J DataPack 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. * * L2J DataPack 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 custom.NpcBufferGod; /** * @autor: fissban */ import java.util.Collection; import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.datatables.SkillTable; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.base.ClassId; import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.skills.L2Skill; public class NpcBufferGOD extends AbstractNpcAI { // NPC private static final int Newbie_Helper = 32327; // Spawn state private static boolean SPAWNED = false; static final Location[] SPAWNS = { // Sacado de la DB new Location(17136, 144896, -3008, 26624), new Location(43556, -47608, -792, 36864), new Location(82385, 53283, -1488, 16384), new Location(82879, 149380, -3469, 34120), new Location(87152, -141328, -1336, 49296), new Location(111168, 221008, -3544, 0), new Location(116935, 77258, -2688, 40960), new Location(147099, 25939, -2008, 49151), new Location(148077, -55367, -2728, 32768), new Location(-84081, 243227, -3728, 9000), new Location(115632, -177996, -896, 32768), new Location(-45032, -113598, -192, 32768), new Location(12111, 16686, -4584, 63240), new Location(45475, 48359, -3056, 49152), new Location(-119692, 44504, 360, 33324), new Location(-13920, 121977, -2984, 33000), new Location(-83123, 150868, -3120, 0), }; protected NpcBufferGOD(String name, String descr) { super(name, descr); addStartNpc(Newbie_Helper); addSpawnId(Newbie_Helper); addTalkId(Newbie_Helper); if (!SPAWNED) { for (Location spawn : SPAWNS) { addSpawn(Newbie_Helper, spawn, false, 0); } SPAWNED = true; } } @Override public String onSpawn(L2Npc npc) { ThreadPoolManager.getInstance().scheduleGeneral(new BufferAI(npc), 5000); return super.onSpawn(npc); } @Override public String onTalk(L2Npc npc, L2PcInstance player) { return "32327.htm"; } protected class BufferAI implements Runnable { private final L2Npc _npc; // Skills private final SkillHolder HASTE_1 = new SkillHolder(4327, 1); private final SkillHolder HASTE_2 = new SkillHolder(5632, 1); private final SkillHolder CUBIC = new SkillHolder(4338, 1); private final SkillHolder[] FIGHTER_BUFFS = { new SkillHolder(4322, 1), // Wind Walk new SkillHolder(4323, 1), // Shield new SkillHolder(5637, 1), // Magic Barrier new SkillHolder(4324, 1), // Bless the Body new SkillHolder(4325, 1), // Vampiric Rage new SkillHolder(4326, 1), // Regeneration }; private final SkillHolder[] MAGE_BUFFS = { new SkillHolder(4322, 1), // Wind Walk new SkillHolder(4323, 1), // Shield new SkillHolder(5637, 1), // Magic Barrier new SkillHolder(4328, 1), // Bless the Soul new SkillHolder(4329, 1), // Acumen new SkillHolder(4330, 1), // Concentration new SkillHolder(4331, 1), // Empower }; private final SkillHolder[] SUMMON_BUFFS = { new SkillHolder(4322, 1), // Wind Walk new SkillHolder(4323, 1), // Shield new SkillHolder(5637, 1), // Magic Barrier new SkillHolder(4324, 1), // Bless the Body new SkillHolder(4325, 1), // Vampiric Rage new SkillHolder(4326, 1), // Regeneration new SkillHolder(4328, 1), // Bless the Soul new SkillHolder(4329, 1), // Acumen new SkillHolder(4330, 1), // Concentration new SkillHolder(4331, 1), // Empower }; protected BufferAI(L2Npc caster) { _npc = caster; } @Override public void run() { if ((_npc == null) || !_npc.isVisible()) { return; } Collection<L2PcInstance> plrs = _npc.getKnownList().getKnownPlayers().values(); for (L2PcInstance player : plrs) { if ((player == null) || player.isInvul() || player.isDead() || (player.getLevel() > 75) || (player.getLevel() < 6) || player.isCursedWeaponEquipped() || (player.getKarma() != 0) || !_npc.isInsideRadius(player, 500, false, false)) { continue; } // summons if ((player.getSummon() != null) && player.getSummon().isServitor()) { for (SkillHolder skills : SUMMON_BUFFS) { CastSummon(player.getSummon(), skills.getSkill()); } if (player.getLevel() > 40) { CastSummon(player.getSummon(), HASTE_2.getSkill()); } else { CastSummon(player.getSummon(), HASTE_1.getSkill()); } } // magos if (player.isMageClass() && (player.getClassId() != ClassId.overlord) && (player.getClassId() != ClassId.warcryer)) { for (SkillHolder skills : MAGE_BUFFS) { CastPlayer(player, skills.getSkill()); } } // warrios else { for (SkillHolder skills : FIGHTER_BUFFS) { CastPlayer(player, skills.getSkill()); } if (player.getLevel() > 40) { CastPlayer(player, HASTE_2.getSkill()); } else { CastPlayer(player, HASTE_1.getSkill()); } } if ((player.getLevel() >= 16) && (player.getLevel() <= 34)) { player.doSimultaneousCast(CUBIC.getSkill()); } } ThreadPoolManager.getInstance().scheduleGeneral(this, 3000); } // metodo para los players private boolean CastPlayer(L2PcInstance player, L2Skill skill) { if (player.getFirstEffect(skill) == null) { skill.getEffects(_npc, player); SkillTable.getInstance().getInfo(skill.getId(), skill.getLevel()).getEffects(player, player); return true; } return false; } // metodo para los summons private boolean CastSummon(L2Summon summon, L2Skill skill) { if (summon.getFirstEffect(skill) == null) { skill.getEffects(_npc, summon); SkillTable.getInstance().getInfo(skill.getId(), skill.getLevel()).getEffects(summon, summon); return true; } return false; } } public static void main(String[] args) { new NpcBufferGOD(NpcBufferGOD.class.getSimpleName(), "ai/npc"); } } htm: https://www.mediafire.com/file/vd5hy2cjfwf2lzj/TeriusBuff.htm/file
  22. /* * Copyright (C) 2004-2013 L2J DataPack * * This file is part of L2J DataPack. * * L2J DataPack 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. * * L2J DataPack 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 custom.NpcBufferGod; /** * @autor: fissban */ import java.util.Collection; import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.datatables.SkillTable; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.base.ClassId; import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.skills.L2Skill; public class NpcBufferGOD extends AbstractNpcAI { // NPC private static final int Newbie_Helper = 32327; // Spawn state private static boolean SPAWNED = false; static final Location[] SPAWNS = { // Sacado de la DB new Location(17136, 144896, -3008, 26624), new Location(43556, -47608, -792, 36864), new Location(82385, 53283, -1488, 16384), new Location(82879, 149380, -3469, 34120), new Location(87152, -141328, -1336, 49296), new Location(111168, 221008, -3544, 0), new Location(116935, 77258, -2688, 40960), new Location(147099, 25939, -2008, 49151), new Location(148077, -55367, -2728, 32768), new Location(-84081, 243227, -3728, 9000), new Location(115632, -177996, -896, 32768), new Location(-45032, -113598, -192, 32768), new Location(12111, 16686, -4584, 63240), new Location(45475, 48359, -3056, 49152), new Location(-119692, 44504, 360, 33324), new Location(-13920, 121977, -2984, 33000), new Location(-83123, 150868, -3120, 0), }; protected NpcBufferGOD(String name, String descr) { super(name, descr); addStartNpc(Newbie_Helper); addSpawnId(Newbie_Helper); addTalkId(Newbie_Helper); if (!SPAWNED) { for (Location spawn : SPAWNS) { addSpawn(Newbie_Helper, spawn, false, 0); } SPAWNED = true; } } @Override public String onSpawn(L2Npc npc) { ThreadPoolManager.getInstance().scheduleGeneral(new BufferAI(npc), 5000); return super.onSpawn(npc); } @Override public String onTalk(L2Npc npc, L2PcInstance player) { return "32327.htm"; } protected class BufferAI implements Runnable { private final L2Npc _npc; // Skills private final SkillHolder HASTE_1 = new SkillHolder(4327, 1); private final SkillHolder HASTE_2 = new SkillHolder(5632, 1); private final SkillHolder CUBIC = new SkillHolder(4338, 1); private final SkillHolder[] FIGHTER_BUFFS = { new SkillHolder(4322, 1), // Wind Walk new SkillHolder(4323, 1), // Shield new SkillHolder(5637, 1), // Magic Barrier new SkillHolder(4324, 1), // Bless the Body new SkillHolder(4325, 1), // Vampiric Rage new SkillHolder(4326, 1), // Regeneration }; private final SkillHolder[] MAGE_BUFFS = { new SkillHolder(4322, 1), // Wind Walk new SkillHolder(4323, 1), // Shield new SkillHolder(5637, 1), // Magic Barrier new SkillHolder(4328, 1), // Bless the Soul new SkillHolder(4329, 1), // Acumen new SkillHolder(4330, 1), // Concentration new SkillHolder(4331, 1), // Empower }; private final SkillHolder[] SUMMON_BUFFS = { new SkillHolder(4322, 1), // Wind Walk new SkillHolder(4323, 1), // Shield new SkillHolder(5637, 1), // Magic Barrier new SkillHolder(4324, 1), // Bless the Body new SkillHolder(4325, 1), // Vampiric Rage new SkillHolder(4326, 1), // Regeneration new SkillHolder(4328, 1), // Bless the Soul new SkillHolder(4329, 1), // Acumen new SkillHolder(4330, 1), // Concentration new SkillHolder(4331, 1), // Empower }; protected BufferAI(L2Npc caster) { _npc = caster; } @Override public void run() { if ((_npc == null) || !_npc.isVisible()) { return; } Collection<L2PcInstance> plrs = _npc.getKnownList().getKnownPlayers().values(); for (L2PcInstance player : plrs) { if ((player == null) || player.isInvul() || player.isDead() || (player.getLevel() > 75) || (player.getLevel() < 6) || player.isCursedWeaponEquipped() || (player.getKarma() != 0) || !_npc.isInsideRadius(player, 500, false, false)) { continue; } // summons if ((player.getSummon() != null) && player.getSummon().isServitor()) { for (SkillHolder skills : SUMMON_BUFFS) { CastSummon(player.getSummon(), skills.getSkill()); } if (player.getLevel() > 40) { CastSummon(player.getSummon(), HASTE_2.getSkill()); } else { CastSummon(player.getSummon(), HASTE_1.getSkill()); } } // magos if (player.isMageClass() && (player.getClassId() != ClassId.overlord) && (player.getClassId() != ClassId.warcryer)) { for (SkillHolder skills : MAGE_BUFFS) { CastPlayer(player, skills.getSkill()); } } // warrios else { for (SkillHolder skills : FIGHTER_BUFFS) { CastPlayer(player, skills.getSkill()); } if (player.getLevel() > 40) { CastPlayer(player, HASTE_2.getSkill()); } else { CastPlayer(player, HASTE_1.getSkill()); } } if ((player.getLevel() >= 16) && (player.getLevel() <= 34)) { player.doSimultaneousCast(CUBIC.getSkill()); } } ThreadPoolManager.getInstance().scheduleGeneral(this, 3000); } // metodo para los players private boolean CastPlayer(L2PcInstance player, L2Skill skill) { if (player.getFirstEffect(skill) == null) { skill.getEffects(_npc, player); SkillTable.getInstance().getInfo(skill.getId(), skill.getLevel()).getEffects(player, player); return true; } return false; } // metodo para los summons private boolean CastSummon(L2Summon summon, L2Skill skill) { if (summon.getFirstEffect(skill) == null) { skill.getEffects(_npc, summon); SkillTable.getInstance().getInfo(skill.getId(), skill.getLevel()).getEffects(summon, summon); return true; } return false; } } public static void main(String[] args) { new NpcBufferGOD(NpcBufferGOD.class.getSimpleName(), "ai/npc"); } } author code : fissban hello I need help to adapt this code to interlude l2jfrozen or l2jacis thank you very much anyway
×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock