From 8786792170d0b6d8045e733ffe21e1b7e17ac200 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 11 Dec 2020 19:05:52 +0000 Subject: [PATCH] Support for item equip and unequip listeners. --- .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- ...rEquipItem.java => OnPlayerItemEquip.java} | 6 +-- .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- ...rEquipItem.java => OnPlayerItemEquip.java} | 6 +-- .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- ...rEquipItem.java => OnPlayerItemEquip.java} | 6 +-- .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- ...rEquipItem.java => OnPlayerItemEquip.java} | 6 +-- .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 9 ++-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 9 ++-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ .../model/actor/instance/PlayerInstance.java | 8 +-- .../gameserver/model/events/EventType.java | 6 ++- .../creature/player/OnPlayerEquipItem.java | 53 ------------------- .../creature/player/OnPlayerItemEquip.java | 53 +++++++++++++++++++ .../creature/player/OnPlayerItemUnequip.java | 53 +++++++++++++++++++ .../model/itemcontainer/Inventory.java | 14 +++++ 110 files changed, 2234 insertions(+), 921 deletions(-) rename L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/{OnPlayerEquipItem.java => OnPlayerItemEquip.java} (86%) create mode 100644 L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java rename L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/{OnPlayerEquipItem.java => OnPlayerItemEquip.java} (86%) create mode 100644 L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java rename L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/{OnPlayerEquipItem.java => OnPlayerItemEquip.java} (86%) create mode 100644 L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java rename L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/{OnPlayerEquipItem.java => OnPlayerItemEquip.java} (86%) create mode 100644 L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java delete mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index dc5818e5f2..ffc9ac7430 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -192,10 +192,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2284,6 +2284,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2307,9 +2310,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/EventType.java index 4773b8bc28..aa64ab0744 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -232,7 +233,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -244,6 +244,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java similarity index 86% rename from L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java rename to L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java index 8d541ba4b0..7d0bceb5b3 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java @@ -24,12 +24,12 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance; /** * @author UnAfraid */ -public class OnPlayerEquipItem implements IBaseEvent +public class OnPlayerItemEquip implements IBaseEvent { private final PlayerInstance _player; private final ItemInstance _item; - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) { _player = player; _item = item; @@ -48,6 +48,6 @@ public class OnPlayerEquipItem implements IBaseEvent @Override public EventType getType() { - return EventType.ON_PLAYER_EQUIP_ITEM; + return EventType.ON_PLAYER_ITEM_EQUIP; } } diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 890f4a245d..ba5f6014d8 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1267,6 +1270,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 4574cedabc..dbe9c5ff54 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -193,10 +193,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2290,6 +2290,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2313,9 +2316,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/EventType.java index 4773b8bc28..aa64ab0744 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -232,7 +233,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -244,6 +244,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java similarity index 86% rename from L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java rename to L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java index 8d541ba4b0..7d0bceb5b3 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java @@ -24,12 +24,12 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance; /** * @author UnAfraid */ -public class OnPlayerEquipItem implements IBaseEvent +public class OnPlayerItemEquip implements IBaseEvent { private final PlayerInstance _player; private final ItemInstance _item; - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) { _player = player; _item = item; @@ -48,6 +48,6 @@ public class OnPlayerEquipItem implements IBaseEvent @Override public EventType getType() { - return EventType.ON_PLAYER_EQUIP_ITEM; + return EventType.ON_PLAYER_ITEM_EQUIP; } } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 3b313c323c..01da5df7a8 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1273,6 +1276,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 1021ae89dd..ce0325d7aa 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -194,10 +194,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2292,6 +2292,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2315,9 +2318,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/EventType.java index 4773b8bc28..aa64ab0744 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -232,7 +233,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -244,6 +244,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java similarity index 86% rename from L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java rename to L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java index 8d541ba4b0..7d0bceb5b3 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java @@ -24,12 +24,12 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance; /** * @author UnAfraid */ -public class OnPlayerEquipItem implements IBaseEvent +public class OnPlayerItemEquip implements IBaseEvent { private final PlayerInstance _player; private final ItemInstance _item; - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) { _player = player; _item = item; @@ -48,6 +48,6 @@ public class OnPlayerEquipItem implements IBaseEvent @Override public EventType getType() { - return EventType.ON_PLAYER_EQUIP_ITEM; + return EventType.ON_PLAYER_ITEM_EQUIP; } } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 3b313c323c..01da5df7a8 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1273,6 +1276,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 96786f15b3..14009942b3 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -192,10 +192,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2299,6 +2299,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2323,9 +2326,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/EventType.java index 4773b8bc28..aa64ab0744 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -232,7 +233,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -244,6 +244,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java similarity index 86% rename from L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java rename to L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java index 8d541ba4b0..7d0bceb5b3 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java @@ -24,12 +24,12 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance; /** * @author UnAfraid */ -public class OnPlayerEquipItem implements IBaseEvent +public class OnPlayerItemEquip implements IBaseEvent { private final PlayerInstance _player; private final ItemInstance _item; - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) { _player = player; _item = item; @@ -48,6 +48,6 @@ public class OnPlayerEquipItem implements IBaseEvent @Override public EventType getType() { - return EventType.ON_PLAYER_EQUIP_ITEM; + return EventType.ON_PLAYER_ITEM_EQUIP; } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 2e7e20e4d2..f7b374de07 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1273,6 +1276,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index ad9863830b..3132a58d4e 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -192,10 +192,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2292,6 +2292,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2316,9 +2319,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/EventType.java index f6a338f934..99875a73cf 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -238,7 +239,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -250,6 +250,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 3bf1caa1bb..97e97ae5a5 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1302,6 +1305,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index eb0dfaf728..8c24e88534 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -192,10 +192,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2292,6 +2292,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2316,9 +2319,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/EventType.java index f6a338f934..99875a73cf 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -238,7 +239,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -250,6 +250,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index de57736911..e9e329831c 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1378,6 +1381,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index bb601cb5d3..ec659aafa5 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -192,10 +192,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2292,6 +2292,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2316,9 +2319,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/EventType.java index f6a338f934..99875a73cf 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -238,7 +239,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -250,6 +250,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index de57736911..e9e329831c 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1378,6 +1381,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 9119c2d09e..b26dcbfddf 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -195,10 +195,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2224,6 +2224,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2246,9 +2249,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/EventType.java index f6a338f934..99875a73cf 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -238,7 +239,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -250,6 +250,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 01a1bc5d04..f321011c13 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1371,6 +1374,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 861c378dad..475fcd3742 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -194,10 +194,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2219,6 +2219,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2241,9 +2244,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/EventType.java index f6a338f934..99875a73cf 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -238,7 +239,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -250,6 +250,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 1e40015465..a386829897 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1372,6 +1375,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 474f805695..444d431818 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -181,9 +181,9 @@ import org.l2jmobius.gameserver.model.effects.EffectType; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.playable.OnPlayableExpChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerKarmaChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; @@ -2301,6 +2301,10 @@ public class PlayerInstance extends Playable { rechargeShots(true, true); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); + } else { @@ -2324,9 +2328,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/EventType.java index f0654357e0..ec19081c7f 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -54,10 +54,11 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerChat; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerKarmaChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLevelChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; @@ -187,7 +188,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), // Henna events ON_PLAYER_HENNA_ADD(OnPlayerHennaAdd.class, void.class), @@ -198,6 +198,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Other player events ON_PLAYER_KARMA_CHANGED(OnPlayerKarmaChanged.class, void.class), ON_PLAYER_LEVEL_CHANGED(OnPlayerLevelChanged.class, void.class), diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 557824f0f0..1f3c7d5893 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -36,7 +36,10 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType; import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.items.Item; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -1116,6 +1119,17 @@ public abstract class Inventory extends ItemContainer item.updateDatabase(); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index d65eaa69a7..40ff02e4ad 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -184,9 +184,9 @@ import org.l2jmobius.gameserver.model.effects.EffectType; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.playable.OnPlayableExpChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerKarmaChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; @@ -2212,6 +2212,10 @@ public class PlayerInstance extends Playable { rechargeShots(true, true); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); + } else { @@ -2235,9 +2239,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/EventType.java index f0654357e0..ec19081c7f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -54,10 +54,11 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerChat; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerKarmaChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLevelChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; @@ -187,7 +188,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), // Henna events ON_PLAYER_HENNA_ADD(OnPlayerHennaAdd.class, void.class), @@ -198,6 +198,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Other player events ON_PLAYER_KARMA_CHANGED(OnPlayerKarmaChanged.class, void.class), ON_PLAYER_LEVEL_CHANGED(OnPlayerLevelChanged.class, void.class), diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 557824f0f0..1f3c7d5893 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -36,7 +36,10 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType; import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.items.Item; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -1116,6 +1119,17 @@ public abstract class Inventory extends ItemContainer item.updateDatabase(); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 2e0b142ca6..d8c6f12766 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -192,10 +192,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2250,6 +2250,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2273,9 +2276,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/EventType.java index 4773b8bc28..aa64ab0744 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -232,7 +233,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -244,6 +244,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 3b313c323c..01da5df7a8 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1273,6 +1276,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 44228b8484..7dfc707ad2 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -192,10 +192,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2250,6 +2250,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2273,9 +2276,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/EventType.java index 4773b8bc28..aa64ab0744 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -232,7 +233,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -244,6 +244,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 3b313c323c..01da5df7a8 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1273,6 +1276,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index abf2cefa77..109915fc5e 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -192,10 +192,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2248,6 +2248,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2271,9 +2274,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/EventType.java index 4773b8bc28..aa64ab0744 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -232,7 +233,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -244,6 +244,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index e42fe68e08..686702747c 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1302,6 +1305,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 07274253ba..1c64ee504b 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -195,10 +195,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2258,6 +2258,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2281,9 +2284,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/EventType.java index a0569b2bde..e4bb3c6690 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -78,7 +78,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -116,6 +116,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -234,7 +235,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -246,6 +246,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index a53c584f18..b2ba8a6850 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1378,6 +1381,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 11f166b8fb..bba754032c 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -195,10 +195,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2258,6 +2258,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2281,9 +2284,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/EventType.java index a0569b2bde..e4bb3c6690 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -78,7 +78,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -116,6 +116,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -234,7 +235,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -246,6 +246,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index a53c584f18..b2ba8a6850 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1378,6 +1381,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index ad60f672da..fe32ee6045 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -197,10 +197,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2177,6 +2177,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2199,9 +2202,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/EventType.java index a0569b2bde..e4bb3c6690 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -78,7 +78,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -116,6 +116,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -234,7 +235,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -246,6 +246,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 01a1bc5d04..f321011c13 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1371,6 +1374,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 10b71eade4..5bd46ba752 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -192,10 +192,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2252,6 +2252,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2275,9 +2278,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/EventType.java index 4773b8bc28..aa64ab0744 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -76,7 +76,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -114,6 +114,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -232,7 +233,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -244,6 +244,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 890f4a245d..ba5f6014d8 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1267,6 +1270,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index fab0dd60a4..0007737a4e 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -197,10 +197,10 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAbilityPointsChanged; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaRemove; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerMenteeStatus; @@ -2184,6 +2184,9 @@ public class PlayerInstance extends Playable { rechargeShots(true, true, false); } + + // Notify to scripts + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemEquip(this, item), item.getItem()); } else { @@ -2206,9 +2209,6 @@ public class PlayerInstance extends Playable { sendPacket(new ExStorageMaxCount(this)); } - - // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this); } /** diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/EventType.java index a0569b2bde..e4bb3c6690 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/EventType.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/EventType.java @@ -78,7 +78,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer; -import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerEquipItem; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd; @@ -116,6 +116,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion; import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction; import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated; @@ -234,7 +235,6 @@ public enum EventType ON_PLAYER_CREATE(OnPlayerCreate.class, void.class), ON_PLAYER_DELETE(OnPlayerDelete.class, void.class), ON_PLAYER_DLG_ANSWER(OnPlayerDlgAnswer.class, void.class, TerminateReturn.class), - ON_PLAYER_EQUIP_ITEM(OnPlayerEquipItem.class, void.class), ON_PLAYER_FAME_CHANGED(OnPlayerFameChanged.class, void.class), ON_PLAYER_FISHING(OnPlayerFishing.class, void.class), // Henna events @@ -246,6 +246,8 @@ public enum EventType ON_PLAYER_ITEM_DROP(OnPlayerItemDrop.class, void.class), ON_PLAYER_ITEM_PICKUP(OnPlayerItemPickup.class, void.class), ON_PLAYER_ITEM_TRANSFER(OnPlayerItemTransfer.class, void.class), + ON_PLAYER_ITEM_EQUIP(OnPlayerItemEquip.class, void.class), + ON_PLAYER_ITEM_UNEQUIP(OnPlayerItemUnequip.class, void.class), // Mentoring events ON_PLAYER_MENTEE_ADD(OnPlayerMenteeAdd.class, void.class), ON_PLAYER_MENTEE_LEFT(OnPlayerMenteeLeft.class, void.class), diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java deleted file mode 100644 index 8d541ba4b0..0000000000 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerEquipItem.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 org.l2jmobius.gameserver.model.events.impl.creature.player; - -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.events.EventType; -import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; - -/** - * @author UnAfraid - */ -public class OnPlayerEquipItem implements IBaseEvent -{ - private final PlayerInstance _player; - private final ItemInstance _item; - - public OnPlayerEquipItem(PlayerInstance player, ItemInstance item) - { - _player = player; - _item = item; - } - - public PlayerInstance getPlayer() - { - return _player; - } - - public ItemInstance getItem() - { - return _item; - } - - @Override - public EventType getType() - { - return EventType.ON_PLAYER_EQUIP_ITEM; - } -} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.java new file mode 100644 index 0000000000..7d0bceb5b3 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemEquip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author UnAfraid + */ +public class OnPlayerItemEquip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemEquip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_EQUIP; + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.java new file mode 100644 index 0000000000..6913d86971 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/impl/creature/player/OnPlayerItemUnequip.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 org.l2jmobius.gameserver.model.events.impl.creature.player; + +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventType; +import org.l2jmobius.gameserver.model.events.impl.IBaseEvent; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Mobius + */ +public class OnPlayerItemUnequip implements IBaseEvent +{ + private final PlayerInstance _player; + private final ItemInstance _item; + + public OnPlayerItemUnequip(PlayerInstance player, ItemInstance item) + { + _player = player; + _item = item; + } + + public PlayerInstance getPlayer() + { + return _player; + } + + public ItemInstance getItem() + { + return _item; + } + + @Override + public EventType getType() + { + return EventType.ON_PLAYER_ITEM_UNEQUIP; + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 01a1bc5d04..f321011c13 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -44,7 +44,10 @@ import org.l2jmobius.gameserver.model.ArmorSet; import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.VariationInstance; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.events.EventDispatcher; +import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip; import org.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder; import org.l2jmobius.gameserver.model.holders.ItemSkillHolder; import org.l2jmobius.gameserver.model.items.EtcItem; @@ -1371,6 +1374,17 @@ public abstract class Inventory extends ItemContainer getOwner().sendPacket(new ExUserInfoEquipSlot(getOwner().getActingPlayer())); } } + + // Notify to scripts + if (old != null) + { + final Creature owner = getOwner(); + if ((owner != null) && owner.isPlayer()) + { + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemUnequip(owner.getActingPlayer(), old), old.getItem()); + } + } + return old; }