Jump to content

Recommended Posts

Posted

 

Hello.

 

I have made a custom instance based on the Kamaloka instance. I basically got the script, removed all zones except one and i added mobs and i adapted it to Devastated Castle.

All works fine except when i enter instance the doors inside the castle light up when i hover the mouse cursor over it, but they are untargetable.  I tryed to add L2DoorInstance but nothing happened, aldough server had no errors in running the script.

 

Also, it would be much apreciated if  someone could make the RaidBoss spawn after the miniboss is killed. Tryed a few things but none worked.

 

I must state that i don t have a good knowledge of java scripts or programing... but with time i learned how scripts in L2 work.

 

Any help would be much apreciated. Thank you.

 

Script is Kamaloka from L2Sunrise Source.

 

Thank you !

 

Here is the modified script >

 

/*
 * Copyright (C) 2004-2015 L2J DataPack
 *
 * This file is part of L2J DataPack.
 *
 * L2J DataPack 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.
 *
 * L2J DataPack 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.BloodRun;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.Map;

import l2r.gameserver.data.xml.impl.SkillData;
import l2r.gameserver.instancemanager.InstanceManager;
import l2r.gameserver.model.L2Party;
import l2r.gameserver.model.L2Spawn;
import l2r.gameserver.model.L2World;
import l2r.gameserver.model.Location;
import l2r.gameserver.model.actor.L2Character;
import l2r.gameserver.model.actor.L2Npc;
import l2r.gameserver.model.actor.instance.L2PcInstance;
import l2r.gameserver.model.effects.L2Effect;
import l2r.gameserver.model.entity.Instance;
import l2r.gameserver.model.instancezone.InstanceWorld;
import l2r.gameserver.model.skills.L2Skill;
import l2r.gameserver.network.SystemMessageId;
import l2r.gameserver.network.serverpackets.SystemMessage;

import instances.AbstractInstance;

public final class BloodRun extends AbstractInstance
{
    /*
     * Reset time for all BloodRun Default: 6:30AM on server time
     */
    private static final int RESET_HOUR = 6;
    private static final int RESET_MIN = 30;
    
    /*
     * Time after which instance without players will be destroyed Default: 5 minutes
     */
    private static final int EMPTY_DESTROY_TIME = 5;
    
    /*
     * Time to destroy instance (and eject players away) after boss defeat Default: 5 minutes
     */
    private static final int EXIT_TIME = 5;
    
    /*
     * Maximum level difference between players level and BloodRun level Default: 5
     */
    private static final int MAX_LEVEL_DIFFERENCE = 5;
    
    /*
     * If true shaman in the first room will have same npcId as other mobs, making radar useless Default: true (but not retail like)
     */
    private static final boolean STEALTH_SHAMAN = true;
    // Template IDs for BloodRun
    // @formatter:off
    private static final int[] TEMPLATE_IDS =
    {
        161, 162
    };
    
    // Level of the BloodRun
    private static final int[] LEVEL =
    {
        81
    };
    
    // Duration of the instance, minutes
    private static final int[] DURATION =
    {
        60
    };
    // Maximum party size for the instance
    private static final int[] MAX_PARTY_SIZE =
    {
        9
    };

    /**
     * List of buffs NOT removed on enter from player and pet<br>
     * On retail only newbie guide buffs not removed<br>
     * CAUTION: array must be sorted in ascension order!
     */
    protected static final int[] BUFFS_WHITELIST =
    {
        4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 5632, 5637, 5950, 982, 915, 274, 307, 309, 276, 825, 1537, 1538, 1548, 1232, 1307, 1257, 1047, 4351, 4344, 4348, 4347, 4353, 4346, 4352, 4356, 4355, 1303, 4358, 4359, 4357, 4354, 4360, 1392, 1393, 1354, 1353, 1352, 4349, 4350, 1284, 1461, 1397, 1416, 1085, 1304, 1087, 1062, 1243, 1045, 1048, 1397, 1078, 1242, 1059, 1077, 1240, 1086, 1043, 1032, 1036, 1460, 1035, 1068, 1044, 1182, 1191, 1033, 1259, 1189, 1040, 1268, 1284, 1139, 1140, 1141, 1144, 1145, 1146, 1497, 1388, 1389, 1413, 1363, 1356, 1355, 1357, 1414, 4702, 4703, 4699, 4700, 1349, 1346, 1347, 1348, 1002, 1311, 1087, 1007, 1009, 1229, 1251, 1252, 1253, 1284, 1308, 1309, 1310, 1362, 1363, 1390, 1391, 1413, 1006, 1204, 1003, 1004, 1005, 1008, 1010, 1249, 1250, 1256, 1260, 1261, 1282, 1364, 1365, 1415, 1416, 1238, 1501, 1502, 1503, 1504, 1519, 1500, 1499, 1545, 1536, 1542, 1562, 1535, 4342, 4345, 4343, 264, 266, 306, 308, 268, 363, 364, 349, 265, 304, 270, 305, 269, 829, 530, 914, 277, 275, 826, 827, 271, 828, 830, 272, 310, 311, 529, 1323, 267, 273, 365, 764, 765, 7006, 7029, 1549, 366,
    };
    // @formatter:on
    // Teleport points into instances x, y, z
    private static final Location[] TELEPORTS =
    {
    new Location(178330, -15269, -2256)
    };
    // Respawn delay for the mobs in the first room, seconds Default: 25
    private static final int FIRST_ROOM_RESPAWN_DELAY = 25;
    
    //@formatter:off
    
    /*
     * First room information, null if room not spawned
     * Skill is casted on the boss when shaman is defeated and mobs respawn stopped
     * Default: 5699 (decrease pdef)
     *
     * shaman npcId, minions npcId, skillId, skillLvl
     */
    private static final int[][] FIRST_ROOM =
    {
        { 22857, 22857, 5699, 1 }
    };
    
    /*
     * First room spawns, null if room not spawned
     *
     * x, y, z
     */
    private static final int[][][] FIRST_ROOM_SPAWNS =
    {    
        {
            { 177547, -14832, -2232 }, { 177753, -15083, -2232 },
            { 177504, -15232, -2232 }, { 177055, -15446, -2256 },
            { 177198, -15924, -2256 }, { 177496, -15544, -2256 },
            { 177569, -16064, -2256 }, { 177776, -15486, -2256 },
            { 177723, -15806, -2256 }, { 177841, -16243, -2256 },
            { 178059, -16010, -2256 }, { 178032, -15403, -2256 },
            { 178093, -15695, -2256 }, { 178156, -16290, -2224 },
            { 178345, -16278, -2224 }, { 178370, -15632, -2256 },
            { 178394, -16049, -2256 }, { 178681, -15468, -2256 },
            { 178974, -15411, -2256 }, { 178581, -15855, -2256 },
            { 178723, -16192, -2256 }, { 178832, -15955, -2256 },
            { 178863, -15695, -2256 }, { 179029, -16148, -2256 },
            { 179580, -15364, -2256 }, { 179310, -15521, -2256 },
            { 179454, -15066, -2232 }, { 179325, -14826, -2232 },
            { 179216, -15186, -2232 }, { 179392, -15823, -2256 },
            { 179659, -15940, -2256 }, { 179522, -16118, -2256 },
            { 179671, -16304, -2256 }, { 179538, -16550, -2256 },
            { 179627, -16698, -2256 }, { 179508, -16885, -2256 },
            { 179603, -17094, -2256 }, { 179474, -17294, -2256 },
            { 179697, -17278, -2256 }, { 179615, -17499, -2256 },
            { 179489, -17673, -2256 }, { 179650, -17804, -2256 },
            { 179492, -17918, -2256 }, { 179699, -18012, -2256 },
            { 179593, -18246, -2256 }, { 179705, -18501, -2256 },
            { 179467, -18861, -2256 }, { 179518, -18604, -2256 },
            { 179303, -18702, -2256 }, { 179181, -18512, -2256 },
            { 179027, -18785, -2256 }, { 178922, -18548, -2256 },
            { 178620, -18730, -2256 }, { 178654, -18517, -2256 },
            { 178858, -18996, -2256 }, { 178417, -18595, -2256 },
            { 178731, -18159, -2224 }, { 178058, -18041, -2224 },
            { 178134, -17738, -2224 }, { 178750, -17810, -2224 },
            { 178957, -17509, -2224 }, { 178757, -17304, -2224 },
            { 178999, -17166, -2224 }, { 178875, -17009, -2224 },
            { 179082, -16850, -2224 }, { 178863, -16595, -2224 },
            { 178585, -16812, -2224 }, { 178342, -16640, -2224 }
        }
    };
    
    /*
     * Second room information, null if room not spawned
     * Skill is casted on the boss when all mobs are defeated
     * Default: 5700 (decrease mdef)
     *
     * npcId, skillId, skillLvl
     */
    private static final int[][] SECOND_ROOM =
    {
        { 22856, 5699, 1 }
    };
    
    /*
     * Spawns for second room, null if room not spawned
     *
     * x, y, z
     */
    private static final int[][][] SECOND_ROOM_SPAWNS =
    {    
        {
            { 178078, -16888, -2224 }, { 177899, -16615, -2224 },
            { 177680, -16928, -2224 }, { 177516, -16607, -2224 },
            { 177334, -16836, -2224 }, { 177209, -17060, -2224 },
            { 177234, -17374, -2224 }, { 177321, -17712, -2224 },
            { 177524, -17191, -2224 }, { 177850, -17190, -2224 },
            { 178136, -17279, -2224 }, { 178035, -17408, -2224 },
            { 177669, -17389, -2224 }, { 177518, -17596, -2224 },
            { 177492, -17859, -2224 }, { 177657, -17764, -2224 },
            { 177856, -17560, -2224 }, { 177803, -17919, -2224 },
            { 178019, -17759, -2224 }, { 178098, -17986, -2224 },
            { 178347, -18052, -2224 }, { 177927, -16789, -2224 }
        }
    };
    
    // miniboss info
    // skill is casted on the boss when miniboss is defeated
    // npcId, x, y, z, skill id, skill level
    /*
     * Miniboss information, null if miniboss not spawned
     * Skill is casted on the boss when miniboss is defeated
     * Default: 5701 (decrease patk)
     *
     * npcId, x, y, z, skillId, skillLvl
     */
    private static final int[][] MINIBOSS =
    {
        { 10156, 178325, -17779, -2200, 5701, 1 }
    };
    
    /*
     * Bosses of the BloodRun
     * Instance ends when boss is defeated
     *
     * npcId, x, y, z
     */
    private static final int[][] BOSS =
    {
        { 10000, 178310, -17489, -2200 },
    };
    
    /*
     * Escape telepoters spawns, null if not spawned
     *
     * x, y, z
     */
    private static final int[][] TELEPORTERS =
    {
        null, null,
    };
    
    /*
     * Escape teleporter npcId
     */
    private static final int TELEPORTER = 32496;

    /*
     * BloodRun captains (start npc's) npcIds.
     */
    private static final int[] CAPTAINS =
    { 500 };
    
    //@formatter:on
    
    protected class BloodWorld extends InstanceWorld
    {
        public int index; // 0-18 index of the Blood type in arrays
        public int shaman = 0; // objectId of the shaman
        public List<L2Spawn> firstRoom; // list of the spawns in the first room (excluding shaman)
        public List<Integer> secondRoom;// list of objectIds mobs in the second room
        public int miniBoss = 0; // objectId of the miniboss
        public L2Npc boss = null; // boss
    }
    
    public BloodRun()
    {
        super(BloodRun.class.getSimpleName());
        addFirstTalkId(TELEPORTER);
        addTalkId(TELEPORTER);
        addStartNpc(CAPTAINS);
        addTalkId(CAPTAINS);
        
        for (int[] mob : FIRST_ROOM)
        {
            if (mob != null)
            {
                if (STEALTH_SHAMAN)
                {
                    addKillId(mob[1]);
                }
                else
                {
                    addKillId(mob[0]);
                }
            }
        }
        for (int[] mob : SECOND_ROOM)
        {
            if (mob != null)
            {
                addKillId(mob[0]);
            }
        }
        for (int[] mob : MINIBOSS)
        {
            if (mob != null)
            {
                addKillId(mob[0]);
            }
        }
        for (int[] mob : BOSS)
        {
            addKillId(mob[0]);
        }
    }
    
    /**
     * Check if party with player as leader allowed to enter
     * @param player party leader
     * @param index (0-18) index of the BloodRun in arrays
     * @return true if party allowed to enter
     */
    private static final boolean checkPartyConditions(L2PcInstance player, int index)
    {
        if (player.isGM())
        {
            return true;
        }
        
        final L2Party party = player.getParty();
        // player must be in party
        if (party == null)
        {
            player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER);
            return false;
        }
        // ...and be party leader
        if (party.getLeader() != player)
        {
            player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER);
            return false;
        }
        // party must not exceed max size for selected instance
        if (party.getMemberCount() > MAX_PARTY_SIZE[index])
        {
            player.sendPacket(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER);
            return false;
        }
        
        // get level of the instance
        final int level = LEVEL[index];
        // and client name
        final String instanceName = InstanceManager.getInstance().getInstanceIdName(TEMPLATE_IDS[index]);
        
        Map<Integer, Long> instanceTimes;
        // for each party member
        for (L2PcInstance partyMember : party.getMembers())
        {
            // player level must be in range
            if (Math.abs(partyMember.getLevel() - level) > MAX_LEVEL_DIFFERENCE)
            {
                SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED);
                sm.addPcName(partyMember);
                player.sendPacket(sm);
                return false;
            }
            // player must be near party leader
            if (!partyMember.isInsideRadius(player, 1000, true, true))
            {
                SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
                sm.addPcName(partyMember);
                player.sendPacket(sm);
                return false;
            }
            // get instances reenter times for player
            instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(partyMember.getObjectId());
            if (instanceTimes != null)
            {
                for (int id : instanceTimes.keySet())
                {
                    // find instance with same name (BloodRun or labyrinth)
                    // TODO: Zoey76: Don't use instance name, use other system.
                    if (!instanceName.equals(InstanceManager.getInstance().getInstanceIdName(id)))
                    {
                        continue;
                    }
                    // if found instance still can't be reentered - exit
                    if (System.currentTimeMillis() < instanceTimes.get(id))
                    {
                        SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET);
                        sm.addPcName(partyMember);
                        player.sendPacket(sm);
                        return false;
                    }
                }
            }
        }
        return true;
    }


    /**
     * Removing all buffs from player and pet except BUFFS_WHITELIST
     * @param ch player
     */
    private static final void removeBuffs(L2Character ch)
    {
        for (L2Effect e : ch.getEffectList().getEffects())
        {
            if (e == null)
            {
                continue;
            }
            L2Skill skill = e.getSkill();
            if (skill.isDebuff() || skill.isStayAfterDeath())
            {
                continue;
            }
            if (Arrays.binarySearch(BUFFS_WHITELIST, skill.getId()) >= 0)
            {
                continue;
            }
            e.exit();
        }
        if (ch.getSummon() != null)
        {
            for (L2Effect e : ch.getSummon().getEffectList().getEffects())
            {
                if (e == null)
                {
                    continue;
                }
                L2Skill skill = e.getSkill();
                if (skill.isDebuff() || skill.isStayAfterDeath())
                {
                    continue;
                }
                if (Arrays.binarySearch(BUFFS_WHITELIST, skill.getId()) >= 0)
                {
                    continue;
                }
                e.exit();
            }
        }
    }
    
    /**
     * Handling enter of the players into BloodRun
     * @param player party leader
     * @param index (0-18) BloodRun index in arrays
     */
    private final synchronized void enterInstance(L2PcInstance player, int index)
    {
        int templateId = TEMPLATE_IDS[index];
        // check for existing instances for this player
        InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
        // player already in the instance
        if (world != null)
        {
            // but not in BloodRun
            if (!(world instanceof BloodWorld) || (world.getTemplateId() != templateId))
            {
                player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
                return;
            }
            // check for level difference again on reenter
            if (Math.abs(player.getLevel() - LEVEL[((BloodWorld) world).index]) > MAX_LEVEL_DIFFERENCE)
            {
                SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED);
                sm.addPcName(player);
                player.sendPacket(sm);
                return;
            }
            // check what instance still exist
            Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
            if (inst != null)
            {
                removeBuffs(player);
                teleportPlayer(player, TELEPORTS[index], world.getInstanceId());
                world.addAllowed(player.getObjectId());
            }
            return;
        }
        // Creating new BloodRun instance
        if (!checkPartyConditions(player, index))
        {
            return;
        }
        
        // Creating dynamic instance without template
        final int instanceId = InstanceManager.getInstance().createDynamicInstance(null);
        final Instance inst = InstanceManager.getInstance().getInstance(instanceId);
        // set name for the BloodRun
        inst.setName(InstanceManager.getInstance().getInstanceIdName(templateId));
        // set return location
        inst.setExitLoc(new Location(player));
        // disable summon friend into instance
        inst.setAllowSummon(false);
        // set duration and empty destroy time
        inst.setDuration(DURATION[index] * 60000);
        inst.setEmptyDestroyTime(EMPTY_DESTROY_TIME * 60000);
        
        // Creating new instanceWorld, using our instanceId and templateId
        world = new BloodWorld();
        world.setInstanceId(instanceId);
        world.setTemplateId(templateId);
        // set index for easy access to the arrays
        ((BloodWorld) world).index = index;
        InstanceManager.getInstance().addWorld(world);
        world.setStatus(0);
        // spawn npcs
        spawnBlood((BloodWorld) world);
        
        if (player.isGM())
        {
            world.addAllowed(player.getObjectId());
            teleportPlayer(player, TELEPORTS[index], instanceId);
        }
        else
        {
            // and finally teleport party into instance
            final L2Party party = player.getParty();
            for (L2PcInstance partyMember : party.getMembers())
            {
                world.addAllowed(partyMember.getObjectId());
                
                teleportPlayer(partyMember, TELEPORTS[index], instanceId);
            }
        }
        return;
    }
    
    /**
     * Called on instance finish and handles reenter time for instance
     * @param world instanceWorld
     */
    @Override
    protected final void finishInstance(InstanceWorld world)
    {
        if (world instanceof BloodWorld)
        {
            Calendar reenter = Calendar.getInstance();
            reenter.set(Calendar.MINUTE, RESET_MIN);
            // if time is >= RESET_HOUR - roll to the next day
            if (reenter.get(Calendar.HOUR_OF_DAY) >= RESET_HOUR)
            {
                reenter.add(Calendar.DATE, 1);
            }
            reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
            
            SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_FROM_HERE_S1_S_ENTRY_HAS_BEEN_RESTRICTED);
            sm.addInstanceName(world.getTemplateId());
            
            // set instance reenter time for all allowed players
            for (int objectId : world.getAllowed())
            {
                L2PcInstance obj = L2World.getInstance().getPlayer(objectId);
                if ((obj != null) && obj.isOnline())
                {
                    InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis());
                    obj.sendPacket(sm);
                }
            }
            
            // destroy instance after EXIT_TIME
            Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
            inst.setDuration(EXIT_TIME * 60000);
            inst.setEmptyDestroyTime(0);
        }
    }
    
    /**
     * Spawn all NPCs in BloodRun
     * @param world instanceWorld
     */
    private final void spawnBlood(BloodWorld world)
    {
        int[] npcs;
        int[][] spawns;
        L2Npc npc;
        final int index = world.index;
        
        // first room
        npcs = FIRST_ROOM[index];
        spawns = FIRST_ROOM_SPAWNS[index];
        if (npcs != null)
        {
            world.firstRoom = new ArrayList<>(spawns.length - 1);
            int shaman = getRandom(spawns.length); // random position for shaman
            
            for (int i = 0; i < spawns.length; i++)
            {
                if (i == shaman)
                {
                    // stealth shaman use same npcId as other mobs
                    npc = addSpawn(STEALTH_SHAMAN ? npcs[1] : npcs[0], spawns[i][0], spawns[i][1], spawns[i][2], 0, false, 0, false, world.getInstanceId());
                    world.shaman = npc.getObjectId();
                }
                else
                {
                    npc = addSpawn(npcs[1], spawns[i][0], spawns[i][1], spawns[i][2], 0, false, 0, false, world.getInstanceId());
                    L2Spawn spawn = npc.getSpawn();
                    spawn.setRespawnDelay(FIRST_ROOM_RESPAWN_DELAY);
                    spawn.setAmount(1);
                    spawn.startRespawn();
                    world.firstRoom.add(spawn); // store mobs spawns
                }
                npc.setIsNoRndWalk(true);
            }
        }
        
        // second room
        npcs = SECOND_ROOM[index];
        spawns = SECOND_ROOM_SPAWNS[index];
        if (npcs != null)
        {
            world.secondRoom = new ArrayList<>(spawns.length);
            
            for (int[] spawn : spawns)
            {
                npc = addSpawn(npcs[0], spawn[0], spawn[1], spawn[2], 0, false, 0, false, world.getInstanceId());
                npc.setIsNoRndWalk(true);
                world.secondRoom.add(npc.getObjectId());
            }
        }
        
        // miniboss
        if (MINIBOSS[index] != null)
        {
            npc = addSpawn(MINIBOSS[index][0], MINIBOSS[index][1], MINIBOSS[index][2], MINIBOSS[index][3], 0, false, 0, false, world.getInstanceId());
            npc.setIsNoRndWalk(true);
            world.miniBoss = npc.getObjectId();
        }
        
        // escape teleporter
        if (TELEPORTERS[index] != null)
        {
            addSpawn(TELEPORTER, TELEPORTERS[index][0], TELEPORTERS[index][1], TELEPORTERS[index][2], 0, false, 0, false, world.getInstanceId());
        }
        
        // boss
        world.boss = addSpawn(BOSS[index][0], BOSS[index][1], BOSS[index][2], BOSS[index][3], 0, false, 0, false, world.getInstanceId());
    }
    
    /**
     * Handles only player's enter, single parameter - integer BloodRun index
     */
    @Override
    public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
    {
        enterInstance(player, Integer.parseInt(event));
        return "";
    }
    
    /**
     * Talk with captains and using of the escape teleporter
     */
    @Override
    public final String onTalk(L2Npc npc, L2PcInstance player)
    {
        final int npcId = npc.getId();
        if (npcId == TELEPORTER)
        {
            final L2Party party = player.getParty();
            // only party leader can talk with escape teleporter
            if ((party != null) && party.isLeader(player))
            {
                final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
                if (world instanceof BloodWorld)
                {
                    // party members must be in the instance
                    if (world.isAllowed(player.getObjectId()))
                    {
                        Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
                        
                        // teleports entire party away
                        for (L2PcInstance partyMember : party.getMembers())
                        {
                            if ((partyMember != null) && (partyMember.getInstanceId() == world.getInstanceId()))
                            {
                                teleportPlayer(partyMember, inst.getExitLoc(), 0);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            return npcId + ".htm";
        }
        
        return "";
    }
    
    /**
     * Only escape teleporters first talk handled
     */
    @Override
    public final String onFirstTalk(L2Npc npc, L2PcInstance player)
    {
        if (npc.getId() == TELEPORTER)
        {
            if (player.isGM())
            {
                return "32496.htm";
            }
            
            if (player.isInParty() && player.getParty().isLeader(player))
            {
                return "32496.htm";
            }
            return "32496-no.htm";
        }
        return "";
    }
    
    @Override
    public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
    {
        final InstanceWorld tmpWorld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
        if (tmpWorld instanceof BloodWorld)
        {
            final BloodWorld world = (BloodWorld) tmpWorld;
            final int objectId = npc.getObjectId();
            
            // first room was spawned ?
            if (world.firstRoom != null)
            {
                // is shaman killed ?
                if ((world.shaman != 0) && (world.shaman == objectId))
                {
                    world.shaman = 0;
                    // stop respawn of the minions
                    for (L2Spawn spawn : world.firstRoom)
                    {
                        if (spawn != null)
                        {
                            spawn.stopRespawn();
                        }
                    }
                    world.firstRoom.clear();
                    world.firstRoom = null;
                    
                    if (world.boss != null)
                    {
                        final int skillId = FIRST_ROOM[world.index][2];
                        final int skillLvl = FIRST_ROOM[world.index][3];
                        if ((skillId != 0) && (skillLvl != 0))
                        {
                            final L2Skill skill = SkillData.getInstance().getInfo(skillId, skillLvl);
                            if (skill != null)
                            {
                                skill.getEffects(world.boss, world.boss);
                            }
                        }
                    }
                    
                    return super.onKill(npc, player, isSummon);
                }
            }
            
            // second room was spawned ?
            if (world.secondRoom != null)
            {
                boolean all = true;
                // check for all mobs in the second room
                for (int i = 0; i < world.secondRoom.size(); i++)
                {
                    // found killed now mob
                    if (world.secondRoom.get(i) == objectId)
                    {
                        world.secondRoom.set(i, 0);
                    }
                    else if (world.secondRoom.get(i) != 0)
                    {
                        all = false;
                    }
                }
                // all mobs killed ?
                if (all)
                {
                    world.secondRoom.clear();
                    world.secondRoom = null;
                    
                    if (world.boss != null)
                    {
                        final int skillId = SECOND_ROOM[world.index][1];
                        final int skillLvl = SECOND_ROOM[world.index][2];
                        if ((skillId != 0) && (skillLvl != 0))
                        {
                            final L2Skill skill = SkillData.getInstance().getInfo(skillId, skillLvl);
                            if (skill != null)
                            {
                                skill.getEffects(world.boss, world.boss);
                            }
                        }
                    }
                    
                    return super.onKill(npc, player, isSummon);
                }
            }
            
            // miniboss spawned ?
            if ((world.miniBoss != 0) && (world.miniBoss == objectId))
            {
                world.miniBoss = 0;
                
                if (world.boss != null)
                {
                    final int skillId = MINIBOSS[world.index][4];
                    final int skillLvl = MINIBOSS[world.index][5];
                    if ((skillId != 0) && (skillLvl != 0))
                    {
                        final L2Skill skill = SkillData.getInstance().getInfo(skillId, skillLvl);
                        if (skill != null)
                        {
                            skill.getEffects(world.boss, world.boss);
                            

                        }
                    }
                }
                
                return super.onKill(npc, player, isSummon);
            }
            
            // boss was killed, finish instance
            if ((world.boss != null) && (world.boss == npc))
            {
                world.boss = null;
                finishInstance(world);
            }
        }
        return super.onKill(npc, player, isSummon);
    }
    
    @Override
    public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
    {    
    if (firstEntrance)
        {
            world.addAllowed(player.getObjectId());
        }
    }
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • hello everyone! I am wanting to save the files (Ini. - Data - ) of the EP5 Client: Salvation... But they generate the error "corrupt files"... I tried several versions of L2FileEditor without good results. I need help! Thank you!
    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...