Basic Frintezza AI.

Thanks to Stayway for making the spawns.
This commit is contained in:
MobiusDev 2016-08-14 23:03:09 +00:00
parent 1ee94b614f
commit 44048e1026
5 changed files with 1399 additions and 61 deletions

View File

@ -1,7 +1,7 @@
<html><body>
I feel an invisible barrier... Some sort of Magic Force Field has been put in place...<br>
...? The guide of the Imperial mausoleum seems to have something to say.<br><br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest FinalEmperialTomb">Enter the Magic Force Field</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Quest LastImperialTomb">Enter the Magic Force Field</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Chat 1">Listen to Imperial Tomb Guide</Button>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h npc_%objectId%_Quest">Quest</Button>
</body></html>

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Last Imperial Tomb -->
<instance id="136" maxWorlds="5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/instance.xsd">
<time duration="120" empty="30" />
<locations>
<enter type="FIXED">
<location x="-88015" y="-141153" z="-9168" />
</enter>
<exit type="ORIGIN" />
</locations>
<conditions>
<condition type="Party" />
<condition type="CommandChannel" />
<condition type="CommandChannelLeader" />
<condition type="Item" onlyLeader="true">
<param name="id" value="8073" /> <!-- Scroll: Remove Frintezza's Magic Force Field -->
<param name="count" value="1" />
<param name="take" value="true" />
</condition>
<condition type="GroupMin">
<param name="limit" value="21" />
</condition>
<condition type="GroupMax">
<param name="limit" value="35" />
</condition>
<condition type="Level">
<param name="min" value="80" />
</condition>
<condition type="Distance" />
<condition type="Reenter" />
</conditions>
<reenter>
<reset day="WEDNESDAY" hour="6" minute="30" />
<reset day="SATURDAY" hour="6" minute="30" />
</reenter>
<doorlist>
<door id="17130045" />
<door id="17130051" />
<door id="17130046" />
<door id="17130043" />
<door id="17130042" />
<door id="17130052" />
<door id="17130053" />
<door id="17130054" />
<door id="17130055" />
<door id="17130056" />
<door id="17130057" />
<door id="17130058" />
<door id="17130061" />
<door id="17130062" />
<door id="17130063" />
<door id="17130064" />
<door id="17130065" />
<door id="17130066" />
<door id="17130067" />
<door id="17130068" />
<door id="17130069" />
<door id="17130070" />
</doorlist>
</instance>

View File

@ -0,0 +1,208 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Last Imperial Tomb -->
<instance id="136" maxWorlds="5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/instance.xsd">
<time duration="120" empty="30" />
<locations>
<enter type="FIXED">
<location x="-88015" y="-141153" z="-9168" />
</enter>
<exit type="ORIGIN" />
</locations>
<conditions>
<condition type="Party" />
<condition type="CommandChannel" />
<condition type="CommandChannelLeader" />
<condition type="Item" onlyLeader="true">
<param name="id" value="8073" /> <!-- Scroll: Remove Frintezza's Magic Force Field -->
<param name="count" value="1" />
<param name="take" value="true" />
</condition>
<condition type="GroupMin">
<param name="limit" value="21" />
</condition>
<condition type="GroupMax">
<param name="limit" value="35" />
</condition>
<condition type="Level">
<param name="min" value="80" />
</condition>
<condition type="Distance" />
<condition type="Reenter" />
</conditions>
<reenter>
<reset day="WEDNESDAY" hour="6" minute="30" />
<reset day="SATURDAY" hour="6" minute="30" />
</reenter>
<doorlist>
<door id="17130045" />
<door id="17130051" />
<door id="17130046" />
<door id="17130043" />
<door id="17130042" />
<door id="17130052" />
<door id="17130053" />
<door id="17130054" />
<door id="17130055" />
<door id="17130056" />
<door id="17130057" />
<door id="17130058" />
<door id="17130061" />
<door id="17130062" />
<door id="17130063" />
<door id="17130064" />
<door id="17130065" />
<door id="17130066" />
<door id="17130067" />
<door id="17130068" />
<door id="17130069" />
<door id="17130070" />
</doorlist>
<spawnlist>
<group>
<npc id="18328" x="-87904" y="-141296" z="-9168" heading="0" /> <!-- Hall Alarm -->
</group>
<group name="room1" spawnByDefault="false">
<npc id="18329" x="-87361" y="-142312" z="-9176" heading="43694" />
<npc id="18329" x="-86916" y="-142136" z="-9176" heading="47013" />
<npc id="18329" x="-87037" y="-142185" z="-9176" heading="36781" />
<npc id="18329" x="-86869" y="-141910" z="-9176" heading="33913" />
<npc id="18329" x="-86787" y="-141333" z="-9176" heading="49395" />
<npc id="18329" x="-86581" y="-141426" z="-9176" heading="61112" />
<npc id="18329" x="-86792" y="-141119" z="-9176" heading="36773" />
<npc id="18329" x="-86693" y="-141079" z="-9176" heading="52481" />
<npc id="18329" x="-87002" y="-140604" z="-9176" heading="52739" />
<npc id="18329" x="-87074" y="-140403" z="-9176" heading="62270" />
<npc id="18329" x="-87239" y="-140163" z="-9176" heading="62482" />
<npc id="18329" x="-87816" y="-140199" z="-9176" heading="61902" />
<npc id="18329" x="-87281" y="-140336" z="-9176" heading="46667" />
<npc id="18329" x="-87809" y="-140030" z="-9176" heading="15952" />
<npc id="18329" x="-88028" y="-140122" z="-9176" heading="58845" />
<npc id="18329" x="-88186" y="-140004" z="-9176" heading="6601" />
<npc id="18329" x="-88746" y="-140354" z="-9176" heading="40577" />
<npc id="18329" x="-88717" y="-140442" z="-9176" heading="2789" />
<npc id="18329" x="-88619" y="-140236" z="-9176" heading="46506" />
<npc id="18329" x="-88936" y="-140502" z="-9176" heading="39670" />
<npc id="18329" x="-89022" y="-141327" z="-9176" heading="40426" />
<npc id="18329" x="-89177" y="-141120" z="-9176" heading="31507" />
<npc id="18329" x="-89037" y="-141137" z="-9176" heading="8243" />
<npc id="18329" x="-89075" y="-141545" z="-9176" heading="9402" />
<npc id="18329" x="-89147" y="-141636" z="-9176" heading="16185" />
<npc id="18329" x="-88857" y="-141957" z="-9176" heading="14827" />
<npc id="18329" x="-88880" y="-142110" z="-9176" heading="16669" />
<npc id="18329" x="-88554" y="-142294" z="-9176" heading="21413" />
<npc id="18329" x="-88693" y="-142254" z="-9176" heading="29845" />
<npc id="18330" x="-87188" y="-142282" z="-9176" heading="31391" />
<npc id="18330" x="-86779" y="-142056" z="-9176" heading="57028" />
<npc id="18330" x="-87043" y="-142152" z="-9176" heading="38684" />
<npc id="18330" x="-87075" y="-142297" z="-9176" heading="46886" />
<npc id="18330" x="-86923" y="-141903" z="-9176" heading="8556" />
<npc id="18330" x="-86908" y="-142066" z="-9176" heading="33147" />
<npc id="18330" x="-86819" y="-141497" z="-9176" heading="34625" />
<npc id="18330" x="-86669" y="-141470" z="-9176" heading="43482" />
<npc id="18330" x="-86710" y="-141243" z="-9176" heading="57995" />
<npc id="18330" x="-86795" y="-141168" z="-9176" heading="45501" />
<npc id="18330" x="-86556" y="-141283" z="-9176" heading="62885" />
<npc id="18330" x="-86825" y="-140630" z="-9176" heading="60032" />
<npc id="18330" x="-87030" y="-140389" z="-9176" heading="48351" />
<npc id="18330" x="-87018" y="-140233" z="-9176" heading="58404" />
<npc id="18330" x="-87115" y="-140461" z="-9176" heading="40098" />
<npc id="18330" x="-87402" y="-140121" z="-9176" heading="1948" />
<npc id="18330" x="-87207" y="-140079" z="-9176" heading="2212" />
<npc id="18330" x="-87656" y="-140169" z="-9176" heading="52562" />
<npc id="18330" x="-87841" y="-139951" z="-9176" heading="5627" />
<npc id="18330" x="-88008" y="-140051" z="-9176" heading="8635" />
<npc id="18330" x="-88098" y="-140149" z="-9176" heading="57598" />
<npc id="18330" x="-88224" y="-140029" z="-9176" heading="6984" />
<npc id="18330" x="-88689" y="-140355" z="-9176" heading="6411" />
<npc id="18330" x="-88859" y="-140475" z="-9176" heading="19053" />
<npc id="18330" x="-88571" y="-140352" z="-9176" heading="265" />
<npc id="18330" x="-88814" y="-140647" z="-9176" heading="63312" />
<npc id="18330" x="-88911" y="-140626" z="-9176" heading="6711" />
<npc id="18330" x="-89039" y="-141498" z="-9176" heading="56937" />
<npc id="18330" x="-89205" y="-141444" z="-9176" heading="29487" />
<npc id="18330" x="-89199" y="-141325" z="-9176" heading="42737" />
<npc id="18330" x="-89110" y="-141199" z="-9176" heading="29210" />
<npc id="18330" x="-88914" y="-141931" z="-9176" heading="12620" />
<npc id="18330" x="-88827" y="-142052" z="-9176" heading="27582" />
<npc id="18330" x="-89004" y="-142155" z="-9176" heading="38265" />
<npc id="18330" x="-88665" y="-142492" z="-9176" heading="32599" />
<npc id="18330" x="-88609" y="-142397" z="-9176" heading="10828" />
<npc id="18330" x="-88698" y="-142122" z="-9176" heading="19648" />
<npc id="18331" x="-86964" y="-142079" z="-9176" heading="6621" />
<npc id="18331" x="-87260" y="-142297" z="-9176" heading="8297" />
<npc id="18331" x="-86704" y="-141451" z="-9176" heading="15742" />
<npc id="18331" x="-86707" y="-141175" z="-9176" heading="51507" />
<npc id="18331" x="-86836" y="-140566" z="-9176" heading="23410" />
<npc id="18331" x="-87025" y="-140438" z="-9176" heading="26558" />
<npc id="18331" x="-87743" y="-139994" z="-9176" heading="31747" />
<npc id="18331" x="-87919" y="-140013" z="-9176" heading="62621" />
<npc id="18331" x="-88533" y="-140389" z="-9168" heading="38980" />
<npc id="18331" x="-88668" y="-140355" z="-9176" heading="48943" />
<npc id="18331" x="-88847" y="-140437" z="-9176" heading="37248" />
<npc id="18331" x="-89094" y="-140991" z="-9176" heading="51142" />
<npc id="18331" x="-89214" y="-141196" z="-9176" heading="43628" />
<npc id="18331" x="-89167" y="-141458" z="-9176" heading="51003" />
<npc id="18331" x="-88975" y="-142053" z="-9176" heading="58755" />
<npc id="18331" x="-88928" y="-142081" z="-9176" heading="59768" />
<npc id="18331" x="-88648" y="-142284" z="-9176" heading="60097" />
</group>
<group name="room2_part1" spawnByDefault="false">
<npc id="18339" x="-87882" y="-146943" z="-9188" heading="9083" />
<npc id="18339" x="-87914" y="-146981" z="-9188" heading="51455" />
<npc id="18339" x="-87925" y="-146932" z="-9188" heading="15755" />
<npc id="18339" x="-87971" y="-146885" z="-9188" heading="3538" />
</group>
<group name="room2_part2" spawnByDefault="false">
<npc id="18334" x="-87016" y="-147940" z="-9172" heading="23515" />
<npc id="18334" x="-86769" y="-147555" z="-9172" heading="31470" />
<npc id="18334" x="-86723" y="-147121" z="-9172" heading="33419" />
<npc id="18334" x="-86754" y="-146706" z="-9168" heading="32189" />
<npc id="18334" x="-86910" y="-146366" z="-9172" heading="40265" />
<npc id="18334" x="-89015" y="-146462" z="-9172" heading="59668" />
<npc id="18334" x="-88879" y="-146240" z="-9172" heading="62109" />
<npc id="18334" x="-89089" y="-147299" z="-9172" heading="50108" />
<npc id="18334" x="-89128" y="-146746" z="-9172" heading="62663" />
<npc id="18334" x="-88959" y="-147727" z="-9172" heading="3222" />
<npc id="18335" x="-88899" y="-146145" z="-9172" heading="60699" />
<npc id="18335" x="-88822" y="-147929" z="-9172" heading="5129" />
<npc id="18335" x="-89008" y="-147561" z="-9172" heading="1691" />
<npc id="18335" x="-89044" y="-146878" z="-9172" heading="64122" />
<npc id="18335" x="-89005" y="-146439" z="-9172" heading="57813" />
<npc id="18335" x="-89206" y="-147285" z="-9172" heading="61667" />
<npc id="18335" x="-86958" y="-147939" z="-9172" heading="22983" />
<npc id="18335" x="-86739" y="-147224" z="-9172" heading="31415" />
<npc id="18335" x="-86770" y="-146513" z="-9172" heading="29048" />
<npc id="18335" x="-86653" y="-146900" z="-9172" heading="22558" />
<npc id="18335" x="-87029" y="-146250" z="-9172" heading="53805" />
<npc id="18335" x="-86822" y="-147687" z="-9172" heading="25845" />
<npc id="18337" x="-89000" y="-146471" z="-9172" heading="64277" />
<npc id="18337" x="-89005" y="-146678" z="-9172" heading="61677" />
<npc id="18337" x="-89028" y="-146997" z="-9172" heading="64285" />
<npc id="18337" x="-89176" y="-147119" z="-9172" heading="4741" />
<npc id="18337" x="-88994" y="-147462" z="-9172" heading="64668" />
<npc id="18337" x="-89152" y="-147341" z="-9172" heading="65001" />
<npc id="18337" x="-89043" y="-147812" z="-9172" heading="3894" />
<npc id="18337" x="-88811" y="-148033" z="-9172" heading="8381" />
<npc id="18337" x="-88648" y="-148132" z="-9172" heading="12021" />
<npc id="18337" x="-87142" y="-146176" z="-9172" heading="40799" />
<npc id="18337" x="-86899" y="-146535" z="-9172" heading="36449" />
<npc id="18337" x="-86776" y="-146606" z="-9172" heading="37651" />
<npc id="18337" x="-86812" y="-146767" z="-9172" heading="38225" />
<npc id="18337" x="-86825" y="-146966" z="-9172" heading="28332" />
<npc id="18337" x="-86885" y="-147227" z="-9172" heading="33807" />
<npc id="18337" x="-86751" y="-147105" z="-9172" heading="31522" />
<npc id="18337" x="-86873" y="-147564" z="-9172" heading="26634" />
<npc id="18337" x="-87025" y="-147743" z="-9172" heading="27046" />
<npc id="18337" x="-86917" y="-147672" z="-9172" heading="24575" />
<npc id="18338" x="-86885" y="-146225" z="-9168" heading="40959" />
<npc id="18338" x="-86885" y="-146225" z="-9168" heading="51582" />
<npc id="18338" x="-86942" y="-147322" z="-9172" heading="44537" />
<npc id="18338" x="-86766" y="-147622" z="-9172" heading="54685" />
<npc id="18338" x="-86996" y="-147855" z="-9172" heading="41027" />
<npc id="18338" x="-89035" y="-147546" z="-9172" heading="57311" />
<npc id="18338" x="-89228" y="-146891" z="-9172" heading="50874" />
<npc id="18338" x="-89028" y="-146502" z="-9168" heading="45888" />
<npc id="18338" x="-88846" y="-146119" z="-9172" heading="514" />
</group>
</spawnlist>
</instance>

View File

@ -0,0 +1,908 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 instances.LastImperialTomb;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.Earthquake;
import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillCanceld;
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jmobius.gameserver.network.serverpackets.NpcInfo;
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
import com.l2jmobius.gameserver.network.serverpackets.SpecialCamera;
import instances.AbstractInstance;
/**
* Last Imperial Tomb AI
* @author Mobius (reworked from L2J version)
*/
public final class LastImperialTomb extends AbstractInstance
{
// NPCs
private static final int GUIDE = 32011;
private static final int CUBE = 29061;
private static final int HALL_ALARM = 18328;
private static final int HALL_KEEPER_SUICIDAL_SOLDIER = 18333;
private static final int DUMMY = 29052;
private static final int DUMMY2 = 29053;
private static final int[] PORTRAITS =
{
29048,
29049
};
private static final int[] DEMONS =
{
29050,
29051
};
private static final int FRINTEZZA = 29045;
private static final int SCARLET1 = 29046;
private static final int SCARLET2 = 29047;
private static final int[] ON_KILL_MONSTERS =
{
HALL_ALARM,
HALL_KEEPER_SUICIDAL_SOLDIER,
18329,
18330,
18331,
18334,
18335,
18336,
18337,
18338,
18339
};
// Items
private static final int DEWDROP_OF_DESTRUCTION_ITEM_ID = 8556;
private static final int FIRST_SCARLET_WEAPON = 8204;
private static final int SECOND_SCARLET_WEAPON = 7903;
// Doors
private static final int[] FIRST_ROOM_DOORS =
{
17130051,
17130052,
17130053,
17130054,
17130055,
17130056,
17130057,
17130058
};
private static final int[] SECOND_ROOM_DOORS =
{
17130061,
17130062,
17130063,
17130064,
17130065,
17130066,
17130067,
17130068,
17130069,
17130070
};
private static final int[] FIRST_ROUTE_DOORS =
{
17130042,
17130043
};
private static final int[] SECOND_ROUTE_DOORS =
{
17130045,
17130046
};
// Skills
private static final int DEWDROP_OF_DESTRUCTION_SKILL_ID = 2276;
private static final SkillHolder INTRO_SKILL = new SkillHolder(5004, 1);
private static final SkillHolder FIRST_MORPH_SKILL = new SkillHolder(5017, 1);
private static final Map<Integer, NpcStringId> SKILL_MSG = new HashMap<>();
static
{
SKILL_MSG.put(1, NpcStringId.REQUIEM_OF_HATRED);
SKILL_MSG.put(2, NpcStringId.RONDO_OF_SOLITUDE);
SKILL_MSG.put(3, NpcStringId.FRENETIC_TOCCATA);
SKILL_MSG.put(4, NpcStringId.FUGUE_OF_JUBILATION);
SKILL_MSG.put(5, NpcStringId.HYPNOTIC_MAZURKA);
}
// Spawns
// @formatter:off
static final int[][] PORTRAIT_SPAWNS =
{
{29048, -89381, -153981, -9168, 3368, -89378, -153968, -9168, 3368},
{29048, -86234, -152467, -9168, 37656, -86261, -152492, -9168, 37656},
{29049, -89342, -152479, -9168, -5152, -89311, -152491, -9168, -5152},
{29049, -86189, -153968, -9168, 29456, -86217, -153956, -9168, 29456},
};
// @formatter:on
// Misc
private static final int TEMPLATE_ID = 136;
private static final int FRINTEZZA_WAIT_TIME = 10; // minutes
private static final int RANDOM_SONG_INTERVAL = 90; // seconds
private static final int TIME_BETWEEN_DEMON_SPAWNS = 20; // seconds
private static final int MAX_DEMONS = 24;
public LastImperialTomb()
{
addTalkId(GUIDE, CUBE);
addAttackId(SCARLET1);
addKillId(ON_KILL_MONSTERS);
addKillId(HALL_ALARM, SCARLET2);
addKillId(PORTRAITS);
addKillId(DEMONS);
addSpawnId(HALL_ALARM, DUMMY, DUMMY2);
addSpellFinishedId(HALL_KEEPER_SUICIDAL_SOLDIER);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "FRINTEZZA_INTRO_START":
{
final Instance world = player.getInstanceWorld();
startQuestTimer("FRINTEZZA_INTRO_1", 17000, null, player, false);
startQuestTimer("FRINTEZZA_INTRO_2", 20000, null, player, false);
broadCastPacket(world, new Earthquake(-87784, -155083, -9087, 45, 27));
break;
}
case "FRINTEZZA_INTRO_1":
{
final Instance world = player.getInstanceWorld();
for (int doorId : FIRST_ROOM_DOORS)
{
world.openCloseDoor(doorId, false);
}
for (int doorId : FIRST_ROUTE_DOORS)
{
world.openCloseDoor(doorId, false);
}
for (int doorId : SECOND_ROOM_DOORS)
{
world.openCloseDoor(doorId, false);
}
for (int doorId : SECOND_ROUTE_DOORS)
{
world.openCloseDoor(doorId, false);
}
addSpawn(CUBE, -87904, -141296, -9168, 0, false, 0, false, world.getId());
break;
}
case "FRINTEZZA_INTRO_2":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezzaDummy = addSpawn(DUMMY, -87784, -155083, -9087, 16048, false, 0, false, world.getId());
world.setParameter("frintezzaDummy", frintezzaDummy);
final L2Npc overheadDummy = addSpawn(DUMMY, -87784, -153298, -9175, 16384, false, 0, false, world.getId());
overheadDummy.setCollisionHeight(600);
broadCastPacket(world, new NpcInfo(overheadDummy));
world.setParameter("overheadDummy", overheadDummy);
final L2Npc portraitDummy1 = addSpawn(DUMMY, -89566, -153168, -9165, 16048, false, 0, false, world.getId());
world.setParameter("portraitDummy1", portraitDummy1);
final L2Npc portraitDummy3 = addSpawn(DUMMY, -86004, -153168, -9165, 16048, false, 0, false, world.getId());
world.setParameter("portraitDummy3", portraitDummy3);
final L2Npc scarletDummy = addSpawn(DUMMY2, -87784, -153298, -9175, 16384, false, 0, false, world.getId());
world.setParameter("scarletDummy", scarletDummy);
disablePlayers(world);
broadCastPacket(world, new SpecialCamera(overheadDummy, 0, 75, -89, 0, 100, 0, 0, 1, 0, 0));
broadCastPacket(world, new SpecialCamera(overheadDummy, 0, 75, -89, 0, 100, 0, 0, 1, 0, 0));
broadCastPacket(world, new SpecialCamera(overheadDummy, 300, 90, -10, 6500, 7000, 0, 0, 1, 0, 0));
final L2Npc frintezza = addSpawn(FRINTEZZA, -87780, -155086, -9080, 16384, false, 0, false, world.getId());
frintezza.setIsImmobilized(true);
frintezza.setIsInvul(true);
frintezza.disableAllSkills();
world.setParameter("frintezza", frintezza);
final List<L2Npc> demons = new ArrayList<>();
for (int[] element : PORTRAIT_SPAWNS)
{
final L2MonsterInstance demon = (L2MonsterInstance) addSpawn(element[0] + 2, element[5], element[6], element[7], element[8], false, 0, false, world.getId());
demon.setIsImmobilized(true);
demon.disableAllSkills();
demons.add(demon);
}
world.setParameter("demons", demons);
startQuestTimer("FRINTEZZA_INTRO_3", 6500, null, player, false);
break;
}
case "FRINTEZZA_INTRO_3":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezzaDummy = world.getParameters().getObject("frintezzaDummy", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezzaDummy, 1800, 90, 8, 6500, 7000, 0, 0, 1, 0, 0));
startQuestTimer("FRINTEZZA_INTRO_4", 900, null, player, false);
break;
}
case "FRINTEZZA_INTRO_4":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezzaDummy = world.getParameters().getObject("frintezzaDummy", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezzaDummy, 140, 90, 10, 2500, 4500, 0, 0, 1, 0, 0));
startQuestTimer("FRINTEZZA_INTRO_5", 4000, null, player, false);
break;
}
case "FRINTEZZA_INTRO_5":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezza, 40, 75, -10, 0, 1000, 0, 0, 1, 0, 0));
broadCastPacket(world, new SpecialCamera(frintezza, 40, 75, -10, 0, 12000, 0, 0, 1, 0, 0));
startQuestTimer("FRINTEZZA_INTRO_6", 1350, null, player, false);
break;
}
case "FRINTEZZA_INTRO_6":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new SocialAction(frintezza.getObjectId(), 2));
final L2Npc frintezzaDummy = world.getParameters().getObject("frintezzaDummy", L2Npc.class);
frintezzaDummy.deleteMe();
startQuestTimer("FRINTEZZA_INTRO_7", 8000, null, player, false);
break;
}
case "FRINTEZZA_INTRO_7":
{
final Instance world = player.getInstanceWorld();
final List<L2Npc> demons = world.getParameters().getList("demons", L2Npc.class);
broadCastPacket(world, new SocialAction(demons.get(1).getObjectId(), 1));
broadCastPacket(world, new SocialAction(demons.get(2).getObjectId(), 1));
startQuestTimer("FRINTEZZA_INTRO_8", 400, null, player, false);
break;
}
case "FRINTEZZA_INTRO_8":
{
final Instance world = player.getInstanceWorld();
final List<L2Npc> demons = world.getParameters().getList("demons", L2Npc.class);
final L2Npc portraitDummy1 = world.getParameters().getObject("portraitDummy1", L2Npc.class);
final L2Npc portraitDummy3 = world.getParameters().getObject("portraitDummy3", L2Npc.class);
broadCastPacket(world, new SocialAction(demons.get(0).getObjectId(), 1));
broadCastPacket(world, new SocialAction(demons.get(3).getObjectId(), 1));
sendPacketX(world, new SpecialCamera(portraitDummy1, 1000, 118, 0, 0, 1000, 0, 0, 1, 0, 0), new SpecialCamera(portraitDummy3, 1000, 62, 0, 0, 1000, 0, 0, 1, 0, 0), -87784);
sendPacketX(world, new SpecialCamera(portraitDummy1, 1000, 118, 0, 0, 10000, 0, 0, 1, 0, 0), new SpecialCamera(portraitDummy3, 1000, 62, 0, 0, 10000, 0, 0, 1, 0, 0), -87784);
startQuestTimer("FRINTEZZA_INTRO_9", 2000, null, player, false);
break;
}
case "FRINTEZZA_INTRO_9":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
final L2Npc portraitDummy1 = world.getParameters().getObject("portraitDummy1", L2Npc.class);
final L2Npc portraitDummy3 = world.getParameters().getObject("portraitDummy3", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezza, 240, 90, 0, 0, 1000, 0, 0, 1, 0, 0));
broadCastPacket(world, new SpecialCamera(frintezza, 240, 90, 25, 5500, 10000, 0, 0, 1, 0, 0));
broadCastPacket(world, new SocialAction(frintezza.getObjectId(), 3));
portraitDummy1.deleteMe();
portraitDummy3.deleteMe();
startQuestTimer("FRINTEZZA_INTRO_10", 4500, null, player, false);
break;
}
case "FRINTEZZA_INTRO_10":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezza, 100, 195, 35, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("FRINTEZZA_INTRO_11", 700, null, player, false);
break;
}
case "FRINTEZZA_INTRO_11":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezza, 100, 195, 35, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("FRINTEZZA_INTRO_12", 1300, null, player, false);
break;
}
case "FRINTEZZA_INTRO_12":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new ExShowScreenMessage(NpcStringId.MOURNFUL_CHORALE_PRELUDE, 2, 5000));
broadCastPacket(world, new SpecialCamera(frintezza, 120, 180, 45, 1500, 10000, 0, 0, 1, 0, 0));
broadCastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
startQuestTimer("FRINTEZZA_INTRO_13", 1500, null, player, false);
break;
}
case "FRINTEZZA_INTRO_13":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezza, 520, 135, 45, 8000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("FRINTEZZA_INTRO_14", 7500, null, player, false);
break;
}
case "FRINTEZZA_INTRO_14":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezza, 1500, 110, 25, 10000, 13000, 0, 0, 1, 0, 0));
startQuestTimer("FRINTEZZA_INTRO_15", 9500, null, player, false);
break;
}
case "FRINTEZZA_INTRO_15":
{
final Instance world = player.getInstanceWorld();
final L2Npc overheadDummy = world.getParameters().getObject("overheadDummy", L2Npc.class);
final L2Npc scarletDummy = world.getParameters().getObject("scarletDummy", L2Npc.class);
broadCastPacket(world, new SpecialCamera(overheadDummy, 930, 160, -20, 0, 1000, 0, 0, 1, 0, 0));
broadCastPacket(world, new SpecialCamera(overheadDummy, 600, 180, -25, 0, 10000, 0, 0, 1, 0, 0));
broadCastPacket(world, new MagicSkillUse(scarletDummy, overheadDummy, 5004, 1, 5800, 0));
startQuestTimer("FRINTEZZA_INTRO_16", 5000, null, player, false);
break;
}
case "FRINTEZZA_INTRO_16":
{
final Instance world = player.getInstanceWorld();
final L2Npc scarletDummy = world.getParameters().getObject("scarletDummy", L2Npc.class);
final L2Npc activeScarlet = addSpawn(SCARLET1, -87789, -153295, -9176, 16384, false, 0, false, world.getId());
world.setParameter("activeScarlet", activeScarlet);
activeScarlet.setRHandId(FIRST_SCARLET_WEAPON);
activeScarlet.setIsInvul(true);
activeScarlet.setIsImmobilized(true);
activeScarlet.disableAllSkills();
broadCastPacket(world, new SocialAction(activeScarlet.getObjectId(), 3));
broadCastPacket(world, new SpecialCamera(scarletDummy, 800, 180, 10, 1000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("FRINTEZZA_INTRO_17", 2100, null, player, false);
break;
}
case "FRINTEZZA_INTRO_17":
{
final Instance world = player.getInstanceWorld();
final L2Npc activeScarlet = world.getParameters().getObject("activeScarlet", L2Npc.class);
broadCastPacket(world, new SpecialCamera(activeScarlet, 300, 60, 8, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("FRINTEZZA_INTRO_18", 2000, null, player, false);
break;
}
case "FRINTEZZA_INTRO_18":
{
final Instance world = player.getInstanceWorld();
final L2Npc activeScarlet = world.getParameters().getObject("activeScarlet", L2Npc.class);
broadCastPacket(world, new SpecialCamera(activeScarlet, 500, 90, 10, 3000, 5000, 0, 0, 1, 0, 0));
world.setParameter("isPlayingSong", false);
playRandomSong(world);
startQuestTimer("FRINTEZZA_INTRO_19", 3000, null, player, false);
break;
}
case "FRINTEZZA_INTRO_19":
{
final Instance world = player.getInstanceWorld();
Map<L2Npc, Integer> portraits = new HashMap<>();
for (int i = 0; i < PORTRAIT_SPAWNS.length; i++)
{
final L2Npc portrait = addSpawn(PORTRAIT_SPAWNS[i][0], PORTRAIT_SPAWNS[i][1], PORTRAIT_SPAWNS[i][2], PORTRAIT_SPAWNS[i][3], PORTRAIT_SPAWNS[i][4], false, 0, false, world.getId());
portraits.put(portrait, i);
}
world.setParameter("portraits", portraits);
final L2Npc overheadDummy = world.getParameters().getObject("overheadDummy", L2Npc.class);
final L2Npc scarletDummy = world.getParameters().getObject("scarletDummy", L2Npc.class);
overheadDummy.deleteMe();
scarletDummy.deleteMe();
startQuestTimer("FRINTEZZA_INTRO_20", 2000, null, player, false);
break;
}
case "FRINTEZZA_INTRO_20":
{
final Instance world = player.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
final L2Npc activeScarlet = world.getParameters().getObject("activeScarlet", L2Npc.class);
final List<L2Npc> demons = world.getParameters().getList("demons", L2Npc.class);
for (L2Npc demon : demons)
{
demon.setIsImmobilized(false);
demon.enableAllSkills();
}
activeScarlet.setIsInvul(false);
activeScarlet.setIsImmobilized(false);
activeScarlet.enableAllSkills();
activeScarlet.setRunning();
activeScarlet.doCast(INTRO_SKILL.getSkill());
frintezza.enableAllSkills();
frintezza.disableCoreAI(true);
frintezza.setIsInvul(true);
enablePlayers(world);
startQuestTimer("PLAY_RANDOM_SONG", RANDOM_SONG_INTERVAL * 1000, frintezza, null, false);
startQuestTimer("SPAWN_DEMONS", TIME_BETWEEN_DEMON_SPAWNS * 1000, null, player, false);
break;
}
case "SPAWN_DEMONS":
{
final Instance world = player.getInstanceWorld();
final Map<L2Npc, Integer> portraits = world.getParameters().getMap("portraits", L2Npc.class, Integer.class);
if (!portraits.isEmpty())
{
final List<L2Npc> demons = world.getParameters().getList("demons", L2Npc.class);
for (int i : portraits.values())
{
if (demons.size() > MAX_DEMONS)
{
break;
}
final L2Npc demon = addSpawn(PORTRAIT_SPAWNS[i][0] + 2, PORTRAIT_SPAWNS[i][5], PORTRAIT_SPAWNS[i][6], PORTRAIT_SPAWNS[i][7], PORTRAIT_SPAWNS[i][8], false, 0, false, world.getId());
demons.add(demon);
}
world.setParameter("demons", demons);
startQuestTimer("SPAWN_DEMONS", TIME_BETWEEN_DEMON_SPAWNS * 1000, null, player, false);
}
break;
}
case "PLAY_RANDOM_SONG":
{
if (npc != null)
{
final Instance world = npc.getInstanceWorld();
playRandomSong(world);
startQuestTimer("PLAY_RANDOM_SONG", RANDOM_SONG_INTERVAL * 1000, null, player, false);
}
break;
}
case "SCARLET_FIRST_MORPH":
{
final Instance world = npc.getInstanceWorld();
npc.doCast(FIRST_MORPH_SKILL.getSkill());
playRandomSong(world);
break;
}
case "SCARLET_SECOND_MORPH":
{
final Instance world = npc.getInstanceWorld();
disablePlayers(world);
final L2Npc activeScarlet = world.getParameters().getObject("activeScarlet", L2Npc.class);
activeScarlet.abortAttack();
activeScarlet.abortCast();
activeScarlet.setIsInvul(true);
activeScarlet.setIsImmobilized(true);
activeScarlet.disableAllSkills();
playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false);
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_1":
{
final Instance world = npc.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadCastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadCastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false);
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_2":
{
final Instance world = npc.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadCastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false);
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_3":
{
final Instance world = npc.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false);
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_4":
{
final Instance world = npc.getInstanceWorld();
final L2Npc activeScarlet = world.getParameters().getObject("activeScarlet", L2Npc.class);
final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0;
if (scarletLocation.getHeading() < 32768)
{
newHeading = Math.abs(180 - (int) (scarletLocation.getHeading() / 182.044444444));
}
else
{
newHeading = Math.abs(540 - (int) (scarletLocation.getHeading() / 182.044444444));
}
world.setParameter("scarletLocation", scarletLocation);
world.setParameter("newHeading", newHeading);
broadCastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadCastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false);
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_5":
{
final Instance world = npc.getInstanceWorld();
final L2Npc activeScarlet = world.getParameters().getObject("activeScarlet", L2Npc.class);
final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet);
broadCastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false);
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_6":
{
final Instance world = npc.getInstanceWorld();
final L2Npc activeScarlet = world.getParameters().getObject("activeScarlet", L2Npc.class);
activeScarlet.deleteMe();
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_7":
{
final Instance world = npc.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final L2Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
world.setParameter("activeScarlet", activeScarlet);
activeScarlet.setRHandId(SECOND_SCARLET_WEAPON);
activeScarlet.setIsInvul(true);
activeScarlet.setIsImmobilized(true);
activeScarlet.disableAllSkills();
broadCastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false);
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_8":
{
final Instance world = npc.getInstanceWorld();
final L2Npc activeScarlet = world.getParameters().getObject("activeScarlet", L2Npc.class);
broadCastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_9":
{
final Instance world = npc.getInstanceWorld();
final L2Npc activeScarlet = world.getParameters().getObject("activeScarlet", L2Npc.class);
activeScarlet.setIsInvul(false);
activeScarlet.setIsImmobilized(false);
activeScarlet.enableAllSkills();
enablePlayers(world);
break;
}
case "FINISH_CAMERA_1":
{
final Instance world = npc.getInstanceWorld();
final L2Npc activeScarlet = world.getParameters().getObject("activeScarlet", L2Npc.class);
final int newHeading = world.getParameters().getInt("newHeading");
broadCastPacket(world, new SpecialCamera(activeScarlet, 300, newHeading - 180, 5, 0, 7000, 0, 0, 1, 0, 0));
broadCastPacket(world, new SpecialCamera(activeScarlet, 200, newHeading, 85, 4000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("FINISH_CAMERA_2", 7400, npc, null, false);
startQuestTimer("FINISH_CAMERA_3", 7500, npc, null, false);
break;
}
case "FINISH_CAMERA_2":
{
final Instance world = npc.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
frintezza.doDie(frintezza);
break;
}
case "FINISH_CAMERA_3":
{
final Instance world = npc.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezza, 100, 120, 5, 0, 7000, 0, 0, 1, 0, 0));
broadCastPacket(world, new SpecialCamera(frintezza, 100, 90, 5, 5000, 15000, 0, 0, 1, 0, 0));
startQuestTimer("FINISH_CAMERA_4", 7000, npc, null, false);
break;
}
case "FINISH_CAMERA_4":
{
final Instance world = npc.getInstanceWorld();
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new SpecialCamera(frintezza, 900, 90, 25, 7000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("FINISH_CAMERA_5", 9000, npc, null, false);
break;
}
case "FINISH_CAMERA_5":
{
final Instance world = npc.getInstanceWorld();
for (int doorId : FIRST_ROOM_DOORS)
{
world.openCloseDoor(doorId, true);
}
for (int doorId : FIRST_ROUTE_DOORS)
{
world.openCloseDoor(doorId, true);
}
for (int doorId : SECOND_ROOM_DOORS)
{
world.openCloseDoor(doorId, true);
}
for (int doorId : SECOND_ROUTE_DOORS)
{
world.openCloseDoor(doorId, true);
}
enablePlayers(world);
break;
}
}
return null;
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
if (npc.getId() == GUIDE)
{
enterInstance(player, npc, TEMPLATE_ID);
}
else // Teleport Cube
{
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);
}
}
return null;
}
@Override
public String onSpawn(L2Npc npc)
{
npc.setRandomWalking(false);
npc.setIsImmobilized(true);
if (npc.getId() == HALL_ALARM)
{
npc.disableCoreAI(true);
}
else // dummy
{
npc.setIsInvul(true);
}
return super.onSpawn(npc);
}
@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill)
{
if (npc.getId() == SCARLET1)
{
if ((npc.getScriptValue() == 0) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.80)))
{
npc.setScriptValue(1);
startQuestTimer("SCARLET_FIRST_MORPH", 1000, npc, null, false);
}
if ((npc.getScriptValue() == 1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{
npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false);
}
}
if (skill != null)
{
// When Dewdrop of Destruction is used on Portraits they suicide.
if (CommonUtil.contains(PORTRAITS, npc.getId()) && (skill.getId() == DEWDROP_OF_DESTRUCTION_SKILL_ID))
{
npc.doDie(attacker);
}
}
return null;
}
@Override
public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
{
if (skill.isSuicideAttack())
{
return onKill(npc, null, false);
}
return super.onSpellFinished(npc, player, skill);
}
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
final Instance world = killer.getInstanceWorld();
if ((npc.getId() == HALL_ALARM) && (world.getStatus() == 0))
{
world.setStatus(1);
world.spawnGroup("room1");
final List<L2MonsterInstance> monsters = world.getAliveNpcs(L2MonsterInstance.class);
world.setParameter("monstersCount", monsters.size() - 1);
for (int doorId : FIRST_ROOM_DOORS)
{
world.openCloseDoor(doorId, true);
}
for (L2Npc monster : monsters)
{
monster.reduceCurrentHp(1, killer, null); // TODO: Find better way for attack
}
}
else if (npc.getId() == SCARLET2)
{
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
broadCastPacket(world, new MagicSkillCanceld(frintezza.getObjectId()));
startQuestTimer("FINISH_CAMERA_1", 500, npc, null, false);
}
else if (CommonUtil.contains(DEMONS, npc.getId()))
{
final List<L2Npc> demons = world.getParameters().getList("demons", L2Npc.class);
demons.remove(npc);
}
else if (CommonUtil.contains(PORTRAITS, npc.getId()))
{
final Map<L2Npc, Integer> portraits = world.getParameters().getMap("portraits", L2Npc.class, Integer.class);
portraits.remove(npc);
}
else
{
final int killCount = world.getParameters().getInt("monstersCount");
world.setParameter("monstersCount", killCount - 1);
if (killCount <= 0)
{
switch (world.getStatus())
{
case 1:
{
world.setStatus(2);
world.spawnGroup("room2_part1");
final List<L2MonsterInstance> monsters = world.getAliveNpcs(L2MonsterInstance.class);
world.setParameter("monstersCount", monsters.size() - 1);
for (int doorId : FIRST_ROUTE_DOORS)
{
world.openCloseDoor(doorId, true);
}
break;
}
case 2:
{
world.setStatus(3);
world.spawnGroup("room2_part2");
final List<L2MonsterInstance> monsters = world.getAliveNpcs(L2MonsterInstance.class);
world.setParameter("monstersCount", monsters.size() - 1);
for (int doorId : SECOND_ROOM_DOORS)
{
world.openCloseDoor(doorId, true);
}
for (L2Npc monster : monsters)
{
monster.reduceCurrentHp(1, killer, null); // TODO: Find better way for attack
}
break;
}
case 3:
{
world.setStatus(4);
for (int doorId : SECOND_ROUTE_DOORS)
{
world.openCloseDoor(doorId, true);
}
startQuestTimer("FRINTEZZA_INTRO_START", FRINTEZZA_WAIT_TIME * 60 * 1000, null, killer, false);
break;
}
}
}
if (getRandom(100) < 5)
{
npc.dropItem(killer, DEWDROP_OF_DESTRUCTION_ITEM_ID, 1);
}
}
return super.onKill(npc, killer, isSummon);
}
private void playRandomSong(Instance world)
{
final L2Npc frintezza = world.getParameters().getObject("frintezza", L2Npc.class);
final boolean isPlayingSong = world.getParameters().getBoolean("isPlayingSong");
if (isPlayingSong)
{
return;
}
world.setParameter("isPlayingSong", true);
final int random = getRandom(1, 5);
final SkillHolder skill = new SkillHolder(5007, random);
final SkillHolder skillEffect = new SkillHolder(5008, random);
broadCastPacket(world, new ExShowScreenMessage(2, -1, 2, 0, 0, 0, 0, true, 4000, false, null, SKILL_MSG.get(random), null));
broadCastPacket(world, new MagicSkillUse(frintezza, frintezza, skill.getSkillId(), skill.getSkillLvl(), skill.getSkill().getHitTime(), 0));
for (L2PcInstance player : world.getPlayers())
{
if ((player != null) && player.isOnline())
{
frintezza.setTarget(player);
frintezza.doCast(skillEffect.getSkill());
}
}
world.setParameter("isPlayingSong", false);
}
private void disablePlayers(Instance world)
{
for (L2PcInstance player : world.getPlayers())
{
if ((player != null) && player.isOnline())
{
player.abortAttack();
player.abortCast();
player.disableAllSkills();
player.setTarget(null);
player.stopMove(null);
player.setIsImmobilized(true);
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
}
}
private void enablePlayers(Instance world)
{
for (L2PcInstance player : world.getPlayers())
{
if ((player != null) && player.isOnline())
{
player.enableAllSkills();
player.setIsImmobilized(false);
}
}
}
void broadCastPacket(Instance world, IClientOutgoingPacket packet)
{
for (L2PcInstance player : world.getPlayers())
{
if ((player != null) && player.isOnline())
{
player.sendPacket(packet);
}
}
}
private void sendPacketX(Instance world, IClientOutgoingPacket packet1, IClientOutgoingPacket packet2, int x)
{
for (L2PcInstance player : world.getPlayers())
{
if ((player != null) && player.isOnline())
{
if (player.getX() < x)
{
player.sendPacket(packet1);
}
else
{
player.sendPacket(packet2);
}
}
}
}
public static void main(String[] args)
{
new LastImperialTomb();
}
}

View File

@ -0,0 +1,282 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 instances.LastImperialTomb;
import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
import java.util.ArrayList;
import com.l2jmobius.gameserver.GeoData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2DecoyInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
* @author Micr0, Zerox, Mobius
*/
public final class ScarletVanHalisha extends AbstractNpcAI
{
// NPCs
private static final int HALISHA2 = 29046;
private static final int HALISHA3 = 29047;
// Skills
private static final int FRINTEZZA_DAEMON_ATTACK = 5014;
private static final int FRINTEZZA_DAEMON_CHARGE = 5015;
private static final int YOKE_OF_SCARLET = 5016;
private static final int FRINTEZZA_DAEMON_MORPH = 5018;
private static final int FRINTEZZA_DAEMON_FIELD = 5019;
// Misc
private L2Character _target;
private Skill _skill;
private long _lastRangedSkillTime;
private final int _rangedSkillMinCoolTime = 60000; // 1 minute
public ScarletVanHalisha()
{
addAttackId(HALISHA2, HALISHA3);
addKillId(HALISHA2, HALISHA3);
addSpellFinishedId(HALISHA2, HALISHA3);
registerMobs(HALISHA2, HALISHA3);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "attack":
{
if (npc != null)
{
getSkillAI(npc);
}
break;
}
case "random_target":
{
_target = getRandomTarget(npc, null);
break;
}
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
{
getSkillAI(npc);
return super.onSpellFinished(npc, player, skill);
}
@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
{
startQuestTimer("random_Target", 5000, npc, null, true);
startQuestTimer("attack", 500, npc, null, true);
return super.onAttack(npc, attacker, damage, isSummon);
}
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
cancelQuestTimers("attack");
cancelQuestTimers("random_Target");
return super.onKill(npc, killer, isSummon);
}
private Skill getRndSkills(L2Npc npc)
{
switch (npc.getId())
{
case HALISHA2:
{
if (getRandom(100) < 10)
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_CHARGE, 2);
}
else if (getRandom(100) < 10)
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_CHARGE, 5);
}
else if (getRandom(100) < 2)
{
return SkillData.getInstance().getSkill(YOKE_OF_SCARLET, 1);
}
else
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_ATTACK, 2);
}
}
case HALISHA3:
{
if (getRandom(100) < 10)
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_CHARGE, 3);
}
else if (getRandom(100) < 10)
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_CHARGE, 6);
}
else if (getRandom(100) < 10)
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_CHARGE, 2);
}
else if (((_lastRangedSkillTime + _rangedSkillMinCoolTime) < System.currentTimeMillis()) && (getRandom(100) < 10))
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_FIELD, 1);
}
else if (((_lastRangedSkillTime + _rangedSkillMinCoolTime) < System.currentTimeMillis()) && (getRandom(100) < 10))
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_MORPH, 1);
}
else if (getRandom(100) < 2)
{
return SkillData.getInstance().getSkill(YOKE_OF_SCARLET, 1);
}
else
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_ATTACK, 3);
}
}
}
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_ATTACK, 1);
}
private synchronized void getSkillAI(L2Npc npc)
{
if (npc.isInvul() || npc.isCastingNow())
{
return;
}
if ((getRandom(100) < 30) || (_target == null) || _target.isDead())
{
_skill = getRndSkills(npc);
_target = getRandomTarget(npc, _skill);
}
final L2Character target = _target;
Skill skill = _skill;
if (skill == null)
{
skill = getRndSkills(npc);
}
if (npc.isPhysicalMuted())
{
return;
}
if ((target == null) || target.isDead())
{
// npc.setIsCastingNow(false);
return;
}
if (Util.checkIfInRange(skill.getCastRange(), npc, target, true))
{
npc.getAI().setIntention(AI_INTENTION_IDLE);
npc.setTarget(target);
// npc.setIsCastingNow(true);
_target = null;
npc.doCast(skill);
}
else
{
npc.getAI().setIntention(AI_INTENTION_FOLLOW, target, null);
npc.getAI().setIntention(AI_INTENTION_ATTACK, target, null);
// npc.setIsCastingNow(false);
}
}
private L2Character getRandomTarget(L2Npc npc, Skill skill)
{
final ArrayList<L2Character> result = new ArrayList<>();
{
for (L2Object obj : npc.getInstanceWorld().getPlayers())
{
if (obj.isPlayable() || (obj instanceof L2DecoyInstance))
{
if (obj.isPlayer() && obj.getActingPlayer().isInvisible())
{
continue;
}
if (((((L2Character) obj).getZ() < (npc.getZ() - 100)) && (((L2Character) obj).getZ() > (npc.getZ() + 100))) || !GeoData.getInstance().canSeeTarget(((L2Character) obj).getX(), ((L2Character) obj).getY(), ((L2Character) obj).getZ(), npc.getX(), npc.getY(), npc.getZ()))
{
continue;
}
}
if (obj.isPlayable() || (obj instanceof L2DecoyInstance))
{
int skillRange = 150;
if (skill != null)
{
switch (skill.getId())
{
case FRINTEZZA_DAEMON_ATTACK:
{
skillRange = 150;
break;
}
case FRINTEZZA_DAEMON_CHARGE:
{
skillRange = 400;
break;
}
case YOKE_OF_SCARLET:
{
skillRange = 200;
break;
}
case FRINTEZZA_DAEMON_MORPH:
case FRINTEZZA_DAEMON_FIELD:
{
_lastRangedSkillTime = System.currentTimeMillis();
skillRange = 550;
break;
}
}
}
if (Util.checkIfInRange(skillRange, npc, obj, true) && !((L2Character) obj).isDead())
{
result.add((L2Character) obj);
}
}
}
}
if (!result.isEmpty() && (result.size() != 0))
{
final Object[] characters = result.toArray();
return (L2Character) characters[getRandom(characters.length)];
}
return null;
}
public static void main(String[] args)
{
new ScarletVanHalisha();
}
}