Jump to content

Question

Posted

How i can make Delevel Manager With request item for delevel + reward for delevel?

Was something with L2ItemInstance, but i don;t know how.  

I want to take from players 1 kk adena and give 1 apiga. Thank you !

Recommended Posts

  • 0
Posted (edited)

Yea, no work for me, thx all for attentions. everything i do, no work. I have lv 80 and item for destroy, Delevel Manager has telling me i no have lv 801.....

Edited by 0flee
  • 0
Posted (edited)

Try this 

player.removeExpAndSp(ExperienceData.getInstance().getExpForLevel(55), 0);
player.broadcastUserInfo();

Do you want it reduced to 55 or 30 levels?

Edited by TGSLineage2
  • 0
Posted (edited)
13 minutes ago, 0flee said:

I want after level 80 ( till level 85) player downlevel to 55.

assuming the method you are using is void type, you should ask at the beginning.
           

if (player.getLevel() <= 80) {
            player.sendMessage("You don't have the level necessary to perform this action")
            return;
            }

 

Edited by TGSLineage2
  • 0
Posted

I try this before, unsuccessfully. Btw, i find a voice command to do that except npc. But it is in Greek and it is for interlude, and i try to adapt L2j-Sunrise , but idk if i can.

Spoiler

 

 

  • 0
Posted

try this one

if (player.getLevel >= 80 && player.getLevel <= 85) // Only 80 .. 85 levels 
	if (player.destroyItemByItemId("delevel", 57, 1000, null, true)) // Check the destroy item
		{
			player.removeExpAndSp(player.getExp() - ExperienceData.getInstance().getExpForLevel(55), 0); //remove the xp
			player.addItem("delevel-reward", 7575, 1, null, true); // reward
		}

 

Note: If this will not work, then you should look before this code if something doesn't allow the conditions

  • 0
Posted (edited)

Yea, i did it on voice command. Now i must find that way to do delevel after lv 80. I try 

if (player.getLevel >= 80 && player.getLevel <= 85) // Only 80 .. 85 levels

and chat still sau i no have requirements to do delevel.

Edited by 0flee
  • 0
Posted
21 minutes ago, 0flee said:

Yea, i did it on voice command. Now i must find that way to do delevel after lv 80. I try 


if (player.getLevel >= 80 && player.getLevel <= 85) // Only 80 .. 85 levels

and chat still sau i no have requirements to do delevel.

maybe you should post exactly what message you are receiving. also, post the whole code here in code tags

  • 0
Posted (edited)

Ok, i have level 80 and i can;t do delevel. just on level 85. I will post here code.

 

http://dfrhtcF.png

 

Spoiler

public class DelevelCmd implements IVoicedCommandHandler
{
    private static final String[] VOICED_COMMANDS =
    {
        "delevel"
    };
    
    public static final int ZONE_PEACE = 2;
    
    /*
     * (non-Javadoc)
     * @see l2r.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(String, l2r.gameserver.model.L2PcInstance), String)
     */
    @Override
    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {
        if (command.startsWith("delevel"))
        {
            requestDelevel(activeChar);
        }
        return true;
    }
    
    public boolean requestDelevel(L2PcInstance activeChar)
    {
        Siege siege = SiegeManager.getInstance().getSiege(activeChar);
        
        // Check the activeChar's level.
        if (activeChar.getLevel() <= 80)
        {
            activeChar.sendMessage("You do not meet the level requirement for Delevel!");
            return false;
        }
        // Check activeChar if have SubClass
        else if (activeChar.isSubClassActive())
        {
            activeChar.sendMessage("Please switch to your Main Class before attempting Delevel.");
            return false;
        }
        // Check activeChar if in Peace Zone
        else if (!activeChar.isInsideZone(ZoneIdType.PEACE))
        {
            activeChar.sendMessage("You can only Delevel in peace zone.");
            return false;
        }
        // Check activeChar is death/fake death and movement disable
        else if (activeChar.isMovementDisabled() || activeChar.isAlikeDead())
        {
            activeChar.sendMessage("You can't Delevel on death mode");
            return false;
        }
        // Check if activeChar is in Siege
        else if ((siege != null) && siege.isInProgress())
        {
            activeChar.sendMessage("You are in siege, you can't Delevel.");
            return false;
        }
        // Check if activeChar is a Cursed Weapon owner
        else if (activeChar.isCursedWeaponEquipped())
        {
            activeChar.sendMessage("You can't Delevel! You are currently holding a cursed weapon.");
            return false;
        }
        // Check if activeChar is in Duel
        else if (activeChar.isInDuel())
        {
            activeChar.sendMessage("You can't Delevel You are in a duel!");
            return false;
        }
        // Check is in DimensionsRift
        else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
        {
            activeChar.sendMessage("You can't Delevel! You are in the dimensional rift.");
            return false;
        }
        // Check to see if the activeChar is in an event
        else if (activeChar.isOnEvent())
        {
            activeChar.sendMessage("You can't Delevel! You are in event now.");
            return false;
        }
        // Check activeChar is in Olympiade
        else if (activeChar.isInOlympiadMode() || (activeChar.getOlympiadGameId() != -1))
        {
            activeChar.sendMessage("You can't Delevel! Your are fighting in Olympiad!");
            return false;
        }
        // Check activeChar is in observer mode
        else if (activeChar.inObserverMode())
        {
            activeChar.sendMessage("You can't Delevel in Observer mode!");
            return false;
        }
        // Check activeChar have karma/pk/pvp status
        if ((activeChar.getKarma() > 0) || (activeChar.getPvpFlag() > 0))
        {
            activeChar.sendMessage("player in PVP or with Karma can't use the Delevel command!");
            return false;
        }
        // Check if activeChar have no one in target
        else if (activeChar.getTarget() == null)
        {
            activeChar.sendMessage("You can't have any one in your target when Delevel only your self.");
            return false;
        }
        // If activeChar have not any of theis can delevel
        delevelstart(activeChar);
        return true;
    }
    
    public boolean delevelstart(L2PcInstance activeChar)
    {
        try
        {
            if (activeChar.destroyItemByItemId("Delevel", 3470, 10, null, true))
            {
                activeChar.sendMessage("You don't have enough Gold Bar.");
            }
            {
                activeChar.addItem("delevel-reward", 7575, 1, null, true);
                activeChar.sendMessage("Congratulation)" + activeChar.getName() + (" you are on level 55."));
            }
            activeChar.getCurrentHp();
            activeChar.getCurrentCp();
            int max_level = ExperienceData.getInstance().getMaxLevel();
            // Protections
            Integer returnToLevel = 55;
            if (returnToLevel < 1)
            {
                returnToLevel = 1;
            }
            if (returnToLevel > max_level)
            {
                returnToLevel = max_level;
            }
            // Resets character to first class.
            activeChar.broadcastUserInfo();
            final byte lvl = Byte.parseByte(returnToLevel + "");
            final long pXp = activeChar.getStat().getExp();
            final long tXp = ExperienceData.getInstance().getExpForLevel(lvl);
            if (pXp > tXp)
            {
                activeChar.getStat().removeExpAndSp(pXp - tXp, 0);
            }
            else if (pXp < tXp)
            {
                activeChar.getStat().addExpAndSp(tXp - pXp, 0);
            }
            
            // restore Hp-Mp-Cp
            activeChar.setCurrentCp(activeChar.getMaxRecoverableCp());
            activeChar.setCurrentMp(activeChar.getMaxRecoverableMp());
            activeChar.setCurrentHp(activeChar.getMaxRecoverableMp());
            activeChar.broadcastStatusUpdate();
            // Updates the activeChar's information in the Character Database.
            activeChar.store();
            // Update skill list
            activeChar.sendSkillList();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return true;
    }
    
    @Override
    public String[] getVoicedCommandList()
    {
        return VOICED_COMMANDS;
    }
    
}

 

Edited by 0flee
  • 0
Posted (edited)

OK guys, i solve it. the problem was "=" from <=80. Now i leave it < 80 and it's working. thx again. Now i want to know how i can count them. it is player.getCountDelevel()?

Edited by 0flee

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

    • Server is Online – 1,000+ Active Players! We’re excited to announce the addition of a Europe Proxy to improve connectivity for our EU players! Clans can now benefit from VIP Access to help you catch up faster. 🎯 If you're a clan leader with at least 9 active members, join our Discord and open a ticket to claim your VIP rewards!  
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
    • 📜 • Mass PVP – Craft – Progressive Server (ITEMS, ARMOR, WEAPONS, ETC) 🕹️ • Chronicles: Lineage 2 - Interlude (C6) 🛠️ • Retail status 🕒 • Server Time: GMT -3 🏙️ • Main Town: Giran ✨ • Teleportation for all Towns, Gk Global 🛡️ • NPC BUFFER - GMSHOP B-GRADE - DONATION SHOP - AUCTION MANAGER 🐉 • Epic Bosses: Chaotic Zones 🔁 • Protection respawn: 15 seconds ⏰ • Restart Server: 05:00 AM Today 💸 • RTM allowed between players (ask Staff if in doubt) 📊 SERVER RATES: • EXP: x8 • SP: x10 • Adena: x3 • Seal Stone: x3 • Drop: x3 • Spoil: x5 • Raid EXP/SP/Drop: x3 • Premium Rates: x2 🌐 Website: https://www.l2roosters.com 💬 Discord: https://discord.gg/cUyYXrfy 🔥 Join us now and forge your legacy at Roosters Gaming!
    • Hello, lovely people, how are you? I just finished compiling the L2jFrozen project Rev: 1132 (very old). I don't mind it being too old, since the project is for me and my children. (LAN/Offline) it's not meant to be put online. I want to learn and give my children more comfort when playing. And for my part, I also experiment with the game. My problem is that I don't know much about the subject. I was able to make some basic configurations to my liking and that of my children, but it never compiles or anything like that... I would really need help from you, the community... I simply want to remove all subclass restrictions, remove the restriction on "Overlord, Warsmith, and Dark Elf subclasses with White Elves and vice versa." Thank you very much in advance! Greetings, community.
  • 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