Proper listeners for agathion summoning.
This commit is contained in:
@ -101,7 +101,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionCancel;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonAgathion;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||
@ -1507,13 +1506,6 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
||||
return registerConsumer(callback, EventType.ON_INSTANCE_STATUS_CHANGE, ListenerRegisterType.INSTANCE, templateIds);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
protected final List<AbstractEventListener> setPlayerSummonAgathion(Consumer<OnPlayerSummonAgathion> callback)
|
||||
{
|
||||
return registerConsumer(callback, EventType.ON_PLAYER_SUMMON_AGATHION, ListenerRegisterType.GLOBAL);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
// --------------------------------Default listener register methods---------------------------------
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
|
@ -111,6 +111,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummo
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonTalk;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerTransform;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerUnsummonAgathion;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnTrapAction;
|
||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarFinish;
|
||||
import com.l2jmobius.gameserver.model.events.impl.clan.OnClanWarStart;
|
||||
@ -272,6 +273,7 @@ public enum EventType
|
||||
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),
|
||||
ON_PLAYER_QUEST_COMPLETE(OnPlayerQuestComplete.class, void.class),
|
||||
ON_PLAYER_SUMMON_AGATHION(OnPlayerSummonAgathion.class, void.class),
|
||||
ON_PLAYER_UNSUMMON_AGATHION(OnPlayerUnsummonAgathion.class, void.class),
|
||||
|
||||
// Trap events
|
||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.player;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventType;
|
||||
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class OnPlayerUnsummonAgathion implements IBaseEvent
|
||||
{
|
||||
private final L2PcInstance _player;
|
||||
private final int _agathionId;
|
||||
|
||||
public OnPlayerUnsummonAgathion(L2PcInstance player, int agathionId)
|
||||
{
|
||||
_player = player;
|
||||
_agathionId = agathionId;
|
||||
}
|
||||
|
||||
public L2PcInstance getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public int getAgathionId()
|
||||
{
|
||||
return _agathionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventType getType()
|
||||
{
|
||||
return EventType.ON_PLAYER_UNSUMMON_AGATHION;
|
||||
}
|
||||
}
|
@ -1002,19 +1002,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
return false;
|
||||
}
|
||||
|
||||
public final void notifySummonAgathion(L2PcInstance player, int npcId)
|
||||
{
|
||||
try
|
||||
{
|
||||
onSummonAgathion(player, npcId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Exception on onSummonAgathion() in notifySummonAgathion(): " + e.getMessage(), e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// These are methods that java calls to invoke scripts.
|
||||
|
||||
/**
|
||||
@ -1497,10 +1484,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
{
|
||||
}
|
||||
|
||||
public void onSummonAgathion(L2PcInstance player, int agathionId)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npc
|
||||
* @param player
|
||||
@ -2415,11 +2398,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
setInstanceLeaveId(event -> onInstanceLeave(event.getPlayer(), event.getInstanceWorld()), templateIds);
|
||||
}
|
||||
|
||||
public void addSummonAgathion()
|
||||
{
|
||||
setPlayerSummonAgathion(event -> notifySummonAgathion(event.getPlayer(), event.getAgathionId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to get a random party member from a player's party.<br>
|
||||
* Useful when distributing rewards after killing an NPC.
|
||||
|
Reference in New Issue
Block a user