Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/com/equal/Config.java
- ===================================================================
- --- java/com/equal/Config.java (revision 341)
- +++ java/com/equal/Config.java (working copy)
- @@ -25,10 +25,12 @@
- import java.math.BigInteger;
- import java.util.ArrayList;
- import java.util.List;
- +import java.util.Map;
- import java.util.Properties;
- import java.util.logging.Logger;
- import javolution.util.FastList;
- +import javolution.util.FastMap;
- import com.equal.gameserver.model.actor.instance.L2PcInstance;
- import com.equal.gameserver.util.FloodProtectorConfig;
- @@ -660,6 +662,12 @@
- public static int ENCHANT_CHANCE_WEAPON_BLESSED; /** Chance that a Blessed Scroll will have to enchant over safe limit */
- public static int ENCHANT_CHANCE_ARMOR_BLESSED; /** Chance that a Blessed Scroll will have to enchant over safe limit */
- public static int ENCHANT_CHANCE_JEWELRY_BLESSED; /** Chance that a Blessed Scroll will have to enchant over safe limit */
- + public static Map<Integer, Integer> ENCHANT_CHANCE_WEAPON_LIST;
- + public static Map<Integer, Integer> ENCHANT_CHANCE_ARMOR_LIST;
- + public static Map<Integer, Integer> ENCHANT_CHANCE_JEWELRY_LIST;
- + public static Map<Integer, Integer> BLESSED_ENCHANT_CHANCE_WEAPON_LIST;
- + public static Map<Integer, Integer> BLESSED_ENCHANT_CHANCE_ARMOR_LIST;
- + public static Map<Integer, Integer> BLESSED_ENCHANT_CHANCE_JEWELRY_LIST;
- public static int ENCHANT_MAX_ALLOWED_WEAPON; /** Max possible enchant by player */
- public static int ENCHANT_MAX_ALLOWED_ARMOR; /** Max possible enchant by player */
- public static int ENCHANT_MAX_ALLOWED_JEWELRY; /** Max possible enchant by player */
- @@ -1615,6 +1623,102 @@
- ENCHANT_CHANCE_WEAPON_BLESSED = Integer.parseInt(otherSettings.getProperty("EnchantChanceWeaponBlessed", "55"));
- ENCHANT_CHANCE_ARMOR_BLESSED = Integer.parseInt(otherSettings.getProperty("EnchantChanceArmorBlessed", "55"));
- ENCHANT_CHANCE_JEWELRY_BLESSED = Integer.parseInt(otherSettings.getProperty("EnchantChanceJewelryBlessed", "55"));
- + String[] propertySplitWeapon = otherSettings.getProperty("EnchantChanceWeaponList", "").split(";");
- + String[] propertySplitArmor = otherSettings.getProperty("EnchantChanceArmorList", "").split(";");
- + String[] propertySplitJewelry = otherSettings.getProperty("EnchantChanceJewelryList", "").split(";");
- + String[] propertySplitBlessedWeapon = otherSettings.getProperty("BlessedEnchantChanceWeaponList", "").split(";");
- + String[] propertySplitBlessedArmor = otherSettings.getProperty("BlessedEnchantChanceArmorList", "").split(";");
- + String[] propertySplitBlessedJewelry = otherSettings.getProperty("BlessedEnchantChanceJewelryList", "").split(";");
- + ENCHANT_CHANCE_WEAPON_LIST = new FastMap<Integer, Integer>(propertySplitWeapon.length);
- + ENCHANT_CHANCE_ARMOR_LIST = new FastMap<Integer, Integer>(propertySplitArmor.length);
- + ENCHANT_CHANCE_JEWELRY_LIST = new FastMap<Integer, Integer>(propertySplitJewelry.length);
- + BLESSED_ENCHANT_CHANCE_WEAPON_LIST = new FastMap<Integer, Integer>(propertySplitBlessedWeapon.length);
- + BLESSED_ENCHANT_CHANCE_ARMOR_LIST = new FastMap<Integer, Integer>(propertySplitBlessedArmor.length);
- + BLESSED_ENCHANT_CHANCE_JEWELRY_LIST = new FastMap<Integer, Integer>(propertySplitBlessedJewelry.length);
- + if (propertySplitWeapon.length > 1)
- + {
- + for (String enchant : propertySplitWeapon)
- + {
- + String[] enchantSplit = enchant.split(",");
- + if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
- + else
- + {
- + try{ENCHANT_CHANCE_WEAPON_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
- + catch (NumberFormatException nfe){
- + if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
- + }
- + }
- + }
- + if (propertySplitArmor.length > 1)
- + {
- + for (String enchant : propertySplitArmor)
- + {
- + String[] enchantSplit = enchant.split(",");
- + if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
- + else
- + {
- + try{ENCHANT_CHANCE_ARMOR_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
- + catch (NumberFormatException nfe){
- + if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
- + }
- + }
- + }
- + if (propertySplitJewelry.length > 1)
- + {
- + for (String enchant : propertySplitJewelry)
- + {
- + String[] enchantSplit = enchant.split(",");
- + if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
- + else
- + {
- + try{ENCHANT_CHANCE_JEWELRY_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
- + catch (NumberFormatException nfe){
- + if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
- + }
- + }
- + }
- + if (propertySplitBlessedWeapon.length > 1)
- + {
- + for (String enchant : propertySplitBlessedWeapon)
- + {
- + String[] enchantSplit = enchant.split(",");
- + if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
- + else
- + {
- + try{BLESSED_ENCHANT_CHANCE_WEAPON_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
- + catch (NumberFormatException nfe){
- + if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
- + }
- + }
- + }
- + if (propertySplitBlessedArmor.length > 1)
- + {
- + for (String enchant : propertySplitBlessedArmor)
- + {
- + String[] enchantSplit = enchant.split(",");
- + if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
- + else
- + {
- + try{BLESSED_ENCHANT_CHANCE_ARMOR_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
- + catch (NumberFormatException nfe){
- + if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
- + }
- + }
- + }
- + if (propertySplitBlessedJewelry.length > 1)
- + {
- + for (String enchant : propertySplitBlessedJewelry)
- + {
- + String[] enchantSplit = enchant.split(",");
- + if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
- + else
- + {
- + try{BLESSED_ENCHANT_CHANCE_JEWELRY_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
- + catch (NumberFormatException nfe){
- + if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
- + }
- + }
- + }
- ENCHANT_MAX_ALLOWED_WEAPON = Integer.parseInt(otherSettings.getProperty("EnchantMaxAllowedWeapon", "255"));
- ENCHANT_MAX_ALLOWED_ARMOR = Integer.parseInt(otherSettings.getProperty("EnchantMaxAllowedArmor", "255"));
- ENCHANT_MAX_ALLOWED_JEWELRY = Integer.parseInt(otherSettings.getProperty("EnchantMaxAllowedJewelry", "255"));
- Index: java/com/equal/gameserver/network/clientpackets/RequestEnchantItem.java
- ===================================================================
- --- java/com/equal/gameserver/network/clientpackets/RequestEnchantItem.java (revision 341)
- +++ java/com/equal/gameserver/network/clientpackets/RequestEnchantItem.java (working copy)
- @@ -206,7 +206,13 @@
- {
- if (scroll.getItemId() == scrollId)
- {
- - chance = Config.ENCHANT_CHANCE_WEAPON;
- + if (!Config.ENCHANT_CHANCE_WEAPON_LIST.isEmpty())
- + {
- + if (Config.ENCHANT_CHANCE_WEAPON_LIST.containsKey(item.getEnchantLevel()+1))
- + chance = Config.ENCHANT_CHANCE_WEAPON_LIST.get(item.getEnchantLevel()+1);
- + else chance = Config.ENCHANT_CHANCE_WEAPON;
- + }
- + else chance = Config.ENCHANT_CHANCE_WEAPON;
- break;
- }
- }
- @@ -223,7 +229,13 @@
- {
- if (scroll.getItemId() == scrollId)
- {
- - chance = Config.ENCHANT_CHANCE_WEAPON_BLESSED;
- + if (!Config.BLESSED_ENCHANT_CHANCE_WEAPON_LIST.isEmpty())
- + {
- + if (Config.BLESSED_ENCHANT_CHANCE_WEAPON_LIST.containsKey(item.getEnchantLevel()+1))
- + chance = Config.BLESSED_ENCHANT_CHANCE_WEAPON_LIST.get(item.getEnchantLevel()+1);
- + else chance = Config.ENCHANT_CHANCE_WEAPON_BLESSED;
- + }
- + else chance = Config.ENCHANT_CHANCE_WEAPON_BLESSED;
- break;
- }
- }
- @@ -235,7 +247,13 @@
- {
- if (scroll.getItemId() == scrollId)
- {
- - chance = Config.ENCHANT_CHANCE_ARMOR;
- + if (!Config.ENCHANT_CHANCE_ARMOR_LIST.isEmpty())
- + {
- + if (Config.ENCHANT_CHANCE_ARMOR_LIST.containsKey(item.getEnchantLevel()+1))
- + chance = Config.ENCHANT_CHANCE_ARMOR_LIST.get(item.getEnchantLevel()+1);
- + else chance = Config.ENCHANT_CHANCE_ARMOR;
- + }
- + else chance = Config.ENCHANT_CHANCE_ARMOR;
- break;
- }
- }
- @@ -251,7 +269,13 @@
- {
- if (scroll.getItemId() == scrollId)
- {
- - chance = Config.ENCHANT_CHANCE_ARMOR_BLESSED;
- + if (!Config.BLESSED_ENCHANT_CHANCE_ARMOR_LIST.isEmpty())
- + {
- + if (Config.BLESSED_ENCHANT_CHANCE_ARMOR_LIST.containsKey(item.getEnchantLevel()+1))
- + chance = Config.BLESSED_ENCHANT_CHANCE_ARMOR_LIST.get(item.getEnchantLevel()+1);
- + else chance = Config.ENCHANT_CHANCE_ARMOR_BLESSED;
- + }
- + else chance = Config.ENCHANT_CHANCE_ARMOR_BLESSED;
- break;
- }
- }
- @@ -262,7 +286,13 @@
- {
- if (scroll.getItemId() == scrollId)
- {
- - chance = Config.ENCHANT_CHANCE_JEWELRY;
- + if (!Config.ENCHANT_CHANCE_JEWELRY_LIST.isEmpty())
- + {
- + if (Config.ENCHANT_CHANCE_JEWELRY_LIST.containsKey(item.getEnchantLevel()+1))
- + chance = Config.ENCHANT_CHANCE_JEWELRY_LIST.get(item.getEnchantLevel()+1);
- + else chance = Config.ENCHANT_CHANCE_JEWELRY;
- + }
- + else chance = Config.ENCHANT_CHANCE_JEWELRY;
- break;
- }
- }
- @@ -278,7 +308,13 @@
- {
- if (scroll.getItemId() == scrollId)
- {
- - chance = Config.ENCHANT_CHANCE_JEWELRY_BLESSED;
- + if (!Config.BLESSED_ENCHANT_CHANCE_JEWELRY_LIST.isEmpty())
- + {
- + if (Config.BLESSED_ENCHANT_CHANCE_JEWELRY_LIST.containsKey(item.getEnchantLevel()+1))
- + chance = Config.BLESSED_ENCHANT_CHANCE_JEWELRY_LIST.get(item.getEnchantLevel()+1);
- + else chance = Config.ENCHANT_CHANCE_JEWELRY_BLESSED;
- + }
- + else chance = Config.ENCHANT_CHANCE_JEWELRY_BLESSED;
- break;
- }
- }
- Index: config/other.properties
- ===================================================================
- --- config/other.properties (revision 341)
- +++ config/other.properties (working copy)
- @@ -61,7 +61,30 @@
- EnchantChanceArmorBlessed = 100
- EnchantChanceJewelryBlessed = 100
- +# This is a list where you define different enchant chance on different enchant levels
- +# Format: enchantLevel1,enchantChance1;enchantLevel2,enchantChance2...
- +# Example:
- +# The "\"indicates new line, and is only set for formating purposes.
- +# EnchantChanceWeaponList = 4,90;5,80;6,75;7,70;8,65;\
- +# 9,60;10,50;11,20;12,10;13,50;14,25;15,20
- +# No ";" or ";\" at the end
- +# So, if the enchant chance for +15 is set to 30%, the enchanter will have 30%
- +# chance to enchant the weapon from +14 to +15
- +# If a specific enchant level isnt described in the list, or the list is empty,
- +# the chance will be the one set at default configs
- +# (ex. EnchantChanceWeapon = ?? / EnchantChanceArmor = ?? / EnchantChanceJewelry = ??)
- +# So if you miss in the list for example, +15 for weapon, the chance will be
- +# the one set at EnchantChanceWeapon (BlessedEnchantChanceWeapon for blessed)
- +EnchantChanceWeaponList =
- +EnchantChanceArmorList =
- +EnchantChanceJewelryList =
- +BlessedEnchantChanceWeaponList =
- +BlessedEnchantChanceArmorList =
- +BlessedEnchantChanceJewelryList =
- +
- # Enchant limit [default = 0 (unlimited)]
- # EnchantMaxAllowe is if any player has bigger enchant gets banned. EnchantMax is what max value can be put by scrols.
- EnchantMaxAllowedWeapon = 65535
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement