Re-addition of Sel Mahum AIs.

This commit is contained in:
MobiusDev
2018-05-21 22:24:38 +00:00
parent 29603cb853
commit ebf1e85cce
35 changed files with 4191 additions and 0 deletions

View File

@ -38,6 +38,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;
@ -382,6 +384,9 @@ public final class WalkingManager implements IGameXmlReader
return;
}
// Notify quest
EventDispatcher.getInstance().notifyEventAsync(new OnNpcMoveNodeArrived(npc), npc);
final WalkInfo walk = _activeRoutes.get(npc.getObjectId());
// Opposite should not happen... but happens sometime
if ((walk.getCurrentNodeId() < 0) || (walk.getCurrentNodeId() >= walk.getRoute().getNodesCount()))

View File

@ -72,6 +72,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcCreatureSee
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;
@ -665,6 +666,30 @@ public abstract class AbstractScript extends ManagedScript
// ---------------------------------------------------------------------------------------------------------------------------
/**
* 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

View File

@ -34,6 +34,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcEventReceiv
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.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;
@ -152,6 +153,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),

View File

@ -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;
}
}

View File

@ -917,6 +917,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
*/
@ -1325,6 +1340,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
@ -2023,6 +2046,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