Prechádzať zdrojové kódy

Clan hall siege update.
- Abstracting and optimizing bandit stronghold siege
- Taking bandit stronghold siege closer to retail like behaviour
- Adding Wild Beast Reserver Siege
Core Side

BiggBoss 13 rokov pred
rodič
commit
ef0187c130

+ 10 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2ClanHallManagerInstance.java

@@ -18,6 +18,7 @@ import java.text.SimpleDateFormat;
 import java.util.StringTokenizer;
 
 import com.l2jserver.Config;
+import com.l2jserver.gameserver.cache.HtmCache;
 import com.l2jserver.gameserver.datatables.SkillTable;
 import com.l2jserver.gameserver.datatables.TeleportLocationTable;
 import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
@@ -1330,7 +1331,10 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
 			else if (actualCommand.equalsIgnoreCase("list_back"))
 			{
 				NpcHtmlMessage html = new NpcHtmlMessage(1);
-				html.setFile(player.getHtmlPrefix(), "data/html/clanHallManager/chamberlain.htm");
+				String file = "data/html/clanHallManager/chamberlain-"+getNpcId()+".htm";
+				if(!HtmCache.getInstance().isLoadable(file))
+					file = "data/html/clanHallManager/chamberlain.htm";
+				html.setFile(player.getHtmlPrefix(), file);
 				html.replace("%objectId%", String.valueOf(this.getObjectId()));
 				html.replace("%npcname%", this.getName());
 				sendHtmlMessage(player, html);
@@ -1371,7 +1375,11 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
 		
 		int condition = validateCondition(player);
 		if (condition == COND_OWNER)
-			filename = "data/html/clanHallManager/chamberlain.htm";// Owner message window
+		{
+			filename = "data/html/clanHallManager/chamberlain-"+getNpcId()+".htm";
+			if(!HtmCache.getInstance().isLoadable(filename))
+				filename = "data/html/clanHallManager/chamberlain.htm";// Owner message window
+		}
 		else if (condition == COND_OWNER_FALSE)
 			filename = "data/html/clanHallManager/chamberlain-of.htm";
 		NpcHtmlMessage html = new NpcHtmlMessage(1);

+ 26 - 17
L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/clanhall/ClanHallSiegeEngine.java

@@ -38,6 +38,7 @@ import com.l2jserver.gameserver.model.L2SiegeClan;
 import com.l2jserver.gameserver.model.L2Spawn;
 import com.l2jserver.gameserver.model.L2World;
 import com.l2jserver.gameserver.model.L2SiegeClan.SiegeClanType;
+import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.entity.Siegable;
@@ -57,11 +58,12 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
 	private static final String SQL_SAVE_ATTACKERS = "INSERT INTO clanhall_siege_attackers VALUES (?,?)";
 	private static final String SQL_LOAD_GUARDS = "SELECT * FROM clanhall_siege_guards WHERE clanHallId = ?";
 
+	public static final int FORTRESS_RESSISTANCE = 21;
 	public static final int DEVASTATED_CASTLE = 34;
 	public static final int BANDIT_STRONGHOLD = 35;
-	public static final int FORTRESS_RESSISTANCE = 21;
-	public static final int FORTRESS_OF_DEAD = 64;
 	public static final int RAINBOW_SPRINGS = 62;
+	public static final int BEAST_FARM = 63;
+	public static final int FORTRESS_OF_DEAD = 64;
 	
 	protected final Logger _log;
 	
@@ -87,12 +89,8 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
 	
 	//XXX Load methods -------------------------------
 	
-	private final void loadAttackers()
+	public void loadAttackers()
 	{
-		// XXX
-		if(_hall.getId() == 63)
-			return;;
-		
 		Connection con = null;
 		try
 		{
@@ -345,11 +343,8 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
 		
 		_hall.banishForeigners();
 		_hall.spawnDoor();
-		if(_hall.getId() != BANDIT_STRONGHOLD)
-		{
-			loadGuards();
-			spawnSiegeGuards();
-		}
+		loadGuards();
+		spawnSiegeGuards();
 		_hall.updateSiegeZone(true);
 		
 		final byte state = 1;
@@ -434,8 +429,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
 		_log.config("Siege of "+_hall.getName()+" scheduled for: "+_hall.getSiegeDate().getTime());
 		
 		_hall.updateSiegeStatus(SiegeStatus.REGISTERING);
-		if(_hall.getId() != BANDIT_STRONGHOLD)
-			unSpawnSiegeGuards();
+		unSpawnSiegeGuards();
 	}
 	
 	@Override
@@ -492,10 +486,25 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
 	}
 	
 	// XXX Siege task and abstract methods -------------------
+	public Location getInnerSpawnLoc(L2PcInstance player)
+	{
+		return null;
+	}
+	
+	public boolean canPlantFlag()
+	{
+		return true;
+	}
+		
+	public void onSiegeStarts() 
+	{
+	}
+	
+	public void onSiegeEnds()
+	{
+	}
 	
-	public abstract L2Clan getWinner(); 
-	public void onSiegeStarts() {}
-	public void onSiegeEnds()  {}
+	public abstract L2Clan getWinner();
 	
 	public class PrepareOwner implements Runnable
 	{

+ 74 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java

@@ -0,0 +1,74 @@
+/*
+ * 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 com.l2jserver.gameserver.model.zone.type;
+
+import java.util.concurrent.ScheduledFuture;
+
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.model.Location;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * @author BiggBoss
+ * Teleport residence zone for clan hall sieges
+ */
+public class L2ResidenceHallTeleportZone extends L2ResidenceTeleportZone
+{
+	private int _id;
+	private ScheduledFuture<?> _teleTask;
+	
+	/**
+	 * @param id
+	 */
+	public L2ResidenceHallTeleportZone(int id)
+	{
+		super(id);
+	}
+	
+	@Override
+	public void setParameter(String name, String value)
+	{
+		if (name.equals("residenceZoneId"))
+			_id = Integer.parseInt(value);
+		else
+			super.setParameter(name, value);
+	}
+	
+	public int getResidenceZoneId()
+	{
+		return _id;
+	}
+	
+	public synchronized void checkTeleporTask()
+	{
+		if(_teleTask == null || _teleTask.isDone())
+			_teleTask = ThreadPoolManager.getInstance().scheduleGeneral(new TeleportTask(), 30000);
+	}
+	
+	class TeleportTask implements Runnable
+	{
+		@Override
+		public void run()
+		{
+			final Location loc = getSpawns().get(0);
+			if(loc == null)
+				throw new NullPointerException();
+			
+			for(L2PcInstance pc : getAllPlayers())
+				if(pc != null)
+					pc.teleToLocation(loc, 0);
+		}
+	}
+}

+ 4 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestRestartPoint.java

@@ -159,6 +159,10 @@ public final class RequestRestartPoint extends L2GameClientPacket
 						siegeClan = hall.getSiege().getAttackerClan(activeChar.getClan());
 					if ((siegeClan == null || siegeClan.getFlag().isEmpty()) && flag == null)
 					{
+						// Check if clan hall has inner spawns loc
+						if(hall != null && (loc = hall.getSiege().getInnerSpawnLoc(activeChar)) != null)
+							break;
+						
 						_log.warning("Player ["+activeChar.getName()+"] called RestartPointPacket - To Siege HQ and he doesn't have Siege HQ!");
 						return;
 					}

+ 2 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/skills/l2skills/L2SkillSiegeFlag.java

@@ -241,6 +241,8 @@ public class L2SkillSiegeFlag extends L2Skill
 			text = "You have already placed the maximum number of flags possible.";
 		else if (!player.isInsideZone(L2Character.ZONE_HQ))
 			player.sendPacket(SystemMessageId.NOT_SET_UP_BASE_HERE);
+		else if(!hall.getSiege().canPlantFlag())
+			text = "You cannot place a flag on this siege.";
 		else
 			return true;