Fix for pomanders on profession cancel.
This commit is contained in:
parent
b224d80373
commit
8fcb49c449
@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn;
|
|||||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||||
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
@ -51,11 +54,9 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
private SkillTransfer()
|
private SkillTransfer()
|
||||||
{
|
{
|
||||||
setPlayerProfessionChangeId(this::onProfessionChange);
|
setPlayerProfessionChangeId(this::onProfessionChange);
|
||||||
if (Config.SKILL_CHECK_ENABLE)
|
setPlayerProfessionCancelId(this::onProfessionCancel);
|
||||||
{
|
|
||||||
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void onProfessionChange(OnPlayerProfessionChange event)
|
public void onProfessionChange(OnPlayerProfessionChange event)
|
||||||
{
|
{
|
||||||
@ -74,6 +75,29 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onProfessionCancel(OnPlayerProfessionCancel event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getActiveChar();
|
||||||
|
final int index = getTransferClassIndex(player);
|
||||||
|
|
||||||
|
// is a transfer class
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pomanderId = PORMANDERS[index].getId();
|
||||||
|
// remove unsused HolyPomander
|
||||||
|
PcInventory inv = player.getInventory();
|
||||||
|
for (L2ItemInstance itemI : inv.getAllItemsByItemId(pomanderId))
|
||||||
|
{
|
||||||
|
inv.destroyItem("[HolyPomander - remove]", itemI, player, null);
|
||||||
|
}
|
||||||
|
// remove holy pomander variable
|
||||||
|
final String name = HOLY_POMANDER + event.getClassId();
|
||||||
|
player.getVariables().remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onEnterWorld(L2PcInstance player)
|
public String onEnterWorld(L2PcInstance player)
|
||||||
{
|
{
|
||||||
@ -110,6 +134,11 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// SkillTransfer or HolyPomander missing
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
player.getInventory().addItem("[HolyPomander - missing]", PORMANDERS[index].getId(), count, player, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onEnterWorld(player);
|
return super.onEnterWorld(player);
|
||||||
}
|
}
|
||||||
|
@ -203,6 +203,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -9685,6 +9686,10 @@ public final class L2PcInstance extends L2Playable
|
|||||||
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify to scripts
|
||||||
|
int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -97,6 +97,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSpawn;
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
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.OnPlayerSummonAgathion;
|
||||||
@ -1377,6 +1378,16 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides instant callback operation when player's cancel profession
|
||||||
|
* @param callback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected final List<AbstractEventListener> setPlayerProfessionCancelId(Consumer<OnPlayerProfessionCancel> callback)
|
||||||
|
{
|
||||||
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides instant callback operation when instance world created
|
* Provides instant callback operation when instance world created
|
||||||
* @param callback
|
* @param callback
|
||||||
|
@ -95,6 +95,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMento
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -256,6 +257,7 @@ public enum EventType
|
|||||||
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
||||||
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
||||||
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
||||||
|
ON_PLAYER_PROFESSION_CANCEL(OnPlayerProfessionCancel.class, void.class),
|
||||||
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
||||||
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
||||||
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* 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 Krunchy
|
||||||
|
* @since 2.6.0.0
|
||||||
|
*/
|
||||||
|
public class OnPlayerProfessionCancel implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _activeChar;
|
||||||
|
private final int _classId;
|
||||||
|
|
||||||
|
public OnPlayerProfessionCancel(L2PcInstance activeChar, int classId)
|
||||||
|
{
|
||||||
|
_activeChar = activeChar;
|
||||||
|
_classId = classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getActiveChar()
|
||||||
|
{
|
||||||
|
return _activeChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getClassId()
|
||||||
|
{
|
||||||
|
return _classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_PROFESSION_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn;
|
|||||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||||
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
@ -51,11 +54,9 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
private SkillTransfer()
|
private SkillTransfer()
|
||||||
{
|
{
|
||||||
setPlayerProfessionChangeId(this::onProfessionChange);
|
setPlayerProfessionChangeId(this::onProfessionChange);
|
||||||
if (Config.SKILL_CHECK_ENABLE)
|
setPlayerProfessionCancelId(this::onProfessionCancel);
|
||||||
{
|
|
||||||
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void onProfessionChange(OnPlayerProfessionChange event)
|
public void onProfessionChange(OnPlayerProfessionChange event)
|
||||||
{
|
{
|
||||||
@ -74,6 +75,29 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onProfessionCancel(OnPlayerProfessionCancel event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getActiveChar();
|
||||||
|
final int index = getTransferClassIndex(player);
|
||||||
|
|
||||||
|
// is a transfer class
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pomanderId = PORMANDERS[index].getId();
|
||||||
|
// remove unsused HolyPomander
|
||||||
|
PcInventory inv = player.getInventory();
|
||||||
|
for (L2ItemInstance itemI : inv.getAllItemsByItemId(pomanderId))
|
||||||
|
{
|
||||||
|
inv.destroyItem("[HolyPomander - remove]", itemI, player, null);
|
||||||
|
}
|
||||||
|
// remove holy pomander variable
|
||||||
|
final String name = HOLY_POMANDER + event.getClassId();
|
||||||
|
player.getVariables().remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onEnterWorld(L2PcInstance player)
|
public String onEnterWorld(L2PcInstance player)
|
||||||
{
|
{
|
||||||
@ -110,6 +134,11 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// SkillTransfer or HolyPomander missing
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
player.getInventory().addItem("[HolyPomander - missing]", PORMANDERS[index].getId(), count, player, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onEnterWorld(player);
|
return super.onEnterWorld(player);
|
||||||
}
|
}
|
||||||
|
@ -204,6 +204,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -9692,6 +9693,10 @@ public final class L2PcInstance extends L2Playable
|
|||||||
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify to scripts
|
||||||
|
int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -97,6 +97,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSpawn;
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
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.OnPlayerSummonAgathion;
|
||||||
@ -1377,6 +1378,16 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides instant callback operation when player's cancel profession
|
||||||
|
* @param callback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected final List<AbstractEventListener> setPlayerProfessionCancelId(Consumer<OnPlayerProfessionCancel> callback)
|
||||||
|
{
|
||||||
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides instant callback operation when instance world created
|
* Provides instant callback operation when instance world created
|
||||||
* @param callback
|
* @param callback
|
||||||
|
@ -95,6 +95,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMento
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -256,6 +257,7 @@ public enum EventType
|
|||||||
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
||||||
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
||||||
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
||||||
|
ON_PLAYER_PROFESSION_CANCEL(OnPlayerProfessionCancel.class, void.class),
|
||||||
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
||||||
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
||||||
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* 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 Krunchy
|
||||||
|
* @since 2.6.0.0
|
||||||
|
*/
|
||||||
|
public class OnPlayerProfessionCancel implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _activeChar;
|
||||||
|
private final int _classId;
|
||||||
|
|
||||||
|
public OnPlayerProfessionCancel(L2PcInstance activeChar, int classId)
|
||||||
|
{
|
||||||
|
_activeChar = activeChar;
|
||||||
|
_classId = classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getActiveChar()
|
||||||
|
{
|
||||||
|
return _activeChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getClassId()
|
||||||
|
{
|
||||||
|
return _classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_PROFESSION_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn;
|
|||||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||||
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
@ -51,11 +54,9 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
private SkillTransfer()
|
private SkillTransfer()
|
||||||
{
|
{
|
||||||
setPlayerProfessionChangeId(this::onProfessionChange);
|
setPlayerProfessionChangeId(this::onProfessionChange);
|
||||||
if (Config.SKILL_CHECK_ENABLE)
|
setPlayerProfessionCancelId(this::onProfessionCancel);
|
||||||
{
|
|
||||||
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void onProfessionChange(OnPlayerProfessionChange event)
|
public void onProfessionChange(OnPlayerProfessionChange event)
|
||||||
{
|
{
|
||||||
@ -74,6 +75,29 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onProfessionCancel(OnPlayerProfessionCancel event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getActiveChar();
|
||||||
|
final int index = getTransferClassIndex(player);
|
||||||
|
|
||||||
|
// is a transfer class
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pomanderId = PORMANDERS[index].getId();
|
||||||
|
// remove unsused HolyPomander
|
||||||
|
PcInventory inv = player.getInventory();
|
||||||
|
for (L2ItemInstance itemI : inv.getAllItemsByItemId(pomanderId))
|
||||||
|
{
|
||||||
|
inv.destroyItem("[HolyPomander - remove]", itemI, player, null);
|
||||||
|
}
|
||||||
|
// remove holy pomander variable
|
||||||
|
final String name = HOLY_POMANDER + event.getClassId();
|
||||||
|
player.getVariables().remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onEnterWorld(L2PcInstance player)
|
public String onEnterWorld(L2PcInstance player)
|
||||||
{
|
{
|
||||||
@ -110,6 +134,11 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// SkillTransfer or HolyPomander missing
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
player.getInventory().addItem("[HolyPomander - missing]", PORMANDERS[index].getId(), count, player, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onEnterWorld(player);
|
return super.onEnterWorld(player);
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -9702,6 +9703,10 @@ public final class L2PcInstance extends L2Playable
|
|||||||
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify to scripts
|
||||||
|
int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -98,6 +98,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSpawn;
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
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.OnPlayerSummonAgathion;
|
||||||
@ -1378,6 +1379,16 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides instant callback operation when player's cancel profession
|
||||||
|
* @param callback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected final List<AbstractEventListener> setPlayerProfessionCancelId(Consumer<OnPlayerProfessionCancel> callback)
|
||||||
|
{
|
||||||
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides instant callback operation when instance world created
|
* Provides instant callback operation when instance world created
|
||||||
* @param callback
|
* @param callback
|
||||||
|
@ -95,6 +95,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMento
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -256,6 +257,7 @@ public enum EventType
|
|||||||
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
||||||
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
||||||
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
||||||
|
ON_PLAYER_PROFESSION_CANCEL(OnPlayerProfessionCancel.class, void.class),
|
||||||
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
||||||
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
||||||
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* 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 Krunchy
|
||||||
|
* @since 2.6.0.0
|
||||||
|
*/
|
||||||
|
public class OnPlayerProfessionCancel implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _activeChar;
|
||||||
|
private final int _classId;
|
||||||
|
|
||||||
|
public OnPlayerProfessionCancel(L2PcInstance activeChar, int classId)
|
||||||
|
{
|
||||||
|
_activeChar = activeChar;
|
||||||
|
_classId = classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getActiveChar()
|
||||||
|
{
|
||||||
|
return _activeChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getClassId()
|
||||||
|
{
|
||||||
|
return _classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_PROFESSION_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn;
|
|||||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||||
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
@ -51,11 +54,9 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
private SkillTransfer()
|
private SkillTransfer()
|
||||||
{
|
{
|
||||||
setPlayerProfessionChangeId(this::onProfessionChange);
|
setPlayerProfessionChangeId(this::onProfessionChange);
|
||||||
if (Config.SKILL_CHECK_ENABLE)
|
setPlayerProfessionCancelId(this::onProfessionCancel);
|
||||||
{
|
|
||||||
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void onProfessionChange(OnPlayerProfessionChange event)
|
public void onProfessionChange(OnPlayerProfessionChange event)
|
||||||
{
|
{
|
||||||
@ -74,6 +75,29 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onProfessionCancel(OnPlayerProfessionCancel event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getActiveChar();
|
||||||
|
final int index = getTransferClassIndex(player);
|
||||||
|
|
||||||
|
// is a transfer class
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pomanderId = PORMANDERS[index].getId();
|
||||||
|
// remove unsused HolyPomander
|
||||||
|
PcInventory inv = player.getInventory();
|
||||||
|
for (L2ItemInstance itemI : inv.getAllItemsByItemId(pomanderId))
|
||||||
|
{
|
||||||
|
inv.destroyItem("[HolyPomander - remove]", itemI, player, null);
|
||||||
|
}
|
||||||
|
// remove holy pomander variable
|
||||||
|
final String name = HOLY_POMANDER + event.getClassId();
|
||||||
|
player.getVariables().remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onEnterWorld(L2PcInstance player)
|
public String onEnterWorld(L2PcInstance player)
|
||||||
{
|
{
|
||||||
@ -110,6 +134,11 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// SkillTransfer or HolyPomander missing
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
player.getInventory().addItem("[HolyPomander - missing]", PORMANDERS[index].getId(), count, player, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onEnterWorld(player);
|
return super.onEnterWorld(player);
|
||||||
}
|
}
|
||||||
|
@ -204,6 +204,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -9695,6 +9696,10 @@ public final class L2PcInstance extends L2Playable
|
|||||||
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify to scripts
|
||||||
|
int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -98,6 +98,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSpawn;
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
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.OnPlayerSummonAgathion;
|
||||||
@ -1378,6 +1379,16 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides instant callback operation when player's cancel profession
|
||||||
|
* @param callback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected final List<AbstractEventListener> setPlayerProfessionCancelId(Consumer<OnPlayerProfessionCancel> callback)
|
||||||
|
{
|
||||||
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides instant callback operation when instance world created
|
* Provides instant callback operation when instance world created
|
||||||
* @param callback
|
* @param callback
|
||||||
|
@ -95,6 +95,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMento
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -256,6 +257,7 @@ public enum EventType
|
|||||||
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
||||||
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
||||||
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
||||||
|
ON_PLAYER_PROFESSION_CANCEL(OnPlayerProfessionCancel.class, void.class),
|
||||||
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
||||||
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
||||||
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* 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 Krunchy
|
||||||
|
* @since 2.6.0.0
|
||||||
|
*/
|
||||||
|
public class OnPlayerProfessionCancel implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _activeChar;
|
||||||
|
private final int _classId;
|
||||||
|
|
||||||
|
public OnPlayerProfessionCancel(L2PcInstance activeChar, int classId)
|
||||||
|
{
|
||||||
|
_activeChar = activeChar;
|
||||||
|
_classId = classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getActiveChar()
|
||||||
|
{
|
||||||
|
return _activeChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getClassId()
|
||||||
|
{
|
||||||
|
return _classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_PROFESSION_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
@ -23,8 +23,11 @@ import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
|||||||
import com.l2jmobius.gameserver.model.L2SkillLearn;
|
import com.l2jmobius.gameserver.model.L2SkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||||
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
@ -51,6 +54,7 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
{
|
{
|
||||||
super(SkillTransfer.class.getSimpleName(), "features");
|
super(SkillTransfer.class.getSimpleName(), "features");
|
||||||
setPlayerProfessionChangeId(this::onProfessionChange);
|
setPlayerProfessionChangeId(this::onProfessionChange);
|
||||||
|
setPlayerProfessionCancelId(this::onProfessionCancel);
|
||||||
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,6 +75,29 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onProfessionCancel(OnPlayerProfessionCancel event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getActiveChar();
|
||||||
|
final int index = getTransferClassIndex(player);
|
||||||
|
|
||||||
|
// is a transfer class
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pomanderId = PORMANDERS[index].getId();
|
||||||
|
// remove unsused HolyPomander
|
||||||
|
PcInventory inv = player.getInventory();
|
||||||
|
for (L2ItemInstance itemI : inv.getAllItemsByItemId(pomanderId))
|
||||||
|
{
|
||||||
|
inv.destroyItem("[HolyPomander - remove]", itemI, player, null);
|
||||||
|
}
|
||||||
|
// remove holy pomander variable
|
||||||
|
final String name = HOLY_POMANDER + event.getClassId();
|
||||||
|
player.getVariables().remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onEnterWorld(L2PcInstance player)
|
public String onEnterWorld(L2PcInstance player)
|
||||||
{
|
{
|
||||||
@ -107,6 +134,11 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// SkillTransfer or HolyPomander missing
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
player.getInventory().addItem("[HolyPomander - missing]", PORMANDERS[index].getId(), count, player, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onEnterWorld(player);
|
return super.onEnterWorld(player);
|
||||||
}
|
}
|
||||||
|
@ -202,6 +202,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerKarma
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -10066,6 +10067,11 @@ public final class L2PcInstance extends L2Playable
|
|||||||
getSubClasses().remove(classIndex);
|
getSubClasses().remove(classIndex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify to scripts
|
||||||
|
int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
|
|
||||||
getSubClasses().remove(classIndex);
|
getSubClasses().remove(classIndex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -89,6 +89,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.attackable.OnAtt
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.attackable.OnAttackableKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.attackable.OnAttackableKill;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSummonSpawn;
|
||||||
@ -1229,6 +1230,16 @@ public abstract class AbstractScript extends ManagedScript
|
|||||||
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides instant callback operation when player's cancel profession
|
||||||
|
* @param callback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected final List<AbstractEventListener> setPlayerProfessionCancelId(Consumer<OnPlayerProfessionCancel> callback)
|
||||||
|
{
|
||||||
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL);
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
// --------------------------------Default listener register methods---------------------------------
|
// --------------------------------Default listener register methods---------------------------------
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
@ -61,6 +61,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -205,6 +206,7 @@ public enum EventType
|
|||||||
ON_PLAYER_PK_CHANGED(OnPlayerPKChanged.class, void.class),
|
ON_PLAYER_PK_CHANGED(OnPlayerPKChanged.class, void.class),
|
||||||
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
||||||
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
||||||
|
ON_PLAYER_PROFESSION_CANCEL(OnPlayerProfessionCancel.class, void.class),
|
||||||
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
||||||
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
||||||
ON_PLAYER_RESTORE(OnPlayerRestore.class, void.class),
|
ON_PLAYER_RESTORE(OnPlayerRestore.class, void.class),
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* 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 Krunchy
|
||||||
|
* @since 2.6.0.0
|
||||||
|
*/
|
||||||
|
public class OnPlayerProfessionCancel implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _activeChar;
|
||||||
|
private final int _classId;
|
||||||
|
|
||||||
|
public OnPlayerProfessionCancel(L2PcInstance activeChar, int classId)
|
||||||
|
{
|
||||||
|
_activeChar = activeChar;
|
||||||
|
_classId = classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getActiveChar()
|
||||||
|
{
|
||||||
|
return _activeChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getClassId()
|
||||||
|
{
|
||||||
|
return _classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_PROFESSION_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn;
|
|||||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||||
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
@ -51,11 +54,9 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
private SkillTransfer()
|
private SkillTransfer()
|
||||||
{
|
{
|
||||||
setPlayerProfessionChangeId(this::onProfessionChange);
|
setPlayerProfessionChangeId(this::onProfessionChange);
|
||||||
if (Config.SKILL_CHECK_ENABLE)
|
setPlayerProfessionCancelId(this::onProfessionCancel);
|
||||||
{
|
|
||||||
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void onProfessionChange(OnPlayerProfessionChange event)
|
public void onProfessionChange(OnPlayerProfessionChange event)
|
||||||
{
|
{
|
||||||
@ -74,6 +75,29 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onProfessionCancel(OnPlayerProfessionCancel event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getActiveChar();
|
||||||
|
final int index = getTransferClassIndex(player);
|
||||||
|
|
||||||
|
// is a transfer class
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pomanderId = PORMANDERS[index].getId();
|
||||||
|
// remove unsused HolyPomander
|
||||||
|
PcInventory inv = player.getInventory();
|
||||||
|
for (L2ItemInstance itemI : inv.getAllItemsByItemId(pomanderId))
|
||||||
|
{
|
||||||
|
inv.destroyItem("[HolyPomander - remove]", itemI, player, null);
|
||||||
|
}
|
||||||
|
// remove holy pomander variable
|
||||||
|
final String name = HOLY_POMANDER + event.getClassId();
|
||||||
|
player.getVariables().remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onEnterWorld(L2PcInstance player)
|
public String onEnterWorld(L2PcInstance player)
|
||||||
{
|
{
|
||||||
@ -110,6 +134,11 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// SkillTransfer or HolyPomander missing
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
player.getInventory().addItem("[HolyPomander - missing]", PORMANDERS[index].getId(), count, player, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onEnterWorld(player);
|
return super.onEnterWorld(player);
|
||||||
}
|
}
|
||||||
|
@ -204,6 +204,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -9630,6 +9631,10 @@ public final class L2PcInstance extends L2Playable
|
|||||||
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify to scripts
|
||||||
|
int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -97,6 +97,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSpawn;
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
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.OnPlayerSummonAgathion;
|
||||||
@ -1377,6 +1378,16 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides instant callback operation when player's cancel profession
|
||||||
|
* @param callback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected final List<AbstractEventListener> setPlayerProfessionCancelId(Consumer<OnPlayerProfessionCancel> callback)
|
||||||
|
{
|
||||||
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides instant callback operation when instance world created
|
* Provides instant callback operation when instance world created
|
||||||
* @param callback
|
* @param callback
|
||||||
|
@ -95,6 +95,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMento
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -256,6 +257,7 @@ public enum EventType
|
|||||||
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
||||||
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
||||||
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
||||||
|
ON_PLAYER_PROFESSION_CANCEL(OnPlayerProfessionCancel.class, void.class),
|
||||||
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
||||||
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
||||||
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* 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 Krunchy
|
||||||
|
* @since 2.6.0.0
|
||||||
|
*/
|
||||||
|
public class OnPlayerProfessionCancel implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _activeChar;
|
||||||
|
private final int _classId;
|
||||||
|
|
||||||
|
public OnPlayerProfessionCancel(L2PcInstance activeChar, int classId)
|
||||||
|
{
|
||||||
|
_activeChar = activeChar;
|
||||||
|
_classId = classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getActiveChar()
|
||||||
|
{
|
||||||
|
return _activeChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getClassId()
|
||||||
|
{
|
||||||
|
return _classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_PROFESSION_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn;
|
|||||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
import com.l2jmobius.gameserver.model.actor.transform.Transform;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||||
|
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||||
|
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
@ -51,11 +54,9 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
private SkillTransfer()
|
private SkillTransfer()
|
||||||
{
|
{
|
||||||
setPlayerProfessionChangeId(this::onProfessionChange);
|
setPlayerProfessionChangeId(this::onProfessionChange);
|
||||||
if (Config.SKILL_CHECK_ENABLE)
|
setPlayerProfessionCancelId(this::onProfessionCancel);
|
||||||
{
|
|
||||||
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
setOnEnterWorld(Config.SKILL_CHECK_ENABLE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void onProfessionChange(OnPlayerProfessionChange event)
|
public void onProfessionChange(OnPlayerProfessionChange event)
|
||||||
{
|
{
|
||||||
@ -74,6 +75,29 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onProfessionCancel(OnPlayerProfessionCancel event)
|
||||||
|
{
|
||||||
|
final L2PcInstance player = event.getActiveChar();
|
||||||
|
final int index = getTransferClassIndex(player);
|
||||||
|
|
||||||
|
// is a transfer class
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pomanderId = PORMANDERS[index].getId();
|
||||||
|
// remove unsused HolyPomander
|
||||||
|
PcInventory inv = player.getInventory();
|
||||||
|
for (L2ItemInstance itemI : inv.getAllItemsByItemId(pomanderId))
|
||||||
|
{
|
||||||
|
inv.destroyItem("[HolyPomander - remove]", itemI, player, null);
|
||||||
|
}
|
||||||
|
// remove holy pomander variable
|
||||||
|
final String name = HOLY_POMANDER + event.getClassId();
|
||||||
|
player.getVariables().remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onEnterWorld(L2PcInstance player)
|
public String onEnterWorld(L2PcInstance player)
|
||||||
{
|
{
|
||||||
@ -110,6 +134,11 @@ public final class SkillTransfer extends AbstractNpcAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// SkillTransfer or HolyPomander missing
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
player.getInventory().addItem("[HolyPomander - missing]", PORMANDERS[index].getId(), count, player, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onEnterWorld(player);
|
return super.onEnterWorld(player);
|
||||||
}
|
}
|
||||||
|
@ -204,6 +204,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogou
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMenteeStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMentorStatus;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -9630,6 +9631,10 @@ public final class L2PcInstance extends L2Playable
|
|||||||
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
_log.log(Level.WARNING, "Could not modify sub class for " + getName() + " to class index " + classIndex + ": " + e.getMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify to scripts
|
||||||
|
int classId = getSubClasses().get(classIndex).getClassId();
|
||||||
|
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -97,6 +97,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSpawn;
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcTeleport;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSkillLearn;
|
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.OnPlayerSummonAgathion;
|
||||||
@ -1377,6 +1378,16 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
|||||||
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CHANGE, ListenerRegisterType.GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides instant callback operation when player's cancel profession
|
||||||
|
* @param callback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected final List<AbstractEventListener> setPlayerProfessionCancelId(Consumer<OnPlayerProfessionCancel> callback)
|
||||||
|
{
|
||||||
|
return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides instant callback operation when instance world created
|
* Provides instant callback operation when instance world created
|
||||||
* @param callback
|
* @param callback
|
||||||
|
@ -95,6 +95,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMento
|
|||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPressTutorialMark;
|
||||||
|
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.OnPlayerProfessionChange;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill;
|
||||||
@ -256,6 +257,7 @@ public enum EventType
|
|||||||
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
ON_PLAYER_PRESS_TUTORIAL_MARK(OnPlayerPressTutorialMark.class, void.class),
|
||||||
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
|
||||||
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
|
||||||
|
ON_PLAYER_PROFESSION_CANCEL(OnPlayerProfessionCancel.class, void.class),
|
||||||
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
|
||||||
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
|
||||||
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class),
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* 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 Krunchy
|
||||||
|
* @since 2.6.0.0
|
||||||
|
*/
|
||||||
|
public class OnPlayerProfessionCancel implements IBaseEvent
|
||||||
|
{
|
||||||
|
private final L2PcInstance _activeChar;
|
||||||
|
private final int _classId;
|
||||||
|
|
||||||
|
public OnPlayerProfessionCancel(L2PcInstance activeChar, int classId)
|
||||||
|
{
|
||||||
|
_activeChar = activeChar;
|
||||||
|
_classId = classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public L2PcInstance getActiveChar()
|
||||||
|
{
|
||||||
|
return _activeChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getClassId()
|
||||||
|
{
|
||||||
|
return _classId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventType getType()
|
||||||
|
{
|
||||||
|
return EventType.ON_PLAYER_PROFESSION_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user