Jump to content

[Share]Custom start lvl


Recommended Posts

as title says when someone login in game and his char is lvl 1 he will get the lvl you put in config

 

here is the patch

Index: config/main/altgame.properties
===================================================================
--- config/main/altgame.properties	(revision 1710)
+++ config/main/altgame.properties	(working copy)
@@ -121,6 +121,11 @@
DwarfRecipeLimit = 50
CommonRecipeLimit = 50

+# Allow custom starting lvl default:false
+AllowCustomStartLvl = false
+#Custom Start lvl for 85 lvl and 100% put 86
+CustomStartLvl = 1
+
# ----------------
# Section: Summons
# ----------------
Index: src/main/java/net/l2emuproject/Config.java
===================================================================
--- src/main/java/net/l2emuproject/Config.java	(revision 1710)
+++ src/main/java/net/l2emuproject/Config.java	(working copy)
@@ -1878,6 +1878,10 @@
	// ---------- Summons ---------------------------------------
	public static float			ALT_GAME_SUMMON_PENALTY_RATE;			// Alternative game summon penalty

+	// ------------ custom start lvl ------------
+	public static boolean		ALLOW_CUSTOM_CHAR_LVL;
+	public static int		CUSTOM_CHAR_LVL;
+
	//********************************************************************************************
	public static void loadAltConfig()
	{
@@ -1926,6 +1930,10 @@

			// ----------- Summmons -------------- 
			ALT_GAME_SUMMON_PENALTY_RATE = Float.parseFloat(altSettings.getProperty("AltSummonPenaltyRate", "1."));
+
+			// ------------ custom start lvl ------------
+			ALLOW_CUSTOM_CHAR_LVL = Boolean.parseBoolean(altSettings.getProperty("AllowCustomStartLvl", "false"));
+			CUSTOM_CHAR_LVL = Integer.parseInt(altSettings.getProperty("CustomStartLvl", "1"));
		}
		catch (Exception e)
		{
Index: src/main/java/net/l2emuproject/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- src/main/java/net/l2emuproject/gameserver/network/clientpackets/EnterWorld.java	(revision 1710)
+++ src/main/java/net/l2emuproject/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -43,6 +43,7 @@
import net.l2emuproject.gameserver.model.L2World;
import net.l2emuproject.gameserver.model.actor.appearance.PcAppearance;
import net.l2emuproject.gameserver.model.actor.instance.L2PcInstance;
+import net.l2emuproject.gameserver.model.base.Experience;
import net.l2emuproject.gameserver.model.entity.Castle;
import net.l2emuproject.gameserver.model.entity.ClanHall;
import net.l2emuproject.gameserver.model.entity.Couple;
@@ -568,6 +569,11 @@

		if (activeChar.isCursedWeaponEquipped())
			CursedWeaponsManager.getInstance().getCursedWeapon(activeChar.getCursedWeaponEquippedId()).cursedOnLogin(activeChar);
+
+		if (Config.ALLOW_CUSTOM_CHAR_LVL && (activeChar.getLevel() == 1))
+		{
+			activeChar.getStat().addExp(Experience.LEVEL[Config.CUSTOM_CHAR_LVL]);
+		}
	}

	/**

 

if you put in config 85 level the char will be 85 lvl and 0% if you need 85 lvl and 100% put in config 86

 

works for me on l2emu gracia part 2

Link to comment
Share on other sites

1st- Using a lot of ifs in that case is just dumb, use switch instead;

2nd- Enterworld is not the proper place to use it, it works indeed, but its not the right place.

3rd- Using that on Enterworld without actually checking if its the main cass is just dumb since if someone relogs with a Sub he'll get max level too ,it may be what you want, but its not safe. Just add a if(getActiveClass().isSub()).

4th- You shouldn't use a switch or ifs at all,just get the value from the Config and Compare it to the CharacterExperience and thus getting the right exp ^^

Link to comment
Share on other sites

the char must be lvl 1 to get the exp this way when someone relogs he wont take more exp

 

 

EDIT: i update the first post now i think the code is better than before

Exactly,thats what I meant.That is not only cleaner code ,you also removed useless code and made it faster ^^ gz. But still its not the right place ;)

Link to comment
Share on other sites

I alredy shared that please search before share things.

 

http://www.maxcheaters.com/forum/index.php?topic=46604.0

 

Also what Horus is try to say is that code is better in the charactercreate clientpacket not in enterworld but anyway ok

Link to comment
Share on other sites

I alredy shared that please search before share things.

 

http://www.maxcheaters.com/forum/index.php?topic=46604.0

 

Also what Horus is try to say is that code is better in the charactercreate clientpacket not in enterworld but anyway ok

Sorry I completely forgot about this Thread lool. Indeed its much smarter on charactercreate , that way you avoid a useless check on Enterworld = Slightly (REALLY Slightly lol) more Stable Server.

Link to comment
Share on other sites

  • 1 month later...
Guest
This topic is now closed to further replies.


×
×
  • Create New...