Re-addition of Sel Mahum AIs.
This commit is contained in:
@ -40,6 +40,8 @@ import com.l2jmobius.gameserver.model.WalkInfo;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.tasks.npc.walker.ArrivedTask;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMoveNodeArrived;
|
||||
import com.l2jmobius.gameserver.model.holders.NpcRoutesHolder;
|
||||
import com.l2jmobius.gameserver.network.NpcStringId;
|
||||
|
||||
@ -421,6 +423,9 @@ public final class WalkingManager implements IGameXmlReader
|
||||
{
|
||||
if (_activeRoutes.containsKey(npc.getObjectId()))
|
||||
{
|
||||
// Notify quest
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcMoveNodeArrived(npc), npc);
|
||||
|
||||
final WalkInfo walk = _activeRoutes.get(npc.getObjectId());
|
||||
|
||||
// Opposite should not happen... but happens sometime
|
||||
|
@ -89,6 +89,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcDespawn;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcEventReceived;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcFirstTalk;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMoveFinished;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMoveNodeArrived;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMoveRouteFinished;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSkillFinished;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSkillSee;
|
||||
@ -806,6 +807,30 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Provides instant callback operation when {@link L2Npc} arrive to node of its route
|
||||
* @param callback
|
||||
* @param npcIds
|
||||
* @return
|
||||
*/
|
||||
protected final List<AbstractEventListener> setNpcMoveNodeArrivedId(Consumer<OnNpcMoveNodeArrived> callback, int... npcIds)
|
||||
{
|
||||
return registerConsumer(callback, EventType.ON_NPC_MOVE_NODE_ARRIVED, ListenerRegisterType.NPC, npcIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides instant callback operation when {@link L2Npc} arrive to node of its route
|
||||
* @param callback
|
||||
* @param npcIds
|
||||
* @return
|
||||
*/
|
||||
protected final List<AbstractEventListener> setNpcMoveNodeArrivedId(Consumer<OnNpcMoveNodeArrived> callback, Collection<Integer> npcIds)
|
||||
{
|
||||
return registerConsumer(callback, EventType.ON_NPC_MOVE_NODE_ARRIVED, ListenerRegisterType.NPC, npcIds);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Provides instant callback operation when {@link L2Npc} finishes to move on its route.
|
||||
* @param callback
|
||||
|
@ -48,6 +48,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcFirstTalk;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcManorBypass;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMenuSelect;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMoveFinished;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMoveNodeArrived;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMoveRouteFinished;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSkillFinished;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSkillSee;
|
||||
@ -187,6 +188,7 @@ public enum EventType
|
||||
ON_NPC_FIRST_TALK(OnNpcFirstTalk.class, void.class),
|
||||
ON_NPC_HATE(OnAttackableHate.class, void.class, TerminateReturn.class),
|
||||
ON_NPC_MOVE_FINISHED(OnNpcMoveFinished.class, void.class),
|
||||
ON_NPC_MOVE_NODE_ARRIVED(OnNpcMoveNodeArrived.class, void.class),
|
||||
ON_NPC_MOVE_ROUTE_FINISHED(OnNpcMoveRouteFinished.class, void.class),
|
||||
ON_NPC_QUEST_START(null, void.class),
|
||||
ON_NPC_SKILL_FINISHED(OnNpcSkillFinished.class, void.class),
|
||||
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model.events.impl.character.npc;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.events.EventType;
|
||||
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class OnNpcMoveNodeArrived implements IBaseEvent
|
||||
{
|
||||
private final L2Npc _npc;
|
||||
|
||||
public OnNpcMoveNodeArrived(L2Npc npc)
|
||||
{
|
||||
_npc = npc;
|
||||
}
|
||||
|
||||
public L2Npc getNpc()
|
||||
{
|
||||
return _npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventType getType()
|
||||
{
|
||||
return EventType.ON_NPC_MOVE_NODE_ARRIVED;
|
||||
}
|
||||
}
|
@ -953,6 +953,21 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npc
|
||||
*/
|
||||
public final void notifyNodeArrived(L2Npc npc)
|
||||
{
|
||||
try
|
||||
{
|
||||
onNodeArrived(npc);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Exception on onNodeArrived() in notifyNodeArrived(): " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npc
|
||||
*/
|
||||
@ -1392,6 +1407,14 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called whenever a walker NPC (controlled by WalkingManager) arrive a walking node
|
||||
* @param npc registered NPC
|
||||
*/
|
||||
public void onNodeArrived(L2Npc npc)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called whenever a walker NPC (controlled by WalkingManager) arrive to last node
|
||||
* @param npc registered NPC
|
||||
@ -2202,6 +2225,24 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
setNpcMoveFinishedId(event -> notifyMoveFinished(event.getNpc()), npcIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register onNodeArrived trigger for NPC
|
||||
* @param npcIds the IDs of the NPCs to register
|
||||
*/
|
||||
public void addNodeArrivedId(int... npcIds)
|
||||
{
|
||||
setNpcMoveNodeArrivedId(event -> notifyNodeArrived(event.getNpc()), npcIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register onNodeArrived trigger for NPC
|
||||
* @param npcIds the IDs of the NPCs to register
|
||||
*/
|
||||
public void addNodeArrivedId(Collection<Integer> npcIds)
|
||||
{
|
||||
setNpcMoveNodeArrivedId(event -> notifyNodeArrived(event.getNpc()), npcIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register onRouteFinished trigger for NPC
|
||||
* @param npcIds the IDs of the NPCs to register
|
||||
|
Reference in New Issue
Block a user