Jump to content

Recommended Posts

Posted

Well, a guy here was asking for this code (I explained at the title) and, since I decided to rework on Vago's one, I said "why don't I share it here, in case somebody else needs it too?"

And that's what I'm gonna do.

 

Explanation: Well, this is Vago's Color System but I have: Fixed his bugs, Fixed the patch (by creating a new one), Reworked on the second part by adding PvP settings instead of pk.

So now the whole system works with PvPs.

 

The following code is a rework at l2jteon's color system (as the guy in the topic requested), but of course you can add it in any project without errors.

 

Index: L2JTeon/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- L2JTeon/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 526)
+++ L2JTeon/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -3655,23 +3655,23 @@
	{
		if (Config.PVP_COLOR_SYSTEM_ENABLED)
		{
-			// Check if the character has GM access and if so, let them be.
+			//Check if the character has GM access and if so, let them be.
			if (isGM())
				return;
			{
-				if ((pvpKillAmount >= (Config.PVP_AMOUNT1)) && (pvpKillAmount < (Config.PVP_AMOUNT2)))
+				if ((pvpKillAmount >= (Config.PVP_AMOUNT1)) && (pvpKillAmount <= (Config.PVP_AMOUNT2)))
				{
					getAppearance().setNameColor(Config.NAME_COLOR_FOR_PVP_AMOUNT1);
				}
-				else if ((pvpKillAmount >= (Config.PVP_AMOUNT2)) && (pvpKillAmount < (Config.PVP_AMOUNT3)))
+				else if ((pvpKillAmount >= (Config.PVP_AMOUNT2)) && (pvpKillAmount <= (Config.PVP_AMOUNT3)))
				{
					getAppearance().setNameColor(Config.NAME_COLOR_FOR_PVP_AMOUNT2);
				}
-				else if ((pvpKillAmount >= (Config.PVP_AMOUNT3)) && (pvpKillAmount < (Config.PVP_AMOUNT4)))
+				else if ((pvpKillAmount >= (Config.PVP_AMOUNT3)) && (pvpKillAmount <= (Config.PVP_AMOUNT4)))
				{
					getAppearance().setNameColor(Config.NAME_COLOR_FOR_PVP_AMOUNT3);
				}
-				else if ((pvpKillAmount >= (Config.PVP_AMOUNT4)) && (pvpKillAmount < (Config.PVP_AMOUNT5)))
+				else if ((pvpKillAmount >= (Config.PVP_AMOUNT4)) && (pvpKillAmount <= (Config.PVP_AMOUNT5)))
				{
					getAppearance().setNameColor(Config.NAME_COLOR_FOR_PVP_AMOUNT4);
				}
@@ -3682,43 +3682,42 @@
			}
		}
	}
-
-	// Custom PVP Color System - End
-	// Custom Pk Color System - Start
-	public void updatePkColor(int pkKillAmount)
+	//Custom PVP Color System - End
+	
+	// Custom PVP Title Color System - Start
+	public void updatePvPTitleColor(int pvpKillAmount)
	{
		if (Config.PK_COLOR_SYSTEM_ENABLED)
		{
-			// Check if the character has GM access and if so, let them be, like above.
+			//Check if the character has GM access and if so, let them be, like above.
			if (isGM())
				return;
			{
-				if ((pkKillAmount >= (Config.PK_AMOUNT1)) && (pkKillAmount < (Config.PVP_AMOUNT2)))
+				if ((pvpKillAmount >= (Config.TITLE_COLOR_FOR_PVP_AMOUNT1)) && (pvpKillAmount <= (Config.PVP_AMOUNT2)))
				{
-					getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PK_AMOUNT1);
+					getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT1);
				}
-				else if ((pkKillAmount >= (Config.PK_AMOUNT2)) && (pkKillAmount < (Config.PVP_AMOUNT3)))
+				else if ((pvpKillAmount >= (Config.TITLE_COLOR_FOR_PVP_AMOUNT2)) && (pvpKillAmount <= (Config.PVP_AMOUNT3)))
				{
-					getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PK_AMOUNT2);
+					getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT2);
				}
-				else if ((pkKillAmount >= (Config.PK_AMOUNT3)) && (pkKillAmount < (Config.PVP_AMOUNT4)))
+				else if ((pvpKillAmount >= (Config.TITLE_COLOR_FOR_PVP_AMOUNT3)) && (pvpKillAmount <= (Config.PVP_AMOUNT4)))
				{
-					getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PK_AMOUNT3);
+					getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT3);
				}
-				else if ((pkKillAmount >= (Config.PK_AMOUNT4)) && (pkKillAmount < (Config.PVP_AMOUNT5)))
+				else if ((pvpKillAmount >= (Config.TITLE_COLOR_FOR_PVP_AMOUNT4)) && (pvpKillAmount <= (Config.PVP_AMOUNT5)))
				{
-					getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PK_AMOUNT4);
+					getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT4);
				}
-				else if (pkKillAmount >= (Config.PK_AMOUNT5))
+				else if (pvpKillAmount >= (Config.TITLE_COLOR_FOR_PVP_AMOUNT5))
				{
-					getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PK_AMOUNT5);
+					getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT5);
				}
			}
		}
	}
+	//Custom PVP Title Color System - End

-	// Custom Pk Color System - End
-
	/**
	 * Send a Server->Client packet UserInfo to this L2PcInstance and CharInfo to all L2PcInstance in its _KnownPlayers.<BR>
	 * <B><U> Concept</U> :</B><BR>
@@ -4727,7 +4726,10 @@
         
		// Add to attacker and increase its PK counter
		setPvpKills(getPvpKills() + 1);
+		
		updatePvPColor(getPvpKills());
+		updatePvPTitleColor(getPvpKills());
+		
		// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
		sendPacket(new UserInfo(this));
	}
@@ -4894,7 +4896,7 @@
		// Add karma to attacker and increase its PK counter
		setPkKills(getPkKills() + 1);
		setKarma(getKarma() + newKarma);
-		updatePkColor(getPkKills());
+		
		// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
		sendPacket(new UserInfo(this));
	}
Index: L2JTeon/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- L2JTeon/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(revision 526)
+++ L2JTeon/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -267,14 +267,14 @@
		activeChar.checkBanChat(false);
		// restore info about auto herbs loot

-		// Color System checks - Start =====================================================
-		// Check if the custom PvP and PK color systems are enabled and if so ==============
-		// check the character's counters and apply any color changes that must be done. ===
-		if (activeChar.getPvpKills() >= (Config.PVP_AMOUNT1) && (Config.PVP_COLOR_SYSTEM_ENABLED))
-			activeChar.updatePvPColor(activeChar.getPvpKills());
-		if (activeChar.getPkKills() >= (Config.PK_AMOUNT1) && (Config.PK_COLOR_SYSTEM_ENABLED))
-			activeChar.updatePkColor(activeChar.getPkKills());
-		// Color System checks - End =======================================================
+		// ==========================================================================================================================================================
+        // Color System checks - Start ==============================================================================================================================
+        // Check if the custom PvP color systems are enabled and if so ==============================================================================================
+        // check the character's counters and apply any color changes that must be done. ============================================================================
+        if (activeChar.getPvpKills()>=(Config.PVP_AMOUNT1) && (Config.PVP_COLOR_SYSTEM_ENABLED)) activeChar.updatePvPColor(activeChar.getPvpKills());
+        if (activeChar.getPvpKills()>=(Config.PVP_TITLE_AMOUNT1) && (Config.PK_COLOR_SYSTEM_ENABLED)) activeChar.updatePvPTitleColor(activeChar.getPvpKills());
+        // Color System checks - End =================================================================================================================================
+        // ===========================================================================================================================================================

		if (Config.ALLOW_AUTOHERBS_CMD)
			activeChar.getAutoLootHerbs();
Index: L2JTeon/java/net/sf/l2j/Config.java
===================================================================
--- L2JTeon/java/net/sf/l2j/Config.java	(revision 526)
+++ L2JTeon/java/net/sf/l2j/Config.java	(working copy)
@@ -814,50 +814,29 @@
	public static int PK_REWARD_COUNT;

	// ** Colored pvp name system ** //
-	public static boolean PVP_COLOR_SYSTEM_ENABLED;
+	public static boolean		PVP_COLOR_SYSTEM_ENABLED;
+	public static int			PVP_AMOUNT1;
+	public static int			PVP_AMOUNT2;
+	public static int			PVP_AMOUNT3;
+	public static int			PVP_AMOUNT4;
+	public static int			PVP_AMOUNT5;
+	public static int			NAME_COLOR_FOR_PVP_AMOUNT1;
+	public static int			NAME_COLOR_FOR_PVP_AMOUNT2;
+	public static int			NAME_COLOR_FOR_PVP_AMOUNT3;
+	public static int			NAME_COLOR_FOR_PVP_AMOUNT4;
+	public static int			NAME_COLOR_FOR_PVP_AMOUNT5;
+	public static boolean		PK_COLOR_SYSTEM_ENABLED;
+	public static int			PVP_TITLE_AMOUNT1;
+	public static int			PVP_TITLE_AMOUNT2;
+	public static int			PVP_TITLE_AMOUNT3;
+	public static int			PVP_TITLE_AMOUNT4;
+	public static int			PVP_TITLE_AMOUNT5;
+	public static int			TITLE_COLOR_FOR_PVP_AMOUNT1;
+	public static int			TITLE_COLOR_FOR_PVP_AMOUNT2;
+	public static int			TITLE_COLOR_FOR_PVP_AMOUNT3;
+	public static int			TITLE_COLOR_FOR_PVP_AMOUNT4;
+	public static int			TITLE_COLOR_FOR_PVP_AMOUNT5;
	/** Colored pvp name system */
-	public static int PVP_AMOUNT1;
-	/** Colored pvp name system */
-	public static int PVP_AMOUNT2;
-	/** Colored pvp name system */
-	public static int PVP_AMOUNT3;
-	/** Colored pvp name system */
-	public static int PVP_AMOUNT4;
-	/** Colored pvp name system */
-	public static int PVP_AMOUNT5;
-	/** Colored pvp name system */
-	public static int NAME_COLOR_FOR_PVP_AMOUNT1;
-	/** Colored pvp name system */
-	public static int NAME_COLOR_FOR_PVP_AMOUNT2;
-	/** Colored pvp name system */
-	public static int NAME_COLOR_FOR_PVP_AMOUNT3;
-	/** Colored pvp name system */
-	public static int NAME_COLOR_FOR_PVP_AMOUNT4;
-	/** Colored pvp name system */
-	public static int NAME_COLOR_FOR_PVP_AMOUNT5;
-	/** Colored pvp name system */
-	public static boolean PK_COLOR_SYSTEM_ENABLED;
-	/** Colored pk name system */
-	public static int PK_AMOUNT1;
-	/** Colored pk name system */
-	public static int PK_AMOUNT2;
-	/** Colored pk name system */
-	public static int PK_AMOUNT3;
-	/** Colored pk name system */
-	public static int PK_AMOUNT4;
-	/** Colored pk name system */
-	public static int PK_AMOUNT5;
-	/** Colored pk name system */
-	public static int TITLE_COLOR_FOR_PK_AMOUNT1;
-	/** Colored pk name system */
-	public static int TITLE_COLOR_FOR_PK_AMOUNT2;
-	/** Colored pk name system */
-	public static int TITLE_COLOR_FOR_PK_AMOUNT3;
-	/** Colored pk name system */
-	public static int TITLE_COLOR_FOR_PK_AMOUNT4;
-	/** Colored pk name system */
-	public static int TITLE_COLOR_FOR_PK_AMOUNT5;
-	/** Colored pk name system */

	// * Baby Pets Customizations *//
	/** Can Baby Pets Grow Up? * */
@@ -2659,30 +2638,30 @@
				BANKING_SYSTEM_ADENA = Integer.parseInt(L2JTeonCustom.getProperty("BankingSystemAdena", "0"));
				BANKING_SYSTEM_GOLDBARS = Integer.parseInt(L2JTeonCustom.getProperty("BankingSystemGoldBars", "0"));
				// ************************//
-				/* PvP E Pk Color System */
+				/* PvP Color System       */
				// **********************//
-				PVP_COLOR_SYSTEM_ENABLED = Boolean.parseBoolean(L2JTeonCustom.getProperty("EnablePvPColorSystem", "False"));
-				PVP_AMOUNT1 = Integer.parseInt(L2JTeonCustom.getProperty("PvpAmount1", "500"));
-				PVP_AMOUNT2 = Integer.parseInt(L2JTeonCustom.getProperty("PvpAmount2", "1000"));
-				PVP_AMOUNT3 = Integer.parseInt(L2JTeonCustom.getProperty("PvpAmount3", "1500"));
-				PVP_AMOUNT4 = Integer.parseInt(L2JTeonCustom.getProperty("PvpAmount4", "2500"));
-				PVP_AMOUNT5 = Integer.parseInt(L2JTeonCustom.getProperty("PvpAmount5", "5000"));
-				NAME_COLOR_FOR_PVP_AMOUNT1 = Integer.decode("0x" + L2JTeonCustom.getProperty("ColorForAmount1", "00FF00"));
-				NAME_COLOR_FOR_PVP_AMOUNT2 = Integer.decode("0x" + L2JTeonCustom.getProperty("ColorForAmount2", "00FF00"));
-				NAME_COLOR_FOR_PVP_AMOUNT3 = Integer.decode("0x" + L2JTeonCustom.getProperty("ColorForAmount3", "00FF00"));
-				NAME_COLOR_FOR_PVP_AMOUNT4 = Integer.decode("0x" + L2JTeonCustom.getProperty("ColorForAmount4", "00FF00"));
-				NAME_COLOR_FOR_PVP_AMOUNT5 = Integer.decode("0x" + L2JTeonCustom.getProperty("ColorForAmount4", "00FF00"));
-				PK_COLOR_SYSTEM_ENABLED = Boolean.parseBoolean(L2JTeonCustom.getProperty("EnablePkColorSystem", "False"));
-				PK_AMOUNT1 = Integer.parseInt(L2JTeonCustom.getProperty("PkAmount1", "500"));
-				PK_AMOUNT2 = Integer.parseInt(L2JTeonCustom.getProperty("PkAmount2", "1000"));
-				PK_AMOUNT3 = Integer.parseInt(L2JTeonCustom.getProperty("PkAmount3", "1500"));
-				PK_AMOUNT4 = Integer.parseInt(L2JTeonCustom.getProperty("PkAmount4", "2500"));
-				PK_AMOUNT5 = Integer.parseInt(L2JTeonCustom.getProperty("PkAmount5", "5000"));
-				TITLE_COLOR_FOR_PK_AMOUNT1 = Integer.decode("0x" + L2JTeonCustom.getProperty("TitleForAmount1", "00FF00"));
-				TITLE_COLOR_FOR_PK_AMOUNT2 = Integer.decode("0x" + L2JTeonCustom.getProperty("TitleForAmount2", "00FF00"));
-				TITLE_COLOR_FOR_PK_AMOUNT3 = Integer.decode("0x" + L2JTeonCustom.getProperty("TitleForAmount3", "00FF00"));
-				TITLE_COLOR_FOR_PK_AMOUNT4 = Integer.decode("0x" + L2JTeonCustom.getProperty("TitleForAmount4", "00FF00"));
-				TITLE_COLOR_FOR_PK_AMOUNT5 = Integer.decode("0x" + L2JTeonCustom.getProperty("TitleForAmount5", "00FF00"));
+				PVP_COLOR_SYSTEM_ENABLED = Boolean.parseBoolean(L2JTeonCustom.getProperty("EnablePvPColorSystem", "false"));
+    			PVP_AMOUNT1 = Integer.parseInt(L2JTeonCustom.getProperty("PvpAmount1", "500"));
+    			PVP_AMOUNT2 = Integer.parseInt(L2JTeonCustom.getProperty("PvpAmount2", "1000"));
+    			PVP_AMOUNT3 = Integer.parseInt(L2JTeonCustom.getProperty("PvpAmount3", "1500"));
+    			PVP_AMOUNT4 = Integer.parseInt(L2JTeonCustom.getProperty("PvpAmount4", "2500"));
+    			PVP_AMOUNT5 = Integer.parseInt(L2JTeonCustom.getProperty("PvpAmount5", "5000"));
+    			NAME_COLOR_FOR_PVP_AMOUNT1 = Integer.decode("0x" + L2JTeonCustom.getProperty("ColorForAmount1", "00FF00"));
+    			NAME_COLOR_FOR_PVP_AMOUNT2 = Integer.decode("0x" + L2JTeonCustom.getProperty("ColorForAmount2", "00FF00"));
+    			NAME_COLOR_FOR_PVP_AMOUNT3 = Integer.decode("0x" + L2JTeonCustom.getProperty("ColorForAmount3", "00FF00"));
+    			NAME_COLOR_FOR_PVP_AMOUNT4 = Integer.decode("0x" + L2JTeonCustom.getProperty("ColorForAmount4", "00FF00"));
+    			NAME_COLOR_FOR_PVP_AMOUNT5 = Integer.decode("0x" + L2JTeonCustom.getProperty("ColorForAmount4", "00FF00"));
+    			PK_COLOR_SYSTEM_ENABLED = Boolean.parseBoolean(L2JTeonCustom.getProperty("EnablePvPTitleColorSystem", "false"));
+    			PVP_TITLE_AMOUNT1 = Integer.parseInt(L2JTeonCustom.getProperty("PvPTitleAmount1", "500"));
+    			PVP_TITLE_AMOUNT2 = Integer.parseInt(L2JTeonCustom.getProperty("PvPTitleAmount2", "1000"));
+    			PVP_TITLE_AMOUNT3 = Integer.parseInt(L2JTeonCustom.getProperty("PvPTitleAmount3", "1500"));
+    			PVP_TITLE_AMOUNT4 = Integer.parseInt(L2JTeonCustom.getProperty("PvPTitleAmount4", "2500"));
+    			PVP_TITLE_AMOUNT5 = Integer.parseInt(L2JTeonCustom.getProperty("PvPTitleAmount5", "5000"));
+    			TITLE_COLOR_FOR_PVP_AMOUNT1 = Integer.decode("0x" + L2JTeonCustom.getProperty("TitleForAmount1", "00FF00"));
+    			TITLE_COLOR_FOR_PVP_AMOUNT2 = Integer.decode("0x" + L2JTeonCustom.getProperty("TitleForAmount2", "00FF00"));
+    			TITLE_COLOR_FOR_PVP_AMOUNT3 = Integer.decode("0x" + L2JTeonCustom.getProperty("TitleForAmount3", "00FF00"));
+    			TITLE_COLOR_FOR_PVP_AMOUNT4 = Integer.decode("0x" + L2JTeonCustom.getProperty("TitleForAmount4", "00FF00"));
+    			TITLE_COLOR_FOR_PVP_AMOUNT5 = Integer.decode("0x" + L2JTeonCustom.getProperty("TitleForAmount5", "00FF00"));
				// PvP and PK Reward
				ALLOW_PVP_REWARD = Boolean.parseBoolean(L2JTeonCustom.getProperty("AllowPvpRewardSystem", "False"));
				PVP_REWARD_ITEM = Integer.parseInt(L2JTeonCustom.getProperty("PvpRewardItem", "57"));
Index: L2JTeon/java/config/Custom/L2JTeonCustom.properties
===================================================================
--- L2JTeon/java/config/Custom/L2JTeonCustom.properties	(revision 526)
+++ L2JTeon/java/config/Custom/L2JTeonCustom.properties	(working copy)
@@ -528,62 +528,62 @@
L2WalkerProtection = False

# ---------------------------------------
-# Change Name's Color Via PvP's
+# PvP Name Color Change System by VaGo
# ---------------------------------------
# Each Amount will change the name color to the values defined here.
# Example: PvpAmmount1 = 500, when a character's PvP counter reaches 500, their name color will change
# according to the ColorForAmount value.
-# Note: Colors Must Use RGB format
-EnablePvPColorSystem = False
+# Note: Colors Must Use RBG format
+EnablePvPColorSystem = false

# Pvp Amount & Name color level 1.
-PvpAmount1 = 50
-ColorForAmount1 = B5B5B5
+PvpAmount1 = 500
+ColorForAmount1 = CCFF00

# Pvp Amount & Name color level 2.
-PvpAmount2 = 100
-ColorForAmount2 = B5B5B5
+PvpAmount2 = 1000
+ColorForAmount2 = 00FF00

# Pvp Amount & Name color level 3.
-PvpAmount3 = 200
-ColorForAmount3 = B5B5B5
+PvpAmount3 = 1500
+ColorForAmount3 = 00FF00

# Pvp Amount & Name color level 4.
-PvpAmount4 = 300
-ColorForAmount4 = B5B5B5
+PvpAmount4 = 2500
+ColorForAmount4 = 00FF00

# Pvp Amount & Name color level 5.
-PvpAmount5 = 400
-ColorForAmount5 = B5B5B5
+PvpAmount5 = 5000
+ColorForAmount5 = 00FF00

# ---------------------------------------
-# Change Title's Color Via Pk's
+# PvP Title Color System Reworked by Coyote
# ---------------------------------------
# Same as above, with the difference that the PK counter changes the title color.
# Example:  PkAmmount1 = 500, when a character's PK counter reaches 500, their title color will change
# according to the Title For Amount
-# WAN: Colors Must Use RGB format
-EnablePkColorSystem = False
+# WAN: Colors Must Use RBG format
+EnablePvPTitleColorSystem = false

-# Pk Amount & Title color level 1.
-PkAmount1 = 50
-TitleForAmount1 = B5B5B5
+# PvP Amount & Title color level 1.
+PvPTitleAmount1 = 500
+TitleForAmount1 = 00FF00

-# Pk Amount & Title color level 2.
-PkAmount2 = 100
-TitleForAmount2 = B5B5B5
+# PvP Amount & Title color level 2.
+PvPTitleAmount2 = 1000
+TitleForAmount2 = 00FF00

-# Pk Amount & Title color level 3.
-PkAmount3 = 200
-TitleForAmount3 = B5B5B5
+# PvP Amount & Title color level 3.
+PvPTitleAmount3 = 1500
+TitleForAmount3 = 00FF00

-# Pk Amount & Title color level 4.
-PkAmount4 = 300
-TitleForAmount4 = B5B5B5
+# PvP Amount & Title color level 4.
+PvPTitleAmount4 = 2500
+TitleForAmount4 = 00FF00

-# Pk Amount & Title color level 5.
-PkAmount5 = 400
-TitleForAmount5 = B5B5B5
+# PvP Amount & Title color level 5.
+PvPTitleAmount5 = 5000
+TitleForAmount5 = 00FF00

# -------------------------------------------------------------
# Custom PVP/PK settings									  -

 

 

DO NOT ASK ME HOW TO PUT THIS IN YOUR SERVER! THERE HAVE BEEN MADE TONS OF GUIDES!

 

Status: Tested and works w/o compile errors. hf.

 

Credits: Vago for the starting erroneous code, and Coyote for fixing it, and reworking the other part.

 

 

Bye bye.

Posted

Edit: Compile Ok

 

Edit 2: Fixed for the client?? i dont know i will try tomorrow GOOD NIGHT OR DAY

 

What do you mean the client?

I do not touch the client for this modification..

Posted

what bugs did you found and fix?

coz isnt so hard to add pvp title system (when you take it from one other)

 

a/w thank you!

 

well, if you ever be able to read java (no need to be able to code it, im a "beginner" too), then you'll see that it's not something that I took from another =]

and btw the patch that vago had given, showed to put everything at enterworld, lol.

Posted

I try and this code is OK.

 

Caution: blue color = red color  and red color = blue color

 

This happens with almost all the colors in lineage =P

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

    • what pack you use  send me on discord for it
    • package custom.events.RandomZoneEvent; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.ScheduledFuture; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.time.SchedulingPattern; import org.l2jmobius.commons.time.TimeUtil; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.managers.ZoneManager; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.quest.Event; import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneType; import org.l2jmobius.gameserver.model.zone.type.RandomZone; import org.l2jmobius.gameserver.util.Broadcast; /** * Random Zone Event - Activates one random PvP zone temporarily. No modifica la clase de la zona: usa flags PvP en runtime. * @author Juan */ public class RandomZoneEvent extends Event { private static final String CONFIG_FILE = "data/scripts/custom/events/RandomZoneEvent/config.xml"; private static int EVENT_DURATION_MINUTES = 15; private static boolean _isActive = false; private ScheduledFuture<?> _eventTask = null; private final List<ZoneType> _availableZones = new ArrayList<>(); private ZoneType _activeZone = null; public RandomZoneEvent() { loadConfig(); loadZones(); registerZoneListeners(); } /** * Registra listeners a TODAS LAS ZONAS random */ private void registerZoneListeners() { for (ZoneType zone : _availableZones) { addEnterZoneId(zone.getId()); addExitZoneId(zone.getId()); LOGGER.info("[RandomZoneEvent] Registered listener for zone: " + zone.getName()); } } private void loadConfig() { new IXmlReader() { @Override public void load() { parseDatapackFile(CONFIG_FILE); } @Override public void parseDocument(Document doc, File file) { forEach(doc, "event", eventNode -> { final StatSet att = new StatSet(parseAttributes(eventNode)); final String name = att.getString("name"); for (Node node = eventNode.getFirstChild(); node != null; node = node.getNextSibling()) { if ("schedule".equals(node.getNodeName())) { final StatSet attributes = new StatSet(parseAttributes(node)); final String pattern = attributes.getString("pattern"); final SchedulingPattern schedulingPattern = new SchedulingPattern(pattern); final StatSet params = new StatSet(); params.set("Name", name); params.set("SchedulingPattern", pattern); final long delay = schedulingPattern.getDelayToNextFromNow(); getTimers().addTimer("Schedule_" + name, params, delay + 5000, null, null); LOGGER.info("[RandomZoneEvent] Event " + name + " scheduled at " + TimeUtil.getDateTimeString(System.currentTimeMillis() + delay)); } } }); } }.load(); } private void loadZones() { for (ZoneType zone : ZoneManager.getInstance().getAllZones(RandomZone.class)) { if ((zone.getName() != null) && zone.getName().toLowerCase().startsWith("random_zone")) { _availableZones.add(zone); LOGGER.info("[RandomZoneEvent] Loaded zone: " + zone.getName() + " (id=" + zone.getId() + ")"); } } LOGGER.info("[RandomZoneEvent] Total random zones loaded: " + _availableZones.size()); } @Override public void onTimerEvent(String event, StatSet params, Npc npc, Player player) { if (event.startsWith("Schedule_")) { eventStart(null); final SchedulingPattern schedulingPattern = new SchedulingPattern(params.getString("SchedulingPattern")); final long delay = schedulingPattern.getDelayToNextFromNow(); getTimers().addTimer(event, params, delay + 5000, null, null); LOGGER.info("[RandomZoneEvent] Rescheduled for " + TimeUtil.getDateTimeString(System.currentTimeMillis() + delay)); } } @Override public boolean eventStart(Player eventMaker) { if (_isActive) { if (eventMaker != null) { eventMaker.sendMessage("RandomZoneEvent already active."); } return false; } if (_availableZones.isEmpty()) { Broadcast.toAllOnlinePlayers("[RandomZoneEvent] No zones configured."); return false; } _isActive = true; Broadcast.toAllOnlinePlayers("⚔️ Random Zone Event has started!"); _eventTask = ThreadPool.schedule(this::activateRandomZone, 5_000); return true; } private void activateRandomZone() { _activeZone = _availableZones.get(new Random().nextInt(_availableZones.size())); _activeZone.setEnabled(true); Broadcast.toAllOnlinePlayers("🔥 Random Zone Event: " + _activeZone.getName() + " is now PvP for " + EVENT_DURATION_MINUTES + " minutes!"); _eventTask = ThreadPool.schedule(this::eventStop, EVENT_DURATION_MINUTES * 60 * 1000L); } @Override public boolean eventStop() { if (!_isActive) { return false; } _isActive = false; if (_eventTask != null) { _eventTask.cancel(true); _eventTask = null; } if (_activeZone != null) { _activeZone.setEnabled(false); Broadcast.toAllOnlinePlayers("🏁 Random Zone Event ended. " + _activeZone.getName() + " is back to normal."); _activeZone = null; } else { Broadcast.toAllOnlinePlayers("🏁 Random Zone Event ended."); } return true; } @Override public void onEnterZone(Creature creature, ZoneType zone) { if (!_isActive || (_activeZone == null)) { return; } if ((zone == _activeZone) && creature.isPlayable()) { creature.setInsideZone(ZoneId.PVP, true); if (creature.isPlayer()) { creature.sendMessage("Esta zona está en modo PvP temporalmente."); } } } @Override public void onExitZone(Creature creature, ZoneType zone) { if (!_isActive || (_activeZone == null)) { return; } if ((zone == _activeZone) && creature.isPlayable()) { creature.setInsideZone(ZoneId.PVP, false); if (creature.isPlayer()) { creature.sendMessage("Abandonaste la zona PvP temporal."); } } } @Override public boolean eventBypass(Player player, String bypass) { return true; } @Override public String onEvent(String event, Npc npc, Player player) { return super.onEvent(event, npc, player); } @Override public String onFirstTalk(Npc npc, Player player) { return null; } public static void main(String[] args) { new RandomZoneEvent(); } } i have this but its not working
    • ZonePvPSpawnBossRadio=0 ZonePvPSpawnBossBarakiel=0 at the Customs.ini in L2Server folder. Im prety sure this is it because i had the same problem with you in cruma 1 floor for example and i couldn't fix it but i fixed it finally by changing these 2 lines
    • Siege Reward Start PM Msg Rework Config root BossDieAnnounce and BossDieSound in the L24Team.properties and Config.java files for global raid boss death notifications and sounds. Adds a new reward_list table to the DB.sql file to track castle rewards. Improves character creation logic for thread safety and validation. Adds extensive state checks to the RequestEnchantItem method to prevent enchantments during inappropriate player states. Fixed auto-attack animation bug (there was no attack animation, only damage animation) Clean Code Other fixes I forgot to list! Java 14 Fixed issue where deleting a character would prevent it from leaving the screen or being removed, or even after a delete CD (it would only exit when re-logging in or creating a new character). Added Premium System from the other C2 project (Needs testing and improvement). Added the "Improved" Community Board (incomplete).
  • Topics

×
×
  • Create New...

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