Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: config/main/rates.properties
- ===================================================================
- --- config/main/rates.properties (revision 980)
- +++ config/main/rates.properties (working copy)
- @@ -80,6 +80,38 @@
- EnchantChanceCrystal = 88
- EnchantChanceArmor = 66
- EnchantChanceJewelry = 66
- +# 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 =
- +
- +# List of item id that will be affected by EnchantChance lists
- +# (separated by "," like 77,78,79).
- +# Notes:
- +# *Make sure the lists do NOT CONTAIN trailing spaces or spaces between the numbers!
- +# *Items on this list will be affected by normal enchant restrictions aswell.
- +# For example, even if you add a hero weapon here, you wont be able to enchant it.
- +# *Default is 0, that means all items will be affected, and if there is 0 somewhere
- +# in the list, it will still affect all items! Be aware of that!
- +EnchantChanceListsRestriction = 0
- +
- # Enchant limit [default = 0 (unlimited)]
- EnchantMaxWeapon = 0
- EnchantMaxArmor = 0
- Index: src/main/java/com/l2jarchid/gameserver/network/clientpackets/RequestEnchantItem.java
- ===================================================================
- --- src/main/java/com/l2jarchid/gameserver/network/clientpackets/RequestEnchantItem.java (revision 980)
- +++ src/main/java/com/l2jarchid/gameserver/network/clientpackets/RequestEnchantItem.java (working copy)
- @@ -17,6 +17,7 @@
- */
- package com.l2jarchid.gameserver.network.clientpackets;
- +import java.util.Map;
- import java.util.logging.Logger;
- import com.l2jarchid.L2Config;
- @@ -200,13 +201,13 @@
- for (int normalweaponscroll : NORMAL_WEAPON_SCROLLS)
- if (scroll.getItemId() == normalweaponscroll)
- {
- - chance = L2Config.ENCHANT_CHANCE_WEAPON;
- + chance = getListChance(L2Config.ENCHANT_CHANCE_WEAPON_LIST,L2Config.ENCHANT_CHANCE_WEAPON,item);
- maxEnchantLevel = L2Config.ENCHANT_MAX_WEAPON;
- }
- for (int blessedweaponscroll : BLESSED_WEAPON_SCROLLS)
- if (scroll.getItemId() == blessedweaponscroll)
- {
- - chance = L2Config.ENCHANT_CHANCE_BLESSED;
- + chance = getListChance(L2Config.BLESSED_ENCHANT_CHANCE_WEAPON_LIST,L2Config.ENCHANT_CHANCE_BLESSED,item);
- maxEnchantLevel = L2Config.ENCHANT_MAX_WEAPON;
- }
- for (int crystalweaponscroll : CRYSTAL_WEAPON_SCROLLS)
- @@ -219,13 +220,13 @@
- for (int normalarmorscroll : NORMAL_ARMOR_SCROLLS)
- if (scroll.getItemId() == normalarmorscroll)
- {
- - chance = L2Config.ENCHANT_CHANCE_ARMOR;
- + chance = getListChance(L2Config.ENCHANT_CHANCE_ARMOR_LIST,L2Config.ENCHANT_CHANCE_ARMOR,item);
- maxEnchantLevel = L2Config.ENCHANT_MAX_ARMOR;
- }
- for (int blessedarmorscroll : BLESSED_ARMOR_SCROLLS)
- if (scroll.getItemId() == blessedarmorscroll)
- {
- - chance = L2Config.ENCHANT_CHANCE_BLESSED;
- + chance = getListChance(L2Config.BLESSED_ENCHANT_CHANCE_ARMOR_LIST,L2Config.ENCHANT_CHANCE_BLESSED,item);
- maxEnchantLevel = L2Config.ENCHANT_MAX_ARMOR;
- }
- for (int crystalarmorscroll : CRYSTAL_ARMOR_SCROLLS)
- @@ -238,13 +239,13 @@
- for (int normaljewelscroll : NORMAL_ARMOR_SCROLLS)
- if (scroll.getItemId() == normaljewelscroll)
- {
- - chance = L2Config.ENCHANT_CHANCE_JEWELRY;
- + chance = getListChance(L2Config.ENCHANT_CHANCE_JEWELRY_LIST,L2Config.ENCHANT_CHANCE_JEWELRY,item);
- maxEnchantLevel = L2Config.ENCHANT_MAX_JEWELRY;
- }
- for (int blessedjewelscroll : BLESSED_ARMOR_SCROLLS)
- if (scroll.getItemId() == blessedjewelscroll)
- {
- - chance = L2Config.ENCHANT_CHANCE_BLESSED;
- + chance = getListChance(L2Config.BLESSED_ENCHANT_CHANCE_JEWELRY_LIST,L2Config.ENCHANT_CHANCE_BLESSED,item);
- maxEnchantLevel = L2Config.ENCHANT_MAX_JEWELRY;
- }
- for (int crystaljewelscroll : CRYSTAL_ARMOR_SCROLLS)
- @@ -395,6 +396,25 @@
- activeChar.broadcastUserInfo();
- }
- +
- + public static boolean isInRestrictionList(L2ItemInstance item)
- + {
- + if (L2Config.LIST_ENCHANT_CHANCE_LISTS_RESTRICTION.contains(0)) return true;
- + return L2Config.LIST_ENCHANT_CHANCE_LISTS_RESTRICTION.contains(item.getItemId());
- + }
- + public static int getListChance(Map<Integer, Integer> ConfigEnchantChanceList, Integer ConfigEnchantChance, L2ItemInstance item)
- + {
- + int chance = 0;
- + if (!ConfigEnchantChanceList.isEmpty() && isInRestrictionList(item))
- + {
- + if (ConfigEnchantChanceList.containsKey(item.getEnchantLevel()+1))
- + chance = ConfigEnchantChanceList.get(item.getEnchantLevel()+1);
- + else chance = ConfigEnchantChance;
- + }
- + else chance = ConfigEnchantChance;
- + return chance;
- + }
- +
- /* (non-Javadoc)
- * @see com.l2jarchid.gameserver.clientpackets.ClientBasePacket#getType()
- */
- Index: src/main/java/com/l2jarchid/L2Config.java
- ===================================================================
- --- src/main/java/com/l2jarchid/L2Config.java (revision 980)
- +++ src/main/java/com/l2jarchid/L2Config.java (working copy)
- @@ -785,6 +785,14 @@
- public static int ENCHANT_CHANCE_CRYSTAL;
- public static int ENCHANT_CHANCE_ARMOR;
- public static int ENCHANT_CHANCE_JEWELRY;
- + 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 String ENCHANT_CHANCE_LISTS_RESTRICTION;
- + public static List<Integer> LIST_ENCHANT_CHANCE_LISTS_RESTRICTION = new FastList<Integer>();
- public static int ENCHANT_MAX_WEAPON;
- public static int ENCHANT_MAX_ARMOR;
- public static int ENCHANT_MAX_JEWELRY;
- @@ -840,6 +848,108 @@
- ENCHANT_CHANCE_CRYSTAL = Integer.parseInt(ratesSettings.getProperty("EnchantChanceCrystal", "100"));
- ENCHANT_CHANCE_ARMOR = Integer.parseInt(ratesSettings.getProperty("EnchantChanceArmor", "52"));
- ENCHANT_CHANCE_JEWELRY = Integer.parseInt(ratesSettings.getProperty("EnchantChanceJewelry", "54"));
- + String[] propertySplitWeapon = ratesSettings.getProperty("EnchantChanceWeaponList", "").split(";");
- + String[] propertySplitArmor = ratesSettings.getProperty("EnchantChanceArmorList", "").split(";");
- + String[] propertySplitJewelry = ratesSettings.getProperty("EnchantChanceJewelryList", "").split(";");
- + String[] propertySplitBlessedWeapon = ratesSettings.getProperty("BlessedEnchantChanceWeaponList", "").split(";");
- + String[] propertySplitBlessedArmor = ratesSettings.getProperty("BlessedEnchantChanceArmorList", "").split(";");
- + String[] propertySplitBlessedJewelry = ratesSettings.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_CHANCE_LISTS_RESTRICTION = ratesSettings.getProperty("EnchantChanceListsRestriction", "0");
- + LIST_ENCHANT_CHANCE_LISTS_RESTRICTION = new FastList<Integer>();
- + for (String id : ENCHANT_CHANCE_LISTS_RESTRICTION.split(","))
- + {
- + LIST_ENCHANT_CHANCE_LISTS_RESTRICTION.add(Integer.parseInt(id));
- + }
- /* limit on enchant */
- ENCHANT_MAX_WEAPON = Integer.parseInt(ratesSettings.getProperty("EnchantMaxWeapon", "255"));
- ENCHANT_MAX_ARMOR = Integer.parseInt(ratesSettings.getProperty("EnchantMaxArmor", "255"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement