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

Posted

Eyxaristo :) polu file m gia ayto exw kanei kai to arxeio delevel.properties gia na to ri9mizoyn apo kei ;) yparxoun polles parages kai ides

  • 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

    • Hi, could someone please share a C1 L2 Off cheat code for local play?
    • I’ve worked with a web designer Tacoma before, and it really reminded me how much smoother projects run when design and development stay in sync. Your setup looks solid, and pairing clean UI work with steady backend support can save a ton of back‑and‑forth later. If you ever decide to push harder on conversions or need outside perspective on structure, that mix helped me spot gaps early on.
    • If you’re juggling mixed payment methods and tricky setups, I’ve found that easing the pressure on the subscription side can make the whole flow smoother. I started using Subscription Revenue Growth for handling my own recurring payments, upgrades, and all that messy churn stuff, and it took a big weight off. Pairing something stable for subs with your gateway setup can keep cashflow from going off the rails.
    • L2Avalon launches February 20 High Five project (Salvation client) focused on classic world progression — not instance spam and not “twink” metas. What is L2Avalon? L2Avalon is built around real Lineage 2 gameplay: farming spots, open world conflict, raids, epics, economy and competition. No Kamael Reduced instanced content **Discord:** https://discord.gg/NbM2cXmAem 🌐 **Website:** https://l2avalon.net Balance & Economy Every class is tuned to be viable in PvE and PvP Off-meta classes get buffed instead of adding power-creep garbage Adena-based economy Farming matters: boosted Drop/Spoil for each stage of progression Rates & Settings Dynamic XP: 50x (Lv 1–40) → 1x (Lv 78+) Staged progression with new content unlocking weekly Adena / Drop / Spoil: 3x / 5x / 5x NPC Buffer: 2 hours (Premium: 3 hours) Box limit: 2+1 windows per PC MP potion: 1000 MP, 10s cooldown Free2Play System (earn Donate Coins by playing) You don’t have to donate to progress. Donate Coins drop in-game, so everything is achievable through playtime and activity. Where Donate Coins drop: Mobs Lv 76+, Raid Bosses Lv 70+, Epic Bosses Auto-farm (controlled) Limit: only 1 window can use auto-farm at the same time Daily time: 1 hour/day without Premium Extra tickets: purchasable with PC Bang points (earned by being online) Disabled zones: CC / IT / FOG / VARKA / KETRA Equipment Changes Reworked set bonuses Reworked SA system Enchanted set bonuses Enchanted shirt bonuses Fake Epic jewelry (weakened alternative) Skills (High Five mechanics) New skills added Old skills updated New enchant branches + updated existing ones Subclass skills Clan skills Daily Activities (solo-friendly) Events / Missions / Instances Stages Soon — stage schedule and weekly unlocks will be published February 20 — we start. **Discord:** https://discord.gg/NbM2cXmAem 🌐 **Website:** https://l2avalon.net
  • 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..

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