Addition of item deletion info.

Thanks to Index.
This commit is contained in:
MobiusDevelopment 2022-04-03 07:15:06 +00:00
parent ea842ca77b
commit f7f2720f85
32 changed files with 968 additions and 0 deletions

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> _items = new HashMap<>();
protected ItemDeletionInfoManager()
{
}
public void addItemInfo(int itemId, Date date)
{
_items.put(itemId, date);
}
public Map<Integer, Date> getInfo()
{
return _items;
}
public static ItemDeletionInfoManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager();
}
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> itemInfos = ItemDeletionInfoManager.getInstance().getInfo();
packet.writeD(itemInfos.size());
for (Entry<Integer, Date> info : itemInfos.entrySet())
{
packet.writeD(info.getKey()); // item id
packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME
}
// Skills.
packet.writeD(0);
return true;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> _items = new HashMap<>();
protected ItemDeletionInfoManager()
{
}
public void addItemInfo(int itemId, Date date)
{
_items.put(itemId, date);
}
public Map<Integer, Date> getInfo()
{
return _items;
}
public static ItemDeletionInfoManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager();
}
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> itemInfos = ItemDeletionInfoManager.getInstance().getInfo();
packet.writeD(itemInfos.size());
for (Entry<Integer, Date> info : itemInfos.entrySet())
{
packet.writeD(info.getKey()); // item id
packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME
}
// Skills.
packet.writeD(0);
return true;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> _items = new HashMap<>();
protected ItemDeletionInfoManager()
{
}
public void addItemInfo(int itemId, Date date)
{
_items.put(itemId, date);
}
public Map<Integer, Date> getInfo()
{
return _items;
}
public static ItemDeletionInfoManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager();
}
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> itemInfos = ItemDeletionInfoManager.getInstance().getInfo();
packet.writeD(itemInfos.size());
for (Entry<Integer, Date> info : itemInfos.entrySet())
{
packet.writeD(info.getKey()); // item id
packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME
}
// Skills.
packet.writeD(0);
return true;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> _items = new HashMap<>();
protected ItemDeletionInfoManager()
{
}
public void addItemInfo(int itemId, Date date)
{
_items.put(itemId, date);
}
public Map<Integer, Date> getInfo()
{
return _items;
}
public static ItemDeletionInfoManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager();
}
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> itemInfos = ItemDeletionInfoManager.getInstance().getInfo();
packet.writeD(itemInfos.size());
for (Entry<Integer, Date> info : itemInfos.entrySet())
{
packet.writeD(info.getKey()); // item id
packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME
}
// Skills.
packet.writeD(0);
return true;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> _items = new HashMap<>();
protected ItemDeletionInfoManager()
{
}
public void addItemInfo(int itemId, Date date)
{
_items.put(itemId, date);
}
public Map<Integer, Date> getInfo()
{
return _items;
}
public static ItemDeletionInfoManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager();
}
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> itemInfos = ItemDeletionInfoManager.getInstance().getInfo();
packet.writeD(itemInfos.size());
for (Entry<Integer, Date> info : itemInfos.entrySet())
{
packet.writeD(info.getKey()); // item id
packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME
}
// Skills.
packet.writeD(0);
return true;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> _items = new HashMap<>();
protected ItemDeletionInfoManager()
{
}
public void addItemInfo(int itemId, Date date)
{
_items.put(itemId, date);
}
public Map<Integer, Date> getInfo()
{
return _items;
}
public static ItemDeletionInfoManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager();
}
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> itemInfos = ItemDeletionInfoManager.getInstance().getInfo();
packet.writeD(itemInfos.size());
for (Entry<Integer, Date> info : itemInfos.entrySet())
{
packet.writeD(info.getKey()); // item id
packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME
}
// Skills.
packet.writeD(0);
return true;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> _items = new HashMap<>();
protected ItemDeletionInfoManager()
{
}
public void addItemInfo(int itemId, Date date)
{
_items.put(itemId, date);
}
public Map<Integer, Date> getInfo()
{
return _items;
}
public static ItemDeletionInfoManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager();
}
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> itemInfos = ItemDeletionInfoManager.getInstance().getInfo();
packet.writeD(itemInfos.size());
for (Entry<Integer, Date> info : itemInfos.entrySet())
{
packet.writeD(info.getKey()); // item id
packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME
}
// Skills.
packet.writeD(0);
return true;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> _items = new HashMap<>();
protected ItemDeletionInfoManager()
{
}
public void addItemInfo(int itemId, Date date)
{
_items.put(itemId, date);
}
public Map<Integer, Date> getInfo()
{
return _items;
}
public static ItemDeletionInfoManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final ItemDeletionInfoManager INSTANCE = new ItemDeletionInfoManager();
}
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, Date> itemInfos = ItemDeletionInfoManager.getInstance().getInfo();
packet.writeD(itemInfos.size());
for (Entry<Integer, Date> info : itemInfos.entrySet())
{
packet.writeD(info.getKey()); // item id
packet.writeD((int) (info.getValue().getTime() / 1000)); // UNIX TIME
}
// Skills.
packet.writeD(0);
return true;
}
}