Jump to content

Recommended Posts

Posted

hiddd for 50 posts for now, vago can change it

 

Im sorry but I dont want my stuff hidden in any way. Thats why I posted it here...for everyone to have it

Wth!?

 

-beep-ING AWESOME!

 

When You Manage To Make It Fully Working ( Cause I See It's In Beta )

 

You'll Have +1 From Me..

 

Btw , Continue Sharing Java Stuff You Help a Lot. And That's Good :)

 

This is the v1 release. I forgot to change title

 

 

I repeat...Please test it as much as you can and give me as much info and ideas as you can. This is the only way to make it better

Posted

well i start to use it.

-Compiled

-server started

-the start_war announce incorrect(it said normal too)

-no error msg

-bug in the grand boss manager instance i dont know its for everybody but everytime when i start the event its +12 reloaded grandboss instance.

 

more soon when i have more time

Posted

Because of the revalidateZone

 

Code updated.

 

The boss reload is fewer times now but will still be there...GOnna try to fix.

Posted

2: // Talking Island

3: // Elven village

1: // Dark elf village

4: // Orc village

6: // Dwarven village

7: // Gludio

5: // Gludin

8: // Dion

9: // Giran

10: // Oren

12: // Aden

11: // Hunters village

9: // Giran Harbour

15: // Heine

14: // Rune

13: // Goddard

17: // Schuttgart

16: // Floran

19: //Primeval Isle

20: //Kamael Village

21: //South of Wastelands Camp

22: //Fantasy Island

 

List of the towns that can be used in that event(use only the Id)

Posted

You can use it like

 

TownManager.getTown(1).setParameter("isPeaceZone", "true");

TownManager.getTown(5).setParameter("isPeaceZone", "true");      

TownManager.getTown(9).setParameter("isPeaceZone", "true");

 

But dont forget to change the announce too also to set them back to peace zone when event is over :p

Posted

You can use it like

 

TownManager.getTown(1).setParameter("isPeaceZone", "true");

TownManager.getTown(5).setParameter("isPeaceZone", "true");      

TownManager.getTown(9).setParameter("isPeaceZone", "true");

 

But dont forget to change the announce too also to set them back to peace zone when event is over :p

Ok, thank you. Waiting for Cobra to adapt this for L2JFree :P I hope he'll release it ^__^

Posted

Well will be great if you add at config like ZoneTownId what i mean .. the admin can chose every time what town he want to be battle zone ...!!

 

Like ZoneTownId= 9 this is for giran you have done .. any way .. here the code

 

Index: C:/Documents and Settings/Cobra/workspace/L2_GameServer/java/config/l2jmods.properties
===================================================================
--- C:/Documents and Settings/Cobra/workspace/L2_GameServer/java/config/l2jmods.properties	(revision 2739)
+++ C:/Documents and Settings/Cobra/workspace/L2_GameServer/java/config/l2jmods.properties	(working copy)
@@ -161,4 +161,48 @@
#----------------------------------
EnableWarehouseSortingClan = False
EnableWarehouseSortingPrivate = False
-EnableWarehouseSortingFreight = False
\ No newline at end of file
+EnableWarehouseSortingFreight = False
+
+# unsummon pet of ctf participants on event start?
+CTFOnStartUnsummonPet=true
+
+#----------------------------------
+#Town War
+#----------------------------------
+# //townwar_start - Starts town war in Giran
+# //townwar_end - Ends townwar in Giran
+#REWARD FOR EACH KILL:
+
+TownWarItemId = 57
+TownWarItemAmount = 5000
+
+# Give PKers karma during townwar?
+AllowKarma = False
+
+#----------------------------------
+#Town Id
+#----------------------------------
+# You Can Choose The Id Of Town
+#2: // Talking Island
+#3: // Elven village
+#1: // Dark elf village
+#4: // Orc village
+#6: // Dwarven village
+#7: // Gludio
+#5: // Gludin
+#8: // Dion
+#9: // Giran
+#10: // Oren
+#12: // Aden
+#11: // Hunters village
+#9: // Giran Harbour
+#15: // Heine
+#14: // Rune
+#13: // Goddard
+#17: // Schuttgart
+#16: // Floran
+#19: //Primeval Isle
+#20: //Kamael Village
+#21: //South of Wastelands Camp
+#22: //Fantasy Island
+ZoneTownId= 9
Index: C:/Documents and Settings/Cobra/workspace/L2_GameServer/java/net/sf/l2j/Config.java
===================================================================
--- C:/Documents and Settings/Cobra/workspace/L2_GameServer/java/net/sf/l2j/Config.java	(revision 2739)
+++ C:/Documents and Settings/Cobra/workspace/L2_GameServer/java/net/sf/l2j/Config.java	(working copy)
@@ -563,6 +563,9 @@
     /** ************************************************** **/
	/** L2JMods Settings -End                              **/
@@ -949,8 +952,10 @@
     public static int     FAST_CONNECTION_LIMIT;
     public static int     NORMAL_CONNECTION_TIME;
     public static int     FAST_CONNECTION_TIME;
-    public static int     MAX_CONNECTION_PER_IP;  
+    public static int     MAX_CONNECTION_PER_IP;

+	public static int ZONE_TOWN_ID;  
+
     /**
      * This class initializes all global variables for configuration.<br>
      * If key doesn't appear in properties file, a default value is setting on by this class.
@@ -1781,6 +1786,12 @@
+	                ZONE_TOWN_ID                            = Integer.parseInt(L2JModSettings.getProperty("ZoneTownId", "9"));

	                if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
	                {
@@ -2321,6 +2332,12 @@
         else if (pName.equalsIgnoreCase("EnableWarehouseSortingClan")) L2JMOD_ENABLE_WAREHOUSESORTING_CLAN = Boolean.parseBoolean(pValue);
         else if (pName.equalsIgnoreCase("EnableWarehouseSortingPrivate")) L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = Boolean.parseBoolean(pValue);
         else if (pName.equalsIgnoreCase("EnableWarehouseSortingFreight")) L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT = Boolean.parseBoolean(pValue);
+       else if (pName.equalsIgnoreCase("ZoneTownId")) ZONE_TOWN_ID = Integer.parseInt(pValue);

         // PvP settings
         else if (pName.equalsIgnoreCase("MinKarma")) KARMA_MIN_KARMA = Integer.parseInt(pValue);
Index: C:/Documents and Settings/Cobra/workspace/L2_GameServer/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTownWar.java
===================================================================
--- C:/Documents and Settings/Cobra/workspace/L2_GameServer/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTownWar.java
+++ C:/Documents and Settings/Cobra/workspace/L2_GameServer/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTownWar.java
+/*
+* This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.handler.admincommandhandlers;
+
+import java.util.Collection;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.model.L2Character;
+import net.sf.l2j.gameserver.model.L2Object;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.L2WorldRegion;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.zone.L2ZoneType;
+import net.sf.l2j.gameserver.instancemanager.*;
+
+public class AdminTownWar implements IAdminCommandHandler
+{
+   private static final String[] ADMIN_COMMANDS =
+   {
+      "admin_townwar_start",
+      "admin_townwar_end"
+   };
+   private L2WorldRegion _worldRegion;
+    private L2Object _activeObject;
+    public final L2Object getActiveObject()
+    {
+        return _activeObject;
+    }
+   public boolean useAdminCommand(String command, L2PcInstance activeChar)
+   {
+      if (command.startsWith("admin_townwar_start"))
+      {
+            TownManager.getTown(Config.ZONE_TOWN_ID).setParameter("isPeaceZone", "false");
+            ZoneManager.load();
+            
+            Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
+            {
+               for (L2PcInstance onlinePlayer : pls)
+                  if (onlinePlayer.isOnline() == 1 && onlinePlayer.isInsidePeaceZone(onlinePlayer))
+                     {
+                     onlinePlayer.revalidateZone(true);
+                     onlinePlayer.setInTownWar(true);
+                     }
+            }
+               Announcements.getInstance().announceToAll("Giran Castle Town has been set war zone by " + activeChar.getName() + ".");
+      }
+      if (command.startsWith("admin_townwar_end"))
+      {
+            TownManager.getTown(Config.ZONE_TOWN_ID).setParameter("isPeaceZone", "true");
+            ZoneManager.load();
+            
+            Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
+            {
+               for (L2PcInstance onlinePlayer : pls)
+                  if (onlinePlayer.isOnline() == 1 && !onlinePlayer.isInsidePeaceZone(onlinePlayer))
+                     {
+                     onlinePlayer.revalidateZone(true);
+                     onlinePlayer.setInTownWar(false);
+                     }
+            }
+            Announcements.getInstance().announceToAll("Giran Castle Town has been set back to normal by " + activeChar.getName() + ".");
+      }
+      return true;
+   }
+   
+   
+   
+   public String[] getAdminCommandList()
+   {
+      return ADMIN_COMMANDS;
+   }
+}
+

 

Again good job :) ... for l2jfree it have some bugs ... but i'm wokring on it ..  wen will be ready without any problem i'll share it!

 

Guest
This topic is now closed to further replies.



  • 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