From f7f2720f85add39715863f930634a706a7f56d29 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sun, 3 Apr 2022 07:15:06 +0000 Subject: [PATCH] Addition of item deletion info. Thanks to Index. --- .../events/ItemDeletionInfoManager.java | 56 +++++++++++++++++++ .../gameserver/model/quest/LongTimeEvent.java | 7 +++ .../network/clientpackets/EnterWorld.java | 3 + .../serverpackets/ItemDeletionInfo.java | 55 ++++++++++++++++++ .../events/ItemDeletionInfoManager.java | 56 +++++++++++++++++++ .../gameserver/model/quest/LongTimeEvent.java | 7 +++ .../network/clientpackets/EnterWorld.java | 3 + .../serverpackets/ItemDeletionInfo.java | 55 ++++++++++++++++++ .../events/ItemDeletionInfoManager.java | 56 +++++++++++++++++++ .../gameserver/model/quest/LongTimeEvent.java | 7 +++ .../network/clientpackets/EnterWorld.java | 3 + .../serverpackets/ItemDeletionInfo.java | 55 ++++++++++++++++++ .../events/ItemDeletionInfoManager.java | 56 +++++++++++++++++++ .../gameserver/model/quest/LongTimeEvent.java | 7 +++ .../network/clientpackets/EnterWorld.java | 3 + .../serverpackets/ItemDeletionInfo.java | 55 ++++++++++++++++++ .../events/ItemDeletionInfoManager.java | 56 +++++++++++++++++++ .../gameserver/model/quest/LongTimeEvent.java | 7 +++ .../network/clientpackets/EnterWorld.java | 3 + .../serverpackets/ItemDeletionInfo.java | 55 ++++++++++++++++++ .../events/ItemDeletionInfoManager.java | 56 +++++++++++++++++++ .../gameserver/model/quest/LongTimeEvent.java | 7 +++ .../network/clientpackets/EnterWorld.java | 3 + .../serverpackets/ItemDeletionInfo.java | 55 ++++++++++++++++++ .../events/ItemDeletionInfoManager.java | 56 +++++++++++++++++++ .../gameserver/model/quest/LongTimeEvent.java | 7 +++ .../network/clientpackets/EnterWorld.java | 3 + .../serverpackets/ItemDeletionInfo.java | 55 ++++++++++++++++++ .../events/ItemDeletionInfoManager.java | 56 +++++++++++++++++++ .../gameserver/model/quest/LongTimeEvent.java | 7 +++ .../network/clientpackets/EnterWorld.java | 3 + .../serverpackets/ItemDeletionInfo.java | 55 ++++++++++++++++++ 32 files changed, 968 insertions(+) create mode 100644 L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java create mode 100644 L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java create mode 100644 L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java create mode 100644 L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java create mode 100644 L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java create mode 100644 L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java create mode 100644 L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java create mode 100644 L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java create mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java create mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java create mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java create mode 100644 L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java create mode 100644 L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java create mode 100644 L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java new file mode 100644 index 0000000000..76bb843ac2 --- /dev/null +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java @@ -0,0 +1,56 @@ +/* + * 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.instancemanager.events; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +/** + * @author Mobius + */ +public class ItemDeletionInfoManager +{ + protected static final Logger LOGGER = Logger.getLogger(ItemDeletionInfoManager.class.getName()); + + private final Map _items = new HashMap<>(); + + protected ItemDeletionInfoManager() + { + } + + public void addItemInfo(int itemId, Date date) + { + _items.put(itemId, date); + } + + public Map getInfo() + { + return _items; + } + + public static ItemDeletionInfoManager getInstance() + { + return SingletonHolder.INSTANCE; + } + + private static class SingletonHolder + { + protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager(); + } +} diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java index 18508d0145..04683bf934 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java @@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.EventDropManager; import org.l2jmobius.gameserver.instancemanager.EventShrineManager; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.actor.Player; @@ -296,6 +297,12 @@ public class LongTimeEvent extends Quest continue; } _destroyItemsOnEnd.add(itemId); + + // Add item deletion info to manager. + if (_eventPeriod.getEndDate().getTime() > Chronos.currentTimeMillis()) + { + ItemDeletionInfoManager.getInstance().addItemInfo(itemId, _eventPeriod.getEndDate()); + } } catch (NumberFormatException nfe) { diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index de698fde38..0828a7770e 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -101,6 +101,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExVitalityEffectInfo; import org.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.HennaInfo; +import org.l2jmobius.gameserver.network.serverpackets.ItemDeletionInfo; import org.l2jmobius.gameserver.network.serverpackets.ItemList; import org.l2jmobius.gameserver.network.serverpackets.LeaveWorld; import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; @@ -664,6 +665,8 @@ public class EnterWorld implements IClientIncomingPacket player.updateAbnormalVisualEffects(); } + player.sendPacket(new ItemDeletionInfo()); + // Activate first agathion when available. final Item agathion = player.getInventory().unEquipItemInBodySlot(ItemTemplate.SLOT_AGATHION); if (agathion != null) diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java new file mode 100644 index 0000000000..b3d49fc1b7 --- /dev/null +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java @@ -0,0 +1,55 @@ +/* + * 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.network.serverpackets; + +import java.util.Date; +import java.util.Map; +import java.util.Map.Entry; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; +import org.l2jmobius.gameserver.network.OutgoingPackets; + +/** + * @author Index, Mobius + */ +public class ItemDeletionInfo implements IClientOutgoingPacket +{ + public ItemDeletionInfo() + { + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_ITEM_DELETION_INFO.writeId(packet); + + // Items. + final Map itemInfos = ItemDeletionInfoManager.getInstance().getInfo(); + packet.writeD(itemInfos.size()); + for (Entry info : itemInfos.entrySet()) + { + packet.writeD(info.getKey()); // item id + packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME + } + + // Skills. + packet.writeD(0); + + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java new file mode 100644 index 0000000000..76bb843ac2 --- /dev/null +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java @@ -0,0 +1,56 @@ +/* + * 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.instancemanager.events; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +/** + * @author Mobius + */ +public class ItemDeletionInfoManager +{ + protected static final Logger LOGGER = Logger.getLogger(ItemDeletionInfoManager.class.getName()); + + private final Map _items = new HashMap<>(); + + protected ItemDeletionInfoManager() + { + } + + public void addItemInfo(int itemId, Date date) + { + _items.put(itemId, date); + } + + public Map getInfo() + { + return _items; + } + + public static ItemDeletionInfoManager getInstance() + { + return SingletonHolder.INSTANCE; + } + + private static class SingletonHolder + { + protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager(); + } +} diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java index 18508d0145..04683bf934 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java @@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.EventDropManager; import org.l2jmobius.gameserver.instancemanager.EventShrineManager; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.actor.Player; @@ -296,6 +297,12 @@ public class LongTimeEvent extends Quest continue; } _destroyItemsOnEnd.add(itemId); + + // Add item deletion info to manager. + if (_eventPeriod.getEndDate().getTime() > Chronos.currentTimeMillis()) + { + ItemDeletionInfoManager.getInstance().addItemInfo(itemId, _eventPeriod.getEndDate()); + } } catch (NumberFormatException nfe) { diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 10b389d541..9eea1885f4 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -102,6 +102,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExVitalityEffectInfo; import org.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.HennaInfo; +import org.l2jmobius.gameserver.network.serverpackets.ItemDeletionInfo; import org.l2jmobius.gameserver.network.serverpackets.ItemList; import org.l2jmobius.gameserver.network.serverpackets.LeaveWorld; import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; @@ -674,6 +675,8 @@ public class EnterWorld implements IClientIncomingPacket player.sendPacket(new ExCollectionInfo(player, category)); } + player.sendPacket(new ItemDeletionInfo()); + // Activate first agathion when available. final Item agathion = player.getInventory().unEquipItemInBodySlot(ItemTemplate.SLOT_AGATHION); if (agathion != null) diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java new file mode 100644 index 0000000000..b3d49fc1b7 --- /dev/null +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java @@ -0,0 +1,55 @@ +/* + * 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.network.serverpackets; + +import java.util.Date; +import java.util.Map; +import java.util.Map.Entry; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; +import org.l2jmobius.gameserver.network.OutgoingPackets; + +/** + * @author Index, Mobius + */ +public class ItemDeletionInfo implements IClientOutgoingPacket +{ + public ItemDeletionInfo() + { + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_ITEM_DELETION_INFO.writeId(packet); + + // Items. + final Map itemInfos = ItemDeletionInfoManager.getInstance().getInfo(); + packet.writeD(itemInfos.size()); + for (Entry info : itemInfos.entrySet()) + { + packet.writeD(info.getKey()); // item id + packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME + } + + // Skills. + packet.writeD(0); + + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java new file mode 100644 index 0000000000..76bb843ac2 --- /dev/null +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java @@ -0,0 +1,56 @@ +/* + * 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.instancemanager.events; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +/** + * @author Mobius + */ +public class ItemDeletionInfoManager +{ + protected static final Logger LOGGER = Logger.getLogger(ItemDeletionInfoManager.class.getName()); + + private final Map _items = new HashMap<>(); + + protected ItemDeletionInfoManager() + { + } + + public void addItemInfo(int itemId, Date date) + { + _items.put(itemId, date); + } + + public Map getInfo() + { + return _items; + } + + public static ItemDeletionInfoManager getInstance() + { + return SingletonHolder.INSTANCE; + } + + private static class SingletonHolder + { + protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager(); + } +} diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java index 18508d0145..04683bf934 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java @@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.EventDropManager; import org.l2jmobius.gameserver.instancemanager.EventShrineManager; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.actor.Player; @@ -296,6 +297,12 @@ public class LongTimeEvent extends Quest continue; } _destroyItemsOnEnd.add(itemId); + + // Add item deletion info to manager. + if (_eventPeriod.getEndDate().getTime() > Chronos.currentTimeMillis()) + { + ItemDeletionInfoManager.getInstance().addItemInfo(itemId, _eventPeriod.getEndDate()); + } } catch (NumberFormatException nfe) { diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 013c0c16d6..a9819a8a61 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -102,6 +102,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExVitalityEffectInfo; import org.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.HennaInfo; +import org.l2jmobius.gameserver.network.serverpackets.ItemDeletionInfo; import org.l2jmobius.gameserver.network.serverpackets.ItemList; import org.l2jmobius.gameserver.network.serverpackets.LeaveWorld; import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; @@ -678,6 +679,8 @@ public class EnterWorld implements IClientIncomingPacket player.sendPacket(new ExCollectionInfo(player, category)); } + player.sendPacket(new ItemDeletionInfo()); + // Activate first agathion when available. final Item agathion = player.getInventory().unEquipItemInBodySlot(ItemTemplate.SLOT_AGATHION); if (agathion != null) diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java new file mode 100644 index 0000000000..b3d49fc1b7 --- /dev/null +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java @@ -0,0 +1,55 @@ +/* + * 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.network.serverpackets; + +import java.util.Date; +import java.util.Map; +import java.util.Map.Entry; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; +import org.l2jmobius.gameserver.network.OutgoingPackets; + +/** + * @author Index, Mobius + */ +public class ItemDeletionInfo implements IClientOutgoingPacket +{ + public ItemDeletionInfo() + { + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_ITEM_DELETION_INFO.writeId(packet); + + // Items. + final Map itemInfos = ItemDeletionInfoManager.getInstance().getInfo(); + packet.writeD(itemInfos.size()); + for (Entry info : itemInfos.entrySet()) + { + packet.writeD(info.getKey()); // item id + packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME + } + + // Skills. + packet.writeD(0); + + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java new file mode 100644 index 0000000000..76bb843ac2 --- /dev/null +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java @@ -0,0 +1,56 @@ +/* + * 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.instancemanager.events; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +/** + * @author Mobius + */ +public class ItemDeletionInfoManager +{ + protected static final Logger LOGGER = Logger.getLogger(ItemDeletionInfoManager.class.getName()); + + private final Map _items = new HashMap<>(); + + protected ItemDeletionInfoManager() + { + } + + public void addItemInfo(int itemId, Date date) + { + _items.put(itemId, date); + } + + public Map getInfo() + { + return _items; + } + + public static ItemDeletionInfoManager getInstance() + { + return SingletonHolder.INSTANCE; + } + + private static class SingletonHolder + { + protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager(); + } +} diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java index 18508d0145..04683bf934 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java @@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.EventDropManager; import org.l2jmobius.gameserver.instancemanager.EventShrineManager; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.actor.Player; @@ -296,6 +297,12 @@ public class LongTimeEvent extends Quest continue; } _destroyItemsOnEnd.add(itemId); + + // Add item deletion info to manager. + if (_eventPeriod.getEndDate().getTime() > Chronos.currentTimeMillis()) + { + ItemDeletionInfoManager.getInstance().addItemInfo(itemId, _eventPeriod.getEndDate()); + } } catch (NumberFormatException nfe) { diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 013c0c16d6..a9819a8a61 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -102,6 +102,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExVitalityEffectInfo; import org.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.HennaInfo; +import org.l2jmobius.gameserver.network.serverpackets.ItemDeletionInfo; import org.l2jmobius.gameserver.network.serverpackets.ItemList; import org.l2jmobius.gameserver.network.serverpackets.LeaveWorld; import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; @@ -678,6 +679,8 @@ public class EnterWorld implements IClientIncomingPacket player.sendPacket(new ExCollectionInfo(player, category)); } + player.sendPacket(new ItemDeletionInfo()); + // Activate first agathion when available. final Item agathion = player.getInventory().unEquipItemInBodySlot(ItemTemplate.SLOT_AGATHION); if (agathion != null) diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java new file mode 100644 index 0000000000..b3d49fc1b7 --- /dev/null +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java @@ -0,0 +1,55 @@ +/* + * 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.network.serverpackets; + +import java.util.Date; +import java.util.Map; +import java.util.Map.Entry; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; +import org.l2jmobius.gameserver.network.OutgoingPackets; + +/** + * @author Index, Mobius + */ +public class ItemDeletionInfo implements IClientOutgoingPacket +{ + public ItemDeletionInfo() + { + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_ITEM_DELETION_INFO.writeId(packet); + + // Items. + final Map itemInfos = ItemDeletionInfoManager.getInstance().getInfo(); + packet.writeD(itemInfos.size()); + for (Entry info : itemInfos.entrySet()) + { + packet.writeD(info.getKey()); // item id + packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME + } + + // Skills. + packet.writeD(0); + + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java new file mode 100644 index 0000000000..76bb843ac2 --- /dev/null +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java @@ -0,0 +1,56 @@ +/* + * 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.instancemanager.events; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +/** + * @author Mobius + */ +public class ItemDeletionInfoManager +{ + protected static final Logger LOGGER = Logger.getLogger(ItemDeletionInfoManager.class.getName()); + + private final Map _items = new HashMap<>(); + + protected ItemDeletionInfoManager() + { + } + + public void addItemInfo(int itemId, Date date) + { + _items.put(itemId, date); + } + + public Map getInfo() + { + return _items; + } + + public static ItemDeletionInfoManager getInstance() + { + return SingletonHolder.INSTANCE; + } + + private static class SingletonHolder + { + protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager(); + } +} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java index 18508d0145..04683bf934 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java @@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.EventDropManager; import org.l2jmobius.gameserver.instancemanager.EventShrineManager; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.actor.Player; @@ -296,6 +297,12 @@ public class LongTimeEvent extends Quest continue; } _destroyItemsOnEnd.add(itemId); + + // Add item deletion info to manager. + if (_eventPeriod.getEndDate().getTime() > Chronos.currentTimeMillis()) + { + ItemDeletionInfoManager.getInstance().addItemInfo(itemId, _eventPeriod.getEndDate()); + } } catch (NumberFormatException nfe) { diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 42b2d36715..e8a79f6866 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -100,6 +100,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExVitalityEffectInfo; import org.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.HennaInfo; +import org.l2jmobius.gameserver.network.serverpackets.ItemDeletionInfo; import org.l2jmobius.gameserver.network.serverpackets.ItemList; import org.l2jmobius.gameserver.network.serverpackets.LeaveWorld; import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; @@ -661,6 +662,8 @@ public class EnterWorld implements IClientIncomingPacket player.sendPacket(new ExCraftInfo(player)); } + player.sendPacket(new ItemDeletionInfo()); + // Activate first agathion when available. final Item agathion = player.getInventory().unEquipItemInBodySlot(ItemTemplate.SLOT_AGATHION); if (agathion != null) diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java new file mode 100644 index 0000000000..b3d49fc1b7 --- /dev/null +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java @@ -0,0 +1,55 @@ +/* + * 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.network.serverpackets; + +import java.util.Date; +import java.util.Map; +import java.util.Map.Entry; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; +import org.l2jmobius.gameserver.network.OutgoingPackets; + +/** + * @author Index, Mobius + */ +public class ItemDeletionInfo implements IClientOutgoingPacket +{ + public ItemDeletionInfo() + { + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_ITEM_DELETION_INFO.writeId(packet); + + // Items. + final Map itemInfos = ItemDeletionInfoManager.getInstance().getInfo(); + packet.writeD(itemInfos.size()); + for (Entry info : itemInfos.entrySet()) + { + packet.writeD(info.getKey()); // item id + packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME + } + + // Skills. + packet.writeD(0); + + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java new file mode 100644 index 0000000000..76bb843ac2 --- /dev/null +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java @@ -0,0 +1,56 @@ +/* + * 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.instancemanager.events; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +/** + * @author Mobius + */ +public class ItemDeletionInfoManager +{ + protected static final Logger LOGGER = Logger.getLogger(ItemDeletionInfoManager.class.getName()); + + private final Map _items = new HashMap<>(); + + protected ItemDeletionInfoManager() + { + } + + public void addItemInfo(int itemId, Date date) + { + _items.put(itemId, date); + } + + public Map getInfo() + { + return _items; + } + + public static ItemDeletionInfoManager getInstance() + { + return SingletonHolder.INSTANCE; + } + + private static class SingletonHolder + { + protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager(); + } +} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java index 18508d0145..04683bf934 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java @@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.EventDropManager; import org.l2jmobius.gameserver.instancemanager.EventShrineManager; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.actor.Player; @@ -296,6 +297,12 @@ public class LongTimeEvent extends Quest continue; } _destroyItemsOnEnd.add(itemId); + + // Add item deletion info to manager. + if (_eventPeriod.getEndDate().getTime() > Chronos.currentTimeMillis()) + { + ItemDeletionInfoManager.getInstance().addItemInfo(itemId, _eventPeriod.getEndDate()); + } } catch (NumberFormatException nfe) { diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index e850a541cd..7cb3afbe45 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -101,6 +101,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExVitalityEffectInfo; import org.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.HennaInfo; +import org.l2jmobius.gameserver.network.serverpackets.ItemDeletionInfo; import org.l2jmobius.gameserver.network.serverpackets.ItemList; import org.l2jmobius.gameserver.network.serverpackets.LeaveWorld; import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; @@ -675,6 +676,8 @@ public class EnterWorld implements IClientIncomingPacket player.sendPacket(new ExSubjugationSidebar(1, player.getPurgePoints().get(1))); + player.sendPacket(new ItemDeletionInfo()); + // Activate first agathion when available. final Item agathion = player.getInventory().unEquipItemInBodySlot(ItemTemplate.SLOT_AGATHION); if (agathion != null) diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java new file mode 100644 index 0000000000..b3d49fc1b7 --- /dev/null +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java @@ -0,0 +1,55 @@ +/* + * 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.network.serverpackets; + +import java.util.Date; +import java.util.Map; +import java.util.Map.Entry; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; +import org.l2jmobius.gameserver.network.OutgoingPackets; + +/** + * @author Index, Mobius + */ +public class ItemDeletionInfo implements IClientOutgoingPacket +{ + public ItemDeletionInfo() + { + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_ITEM_DELETION_INFO.writeId(packet); + + // Items. + final Map itemInfos = ItemDeletionInfoManager.getInstance().getInfo(); + packet.writeD(itemInfos.size()); + for (Entry info : itemInfos.entrySet()) + { + packet.writeD(info.getKey()); // item id + packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME + } + + // Skills. + packet.writeD(0); + + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java new file mode 100644 index 0000000000..76bb843ac2 --- /dev/null +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java @@ -0,0 +1,56 @@ +/* + * 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.instancemanager.events; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +/** + * @author Mobius + */ +public class ItemDeletionInfoManager +{ + protected static final Logger LOGGER = Logger.getLogger(ItemDeletionInfoManager.class.getName()); + + private final Map _items = new HashMap<>(); + + protected ItemDeletionInfoManager() + { + } + + public void addItemInfo(int itemId, Date date) + { + _items.put(itemId, date); + } + + public Map getInfo() + { + return _items; + } + + public static ItemDeletionInfoManager getInstance() + { + return SingletonHolder.INSTANCE; + } + + private static class SingletonHolder + { + protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager(); + } +} diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java index 18508d0145..04683bf934 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java @@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.EventDropManager; import org.l2jmobius.gameserver.instancemanager.EventShrineManager; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.actor.Player; @@ -296,6 +297,12 @@ public class LongTimeEvent extends Quest continue; } _destroyItemsOnEnd.add(itemId); + + // Add item deletion info to manager. + if (_eventPeriod.getEndDate().getTime() > Chronos.currentTimeMillis()) + { + ItemDeletionInfoManager.getInstance().addItemInfo(itemId, _eventPeriod.getEndDate()); + } } catch (NumberFormatException nfe) { diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 585443e70b..8880336ce1 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -101,6 +101,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExVitalityEffectInfo; import org.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.HennaInfo; +import org.l2jmobius.gameserver.network.serverpackets.ItemDeletionInfo; import org.l2jmobius.gameserver.network.serverpackets.ItemList; import org.l2jmobius.gameserver.network.serverpackets.LeaveWorld; import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; @@ -675,6 +676,8 @@ public class EnterWorld implements IClientIncomingPacket player.sendPacket(new ExSubjugationSidebar(1, player.getPurgePoints().get(1))); + player.sendPacket(new ItemDeletionInfo()); + // Activate first agathion when available. final Item agathion = player.getInventory().unEquipItemInBodySlot(ItemTemplate.SLOT_AGATHION); if (agathion != null) diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java new file mode 100644 index 0000000000..b3d49fc1b7 --- /dev/null +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java @@ -0,0 +1,55 @@ +/* + * 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.network.serverpackets; + +import java.util.Date; +import java.util.Map; +import java.util.Map.Entry; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; +import org.l2jmobius.gameserver.network.OutgoingPackets; + +/** + * @author Index, Mobius + */ +public class ItemDeletionInfo implements IClientOutgoingPacket +{ + public ItemDeletionInfo() + { + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_ITEM_DELETION_INFO.writeId(packet); + + // Items. + final Map itemInfos = ItemDeletionInfoManager.getInstance().getInfo(); + packet.writeD(itemInfos.size()); + for (Entry info : itemInfos.entrySet()) + { + packet.writeD(info.getKey()); // item id + packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME + } + + // Skills. + packet.writeD(0); + + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java new file mode 100644 index 0000000000..76bb843ac2 --- /dev/null +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/instancemanager/events/ItemDeletionInfoManager.java @@ -0,0 +1,56 @@ +/* + * 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.instancemanager.events; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +/** + * @author Mobius + */ +public class ItemDeletionInfoManager +{ + protected static final Logger LOGGER = Logger.getLogger(ItemDeletionInfoManager.class.getName()); + + private final Map _items = new HashMap<>(); + + protected ItemDeletionInfoManager() + { + } + + public void addItemInfo(int itemId, Date date) + { + _items.put(itemId, date); + } + + public Map getInfo() + { + return _items; + } + + public static ItemDeletionInfoManager getInstance() + { + return SingletonHolder.INSTANCE; + } + + private static class SingletonHolder + { + protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager(); + } +} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java index 18508d0145..04683bf934 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/quest/LongTimeEvent.java @@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.data.sql.AnnouncementsTable; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.EventDropManager; import org.l2jmobius.gameserver.instancemanager.EventShrineManager; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.actor.Player; @@ -296,6 +297,12 @@ public class LongTimeEvent extends Quest continue; } _destroyItemsOnEnd.add(itemId); + + // Add item deletion info to manager. + if (_eventPeriod.getEndDate().getTime() > Chronos.currentTimeMillis()) + { + ItemDeletionInfoManager.getInstance().addItemInfo(itemId, _eventPeriod.getEndDate()); + } } catch (NumberFormatException nfe) { diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 585443e70b..8880336ce1 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -101,6 +101,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExVitalityEffectInfo; import org.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.HennaInfo; +import org.l2jmobius.gameserver.network.serverpackets.ItemDeletionInfo; import org.l2jmobius.gameserver.network.serverpackets.ItemList; import org.l2jmobius.gameserver.network.serverpackets.LeaveWorld; import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; @@ -675,6 +676,8 @@ public class EnterWorld implements IClientIncomingPacket player.sendPacket(new ExSubjugationSidebar(1, player.getPurgePoints().get(1))); + player.sendPacket(new ItemDeletionInfo()); + // Activate first agathion when available. final Item agathion = player.getInventory().unEquipItemInBodySlot(ItemTemplate.SLOT_AGATHION); if (agathion != null) diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java new file mode 100644 index 0000000000..b3d49fc1b7 --- /dev/null +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ItemDeletionInfo.java @@ -0,0 +1,55 @@ +/* + * 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.network.serverpackets; + +import java.util.Date; +import java.util.Map; +import java.util.Map.Entry; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.instancemanager.events.ItemDeletionInfoManager; +import org.l2jmobius.gameserver.network.OutgoingPackets; + +/** + * @author Index, Mobius + */ +public class ItemDeletionInfo implements IClientOutgoingPacket +{ + public ItemDeletionInfo() + { + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_ITEM_DELETION_INFO.writeId(packet); + + // Items. + final Map itemInfos = ItemDeletionInfoManager.getInstance().getInfo(); + packet.writeD(itemInfos.size()); + for (Entry info : itemInfos.entrySet()) + { + packet.writeD(info.getKey()); // item id + packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME + } + + // Skills. + packet.writeD(0); + + return true; + } +} \ No newline at end of file