Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_DataPack_BETA
- Index: data/scripts/ai/individual/Frintezza.java
- ===================================================================
- --- data/scripts/ai/individual/Frintezza.java (revision 8223)
- +++ data/scripts/ai/individual/Frintezza.java (working copy)
- @@ -14,25 +14,29 @@
- */
- package ai.individual;
- +import java.util.Calendar;
- import java.util.List;
- +import java.util.logging.Level;
- +import java.util.logging.Logger;
- import javolution.util.FastList;
- import ai.group_template.L2AttackableAIScript;
- -import com.l2jserver.Config;
- import com.l2jserver.gameserver.ai.CtrlIntention;
- -import com.l2jserver.gameserver.datatables.DoorTable;
- import com.l2jserver.gameserver.datatables.SkillTable;
- import com.l2jserver.gameserver.instancemanager.GrandBossManager;
- +import com.l2jserver.gameserver.instancemanager.InstanceManager;
- import com.l2jserver.gameserver.model.L2CommandChannel;
- import com.l2jserver.gameserver.model.L2Party;
- import com.l2jserver.gameserver.model.L2Skill;
- import com.l2jserver.gameserver.model.actor.L2Attackable;
- import com.l2jserver.gameserver.model.actor.L2Character;
- import com.l2jserver.gameserver.model.actor.L2Npc;
- +import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
- import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
- import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.model.quest.*;
- import com.l2jserver.gameserver.model.zone.type.L2BossZone;
- import com.l2jserver.gameserver.network.SystemMessageId;
- import com.l2jserver.gameserver.network.serverpackets.AbstractNpcInfo.NpcInfo;
- @@ -45,7 +49,7 @@
- import com.l2jserver.gameserver.network.serverpackets.SpecialCamera;
- import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
- import com.l2jserver.gameserver.skills.AbnormalEffect;
- -import com.l2jserver.gameserver.templates.StatsSet;
- +import com.l2jserver.gameserver.util.Util;
- import com.l2jserver.util.Rnd;
- /**
- @@ -57,7 +61,8 @@
- *
- * Update by rocknow
- * Updated by L2jOff team
- - *
- + * Updated to use instances by horato
- + *
- * <BR>
- * Warn: be careful with adding new spawns {@link #getXFix(int)}
- *
- @@ -231,13 +236,16 @@
- private static final int GUIDE = 32011;
- private static final int CUBE = 29061;
- + private static final int INSTANCEID = 136; // Taken from instancenames.xml, I have no idea if it is right but I hope so :}}
- +
- //Frintezza Status Tracking :
- private static final byte DORMANT = 0; //Frintezza is spawned and no one has entered yet. Entry is unlocked
- private static final byte WAITING = 1; //Frintezza is spawend and someone has entered, triggering a 30 minute window for additional people to enter
- //before he unleashes his attack. Entry is unlocked
- private static final byte FIGHTING = 2; //Frintezza is engaged in battle, annihilating his foes. Entry is locked
- - private static final byte DEAD = 3; //Frintezza has been killed. Entry is locked
- + private static byte CurrentStatus = DORMANT;
- +
- private static long _LastAction = 0;
- private static int _Angle = 0;
- private static int _Heading = 0;
- @@ -258,6 +266,7 @@
- private static int _KillDarkChoirPlayer = 0;
- private static int _KillDarkChoirCaptain = 0;
- + private static QuestState st = null;
- private static L2BossZone _Zone;
- private L2GrandBossInstance frintezza, weakScarlet, strongScarlet, activeScarlet;
- private L2MonsterInstance demon1, demon2, demon3, demon4, portrait1, portrait2, portrait3, portrait4;
- @@ -267,6 +276,15 @@
- private static List<L2Npc> _Room2Mobs = new FastList<L2Npc>();
- private static List<L2Attackable> Minions = new FastList<L2Attackable>();
- + private static List<String> _TimerControl = new FastList<String>();
- + // Initialization at 6:30 am on Wednesday and Saturday
- + private static final int RESET_HOUR = 6;
- + private static final int RESET_MIN = 30;
- + private static final int RESET_DAY_1 = 4;
- + private static final int RESET_DAY_2 = 7;
- + private static int currentInstanceID = 0;
- + private final static Logger _log = Logger.getLogger("FrintezzaInstance");
- +
- // Boss: Frintezza
- public Frintezza(int id, String name, String descr)
- {
- @@ -278,22 +296,12 @@
- addTalkId(GUIDE);
- addStartNpc(CUBE);
- addTalkId(CUBE);
- - StatsSet info = GrandBossManager.getInstance().getStatsSet(FRINTEZZA);
- - int status = GrandBossManager.getInstance().getBossStatus(FRINTEZZA);
- - if (status == DEAD)
- - {
- - long temp = (info.getLong("respawn_time") - System.currentTimeMillis());
- - if (temp > 0)
- - startQuestTimer("frintezza_unlock", temp, null, null);
- - else
- - GrandBossManager.getInstance().setBossStatus(FRINTEZZA,DORMANT);
- - }
- - else if (status != DORMANT)
- - GrandBossManager.getInstance().setBossStatus(FRINTEZZA,DORMANT);
- -
- +
- + /*
- //tempfix for messed door cords
- for (int i = 0; i < 8; i++)
- - DoorTable.getInstance().getDoor(17130051+i).setRange(0, 0, 0, 0, 0, 0);
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130051 + i).setRange(0, 0, 0, 0, 0, 0);
- + */
- }
- @Override
- @@ -412,6 +420,8 @@
- }
- else if (event.equalsIgnoreCase("clean"))
- {
- + for(L2PcInstance temps : _PlayersInside)
- + temps.removeNotifyQuestOfDeath(st);
- _LastAction = 0;
- _LocCycle = 0;
- _CheckDie = 0;
- @@ -428,18 +438,26 @@
- else if (event.equalsIgnoreCase("close"))
- {
- for (int i = 17130051; i <= 17130058; i++)
- - DoorTable.getInstance().getDoor(i).closeMe();
- + {
- + L2DoorInstance door = InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i);
- + if(door != null)
- + door.closeMe();
- + }
- for (int i = 17130061; i <= 17130070; i++)
- - DoorTable.getInstance().getDoor(i).closeMe();
- -
- - DoorTable.getInstance().getDoor(17130042).closeMe();
- - DoorTable.getInstance().getDoor(17130043).closeMe();
- - DoorTable.getInstance().getDoor(17130045).closeMe();
- - DoorTable.getInstance().getDoor(17130046).closeMe();
- + {
- + L2DoorInstance door = InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i);
- + if(door != null)
- + door.closeMe();
- + }
- +
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).closeMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).closeMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).closeMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).closeMe();
- }
- else if (event.equalsIgnoreCase("loc_check"))
- {
- - if (GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
- + if (CurrentStatus == FIGHTING)
- {
- if (!_Zone.isInsideZone(npc))
- npc.teleToLocation(getXFix(174232),getYFix(-88020),getZFix(-5116));
- @@ -449,7 +467,7 @@
- }
- else if (event.equalsIgnoreCase("camera_1"))
- {
- - GrandBossManager.getInstance().setBossStatus(FRINTEZZA,FIGHTING);
- + CurrentStatus = FIGHTING;
- _frintezzaDummy = addSpawn(29052,174240,-89805,-5022,16048,false,0);
- _frintezzaDummy.setIsInvul(true);
- @@ -491,7 +509,6 @@
- _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),300, 90, -10, 6500, 7000,0,0,1,0));
- frintezza = (L2GrandBossInstance) addSpawn(FRINTEZZA,174240,-89805,-5022,16048,false,0);
- - GrandBossManager.getInstance().addBoss(frintezza);
- frintezza.setIsImmobilized(true);
- frintezza.setIsInvul(true);
- frintezza.disableAllSkills();
- @@ -1158,6 +1175,8 @@
- else if (event.equalsIgnoreCase("room_final"))
- {
- _Zone.broadcastPacket(new NpcSay(npc.getObjectId(),1,npc.getNpcId(),"Exceeded his time limit, challenge failed!"));
- + for(L2PcInstance playerInsideTezza : _PlayersInside)
- + playerInsideTezza.setInstanceId(0);
- _Zone.oustAllPlayers();
- cancelQuestTimers("waiting");
- @@ -1166,16 +1185,54 @@
- startQuestTimer("close", 1000, npc, null);
- startQuestTimer("room1_del", 1000, npc, null);
- startQuestTimer("room2_del", 1000, npc, null);
- -
- - GrandBossManager.getInstance().setBossStatus(FRINTEZZA,DORMANT);
- + startQuestTimer("destroy_instance", 30000, npc, null);
- }
- + else if (event.equalsIgnoreCase("all_dead_frintezza_despawn"))
- + {
- + temp = (System.currentTimeMillis() - _LastAction);
- + if (temp > 30000)
- + {
- + //Maybe they ressed?
- + for(L2PcInstance temps : _PlayersInside)
- + {
- + if(!temps.isDead())
- + {
- + _log.log(Level.INFO, "Frintezza Manager: Someone is still alive, cancelling instance deletion.");
- + cancelQuestTimers("all_dead_frintezza_despawn");
- + return "";
- + }
- + }
- + for(L2PcInstance playerInsideTezza : _PlayersInside)
- + playerInsideTezza.setInstanceId(0);
- +
- + _Zone.oustAllPlayers();
- + cancelQuestTimers("all_dead_frintezza_despawn");
- + cancelQuestTimers("waiting");
- + cancelQuestTimers("loc_check");
- + cancelQuestTimers("room_final");
- + cancelQuestTimers("spawn_minion");
- + startQuestTimer("clean", 1000, npc, null);
- + startQuestTimer("close", 1000, npc, null);
- + startQuestTimer("attack_stop", 1000, npc, null);
- + startQuestTimer("room1_del", 1000, npc, null);
- + startQuestTimer("room2_del", 1000, npc, null);
- + startQuestTimer("room3_del", 1000, npc, null);
- + startQuestTimer("minions_despawn", 1000, npc, null);
- + startQuestTimer("destroy_instance", 30000, npc, null);
- +
- + }
- + }
- else if (event.equalsIgnoreCase("frintezza_despawn"))
- {
- temp = (System.currentTimeMillis() - _LastAction);
- if (temp > 900000)
- {
- + for(L2PcInstance playerInsideTezza : _PlayersInside)
- + playerInsideTezza.setInstanceId(0);
- +
- _Zone.oustAllPlayers();
- + cancelQuestTimers("frintezza_despawn");
- cancelQuestTimers("waiting");
- cancelQuestTimers("loc_check");
- cancelQuestTimers("room_final");
- @@ -1187,10 +1244,7 @@
- startQuestTimer("room2_del", 1000, npc, null);
- startQuestTimer("room3_del", 1000, npc, null);
- startQuestTimer("minions_despawn", 1000, npc, null);
- -
- - GrandBossManager.getInstance().setBossStatus(FRINTEZZA,DORMANT);
- -
- - cancelQuestTimers("frintezza_despawn");
- + startQuestTimer("destroy_instance", 30000, npc, null);
- }
- }
- else if (event.equalsIgnoreCase("minions_despawn"))
- @@ -1208,24 +1262,38 @@
- if (npc != null && !npc.isDead() && frintezza != null && !frintezza.isDead())
- {
- L2Attackable mob = (L2Attackable)addSpawn(npc.getNpcId()+2,npc.getX(),npc.getY(),npc.getZ(),npc.getHeading(),false,0);
- - mob.setIsRaidMinion(true);
- - Minions.add(mob);
- -
- - startQuestTimer("action", 200, mob, null);
- - startQuestTimer("spawn_minion", 18000, npc, null);
- + if(mob != null)
- + {
- + mob.setIsRaidMinion(true);
- + Minions.add(mob);
- +
- + startQuestTimer("action", 200, mob, null);
- + startQuestTimer("spawn_minion", 18000, npc, null);
- + }
- }
- }
- else if (event.equalsIgnoreCase("spawn_cubes"))
- {
- addSpawn(CUBE,174232,-88020,-5114,16384,false,900000);
- + startQuestTimer("frintezza_despawn", 60000, null, null, true);
- }
- - else if (event.equalsIgnoreCase("frintezza_unlock"))
- - {
- - GrandBossManager.getInstance().setBossStatus(FRINTEZZA,DORMANT);
- - }
- else if (event.equalsIgnoreCase("remove_players"))
- {
- + for(L2PcInstance playerInsideTezza : _PlayersInside)
- + playerInsideTezza.setInstanceId(0);
- _Zone.oustAllPlayers();
- +
- + }else if (event.equalsIgnoreCase("destroy_instance"))
- + {
- + InstanceManager.getInstance().destroyInstance(currentInstanceID);
- +
- + for(String timer : _TimerControl)
- + if(timer != null)
- + cancelQuestTimers(timer);
- + _TimerControl.clear();
- +
- + _log.log(Level.INFO, "Frintezza Manager: Frintezza's instance is opened.");
- + CurrentStatus = DORMANT;
- }
- return super.onAdvEvent(event, npc, player);
- @@ -1238,80 +1306,105 @@
- {
- int x = 150037 + Rnd.get(500);
- int y = -57720 + Rnd.get(500);
- + player.setInstanceId(0);
- player.teleToLocation(x, y, -2976);
- + _PlayersInside.remove(player);
- +
- + if(_PlayersInside.isEmpty())
- + startQuestTimer("destroy_instance", 30000, npc, null);
- +
- return null;
- }
- - String htmltext = "";
- - synchronized(this) //Synch to prevent 2 command channels entering at once
- + if(CurrentStatus != DORMANT)
- + return "<html><body>Someone is already inside instance. Try again later.</body></html>";
- +
- + st = player.getQuestState(getName());
- +
- + if (player.getParty() == null || player.getParty().getCommandChannel() == null || player.getParty().getCommandChannel().getChannelLeader() != player)
- + return "<html><body>I speak only with command channel leader.</body></html>";
- +
- + if (player.getParty().getCommandChannel().getMemberCount() < 36 || player.getParty().getCommandChannel().getMemberCount() > 45)
- + return "<html><body>Your command channel have incorrect size. You need between 36 and 45 players.</body></html>";
- +
- + if (player.getInventory().getItemByItemId(8073) == null)
- + return "<html><body>You dont have required item.</body></html>";
- +
- + L2CommandChannel CC = player.getParty().getCommandChannel();
- + for (L2Party _party : CC.getPartys())
- {
- - if (GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == DEAD)
- + if (_party == null)
- + continue;
- + for (L2PcInstance _member : _party.getPartyMembers())
- {
- - 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 if (GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == DORMANT)
- - {
- - if ((!player.isInParty() || !player.getParty().isLeader(player))
- - || (player.getParty().getCommandChannel() == null)
- - || (player.getParty().getCommandChannel().getChannelLeader() != player))
- + if (_member == null)
- + continue;
- +
- + if (_member.getLevel() < 80)
- + return "<html><body>Player " + _member.getName() + " have too low level. Minimum level required is 80.</body></html>";
- + if (!Util.checkIfInRange(1000, player, _member, false))
- + return "<html><body>" + _member.getName() + " is not near NPC.</body></html>";
- +
- + Long reentertime = InstanceManager.getInstance().getInstanceTime(_member.getObjectId(), INSTANCEID);
- + if (System.currentTimeMillis() < reentertime)
- {
- - htmltext = "<html><body>No reaction. Contact must be initiated by the Command Channel Leader.</body></html>";
- + return "<html><body>" + _member.getName() + " may not reenter yet.</body></html>";
- }
- - else if (player.getParty().getCommandChannel().getPartys().size() < 4 || player.getParty().getCommandChannel().getPartys().size() > 5)
- - {
- - htmltext = "<html><body>Your command channel needs to have at least 4 parties and a maximum of 5.</body></html>";
- - }
- - else if (player.getInventory().getItemByItemId(8073) == null)
- - {
- - htmltext = "<html><body>You dont have required item.</body></html>";
- - }
- - else
- - {
- - player.destroyItemByItemId("Quest", 8073, 1, player, true);
- - L2CommandChannel CC = player.getParty().getCommandChannel();
- - GrandBossManager.getInstance().setBossStatus(FRINTEZZA, WAITING);
- -
- - startQuestTimer("close", 0, npc, null);
- - startQuestTimer("room1_spawn", 5000, npc, null);
- - startQuestTimer("room_final", 2100000, npc, null);
- - startQuestTimer("frintezza_despawn", 60000, npc, null, true);
- -
- - _LastAction = System.currentTimeMillis();
- - for (L2Party party : CC.getPartys())
- - {
- - if (party == null)
- - continue;
- - for (L2PcInstance member : party.getPartyMembers())
- - {
- - if (member == null || member.getLevel() < 74)
- - continue;
- - if (!member.isInsideRadius(npc, 700, false, false))
- - continue;
- - if (_PlayersInside.size() > 45)
- - {
- - member.sendMessage("The number of challenges have been full, so can not enter.");
- - break;
- - }
- - _PlayersInside.add(member);
- - _Zone.allowPlayerEntry(member, 300);
- - member.teleToLocation(getXFix(_invadeLoc[_LocCycle][0]) + Rnd.get(50), getYFix(_invadeLoc[_LocCycle][1]) + Rnd.get(50), getZFix(_invadeLoc[_LocCycle][2]));
- - }
- - if (_PlayersInside.size() > 45)
- - break;
- -
- - _LocCycle++;
- - if (_LocCycle >= 6)
- - _LocCycle = 1;
- - }
- - }
- +
- }
- - else
- - htmltext = "<html><body>Someone else is already inside the Magic Force Field. Try again later.</body></html>";
- }
- -
- - return htmltext;
- + ClearVariables();
- + currentInstanceID = InstanceManager.getInstance().createDynamicInstance("Frintezza.xml");
- +
- + player.destroyItemByItemId("Quest", 8073, 1, player, true);
- + CurrentStatus = WAITING;
- +
- + startQuestTimer("close", 0, npc, null);
- + startQuestTimer("room1_spawn", 5000, npc, null);
- + startQuestTimer("room_final", 2100000, npc, null);
- + startQuestTimer("frintezza_despawn", 60000, npc, null, true);
- +
- + _LastAction = System.currentTimeMillis();
- + for (L2Party party : CC.getPartys())
- + {
- + if (party == null)
- + continue;
- + for (L2PcInstance member : party.getPartyMembers())
- + {
- + _PlayersInside.add(member);
- + _Zone.allowPlayerEntry(member, 300);
- + member.addNotifyQuestOfDeath(st);
- + member.setInstanceId(currentInstanceID);
- + member.teleToLocation(getXFix(_invadeLoc[_LocCycle][0]) + Rnd.get(50), getYFix(_invadeLoc[_LocCycle][1]) + Rnd.get(50), getZFix(_invadeLoc[_LocCycle][2]));
- + }
- + _LocCycle++;
- + if (_LocCycle >= 6)
- + _LocCycle = 1;
- + }
- +
- + setInstanceTimeRestrictions();
- + _log.log(Level.INFO, "Frintezza Manager: Frintezza's instance with ID "+currentInstanceID+" has been created by player "+player.getName());
- + return "";
- }
- + private void ClearVariables()
- + {
- + _PlayersInside.clear();
- + _TimerControl.clear();
- + _KillHallAlarmDevice = 0;
- + _KillDarkChoirPlayer = 0;
- + _KillDarkChoirCaptain = 0;
- + currentInstanceID = 0;
- + _LastAction = 0;
- + _LocCycle = 0;
- + _CheckDie = 0;
- + _OnCheck = 0;
- + _Abnormal = 0;
- + _OnMorph = 0;
- + _SecondMorph = 0;
- + _ThirdMorph = 0;
- + }
- +
- @Override
- public String onAttack (L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
- {
- @@ -1321,7 +1414,7 @@
- npc.setCurrentHpMp(npc.getMaxHp(), 0);
- return null;
- }
- - if (npc.getNpcId() == SCARLET1 && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.75 && GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
- + if (npc.getNpcId() == SCARLET1 && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.75 && CurrentStatus == FIGHTING)
- {
- startQuestTimer("attack_stop", 0, frintezza, null);
- @@ -1332,7 +1425,7 @@
- startQuestTimer("stop_npc", 1000, npc, null);
- startQuestTimer("morph_01", 1100, npc, null);
- }
- - else if (npc.getNpcId() == SCARLET1 && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.5 && GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
- + else if (npc.getNpcId() == SCARLET1 && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.5 && CurrentStatus == FIGHTING)
- {
- startQuestTimer("attack_stop", 0, frintezza, null);
- @@ -1344,7 +1437,7 @@
- startQuestTimer("morph_05a", 2000, npc, null);
- startQuestTimer("morph_05", 2100, npc, null);
- }
- - else if (npc.getNpcId() == SCARLET2 && _SecondMorph == 1 && _ThirdMorph == 1 && _OnCheck == 0 && damage >= npc.getCurrentHp() && GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
- + else if (npc.getNpcId() == SCARLET2 && _SecondMorph == 1 && _ThirdMorph == 1 && _OnCheck == 0 && damage >= npc.getCurrentHp() && CurrentStatus == FIGHTING)
- {
- _OnCheck = 1;
- startQuestTimer("check_hp", 0, npc, null);
- @@ -1378,14 +1471,14 @@
- {
- return null;
- }
- - else if (npc.getNpcId() == SCARLET2 && _OnCheck == 0 && GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
- + else if (npc.getNpcId() == SCARLET2 && _OnCheck == 0 && CurrentStatus == FIGHTING)
- {
- _OnCheck = 1;
- startQuestTimer("stop_pc", 0, npc, null);
- startQuestTimer("stop_npc", 0, npc, null);
- startQuestTimer("morph_16", 0, npc, null);
- }
- - else if (npc.getNpcId() == SCARLET2 && _OnCheck == 1 && GrandBossManager.getInstance().getBossStatus(FRINTEZZA) == FIGHTING)
- + else if (npc.getNpcId() == SCARLET2 && _OnCheck == 1 && CurrentStatus == FIGHTING)
- {
- cancelQuestTimers("loc_check");
- cancelQuestTimers("spawn_minion");
- @@ -1395,14 +1488,7 @@
- startQuestTimer("room3_del", 60000, npc, null);
- startQuestTimer("minions_despawn", 60000, npc, null);
- startQuestTimer("remove_players", 900000, npc, null);
- -
- - GrandBossManager.getInstance().setBossStatus(FRINTEZZA,DEAD);
- - long respawnTime = (long)Config.Interval_Of_Frintezza_Spawn + Rnd.get(Config.Random_Of_Frintezza_Spawn);
- - startQuestTimer("frintezza_unlock", respawnTime, npc, null);
- - // also save the respawn time so that the info is maintained past reboots
- - StatsSet info = GrandBossManager.getInstance().getStatsSet(FRINTEZZA);
- - info.set("respawn_time", System.currentTimeMillis() + respawnTime);
- - GrandBossManager.getInstance().setStatsSet(FRINTEZZA,info);
- + startQuestTimer("destroy_instance", 900001, npc, null);
- }
- else if (npc.getNpcId() == 18328)
- {
- @@ -1411,13 +1497,13 @@
- {
- startQuestTimer("room1_del", 100, npc, null);
- startQuestTimer("room2_spawn", 100, npc, null);
- -
- - DoorTable.getInstance().getDoor(17130042).openMe();
- - DoorTable.getInstance().getDoor(17130043).openMe();
- - // DoorTable.getInstance().getDoor(17130045).openMe();
- - // DoorTable.getInstance().getDoor(17130046).openMe();
- +
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).openMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).openMe();
- + // InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).openMe();
- + // InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).openMe();
- for (int i = 17130051; i <= 17130058; i++)
- - DoorTable.getInstance().getDoor(i).openMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i).openMe();
- }
- }
- else if (npc.getNpcId() == 18339)
- @@ -1425,10 +1511,10 @@
- _KillDarkChoirPlayer ++;
- if (_KillDarkChoirPlayer == 2)
- {
- - DoorTable.getInstance().getDoor(17130042).closeMe();
- - DoorTable.getInstance().getDoor(17130043).closeMe();
- - DoorTable.getInstance().getDoor(17130045).closeMe();
- - DoorTable.getInstance().getDoor(17130046).closeMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).closeMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).closeMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).closeMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).closeMe();
- int outside = 0;
- for (L2PcInstance room2_pc : _PlayersInside)
- {
- @@ -1444,7 +1530,7 @@
- else
- {
- for (int i = 17130061; i <= 17130070; i++)
- - DoorTable.getInstance().getDoor(i).openMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i).openMe();
- startQuestTimer("room2_spawn2", 1000, npc, null);
- }
- @@ -1457,8 +1543,8 @@
- {
- startQuestTimer("room2_del", 100, npc, null);
- - DoorTable.getInstance().getDoor(17130045).openMe();
- - DoorTable.getInstance().getDoor(17130046).openMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).openMe();
- + InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).openMe();
- startQuestTimer("waiting", 180000, npc, null);
- cancelQuestTimers("room_final");
- @@ -1468,6 +1554,27 @@
- return super.onKill(npc,killer,isPet);
- }
- + @Override
- + public String onDeath(L2Character killer, L2Character victim, QuestState qs)
- + {
- + for(L2PcInstance player : _PlayersInside)
- + {
- + if(player.getInstanceId() != currentInstanceID)
- + {
- + player.removeNotifyQuestOfDeath(st);
- + _PlayersInside.remove(player);
- + continue;
- + }
- + if(!player.isDead())
- + return "";
- + }
- + _log.log(Level.INFO, "Frintezza Manager: Everyone inside Frintezza are dead. Closing instance in 30s.");
- + startQuestTimer("all_dead_frintezza_despawn", 1000, null, null, true);
- + return super.onDeath(killer, victim, qs);
- + }
- +
- +
- +
- /**
- * Override spawn method to correct spawn cords after lair move<BR>
- * TODO: Update cords in script, im just lazy :)
- @@ -1475,8 +1582,9 @@
- @Override
- public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn, int instanceId)
- {
- +
- // cords fix:
- - return super.addSpawn(npcId, getXFix(x), getYFix(y), getZFix(z), heading, randomOffset, despawnDelay, isSummonSpawn, instanceId);
- + return super.addSpawn(npcId, getXFix(x), getYFix(y), getZFix(z), heading, randomOffset, despawnDelay, isSummonSpawn, currentInstanceID);
- }
- @@ -1506,6 +1614,47 @@
- return z + 4065;
- }
- + protected void setInstanceTimeRestrictions()
- + {
- + Calendar reenter = Calendar.getInstance();
- + reenter.set(Calendar.MINUTE, RESET_MIN);
- + reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
- + // if time is >= RESET_HOUR - roll to the next day
- + if (reenter.getTimeInMillis() <= System.currentTimeMillis())
- + reenter.add(Calendar.DAY_OF_MONTH, 1);
- + if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1)
- + while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1)
- + reenter.add(Calendar.DAY_OF_MONTH, 1);
- + else
- + while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2)
- + reenter.add(Calendar.DAY_OF_MONTH, 1);
- +
- + // set instance reenter time for all allowed players
- + for (L2PcInstance playerInside : _PlayersInside)
- + InstanceManager.getInstance().setInstanceTime(playerInside.getObjectId(), INSTANCEID, reenter.getTimeInMillis());
- + }
- +
- + @Override
- + public void startQuestTimer(String name, long time, L2Npc npc, L2PcInstance player)
- + {
- + _TimerControl.add(name);
- + super.startQuestTimer(name, time, npc, player);
- + }
- +
- + @Override
- + public void startQuestTimer(String name, long time, L2Npc npc, L2PcInstance player, boolean repeating)
- + {
- + _TimerControl.add(name);
- + super.startQuestTimer(name, time, npc, player, repeating);
- + }
- +
- + @Override
- + public void cancelQuestTimers(String name)
- + {
- + _TimerControl.remove(name);
- + super.cancelQuestTimers(name);
- + }
- +
- public static void main(String[] args)
- {
- // now call the constructor (starts up the ai)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement