Jump to content
  • 0

FinalEmperialTomb Interlude { aCis }


Question

Posted

I am creating Frintezza for aCis but I came across something really does FinalEmperialTomb exist in the interlude? Because I created it based on research and I didn't find anything about Interlude, I just found about High Five. A part of my code, yes it is working perfectly I would like to know more about FinalEmperialTomb because I don't want to waste time on it.

 

package net.sf.l2j.gameserver.scripting.script.ai.area;

import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import net.sf.l2j.commons.random.Rnd;

import net.sf.l2j.gameserver.data.manager.GrandBossManager;
import net.sf.l2j.gameserver.data.manager.ZoneManager;
import net.sf.l2j.gameserver.data.xml.DoorData;
import net.sf.l2j.gameserver.data.xml.ScriptData;
import net.sf.l2j.gameserver.enums.SayType;
import net.sf.l2j.gameserver.enums.ScriptEventType;
import net.sf.l2j.gameserver.model.actor.Creature;
import net.sf.l2j.gameserver.model.actor.Npc;
import net.sf.l2j.gameserver.model.actor.Player;
import net.sf.l2j.gameserver.model.location.Location;
import net.sf.l2j.gameserver.model.zone.type.BossZone;
import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
import net.sf.l2j.gameserver.scripting.script.ai.AttackableAIScript;
import net.sf.l2j.gameserver.scripting.script.ai.boss.Frintezza;

public class FinalEmperialTomb extends AttackableAIScript
{
	private static final BossZone ZONE = ZoneManager.getInstance().getZoneById(110012, BossZone.class);
	
	private static final int[][] MOBLOC =
	{
		{ 18328,172894,-76019,-5107,243 },
		{ 18328,174095,-77279,-5107,16216 },
		{ 18328,174111,-74833,-5107,49043 },
		{ 18328,175344,-76042,-5107,32847 },
		{ 18330,173489,-76227,-5134,63565 },
		{ 18330,173498,-75724,-5107,58498 },
		{ 18330,174365,-76745,-5107,22424 },
		{ 18330,174570,-75584,-5107,31968 },
		{ 18330,174613,-76179,-5107,31471 },
		{ 18332,173620,-75981,-5107,4588 },
		{ 18332,173630,-76340,-5107,62454 },
		{ 18332,173755,-75613,-5107,57892 },
		{ 18332,173823,-76688,-5107,2411 },
		{ 18332,174000,-75411,-5107,54718 },
		{ 18332,174487,-75555,-5107,33861 },
		{ 18332,174517,-76471,-5107,21893 },
		{ 18332,174576,-76122,-5107,31176 },
		{ 18332,174600,-75841,-5134,35927 },
		{ 18329,173481,-76043,-5107,61312 },
		{ 18329,173539,-75678,-5107,59524 },
		{ 18329,173584,-76386,-5107,3041 },
		{ 18329,173773,-75420,-5107,51115 },
		{ 18329,173777,-76650,-5107,12588 },
		{ 18329,174585,-76510,-5107,21704 },
		{ 18329,174623,-75571,-5107,40141 },
		{ 18329,174744,-76240,-5107,29202 },
		{ 18329,174769,-75895,-5107,29572 },
		{ 18333,173861,-76011,-5107,383 },
		{ 18333,173872,-76461,-5107,8041 },
		{ 18333,173898,-75668,-5107,51856 },
		{ 18333,174422,-75689,-5107,42878 },
		{ 18333,174460,-76355,-5107,27311 },
		{ 18333,174483,-76041,-5107,30947 },
		{ 18331,173515,-76184,-5107,6971 },
		{ 18331,173516,-75790,-5134,3142 },
		{ 18331,173696,-76675,-5107,6757 },
		{ 18331,173766,-75502,-5134,60827 },
		{ 18331,174473,-75321,-5107,37147 },
		{ 18331,174493,-76505,-5107,34503 },
		{ 18331,174568,-75654,-5134,41661 },
		{ 18331,174584,-76263,-5107,31729 },
		{ 18339,173892,-81592,-5123,50849 },
		{ 18339,173958,-81820,-5123,7459 },
		{ 18339,174128,-81805,-5150,21495 },
		{ 18339,174245,-81566,-5123,41760 },
		{ 18334,173264,-81529,-5072,1646 },
		{ 18334,173265,-81656,-5072,441 },
		{ 18334,173267,-81889,-5072,0 },
		{ 18334,173271,-82015,-5072,65382 },
		{ 18334,174867,-81655,-5073,32537 },
		{ 18334,174868,-81890,-5073,32768 },
		{ 18334,174869,-81485,-5073,32315 },
		{ 18334,174871,-82017,-5073,33007 },
		{ 18335,173074,-80817,-5107,8353 },
		{ 18335,173128,-82702,-5107,5345 },
		{ 18335,173181,-82544,-5107,65135 },
		{ 18335,173191,-80981,-5107,6947 },
		{ 18335,174859,-80889,-5134,24103 },
		{ 18335,174924,-82666,-5107,38710 },
		{ 18335,174947,-80733,-5107,22449 },
		{ 18335,175096,-82724,-5107,42205 },
		{ 18336,173435,-80512,-5107,65215 },
		{ 18336,173440,-82948,-5107,417 },
		{ 18336,173443,-83120,-5107,1094 },
		{ 18336,173463,-83064,-5107,286 },
		{ 18336,173465,-80453,-5107,174 },
		{ 18336,173465,-83006,-5107,2604 },
		{ 18336,173468,-82889,-5107,316 },
		{ 18336,173469,-80570,-5107,65353 },
		{ 18336,173469,-80628,-5107,166 },
		{ 18336,173492,-83121,-5107,394 },
		{ 18336,173493,-80683,-5107,0 },
		{ 18336,173497,-80510,-5134,417 },
		{ 18336,173499,-82947,-5107,0 },
		{ 18336,173521,-83063,-5107,316 },
		{ 18336,173523,-82889,-5107,128 },
		{ 18336,173524,-80627,-5134,65027 },
		{ 18336,173524,-83007,-5107,0 },
		{ 18336,173526,-80452,-5107,64735 },
		{ 18336,173527,-80569,-5134,65062 },
		{ 18336,174602,-83122,-5107,33104 },
		{ 18336,174604,-82949,-5107,33184 },
		{ 18336,174609,-80514,-5107,33234 },
		{ 18336,174609,-80684,-5107,32851 },
		{ 18336,174629,-80627,-5107,33346 },
		{ 18336,174632,-80570,-5107,32896 },
		{ 18336,174632,-83066,-5107,32768 },
		{ 18336,174635,-82893,-5107,33594 },
		{ 18336,174636,-80456,-5107,32065 },
		{ 18336,174639,-83008,-5107,33057 },
		{ 18336,174660,-80512,-5107,33057 },
		{ 18336,174661,-83121,-5107,32768 },
		{ 18336,174663,-82948,-5107,32768 },
		{ 18336,174664,-80685,-5107,32676 },
		{ 18336,174687,-83008,-5107,32520 },
		{ 18336,174691,-83066,-5107,32961 },
		{ 18336,174692,-80455,-5107,33202 },
		{ 18336,174692,-80571,-5107,32768 },
		{ 18336,174693,-80630,-5107,32994 },
		{ 18336,174693,-82889,-5107,32622 },
		{ 18337,172837,-82382,-5107,58363 },
		{ 18337,172867,-81123,-5107,64055 },
		{ 18337,172883,-82495,-5107,64764 },
		{ 18337,172916,-81033,-5107,7099 },
		{ 18337,172940,-82325,-5107,58998 },
		{ 18337,172946,-82435,-5107,58038 },
		{ 18337,172971,-81198,-5107,14768 },
		{ 18337,172992,-81091,-5107,9438 },
		{ 18337,173032,-82365,-5107,59041 },
		{ 18337,173064,-81125,-5107,5827 },
		{ 18337,175014,-81173,-5107,26398 },
		{ 18337,175061,-82374,-5107,43290 },
		{ 18337,175096,-81080,-5107,24719 },
		{ 18337,175169,-82453,-5107,37672 },
		{ 18337,175172,-80972,-5107,32315 },
		{ 18337,175174,-82328,-5107,41760 },
		{ 18337,175197,-81157,-5107,27617 },
		{ 18337,175245,-82547,-5107,40275 },
		{ 18337,175249,-81075,-5107,28435 },
		{ 18337,175292,-82432,-5107,42225 },
		{ 18338,173014,-82628,-5107,11874 },
		{ 18338,173033,-80920,-5107,10425 },
		{ 18338,173095,-82520,-5107,49152 },
		{ 18338,173115,-80986,-5107,9611 },
		{ 18338,173144,-80894,-5107,5345 },
		{ 18338,173147,-82602,-5107,51316 },
		{ 18338,174912,-80825,-5107,24270 },
		{ 18338,174935,-80899,-5107,18061 },
		{ 18338,175016,-82697,-5107,39533 },
		{ 18338,175041,-80834,-5107,25420 },
		{ 18338,175071,-82549,-5107,39163 },
		{ 18338,175154,-82619,-5107,36345 }
	};

	private static final int[] NPCS =
	{
		18328, 18329, 18330, 18331, 18332, 18333, 18334, 18335, 18336, 18337, 18338, 18339, 29048, 29049, 29050, 29051, 32011
	};

	private static final Location[] FRINTEZZA_IN =
	{
		new Location(174102, -76039, -5105),
		new Location(173235, -76884, -5105),
		new Location(175003, -76933, -5105),
		new Location(174196, -76190, -5105),
		new Location(174013, -76120, -5105),
		new Location(173263, -75161, -5105)
	};
	
	private Set<Npc> _roomMobs = ConcurrentHashMap.newKeySet();
	private int _check;

	public FinalEmperialTomb()
	{
		super("ai/area");
	}
	
	@Override
	protected void registerNpcs()
	{
		addEventIds(NPCS, ScriptEventType.ON_TALK, ScriptEventType.ON_KILL);
	}
	
	@Override
	public String onTalk(Npc npc, Player player)
	{
		String htmltext = "";
		
		int status;
		switch (npc.getNpcId())
		{
			case 32011:
				
				if (player.getInventory().hasItems(8073))
				{
					status = GrandBossManager.getInstance().getBossStatus(Frintezza.FRINTEZZA);
					if (status == Frintezza.DORMANT)
					{
						GrandBossManager.getInstance().setBossStatus(Frintezza.FRINTEZZA, Frintezza.WAITING);
						startQuestTimer("close", null, null, 100);
						startQuestTimer("beginning", null, null, 5000);
						ScriptData.getInstance().getQuest("Frintezza").startQuestTimer("frintezza_despawn", null, null, 60000);

						// Take item from party leader.
						takeItems(player, 8784, 1);
						
						final BossZone zone = ZoneManager.getInstance().getZoneById(110012, BossZone.class);
						zone.allowPlayerEntry(player, 300);
						player.teleportTo(Rnd.get(FRINTEZZA_IN), 50);
					}
					else if (status == Frintezza.DEAD)
						htmltext = "<html><body>There is nothing beyond the Magic Force Field. Come back later.<br>(You may not enter because Frintezza is not inside the Imperial Tomb.)</body></html>";		
				}
				else
					htmltext = "<html><body>You dont have required item.</body></html>";
				
				break;
		}
		
		return htmltext;
	}
	
	@Override
	public String onTimer(String name, Npc npc, Player player)
	{
		if (name.equalsIgnoreCase("beginning"))
		{
			closeDoors();
			_check = 35;
			
			for (int i = 0; i <= 17; i++)
				_roomMobs.add(addSpawn(MOBLOC[i][0], MOBLOC[i][1], MOBLOC[i][2], MOBLOC[i][3], MOBLOC[i][4], false, 0, false));
			
			ZONE.broadcastPacket(new CreatureSay(SayType.SHOUT, "Hall Alarm Device", "Intruders! Sound the alarm!"));
			
			startQuestTimer("check", null, null, 60000);
			ScriptData.getInstance().getQuest("Frintezza").startQuestTimer("frintezza_despawn", null, null, 60000);
		}
		else if (name.equalsIgnoreCase("check"))
		{
			if (_check == 0)
			{
				ZONE.broadcastPacket(new CreatureSay(SayType.SHOUT, "Frintezza Gatekeeper", "Time limit exceeded, challenge failed!"));
				ZONE.oustAllPlayers();
				
				cancelQuestTimers("check");
				ScriptData.getInstance().getQuest("Frintezza").cancelQuestTimers("frintezza_despawn");
				
				deleteAllMobs();
				closeDoors();
				
				GrandBossManager.getInstance().setBossStatus(Frintezza.FRINTEZZA, Frintezza.DORMANT);
			}
			
			_check--;
			ZONE.broadcastPacket(new ExShowScreenMessage(_check + " minute(s) remaining.", 10000));
		}
		else if (name.equalsIgnoreCase("cleanMobs"))
			deleteAllMobs();
		else if (name.equalsIgnoreCase("close"))
			closeDoors();
		
		return super.onTimer(name, npc, player);
	}

	@Override
	public String onKill(Npc npc, Creature killer)
	{
		switch(npc.getNpcId())
		{
			case 18328:
				int alarmsRemaining = getRemainingMonsters(npc);
				if (alarmsRemaining == 1)
				{
					for (int i = 25150051; i <= 25150058; i++)
						openDoor(i);
				}
				else if (alarmsRemaining == 0)
				{
					ZONE.broadcastPacket(new CreatureSay(npc.getObjectId(), SayType.SHOUT, npc.getName(), "De-activate the alarm."));
					deleteAllMobs();
					Spawn(1);
				}
				break;
			case 18339:
				if (getRemainingMonsters(npc) == 0)
					Spawn(2);
				break;
			case 18334:
				if (getRemainingMonsters(npc) == 0)
				{
					deleteAllMobs();
					openDoor(25150045);
					openDoor(25150046);
					cancelQuestTimers("check");
					startQuestTimer("waiting", null, null, 180000);
				}
				break;	                        
		}
		
		return super.onKill(npc, killer);
	}

	private void Spawn(int spawn)
	{
		if (spawn == 1)
		{
			for (int i = 41; i <= 44; i++)
				_roomMobs.add(addSpawn(MOBLOC[i][0], MOBLOC[i][1], MOBLOC[i][2], MOBLOC[i][3], MOBLOC[i][4], false, 0, false));
			
			for (int i = 25150051; i <= 25150058; i++)
				openDoor(i);
			
			openDoor(25150042);
			openDoor(25150043);
		}
		else
		{
			closeDoor(25150042);
			closeDoor(25150043);
			closeDoor(25150045);
			closeDoor(25150046);
			
			for (int i = 25150061; i <= 25150070; i++)
				openDoor(i);
			
			for (int i = 45; i <= 131; i++)
				_roomMobs.add(addSpawn(MOBLOC[i][0], MOBLOC[i][1], MOBLOC[i][2], MOBLOC[i][3], MOBLOC[i][4], false, 0, false));
		}
	}

	private static void closeDoors()
	{
		for (int i = 25150051; i <= 25150058; i++)
			closeDoor(i);
		
		for (int i = 25150061; i <= 25150070; i++)
			closeDoor(i);
		
		closeDoor(25150042);
		closeDoor(25150043);
		closeDoor(25150045);
		closeDoor(25150046);
	}
	
	private static void openDoor(int doorid)
	{
		DoorData.getInstance().getDoor(doorid).openMe();
	}
	
	private static void closeDoor(int doorid)
	{
		DoorData.getInstance().getDoor(doorid).closeMe();
	}

	private void deleteAllMobs()
	{
		for (Npc mob : _roomMobs)
			mob.deleteMe();
		
		for (Npc mob : ZONE.getKnownTypeInside(Npc.class))
			mob.deleteMe();
		
		_roomMobs.clear();
	}

	private int getRemainingMonsters(Npc npc)
	{
		_roomMobs.remove(npc);
		return  (int)_roomMobs.stream().filter(m -> m.getNpcId() == npc.getNpcId()).count();
	}
}

 

4 answers to this question

Recommended Posts

  • 0
Posted

Of coarse it existed on interlude. Its a C4 boss if i'm not mistaking. Of what I remember back in the days it was not instanced and can be fought once for the whole server until next respawn which is date+window.

 

  • 0
Posted
3 hours ago, Cherish said:

Of coarse it existed on interlude. Its a C4 boss if i'm not mistaking. Of what I remember back in the days it was not instanced and can be fought once for the whole server until next respawn which is date+window.

 

on c4 I think there is no Frintezza.

Guest
This topic is now closed to further replies.
×
×
  • Create New...