Addition of ExCollectionActiveEvent server packet.

Contributed by Fakee.
This commit is contained in:
MobiusDevelopment 2023-01-13 02:14:10 +00:00
parent dd9f3c03b2
commit 04af7d61d6
18 changed files with 384 additions and 6 deletions

View File

@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -43,6 +44,7 @@ public class CollectionData implements IXmlReader
private static final Logger LOGGER = Logger.getLogger(CollectionData.class.getName());
private static final Map<Integer, CollectionDataHolder> _collections = new HashMap<>();
private static final Map<Integer, List<CollectionDataHolder>> _collectionsByTabId = new HashMap<>();
protected CollectionData()
{
@ -108,7 +110,9 @@ public class CollectionData implements IXmlReader
}
}
_collections.put(id, new CollectionDataHolder(id, optionId, category, completeCount, items));
final CollectionDataHolder template = new CollectionDataHolder(id, optionId, category, completeCount, items);
_collections.put(id, template);
_collectionsByTabId.computeIfAbsent(template.getCategory(), list -> new ArrayList<>()).add(template);
}
}
}
@ -120,6 +124,15 @@ public class CollectionData implements IXmlReader
return _collections.get(id);
}
public List<CollectionDataHolder> getCollectionsByTabId(int tabId)
{
if (_collectionsByTabId.containsKey(tabId))
{
return _collectionsByTabId.get(tabId);
}
return Collections.emptyList();
}
public Collection<CollectionDataHolder> getCollections()
{
return _collections.values();

View File

@ -115,6 +115,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SkillList;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import org.l2jmobius.gameserver.network.serverpackets.attendance.ExVipAttendanceItemList;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionActiveEvent;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionInfo;
import org.l2jmobius.gameserver.network.serverpackets.friend.L2FriendList;
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
@ -686,6 +687,7 @@ public class EnterWorld implements ClientPacket
{
player.sendPacket(new ExCollectionInfo(player, category));
}
player.sendPacket(new ExCollectionActiveEvent());
player.sendPacket(new ItemDeletionInfo());

View File

@ -0,0 +1,48 @@
/*
* 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.collection;
import java.util.List;
import org.l2jmobius.gameserver.data.xml.CollectionData;
import org.l2jmobius.gameserver.model.holders.CollectionDataHolder;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Fakee
*/
public class ExCollectionActiveEvent extends ServerPacket
{
private final List<CollectionDataHolder> _collections;
public ExCollectionActiveEvent()
{
_collections = CollectionData.getInstance().getCollectionsByTabId(7);
}
@Override
public void write()
{
ServerPackets.EX_COLLECTION_ACTIVE_EVENT.writeId(this);
writeInt(_collections.size());
for (CollectionDataHolder collection : _collections)
{
writeShort(collection.getCollectionId());
}
}
}

View File

@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -43,6 +44,7 @@ public class CollectionData implements IXmlReader
private static final Logger LOGGER = Logger.getLogger(CollectionData.class.getName());
private static final Map<Integer, CollectionDataHolder> _collections = new HashMap<>();
private static final Map<Integer, List<CollectionDataHolder>> _collectionsByTabId = new HashMap<>();
protected CollectionData()
{
@ -108,7 +110,9 @@ public class CollectionData implements IXmlReader
}
}
_collections.put(id, new CollectionDataHolder(id, optionId, category, completeCount, items));
final CollectionDataHolder template = new CollectionDataHolder(id, optionId, category, completeCount, items);
_collections.put(id, template);
_collectionsByTabId.computeIfAbsent(template.getCategory(), list -> new ArrayList<>()).add(template);
}
}
}
@ -120,6 +124,15 @@ public class CollectionData implements IXmlReader
return _collections.get(id);
}
public List<CollectionDataHolder> getCollectionsByTabId(int tabId)
{
if (_collectionsByTabId.containsKey(tabId))
{
return _collectionsByTabId.get(tabId);
}
return Collections.emptyList();
}
public Collection<CollectionDataHolder> getCollections()
{
return _collections.values();

View File

@ -115,6 +115,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SkillList;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import org.l2jmobius.gameserver.network.serverpackets.attendance.ExVipAttendanceItemList;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionActiveEvent;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionInfo;
import org.l2jmobius.gameserver.network.serverpackets.friend.L2FriendList;
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
@ -690,6 +691,7 @@ public class EnterWorld implements ClientPacket
{
player.sendPacket(new ExCollectionInfo(player, category));
}
player.sendPacket(new ExCollectionActiveEvent());
player.sendPacket(new ItemDeletionInfo());

View File

@ -0,0 +1,48 @@
/*
* 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.collection;
import java.util.List;
import org.l2jmobius.gameserver.data.xml.CollectionData;
import org.l2jmobius.gameserver.model.holders.CollectionDataHolder;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Fakee
*/
public class ExCollectionActiveEvent extends ServerPacket
{
private final List<CollectionDataHolder> _collections;
public ExCollectionActiveEvent()
{
_collections = CollectionData.getInstance().getCollectionsByTabId(7);
}
@Override
public void write()
{
ServerPackets.EX_COLLECTION_ACTIVE_EVENT.writeId(this);
writeInt(_collections.size());
for (CollectionDataHolder collection : _collections)
{
writeShort(collection.getCollectionId());
}
}
}

View File

@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -43,6 +44,7 @@ public class CollectionData implements IXmlReader
private static final Logger LOGGER = Logger.getLogger(CollectionData.class.getName());
private static final Map<Integer, CollectionDataHolder> _collections = new HashMap<>();
private static final Map<Integer, List<CollectionDataHolder>> _collectionsByTabId = new HashMap<>();
protected CollectionData()
{
@ -108,7 +110,9 @@ public class CollectionData implements IXmlReader
}
}
_collections.put(id, new CollectionDataHolder(id, optionId, category, completeCount, items));
final CollectionDataHolder template = new CollectionDataHolder(id, optionId, category, completeCount, items);
_collections.put(id, template);
_collectionsByTabId.computeIfAbsent(template.getCategory(), list -> new ArrayList<>()).add(template);
}
}
}
@ -120,6 +124,15 @@ public class CollectionData implements IXmlReader
return _collections.get(id);
}
public List<CollectionDataHolder> getCollectionsByTabId(int tabId)
{
if (_collectionsByTabId.containsKey(tabId))
{
return _collectionsByTabId.get(tabId);
}
return Collections.emptyList();
}
public Collection<CollectionDataHolder> getCollections()
{
return _collections.values();

View File

@ -116,6 +116,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SkillList;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import org.l2jmobius.gameserver.network.serverpackets.attendance.ExVipAttendanceItemList;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionActiveEvent;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionInfo;
import org.l2jmobius.gameserver.network.serverpackets.friend.L2FriendList;
import org.l2jmobius.gameserver.network.serverpackets.herobook.ExHeroBookInfo;
@ -698,6 +699,7 @@ public class EnterWorld implements ClientPacket
{
player.sendPacket(new ExCollectionInfo(player, category));
}
player.sendPacket(new ExCollectionActiveEvent());
player.sendPacket(new ItemDeletionInfo());

View File

@ -0,0 +1,48 @@
/*
* 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.collection;
import java.util.List;
import org.l2jmobius.gameserver.data.xml.CollectionData;
import org.l2jmobius.gameserver.model.holders.CollectionDataHolder;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Fakee
*/
public class ExCollectionActiveEvent extends ServerPacket
{
private final List<CollectionDataHolder> _collections;
public ExCollectionActiveEvent()
{
_collections = CollectionData.getInstance().getCollectionsByTabId(7);
}
@Override
public void write()
{
ServerPackets.EX_COLLECTION_ACTIVE_EVENT.writeId(this);
writeInt(_collections.size());
for (CollectionDataHolder collection : _collections)
{
writeShort(collection.getCollectionId());
}
}
}

View File

@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -43,6 +44,7 @@ public class CollectionData implements IXmlReader
private static final Logger LOGGER = Logger.getLogger(CollectionData.class.getName());
private static final Map<Integer, CollectionDataHolder> _collections = new HashMap<>();
private static final Map<Integer, List<CollectionDataHolder>> _collectionsByTabId = new HashMap<>();
protected CollectionData()
{
@ -108,7 +110,9 @@ public class CollectionData implements IXmlReader
}
}
_collections.put(id, new CollectionDataHolder(id, optionId, category, completeCount, items));
final CollectionDataHolder template = new CollectionDataHolder(id, optionId, category, completeCount, items);
_collections.put(id, template);
_collectionsByTabId.computeIfAbsent(template.getCategory(), list -> new ArrayList<>()).add(template);
}
}
}
@ -120,6 +124,15 @@ public class CollectionData implements IXmlReader
return _collections.get(id);
}
public List<CollectionDataHolder> getCollectionsByTabId(int tabId)
{
if (_collectionsByTabId.containsKey(tabId))
{
return _collectionsByTabId.get(tabId);
}
return Collections.emptyList();
}
public Collection<CollectionDataHolder> getCollections()
{
return _collections.values();

View File

@ -112,6 +112,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
import org.l2jmobius.gameserver.network.serverpackets.SkillList;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.attendance.ExVipAttendanceItemList;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionActiveEvent;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionInfo;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExConnectedTimeAndGettableReward;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
@ -682,6 +683,7 @@ public class EnterWorld implements ClientPacket
{
player.sendPacket(new ExCollectionInfo(player, category));
}
player.sendPacket(new ExCollectionActiveEvent());
player.sendPacket(new ExSubjugationSidebar(player, player.getPurgePoints().get(player.getPurgeLastCategory())));

View File

@ -0,0 +1,48 @@
/*
* 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.collection;
import java.util.List;
import org.l2jmobius.gameserver.data.xml.CollectionData;
import org.l2jmobius.gameserver.model.holders.CollectionDataHolder;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Fakee
*/
public class ExCollectionActiveEvent extends ServerPacket
{
private final List<CollectionDataHolder> _collections;
public ExCollectionActiveEvent()
{
_collections = CollectionData.getInstance().getCollectionsByTabId(7);
}
@Override
public void write()
{
ServerPackets.EX_COLLECTION_ACTIVE_EVENT.writeId(this);
writeInt(_collections.size());
for (CollectionDataHolder collection : _collections)
{
writeShort(collection.getCollectionId());
}
}
}

View File

@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -43,6 +44,7 @@ public class CollectionData implements IXmlReader
private static final Logger LOGGER = Logger.getLogger(CollectionData.class.getName());
private static final Map<Integer, CollectionDataHolder> _collections = new HashMap<>();
private static final Map<Integer, List<CollectionDataHolder>> _collectionsByTabId = new HashMap<>();
protected CollectionData()
{
@ -108,7 +110,9 @@ public class CollectionData implements IXmlReader
}
}
_collections.put(id, new CollectionDataHolder(id, optionId, category, completeCount, items));
final CollectionDataHolder template = new CollectionDataHolder(id, optionId, category, completeCount, items);
_collections.put(id, template);
_collectionsByTabId.computeIfAbsent(template.getCategory(), list -> new ArrayList<>()).add(template);
}
}
}
@ -120,6 +124,15 @@ public class CollectionData implements IXmlReader
return _collections.get(id);
}
public List<CollectionDataHolder> getCollectionsByTabId(int tabId)
{
if (_collectionsByTabId.containsKey(tabId))
{
return _collectionsByTabId.get(tabId);
}
return Collections.emptyList();
}
public Collection<CollectionDataHolder> getCollections()
{
return _collections.values();

View File

@ -113,6 +113,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
import org.l2jmobius.gameserver.network.serverpackets.SkillList;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.attendance.ExVipAttendanceItemList;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionActiveEvent;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionInfo;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExConnectedTimeAndGettableReward;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
@ -698,6 +699,7 @@ public class EnterWorld implements ClientPacket
{
player.sendPacket(new ExCollectionInfo(player, category));
}
player.sendPacket(new ExCollectionActiveEvent());
player.sendPacket(new ExSubjugationSidebar(player, player.getPurgePoints().get(player.getPurgeLastCategory())));

View File

@ -0,0 +1,48 @@
/*
* 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.collection;
import java.util.List;
import org.l2jmobius.gameserver.data.xml.CollectionData;
import org.l2jmobius.gameserver.model.holders.CollectionDataHolder;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Fakee
*/
public class ExCollectionActiveEvent extends ServerPacket
{
private final List<CollectionDataHolder> _collections;
public ExCollectionActiveEvent()
{
_collections = CollectionData.getInstance().getCollectionsByTabId(7);
}
@Override
public void write()
{
ServerPackets.EX_COLLECTION_ACTIVE_EVENT.writeId(this);
writeInt(_collections.size());
for (CollectionDataHolder collection : _collections)
{
writeShort(collection.getCollectionId());
}
}
}

View File

@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -43,6 +44,7 @@ public class CollectionData implements IXmlReader
private static final Logger LOGGER = Logger.getLogger(CollectionData.class.getName());
private static final Map<Integer, CollectionDataHolder> _collections = new HashMap<>();
private static final Map<Integer, List<CollectionDataHolder>> _collectionsByTabId = new HashMap<>();
protected CollectionData()
{
@ -108,7 +110,9 @@ public class CollectionData implements IXmlReader
}
}
_collections.put(id, new CollectionDataHolder(id, optionId, category, completeCount, items));
final CollectionDataHolder template = new CollectionDataHolder(id, optionId, category, completeCount, items);
_collections.put(id, template);
_collectionsByTabId.computeIfAbsent(template.getCategory(), list -> new ArrayList<>()).add(template);
}
}
}
@ -120,6 +124,15 @@ public class CollectionData implements IXmlReader
return _collections.get(id);
}
public List<CollectionDataHolder> getCollectionsByTabId(int tabId)
{
if (_collectionsByTabId.containsKey(tabId))
{
return _collectionsByTabId.get(tabId);
}
return Collections.emptyList();
}
public Collection<CollectionDataHolder> getCollections()
{
return _collections.values();

View File

@ -113,6 +113,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
import org.l2jmobius.gameserver.network.serverpackets.SkillList;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.attendance.ExVipAttendanceItemList;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionActiveEvent;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionInfo;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExConnectedTimeAndGettableReward;
import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
@ -698,6 +699,7 @@ public class EnterWorld implements ClientPacket
{
player.sendPacket(new ExCollectionInfo(player, category));
}
player.sendPacket(new ExCollectionActiveEvent());
player.sendPacket(new ExSubjugationSidebar(player, player.getPurgePoints().get(player.getPurgeLastCategory())));

View File

@ -0,0 +1,48 @@
/*
* 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.collection;
import java.util.List;
import org.l2jmobius.gameserver.data.xml.CollectionData;
import org.l2jmobius.gameserver.model.holders.CollectionDataHolder;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Fakee
*/
public class ExCollectionActiveEvent extends ServerPacket
{
private final List<CollectionDataHolder> _collections;
public ExCollectionActiveEvent()
{
_collections = CollectionData.getInstance().getCollectionsByTabId(7);
}
@Override
public void write()
{
ServerPackets.EX_COLLECTION_ACTIVE_EVENT.writeId(this);
writeInt(_collections.size());
for (CollectionDataHolder collection : _collections)
{
writeShort(collection.getCollectionId());
}
}
}