Jump to content

Recommended Posts

Posted

This new buffer does not replace the Adventurers' Guide only complements it.

When passing within 500 of npc this will give the buff so autoamtica.

 

In addition to implementing the code should also add to script.cfg and delete  spawnlist table so the npc spawn.

 

Written for H5 l2jserver unstable

 

Credits are mine =)

 

Sorry for my English use google translator.

 

    /*
     * 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");
        }
       
    }

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • TG Support: https://t.me/buyingproxysup | Channel: https://t.me/buyingproxycom Discord support: #buyingproxy | Server: Join the BuyingProxy Discord Server! Create your free account here  
    • I've purchased the Samurai interface. Everything went smoothly, and the interface is excellent. Highly recommended!
    • For quick reference, I’ve been using the D12 dice roller when testing dice mechanics—clean design and instant results help a lot. It might give you a solid visual template to work from as you build your own games.
    • 🪙 GoldRush — High Five x20 🪙   A fresh High Five server focused on active progression, fair competition, and a healthy player-driven economy.   GoldRush is built for players who want a fresh spin on our beloved game that is connected to today's world via Web3 marketplace.    🏅 Gold Bar & Marketplace • Gold Bars are part of the server's custom economy — they can be used in Marketplace or Cosmetics shop. • Tokens are optional and used only for server Marketplace features.   ⚙️ Server Rates • EXP: 20x • SP: 20x • Adena: 10x • Normal Drop Chance: 8x • Spoil Chance: 12x • Raid Drop Chance: 3x • Quest Item Drop Amount: 5x • Quest EXP/SP Reward: 10x • Quest Adena Reward: 5x   ✨ Enchant Rates • Max Enchant: Weapons +16 / Armors +12 • +0 to +3 armor / weapon = 100% safe • +0 to +4 full body armor = 100% safe • +4 to +6 = 66% • +7 to +9 = 60% • +10 to +12 = 54% • +13 to +14 = 48% • +15 to +16 = 42%   🛒 Alt+B Services GoldRush includes useful Alt+B services: • GM Shop up to Dynasty • Buffer 1h • Teleports • Drop Search • Rankings   🎒 Auto-Loot • Normal mob drops: auto-loot • Adena: auto-loot • Raid drops: stay on the ground • Herbs: stay on the ground   🧙 Class Progression • 1st and 2nd professions are free with shadow weapon reward. • 3rd profession: 5kk • Auto Learn Skills • Subclass - No Quest • Noblesse - Full Quest     ⚔️ Olympiad • Hero period: 1 week • Olympiad time: 18:00–00:00 server time • Match duration: 5 minutes • Max enchant in Olympiad: +6   🏰 Sieges Castle sieges take place on Sundays at 16:00 and 20:00 GMT+3. The first siege will happen 2 weeks after launch.   🐉 Grand Boss Respawn Queen Ant: 24h + 2h random Core: 30h + 2h random Orfen: 48h + 2h random Baium: 120h + 3h random Antharas: 120h + 24h random Valakas: 120h + 24h random Beleth: 120h + 24h random   ⚔️ Fair Play Bots are strictly forbidden and will result in a ban without warning. Dualbox is limited to 1 box. GoldRush is built around a healthy player-to-player economy. Website : https://www.goldrushpvp.xyz/ Discord : https://discord.com/invite/v3zRZVV6ka Guide of how to make an account on our web3 server!  
    • Patch notes of update v1.0 is done regarding some feedbacks. Added Special Buffs category to the buffer. Queen Cat, Seraphim and Dwarf equipment buffs are now available. Special buffs last 1 hour and can be saved in schemes. Players can now Shift+Click monsters to check drops and spoil directly in-game.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..