Noticias:

No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.

Menú Principal

En TvT muestra el numero de muertes

Iniciado por Swarlog, Jul 25, 2025, 12:27 AM

Tema anterior - Siguiente tema

Swarlog

### Eclipse Workspace Patch 1.0
#P L2_GameServer
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(revisione 4459)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(copia locale)
@@ -760,6 +760,10 @@
 	private int _fishy = 0;
 	private int _fishz = 0;
 	
+	/** TvTEvent participants settings */
+	private short points = 0;
+	public String _originalTitle;
+	
 	private int[] _transformAllowedSkills = {};
 	private ScheduledFuture<?> _taskRentPet;
 	private ScheduledFuture<?> _taskWater;
@@ -15095,4 +15099,19 @@
 		// Maintain = 1
 		return 0;
 	}
+	
+	public short getScore()
+	{
+		return points;
+	}
+	
+	public void increaseScore()
+	{
+		points++;
+	}
+	
+	public void clearPoints()
+	{
+		points = 0;
+	}
 }
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java	(revisione 4459)
+++ java/com/l2jserver/Config.java	(copia locale)
@@ -651,6 +651,7 @@
 	public static int[] TVT_EVENT_PARTICIPATION_FEE = new int[2];
 	public static int TVT_EVENT_MIN_PLAYERS_IN_TEAMS;
 	public static int TVT_EVENT_MAX_PLAYERS_IN_TEAMS;
+	public static String TVT_EVENT_ON_KILL;
 	public static int TVT_EVENT_RESPAWN_TELEPORT_DELAY;
 	public static int TVT_EVENT_START_LEAVE_TELEPORT_DELAY;
 	public static String TVT_EVENT_TEAM_1_NAME;
@@ -2206,6 +2207,7 @@
 					TVT_EVENT_PARTICIPATION_TIME = Integer.parseInt(L2JModSettings.getProperty("TvTEventParticipationTime", "3600"));
 					TVT_EVENT_RUNNING_TIME = Integer.parseInt(L2JModSettings.getProperty("TvTEventRunningTime", "1800"));
 					TVT_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(L2JModSettings.getProperty("TvTEventParticipationNpcId", "0"));
+					TVT_EVENT_ON_KILL = L2JModSettings.getProperty("TvTEventOnKill", "pmteam");
 					
 					L2JMOD_ALLOW_WEDDING = Boolean.parseBoolean(L2JModSettings.getProperty("AllowWedding", "False"));
 					L2JMOD_WEDDING_PRICE = Integer.parseInt(L2JModSettings.getProperty("WeddingPrice", "250000000"));
Index: java/com/l2jserver/gameserver/model/entity/TvTEvent.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/TvTEvent.java	(revisione 4459)
+++ java/com/l2jserver/gameserver/model/entity/TvTEvent.java	(copia locale)
@@ -23,6 +23,7 @@
 import javolution.util.FastMap;
 
 import com.l2jserver.Config;
+import com.l2jserver.gameserver.ThreadPoolManager;
 import com.l2jserver.gameserver.cache.HtmCache;
 import com.l2jserver.gameserver.datatables.DoorTable;
 import com.l2jserver.gameserver.datatables.ItemTable;
@@ -286,6 +287,13 @@
 				{
 					// Teleporter implements Runnable and starts itself
 					new TvTEventTeleporter(playerInstance, team.getCoordinates(), false, false);
+					if (Config.TVT_EVENT_ON_KILL.equalsIgnoreCase("title") || Config.TVT_EVENT_ON_KILL.equalsIgnoreCase("pmtitle"))
+					{
+						playerInstance._originalTitle = playerInstance.getTitle();
+						playerInstance.setTitle("Kills: " + playerInstance.getScore());
+						playerInstance.getAppearance().setVisibleTitle("Kills: " + playerInstance.getScore());
+						playerInstance.broadcastTitleInfo();
+					}
 				}
 			}
 		}
@@ -419,12 +427,26 @@
 		// Iterate over all teams
 		for (TvTEventTeam team : _teams)
 		{
-			for (L2PcInstance playerInstance : team.getParticipatedPlayers().values())
+			for (final L2PcInstance playerInstance : team.getParticipatedPlayers().values())
 			{
 				// Check for nullpointer
 				if (playerInstance != null)
 				{
 					new TvTEventTeleporter(playerInstance, Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES, false, false);
+					if (Config.TVT_EVENT_ON_KILL.equalsIgnoreCase("title") || Config.TVT_EVENT_ON_KILL.equalsIgnoreCase("pmtitle"))
+					{
+						ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+						{
+							@Override
+							public void run()
+							{
+								playerInstance.setTitle(playerInstance._originalTitle);
+								playerInstance.getAppearance().setVisibleTitle(playerInstance._originalTitle);
+								playerInstance.broadcastTitleInfo();
+								playerInstance.clearPoints();
+							}
+						}, Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY * 1000);
+					}
 				}
 			}
 		}
@@ -626,6 +648,12 @@
 				playerInstance.setXYZInvisible(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[0] + Rnd.get(101)-50,
 						Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[1] + Rnd.get(101)-50,
 						Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[2]);
+			if (Config.TVT_EVENT_ON_KILL.equalsIgnoreCase("title") || Config.TVT_EVENT_ON_KILL.equalsIgnoreCase("pmtitle"))
+			{
+				playerInstance.setTitle(playerInstance._originalTitle);
+				playerInstance.getAppearance().setVisibleTitle(playerInstance._originalTitle);
+				playerInstance.broadcastTitleInfo();
+			}
 		}
 	}
 	
@@ -890,15 +918,37 @@
 			
 			killerTeam.increasePoints();
 			
-			CreatureSay cs = new CreatureSay(killerPlayerInstance.getObjectId(), Say2.TELL, killerPlayerInstance.getName(), "I have killed " + killedPlayerInstance.getName() + "!");
-			
-			for (L2PcInstance playerInstance : _teams[killerTeamId].getParticipatedPlayers().values())
+			if (Config.TVT_EVENT_ON_KILL.equalsIgnoreCase("pmteam"))
 			{
-				if (playerInstance != null)
+				CreatureSay cs = new CreatureSay(killerPlayerInstance.getObjectId(), Say2.TELL, killerPlayerInstance.getName(), "I have killed " + killedPlayerInstance.getName() + "!");
+				
+				for (L2PcInstance playerInstance : _teams[killerTeamId].getParticipatedPlayers().values())
 				{
-					playerInstance.sendPacket(cs);
+					if (playerInstance != null)
+						playerInstance.sendPacket(cs);
 				}
 			}
+			else if (Config.TVT_EVENT_ON_KILL.equalsIgnoreCase("title"))
+			{
+				killerPlayerInstance.increaseScore();
+				killerPlayerInstance.setTitle("Kills: " + killerPlayerInstance.getScore());
+				killerPlayerInstance.getAppearance().setVisibleTitle("Kills: " + killerPlayerInstance.getScore());
+				killerPlayerInstance.broadcastTitleInfo();
+			}
+			else if (Config.TVT_EVENT_ON_KILL.equalsIgnoreCase("pmtitle"))
+			{
+				CreatureSay cs = new CreatureSay(killerPlayerInstance.getObjectId(), Say2.TELL, killerPlayerInstance.getName(), "I have killed " + killedPlayerInstance.getName() + "!");
+				
+				for (L2PcInstance playerInstance : _teams[killerTeamId].getParticipatedPlayers().values())
+				{
+					if (playerInstance != null)
+						playerInstance.sendPacket(cs);
+				}
+				killerPlayerInstance.increaseScore();
+				killerPlayerInstance.setTitle("Kills: " + killerPlayerInstance.getScore());
+				killerPlayerInstance.getAppearance().setVisibleTitle("Kills: " + killerPlayerInstance.getScore());
+				killerPlayerInstance.broadcastTitleInfo();
+			}
 		}
 	}
 	
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revisione 4459)
+++ java/config/l2jmods.properties	(copia locale)
@@ -163,6 +163,15 @@
 TvTEventMinPlayerLevel = 1
 TvTEventMaxPlayerLevel = 85
 
+# Method to show player's kill on the TvT event.
+# Choose "pmteam" for an automatic personal message to the player team.
+# Example: "Player1: I have killed Player2 !".
+# Put "title" for an automatic title that counts the player's kills.
+# Example: "Kills: number" (title will be restored at the event end).
+# Put "pmtitle" for both methods (pmteam and title).
+# Default: pmteam
+TvTEventOnKill = pmteam
+
 # Repsawn and exit delay timers (in seconds).
 TvTEventRespawnTeleportDelay = 10
 TvTEventStartLeaveTeleportDelay = 10