Jump to content
  • 0

Feanor drop from specific level


Question

Posted (edited)

Hi! Could someone please halp to make Feanor event drop - min level condition? Like, drop starts from players level 20 etc?

I tired to write something like - if (player.getLevel() > 20 around drop section, or boolean for easy control through config - if (player.getLevel() >= Config.MIN_FEANOR_LEVEL), but I'm having issue  1# to set it in the right place and 2# compose the implement correctly, to work. Somethings wrong all the time with "player" to identify it correctly, I tried to add lines from similar examples where player.getLevel can be found, like L2PcInstance player, adding aditional imports of L2PcInstance (also tried L2World).

I tried all feanor related classes, mainly FeanorInterface class. Is there a way to do it here?

 

/*
 * 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.script.faenor;

import java.util.List;
import java.util.Map;

import javax.script.ScriptContext;

import javolution.util.FastList;

import org.apache.log4j.Logger;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.model.L2DropCategory;
import com.l2jfrozen.gameserver.model.L2DropData;
import com.l2jfrozen.gameserver.model.L2PetData;
import com.l2jfrozen.gameserver.model.entity.Announcements;
import com.l2jfrozen.gameserver.script.DateRange;
import com.l2jfrozen.gameserver.script.EngineInterface;
import com.l2jfrozen.gameserver.script.EventDroplist;
import com.l2jfrozen.gameserver.script.Expression;
import com.l2jfrozen.gameserver.templates.L2NpcTemplate;

/**
 * @author Luis Arias
 */
public class FaenorInterface implements EngineInterface
{
    protected static final Logger LOGGER = Logger.getLogger(FaenorInterface.class);
    
    public static FaenorInterface getInstance()
    {
        return SingletonHolder._instance;
    }
    
    private FaenorInterface()
    {
    }
    
    public List<?> getAllPlayers()
    {
        // TODO Auto-generated method stub
        return null;
    }
    
    /**
     * Adds a new Quest Drop to an NPC
     * @see com.l2jfrozen.gameserver.script.EngineInterface#addQuestDrop(int, int, int, int, int, String, String[])
     */
    @Override
    public void addQuestDrop(final int npcID, final int itemID, final int min, final int max, final int chance, final String questID, final String[] states)
    {
        final L2NpcTemplate npc = npcTable.getTemplate(npcID);
        if (npc == null)
        {
            LOGGER.info("FeanorInterface: Npc " + npcID + " is null..");
            return;
        }
        final L2DropData drop = new L2DropData();
        drop.setItemId(itemID);
        drop.setMinDrop(min);
        drop.setMaxDrop(max);
        drop.setChance(chance);
        drop.setQuestID(questID);
        drop.addStates(states);
        addDrop(npc, drop, false);
    }
    
    /**
     * Adds a new Drop to an NPC
     * @param npcID
     * @param itemID
     * @param min
     * @param max
     * @param sweep
     * @param chance
     * @throws NullPointerException
     * @see com.l2jfrozen.gameserver.script.EngineInterface#addQuestDrop(int, int, int, int, int, String, String[])
     */
    public void addDrop(final int npcID, final int itemID, final int min, final int max, final boolean sweep, final int chance) throws NullPointerException
    {
        final L2NpcTemplate npc = npcTable.getTemplate(npcID);
        if (npc == null)
        {
            if (Config.DEBUG)
            {
                LOGGER.warn("Npc doesnt Exist");
            }
            throw new NullPointerException();
        }
        final L2DropData drop = new L2DropData();
        drop.setItemId(itemID);
        drop.setMinDrop(min);
        drop.setMaxDrop(max);
        drop.setChance(chance);
        
        addDrop(npc, drop, sweep);
    }
    
    /**
     * Adds a new drop to an NPC. If the drop is sweep, it adds it to the NPC's Sweep category If the drop is non-sweep, it creates a new category for this drop.
     * @param npc
     * @param drop
     * @param sweep
     */
    public void addDrop(final L2NpcTemplate npc, final L2DropData drop, final boolean sweep)
    {
        if (sweep)
        {
            addDrop(npc, drop, -1);
        }
        else
        {
            int maxCategory = -1;
            
            if (npc.getDropData() != null)
            {
                for (final L2DropCategory cat : npc.getDropData())
                {
                    if (maxCategory < cat.getCategoryType())
                    {
                        maxCategory = cat.getCategoryType();
                    }
                }
            }
            maxCategory++;
            npc.addDropData(drop, maxCategory);
        }
        
    }
    
    /**
     * Adds a new drop to an NPC, in the specified category. If the category does not exist, it is created.
     * @param npc
     * @param drop
     * @param category
     */
    public void addDrop(final L2NpcTemplate npc, final L2DropData drop, final int category)
    {
        npc.addDropData(drop, category);
    }
    
    /**
     * @param npcID
     * @return Returns the _questDrops.
     */
    public List<L2DropData> getQuestDrops(final int npcID)
    {
        final L2NpcTemplate npc = npcTable.getTemplate(npcID);
        if (npc == null)
            return null;
        final List<L2DropData> questDrops = new FastList<>();
        if (npc.getDropData() != null)
        {
            for (final L2DropCategory cat : npc.getDropData())
            {
                for (final L2DropData drop : cat.getAllDrops())
                {
                    if (drop.getQuestID() != null)
                    {
                        questDrops.add(drop);
                    }
                }
            }
        }
        return questDrops;
    }
    
    @Override
    public void addEventDrop(final int[] items, final int[] count, final double chance, final DateRange range)
    {
        EventDroplist.getInstance().addGlobalDrop(items, count, (int) (chance * L2DropData.MAX_CHANCE), range);
    }
    
    @Override
    public void onPlayerLogin(final String[] message, final DateRange validDateRange)
    {
        Announcements.getInstance().addEventAnnouncement(validDateRange, message);
    }
    
    public void addPetData(final ScriptContext context, final int petID, final int levelStart, final int levelEnd, final Map<String, String> stats)
    {
        final L2PetData[] petData = new L2PetData[levelEnd - levelStart + 1];
        int value = 0;
        for (int level = levelStart; level <= levelEnd; level++)
        {
            petData[level - 1] = new L2PetData();
            petData[level - 1].setPetID(petID);
            petData[level - 1].setPetLevel(level);
            
            context.setAttribute("level", new Double(level), ScriptContext.ENGINE_SCOPE);
            for (final String stat : stats.keySet())
            {
                value = ((Number) Expression.eval(context, "beanshell", stats.get(stat))).intValue();
                petData[level - 1].setStat(stat, value);
            }
            context.removeAttribute("level", ScriptContext.ENGINE_SCOPE);
        }
    }
    
    @SuppressWarnings("synthetic-access")
    private static class SingletonHolder
    {
        protected static final FaenorInterface _instance = new FaenorInterface();
    }
}

 

 

Edited by MonkZe

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

There is barely any help here ever. Not when I needed. Dead forum with few smugs with big egos and most likely small ...

Later with time I wrote it my self,

In short: you just find a block that's responsible for quest item drop, and prior you add player level check.

Smtn like player.getLevel() method. I also added Boolean in configs, where I can manually set/change desired level outside the source, smtn like MinimumFeanorLevel = 15, and in condition block you add comparisment "if the level >= then Config.MINIMUM_FEANOR_LEVEL" or which ever way you like to design the comparisment, and thats about it. I don't remember if there was anything else, I'm recalling from memory. Double check all classes with help of search box if there are any lines regarding feanor q item drop, and observe whats around, if any djustment needed. Pretty simple job, only few lines. And a Boolean in configs, or you can hard code a number in source inside the class if you sure u will never change it.

Edited by MonkZe

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Faltan demasiados archivos,  y lógicas en clases claves como L2pcInstance, entre otras. si bien muchas cosas están y el flujo es valorable.  Gracias por tu esfuerzo es bastante... pero realmente no esta completo el código, falta que subas todas las modificaciones en clases colaterales... podrías intentar subir un diff de todo el mod  completo de tu pack y bueno ahí si que cada uno adapte... pero faltan muchas cosas, dudo que haya gente que lo haya echo funcionar con esto... 
    • I know people who have fully bypassed and reversed AAC. One day, they might even release the full source code, but for now, they’re still making money off it. I won’t name anyone, but it’s clear that there aren’t any truly solid anticheats for Lineage2. As I’ve said before, kernel level anticheats are the only real solution. Anything that runs as Internal and injects gets flagged, and your account ends up getting kicked or banned. That’s just how most games handle it nowadays. To TL;DR the whole thing cheating will always exist because there are people out there smart enough to bypass any protection and run private cheats. Public cheats are always detected eventually, so I don’t see any point in buying AAC, especially when they claim it blocks adr, which simply isn’t true.
    • 🌐 Website: https://l2adonis.com 📅 GRAND OPENING: July 18, 2025 – 20:00 (UTC+2) 💬 Discord: https://discord.com/invite/tZBj8JxAwx 🚫 No auto-farm • No auto-macro • No pay-to-win • No custom   Some Basic Info's (More detalied info's on website)  EXP/SP: x25  Adena: x15  Drop: x15  Spoil: x15  Seal Stones: x15  Raid Boss Drop: x10  Epic Boss Drop: x1  Manor: x10  Safe Enchant: +4  Max Enchant: +16  Normal Scroll Chance: 50%  Blessed Scroll Chance: 66% (If enchant fail item remain +4)  Buff Slots (30+4 extra with Divine Inspiration)  Dances/Songs Slots 14  Auto-learn skills  ⚔️ Real PvP • Real Progression • Retail-like experience JOIN NOW and relive the real L2 experience!
    • Discord         :  utchiha_market Telegram        : https://t.me/utchiha_market Auto Buy Store  : https://utchihamkt.mysellauth.com/ Not sure if we’re legit? Check Our server — real reviews, real buyers https://discord.gg/uthciha-servicess  | https://campsite.bio/utchihaamkt
    • Looking for a Developer – Lineage II Interlude (Vanganth Files)   I’m seeking a developer to collaborate on a project based on Vanganth Interlude files.   Important: Applicants with a bad attitude, lack of respect, or unwillingness to work will be immediately rejected. Payment: Hourly rate, not per task. Contact: Please reach out to me via PM.
  • Topics

×
×
  • 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