Jump to content

Recommended Posts

Posted

here we are :

 

### Eclipse Workspace Patch 1.0
#P L2_GameServer
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revision 3945)
+++ java/config/l2jmods.properties	(working copy)
@@ -256,4 +256,75 @@
# This option will enable core support for:
# Mana Drug (item ID 726), using skill ID 9007.
# Mana Potion (item ID 728), using skill ID 9008.
-EnableManaPotionSupport = False
\ No newline at end of file
+EnableManaPotionSupport = False
+
+
+# ---------------------------------------
+# Section: PvP Title Color Change System by Level
+# ---------------------------------------
+# Each Amount will change the title content and color to the values defined here.
+# Example: PvpAmount1 = 20, when a character's PvP counter reaches 20
+# their title color and content will change according to the ColorForAmount value.
+# Note: Colors Must Be in RBG format.
+EnablePvPColorSystem = false
+EnablePkColorSystem = false
+
+# Pvp Amount, Title & color level 1.
+PvpAmount1 = 50
+PkAmount1 = 50
+ColorForAmount1 = 00FF00
+TitleForAmount1 = 00FF00
+
+# Pvp Amount, Title & color level 2.
+PvpAmount2 = 100
+PkAmount2 = 100
+ColorForAmount2 = 00FF00
+TitleForAmount2 = 00FF00
+
+# Pvp Amount, Title & color level 3.
+PvpAmount3 = 150
+PkAmount3 = 150
+ColorForAmount3 = 00FF00
+TitleForAmount3 = 00FF00
+
+# Pvp Amount, Title & color level 4.
+PvpAmount4 = 200
+PkAmount4 = 200
+ColorForAmount4 = 00FF00
+TitleForAmount4 = 00FF00
+
+# Pvp Amount, Title & color level 5.
+PvpAmount5 = 250
+PkAmount5 = 250
+ColorForAmount5 = 00FF00
+TitleForAmount1 = 00FF00
+
+# Pvp Amount, Title & color level 6.
+PvpAmount6 = 300
+PkAmount6 = 300
+ColorForAmount6 = 00FF00
+TitleForAmount6 = 00FF00
+
+# Pvp Amount, Title & color level 7.
+PvpAmount7 = 350
+PkAmount7 = 350
+ColorForAmount7 = 00FF00
+TitleForAmount7 = 00FF00
+
+# Pvp Amount, Title & color level 8.
+PvpAmount8 = 400
+PkAmount8 = 400
+ColorForAmount8 = 00FF00
+TitleForAmount8 = 00FF00
+
+# Pvp Amount, Title & color level 9.
+PvpAmount9 = 450
+PkAmount9 = 450
+ColorForAmount9 = 00FF00
+TitleForAmount9 = 00FF00
+
+# Pvp Amount, Title & color level 10.
+PvpAmount10 = 500
+PkAmount10 = 500
+ColorForAmount10 = 00FF00
+TitleForAmount10 = 00FF00
\ No newline at end of file

Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 3945)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -616,8 +616,51 @@
	public static boolean OFFLINE_SET_NAME_COLOR;
	public static int OFFLINE_NAME_COLOR;
	public static boolean L2JMOD_ENABLE_MANA_POTIONS_SUPPORT;
+	public static boolean   PVP_TITLE_AND_COLOR_SYSTEM_ENABLED;
+	public static boolean   PK_COLOR_SYSTEM_ENABLED;
+	public static int      PVP_AMOUNT1;
+	public static int      PK_AMOUNT1;
+	public static int      TITLE_COLOR_FOR_PVP_AMOUNT1;
+	public static int   	  NAME_COLOR_FOR_PK_AMOUNT1;
+	public static int      PVP_AMOUNT2;
+	public static int      PK_AMOUNT2;
+	public static int      TITLE_COLOR_FOR_PVP_AMOUNT2;
+	public static int      NAME_COLOR_FOR_PK_AMOUNT2;
+	public static int      PVP_AMOUNT3;
+	public static int      PK_AMOUNT3;
+	public static int      TITLE_COLOR_FOR_PVP_AMOUNT3;
+	public static int      NAME_COLOR_FOR_PK_AMOUNT3;
+	public static int      PVP_AMOUNT4;
+	public static int      PK_AMOUNT4;
+	public static int      TITLE_COLOR_FOR_PVP_AMOUNT4;
+	public static int      NAME_COLOR_FOR_PK_AMOUNT4;
+	public static int      PVP_AMOUNT5;
+	public static int      PK_AMOUNT5;
+	public static int      TITLE_COLOR_FOR_PVP_AMOUNT5;
+	public static int      NAME_COLOR_FOR_PK_AMOUNT5;
+	public static int      PVP_AMOUNT6;
+	public static int      PK_AMOUNT6;
+	public static int      TITLE_COLOR_FOR_PVP_AMOUNT6;
+	public static int      NAME_COLOR_FOR_PK_AMOUNT6;
+	public static int      PVP_AMOUNT7;
+	public static int      PK_AMOUNT7;
+	public static int      TITLE_COLOR_FOR_PVP_AMOUNT7;
+	public static int      NAME_COLOR_FOR_PK_AMOUNT7;
+	public static int      PVP_AMOUNT8;
+	public static int      PK_AMOUNT8;
+	public static int      TITLE_COLOR_FOR_PVP_AMOUNT8;
+	public static int      NAME_COLOR_FOR_PK_AMOUNT8;
+	public static int      PVP_AMOUNT9;
+	public static int      PK_AMOUNT9;
+	public static int      TITLE_COLOR_FOR_PVP_AMOUNT9;
+	public static int      NAME_COLOR_FOR_PK_AMOUNT9;
+	public static int      PVP_AMOUNT10;
+	public static int      PK_AMOUNT10;
+	public static int      TITLE_COLOR_FOR_PVP_AMOUNT10;
+	public static int      NAME_COLOR_FOR_PK_AMOUNT10;
+	public static int      PVP_AMOUNT11;
+	public static int      PK_AMOUNT11;

-
	//--------------------------------------------------
	// NPC Settings
	//--------------------------------------------------
@@ -2014,6 +2057,51 @@
					OFFLINE_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("OfflineNameColor", "808080"));

					L2JMOD_ENABLE_MANA_POTIONS_SUPPORT = Boolean.parseBoolean(L2JModSettings.getProperty("EnableManaPotionSupport", "false"));
+					
+					PVP_TITLE_AND_COLOR_SYSTEM_ENABLED      = Boolean.parseBoolean(L2JModSettings.getProperty("EnablePvPColorSystem", "false"));
+					PK_COLOR_SYSTEM_ENABLED                 = Boolean.parseBoolean(L2JModSettings.getProperty("EnablePkColorSystem", "false"));
+					   
+		            PVP_AMOUNT1                             = Integer.parseInt(L2JModSettings.getProperty("PvpAmount1", "50"));
+					PK_AMOUNT1                              = Integer.parseInt(L2JModSettings.getProperty("PkAmount1", "50"));
+					TITLE_COLOR_FOR_PVP_AMOUNT1             = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount1", "00FF00"));
+					NAME_COLOR_FOR_PK_AMOUNT1              = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount1", "00FF00"));
+					PVP_AMOUNT2                             = Integer.parseInt(L2JModSettings.getProperty("PvpAmount2", "100"));
+					PK_AMOUNT2                              = Integer.parseInt(L2JModSettings.getProperty("PkAmount2", "100"));
+					TITLE_COLOR_FOR_PVP_AMOUNT2             = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount2", "00FF00"));
+					NAME_COLOR_FOR_PK_AMOUNT2              = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount2", "00FF00"));
+					PVP_AMOUNT3                             = Integer.parseInt(L2JModSettings.getProperty("PvpAmount3", "150"));
+					PK_AMOUNT3                              = Integer.parseInt(L2JModSettings.getProperty("PkAmount3", "150"));
+					TITLE_COLOR_FOR_PVP_AMOUNT3             = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount3", "00FF00"));
+					NAME_COLOR_FOR_PK_AMOUNT3              = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount3", "00FF00"));
+					PVP_AMOUNT4                             = Integer.parseInt(L2JModSettings.getProperty("PvpAmount4", "200"));
+					PK_AMOUNT4                              = Integer.parseInt(L2JModSettings.getProperty("PkAmount4", "200"));
+					TITLE_COLOR_FOR_PVP_AMOUNT4             = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount4", "00FF00"));
+					NAME_COLOR_FOR_PK_AMOUNT4              = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount4", "00FF00"));
+					PVP_AMOUNT5                             = Integer.parseInt(L2JModSettings.getProperty("PvpAmount5", "250"));
+					PK_AMOUNT5                              = Integer.parseInt(L2JModSettings.getProperty("PkAmount5", "250"));
+					TITLE_COLOR_FOR_PVP_AMOUNT5             = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount5", "00FF00"));
+					NAME_COLOR_FOR_PK_AMOUNT5              = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount5", "00FF00"));
+					PVP_AMOUNT6                             = Integer.parseInt(L2JModSettings.getProperty("PvpAmount6", "300"));
+					PK_AMOUNT6								= Integer.parseInt(L2JModSettings.getProperty("PkAmount6", "300"));
+					TITLE_COLOR_FOR_PVP_AMOUNT6             = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount6", "00FF00"));
+					NAME_COLOR_FOR_PK_AMOUNT6              = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount6", "00FF00"));
+					PVP_AMOUNT7                             = Integer.parseInt(L2JModSettings.getProperty("PvpAmount7", "350"));
+					PK_AMOUNT7                              = Integer.parseInt(L2JModSettings.getProperty("PkAmount7", "350"));
+					TITLE_COLOR_FOR_PVP_AMOUNT7             = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount7", "00FF00"));
+					NAME_COLOR_FOR_PK_AMOUNT7              = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount7", "00FF00"));
+					PVP_AMOUNT8                             = Integer.parseInt(L2JModSettings.getProperty("PvpAmount8", "400"));
+					PK_AMOUNT8                              = Integer.parseInt(L2JModSettings.getProperty("PkAmount8", "400"));
+					TITLE_COLOR_FOR_PVP_AMOUNT8             = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount8", "00FF00"));
+					NAME_COLOR_FOR_PK_AMOUNT8              = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount8", "00FF00"));	
+					PVP_AMOUNT9                             = Integer.parseInt(L2JModSettings.getProperty("PvpAmount9", "450"));
+					PK_AMOUNT9                              = Integer.parseInt(L2JModSettings.getProperty("PkAmount9", "450"));
+					TITLE_COLOR_FOR_PVP_AMOUNT9             = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount9", "00FF00"));
+					NAME_COLOR_FOR_PK_AMOUNT9              = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount9", "00FF00"));
+					PVP_AMOUNT10                             = Integer.parseInt(L2JModSettings.getProperty("PvpAmount10", "500"));
+					PK_AMOUNT10                              = Integer.parseInt(L2JModSettings.getProperty("PkAmount10", "500"));
+					TITLE_COLOR_FOR_PVP_AMOUNT10             = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount10", "00FF00"));
+					NAME_COLOR_FOR_PK_AMOUNT10             = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount10", "00FF00"));	
+					
				}
				catch (Exception e)
				{
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 3945)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -4384,6 +4384,109 @@
         	DuelManager.getInstance().broadcastToOppositTeam(this, update);
         }
	}
+	
+	public void updatePvPTitleColor(int pvpKillAmount)
+   {
+      if (Config.PVP_TITLE_AND_COLOR_SYSTEM_ENABLED)
+      {
+         //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)))
+            {
+               getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT1);
+            }
+            if ((pvpKillAmount >= (Config.PVP_AMOUNT2)) && (pvpKillAmount < (Config.PVP_AMOUNT3)))
+            {
+               getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT2);
+            }
+            if ((pvpKillAmount >= (Config.PVP_AMOUNT3)) && (pvpKillAmount < (Config.PVP_AMOUNT4)))
+            {
+               getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT3);
+            }
+            if ((pvpKillAmount >= (Config.PVP_AMOUNT4)) && (pvpKillAmount < (Config.PVP_AMOUNT5)))
+            {
+               getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT4);
+            }
+            if ((pvpKillAmount >= (Config.PVP_AMOUNT5)) && (pvpKillAmount < (Config.PVP_AMOUNT6)))
+            {
+               getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT5);
+            }
+            if ((pvpKillAmount >= (Config.PVP_AMOUNT6)) && (pvpKillAmount < (Config.PVP_AMOUNT7)))
+            {
+               getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT6);
+            }
+            if ((pvpKillAmount >= (Config.PVP_AMOUNT7)) && (pvpKillAmount < (Config.PVP_AMOUNT8)))
+            {
+               getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT7);
+            }
+            if ((pvpKillAmount >= (Config.PVP_AMOUNT8)) && (pvpKillAmount < (Config.PVP_AMOUNT9)))
+            {
+               getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT8);
+            }
+            if ((pvpKillAmount >= (Config.PVP_AMOUNT9)) && (pvpKillAmount < (Config.PVP_AMOUNT10)))
+            {
+               getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT9);
+            }
+            else if (pvpKillAmount >= (Config.PVP_AMOUNT10))
+            {
+               getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT10);
+            }
+         }
+      }
+   }
+   public void updatePkNameColor(int pkKillAmount)
+  {
+      if (Config.PK_COLOR_SYSTEM_ENABLED)
+     {
+         //Check if the character has GM access and if so, let them be.
+         if (isGM())
+            return;
+         {
+            if ((pkKillAmount >= (Config.PK_AMOUNT1)) && (pkKillAmount < (Config.PVP_AMOUNT2)))
+            {
+               getAppearance().setNameColor(Config.NAME_COLOR_FOR_PK_AMOUNT1);
+            }
+            if ((pkKillAmount >= (Config.PK_AMOUNT2)) && (pkKillAmount < (Config.PVP_AMOUNT3)))
+            {
+               getAppearance().setNameColor(Config.NAME_COLOR_FOR_PK_AMOUNT2);
+            }
+            if ((pkKillAmount >= (Config.PK_AMOUNT3)) && (pkKillAmount < (Config.PVP_AMOUNT4)))
+            {
+               getAppearance().setNameColor(Config.NAME_COLOR_FOR_PK_AMOUNT3);
+            }
+            if ((pkKillAmount >= (Config.PK_AMOUNT4)) && (pkKillAmount < (Config.PVP_AMOUNT5)))
+            {
+               getAppearance().setNameColor(Config.NAME_COLOR_FOR_PK_AMOUNT4);
+            }
+            if ((pkKillAmount >= (Config.PK_AMOUNT5)) && (pkKillAmount < (Config.PVP_AMOUNT6)))
+            {
+               getAppearance().setNameColor(Config.NAME_COLOR_FOR_PK_AMOUNT5);
+            }
+            if ((pkKillAmount >= (Config.PK_AMOUNT6)) && (pkKillAmount < (Config.PVP_AMOUNT7)))
+            {
+               getAppearance().setNameColor(Config.NAME_COLOR_FOR_PK_AMOUNT6);
+            }
+            if ((pkKillAmount >= (Config.PK_AMOUNT7)) && (pkKillAmount < (Config.PVP_AMOUNT8)))
+            {
+               getAppearance().setNameColor(Config.NAME_COLOR_FOR_PK_AMOUNT7);
+            }
+            if ((pkKillAmount >= (Config.PK_AMOUNT8)) && (pkKillAmount < (Config.PVP_AMOUNT9)))
+            {
+               getAppearance().setNameColor(Config.NAME_COLOR_FOR_PK_AMOUNT8);
+            }
+            if ((pkKillAmount >= (Config.PK_AMOUNT9)) && (pkKillAmount < (Config.PVP_AMOUNT10)))
+            {
+               getAppearance().setNameColor(Config.NAME_COLOR_FOR_PK_AMOUNT9);
+            }
+            else if (pkKillAmount >= (Config.PVP_AMOUNT10))
+            {
+               getAppearance().setNameColor(Config.NAME_COLOR_FOR_PK_AMOUNT10);
+            }
+         }
+      }
+   }
     
	/**
	 * Send a Server->Client packet UserInfo to this L2PcInstance and CharInfo to all L2PcInstance in its _KnownPlayers.<BR><BR>
@@ -5663,6 +5766,10 @@
     {
         // Add karma to attacker and increase its PK counter
         setPvpKills(getPvpKills() + 1);
+		
+		//Update the character's name color if they reached any of the 5 PvP levels.
+        updatePvPTitleColor(getPvpKills());
+        broadcastUserInfo();

         // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
         sendPacket(new UserInfo(this));
@@ -5717,6 +5824,10 @@
         setKarma(getKarma() + newKarma);
         if (increasePk)
             setPkKills(getPkKills() + 1);
+		
+		//Update the character's title color if they reached any of the 5 PK levels.
+        updatePkNameColor(getPkKills());
+        broadcastUserInfo();

         // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
         sendPacket(new UserInfo(this));

Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(revision 3945)
+++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -312,6 +312,9 @@
				quest.notifyEnterWorld(activeChar);
		}
		activeChar.sendPacket(new QuestList());
+		
+		if (activeChar.getPvpKills()>=(Config.PVP_AMOUNT1) && (Config.PVP_TITLE_AND_COLOR_SYSTEM_ENABLED)) activeChar.updatePvPTitleColor(activeChar.getPvpKills());
+		if (activeChar.getPkKills()>=(Config.PK_AMOUNT1) && (Config.PK_COLOR_SYSTEM_ENABLED)) activeChar.updatePkNameColor(activeChar.getPkKills());

		if (Config.PLAYER_SPAWN_PROTECTION > 0)
			activeChar.setProtection(true);

 

its a Gracia Final code so if have epilogue try put manually :D gl with it

Posted

This has been made before, so its pointless adding more and more levels.

If somebody has the main code, he can make it for 1k levels.

Imagine if everybody started to re-share codes, while he has only added a few useless values..

Posted

i made for my own server with 10 for pvp 10 for pk so use it or not xD only share it maybe ppl dont wanna create or cant create it like that ^^

 

You didn't create it, you extended it.

It's way different.

Posted

good work thanks....

Sure!

 

+            if ((pvpKillAmount >= (Config.PVP_AMOUNT1)) && (pvpKillAmount < (Config.PVP_AMOUNT2)))

+            {

+              getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT1);

+            }

+            if ((pvpKillAmount >= (Config.PVP_AMOUNT2)) && (pvpKillAmount < (Config.PVP_AMOUNT3)))

+            {

+              getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT2);

+            }

+            if ((pvpKillAmount >= (Config.PVP_AMOUNT3)) && (pvpKillAmount < (Config.PVP_AMOUNT4)))

+            {

+              getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT3);

+            }

+            if ((pvpKillAmount >= (Config.PVP_AMOUNT4)) && (pvpKillAmount < (Config.PVP_AMOUNT5)))

+            {

+              getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT4);

+            }

+            if ((pvpKillAmount >= (Config.PVP_AMOUNT5)) && (pvpKillAmount < (Config.PVP_AMOUNT6)))

+            {

+              getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT5);

+            }

+            if ((pvpKillAmount >= (Config.PVP_AMOUNT6)) && (pvpKillAmount < (Config.PVP_AMOUNT7)))

+            {

+              getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT6);

+            }

+            if ((pvpKillAmount >= (Config.PVP_AMOUNT7)) && (pvpKillAmount < (Config.PVP_AMOUNT8)))

+            {

+              getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT7);

+            }

+            if ((pvpKillAmount >= (Config.PVP_AMOUNT8)) && (pvpKillAmount < (Config.PVP_AMOUNT9)))

+            {

+              getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT8);

+            }

+            if ((pvpKillAmount >= (Config.PVP_AMOUNT9)) && (pvpKillAmount < (Config.PVP_AMOUNT10)))

+            {

+              getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT9);

+            }

+            else if (pvpKillAmount >= (Config.PVP_AMOUNT10))

+            {

+              getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PVP_AMOUNT10);

+            }

+        }

Posted

omg someone help me answer my question i dieing here because i try to do my self but i cant hwre need to put that ?

Config.java, l2jmods.properties, EnterWorld.java, L2PcInstance.java

Posted

Config.java, l2jmods.properties, EnterWorld.java, L2PcInstance.java

thanks that there is peoples whoa helping  like me but when i open those files where i have to put those codes ant with what program i have to pen it ?

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