浏览代码

TvT in instance support. Check config file for details.

_DS_ 15 年之前
父节点
当前提交
bcf0e3238f

+ 7 - 0
L2_GameServer/java/config/l2jmods.properties

@@ -125,6 +125,12 @@ WeddingDivorceCosts = 20
 # Enable/Disable TvTEvent System
 TvTEventEnabled = False
 
+# TvT in instance
+TvTEventInInstance = False
+
+# Name of the instance file for TvT
+TvTEventInstanceFile = coliseum.xml
+
 # Times TvT will occur (24h format).
 TvTEventInterval = 9:00,15:00,21:00,3:00
 
@@ -176,6 +182,7 @@ TvTEventPotionsAllowed = False
 TvTEventSummonByItemAllowed = False
 
 # Door ID's to open/close on start/end.
+# Not supported in instance, use xml template for defining doors.
 # Example: TvTDoorsToOpen = 1;2;3;4;5;6
 TvTDoorsToOpen = 
 TvTDoorsToClose = 

+ 4 - 0
L2_GameServer/java/net/sf/l2j/Config.java

@@ -566,6 +566,8 @@ public final class Config
 	public static int L2JMOD_CHAMPION_REWARD_QTY;
 	public static boolean	L2JMOD_CHAMPION_ENABLE_VITALITY;
 	public static boolean TVT_EVENT_ENABLED;
+	public static boolean TVT_EVENT_IN_INSTANCE;
+	public static String TVT_EVENT_INSTANCE_FILE;
 	public static String[] TVT_EVENT_INTERVAL;
 	public static int TVT_EVENT_PARTICIPATION_TIME;
 	public static int TVT_EVENT_RUNNING_TIME;
@@ -1809,6 +1811,8 @@ public final class Config
 					L2JMOD_CHAMPION_ENABLE_VITALITY = Boolean.parseBoolean(L2JModSettings.getProperty("ChampionEnableVitality", "False"));
 
 					TVT_EVENT_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventEnabled", "false"));
+					TVT_EVENT_IN_INSTANCE = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEventInInstance", "false"));
+					TVT_EVENT_INSTANCE_FILE = L2JModSettings.getProperty("TvTEventInstanceFile", "coliseum.xml");
 					TVT_EVENT_INTERVAL = L2JModSettings.getProperty("TvTEventInterval", "20:00").split(",");
 					TVT_EVENT_PARTICIPATION_TIME = Integer.parseInt(L2JModSettings.getProperty("TvTEventParticipationTime", "3600"));
 					TVT_EVENT_RUNNING_TIME = Integer.parseInt(L2JModSettings.getProperty("TvTEventRunningTime", "1800"));

+ 25 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/entity/TvTEvent.java

@@ -26,6 +26,7 @@ import net.sf.l2j.gameserver.datatables.ItemTable;
 import net.sf.l2j.gameserver.datatables.NpcTable;
 import net.sf.l2j.gameserver.datatables.SkillTable;
 import net.sf.l2j.gameserver.datatables.SpawnTable;
+import net.sf.l2j.gameserver.instancemanager.InstanceManager;
 import net.sf.l2j.gameserver.model.L2Skill;
 import net.sf.l2j.gameserver.model.L2Spawn;
 import net.sf.l2j.gameserver.model.actor.L2Character;
@@ -74,6 +75,8 @@ public class TvTEvent
 	private static L2Spawn _npcSpawn = null;
 	/** the npc instance of the participation npc<br> */
 	private static L2Npc _lastNpcSpawn = null;
+	/** Instance id<br> */
+	private static int _TvTEventInstance = 0;
 	
 	/**
 	 * No instance of this class!<br>
@@ -211,7 +214,23 @@ public class TvTEvent
 			unSpawnNpc();
 			return false;
 		}
-		
+
+		if (Config.TVT_EVENT_IN_INSTANCE)
+		{
+			try
+			{
+				_TvTEventInstance = InstanceManager.getInstance().createDynamicInstance(Config.TVT_EVENT_INSTANCE_FILE);
+				InstanceManager.getInstance().getInstance(_TvTEventInstance).setAllowSummon(false);
+				InstanceManager.getInstance().getInstance(_TvTEventInstance).setPvPInstance(true);
+				InstanceManager.getInstance().getInstance(_TvTEventInstance).setEmptyDestroyTime(Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY * 1000 + 60000L);
+			}
+			catch (Exception e)
+			{
+				_TvTEventInstance = 0;
+				_log.warning("TvTEventEngine[TvTEvent.createDynamicInstance]: exception: " + e);
+			}
+		}
+
 		// Opens all doors specified in configs for tvt
 		openDoors(Config.TVT_DOORS_IDS_TO_OPEN);
 		// Closes all doors specified in configs for tvt
@@ -1188,4 +1207,9 @@ public class TvTEvent
 			_teams[0].getPoints(), _teams[1].getPoints()
 		};
 	}
+	
+	public static int getTvTEventInstance()
+	{
+		return _TvTEventInstance;
+	}
 }

+ 17 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/entity/TvTEventTeleporter.java

@@ -75,9 +75,25 @@ public class TvTEventTeleporter implements Runnable
 				|| (Config.TVT_EVENT_EFFECTS_REMOVAL == 1 && _playerInstance.getTeam() == 0))
 			_playerInstance.stopAllEffectsExceptThoseThatLastThroughDeath();
 
+		int TvTInstance = TvTEvent.getTvTEventInstance();
+		if (TvTInstance != 0)
+		{
+			if (TvTEvent.isStarted() && !_adminRemove)
+			{
+				_playerInstance.setInstanceId(TvTInstance);
+			}
+			else
+			{
+				_playerInstance.setInstanceId(0);
+			}
+		}
+		else
+		{
+			_playerInstance.setInstanceId(0);
+		}
+
 		_playerInstance.doRevive();
 
-		_playerInstance.setInstanceId(0);
 		_playerInstance.teleToLocation( _coordinates[ 0 ] + Rnd.get(101)-50, _coordinates[ 1 ] + Rnd.get(101)-50, _coordinates[ 2 ], false );
 		
 		if (TvTEvent.isStarted() && !_adminRemove)