Browse Source

New zone to prevent player summon siege flag inside the castle's (Need dp support)

Charus 15 years ago
parent
commit
3a3ceb38ad

+ 3 - 0
L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/ZoneManager.java

@@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
+
 import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
 import net.sf.l2j.gameserver.model.L2Object;
@@ -186,6 +187,8 @@ public class ZoneManager
 								temp = new L2ScriptZone(zoneId);
 							else if (zoneType.equals("PaganZone"))
 								temp = new L2PaganZone(zoneId);
+							else if (zoneType.equals("NoHqZone"))
+								temp = new L2NoHqZone(zoneId);
 							
 							// Check for unknown type
 							if (temp == null)

+ 2 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/L2Character.java

@@ -207,8 +207,9 @@ public abstract class L2Character extends L2Object
 	public static final byte ZONE_NOSTORE = 14;
 	public static final byte ZONE_TOWN = 15;
 	public static final byte ZONE_SCRIPT = 16;
+	public static final byte ZONE_NOHQ = 17;
 
-	private final byte[] _zones = new byte[17];
+	private final byte[] _zones = new byte[18];
 	protected byte _zoneValidateCounter = 4;
 
 	private boolean _isRaid = false;

+ 56 - 0
L2_GameServer/java/net/sf/l2j/gameserver/model/zone/type/L2NoHqZone.java

@@ -0,0 +1,56 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.model.zone.type;
+
+import net.sf.l2j.gameserver.model.actor.L2Character;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.zone.L2ZoneType;
+
+/**
+ * Zone where 'Build Headquarters' is not allowed.
+ * 
+ * @author Gnat
+ */
+public class L2NoHqZone extends L2ZoneType
+{
+	public L2NoHqZone(final int id)
+	{
+		super(id);
+	}
+
+	@Override
+	protected void onEnter(final L2Character character)
+	{
+		if (character instanceof L2PcInstance)
+			character.setInsideZone(L2Character.ZONE_NOHQ, true);
+	}
+
+	@Override
+	protected void onExit(final L2Character character)
+	{
+		if (character instanceof L2PcInstance)
+			character.setInsideZone(L2Character.ZONE_NOHQ, false);
+	}
+
+	@Override
+	public void onDieInside(final L2Character character)
+	{
+	}
+
+	@Override
+	public void onReviveInside(final L2Character character)
+	{
+	}
+}

+ 6 - 4
L2_GameServer/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillSiegeFlag.java

@@ -125,15 +125,17 @@ public class L2SkillSiegeFlag extends L2Skill
 		L2PcInstance player = (L2PcInstance) activeChar;
 		
 		if (castle == null || castle.getCastleId() <= 0)
-			text = "You must be on castle ground to place a flag";
+			text = "You must be on castle ground to place a flag.";
 		else if (!castle.getSiege().getIsInProgress())
 			text = "You can only place a flag during a siege.";
 		else if (castle.getSiege().getAttackerClan(player.getClan()) == null)
-			text = "You must be an attacker to place a flag";
+			text = "You must be an attacker to place a flag.";
 		else if (player.getClan() == null || !player.isClanLeader())
-			text = "You must be a clan leader to place a flag";
+			text = "You must be a clan leader to place a flag.";
 		else if (castle.getSiege().getAttackerClan(player.getClan()).getNumFlags() >= SiegeManager.getInstance().getFlagMaxCount())
-			text = "You have already placed the maximum number of flags possible";
+			text = "You have already placed the maximum number of flags possible.";
+		else if (player.isInsideZone(L2Character.ZONE_NOHQ))
+			text = "You cannot place flag here.";
 		else
 			return true;