Jump to content

[L2J Contest - Share] Siege only for registered clans


Cod3x

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Ye, but the point is that no one's trying to create something similar to it.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.



  • Posts

    • Both "MMO genre" AND "forums" are greatly deprecated those days. MMO genre, except very few games (TESO, WOW, BDO, FF14), is mostly "eaten" by fast paced games (aka games with 15-30min game parties, they are numerous). See Twitch best games, I doubt the top 10 are MMOs. Adding more MMOs categories, while MMOs themselves got less population, isn't a bright idea. Also, in the past, there was multiple games categories - none actually worked out, so far. Forums type were replaced by Discord, mostly. You communicate faster, you got voice, you can group up and it's already thematized (by server, by guild, by game,...)... Unfortunately, there is nothing you can do about. You already did it multiple times without success (3 or 4 times at least ?). It's not due to staff. MMO forum is just "niche" nowadays, while 20 years ago it was "dope" and the thing to do. Your main problem is MxC is a community based on "nothing". It was first cheater dedicated, then mostly L2 development dedicated,... With a mix of random things here and there. The formula is lightly-themed as "community" (that's actually why you still have some ppl posting), and in same time community never was expanded to retain ppl (notably through MxC servers - no matter the game : L2, GTA, Conan Exiles, Lost Ark, whatever else). In the end, you end with "nothing", since people comes and goes (and mostly goes, since MMO isn't a thing anymore), but both MMO genre is greatly endangered by other types of games AND forums isn't the proper way to communicate in 2024. Actually, the only use of a forums compared to Discord is to search through archives, and the main point is it's a better "showcase" than Discord (a static website would end with the same output). The proposed formula will never work, or at best will attract greedy ppl.
    • Welcome to my store :https://ultrasstore11.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10.50 $ 2017 Discord Account :4.99 $ 2018 Discord Account : 3.99 $ 2019 Discord Account : 2.99 $ 2020 Discord Account :1.99$ 2021 Discord Account :1.50$ 2022 Discord Account :0.99$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord :@ultrasstore11 Telegram : https://t.me/ultrastore11  
    • Hello everyone,    As you can see lately, the L2 community is decreasing, especially on private servers, its been 21 years since Lineage2 release date (1st October 2003). MaxCheaters.com was created in 2005 (with different names) and till today we are basically focused on Lineage 2. We made several attempts to add other games, but everyone still knew us as an L2 based forum. MaxCheaters has a long history and is one of the few forums that have survived to this day,It would be a shame to let the site die.   So I came up with a few ideas to improve it and follow the trends.   1. Create a utility token, (evm or solana), that will be used for several things such as: Staffers/moderators payment. Content creators reward system. (influencers/advertising/topic creators) Paid forum support. Exchanges and marketplaces . Lineage 2 utility token for private servers. Other MMO utility token for buying/selling accounts/gold etc. Maxcheaters fixed expenses/improvements/development/expansion/design/topsite   2. Reduce l2 sections, (we done this before) , and add more games on main page Less l2 sections More MMO games Focus on marketplaces    3. Rebuild staffers team/more events. Add one staffer per MMO game. More active staffers on our team.   4. Social media activity / streaming Twtter / TikTok content for gaming.  Streaming platforms (create official channel) Moderators/content creators for this content specifically.
  • Topics

×
×
  • Create New...