Support for fixed safe enchant level.

This commit is contained in:
MobiusDevelopment 2020-12-23 11:27:58 +00:00
parent 1836b9974e
commit d5c27d9e44
52 changed files with 765 additions and 62 deletions

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -73,8 +74,9 @@ public abstract class AbstractEnchantItem
throw new IllegalAccessError();
}
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("maxEnchant", 0);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -1,17 +1,84 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="enchant" maxOccurs="unbounded" minOccurs="0">
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="enchant" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:int" name="id" use="optional"/>
<xs:attribute type="xs:string" name="targetGrade" use="optional"/>
<xs:attribute type="xs:byte" name="scrollGroupId" use="optional"/>
<xs:attribute type="xs:int" name="maxEnchant" use="optional"/> <!-- enchant limit -->
</xs:extension>
</xs:simpleContent>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="step" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:attribute type="xs:byte" name="level" use="required" />
<xs:attribute type="xs:double" name="successRate" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:positiveInteger" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:positiveInteger" use="required" />
<xs:attribute name="minEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchantFighter">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchantMagic">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1.0" />
<xs:maxInclusive value="100.0" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="targetGrade">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="D" />
<xs:enumeration value="C" />
<xs:enumeration value="B" />
<xs:enumeration value="A" />
<xs:enumeration value="S" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="scrollGroupId" type="xs:int" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -1,17 +1,84 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="enchant" maxOccurs="unbounded" minOccurs="0">
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="enchant" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:int" name="id" use="optional"/>
<xs:attribute type="xs:string" name="targetGrade" use="optional"/>
<xs:attribute type="xs:byte" name="scrollGroupId" use="optional"/>
<xs:attribute type="xs:int" name="maxEnchant" use="optional"/> <!-- enchant limit -->
</xs:extension>
</xs:simpleContent>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="step" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:attribute type="xs:byte" name="level" use="required" />
<xs:attribute type="xs:double" name="successRate" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:positiveInteger" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:positiveInteger" use="required" />
<xs:attribute name="minEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchantFighter">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchantMagic">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1.0" />
<xs:maxInclusive value="100.0" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="targetGrade">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="D" />
<xs:enumeration value="C" />
<xs:enumeration value="B" />
<xs:enumeration value="A" />
<xs:enumeration value="S" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="scrollGroupId" type="xs:int" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -1,17 +1,84 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="enchant" maxOccurs="unbounded" minOccurs="0">
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="enchant" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:int" name="id" use="optional"/>
<xs:attribute type="xs:string" name="targetGrade" use="optional"/>
<xs:attribute type="xs:byte" name="scrollGroupId" use="optional"/>
<xs:attribute type="xs:int" name="maxEnchant" use="optional"/> <!-- enchant limit -->
</xs:extension>
</xs:simpleContent>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="step" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:attribute type="xs:byte" name="level" use="required" />
<xs:attribute type="xs:double" name="successRate" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:positiveInteger" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:positiveInteger" use="required" />
<xs:attribute name="minEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchantFighter">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchantMagic">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1.0" />
<xs:maxInclusive value="100.0" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="targetGrade">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="D" />
<xs:enumeration value="C" />
<xs:enumeration value="B" />
<xs:enumeration value="A" />
<xs:enumeration value="S" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="scrollGroupId" type="xs:int" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -1,17 +1,84 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="enchant" maxOccurs="unbounded" minOccurs="0">
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="enchant" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:int" name="id" use="optional"/>
<xs:attribute type="xs:string" name="targetGrade" use="optional"/>
<xs:attribute type="xs:byte" name="scrollGroupId" use="optional"/>
<xs:attribute type="xs:int" name="maxEnchant" use="optional"/> <!-- enchant limit -->
</xs:extension>
</xs:simpleContent>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="step" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:attribute type="xs:byte" name="level" use="required" />
<xs:attribute type="xs:double" name="successRate" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:positiveInteger" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:positiveInteger" use="required" />
<xs:attribute name="minEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchantFighter">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchantMagic">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1.0" />
<xs:maxInclusive value="100.0" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="targetGrade">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="D" />
<xs:enumeration value="C" />
<xs:enumeration value="B" />
<xs:enumeration value="A" />
<xs:enumeration value="S" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="scrollGroupId" type="xs:int" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -1,17 +1,84 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="enchant" maxOccurs="unbounded" minOccurs="0">
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="enchant" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:int" name="id" use="optional"/>
<xs:attribute type="xs:string" name="targetGrade" use="optional"/>
<xs:attribute type="xs:byte" name="scrollGroupId" use="optional"/>
<xs:attribute type="xs:int" name="maxEnchant" use="optional"/> <!-- enchant limit -->
</xs:extension>
</xs:simpleContent>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="step" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:attribute type="xs:byte" name="level" use="required" />
<xs:attribute type="xs:double" name="successRate" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:positiveInteger" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:positiveInteger" use="required" />
<xs:attribute name="minEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchantFighter">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxEnchantMagic">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="1.0" />
<xs:maxInclusive value="100.0" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="targetGrade">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="D" />
<xs:enumeration value="C" />
<xs:enumeration value="B" />
<xs:enumeration value="A" />
<xs:enumeration value="S" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="scrollGroupId" type="xs:int" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}

View File

@ -4,21 +4,21 @@
<enchant id="959" targetGrade="S" maxEnchant="16" />
<enchant id="729" targetGrade="A" maxEnchant="16" />
<enchant id="947" targetGrade="B" maxEnchant="16" />
<enchant id="93406" targetGrade="B" maxEnchant="16" />
<enchant id="93406" targetGrade="B" maxEnchant="16" safeEnchant="4" />
<enchant id="951" targetGrade="C" maxEnchant="16" />
<enchant id="93408" targetGrade="C" maxEnchant="16" />
<enchant id="93408" targetGrade="C" maxEnchant="16" safeEnchant="4" />
<enchant id="955" targetGrade="D" maxEnchant="16" />
<enchant id="93410" targetGrade="D" maxEnchant="16" />
<enchant id="93410" targetGrade="D" maxEnchant="16" safeEnchant="4" />
<!-- Scrolls: Enchant Armor -->
<enchant id="960" targetGrade="S" maxEnchant="16" />
<enchant id="730" targetGrade="A" maxEnchant="16" />
<enchant id="948" targetGrade="B" maxEnchant="16" />
<enchant id="93407" targetGrade="B" maxEnchant="16" />
<enchant id="93407" targetGrade="B" maxEnchant="16" safeEnchant="4" />
<enchant id="952" targetGrade="C" maxEnchant="16" />
<enchant id="93409" targetGrade="C" maxEnchant="16" />
<enchant id="93409" targetGrade="C" maxEnchant="16" safeEnchant="4" />
<enchant id="956" targetGrade="D" maxEnchant="16" scrollGroupId="0" /> <!-- Default scroll groups binding. -->
<enchant id="93411" targetGrade="D" maxEnchant="16" scrollGroupId="0" /> <!-- Default scroll groups binding. -->
<enchant id="93411" targetGrade="D" maxEnchant="16" safeEnchant="4" scrollGroupId="0" /> <!-- Default scroll groups binding. -->
<!-- Blessed Scrolls: Enchant Weapon -->
<enchant id="6577" targetGrade="S" maxEnchant="16" />

View File

@ -51,6 +51,14 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="safeEnchant">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1" />
<xs:maxInclusive value="127" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="bonusRate">
<xs:simpleType>
<xs:restriction base="xs:decimal">

View File

@ -59,6 +59,7 @@ public abstract class AbstractEnchantItem
private final CrystalType _grade;
private final int _minEnchantLevel;
private final int _maxEnchantLevel;
private final int _safeEnchantLevel;
private final double _bonusRate;
public AbstractEnchantItem(StatSet set)
@ -75,6 +76,7 @@ public abstract class AbstractEnchantItem
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
_minEnchantLevel = set.getInt("minEnchant", 0);
_maxEnchantLevel = set.getInt("maxEnchant", 127);
_safeEnchantLevel = set.getInt("safeEnchant", 0);
_bonusRate = set.getDouble("bonusRate", 0);
}
@ -131,6 +133,14 @@ public abstract class AbstractEnchantItem
return _maxEnchantLevel;
}
/**
* @return the safe enchant level of this scroll/item
*/
public int getSafeEnchant()
{
return _safeEnchantLevel;
}
/**
* @param itemToEnchant the item to be enchanted
* @param supportItem

View File

@ -187,6 +187,12 @@ public class EnchantScroll extends AbstractEnchantItem
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
return -1;
}
if ((getSafeEnchant() > 0) && (enchantItem.getEnchantLevel() < getSafeEnchant()))
{
return 100;
}
return group.getChance(enchantItem.getEnchantLevel());
}