Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/trunk_398 Limpa/config/EnchantSystem.properties b/trunk_398 Limpa/config/EnchantSystem.properties
- new file mode 100644
- index 0000000..2bf801d
- --- /dev/null
- +++ b/trunk_398 Limpa/config/EnchantSystem.properties
- @@ -0,0 +1,100 @@
- +#============================================================#
- +# ENCHANT SETTINGS #
- +#============================================================#
- +# ----------------------------------------------
- +# Special Enchanting System -
- +# ----------------------------------------------
- +# Chance enchanting presented as a series of pairs of numbers where the first
- +# Indicates the number of levels, and the second chance of successful enchanting.
- +# Also have the option of limiting the maximum level of echanting
- +# For weapons / armor / jewelry.
- +# If you have a maximum level of grinding 50 and you do not want
- +# Give all the chances for each level (from 1 to 50) then
- +# You can specify for example:
- +# NormalWeaponEnchantLevel = 1,50; 2,50; 3,50; 4,75; 5,50;
- +# Example: 5,92; = if you enchant weapon to +5 you have 92% to success.
- +# ----------------------------------------------
- +# CHANCE FOR NORMAL SCROLLS -
- +# ----------------------------------------------
- +# Weapon
- +NormalWeaponEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52;
- +# Armor
- +NormalArmorEnchantLevel = 1,100;2,100;3,100;4,100;5,52;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52;
- +# Jewel
- +NormalJewelryEnchantLevel = 1,100;2,100;3,100;4,100;5,52;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52;
- +
- +# ----------------------------------------------
- +# CHANCE FOR BLESSEDS SCROLLS -
- +# ----------------------------------------------
- +# Weapon
- +BlessWeaponEnchantLevel = 1,100;2,100;3,100;4,100;5,52;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52;
- +# Armor
- +BlessArmorEnchantLevel = 1,100;2,100;3,100;4,100;5,52;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52;
- +# Jewel
- +BlessJewelryEnchantLevel = 1,100;2,100;3,100;4,100;5,52;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52;
- +
- +# ---------------------------------------------
- +# CHANCE FOR CRYSTALS SCROLLS -
- +# ---------------------------------------------
- +# Weapon
- +CrystalWeaponEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100;
- +# Armor
- +CrystalArmorEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100;
- +# Jewel
- +CrystalJewelryEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100;
- +
- +# ---------------------------------------------
- +# CHANCE FOR DONATOR SCROLLS -
- +# ---------------------------------------------
- +# Weapon
- +DonatorWeaponEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100;17,100;18,100;19,100;20,100;21,80;22,60;23,40;24,20;25,10;
- +# Armor
- +DonatorArmorEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100;17,100;18,100;19,100;20,100;21,80;22,60;23,40;24,20;25,10;
- +# Jewel
- +DonatorJewelryEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100;17,100;18,100;19,100;20,100;21,80;22,60;23,40;24,20;25,10;
- +
- +# On / off enchant hero weapons
- +EnableEnchantHeroWeapons = False
- +
- +# Scroll em um so slot
- +ScrollStackable = True
- +
- +# Safe enchant
- +EnchantSafeMax = 4
- +EnchantSafeMaxFull = 4
- +
- +# Max enchant Settings by scrolls.
- +EnchantWeaponMax=16
- +EnchantArmorMax=16
- +EnchantJewelryMax=16
- +
- +# Blessed Limit
- +BlessedEnchantWeaponMax = 16
- +BlessedEnchantArmorMax = 16
- +BlessedEnchantJewelryMax = 16
- +
- +# Enchant after break with blessed scroll.
- +BreakEnchant = 4
- +
- +# Crystal Limits
- +CrystalEnchantMin = 4
- +CrystalEnchantWeaponMax = 16
- +CrystalEnchantArmorMax = 16
- +CrystalEnchantJewelryMax = 16
- +
- +# Donator Enchant Limits
- +DonatorEnchantMin = 4
- +DonatorEnchantWeaponMax = 20
- +DonatorEnchantArmorMax = 20
- +DonatorEnchantJewelryMax = 20
- +DonatorBreakEnchant = 20
- +
- +# Se true quando enchant falhar, ira perder o enchant atual e reduzira 1 enchant no equipament
- +# se false o enchant falha, mas nao reduzira enchant no equipament, permanecera o mesmo enchant
- +DonatorDecreaseEnchant = True
- +
- +# Id donator scroll weapon
- +IdEnchantDonatorWeapon = 9506
- +
- +# Id donator scroll armor
- +IdEnchantDonatorArmor = 9507
- +
- +#Debug, mostrar erros no console caso tenha.
- +#Debug = False
- diff --git a/trunk_398 Limpa/config/players.properties b/trunk_398 Limpa/config/players.properties
- index 79b2515..bb953d5 100644
- --- a/trunk_398 Limpa/config/players.properties
- +++ b/trunk_398 Limpa/config/players.properties
- @@ -78,18 +78,6 @@
- EnchantChanceNonMagicWeapon = 0.7
- EnchantChanceNonMagicWeapon15Plus = 0.35
- -# % chance of success to enchant an armor part (both jewelry or armor)
- -EnchantChanceArmor = 0.66
- -
- -# Enchant limit [default = 0]
- -EnchantMaxWeapon = 0
- -EnchantMaxArmor = 0
- -
- -# if EnchantSafeMax is set to for ex '8' the item will be safly enchanted to '8' regardless of enchant chance(default = 3 for EnchantSafeMax and default = 4 for EnchantSafeMaxFull)
- -# EnchantSafeMaxFull is for full body armor (upper and lower), value should be > 0.
- -EnchantSafeMax = 3
- -EnchantSafeMaxFull = 4
- -
- #=============================================================
- # Augmentations
- #=============================================================
- diff --git a/trunk_398 Limpa/java/net/sf/l2j/Config.java b/trunk_398 Limpa/java/net/sf/l2j/Config.java
- index a2139f4..f844cc0 100644
- --- a/trunk_398 Limpa/java/net/sf/l2j/Config.java
- +++ b/trunk_398 Limpa/java/net/sf/l2j/Config.java
- @@ -35,7 +35,7 @@
- public static final String PLAYERS_FILE = "./config/players.properties";
- public static final String SERVER_FILE = "./config/server.properties";
- public static final String SIEGE_FILE = "./config/siege.properties";
- -
- + public static final String ENCHANTCONFIG = "./config/EnchantSystem.properties";
- // --------------------------------------------------
- // Clans settings
- // --------------------------------------------------
- @@ -367,6 +367,40 @@
- public static int ENCHANT_MAX_ARMOR;
- public static int ENCHANT_SAFE_MAX;
- public static int ENCHANT_SAFE_MAX_FULL;
- + public static int ENCHANT_WEAPON_MAX;
- + public static int ENCHANT_ARMOR_MAX;
- + public static int ENCHANT_JEWELRY_MAX;
- + public static int BLESSED_ENCHANT_WEAPON_MAX;
- + public static int BLESSED_ENCHANT_ARMOR_MAX;
- + public static int BLESSED_ENCHANT_JEWELRY_MAX;
- + public static int BREAK_ENCHANT;
- + public static int CRYSTAL_ENCHANT_MIN;
- + public static int CRYSTAL_ENCHANT_WEAPON_MAX;
- + public static int CRYSTAL_ENCHANT_ARMOR_MAX;
- + public static int CRYSTAL_ENCHANT_JEWELRY_MAX;
- + public static int DONATOR_ENCHANT_MIN;
- + public static int DONATOR_ENCHANT_WEAPON_MAX;
- + public static int DONATOR_ENCHANT_ARMOR_MAX;
- + public static int DONATOR_ENCHANT_JEWELRY_MAX;
- + public static boolean DONATOR_DECREASE_ENCHANT;
- + public static int GOLD_WEAPON;
- + public static int GOLD_ARMOR;
- + public static boolean SCROLL_STACKABLE;
- + public static boolean ENCHANT_HERO_WEAPON;
- + public static HashMap<Integer, Integer> NORMAL_WEAPON_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> BLESS_WEAPON_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> CRYSTAL_WEAPON_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> DONATOR_WEAPON_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> NORMAL_ARMOR_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> BLESS_ARMOR_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> CRYSTAL_ARMOR_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> DONATOR_ARMOR_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> NORMAL_JEWELRY_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> BLESS_JEWELRY_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> CRYSTAL_JEWELRY_ENCHANT_LEVEL = new HashMap<>();
- + public static HashMap<Integer, Integer> DONATOR_JEWELRY_ENCHANT_LEVEL = new HashMap<>();
- + public static boolean DEBUG;
- +
- /** Augmentations */
- public static int AUGMENTATION_NG_SKILL_CHANCE;
- @@ -989,11 +1023,6 @@
- ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS = players.getProperty("EnchantChanceMagicWeapon15Plus", 0.2);
- ENCHANT_CHANCE_WEAPON_NONMAGIC = players.getProperty("EnchantChanceNonMagicWeapon", 0.7);
- ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS = players.getProperty("EnchantChanceNonMagicWeapon15Plus", 0.35);
- - ENCHANT_CHANCE_ARMOR = players.getProperty("EnchantChanceArmor", 0.66);
- - ENCHANT_MAX_WEAPON = players.getProperty("EnchantMaxWeapon", 0);
- - ENCHANT_MAX_ARMOR = players.getProperty("EnchantMaxArmor", 0);
- - ENCHANT_SAFE_MAX = players.getProperty("EnchantSafeMax", 3);
- - ENCHANT_SAFE_MAX_FULL = players.getProperty("EnchantSafeMaxFull", 4);
- AUGMENTATION_NG_SKILL_CHANCE = players.getProperty("AugmentationNGSkillChance", 15);
- AUGMENTATION_NG_GLOW_CHANCE = players.getProperty("AugmentationNGGlowChance", 0);
- @@ -1078,7 +1107,371 @@
- MAX_BUFFS_AMOUNT = players.getProperty("MaxBuffsAmount", 20);
- STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true);
- }
- -
- + /**
- + * config enchant novo.
- + */
- + private static final void loadEnchantSystemConfig()
- + {
- + final ExProperties enchant = initProperties(ENCHANTCONFIG);
- + DEBUG = enchant.getProperty("Debug", false);
- + String[] propertySplit = enchant.getProperty("NormalWeaponEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + LOGGER.info("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + NORMAL_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + LOGGER.info("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("BlessWeaponEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + LOGGER.info("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + BLESS_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + LOGGER.info("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("CrystalWeaponEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + LOGGER.info("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + CRYSTAL_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + LOGGER.info("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("DonatorWeaponEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + System.out.println("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + DONATOR_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + System.out.println("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("NormalArmorEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + LOGGER.info("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + NORMAL_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + LOGGER.info("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("BlessArmorEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + LOGGER.info("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + BLESS_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + LOGGER.info("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("CrystalArmorEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + LOGGER.info("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + CRYSTAL_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + LOGGER.info("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("DonatorArmorEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + System.out.println("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + DONATOR_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + System.out.println("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("NormalJewelryEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + LOGGER.info("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + NORMAL_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + LOGGER.info("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("BlessJewelryEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + LOGGER.info("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + BLESS_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + LOGGER.info("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("CrystalJewelryEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + LOGGER.info("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + CRYSTAL_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + LOGGER.info("invalid config property");
- + }
- + }
- + }
- + }
- + propertySplit = enchant.getProperty("DonatorJewelryEnchantLevel", "").split(";");
- + for (String readData : propertySplit)
- + {
- + String[] writeData = readData.split(",");
- + if (writeData.length != 2)
- + {
- + System.out.println("invalid config property");
- + }
- + else
- + {
- + try
- + {
- + DONATOR_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (DEBUG)
- + {
- + nfe.printStackTrace();
- + }
- + if (!readData.equals(""))
- + {
- + System.out.println("invalid config property");
- + }
- + }
- + }
- + }
- + ENCHANT_HERO_WEAPON = Boolean.parseBoolean(enchant.getProperty("EnableEnchantHeroWeapons", "False"));
- +
- + GOLD_WEAPON = Integer.parseInt(enchant.getProperty("IdEnchantDonatorWeapon", "10010"));
- +
- + GOLD_ARMOR = Integer.parseInt(enchant.getProperty("IdEnchantDonatorArmor", "10011"));
- +
- + ENCHANT_SAFE_MAX = Integer.parseInt(enchant.getProperty("EnchantSafeMax", "3"));
- +
- + ENCHANT_SAFE_MAX_FULL = Integer.parseInt(enchant.getProperty("EnchantSafeMaxFull", "4"));
- +
- + SCROLL_STACKABLE = Boolean.parseBoolean(enchant.getProperty("ScrollStackable", "False"));
- +
- + ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("EnchantWeaponMax", "25"));
- + ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("EnchantArmorMax", "25"));
- + ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("EnchantJewelryMax", "25"));
- +
- + BLESSED_ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("BlessedEnchantWeaponMax", "25"));
- + BLESSED_ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("BlessedEnchantArmorMax", "25"));
- + BLESSED_ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("BlessedEnchantJewelryMax", "25"));
- +
- + BREAK_ENCHANT = Integer.valueOf(enchant.getProperty("BreakEnchant", "0")).intValue();
- +
- + CRYSTAL_ENCHANT_MIN = Integer.parseInt(enchant.getProperty("CrystalEnchantMin", "20"));
- + CRYSTAL_ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("CrystalEnchantWeaponMax", "25"));
- + CRYSTAL_ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("CrystalEnchantArmorMax", "25"));
- + CRYSTAL_ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("CrystalEnchantJewelryMax", "25"));
- +
- + DONATOR_ENCHANT_MIN = Integer.parseInt(enchant.getProperty("DonatorEnchantMin", "20"));
- + DONATOR_ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("DonatorEnchantWeaponMax", "25"));
- + DONATOR_ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("DonatorEnchantArmorMax", "25"));
- + DONATOR_ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("DonatorEnchantJewelryMax", "25"));
- + DONATOR_DECREASE_ENCHANT = Boolean.valueOf(enchant.getProperty("DonatorDecreaseEnchant", "false")).booleanValue();
- +
- + }
- /**
- * Loads siege settings.
- */
- @@ -1293,6 +1686,9 @@
- // siege settings
- loadSieges();
- + // enchant settings new
- + loadEnchantSystemConfig();
- +
- // server settings
- loadServer();
- }
- diff --git a/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/BaseExtender.java b/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/BaseExtender.java
- new file mode 100644
- index 0000000..9ac6d05
- --- /dev/null
- +++ b/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/BaseExtender.java
- @@ -0,0 +1,103 @@
- +package net.sf.l2j.gameserver.model.item.instance;
- +
- +import net.sf.l2j.gameserver.model.WorldObject;
- +
- +public class BaseExtender
- +{
- + protected WorldObject _owner;
- +
- + public static enum EventType
- + {
- + LOAD("load"),
- + STORE("store"),
- + CAST("cast"),
- + ATTACK("attack"),
- + CRAFT("craft"),
- + ENCHANT("enchant"),
- + SPAWN("spawn"),
- + DELETE("delete"),
- + SETOWNER("setwoner"),
- + DROP("drop"),
- + DIE("die"),
- + REVIVE("revive"),
- + SETINTENTION("setintention");
- +
- + public final String name;
- +
- + private EventType(String name)
- + {
- + this.name = name;
- + }
- + }
- +
- + public static boolean canCreateFor(WorldObject object)
- + {
- + return true;
- + }
- +
- + private BaseExtender _next = null;
- +
- + public BaseExtender(WorldObject owner)
- + {
- + _owner = owner;
- + }
- +
- + public WorldObject getOwner()
- + {
- + return _owner;
- + }
- +
- + public Object onEvent(String event, Object... params)
- + {
- + if (_next == null)
- + {
- + return null;
- + }
- + return _next.onEvent(event, params);
- + }
- +
- + public BaseExtender getExtender(String simpleClassName)
- + {
- + if (getClass().getSimpleName().compareTo(simpleClassName) == 0)
- + {
- + return this;
- + }
- + if (_next != null)
- + {
- + return _next.getExtender(simpleClassName);
- + }
- + return null;
- + }
- +
- + public void removeExtender(BaseExtender ext)
- + {
- + if (_next != null)
- + {
- + if (_next == ext)
- + {
- + _next = _next._next;
- + }
- + else
- + {
- + _next.removeExtender(ext);
- + }
- + }
- + }
- +
- + public BaseExtender getNextExtender()
- + {
- + return _next;
- + }
- +
- + public void addExtender(BaseExtender newExtender)
- + {
- + if (_next == null)
- + {
- + _next = newExtender;
- + }
- + else
- + {
- + _next.addExtender(newExtender);
- + }
- + }
- +}
- diff --git a/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java b/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java
- index 4fe230e..7a9d730 100644
- --- a/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java
- +++ b/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java
- @@ -1270,7 +1270,16 @@
- {
- _shotsMask = 0;
- }
- + private final BaseExtender _extender = null;
- + public Object fireEvent(String event, Object... params)
- + {
- + if (_extender == null)
- + {
- + return null;
- + }
- + return _extender.onEvent(event, params);
- + }
- @Override
- public int compareTo(ItemInstance item)
- {
- @@ -1280,4 +1289,13 @@
- return Integer.compare(item.getObjectId(), getObjectId());
- }
- +
- + public int getEquipSlot()
- + {
- + if ((Config.DEBUG) && (_loc != ItemLocation.PAPERDOLL) && (_loc != ItemLocation.PET_EQUIP) && (_loc != ItemLocation.FREIGHT))
- + {
- + throw new AssertionError();
- + }
- + return _locData;
- + }
- }
- \ No newline at end of file
- diff --git a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java
- index 50bda20..b094654 100644
- --- a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java
- +++ b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java
- @@ -2,27 +2,91 @@
- +package net.sf.l2j.gameserver.network.clientpackets;
- +
- +import net.sf.l2j.commons.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.enums.StatusType;
- +import net.sf.l2j.gameserver.enums.items.ItemLocation;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- +import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
- +import net.sf.l2j.gameserver.network.SystemMessageId;
- +import net.sf.l2j.gameserver.network.serverpackets.EnchantResult;
- +import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
- +import net.sf.l2j.gameserver.network.serverpackets.ItemList;
- +import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
- +import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
- +
- +public final class RequestEnchantItem extends L2GameClientPacket
- +{
- + private static final int[] DONATOR_WEAPON_SCROLL =
- + {
- + Config.GOLD_WEAPON
- + };
- + private static final int[] DONATOR_ARMOR_SCROLL =
- + {
- + Config.GOLD_ARMOR
- + };
- + private static final int[] CRYSTAL_SCROLLS =
- + {
- + 731,
- + 732,
- + 949,
- + 950,
- + 953,
- + 954,
- + 957,
- + 958,
- + 961,
- + 962
- + };
- + private static final int[] NORMAL_WEAPON_SCROLLS =
- + {
- + 729,
- + 947,
- + 951,
- + 955,
- + 959
- + };
- + private static final int[] BLESSED_WEAPON_SCROLLS =
- + {
- + 6569,
- + 6571,
- + 6573,
- + 6575,
- + 6577
- + };
- + private static final int[] CRYSTAL_WEAPON_SCROLLS =
- + {
- + 731,
- + 949,
- + 953,
- + 957,
- + 961
- + };
- + private static final int[] NORMAL_ARMOR_SCROLLS =
- + {
- + 730,
- + 948,
- + 952,
- + 956,
- + 960
- + };
- + private static final int[] BLESSED_ARMOR_SCROLLS =
- + {
- + 6570,
- + 6572,
- + 6574,
- + 6576,
- + 6578
- + };
- + private static final int[] CRYSTAL_ARMOR_SCROLLS =
- + {
- + 732,
- + 950,
- + 954,
- + 958,
- + 962
- + };
- + private int _objectId;
- +
- + @Override
- + protected void readImpl()
- + {
- + _objectId = readD();
- + }
- + @Override
- + protected void runImpl()
- + {
- + Player activeChar = getClient().getPlayer();
- + if ((activeChar == null) || (_objectId == 0))
- + {
- + return;
- + }
- + if (activeChar.getActiveTradeList() != null)
- + {
- + activeChar.cancelActiveTrade();
- + activeChar.sendMessage("Your trade canceled");
- + return;
- + }
- + if (activeChar.isProcessingTransaction())
- + {
- + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
- + activeChar.setActiveEnchantItem(null);
- + return;
- + }
- + if (!activeChar.isOnline())
- + {
- + activeChar.setActiveEnchantItem(null);
- + return;
- + }
- + if ((activeChar.isInOlympiadMode()) || (OlympiadManager.getInstance().isRegistered(activeChar)))
- + {
- + activeChar.sendMessage("[Olympiad]: Voce nao pode fazer isso!!");
- + return;
- + }
- + if (!activeChar.isOnline())
- + {
- + activeChar.setActiveEnchantItem(null);
- + return;
- + }
- + ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
- + ItemInstance scroll = activeChar.getActiveEnchantItem();
- + activeChar.setActiveEnchantItem(null);
- + if ((item == null) || (scroll == null))
- + {
- + activeChar.setActiveEnchantItem(null);
- + return;
- + }
- + if ((!Config.ENCHANT_HERO_WEAPON) && (item.getItemId() >= 6611) && (item.getItemId() <= 6621))
- + {
- + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
- + activeChar.setActiveEnchantItem(null);
- + return;
- + }
- + int itemType2 = item.getItem().getType2();
- + boolean enchantItem = false;
- + boolean blessedScroll = false;
- + boolean crystalScroll = false;
- + boolean donatorScroll = false;
- + int crystalId = 0;
- + switch (item.getItem().getCrystalType())
- + {
- + case A:
- + crystalId = 1461;
- + if ((scroll.getItemId() == Config.GOLD_WEAPON) && (itemType2 == 0))
- + {
- + enchantItem = true;
- + }
- + else if ((scroll.getItemId() == Config.GOLD_ARMOR) && ((itemType2 == 1) || (itemType2 == 2)))
- + {
- + enchantItem = true;
- + }
- + switch (scroll.getItemId())
- + {
- + case 729:
- + case 731:
- + case 6569:
- + if (itemType2 == 0)
- + {
- + enchantItem = true;
- + }
- + break;
- + case 730:
- + case 732:
- + case 6570:
- + if ((itemType2 == 1) || (itemType2 == 2))
- + {
- + enchantItem = true;
- + }
- + break;
- + }
- + break;
- + case B:
- + crystalId = 1460;
- + if ((scroll.getItemId() == Config.GOLD_WEAPON) && (itemType2 == 0))
- + {
- + enchantItem = true;
- + }
- + else if ((scroll.getItemId() == Config.GOLD_ARMOR) && ((itemType2 == 1) || (itemType2 == 2)))
- + {
- + enchantItem = true;
- + }
- + switch (scroll.getItemId())
- + {
- + case 947:
- + case 949:
- + case 6571:
- + if (itemType2 == 0)
- + {
- + enchantItem = true;
- + }
- + break;
- + case 948:
- + case 950:
- + case 6572:
- + if ((itemType2 == 1) || (itemType2 == 2))
- + {
- + enchantItem = true;
- + }
- + break;
- + }
- + break;
- + case C:
- + crystalId = 1459;
- + if ((scroll.getItemId() == Config.GOLD_WEAPON) && (itemType2 == 0))
- + {
- + enchantItem = true;
- + }
- + else if ((scroll.getItemId() == Config.GOLD_ARMOR) && ((itemType2 == 1) || (itemType2 == 2)))
- + {
- + enchantItem = true;
- + }
- + switch (scroll.getItemId())
- + {
- + case 951:
- + case 953:
- + case 6573:
- + if (itemType2 == 0)
- + {
- + enchantItem = true;
- + }
- + break;
- + case 952:
- + case 954:
- + case 6574:
- + if ((itemType2 == 1) || (itemType2 == 2))
- + {
- + enchantItem = true;
- + }
- + break;
- + }
- + break;
- + case D:
- + crystalId = 1458;
- + if ((scroll.getItemId() == Config.GOLD_WEAPON) && (itemType2 == 0))
- + {
- + enchantItem = true;
- + }
- + else if ((scroll.getItemId() == Config.GOLD_ARMOR) && ((itemType2 == 1) || (itemType2 == 2)))
- + {
- + enchantItem = true;
- + }
- + switch (scroll.getItemId())
- + {
- + case 955:
- + case 957:
- + case 6575:
- + if (itemType2 == 0)
- + {
- + enchantItem = true;
- + }
- + break;
- + case 956:
- + case 958:
- + case 6576:
- + if ((itemType2 == 1) || (itemType2 == 2))
- + {
- + enchantItem = true;
- + }
- + break;
- + }
- + break;
- + case S:
- + crystalId = 1462;
- + if ((scroll.getItemId() == Config.GOLD_WEAPON) && (itemType2 == 0))
- + {
- + enchantItem = true;
- + }
- + else if ((scroll.getItemId() == Config.GOLD_ARMOR) && ((itemType2 == 1) || (itemType2 == 2)))
- + {
- + enchantItem = true;
- + }
- + switch (scroll.getItemId())
- + {
- + case 959:
- + case 961:
- + case 6577:
- + if (itemType2 == 0)
- + {
- + enchantItem = true;
- + }
- + break;
- + case 960:
- + case 962:
- + case 6578:
- + if ((itemType2 == 1) || (itemType2 == 2))
- + {
- + enchantItem = true;
- + }
- + break;
- + }
- + break;
- + }
- + if (!enchantItem)
- + {
- + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
- + return;
- + }
- + if ((scroll.getItemId() >= 6569) && (scroll.getItemId() <= 6578))
- + {
- + blessedScroll = true;
- + }
- + else if ((scroll.getItemId() == Config.GOLD_WEAPON) || (scroll.getItemId() == Config.GOLD_ARMOR))
- + {
- + donatorScroll = true;
- + }
- + else
- + {
- + for (int crystalscroll : CRYSTAL_SCROLLS)
- + {
- + if (scroll.getItemId() == crystalscroll)
- + {
- + crystalScroll = true;
- + break;
- + }
- + }
- + }
- + int chance = 0;
- + int maxEnchantLevel = 0;
- + int minEnchantLevel = 0;
- + int nextEnchantLevel = item.getEnchantLevel() + 1;
- + if (item.getItem().getType2() == 0)
- + {
- + if (blessedScroll)
- + {
- + for (int blessedweaponscroll : BLESSED_WEAPON_SCROLLS)
- + {
- + if (scroll.getItemId() == blessedweaponscroll)
- + {
- + if (item.getEnchantLevel() >= Config.BLESS_WEAPON_ENCHANT_LEVEL.size())
- + {
- + chance = Config.BLESS_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.BLESS_WEAPON_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.BLESS_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + maxEnchantLevel = Config.BLESSED_ENCHANT_WEAPON_MAX;
- + break;
- + }
- + }
- + }
- + else if (crystalScroll)
- + {
- + for (int crystalweaponscroll : CRYSTAL_WEAPON_SCROLLS)
- + {
- + if (scroll.getItemId() == crystalweaponscroll)
- + {
- + if (item.getEnchantLevel() >= Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.size())
- + {
- + chance = Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + minEnchantLevel = Config.CRYSTAL_ENCHANT_MIN;
- + maxEnchantLevel = Config.CRYSTAL_ENCHANT_WEAPON_MAX;
- + break;
- + }
- + }
- + }
- + else if (donatorScroll)
- + {
- + for (int donateweaponscroll : DONATOR_WEAPON_SCROLL)
- + {
- + if (scroll.getItemId() == donateweaponscroll)
- + {
- + if (item.getEnchantLevel() >= Config.DONATOR_WEAPON_ENCHANT_LEVEL.size())
- + {
- + chance = Config.DONATOR_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.DONATOR_WEAPON_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.DONATOR_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + minEnchantLevel = Config.DONATOR_ENCHANT_MIN;
- + maxEnchantLevel = Config.DONATOR_ENCHANT_WEAPON_MAX;
- + break;
- + }
- + }
- + }
- + else
- + {
- + for (int normalweaponscroll : NORMAL_WEAPON_SCROLLS)
- + {
- + if (scroll.getItemId() == normalweaponscroll)
- + {
- + if (item.getEnchantLevel() >= Config.NORMAL_WEAPON_ENCHANT_LEVEL.size())
- + {
- + chance = Config.NORMAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.NORMAL_WEAPON_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.NORMAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + maxEnchantLevel = Config.ENCHANT_WEAPON_MAX;
- + break;
- + }
- + }
- + }
- + }
- + else if (item.getItem().getType2() == 1)
- + {
- + if (blessedScroll)
- + {
- + for (int blessedarmorscroll : BLESSED_ARMOR_SCROLLS)
- + {
- + if (scroll.getItemId() == blessedarmorscroll)
- + {
- + if (item.getEnchantLevel() >= Config.BLESS_ARMOR_ENCHANT_LEVEL.size())
- + {
- + chance = Config.BLESS_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.BLESS_ARMOR_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.BLESS_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + maxEnchantLevel = Config.BLESSED_ENCHANT_ARMOR_MAX;
- + break;
- + }
- + }
- + }
- + else if (crystalScroll)
- + {
- + for (int crystalarmorscroll : CRYSTAL_ARMOR_SCROLLS)
- + {
- + if (scroll.getItemId() == crystalarmorscroll)
- + {
- + if (item.getEnchantLevel() >= Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.size())
- + {
- + chance = Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + minEnchantLevel = Config.CRYSTAL_ENCHANT_MIN;
- + maxEnchantLevel = Config.CRYSTAL_ENCHANT_ARMOR_MAX;
- + break;
- + }
- + }
- + }
- + else if (donatorScroll)
- + {
- + for (int donatorarmorscroll : DONATOR_ARMOR_SCROLL)
- + {
- + if (scroll.getItemId() == donatorarmorscroll)
- + {
- + if (item.getEnchantLevel() >= Config.DONATOR_ARMOR_ENCHANT_LEVEL.size())
- + {
- + chance = Config.DONATOR_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.DONATOR_ARMOR_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.DONATOR_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + minEnchantLevel = Config.DONATOR_ENCHANT_MIN;
- + maxEnchantLevel = Config.DONATOR_ENCHANT_ARMOR_MAX;
- + break;
- + }
- + }
- + }
- + else
- + {
- + for (int normalarmorscroll : NORMAL_ARMOR_SCROLLS)
- + {
- + if (scroll.getItemId() == normalarmorscroll)
- + {
- + if (item.getEnchantLevel() >= Config.NORMAL_ARMOR_ENCHANT_LEVEL.size())
- + {
- + chance = Config.NORMAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.NORMAL_ARMOR_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.NORMAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + maxEnchantLevel = Config.ENCHANT_ARMOR_MAX;
- + break;
- + }
- + }
- + }
- + }
- + else if (item.getItem().getType2() == 2)
- + {
- + if (blessedScroll)
- + {
- + for (int blessedjewelscroll : BLESSED_ARMOR_SCROLLS)
- + {
- + if (scroll.getItemId() == blessedjewelscroll)
- + {
- + if (item.getEnchantLevel() >= Config.BLESS_JEWELRY_ENCHANT_LEVEL.size())
- + {
- + chance = Config.BLESS_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.BLESS_JEWELRY_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.BLESS_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + maxEnchantLevel = Config.BLESSED_ENCHANT_JEWELRY_MAX;
- + break;
- + }
- + }
- + }
- + else if (crystalScroll)
- + {
- + for (int crystaljewelscroll : CRYSTAL_ARMOR_SCROLLS)
- + {
- + if (scroll.getItemId() == crystaljewelscroll)
- + {
- + if (item.getEnchantLevel() >= Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.size())
- + {
- + chance = Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + minEnchantLevel = Config.CRYSTAL_ENCHANT_MIN;
- + maxEnchantLevel = Config.CRYSTAL_ENCHANT_JEWELRY_MAX;
- +
- + break;
- + }
- + }
- + }
- + else if (donatorScroll)
- + {
- + for (int donatorjewelscroll : DONATOR_ARMOR_SCROLL)
- + {
- + if (scroll.getItemId() == donatorjewelscroll)
- + {
- + if (item.getEnchantLevel() >= Config.DONATOR_JEWELRY_ENCHANT_LEVEL.size())
- + {
- + chance = Config.DONATOR_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.DONATOR_JEWELRY_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.DONATOR_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + minEnchantLevel = Config.DONATOR_ENCHANT_MIN;
- + maxEnchantLevel = Config.DONATOR_ENCHANT_JEWELRY_MAX;
- + break;
- + }
- + }
- + }
- + else
- + {
- + for (int normaljewelscroll : NORMAL_ARMOR_SCROLLS)
- + {
- + if (scroll.getItemId() == normaljewelscroll)
- + {
- + if (item.getEnchantLevel() >= Config.NORMAL_JEWELRY_ENCHANT_LEVEL.size())
- + {
- + chance = Config.NORMAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.NORMAL_JEWELRY_ENCHANT_LEVEL.size())).intValue();
- + }
- + else
- + {
- + chance = Config.NORMAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
- + }
- + maxEnchantLevel = Config.ENCHANT_JEWELRY_MAX;
- + break;
- + }
- + }
- + }
- + }
- + if (((maxEnchantLevel != 0) && (item.getEnchantLevel() >= maxEnchantLevel)) || (item.getEnchantLevel() < minEnchantLevel) || (item.getEnchantLevel() >= nextEnchantLevel))
- + {
- + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
- + return;
- + }
- + if (Config.SCROLL_STACKABLE)
- + {
- + scroll = activeChar.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, activeChar, item);
- + }
- + else
- + {
- + scroll = activeChar.getInventory().destroyItem("Enchant", scroll, activeChar, item);
- + }
- + if (scroll == null)
- + {
- + activeChar.sendPacket(SystemMessageId.NOT_ENOUGH_ITEMS);
- + return;
- + }
- + if ((item.getEnchantLevel() < Config.ENCHANT_SAFE_MAX) || ((item.getItem().getBodyPart() == 32768) && (item.getEnchantLevel() < Config.ENCHANT_SAFE_MAX_FULL)))
- + {
- + chance = 100;
- + }
- + int rndValue = Rnd.get(100);
- +
- + Object aChance = item.fireEvent("calcEnchantChance", new Object[chance]);
- + if (aChance != null)
- + {
- + chance = ((Integer) aChance).intValue();
- + }
- + synchronized (item)
- + {
- + if (rndValue < chance)
- + {
- + if (item.getOwnerId() != activeChar.getObjectId())
- + {
- + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
- + return;
- + }
- + if ((item.getLocation() != ItemLocation.INVENTORY) && (item.getLocation() != ItemLocation.PAPERDOLL))
- + {
- + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
- + return;
- + }
- + if (item.getEnchantLevel() == 0)
- + {
- + SystemMessage sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
- + sm.addItemName(item.getItemId());
- + activeChar.sendPacket(sm);
- + }
- + else
- + {
- + SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
- + sm.addNumber(item.getEnchantLevel());
- + sm.addItemName(item.getItemId());
- + activeChar.sendPacket(sm);
- +
- + }
- + item.setEnchantLevel(item.getEnchantLevel() + 1);
- + item.updateDatabase();
- + }
- + else
- + {
- + if (crystalScroll)
- + {
- + SystemMessage sm = SystemMessage.sendString("Failed in Crystal Enchant. The enchant value of the item become " + Config.CRYSTAL_ENCHANT_MIN);
- + activeChar.sendPacket(sm);
- + }
- + else if (blessedScroll)
- + {
- + SystemMessage sm = new SystemMessage(SystemMessageId.BLESSED_ENCHANT_FAILED);
- + activeChar.sendPacket(sm);
- + }
- + else if (donatorScroll)
- + {
- + if (Config.DONATOR_DECREASE_ENCHANT)
- + {
- + if (item.getEnchantLevel() <= Config.DONATOR_ENCHANT_MIN)
- + {
- + SystemMessage sm1 = SystemMessage.sendString("Failed Golden Enchant.");
- + activeChar.sendPacket(sm1);
- + }
- + else
- + {
- + SystemMessage sm1 = SystemMessage.sendString("Failed Golden Enchant. His equipment had 1 reduced enchant.");
- + activeChar.sendPacket(sm1);
- + }
- + }
- + else
- + {
- + SystemMessage sm1 = SystemMessage.sendString("Failed Golden Enchant.");
- + activeChar.sendPacket(sm1);
- + }
- + }
- + else if (item.getEnchantLevel() > 0)
- + {
- + SystemMessage sm = new SystemMessage(SystemMessageId.ENCHANTMENT_FAILED_S1_S2_EVAPORATED);
- + sm.addNumber(item.getEnchantLevel());
- + sm.addItemName(item.getItemId());
- + activeChar.sendPacket(sm);
- + }
- + else
- + {
- + SystemMessage sm = new SystemMessage(SystemMessageId.ENCHANTMENT_FAILED_S1_EVAPORATED);
- + sm.addItemName(item.getItemId());
- + activeChar.sendPacket(sm);
- + }
- + if ((!blessedScroll) && (!crystalScroll) && (!donatorScroll))
- + {
- + if (item.getEnchantLevel() > 0)
- + {
- + SystemMessage sm = new SystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED);
- + sm.addNumber(item.getEnchantLevel());
- + sm.addItemName(item.getItemId());
- + activeChar.sendPacket(sm);
- + }
- + else
- + {
- + SystemMessage sm = new SystemMessage(SystemMessageId.S1_DISARMED);
- + sm.addItemName(item.getItemId());
- + activeChar.sendPacket(sm);
- + }
- + if (item.isEquipped())
- + {
- + if (item.isAugmented())
- + {
- + item.getAugmentation().removeBonus(activeChar);
- + }
- + ItemInstance[] unequiped = activeChar.getInventory().unequipItemInSlotAndRecord(item.getEquipSlot());
- + InventoryUpdate iu = new InventoryUpdate();
- + for (ItemInstance element : unequiped)
- + {
- + iu.addModifiedItem(element);
- + }
- + activeChar.sendPacket(iu);
- +
- + activeChar.broadcastUserInfo();
- + }
- + int count = item.getCrystalCount() - (item.getItem().getCrystalCount() + 1) / 2;
- + if (count < 1)
- + {
- + count = 1;
- + }
- + if (item.fireEvent("enchantFail", new Object[0]) != null)
- + {
- + return;
- + }
- + ItemInstance destroyItem = activeChar.getInventory().destroyItem("Enchant", item, activeChar, null);
- + if (destroyItem == null)
- + {
- + return;
- + }
- + ItemInstance crystals = activeChar.getInventory().addItem("Enchant", crystalId, count, activeChar, destroyItem);
- +
- + SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
- + sm.addItemName(crystals.getItemId());
- + sm.addNumber(count);
- + activeChar.sendPacket(sm);
- +
- + activeChar.sendPacket(new ItemList(activeChar, true));
- +
- + StatusUpdate su = new StatusUpdate(activeChar);
- + su.addAttribute(StatusType.CUR_LOAD, activeChar.getCurrentWeight());
- + activeChar.sendPacket(su);
- +
- + activeChar.broadcastUserInfo();
- +
- + World world = World.getInstance();
- + world.removeObject(destroyItem);
- + }
- + else if (blessedScroll)
- + {
- + item.setEnchantLevel(Config.BREAK_ENCHANT);
- + item.updateDatabase();
- + }
- + else if (crystalScroll)
- + {
- + item.setEnchantLevel(Config.CRYSTAL_ENCHANT_MIN);
- + item.updateDatabase();
- + }
- + else if (donatorScroll)
- + {
- + if (Config.DONATOR_DECREASE_ENCHANT)
- + {
- + if (item.getEnchantLevel() <= Config.DONATOR_ENCHANT_MIN)
- + {
- + item.setEnchantLevel(item.getEnchantLevel());
- + }
- + else
- + {
- + item.setEnchantLevel(item.getEnchantLevel() - 1);
- + }
- + }
- + else
- + {
- + item.setEnchantLevel(item.getEnchantLevel());
- + }
- + item.updateDatabase();
- + }
- + }
- + }
- +
- + StatusUpdate su = new StatusUpdate(activeChar);
- + su.addAttribute(StatusType.CUR_LOAD, activeChar.getCurrentWeight());
- + activeChar.sendPacket(su);
- + su = null;
- +
- + activeChar.sendPacket(new EnchantResult(item.getEnchantLevel()));
- + activeChar.sendPacket(new ItemList(activeChar, false));
- + activeChar.broadcastUserInfo();
- + activeChar.setActiveEnchantItem(null);
- + }
- +
- + @Override
- + public String getType()
- + {
- + return "[C] 58 RequestEnchantItem";
- + }
- +}
- diff --git a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/EnchantResult.java b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/EnchantResult.java
- index 4a90ea6..32bc359 100644
- --- a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/EnchantResult.java
- +++ b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/EnchantResult.java
- @@ -10,7 +10,7 @@
- private final int _result;
- - private EnchantResult(int result)
- + public EnchantResult(int result)
- {
- _result = result;
- }
- diff --git a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java
- index f4ad4e9..a2cfb75 100644
- --- a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java
- +++ b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java
- @@ -28,7 +28,7 @@
- private SMParam[] _params;
- private int _paramIndex;
- - private SystemMessage(final SystemMessageId smId)
- + public SystemMessage(final SystemMessageId smId)
- {
- final int paramCount = smId.getParamCount();
- _smId = smId;
Add Comment
Please, Sign In to add comment