浏览代码

BETA: Missing spawn timer and minor code refactor in Gatekeeper Spirit AI.

Patch by: jurhciks
Reviewed by: Zoey76, UnAfraid
Zoey76 12 年之前
父节点
当前提交
d00622ce23

+ 22 - 41
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/Teleports/GatekeeperSpirit/GatekeeperSpirit.java

@@ -21,6 +21,7 @@ package ai.npc.Teleports.GatekeeperSpirit;
 import ai.npc.AbstractNpcAI;
 import ai.npc.AbstractNpcAI;
 
 
 import com.l2jserver.gameserver.SevenSigns;
 import com.l2jserver.gameserver.SevenSigns;
+import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 
 
@@ -31,17 +32,19 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 public class GatekeeperSpirit extends AbstractNpcAI
 public class GatekeeperSpirit extends AbstractNpcAI
 {
 {
 	// NPCs
 	// NPCs
-	private final static int GATEKEEPER_SPIRIT_ENTER = 31111;
-	private final static int GATEKEEPER_SPIRIT_EXIT = 31112;
-	private final static int LILITH = 25283;
-	private final static int ANAKIM = 25286;
+	private static final int GATEKEEPER_SPIRIT_ENTER = 31111;
+	private static final int GATEKEEPER_SPIRIT_EXIT = 31112;
+	private static final int LILITH = 25283;
+	private static final int ANAKIM = 25286;
+	// Exit gatekeeper spawn locations
+	private static final Location SPAWN_LILITH_GATEKEEPER = new Location(184410, -10111, -5488);
+	private static final Location SPAWN_ANAKIM_GATEKEEPER = new Location(184410, -13102, -5488);
 	
 	
 	private GatekeeperSpirit()
 	private GatekeeperSpirit()
 	{
 	{
 		super(GatekeeperSpirit.class.getSimpleName(), "ai/npc/Teleports");
 		super(GatekeeperSpirit.class.getSimpleName(), "ai/npc/Teleports");
 		addStartNpc(GATEKEEPER_SPIRIT_ENTER);
 		addStartNpc(GATEKEEPER_SPIRIT_ENTER);
 		addFirstTalkId(GATEKEEPER_SPIRIT_ENTER);
 		addFirstTalkId(GATEKEEPER_SPIRIT_ENTER);
-		addTalkId(GATEKEEPER_SPIRIT_ENTER);
 		addKillId(LILITH, ANAKIM);
 		addKillId(LILITH, ANAKIM);
 	}
 	}
 	
 	
@@ -49,55 +52,33 @@ public class GatekeeperSpirit extends AbstractNpcAI
 	public String onFirstTalk(L2Npc npc, L2PcInstance player)
 	public String onFirstTalk(L2Npc npc, L2PcInstance player)
 	{
 	{
 		int playerCabal = SevenSigns.getInstance().getPlayerCabal(player.getObjectId());
 		int playerCabal = SevenSigns.getInstance().getPlayerCabal(player.getObjectId());
-		int sealAvariceOwner = SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_AVARICE);
+		int sealOfAvariceOwner = SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_AVARICE);
 		int compWinner = SevenSigns.getInstance().getCabalHighestScore();
 		int compWinner = SevenSigns.getInstance().getCabalHighestScore();
 		
 		
-		if ((playerCabal == sealAvariceOwner) && (playerCabal == compWinner))
+		if ((playerCabal == sealOfAvariceOwner) && (playerCabal == compWinner) && (sealOfAvariceOwner != SevenSigns.CABAL_NULL))
 		{
 		{
-			switch (sealAvariceOwner)
-			{
-				case SevenSigns.CABAL_DAWN:
-				{
-					return "dawn.htm";
-				}
-				case SevenSigns.CABAL_DUSK:
-				{
-					return "dusk.htm";
-				}
-				case SevenSigns.CABAL_NULL:
-				{
-					npc.showChatWindow(player);
-					break;
-				}
-			}
-		}
-		else
-		{
-			npc.showChatWindow(player);
+			return (sealOfAvariceOwner == SevenSigns.CABAL_DUSK) ? "dusk.htm" : "dawn.htm";
 		}
 		}
+		
+		npc.showChatWindow(player);
 		return super.onFirstTalk(npc, player);
 		return super.onFirstTalk(npc, player);
 	}
 	}
 	
 	
 	@Override
 	@Override
-	/**
-	 * TODO: Should be spawned 10 seconds after boss dead
-	 */
 	public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
 	public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
 	{
 	{
-		int npcId = npc.getNpcId();
-		if (npcId == LILITH)
-		{
-			// exit_necropolis_boss_lilith
-			addSpawn(GATEKEEPER_SPIRIT_EXIT, 184410, -10111, -5488, 0, false, 900000);
-		}
-		else if (npcId == ANAKIM)
-		{
-			// exit_necropolis_boss_anakim
-			addSpawn(GATEKEEPER_SPIRIT_EXIT, 184410, -13102, -5488, 0, false, 900000);
-		}
+		startQuestTimer(Integer.toString(npc.getNpcId()), 10000, npc, killer);
 		return super.onKill(npc, killer, isSummon);
 		return super.onKill(npc, killer, isSummon);
 	}
 	}
 	
 	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		Location loc = (event.equals(Integer.toString(LILITH)) ? SPAWN_LILITH_GATEKEEPER : SPAWN_ANAKIM_GATEKEEPER);
+		addSpawn(GATEKEEPER_SPIRIT_EXIT, loc, false, 900000);
+		return super.onAdvEvent(event, npc, player);
+	}
+	
 	public static void main(String[] args)
 	public static void main(String[] args)
 	{
 	{
 		new GatekeeperSpirit();
 		new GatekeeperSpirit();