Jump to content

Recommended Posts

Posted

CTF Doors Close :)

to posting here because I saw this mod missing = x

 

Author : Mazokista

Index: java/com/it/roberto/Config.java
===================================================================
--- java/com/it/roberto/Config.java	(revision 57)
+++ java/com/it/roberto/Config.java	(working copy)
@@ -73,11 +73,7 @@
	public static boolean CTF_ALLOW_SUMMON;
	public static boolean CTF_ON_START_REMOVE_ALL_EFFECTS;
	public static boolean CTF_ON_START_UNSUMMON_PET;
+	public static boolean CTF_REVIVE_RECOVERY;
+    public static String CTF_DOORS_IDS_TO_OPEN_STRING;
+	public static List<Integer> CTF_DOORS_IDS_TO_OPEN = new FastList<Integer>();
+    public static String CTF_DOORS_IDS_TO_CLOSE_STRING;
+	public static List<Integer> CTF_DOORS_IDS_TO_CLOSE = new FastList<Integer>();
     public static boolean ENABLE_MODIFY_SKILL_DURATION;
     public static Map<Integer, Integer> SKILL_DURATION_LIST;	
	public static boolean MOVE_BASED_KNOWNLIST;
@@ -2087,20 +2083,6 @@
				CTF_ON_START_REMOVE_ALL_EFFECTS = Boolean.parseBoolean(additionsSettings.getProperty("CTFOnStartRemoveAllEffects", "true"));
				CTF_ON_START_UNSUMMON_PET = Boolean.parseBoolean(additionsSettings.getProperty("CTFOnStartUnsummonPet", "true"));
				CTF_REVIVE_RECOVERY = Boolean.parseBoolean(additionsSettings.getProperty("CTFReviveRecovery", "false"));			
+		        CTF_DOORS_IDS_TO_OPEN_STRING = additionsSettings.getProperty("CTFDoorsToOpen", "");
+				CTF_DOORS_IDS_TO_OPEN = new FastList<Integer>();
+				for (String door : CTF_DOORS_IDS_TO_OPEN_STRING.split(";"))
+				{
+                     if (!door.equals(""))
+						CTF_DOORS_IDS_TO_OPEN.add(Integer.parseInt(door));
+				}
+		        CTF_DOORS_IDS_TO_CLOSE_STRING = additionsSettings.getProperty("CTFDoorsToClose", "");
+				CTF_DOORS_IDS_TO_CLOSE = new FastList<Integer>();
+				for (String door : CTF_DOORS_IDS_TO_CLOSE_STRING.split(";"))
+				{
+                     if (!door.equals(""))
+						CTF_DOORS_IDS_TO_CLOSE.add(Integer.parseInt(door));
+				}
             }
             catch (Exception e)
             {
Index: java/com/it/roberto/gameserver/model/entity/events/CTF.java
===================================================================
--- java/com/it/roberto/gameserver/model/entity/events/CTF.java	(revision 57)
+++ java/com/it/roberto/gameserver/model/entity/events/CTF.java	(working copy)
@@ -10,7 +10,6 @@
import com.it.roberto.Config;
import com.it.roberto.L2DatabaseFactory;
import com.it.roberto.gameserver.ThreadPoolManager;
+import com.it.roberto.gameserver.datatables.DoorTable;
import com.it.roberto.gameserver.datatables.ItemTable;
import com.it.roberto.gameserver.datatables.NpcTable;
import com.it.roberto.gameserver.datatables.SpawnTable;
@@ -22,7 +21,6 @@
import com.it.roberto.gameserver.model.L2Summon;
import com.it.roberto.gameserver.model.L2World;
import com.it.roberto.gameserver.model.L2Radar;
+import com.it.roberto.gameserver.model.actor.instance.L2DoorInstance;
import com.it.roberto.gameserver.model.actor.instance.L2PcInstance;
import com.it.roberto.gameserver.model.actor.instance.L2PetInstance;
import com.it.roberto.gameserver.serverpackets.ActionFailed;
@@ -722,7 +720,7 @@
         _joining = true;
         spawnEventNpc(activeChar);
         Announcements(_eventName + "(CTF): Joinable in " + _joiningLocationName + "!");
+		closeDoorsCTF();
+		// Closes all doors specified in configs for tvt
     }

     public static void startJoin()
@@ -736,7 +734,7 @@
         _joining = true;
         spawnEventNpc();
         Announcements(_eventName + "(CTF): Joinable in " + _joiningLocationName + "!");
+		// Closes all doors specified in configs for CTF
+		closeDoorsCTF();
     }
     
     public static boolean startAutoJoin()
@@ -1272,7 +1270,7 @@
         unspawnAllFlags();
         Announcements(_eventName + "(CTF): Match aborted!");
         teleportFinish();
+		// Opens all doors specified in configs for CTF
+		openDoorsCTF();
     }
     
     public static void sit()
@@ -1955,7 +1953,7 @@
     
     public static void teleportFinish()
     {
+		// Opens all doors specified in configs for CTF
+		openDoorsCTF();
         Announcements(_eventName + "(CTF): Teleport back to participation NPC!");

         ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
@@ -1972,6 +1970,10 @@
         }, 3000);
     }

+
+	/**
+    * author : Mazokista
+	 * Close doors specified in configs
+	 */
+	private static void closeDoorsCTF() 
+	{
+		for (int doorId : Config.CTF_DOORS_IDS_TO_CLOSE) 
+		{
+			L2DoorInstance doorInstance = DoorTable.getInstance().getDoor(doorId);
+			if (doorInstance != null) 
+			{
+				doorInstance.closeMe();
+			}
+		}
+	}
+
@@ -1984,7 +1986,10 @@
			}
		}
	}
-
+	
+	/**
+    * author : Mazokista
+	 * Open doors specified in configs
+	 */
+	private static void openDoorsCTF() 
+	{
+		for (int doorId : Config.CTF_DOORS_IDS_TO_OPEN) 
+		{
+			L2DoorInstance doorInstance = DoorTable.getInstance().getDoor(doorId);
+			if (doorInstance != null) 
+			{
+				doorInstance.openMe();
+			}
+		}
+	}
+
Index: java/config/additions.ini
===================================================================
--- java/config/additions.ini	(revision 57)
+++ java/config/additions.ini	(working copy)
@@ -377,9 +377,3 @@

# on revive participants regain full hp/mp/cp ?
CTFReviveRecovery = False
+
+# Installation of doors in the closed / open in early / late
+# ex.: 1;2;3;4;5;6
+# no ";" at the start or end
+CTFDoorsToOpen =
+CTFDoorsToClose =
\ No newline at end of file

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

    • L2Elixir – Patch 4 Is Live!   We’re working non-stop, day and night, to deliver the best possible quality and bring back what made L2Elixir special. This project is built with passion, not shortcuts — for the old-school players who remember, and the new ones who want to experience it properly. Thank you for being part of the journey. Together, we’re making L2Elixir great again ❤️ The legends never fade.    ⚙️ General Enabled Class Change service (same class type only) ALT + B → Services → Character Development Enabled Shift + Click on Treasure Chests Players can now identify real chests (Adena, scroll drops) and use Key / Unlock Event deaths now cancel only debuffs, All self buffs are preserved, fixes issues with Root and similar effects Bladedancer class can now log in even when Max Clients (2) is reached. Since an active Bladedancer is not available for every damage dealer and some players tried to abuse this via VPN or a second PC, this feature was added to keep things fair. protections applies, requires testing!    🎒 Items Crystallizing enchanted items now gives the correct increased crystal amount (retail-like behavior) Removed Agathion Seal Bracelet: Rudolph from Santa rewards (Gracia Final item) Added Dualsword Craft Stamp into Milestone Exchange list    🧙 Skills Fixed Banish Undead lethal chance Hot Springs Malaria and similar effects now level up faster while being attacked
    • thats new SEO level tricks you know nothing of noob - bottom line: exposed.
    • Warning: This guy is a big scammer, trying to sell everything, advertising for servers etc. That's his mail address evgesha.nrnr@gmail.com , stay away!   @Atom @Celestine
    • Warning: This guy is a big scammer, trying to sell everything, advertising for servers etc. That's his mail address evgesha.nrnr@gmail.com , stay away! @Celestine @Atom
  • 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