New approach for spawning minions.

This commit is contained in:
MobiusDev
2018-04-28 14:58:54 +00:00
parent 68ad48105f
commit c4b4ec5751
39 changed files with 534 additions and 3467 deletions

View File

@@ -1,50 +0,0 @@
/*
* 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 ai.others.Spawns;
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import ai.AbstractNpcAI;
/**
* Spawn AI for monsters that spawn minions.
* @author Mobius
*/
public final class MonstersWithMinionSpawns extends AbstractNpcAI
{
private MonstersWithMinionSpawns()
{
addSpawnId(NpcData.getMasterMonsterIDs());
}
@Override
public String onSpawn(L2Npc npc)
{
if (npc.isMonster())
{
((L2MonsterInstance) npc).getMinionList().spawnMinions(npc.getParameters().getMinionList("Privates"));
}
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new MonstersWithMinionSpawns();
}
}

View File

@@ -29,6 +29,7 @@ import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
@@ -589,6 +590,13 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
_spawnedNpcs.add(npc);
_currentCount++;
// Minions
if (npc.isMonster() && NpcData.getMasterMonsterIDs().contains(npc.getId()))
{
((L2MonsterInstance) npc).getMinionList().spawnMinions(npc.getParameters().getMinionList("Privates"));
}
return npc;
}