Moved spawnGroup method from AbstractInstance to InstanceWorld.

This commit is contained in:
MobiusDev
2018-04-29 23:32:51 +00:00
parent f4b9533ef2
commit 0d9dc852ad
3 changed files with 15 additions and 17 deletions

View File

@@ -24,7 +24,6 @@ import com.l2jmobius.Config;
import com.l2jmobius.gameserver.enums.InstanceReenterType; import com.l2jmobius.gameserver.enums.InstanceReenterType;
import com.l2jmobius.gameserver.instancemanager.InstanceManager; import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.InstanceReenterTimeHolder; import com.l2jmobius.gameserver.model.holders.InstanceReenterTimeHolder;
@@ -183,17 +182,6 @@ public abstract class AbstractInstance extends AbstractNpcAI
return true; return true;
} }
/**
* Spawns group of instance NPCs
* @param groupName the name of group from XML definition to spawn
* @param instanceId the instance ID
* @return list of spawned NPCs
*/
protected List<L2Npc> spawnGroup(String groupName, int instanceId)
{
return InstanceManager.getInstance().getInstance(instanceId).spawnGroup(groupName);
}
/** /**
* Sets reenter time for every player in the instance. * Sets reenter time for every player in the instance.
* @param world the instance * @param world the instance

View File

@@ -84,7 +84,7 @@ public final class SSQSanctumOfTheLordsOfDawn extends AbstractInstance
final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if (world != null) if (world != null)
{ {
spawnGroup("high_priest_of_dawn", world.getInstanceId()); world.spawnGroup("high_priest_of_dawn");
player.sendPacket(SystemMessageId.BY_USING_THE_SKILL_OF_EINHASAD_S_HOLY_SWORD_DEFEAT_THE_EVIL_LILIMS); player.sendPacket(SystemMessageId.BY_USING_THE_SKILL_OF_EINHASAD_S_HOLY_SWORD_DEFEAT_THE_EVIL_LILIMS);
} }
break; break;
@@ -170,10 +170,10 @@ public final class SSQSanctumOfTheLordsOfDawn extends AbstractInstance
if (firstEntrance) if (firstEntrance)
{ {
world.addAllowed(player.getObjectId()); world.addAllowed(player.getObjectId());
world.setParameter("save_point1", spawnGroup("save_point1", world.getInstanceId())); world.setParameter("save_point1", world.spawnGroup("save_point1"));
world.setParameter("save_point2", spawnGroup("save_point2", world.getInstanceId())); world.setParameter("save_point2", world.spawnGroup("save_point2"));
world.setParameter("save_point3", spawnGroup("save_point3", world.getInstanceId())); world.setParameter("save_point3", world.spawnGroup("save_point3"));
world.setParameter("save_point4", spawnGroup("save_point4", world.getInstanceId())); world.setParameter("save_point4", world.spawnGroup("save_point4"));
} }
teleportPlayer(player, ENTER, world.getInstanceId()); teleportPlayer(player, ENTER, world.getInstanceId());
} }

View File

@@ -244,4 +244,14 @@ public class InstanceWorld
{ {
return getNpcs().stream().filter(n -> n.getId() == id).findFirst().orElse(null); return getNpcs().stream().filter(n -> n.getId() == id).findFirst().orElse(null);
} }
/**
* Spawns group of instance NPCs
* @param groupName the name of group from XML definition to spawn
* @return list of spawned NPCs
*/
public List<L2Npc> spawnGroup(String groupName)
{
return _instance.spawnGroup(groupName);
}
} }