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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...