Jump to content

Recommended Posts

Posted

Hizzz (again) :P

Before some days one friend ask me to make for his server a mod that's when they reach the ex '5' pvp will gain hero status!

At the start it was with skills but it was unfair for other players so i put a code to check if the hero is by the olympiad or by the pvp!

If The hero was from olympiad he will have the skills if not he will not!

And Today i am glad to say after many tests on our test server is working perfectly!

 

Here's the code:


Index: C:/Users/Home/Desktop/eclipse/workspace/L2JTeon-CORE/java/config/zozoqcustoms.properties
===================================================================
--- C:/Users/Home/Desktop/eclipse/workspace/L2JTeon-CORE/java/config/zozoqcustoms.properties	(revision 0)
+++ C:/Users/Home/Desktop/eclipse/workspace/L2JTeon-CORE/java/config/zozoqcustoms.properties	(revision 0)
@@ -0,0 +1,61 @@
+# -------------------------------
+# Custom Mods for L2Legend Server
+# -------------------------------
+
+# Hero at kills!
+# Added Hero Check for Olympiad Heroes!
+AllowPvpHero = False
+#Give hero skills at pvp hero?
+GivePvpHeroSkills = False
+#Remove Olympiad hero status on death? This is not for ever!
+RemoveOlympiadHero = False
\ No newline at end of file

Index: C:/Users/Home/Desktop/eclipse/workspace/L2JTeon-CORE/java/net/sf/l2j/Config.java
===================================================================
--- C:/Users/Home/Desktop/eclipse/workspace/L2JTeon-CORE/java/net/sf/l2j/Config.java	(revision 666)
+++ C:/Users/Home/Desktop/eclipse/workspace/L2JTeon-CORE/java/net/sf/l2j/Config.java	(working copy)
@@ -73,6 +73,7 @@
	public static final String OLYMPIAD_FILE = "./config/custom/Olympiad.properties";
	public static final String AUGMENT_CONFIG_FILE = "./config/custom/Augment.properties";
	public static final String DEV_CONFIG_FILE = "./config/custom/Dev.properties";
+	public static final String ZOZOQ_FILE = "./config/zozoqcustoms.properties";

	/** Server and Datapack version */
	public static String SERVER_VERSION;
@@ -1449,6 +1450,27 @@
	public static boolean DATABASE_AUTO_CHECK;
	public static boolean DATABASE_AUTO_OPTIMIZE;
	public static boolean DATABASE_AUTO_REPAIR;
+	
+	
+	/**
+	 * TODO: Adding more Features to server!!!
+	 */
+	public static boolean ALLOW_PVP_HERO;
+      public static boolean GIVE_PVP_HERO_SKILLS;
+      public static boolean REMOVE_OLYMPIAD_HERO;

	/**
	 * This class initializes all global variables for configuration.<br>
@@ -1853,6 +1875,35 @@
				e.printStackTrace();
				throw new Error("Failed to Load " + GM_ACCESS_FILE + " File.");
			}
+			// TODO: Adding more Features
+			try
+			{
+				Properties legend = new Properties();
+				InputStream is = new FileInputStream(new File(ZOZOQ_FILE));
+				legend.load(is);
+				is.close();
+				ALLOW_PVP_HERO = Boolean.parseBoolean(legend.getProperty("AllowPvpHero", "False"));
+                              GIVE_PVP_HERO_SKILLS = Boolean.parseBoolean(legend.getProperty("GivePvpHeroSkills", "False"));
+                              REMOVE_OLYMPIAD_HERO = Boolean.parseBoolean(legend.getProperty("RemoveOlympiadHero", "False"));
+			}
+			catch (Exception e)
+			{
+				e.printStackTrace();
+				throw new Error("Failed to Load " + ZOZOQ_FILE + " File.");
+			}
			// id factory
			try
			{

Index: C:/Users/Home/Desktop/eclipse/workspace/L2JTeon-CORE/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- C:/Users/Home/Desktop/eclipse/workspace/L2JTeon-CORE/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 666)
+++ C:/Users/Home/Desktop/eclipse/workspace/L2JTeon-CORE/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -14,6 +14,7 @@
 */
package net.sf.l2j.gameserver.model.actor.instance;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -110,6 +111,7 @@
import net.sf.l2j.gameserver.model.L2Skill.SkillTargetType;
import net.sf.l2j.gameserver.model.L2Skill.SkillType;
import net.sf.l2j.gameserver.model.actor.appearance.PcAppearance;
import net.sf.l2j.gameserver.model.actor.knownlist.PcKnownList;
import net.sf.l2j.gameserver.model.actor.stat.PcStat;
import net.sf.l2j.gameserver.model.actor.status.PcStatus;
@@ -121,6 +123,7 @@
import net.sf.l2j.gameserver.model.base.SubClass;
import net.sf.l2j.gameserver.model.entity.Castle;
import net.sf.l2j.gameserver.model.entity.Duel;
+import net.sf.l2j.gameserver.model.entity.Hero;
import net.sf.l2j.gameserver.model.entity.L2Event;
import net.sf.l2j.gameserver.model.entity.Siege;
import net.sf.l2j.gameserver.model.entity.L2JTeonEvents.CTF;
@@ -489,6 +492,12 @@
	private TradeList _buyList;
	/** true if the L2PcInstance is newbie */
	private boolean _newbie;
+	/**Pvp Hero System*/
+	private int pvpHeroSystem = 0;
	private boolean _noble = false;
    private boolean _fakeHero = false;
	private boolean _hero = false;

@@ -4466,6 +4550,51 @@
				}
			}
		}
+	
+			if (Config.ALLOW_PVP_HERO)
+			{
+                              if (Config.REMOVE_OLYMPIAD_HERO)
+                              {
+				       pvpHeroSystem = 0;
+				        if (isHero() && Hero.getInstance().getHeroes() != null && Hero.getInstance().getHeroes().containsKey(getObjectId()))
+				        {
+					       return false;
+				         }
+				         else if (isHero())
+				         {
+					      setHero(false);
+					      Announcements.getInstance().announceToAll(getName()+" lost hero status");
+				         }
+			         }
+                               else
+                               {
+				         if (isHero())
+				         {
+					      setHero(false);
+					      Announcements.getInstance().announceToAll(getName()+" lost hero status");
+				         }
+
		setPvpFlag(0); // Clear the pvp flag
		// Unsummon Cubics
		if (_cubics.size() > 0)
@@ -4770,10 +4899,67 @@
		// Add to attacker and increase its PK counter
		setPvpKills(getPvpKills() + 1);
		updatePvPColor(getPvpKills());
+		
+			if (Config.ALLOW_PVP_HERO)
+			{
+				pvpHeroSystem++;
+				switch(pvpHeroSystem) {
+				case 5:
+                                      if (!isHero())
+					{
+					setHero(true);
+					Announcements.getInstance().announceToAll(getName()+" gain hero status for killing row!");
+					}
+					break;
+					default:
+						;
+				}
+			}
+
		// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
		sendPacket(new UserInfo(this));
	}

+
	/**
	 * Get info on pk's from PK table
	 */
@@ -9146,7 +9332,7 @@

	public void setHero(boolean hero)
	{
-			if (hero && _baseClass == _activeClass)
-			{
-				for (L2Skill s : HeroSkillTable.GetHeroSkills())
-					addSkill(s, false); //Dont Save Hero skills to database
-			}
-			else
-			{
-				for (L2Skill s : HeroSkillTable.GetHeroSkills())
-					super.removeSkill(s); //Just Remove skills from nonHero characters
-			}
+		if (!Config.GIVE_PVP_HERO_SKILLS)
+		{
+		if (Hero.getInstance().getHeroes() != null && Hero.getInstance().getHeroes().containsKey(getObjectId()) && hero && _baseClass == _activeClass)
+		{
+			for (L2Skill s : HeroSkillTable.GetHeroSkills())
+				addSkill(s, false); //Dont Save Hero skills to database
+		}
+		else
+		{
+			for (L2Skill s : HeroSkillTable.GetHeroSkills())
+				super.removeSkill(s); //Just Remove skills from nonHero characters
+		}
+		}
+		else
+		{
+			if (hero && _baseClass == _activeClass)
+			{
+				for (L2Skill s : HeroSkillTable.GetHeroSkills())
+					addSkill(s, false); //Dont Save Hero skills to database
+			}
+			else
+			{
+				for (L2Skill s : HeroSkillTable.GetHeroSkills())
+					super.removeSkill(s); //Just Remove skills from nonHero characters
+			}
+                  }
	_hero = hero;

	sendSkillList();


Enjoy!

Credits: Me


I am never but never don't leach other ppl work! So please do not say i stole it!

Oh and is not arleady shares as the other codes is different from mine!

If you want use it if not good!

Friendly ZozOQ

 

Posted

I am working on this! Soon with more configs such remove hero if is from olympiad on death (if they want) and give pvp hero skills!!

EDIT:

Updated!! 2 More Configs!

Posted

No is not only hero glow! You have all the rights of a hero such hero voice! and you can choose if this kind of hero can have hero skills!

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 can see that the admins arent taking any action, yet they still seem willing to share information about various other people names and IP addresses. But when it comes to scams, no one reacts.      
    • Server Info Chronicle:  Interlude                                                                                                                                    XP: 100x | SP: 100x | Drop: 50x | Adena: 75x Enchant: Safe +3 |  Max +21 Website: Website Link Discord: Discord Link   WHY? When I was a teenager I had this idea. Build my own Lineage 2 server. My own rules. My own world. I wasn't a programmer. I had no idea how any of it worked. I tried, hit a wall, and quit. But the idea never left. I came back years later. Got further. Quit again. Watched friends try similar things. The idea stayed stuck in my head for fifteen years. I'm a developer now. I finally finished it. Not because I suddenly had more time - I have a full-time job and real responsibilities. An hour before bed if I'm lucky. That's actually exactly why I finished it.   The problem I kept running into I still love this game. But every server I tried as an adult made that one hour feel worthless. Log in, kill a few mobs, make no real progress, log out frustrated. The game was designed for someone with unlimited time. That person doesn't exist in my life anymore. I looked around. Everyone I used to play with has the same problem. Same love for the game. Same lack of time. Jobs, families, maybe an hour late at night. So I stopped waiting for someone else to build it.           WHAT? Custom starting zone in Gludin (up until 2nd profession start) Talent system - rebirth at level 80 and choose your talents Bounty hunter system - daily tasks to kill random monsters to receive great reward! Potion crafting system - custom HP/MP potions and recipes Custom 1st & 2nd class quests (shorter) Scheme buffer Shop until C grade   Visit our website to get more info: Website Link   The philosophy 95% of the game is completely soloable. No clan required. No raid schedules. No guilt when you have to log off. You are the solo director of your own session. Log in, pursue your goal for an hour, log out on your own terms. When you've conquered what you wanted - you stop naturally. A new season drops with fresh Talent Tree changes and you come back to build something completely different. No endless stretched grind. No pay-to-win. No shady admin decisions. No surprise wipes. I'm one developer who built this because I love it.                                          This is the server I needed fifteen years ago. Glad I finally had the skills to build it. Come see what I made. [Forever Lineage]
    • Hello MaxCheaters community! We’ve all been there: you spend months customizing your NPCs, balancing classes, and setting up the perfect farm zones. You launch your server, the hype is real, and suddenly you hit 200 players—and the "delay" starts. The mobs stop reacting, the Olympiad matches stutter, and your players start complaining on Discord. Many "newbie" admins think the solution is just throwing more RAM at the VPS. While hardware matters, Java is a finicky beast. If you don't tune your JVM (Java Virtual Machine) and your core code, you’ll lag even on a NASA supercomputer. Today, I’m sharing a deep dive into optimizing your L2 server for maximum performance. 1. The Myth of "More RAM" The biggest mistake people make is assigning 32GB of RAM to a server that only needs 8GB. In Java, if your Heap size is too large, the "Garbage Collector" (GC) has to work much harder. When the GC runs a "Full GC" cycle on a massive heap, it performs a "Stop-the-World" event. This literally freezes your server threads for 1–3 seconds to clear memory. Recommendation: For a mid-rate server with 500 players, 6GB to 8GB of Xmx (Max Heap) is usually the sweet spot. Use G1GC (Garbage First Garbage Collector) instead of the old ParallelGC. It handles large heaps much more gracefully by breaking memory into regions. 2. JVM Startup Flags (The Secret Sauce) Don't just run java -jar l2jserver.jar. You need specific flags to ensure the CPU prioritizes the right tasks. Try adding these to your start.sh or start.bat: Bash   -Xms6G -Xmx6G -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:+TieredCompilation MaxGCPauseMillis=50: This tells Java, "Try not to freeze the server for more than 50ms at a time." It makes the gameplay feel much smoother for the end-user. 3. Geodata and Pathfinding Optimization Geodata is the biggest CPU killer in Lineage 2. Every time a mob moves or a player clicks, the server calculates "Can I see this target?" and "Is there a wall in the way?". The Fix: Use a "Pathfinding Cache." If 100 players are running from the Giran Gate to the Luxury Shop, the server shouldn't calculate that path 100 times. Check your Geodata format: Ensure you are using the .l2j or .dat formats optimized for your specific core. If your console is flooded with "Pathfind node limit reached," increase your node limit in the geo.properties file, but be prepared for higher RAM usage. 4. Database Pooling (HikariCP vs. C3P0) If your server freezes for a split second every time someone saves their character or buys an item, your Database Connection Pool is the bottleneck. Most old L2J cores use C3P0, which is outdated and slow. Switch to HikariCP: It is significantly faster and handles "dead" connections much better. Also, ensure your characters and items tables are indexed correctly in MySQL. Running a VACUUM or OPTIMIZE TABLE once a week can prevent those annoying "saving player data" spikes. 5. Network Threading In your server settings, look for "Network" or "Thread" configurations. Usually, you’ll see SelectorThreads and WorkerThreads. Selector Threads: Should be equal to the number of physical CPU cores. Worker Threads: This is where the logic happens (skills, movement). If this is too low, actions will "queue up," creating a delay even if your ping is low. 6. Community Board (BBS) Optimization On MaxCheaters, we love fancy Community Boards. However, if your Buffer or Shop script is poorly coded, it might be reloading the entire HTML from the hard drive every time a player clicks a button. The Fix: Ensure your scripts cache the HTML in the RAM. Reading from an SSD is fast, but reading from RAM is thousands of times faster. Conclusion Optimization isn't a "one-click" fix; it’s about finding the balance between your hardware and your software. Start with your JVM flags, clean up your Geodata settings, and make sure your Database isn't choking on old logs. If you found this helpful, leave a comment or a "Thank You" below! If you have specific lag issues with a certain core (aCis, L2Emu, etc.), post your server.properties and I’ll try to help you tune it.
  • 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..