Jump to content

Recommended Posts

Posted

Well, this is a patch will allow only the registered players or clans to fight in the siege, so noone else can come and fight. I made it for my server and also a friend helped me, I finished it today.

Useful for PvP servers!

 

Patch:

Index: /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SiegeGuardInstance.java
===================================================================
--- /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SiegeGuardInstance.java (revision 231)
+++ /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SiegeGuardInstance.java (revision 317)
@@ -25,8 +25,13 @@
import net.sf.l2j.gameserver.ai.L2CharacterAI;
import net.sf.l2j.gameserver.ai.L2SiegeGuardAI;
+import net.sf.l2j.gameserver.datatables.ClanTable;
+import net.sf.l2j.gameserver.instancemanager.SiegeManager;
import net.sf.l2j.gameserver.model.L2Attackable;
import net.sf.l2j.gameserver.model.L2CharPosition;
import net.sf.l2j.gameserver.model.L2Character;
+import net.sf.l2j.gameserver.model.L2Clan;
+import net.sf.l2j.gameserver.model.L2SiegeClan;
import net.sf.l2j.gameserver.model.actor.knownlist.SiegeGuardKnownList;
+import net.sf.l2j.gameserver.model.entity.Siege;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
@@ -146,5 +151,34 @@
	public void onAction(L2PcInstance player)
	{
-		if (!canTarget(player)) return;
+		if (!canTarget(player))
+			return;
+		
+		boolean opp = false;
+		Siege siege = SiegeManager.getInstance().getSiege(player);
+		L2Clan oppClan = player.getClan();
+		if (siege != null && siege.getIsInProgress() && oppClan != null)
+		{
+			for (L2SiegeClan clan : siege.getAttackerClans())
+			{
+				L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
+				if (cl == oppClan || cl.getAllyId() == player.getAllyId())
+				{
+					opp = true;
+					break;
+				}
+			}
+			
+			for (L2SiegeClan clan : siege.getDefenderClans())
+			{
+				L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
+				if (cl == oppClan || cl.getAllyId() == player.getAllyId())
+				{
+					opp = true;
+					break;
+				}
+			}
+			if(!opp)
+				return;
+		}

		// Check if the L2PcInstance already target the L2NpcInstance
Index: /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SiegeFlagInstance.java
===================================================================
--- /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SiegeFlagInstance.java (revision 231)
+++ /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SiegeFlagInstance.java (revision 317)
@@ -96,6 +96,9 @@
		if (player == null || !canTarget(player))
			return;
+		
+		if(!_player.siegeonlyRegistered(player))
+			return;

-			// Check if the L2PcInstance already target the L2NpcInstance
+		// Check if the L2PcInstance already target the L2NpcInstance
		if (this != player.getTarget())
		{
Index: /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 314)
+++ /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 317)
@@ -106,4 +106,5 @@
import net.sf.l2j.gameserver.model.L2Request;
import net.sf.l2j.gameserver.model.L2ShortCut;
+import net.sf.l2j.gameserver.model.L2SiegeClan;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.L2SkillLearn;
@@ -3419,4 +3420,11 @@
		if (!TvTEvent.onAction(player.getName(), getName()))
		{
+			player.sendPacket(ActionFailed.STATIC_PACKET);
+			return;
+		}
+		
+		if (!siegeonlyRegistered(player))
+		{
+			player.sendMessage("Player interaction disabled during sieges.");
			player.sendPacket(ActionFailed.STATIC_PACKET);
			return;
@@ -10947,3 +10955,60 @@
		 _isAway = state;
	 }
+	 
+	 public boolean siegeonlyRegistered(L2PcInstance player)
+	 {
+		 Siege siege = SiegeManager.getInstance().getSiege(this);
+		 if (siege != null && siege.getIsInProgress())
+		 {
+			 L2Clan selfClan = getClan();
+			 L2Clan oppClan = player.getClan();
+			 if (selfClan != null && oppClan != null)
+			 {
+				 boolean self = false;
+				 for (L2SiegeClan clan : siege.getAttackerClans())
+				 {
+					 L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
+					 if (cl == selfClan || cl.getAllyId() == getAllyId())
+					 {
+						 self = true;
+						 break;
+					 }
+				 }
+				 
+				 for (L2SiegeClan clan : siege.getDefenderClans())
+				 {
+					 L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
+					 if (cl == selfClan || cl.getAllyId() == getAllyId())
+					 {
+						 self = true;
+						 break;
+					 }
+				 }
+				 
+				 boolean opp = false;
+				 for (L2SiegeClan clan : siege.getAttackerClans())
+				 {
+					 L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
+					 if (cl == oppClan || cl.getAllyId() == player.getAllyId())
+					 {
+						 opp = true;
+						 break;
+					 }
+				 }
+				 
+				 for (L2SiegeClan clan : siege.getDefenderClans())
+				 {
+					 L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
+					 if (cl == oppClan || cl.getAllyId() == player.getAllyId())
+					 {
+						 opp = true;
+						 break;
+					 }
+				 }
+				 return self && opp;
+			 }
+			 return false;
+		 }
+		 return true;
+	 }
}
Index: /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2DoorInstance.java
===================================================================
--- /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2DoorInstance.java (revision 231)
+++ /trunk/GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2DoorInstance.java (revision 317)
@@ -31,9 +31,13 @@
import net.sf.l2j.gameserver.ai.L2CharacterAI;
import net.sf.l2j.gameserver.ai.L2DoorAI;
+import net.sf.l2j.gameserver.datatables.ClanTable;
import net.sf.l2j.gameserver.instancemanager.CastleManager;
+import net.sf.l2j.gameserver.instancemanager.SiegeManager;
import net.sf.l2j.gameserver.model.L2CharPosition;
import net.sf.l2j.gameserver.model.L2Character;
+import net.sf.l2j.gameserver.model.L2Clan;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.L2Object;
+import net.sf.l2j.gameserver.model.L2SiegeClan;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.actor.knownlist.DoorKnownList;
@@ -42,4 +46,5 @@
import net.sf.l2j.gameserver.model.entity.Castle;
import net.sf.l2j.gameserver.model.entity.ClanHall;
+import net.sf.l2j.gameserver.model.entity.Siege;
import net.sf.l2j.gameserver.network.L2GameClient;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
@@ -368,4 +373,38 @@
        if (player == null)
            return;
+        
+        boolean opp = false;
+        Siege siege = SiegeManager.getInstance().getSiege(player);
+        L2Clan oppClan = player.getClan();
+        if (siege != null && siege.getIsInProgress())
+        {
+        	if (oppClan != null)
+        	{
+        		for (L2SiegeClan clan : siege.getAttackerClans())
+        		{
+        			L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
+        			if (cl == oppClan || cl.getAllyId() == player.getAllyId())
+        			{
+        				opp = true;
+        				break;
+        			}
+        		}
+        		
+        		for (L2SiegeClan clan : siege.getDefenderClans())
+        		{
+        			L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
+        			if (cl == oppClan || cl.getAllyId() == player.getAllyId())
+        			{
+        				opp = true;
+        				break;
+        			}
+        		}
+        	}
+        }
+        else
+        	opp = true;
+        
+        if (!opp)
+        	return;

        // Check if the L2PcInstance already target the L2NpcInstance

Posted

i cant understand you.. if one clan is not register to attack the castle can attack?? no .. and why you share it???

If a clan is not registered he cannot attack the registered clans or participants during the event...

Posted

add a message to non attackers: "You cannot attack on siege area because your clan is not registered"

Posted

add a message to non attackers: "You cannot attack on siege area because your clan is not registered"

 

/agree, cuz if someone wont knew that you are using thing like this, will spam youre server forum "why i cant attack... omg bug..."

Posted

Gratz for destroying every retail feature left >_>

Anw, I'd cut my head that I've seen this before.

Anyway.

 

PS: Fixed the Hide ammount, don't put so high values for such codes.

Posted

Gratz for destroying every retail feature left >_>

Anw, I'd cut my head that I've seen this before.

Anyway.

 

PS: Fixed the Hide ammount, don't put so high values for such codes.

 

Yes it's right but it's very nice for fun server and pvp, work fine thanks for share it

Posted

Gratz for destroying every retail feature left >_>

Anw, I'd cut my head that I've seen this before.

Anyway.

 

PS: Fixed the Hide ammount, don't put so high values for such codes.

 

dude :D l2j isnt like retail already long long long time ago :D

Posted

ye but this sux and if ally want to help then what ? -.-

Non-registered clans cannot attack the walls the guards the players registered in the siege... This is so so cool feature for PvP Servers. ! THE BEST WILL WIN.

Posted

this will reduce the pvp's!

if is siege and there is only 2 clan attack and one defence the castle then if players without clan come to fight or others clan help the attackers then they will cant help cause of this and then no pvps...i dont want to see this in any server!

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

    • What complaint are you talking about? I didn't accuse anyone. They came to our topic and began pouring unreasonable dirt, and giving screenshots from competitive forums, where they and their fellow competitors are engaged in blackening our name. Have we offended you in any way?
    • I would like to clarify something publicly because false statements should not go unanswered. I have absolutely no relationship, partnership, or special connection with SkyLord. Any claim suggesting otherwise is entirely unsupported and based on assumptions rather than facts. It is disappointing to see people making accusations against others without presenting a single piece of evidence. Disagreement is one thing; inventing narratives and presenting personal opinions as facts is something completely different. If someone believes I have acted improperly, they are welcome to provide verifiable proof. Until then, these allegations are nothing more than speculation and should be treated as such. I have always been responsible for my own actions and opinions, and I do not need anyone's protection, influence, or assistance to participate in any community. Making accusations without evidence does not strengthen an argumen it only damages the credibility of the person making them. It should be clarified that I have already filed a report so that action can be taken; it is not fair that a post is being distorted in the way that has been happening.  
    • I don't think there is any bias on maxcheaters, this is the only forum left of the major ones where there is an honest administration. You may have meant mmodev, where the administration really has an interest in such fakes about competitors. I am not in favor of posting other people's correspondence, where they discuss with each other how to destroy us... but I'm not going to do this and post it, it's low, I hope that people themselves will finally understand that they are behaving completely wrong and unprofessionally.
    • I am really sorry for what SkyLord is doing to you. Unfortunately, this is not an isolated problem. The same kind of attacks have been happening to me as well. From my point of view, the issue is bigger than just one person, because SkyLord works closely with UnknownSoldier, who is a moderator on MaxCheaters, and that gives them influence and protection inside the forum. This is why they attack you in the same way they attack me: with pressure, manipulation, false accusations, and attempts to damage your reputation. In my opinion, the real problem is that privileges were given to the wrong people. As long as people like this have power there, the forum cannot be trusted anymore. I just wanted to tell you that I understand what you are going through, and I stand with you. They have done the same to me.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..