Jump to content

Recommended Posts

Posted

Καλησπεριζω τα μελη του mxc ειναι το πρωτο μου Java Code Share και ελπιζω να ειναι καλο και να βρειι πολλα ατομα χαρουμενα διοτι απο τη μια υπαρχει αυτη η εντολη αλλα δεν πολη δουλευει σωστα η ειναι bugαρισμενει.Λοιπον ας αρχισω την παρουσιαση του και πως θα την βαλλουμε μεσα στο pack μας:

Δημηουργουμε ενα νεο Java αρχειο με το ονομα "DelevelCmd.java" και το βαζουμε μεσα στον φακελο "voicedcommandhandlers" και αντιγραφουμε το κοδικα στο αρχειο οπου δημιουργισαμε

package com.l2jprotocol.gameserver.handler.voicedcommandhandlers;

import com.l2jprotocol.Config;
import com.l2jprotocol.gameserver.datatables.SkillTable;
import com.l2jprotocol.gameserver.datatables.xml.ExperienceData;
import com.l2jprotocol.gameserver.handler.IVoicedCommandHandler;
import com.l2jprotocol.gameserver.managers.SiegeManager;
import com.l2jprotocol.gameserver.model.actor.instance.L2PcInstance;
import com.l2jprotocol.gameserver.model.entity.siege.Siege;
import com.l2jprotocol.gameserver.model.L2Skill;

/**
* @author LastWarrior_Dev_Team
*/

public class DelevelCmd implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{
		"delevel"
};

public static final int ZONE_PEACE = 2;

/* (non-Javadoc)
 * @see com.l2jprotocol.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(String, com.l2jprotocol.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() < Config.DELEVEL_MIN_LEVEL)
		{
			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(ZONE_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.getIsInProgress())
		{
			activeChar.sendMessage("You are in siege, you can't Delevel.");
			return false;
		}
		// Check if activeChar is a Cursed Weapon owner
		else if(activeChar.isCursedWeaponEquiped())
		{
			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.isInFunEvent())
		{
			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
	{
		double actual_hp = activeChar.getCurrentHp();
		double actual_cp = activeChar.getCurrentCp();				
		int max_level = ExperienceData.getInstance().getMaxLevel();				
		// Protections
		Integer returnToLevel = Config.DELEVEL_TO_LEVEL;
		if (returnToLevel < 1)
			returnToLevel = 1;
		if (returnToLevel > max_level)
			returnToLevel = max_level;				
		// Resets character to first class.
		activeChar.setClassId(activeChar.getBaseClass());				
		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);
		}
		// Remove the activeChar's current skills.
		for (L2Skill skill : activeChar.getAllSkills())
		{
			activeChar.removeSkill(skill);
		}
		// Give activeChars their eligible skills.
		activeChar.giveAvailableSkills();		
		// restore Hp-Mp-Cp
		activeChar.setCurrentCp(actual_cp);
		activeChar.setCurrentMp(activeChar.getMaxMp());
		activeChar.setCurrentHp(actual_hp);
		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;
}

}

Το κανουμε save :) μετα παμε στο αρχειο "voicedcommandhandlers.java" οπου θα ειναι ενας φακελος πισω με το ονομα "handler".

αφου ανοιξουμε το αρχειο "voicedcommandhandlers.java" ψαχουμε να βρουμε που κανει "register" τα voicecommands μας,οταν τα βρουμε παμε στο τελευταιο "register" και βαζουμε αυτες τις 4 γραμουλες

	if (Config.DELEVEL_ENABLE)
	{
		registerVoicedCommandHandler(new DelevelCmd());
	}

Aυτο το κανουμε για να διαβασει ο σερβερ την νεα εντολη "delevel".

Αφου ολοκληρωσουμε αυτο το σημειο κανουμε save...Πανε να βρουμε αλλο ενα αρχειο της java με ονομα Config.Java οπου βρισκεται στο root του σερβερ μας παντα...:/Μολις το βρουμε το ανοιγουμε και προσθετουμε αυτους τους κοδικες οπου θα ειναι τα config του "delevel"

                //============================================================
	public static boolean DELEVEL_ENABLE;
	public static int DELEVEL_MIN_LEVEL;
	public static int DELEVEL_TO_LEVEL;
	//============================================================
	public static void loadDELEVELconfig()
	{
		final String DELEVEL_SYSTEM = FService.DELEVEL_FILE;
		try
		{
			Properties DELEVELSettings = new Properties();
			InputStream is = new FileInputStream(new File(DELEVEL_SYSTEM));
			DELEVELSettings.load(is);
			is.close();

			/** Delevel System **/
			DELEVEL_ENABLE= Boolean.parseBoolean(DELEVELSettings.getProperty("Delevel_Enable","False"));
			DELEVEL_MIN_LEVEL = Integer.parseInt(DELEVELSettings.getProperty("Delevel_Min_Level", "80"));
			DELEVEL_TO_LEVEL = Integer.parseInt(DELEVELSettings.getProperty("Delevel_RETURN_TO_LEVEL", "40"));
		}
		catch(Exception e)
		{
			e.printStackTrace();
			throw new Error("Failed to Load " + DELEVEL_SYSTEM + " File.");
		}
	}

μολις κανουμε την εισαγωγει παμε τρεμα κατω σχεδω στο αρχειο Config.java ωστε να δηλωσουμε τις μεταβλητες για να μπορει ο σερβερ να τις ανακαλεσει

αυτο θα το κανουμε με την εισαγωγει αυτης της λεξεις "loadDELEVELconfig();" οπου θα την βαλουμε μαζι με τις αλλες :)

		loadChampionConfig();
		loadWeddingConfig();
		loadREBIRTHConfig();
		loadAWAYConfig();
		loadBankingConfig();
		loadPCBPointConfig();
		loadOfflineConfig();
		loadPowerPack();
		loadVoteSystemConfig();
		loadDELEVELconfig(); <-------θα την βαλουμε

Τελος με το Config.Java ας κανουμε ενα save.

Τωρα παμε να δημιουργισουμε το αρχειο delevel.properties και να δηλωσουμε την διαδρομη του ωστε να αλλαζουμε τα config του delevel command

Για αρχη ας παμε στο αρχειο Fservice.java οπου λογικα θα ειναι στον ιδιο φακελο με το Config.java και το ανουγουμε και βαζουμε αυτον τον κοδικα

public static final String DELEVEL_FILE = "./config/fun/delevel.properties";

κανουμε ενα save!!! Εχουμε τελειωσει με τα java files το μονο που μας μενει ειναι να φτιαξουμε το αρχειο "delevel.properties" και ειμαστε ετοιμη...Για αυτο παμε στον φακελο "Server/config/fun/ και εδω θα φτιαξουμε το αρχειο delevel.properties" διοτι συμφωνα με τον πρωηγουμενο κοδικα εδω δηλωνουμε την παρουσια του εσεις μπορειτε να το πατε αλλου αρκει να το δηλωσεται μετα.. αφου το δημιουργησουμε το ανοιγουμε και βαζουμε αυτα μεσα

# ==================================== #
#            Delevel System            #
# ==================================== #

# Enable Delevel system
# If set it true then allow players to use 
# command .delevel to delevel ther levels
Delevel_Enable = false

# Minimum level for Deleve
Delevel_Min_Level = 80

# Return to level? (Default = 40)
Delevel_RETURN_TO_LEVEL = 40

αυτο ηταν κανουμε ενα save και ειμαστε ετοιμη...Δοκιμασμενο στο δικο μου σερβερ...αν σας εχω μπερδεψει ζητω συγνωμη αλλα ειναι το πρωτο μου share και οσο να πουμε εχω λιγο τρακ :P

 

 

Posted

kali prospa9ia file, ala pistevw oti 9a itane kalitera an to ekanes 3erw go .delevel 60 kai na se kanei 60 lvl

 

nvm, ty for share

  • 3 weeks later...
  • 4 months later...

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

    • I have a highly customized Hi5 pack based on L2JMobius with a lot of features for performance and modern game design. Disclaimer: I do not run any public server, but I run a "private" server for a group of 10 friends and about 2000 AI bots that required me to do heavy modifications on core systems of the game.  So my opinion will obivously be biased towards L2JMobius.   What I can tell you though without bias is: Most of the features you are asking for are nowadays considered de-facto, don't pay money for them. TvT, offline mode, community boards, premiums, vote rewards are in most packs including the open source ones. So before you pay a thousand plus euro for a pack ask yourself what you are paying that money for, that open source packs don't have.   Also a lot of the "strong points" some old packs were made for are nowadays obsolete. L2JFree derived packs for example used to have a lot of GC optimizations (Trove library) which are not not maintained, but most importantly not needed cause Java has evolved a lot since then and the performance issues these tricks tried to solve back then, are currently solved by Java's JVM itself. So if someone tries to sell you packed / unpacked integers in special hashmap data structures and other such things know that they have really lost their value nowadays.    A lot of people are selling thin air, things that everyone has. "Quality geodata" being one of them. I mean what's "quality geodata" ? Has someone painted them by hand ? Hell there's an online tool for free in github that extracts quality geodata, I think Galagard made it ? In contrast I'll tell you without wanting to boast about it that I use 3D navmesh on my project because 2000 bots could not pathfind large distances on A* on geodata. As far as I know, L2JMobius has it in its subscription version too. So if I could do an acceptable transition to navmesh from geodata in a week alone, I would assume that a decent pack with dedicated developers could do it better and faster. Red flag if someone still tries to sell you geodata in 2026.   Multi-protocol support gives small value and is a high risk.   I would not go for multi-protocol support for a public server cause you are locking yourself to specific providers and the functionality they support. If you need to change (eg pricing issues), you will be locked to a handful of providers. And what are you really gaining from a new client on an old game version ? Better UI ? The engine is still the same, static targeting and menus.    Agentic AI will make old hard features easy to implement, and drop their money value. Pay for AI-proof value. And compared to what most insecure devs claim, its a very powerful tool that allows those who know how to use it to accelerate their development. So a lot of features that took in the past a lot of time and effort to be developed and were a reason to charge money, are becoming a commodity today. So think to: The thing I am paying money for right now, how easy will it be to implement in a year from now ? If for example you are paying money for a game launcher that Claude Code can generate in top 1 hour without issues, I think you are wasting money.    I want to emphasise this a lot. Software engineering is in a transition atm. Most things that were mediocre to implement, launchers, guards, CMS, are nowadays easy. Yet the dev community continues to market them as premium content. They are not, sooner or later, when everyone starts selling them, they will realize that they will have to offer value in more complex features.  Private or public ? Bottom line is that a private pack and 1000 euro wont get you a sucessful server. You're the one that make it or break it. There have been many sucessful servers both in private packs and public packs in the past. It's really on the hands of the beholder, not on the source. A pack that plays good is a good indicator to buy as Trance said, but I would disagree that it's not enough. A server owner is not a player. He's a business man and has to account for longevity, vendor lock-in, expandability, hidden costs,  amortization, price changes and many more. Don't pick a pack based on how it played only.    
    • You don’t even need to look for a ghost project. Just buy the files from a project you’ve personally tested or played. That’s a much better starting point.
    • 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
    • You have to put deep inside your pocket for something like this, for sure 😄
    • Hello everyone, I'm looking for a High Five Java server pack for a long-term project. I'm not looking for free packs. I'm interested in purchasing a professional pack with full source code if it's worth the investment. My priorities are: Stable core Clean and well-structured source code Good geodata and AI Modern Community Board Offline Trade / Offline Craft Premium Account system Vote Reward system Auto Events (TvT, CTF, DM, etc.) HWID protection Auto Farm  Buffer / QoL systems Modern admin tools Good Olympiad & Seven Signs implementation Excellent instance support (Freya, Frintezza, Zaken, Beleth, etc.) A huge bonus would be: Multi-protocol support (High Five + newer clients such as Salvation/Classical clients) Full source code (no closed binaries) Some custom things over Elegia At the moment I'm considering packs like Sunrise and L2-Scripts, but I'd really like to hear opinions from people who have actually worked with them. If you've been running a serious High Five project, I'd appreciate your honest feedback: Which pack are you using? What are its strengths and weaknesses? Would you buy it again? Are there any better alternatives available today? I'm looking for real experience rather than advertisements. Thanks!
  • 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..