diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 8cde8d3c50..54387ffe46 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.PcCondOverride; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.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.util.Util; @@ -51,10 +54,8 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - if (Config.SKILL_CHECK_ENABLE) - { - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); - } + setPlayerProfessionCancelId(this::onProfessionCancel); + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); } 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 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); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index e6d9dd4b98..3a48026e36 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -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.OnPlayerMentorStatus; 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.OnPlayerPvPChanged; 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); return false; } + + // Notify to scripts + int classId = getSubClasses().get(classIndex).getClassId(); + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this); } finally { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index fac1d64c29..26d733e4c1 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -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.player.OnPlayerLogin; 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.OnPlayerSkillLearn; 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); } + /** + * Provides instant callback operation when player's cancel profession + * @param callback + * @return + */ + protected final List setPlayerProfessionCancelId(Consumer callback) + { + return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL); + } + /** * Provides instant callback operation when instance world created * @param callback diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/EventType.java index e74676a9df..f148fd0250 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/EventType.java @@ -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.OnPlayerPKChanged; 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.OnPlayerPvPChanged; 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_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.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_PVP_CHANGED(OnPlayerPvPChanged.class, void.class), ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class), diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java new file mode 100644 index 0000000000..710d5f7deb --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java @@ -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 . + */ +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; + } +} \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 8cde8d3c50..54387ffe46 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.PcCondOverride; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.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.util.Util; @@ -51,10 +54,8 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - if (Config.SKILL_CHECK_ENABLE) - { - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); - } + setPlayerProfessionCancelId(this::onProfessionCancel); + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); } 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 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); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index d49d102f4a..ec9c4a221f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -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.OnPlayerMentorStatus; 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.OnPlayerPvPChanged; 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); return false; } + + // Notify to scripts + int classId = getSubClasses().get(classIndex).getClassId(); + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this); } finally { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index fac1d64c29..26d733e4c1 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -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.player.OnPlayerLogin; 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.OnPlayerSkillLearn; 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); } + /** + * Provides instant callback operation when player's cancel profession + * @param callback + * @return + */ + protected final List setPlayerProfessionCancelId(Consumer callback) + { + return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL); + } + /** * Provides instant callback operation when instance world created * @param callback diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/EventType.java index e74676a9df..f148fd0250 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/EventType.java @@ -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.OnPlayerPKChanged; 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.OnPlayerPvPChanged; 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_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.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_PVP_CHANGED(OnPlayerPvPChanged.class, void.class), ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class), diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java new file mode 100644 index 0000000000..710d5f7deb --- /dev/null +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java @@ -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 . + */ +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; + } +} \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 8cde8d3c50..54387ffe46 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.PcCondOverride; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.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.util.Util; @@ -51,10 +54,8 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - if (Config.SKILL_CHECK_ENABLE) - { - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); - } + setPlayerProfessionCancelId(this::onProfessionCancel); + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); } 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 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); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 770619e7a3..71977bad6b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -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.OnPlayerMentorStatus; 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.OnPlayerPvPChanged; 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); return false; } + + // Notify to scripts + int classId = getSubClasses().get(classIndex).getClassId(); + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this); } finally { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index 606ae56cb9..28ff51de81 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -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.player.OnPlayerLogin; 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.OnPlayerSkillLearn; 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); } + /** + * Provides instant callback operation when player's cancel profession + * @param callback + * @return + */ + protected final List setPlayerProfessionCancelId(Consumer callback) + { + return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL); + } + /** * Provides instant callback operation when instance world created * @param callback diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/EventType.java index e74676a9df..f148fd0250 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/EventType.java @@ -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.OnPlayerPKChanged; 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.OnPlayerPvPChanged; 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_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.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_PVP_CHANGED(OnPlayerPvPChanged.class, void.class), ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class), diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java new file mode 100644 index 0000000000..710d5f7deb --- /dev/null +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java @@ -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 . + */ +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; + } +} \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 8cde8d3c50..54387ffe46 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.PcCondOverride; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.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.util.Util; @@ -51,10 +54,8 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - if (Config.SKILL_CHECK_ENABLE) - { - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); - } + setPlayerProfessionCancelId(this::onProfessionCancel); + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); } 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 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); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 528528de98..62dbed3b01 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -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.OnPlayerMentorStatus; 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.OnPlayerPvPChanged; 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); return false; } + + // Notify to scripts + int classId = getSubClasses().get(classIndex).getClassId(); + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this); } finally { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index 606ae56cb9..28ff51de81 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -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.player.OnPlayerLogin; 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.OnPlayerSkillLearn; 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); } + /** + * Provides instant callback operation when player's cancel profession + * @param callback + * @return + */ + protected final List setPlayerProfessionCancelId(Consumer callback) + { + return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL); + } + /** * Provides instant callback operation when instance world created * @param callback diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/EventType.java index e74676a9df..f148fd0250 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/EventType.java @@ -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.OnPlayerPKChanged; 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.OnPlayerPvPChanged; 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_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.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_PVP_CHANGED(OnPlayerPvPChanged.class, void.class), ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class), diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java new file mode 100644 index 0000000000..710d5f7deb --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java @@ -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 . + */ +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; + } +} \ No newline at end of file diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 611bcefa02..362529c4d0 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -23,8 +23,11 @@ import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.PcCondOverride; 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.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.util.Util; @@ -51,6 +54,7 @@ public final class SkillTransfer extends AbstractNpcAI { super(SkillTransfer.class.getSimpleName(), "features"); setPlayerProfessionChangeId(this::onProfessionChange); + setPlayerProfessionCancelId(this::onProfessionCancel); 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 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); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index a494191c21..c198e06f24 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -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.OnPlayerLogout; 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.OnPlayerPvPChanged; import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPKill; @@ -10066,6 +10067,11 @@ public final class L2PcInstance extends L2Playable getSubClasses().remove(classIndex); return false; } + + // Notify to scripts + int classId = getSubClasses().get(classIndex).getClassId(); + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this); + getSubClasses().remove(classIndex); } finally diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index 951b2b3513..349afe7a50 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -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.player.OnPlayerLogin; 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.OnPlayerSkillLearn; 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); } + /** + * Provides instant callback operation when player's cancel profession + * @param callback + * @return + */ + protected final List setPlayerProfessionCancelId(Consumer callback) + { + return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL); + } + // -------------------------------------------------------------------------------------------------- // --------------------------------Default listener register methods--------------------------------- // -------------------------------------------------------------------------------------------------- diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/EventType.java index 7d9758f571..076a63218e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/EventType.java @@ -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.OnPlayerMoveRequest; 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.OnPlayerPvPChanged; 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_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.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_KILL(OnPlayerPvPKill.class, void.class), ON_PLAYER_RESTORE(OnPlayerRestore.class, void.class), diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java new file mode 100644 index 0000000000..710d5f7deb --- /dev/null +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java @@ -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 . + */ +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; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 8cde8d3c50..54387ffe46 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.PcCondOverride; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.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.util.Util; @@ -51,10 +54,8 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - if (Config.SKILL_CHECK_ENABLE) - { - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); - } + setPlayerProfessionCancelId(this::onProfessionCancel); + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); } 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 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); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 6b1bd1bf42..be2a0c6d46 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -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.OnPlayerMentorStatus; 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.OnPlayerPvPChanged; 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); return false; } + + // Notify to scripts + int classId = getSubClasses().get(classIndex).getClassId(); + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this); } finally { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index fac1d64c29..26d733e4c1 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -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.player.OnPlayerLogin; 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.OnPlayerSkillLearn; 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); } + /** + * Provides instant callback operation when player's cancel profession + * @param callback + * @return + */ + protected final List setPlayerProfessionCancelId(Consumer callback) + { + return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL); + } + /** * Provides instant callback operation when instance world created * @param callback diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/EventType.java index e74676a9df..f148fd0250 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/EventType.java @@ -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.OnPlayerPKChanged; 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.OnPlayerPvPChanged; 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_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.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_PVP_CHANGED(OnPlayerPvPChanged.class, void.class), ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class), diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java new file mode 100644 index 0000000000..710d5f7deb --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java @@ -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 . + */ +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; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java b/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java index 8cde8d3c50..54387ffe46 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java +++ b/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/features/SkillTransfer/SkillTransfer.java @@ -24,8 +24,11 @@ import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.PcCondOverride; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.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.util.Util; @@ -51,10 +54,8 @@ public final class SkillTransfer extends AbstractNpcAI private SkillTransfer() { setPlayerProfessionChangeId(this::onProfessionChange); - if (Config.SKILL_CHECK_ENABLE) - { - setOnEnterWorld(Config.SKILL_CHECK_ENABLE); - } + setPlayerProfessionCancelId(this::onProfessionCancel); + setOnEnterWorld(Config.SKILL_CHECK_ENABLE); } 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 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); } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 3c2d53f8f3..85bf5d1da2 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -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.OnPlayerMentorStatus; 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.OnPlayerPvPChanged; 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); return false; } + + // Notify to scripts + int classId = getSubClasses().get(classIndex).getClassId(); + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerProfessionCancel(this, classId), this); } finally { diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/AbstractScript.java index fac1d64c29..26d733e4c1 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/AbstractScript.java @@ -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.player.OnPlayerLogin; 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.OnPlayerSkillLearn; 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); } + /** + * Provides instant callback operation when player's cancel profession + * @param callback + * @return + */ + protected final List setPlayerProfessionCancelId(Consumer callback) + { + return registerConsumer(callback, EventType.ON_PLAYER_PROFESSION_CANCEL, ListenerRegisterType.GLOBAL); + } + /** * Provides instant callback operation when instance world created * @param callback diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/EventType.java index e74676a9df..f148fd0250 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/EventType.java @@ -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.OnPlayerPKChanged; 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.OnPlayerPvPChanged; 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_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.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_PVP_CHANGED(OnPlayerPvPChanged.class, void.class), ON_PLAYER_PVP_KILL(OnPlayerPvPKill.class, void.class), diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java new file mode 100644 index 0000000000..710d5f7deb --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerProfessionCancel.java @@ -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 . + */ +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; + } +} \ No newline at end of file