Replaced ItemCollectionData holder with ItemEnchantHolder.

This commit is contained in:
MobiusDevelopment
2022-05-16 22:11:37 +00:00
parent cd46f22057
commit 75ecbcfc13
24 changed files with 54 additions and 348 deletions

View File

@@ -32,7 +32,7 @@ import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.CollectionDataHolder;
import org.l2jmobius.gameserver.model.holders.ItemCollectionData;
import org.l2jmobius.gameserver.model.holders.ItemEnchantHolder;
import org.l2jmobius.gameserver.model.item.ItemTemplate;
/**
@@ -88,7 +88,7 @@ public class CollectionData implements IXmlReader
final int id = parseInteger(attrs, "id");
final int optionId = parseInteger(attrs, "optionId");
final int category = parseInteger(attrs, "category");
List<ItemCollectionData> items = new ArrayList<>();
final List<ItemEnchantHolder> items = new ArrayList<>();
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
{
attrs = b.getAttributes();
@@ -103,7 +103,7 @@ public class CollectionData implements IXmlReader
LOGGER.severe(getClass().getSimpleName() + ": Item template null for itemId: " + itemId + " collection item: " + id);
continue;
}
items.add(new ItemCollectionData(itemId, itemCount, itemEnchantLevel));
items.add(new ItemEnchantHolder(itemId, itemCount, itemEnchantLevel));
}
}

View File

@@ -26,9 +26,9 @@ public class CollectionDataHolder
private final int _collectionId;
private final int _optionId;
private final int _category;
private final List<ItemCollectionData> _items;
private final List<ItemEnchantHolder> _items;
public CollectionDataHolder(int collectionId, int optionId, int category, List<ItemCollectionData> items)
public CollectionDataHolder(int collectionId, int optionId, int category, List<ItemEnchantHolder> items)
{
_collectionId = collectionId;
_optionId = optionId;
@@ -51,7 +51,7 @@ public class CollectionDataHolder
return _category;
}
public List<ItemCollectionData> getItems()
public List<ItemEnchantHolder> getItems()
{
return _items;
}

View File

@@ -1,49 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.holders;
/**
* Written by Berezkin Nikolay, on 04.05.2021
*/
public class ItemCollectionData
{
private final int _enchantLevel;
private final int _itemId;
private final long _count;
public ItemCollectionData(int itemId, long count, int enchantLevel)
{
_itemId = itemId;
_count = count;
_enchantLevel = enchantLevel;
}
public int getItemId()
{
return _itemId;
}
public int getEnchantLevel()
{
return _enchantLevel;
}
public long getCount()
{
return _count;
}
}

View File

@@ -21,7 +21,7 @@ import org.l2jmobius.gameserver.data.xml.CollectionData;
import org.l2jmobius.gameserver.data.xml.OptionData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.CollectionDataHolder;
import org.l2jmobius.gameserver.model.holders.ItemCollectionData;
import org.l2jmobius.gameserver.model.holders.ItemEnchantHolder;
import org.l2jmobius.gameserver.model.holders.PlayerCollectionData;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.options.Options;
@@ -72,9 +72,9 @@ public class RequestCollectionRegister implements IClientIncomingPacket
}
long count = 0;
for (ItemCollectionData data : collection.getItems())
for (ItemEnchantHolder data : collection.getItems())
{
if ((data.getItemId() == item.getId()) && ((data.getEnchantLevel() == 0) || (data.getEnchantLevel() == item.getEnchantLevel())))
if ((data.getId() == item.getId()) && ((data.getEnchantLevel() == 0) || (data.getEnchantLevel() == item.getEnchantLevel())))
{
count = data.getCount();
break;