Fixed items enchanted by specific scrolls.
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.data.xml.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
@ -132,6 +133,11 @@ public class EnchantItemData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<EnchantScroll> getScrolls()
|
||||
{
|
||||
return _scrolls.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the enchant scroll.
|
||||
* @param scroll the scroll
|
||||
|
@ -20,6 +20,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnchantItemData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnchantItemGroupsData;
|
||||
import org.l2jmobius.gameserver.model.StatsSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@ -99,6 +100,11 @@ public class EnchantScroll extends AbstractEnchantItem
|
||||
_items.add(itemId);
|
||||
}
|
||||
|
||||
public Set<Integer> getItems()
|
||||
{
|
||||
return _items;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemToEnchant the item to be enchanted
|
||||
* @param supportItem the support item used when enchanting (can be null)
|
||||
@ -107,6 +113,18 @@ public class EnchantScroll extends AbstractEnchantItem
|
||||
@Override
|
||||
public boolean isValid(ItemInstance itemToEnchant, EnchantSupportItem supportItem)
|
||||
{
|
||||
for (EnchantScroll scroll : EnchantItemData.getInstance().getScrolls())
|
||||
{
|
||||
if (scroll.getId() == getId())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final Set<Integer> scrollItems = scroll.getItems();
|
||||
if ((scrollItems != null) && scrollItems.contains(itemToEnchant.getId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ((_items != null) && !_items.contains(itemToEnchant.getId()))
|
||||
{
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user