Jump to content
  • 0

Help Class Master NPC ( how to make it)


Question

Posted

hi guys, this week i try to make one server with my friend ( we use l2AvA Files ) but i have some problems with class master NPC ( dont work).
The npc comes with this code
1150415698_DialogoNPC.PNG.8819de4655169aeac71d9f23517e78c1.PNG

i take the code for another npc ( gm shop) and i make this button ..2.thumb.PNG.08496bdcff161498b5a66ea1c97a7ffe.PNG

the problem is what action can i use here?  i try with bypass "-h scripts_services_community_CareerManager"(but dont work)
throws this error

5.PNG.f6573423209f241221be18d89af09f52.PNG

 

btw this is the file

4.PNG.fef7a6940836d54ca8a85b28cad122f1.PNG

 

package services.community;

import java.util.StringTokenizer;

import l2ro.gameserver.Config;
import l2ro.gameserver.data.htm.HtmCache;
import l2ro.gameserver.data.xml.holder.ItemHolder;
import l2ro.gameserver.handler.bbs.CommunityBoardManager;
import l2ro.gameserver.handler.bbs.ICommunityBoardHandler;
import l2ro.gameserver.model.Player;
import l2ro.gameserver.model.base.ClassId;
import l2ro.gameserver.model.items.ItemInstance;
import l2ro.gameserver.network.serverpackets.ShowBoard;
import l2ro.gameserver.network.serverpackets.SystemMessage2;
import l2ro.gameserver.network.serverpackets.components.SystemMsg;
import l2ro.gameserver.scripts.ScriptFile;
import l2ro.gameserver.templates.item.ItemTemplate;
import l2ro.gameserver.utils.Util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CareerManager implements ScriptFile, ICommunityBoardHandler
{
    private static final Logger _log = LoggerFactory.getLogger(CareerManager.class);
    
    @Override
    public void onLoad()
    {
        if (Config.COMMUNITYBOARD_ENABLED/* && Config.BBS_PVP_CB_ENABLED*/)
        {
            _log.info("CommunityBoard: Manage Career service loaded.");
            CommunityBoardManager.getInstance().registerHandler(this);
        }
    }

    @Override
    public void onReload()
    {
        if (Config.COMMUNITYBOARD_ENABLED/* && Config.BBS_PVP_CB_ENABLED*/)
            CommunityBoardManager.getInstance().removeHandler(this);
    }

    @Override
    public void onShutdown()
    {}

    @Override
    public String[] getBypassCommands()
    {
        return new String[] { "_bbscareer;", "_bbscareer;sub;", "_bbscareer;classmaster;change_class;" };
    }

    @SuppressWarnings("incomplete-switch")
    @Override
    public void onBypassCommand(Player activeChar, String command)
    {
        if (!checkCondition(activeChar))
            return;

        if (command.startsWith("_bbscareer;classmaster;change_class;"))
        {
            StringTokenizer st = new StringTokenizer(command, ";");
            st.nextToken();
            st.nextToken();
            st.nextToken();
            final int classId = Integer.parseInt(st.nextToken());
            
            // Synerge - Check if the player can actually transfer to that class
            if (!checkIfCanTransferToClass(activeChar, classId))
            {
                // TODO: Cheater?
                _log.warn("CareerManager: The player " + activeChar.getName() + " wanted to transfer to a class that he cannot to. Cheater?");
                return;
            }
                        
            final int price = Integer.parseInt(st.nextToken());
            ItemTemplate item = ItemHolder.getInstance().getTemplate(Config.CLASS_MASTERS_PRICE_ITEM);
            ItemInstance pay = activeChar.getInventory().getItemByItemId(item.getItemId());
            if (pay != null && pay.getCount() >= price)
            {
                activeChar.getInventory().destroyItem(pay, price, "Class Changer");
                changeClass(activeChar, classId);
                onBypassCommand(activeChar, "_bbscareer;");
            }
            else if (Config.CLASS_MASTERS_PRICE_ITEM == 57)
            {
                activeChar.sendPacket(new SystemMessage2(SystemMsg.YOU_DO_NOT_HAVE_ENOUGH_ADENA));
            }
            else
            {
                activeChar.sendPacket(new SystemMessage2(SystemMsg.YOU_DO_NOT_HAVE_ENOUGH_ADENA));
            }
        }
        else if (command.startsWith("_bbscareer;"))
        {
            ClassId classId = activeChar.getClassId();
            int jobLevel = classId.getLevel();
            int level = activeChar.getLevel();
            StringBuilder html = new StringBuilder();
            html.append("<br>");
            html.append("<table width=600>");
            html.append("<tr><td>");
            if (Config.ALLOW_CLASS_MASTERS_LIST.isEmpty() || !Config.ALLOW_CLASS_MASTERS_LIST.contains(jobLevel))
                jobLevel = 4;

            if ((level >= 20 && jobLevel == 1 || level >= 40 && jobLevel == 2 || level >= 76 && jobLevel == 3) && Config.ALLOW_CLASS_MASTERS_LIST.contains(jobLevel))
            {
                ItemTemplate item = ItemHolder.getInstance().getTemplate(Config.CLASS_MASTERS_PRICE_ITEM);
                html.append("You have to pay: <font color=\"LEVEL\">");
                html.append(Util.formatAdena(Config.CLASS_MASTERS_PRICE_LIST[jobLevel])).append("</font> <font color=\"LEVEL\">").append(item.getName()).append("</font> to change profession<br>");
                html.append("<center><table width=600><tr>");
                for (ClassId cid : ClassId.values())
                {
                    if (cid == ClassId.inspector)
                        continue;
                    if (cid.childOf(classId) && cid.level() == classId.level() + 1)
                        html.append("<td><center><button value=\"").append(cid.name()).append("\" action=\"bypass _bbscareer;classmaster;change_class;").append(cid.getId()).append(";").append(Config.CLASS_MASTERS_PRICE_LIST[jobLevel]).append("\" width=150 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></center></td>");

                }
                html.append("</tr></table></center>");
                html.append("</td>");
                html.append("</tr>");
                html.append("</table>");
            }
            String content = HtmCache.getInstance().getNotNull(Config.BBS_HOME_DIR + "pages/career.htm", activeChar);
            content = content.replace("%career%", html.toString());
            ShowBoard.separateAndSend(content, activeChar);
        }
    }

    private static void changeClass(Player player, int classId)
    {
        if (player.getClassId().getLevel() == 3)
            player.sendPacket(SystemMsg.CONGRATULATIONS__YOUVE_COMPLETED_YOUR_THIRDCLASS_TRANSFER_QUEST); // ??? 3 ?????
        else
            player.sendPacket(SystemMsg.CONGRATULATIONS__YOUVE_COMPLETED_A_CLASS_TRANSFER); // ??? 1 ? 2 ?????

        player.setClassId(classId, false, false);
        player.broadcastUserInfo(true);
    }

    @Override
    public void onWriteCommand(Player player, String bypass, String arg1, String arg2, String arg3, String arg4, String arg5)
    {}

    private static boolean checkCondition(Player player)
    {
        if (player == null)
            return false;

        if (!Config.USE_BBS_PROF_IS_COMBAT && (player.getPvpFlag() != 0 || player.isInDuel() || player.isInCombat() || player.isAttackingNow()))
        {
            player.sendMessage("During combat, you can not use this feature.");
            return false;
        }

        return true;
    }
    
    /**
     * @param player
     * @param newClassId
     * @return Returns true if the player can transfer to the selected class
     */
    private static boolean checkIfCanTransferToClass(Player player, int newClassId)
    {
        if (player == null)
            return false;

        final ClassId currentClassId = player.getClassId();
        final int jobLevel = player.getLevel();
        final int level = player.getLevel();
        
        if (Config.ALLOW_CLASS_MASTERS_LIST.isEmpty() || !Config.ALLOW_CLASS_MASTERS_LIST.contains(jobLevel))
            return false;

        if ((level >= 20 && jobLevel == 1 || level >= 40 && jobLevel == 2 || level >= 76 && jobLevel == 3) && Config.ALLOW_CLASS_MASTERS_LIST.contains(jobLevel))
        {        
            for (ClassId cid : ClassId.values())
            {
                if (cid.getId() != newClassId)
                    continue;
                
                if (cid == ClassId.inspector)
                    return false;
                
                if (cid.childOf(currentClassId) && cid.level() == currentClassId.level() + 1)
                    return true;
    
            }
        }
        
        return false;
    }
}

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Guest
This topic is now closed to further replies.


  • Posts

    • THE CAMERA DISTORTS – AND THAT CAN EXPOSE YOU ▪ You look at the photo: “looks fine.” But the sensor has already altered it – and without that, the shot doesn’t exist. ▪ Rolling shutter. The frame is read line by line objects slightly “drift”, geometry isn’t perfect that’s not a bug – that’s the baseline. ▪ Sensor noise. Even in good lighting there’s still grain every sensor has its own signature too clean = unnatural. ▪ Aberrations. Color shifts appear near the edges lenses aren’t perfect, and it shows perfect edges with no shift are rare. ▪ Reality ≠ what the camera records. It always adds distortion. ▪ Want to know where your file is “too perfect”? Send it over – we’ll break it down for you. › TG: @mustang_service ( https:// t.me/ mustang_service ) › Channel: Mustang Service ( https:// t.me/ +JPpJCETg-xM1NjNl ) #editing #photoshop #distortion #verification #camera
    • We’re not trying to be “Reborn” or anyone else and you have copy the server concept,the reborn website,the reborn logo,the reborn community board html,lol trash
    • SOCNET is a universal service that combines a digital goods store, an SMM panel, a Telegram bot for purchasing Telegram Stars and a Telegram bot for renting virtual numbers. Here you will find accounts for TikTok, Instagram, Reddit, Twitter, Telegram, Facebook, LinkedIn, WhatsApp, SnapChat, YouTube, Google, Discord, email (Outlook, Hotmail, Gmail, Rambler, Firstmail and others), proxies, virtual servers, advertising accounts, access to ChatGPT 5, gift cards and premium subscriptions to numerous services — and all this at the best prices!   SOCNET STARS is a service that helps you quickly and profitably purchase Telegram Stars and subscribe to Telegram Premium. Using our Telegram bot you can buy Telegram Stars at the lowest prices on the market and use them to pay for gifts, reactions, donations and other features inside Telegram.   Our bot also features a NEW gaming feature — gift slots, where users can win valuable prizes: Telegram gifts, bonuses from our partners and the SOCNET company, stars and premium subscriptions. The game mechanics are completely transparent: no tricks, only real luck decides. You can try it at any time — bets start from just 1 ruble. We also provide the opportunity for a one-time free spin!   Available payment methods: LOLZTEAM, Crypto Bot, Cryptocurrency, Bank cards and SBP ⭐ Our online store ⭐ SOCNET.STORE ⭐ Telegram store ⭐ SOCNET.SHOP ⭐ Our SMM Panel for social media promotion ⭐ SOCNET.PRO ⭐ Our Telegram bot for purchasing Telegram Stars ⭐ SOCNET.CC ⭐ Our SMS Service ⭐ SOCNET.APP ✅ News resources: ➡ Telegram channel ➡ WhatsApp channel ➡ Discord server ✅ Contacts and support: ➡ Telegram support ➡ WhatsApp support ➡ Discord support: socnet_support ➡ Email support: help@socnet.pro We have been operating for a long time and have gathered a huge list of reviews about our work! Our huge list of positive and honest reviews is presented on our website! ⭐We invite you to COOPERATE and EARN with us ⭐ Want to sell your product or service in our stores and make money? Become our partner or suggest mutually beneficial cooperation? You can contact us via the CONTACTS listed in this topic. If you have any questions or problems, our fast customer support is ready to respond to your requests! Refunds for a service that does not fully meet the requirements or quality are issued only if a guarantee and warranty period were specified in the product description. In all other cases, refunds for the service will not be fully processed or issued! By purchasing such a service, you automatically agree to our refund policy for non-provided services! We currently accept Any type of cryptocurrency (Cryptomus, Binance Pay, CryptoBot), any bank cards (VISA, Mastercard, MIR Pay, SBP), LolzTeam Market, Wise, Revolut, Paypal Friends&Families. We value every customer and provide replacements for invalid accounts and services through our contact methods!
    • SOCNET is a universal service that combines a digital goods store, an SMM panel, a Telegram bot for purchasing Telegram Stars and a Telegram bot for renting virtual numbers. Here you will find accounts for TikTok, Instagram, Reddit, Twitter, Telegram, Facebook, LinkedIn, WhatsApp, SnapChat, YouTube, Google, Discord, email (Outlook, Hotmail, Gmail, Rambler, Firstmail and others), proxies, virtual servers, advertising accounts, access to ChatGPT 5, gift cards and premium subscriptions to numerous services — and all this at the best prices!   SOCNET STARS is a service that helps you quickly and profitably purchase Telegram Stars and subscribe to Telegram Premium. Using our Telegram bot you can buy Telegram Stars at the lowest prices on the market and use them to pay for gifts, reactions, donations and other features inside Telegram.   Our bot also features a NEW gaming feature — gift slots, where users can win valuable prizes: Telegram gifts, bonuses from our partners and the SOCNET company, stars and premium subscriptions. The game mechanics are completely transparent: no tricks, only real luck decides. You can try it at any time — bets start from just 1 ruble. We also provide the opportunity for a one-time free spin!   Available payment methods: LOLZTEAM, Crypto Bot, Cryptocurrency, Bank cards and SBP ⭐ Our online store ⭐ SOCNET.STORE ⭐ Telegram store ⭐ SOCNET.SHOP ⭐ Our SMM Panel for social media promotion ⭐ SOCNET.PRO ⭐ Our Telegram bot for purchasing Telegram Stars ⭐ SOCNET.CC ⭐ Our SMS Service ⭐ SOCNET.APP ✅ News resources: ➡ Telegram channel ➡ WhatsApp channel ➡ Discord server ✅ Contacts and support: ➡ Telegram support ➡ WhatsApp support ➡ Discord support: socnet_support ➡ Email support: help@socnet.pro We have been operating for a long time and have gathered a huge list of reviews about our work! Our huge list of positive and honest reviews is presented on our website! ⭐We invite you to COOPERATE and EARN with us ⭐ Want to sell your product or service in our stores and make money? Become our partner or suggest mutually beneficial cooperation? You can contact us via the CONTACTS listed in this topic. If you have any questions or problems, our fast customer support is ready to respond to your requests! Refunds for a service that does not fully meet the requirements or quality are issued only if a guarantee and warranty period were specified in the product description. In all other cases, refunds for the service will not be fully processed or issued! By purchasing such a service, you automatically agree to our refund policy for non-provided services! We currently accept Any type of cryptocurrency (Cryptomus, Binance Pay, CryptoBot), any bank cards (VISA, Mastercard, MIR Pay, SBP), LolzTeam Market, Wise, Revolut, Paypal Friends&Families. We value every customer and provide replacements for invalid accounts and services through our contact methods!
    • SOCNET is a universal service that combines a digital goods store, an SMM panel, a Telegram bot for purchasing Telegram Stars and a Telegram bot for renting virtual numbers. Here you will find accounts for TikTok, Instagram, Reddit, Twitter, Telegram, Facebook, LinkedIn, WhatsApp, SnapChat, YouTube, Google, Discord, email (Outlook, Hotmail, Gmail, Rambler, Firstmail and others), proxies, virtual servers, advertising accounts, access to ChatGPT 5, gift cards and premium subscriptions to numerous services — and all this at the best prices!   SOCNET STARS is a service that helps you quickly and profitably purchase Telegram Stars and subscribe to Telegram Premium. Using our Telegram bot you can buy Telegram Stars at the lowest prices on the market and use them to pay for gifts, reactions, donations and other features inside Telegram.   Our bot also features a NEW gaming feature — gift slots, where users can win valuable prizes: Telegram gifts, bonuses from our partners and the SOCNET company, stars and premium subscriptions. The game mechanics are completely transparent: no tricks, only real luck decides. You can try it at any time — bets start from just 1 ruble. We also provide the opportunity for a one-time free spin!   Available payment methods: LOLZTEAM, Crypto Bot, Cryptocurrency, Bank cards and SBP ⭐ Our online store ⭐ SOCNET.STORE ⭐ Telegram store ⭐ SOCNET.SHOP ⭐ Our SMM Panel for social media promotion ⭐ SOCNET.PRO ⭐ Our Telegram bot for purchasing Telegram Stars ⭐ SOCNET.CC ⭐ Our SMS Service ⭐ SOCNET.APP ✅ News resources: ➡ Telegram channel ➡ WhatsApp channel ➡ Discord server ✅ Contacts and support: ➡ Telegram support ➡ WhatsApp support ➡ Discord support: socnet_support ➡ Email support: help@socnet.pro We have been operating for a long time and have gathered a huge list of reviews about our work! Our huge list of positive and honest reviews is presented on our website! ⭐We invite you to COOPERATE and EARN with us ⭐ Want to sell your product or service in our stores and make money? Become our partner or suggest mutually beneficial cooperation? You can contact us via the CONTACTS listed in this topic. If you have any questions or problems, our fast customer support is ready to respond to your requests! Refunds for a service that does not fully meet the requirements or quality are issued only if a guarantee and warranty period were specified in the product description. In all other cases, refunds for the service will not be fully processed or issued! By purchasing such a service, you automatically agree to our refund policy for non-provided services! We currently accept Any type of cryptocurrency (Cryptomus, Binance Pay, CryptoBot), any bank cards (VISA, Mastercard, MIR Pay, SBP), LolzTeam Market, Wise, Revolut, Paypal Friends&Families. We value every customer and provide replacements for invalid accounts and services through our contact methods!
  • 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..