Jump to content

[Share]No Cursed Weapons weapons in TvT.


Goddess

Recommended Posts

Here's small share for you :O

 

Index: java/net/sf/l2j/gameserver/model/entity/TvTEvent.java
===================================================================
--- java/net/sf/l2j/gameserver/model/entity/TvTEvent.java	(revision 2909)
+++ java/net/sf/l2j/gameserver/model/entity/TvTEvent.java	(working copy)
@@ -177,20 +177,28 @@
			highestLevelPlayerId = highestLevelPcInstanceOf(allParticipants);
			highestLevelPlayer = allParticipants.get(highestLevelPlayerId);
			allParticipants.remove(highestLevelPlayerId);
-			_teams[priority].addPlayer(highestLevelPlayer);
-			balance[priority] += highestLevelPlayer.getLevel();
-			// Exiting if no more players
-			if (allParticipants.isEmpty()) break;
-			// The other team gets one player
-			// XXX: Code not dry
-			priority = 1-priority;
-			highestLevelPlayerId = highestLevelPcInstanceOf(allParticipants);
-			highestLevelPlayer = allParticipants.get(highestLevelPlayerId);
-			allParticipants.remove(highestLevelPlayerId);
-			_teams[priority].addPlayer(highestLevelPlayer);
-			balance[priority] += highestLevelPlayer.getLevel();
-			// Recalculating priority
-			priority = balance[0] > balance[1] ? 1 : 0;
+			// Don't add any cursed weapon owners to either team
+			if (highestLevelPlayer.isCursedWeaponEquipped())
+			{
+				highestLevelPlayer.sendMessage("Your TvT registration has been canceled. Cursed weapon owners are not allowed to participate.");
+			}
+			else
+			{	
+				_teams[priority].addPlayer(highestLevelPlayer);
+				balance[priority] += highestLevelPlayer.getLevel();
+				// Exiting if no more players
+				if (allParticipants.isEmpty()) break;
+				// The other team gets one player
+				// XXX: Code not dry
+				priority = 1-priority;
+				highestLevelPlayerId = highestLevelPcInstanceOf(allParticipants);
+				highestLevelPlayer = allParticipants.get(highestLevelPlayerId);
+				allParticipants.remove(highestLevelPlayerId);
+				_teams[priority].addPlayer(highestLevelPlayer);
+				balance[priority] += highestLevelPlayer.getLevel();
+				// Recalculating priority
+				priority = balance[0] > balance[1] ? 1 : 0;
+			}
		}

		// Check for enought participants

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...