View difference between Paste ID: 9HGqWDdx and ZemraJnA
SHOW: | | - or go back to the newest paste.
1
Index: /trunk/L2_GameServer_CT1.5/config/siege.properties
2
===================================================================
3
--- /trunk/L2_GameServer_CT1.5/config/siege.properties	(revision 3589)
4
+++ /trunk/L2_GameServer_CT1.5/config/siege.properties	(revision 3835)
5
@@ -24,4 +24,7 @@
6
 #Respawn time penalty for loosing each Control tower
7
 CTLossPenalty=20000
8
+
9
+#Allow only registered clans/allys to fight each other on siege ground during sieges
10
+OnlyRegistered = True
11
 
12
 #Caste Artefacts and Control Towers spawns
13
Index: /trunk/L2_GameServer_CT1.5/src/main/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
14
===================================================================
15
--- /trunk/L2_GameServer_CT1.5/src/main/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 3831)
16
+++ /trunk/L2_GameServer_CT1.5/src/main/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 3835)
17
@@ -87,4 +87,5 @@
18
 import net.sf.l2j.gameserver.model.BlockList;
19
 import net.sf.l2j.gameserver.model.CursedWeapon;
20
+import net.sf.l2j.gameserver.model.L2SiegeClan;
21
 import net.sf.l2j.gameserver.model.FishData;
22
 import net.sf.l2j.gameserver.model.ForceBuff;
23
@@ -3409,4 +3410,68 @@
24
 	}
25
 
26
+	private boolean canBeTargetedByAtSiege(L2PcInstance player)
27
+	{
28
+		Siege siege = SiegeManager.getInstance().getSiege(this);
29
+		if (siege != null && siege.getIsInProgress())
30
+		{
31
+			L2Clan selfClan = getClan();
32
+			L2Clan oppClan = player.getClan();
33
+			if (selfClan != null && oppClan != null)
34
+			{
35
+				boolean self = false;
36
+				for (L2SiegeClan clan : siege.getAttackerClans())
37
+				{
38
+					L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
39
+					
40
+					if (cl == selfClan || cl.getAllyId() == getAllyId())
41
+					{
42
+						self = true;
43
+						break;
44
+					}
45
+				}
46
+				
47
+				for (L2SiegeClan clan : siege.getDefenderClans())
48
+				{
49
+					L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
50
+					
51
+					if (cl == selfClan || cl.getAllyId() == getAllyId())
52
+					{
53
+						self = true;
54
+						break;
55
+					}
56
+				}
57
+				
58
+				boolean opp = false;
59
+				for (L2SiegeClan clan : siege.getAttackerClans())
60
+				{
61
+					L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
62
+					
63
+					if (cl == oppClan || cl.getAllyId() == player.getAllyId())
64
+					{
65
+						opp = true;
66
+						break;
67
+					}
68
+				}
69
+				
70
+				for (L2SiegeClan clan : siege.getDefenderClans())
71
+				{
72
+					L2Clan cl = ClanTable.getInstance().getClan(clan.getClanId());
73
+					
74
+					if (cl == oppClan || cl.getAllyId() == player.getAllyId())
75
+					{
76
+						opp = true;
77
+						break;
78
+					}
79
+				}
80
+				
81
+				return self && opp;
82
+			}
83
+			
84
+			return false;
85
+		}
86
+		
87
+		return true;
88
+	}
89
+	
90
 	/**
91
 	 * Manage actions when a player click on this L2PcInstance.<BR><BR>
92
@@ -3441,4 +3506,14 @@
93
 		}
94
 
95
+		if(Config.SIEGE_ONLY_REGISTERED)
96
+		{
97
+			if (!canBeTargetedByAtSiege(player))
98
+			{
99
+				player.sendMessage("Player interaction disabled during sieges.");
100
+				player.sendPacket(ActionFailed.STATIC_PACKET);
101
+				return;
102
+			}
103
+		}
104
+		
105
 		if ((TvT._started && !Config.TVT_ALLOW_INTERFERENCE) || (CTF._started && !Config.CTF_ALLOW_INTERFERENCE) || (DM._started && !Config.DM_ALLOW_INTERFERENCE))
106
 		{
107
Index: /trunk/L2_GameServer_CT1.5/src/main/java/net/sf/l2j/Config.java
108
===================================================================
109
--- /trunk/L2_GameServer_CT1.5/src/main/java/net/sf/l2j/Config.java	(revision 3831)
110
+++ /trunk/L2_GameServer_CT1.5/src/main/java/net/sf/l2j/Config.java	(revision 3835)
111
@@ -1876,4 +1876,6 @@
112
 	public static int			SIEGE_CLAN_MIN_LEVEL;
113
 	public static int			SIEGE_LENGTH_MINUTES;
114
+	
115
+	public static boolean		SIEGE_ONLY_REGISTERED;
116
 
117
 	public static void loadSiegeConfig()
118
@@ -1896,4 +1898,6 @@
119
 			SIEGE_CLAN_MIN_LEVEL = Integer.parseInt(siegeSettings.getProperty("SiegeClanMinLevel", "5"));
120
 			SIEGE_LENGTH_MINUTES = Integer.parseInt(siegeSettings.getProperty("SiegeLength", "120"));
121
+			
122
+			SIEGE_ONLY_REGISTERED = Boolean.parseBoolean(siegeSettings.getProperty("OnlyRegistered", "true"));
123
 		}
124
 		catch (Exception e)