Giant scrolls.

Contributed by Ofelin.
This commit is contained in:
MobiusDev
2017-11-17 21:58:44 +00:00
parent e0df4e1992
commit cef624e6cd
32 changed files with 185 additions and 90 deletions

View File

@@ -42,6 +42,8 @@ public abstract class AbstractEnchantItem
EtcItemType.BLESS_ENCHT_WP,
EtcItemType.ENCHT_AM,
EtcItemType.ENCHT_WP,
EtcItemType.GIANT_ENCHT_AM,
EtcItemType.GIANT_ENCHT_WP,
EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_AM,
EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_WP,
};

View File

@@ -37,6 +37,7 @@ public final class EnchantScroll extends AbstractEnchantItem
private final boolean _isWeapon;
private final boolean _isBlessed;
private final boolean _isSafe;
private final boolean _isGiant;
private final int _scrollGroupId;
private Set<Integer> _items;
@@ -46,9 +47,10 @@ public final class EnchantScroll extends AbstractEnchantItem
_scrollGroupId = set.getInt("scrollGroupId", 0);
final ItemType type = getItem().getItemType();
_isWeapon = (type == EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP) || (type == EtcItemType.BLESS_ENCHT_WP) || (type == EtcItemType.ENCHT_WP);
_isWeapon = (type == EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP) || (type == EtcItemType.BLESS_ENCHT_WP) || (type == EtcItemType.ENCHT_WP) || (type == EtcItemType.GIANT_ENCHT_WP);
_isBlessed = (type == EtcItemType.BLESS_ENCHT_AM) || (type == EtcItemType.BLESS_ENCHT_WP);
_isSafe = (type == EtcItemType.ENCHT_ATTR_CRYSTAL_ENCHANT_AM) || (type == EtcItemType.ENCHT_ATTR_CRYSTAL_ENCHANT_WP);
_isGiant = (type == EtcItemType.GIANT_ENCHT_AM) || (type == EtcItemType.GIANT_ENCHT_WP);
}
@Override
@@ -73,6 +75,11 @@ public final class EnchantScroll extends AbstractEnchantItem
return _isSafe;
}
public boolean isGiant()
{
return _isGiant;
}
/**
* @return id of scroll group that should be used
*/

View File

@@ -42,6 +42,8 @@ public enum EtcItemType implements ItemType
MATURECROP,
ENCHT_WP,
ENCHT_AM,
GIANT_ENCHT_WP,
GIANT_ENCHT_AM,
BLESS_ENCHT_WP,
BLESS_ENCHT_AM,
COUPON,

View File

@@ -20,6 +20,7 @@ import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemData;
import com.l2jmobius.gameserver.enums.ItemSkillType;
import com.l2jmobius.gameserver.enums.UserInfoType;
@@ -184,7 +185,14 @@ public final class RequestEnchantItem implements IClientIncomingPacket
// Increase enchant level only if scroll's base template has chance, some armors can success over +20 but they shouldn't have increased.
if (scrollTemplate.getChance(activeChar, item) > 0)
{
item.setEnchantLevel(item.getEnchantLevel() + 1);
if (scrollTemplate.isGiant())
{
item.setEnchantLevel(Math.min(item.getEnchantLevel() + 1 + Rnd.get(3), scrollTemplate.getMaxEnchantLevel()));
}
else
{
item.setEnchantLevel(item.getEnchantLevel() + 1);
}
item.updateDatabase();
}
client.sendPacket(new EnchantResult(EnchantResult.SUCCESS, item));