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
i take the code for another npc ( gm shop) and i make this button ..
the problem is what action can i use here? i try with bypass "-h scripts_services_community_CareerManager"(but dont work)
throws this error
btw this is the file
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("<tablewidth=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: <fontcolor=\"LEVEL\">");
html.append(Util.formatAdena(Config.CLASS_MASTERS_PRICE_LIST[jobLevel])).append("</font><fontcolor=\"LEVEL\">").append(item.getName()).append("</font> to change profession<br>");
html.append("<center><tablewidth=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><buttonvalue=\"").append(cid.name()).append("\"action=\"bypass _bbscareer;classmaster;change_class;").append(cid.getId()).append(";").append(Config.CLASS_MASTERS_PRICE_LIST[jobLevel]).append("\"width=150height=25back=\"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;
}
}
Unlock Unlimited Access with GoProxy's Residential Proxies!
Experience seamless, secure, and unrestricted connectivity worldwide with GoProxy's Unlimited Residential Proxies.
Our service offers access to a global network of rotating residential IPs, ensuring top performance for your large-scale data collection, streaming, and more.
✔️Unlimited Traffic & IPs: Enjoy unrestricted access with our rotating residential proxies, delivering high performance through a vast global IP pool.
✔️High Success Rate: Achieve a 99.96% success rate with a rapid 0.6-second response time, ensuring efficient and reliable operations.
✔️Flexible Sessions: Customize IP rotation to fit your project needs, with options for automatic rotation and sticky sessions lasting up to 60 minutes.
✔️Global Coverage: Access IPs from over 120 countries, making it ideal for businesses requiring high bandwidth without region-specific constraints.
All plans include unlimited traffic and IPs, unlimited concurrent requests, and access to real residential IP addresses.
Elevate your online operations with GoProxy's Unlimited Residential Proxies—your smart choice for large-scale projects.
👉 Learn more and get started today: GoProxy Unlimited Proxies
Question
MichaelCL
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
i take the code for another npc ( gm shop) and i make this button ..
the problem is what action can i use here? i try with bypass "-h scripts_services_community_CareerManager"(but dont work)
throws this error
btw this is the file
0 answers to this question
Recommended Posts