Advertisement
Guest User

Nik

a guest
Sep 19th, 2009
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 12.81 KB | None | 0 0
  1. Index: java/com/equal/Config.java
  2. ===================================================================
  3. --- java/com/equal/Config.java  (revision 341)
  4. +++ java/com/equal/Config.java  (working copy)
  5. @@ -25,10 +25,12 @@
  6.  import java.math.BigInteger;
  7.  import java.util.ArrayList;
  8.  import java.util.List;
  9. +import java.util.Map;
  10.  import java.util.Properties;
  11.  import java.util.logging.Logger;
  12.  
  13.  import javolution.util.FastList;
  14. +import javolution.util.FastMap;
  15.  
  16.  import com.equal.gameserver.model.actor.instance.L2PcInstance;
  17.  import com.equal.gameserver.util.FloodProtectorConfig;
  18. @@ -660,6 +662,12 @@
  19.     public static int     ENCHANT_CHANCE_WEAPON_BLESSED; /** Chance that a Blessed Scroll will have to enchant over safe limit */
  20.     public static int     ENCHANT_CHANCE_ARMOR_BLESSED; /** Chance that a Blessed Scroll will have to enchant over safe limit */
  21.     public static int     ENCHANT_CHANCE_JEWELRY_BLESSED; /** Chance that a Blessed Scroll will have to enchant over safe limit */
  22. +   public static Map<Integer, Integer> ENCHANT_CHANCE_WEAPON_LIST;
  23. +   public static Map<Integer, Integer> ENCHANT_CHANCE_ARMOR_LIST;
  24. +   public static Map<Integer, Integer> ENCHANT_CHANCE_JEWELRY_LIST;
  25. +   public static Map<Integer, Integer> BLESSED_ENCHANT_CHANCE_WEAPON_LIST;
  26. +   public static Map<Integer, Integer> BLESSED_ENCHANT_CHANCE_ARMOR_LIST;
  27. +   public static Map<Integer, Integer> BLESSED_ENCHANT_CHANCE_JEWELRY_LIST;
  28.     public static int     ENCHANT_MAX_ALLOWED_WEAPON; /** Max possible enchant by player */
  29.     public static int     ENCHANT_MAX_ALLOWED_ARMOR; /** Max possible enchant by player */
  30.     public static int     ENCHANT_MAX_ALLOWED_JEWELRY; /** Max possible enchant by player */
  31. @@ -1615,6 +1623,102 @@
  32.                 ENCHANT_CHANCE_WEAPON_BLESSED = Integer.parseInt(otherSettings.getProperty("EnchantChanceWeaponBlessed", "55"));
  33.                 ENCHANT_CHANCE_ARMOR_BLESSED = Integer.parseInt(otherSettings.getProperty("EnchantChanceArmorBlessed", "55"));
  34.                 ENCHANT_CHANCE_JEWELRY_BLESSED = Integer.parseInt(otherSettings.getProperty("EnchantChanceJewelryBlessed", "55"));
  35. +                       String[] propertySplitWeapon = otherSettings.getProperty("EnchantChanceWeaponList", "").split(";");
  36. +                       String[] propertySplitArmor = otherSettings.getProperty("EnchantChanceArmorList", "").split(";");
  37. +                       String[] propertySplitJewelry = otherSettings.getProperty("EnchantChanceJewelryList", "").split(";");
  38. +                       String[] propertySplitBlessedWeapon = otherSettings.getProperty("BlessedEnchantChanceWeaponList", "").split(";");
  39. +                       String[] propertySplitBlessedArmor = otherSettings.getProperty("BlessedEnchantChanceArmorList", "").split(";");
  40. +                       String[] propertySplitBlessedJewelry = otherSettings.getProperty("BlessedEnchantChanceJewelryList", "").split(";");
  41. +                       ENCHANT_CHANCE_WEAPON_LIST = new FastMap<Integer, Integer>(propertySplitWeapon.length);
  42. +                       ENCHANT_CHANCE_ARMOR_LIST = new FastMap<Integer, Integer>(propertySplitArmor.length);
  43. +                       ENCHANT_CHANCE_JEWELRY_LIST = new FastMap<Integer, Integer>(propertySplitJewelry.length);
  44. +                       BLESSED_ENCHANT_CHANCE_WEAPON_LIST = new FastMap<Integer, Integer>(propertySplitBlessedWeapon.length);
  45. +                       BLESSED_ENCHANT_CHANCE_ARMOR_LIST = new FastMap<Integer, Integer>(propertySplitBlessedArmor.length);
  46. +                       BLESSED_ENCHANT_CHANCE_JEWELRY_LIST = new FastMap<Integer, Integer>(propertySplitBlessedJewelry.length);
  47. +                   if (propertySplitWeapon.length > 1)
  48. +                   {
  49. +                       for (String enchant : propertySplitWeapon)
  50. +                       {
  51. +                           String[] enchantSplit = enchant.split(",");
  52. +                           if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
  53. +                           else
  54. +                           {
  55. +                               try{ENCHANT_CHANCE_WEAPON_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
  56. +                               catch (NumberFormatException nfe){
  57. +                               if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
  58. +                           }
  59. +                       }
  60. +                   }
  61. +                   if (propertySplitArmor.length > 1)
  62. +                   {
  63. +                       for (String enchant : propertySplitArmor)
  64. +                       {
  65. +                           String[] enchantSplit = enchant.split(",");
  66. +                           if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
  67. +                           else
  68. +                           {
  69. +                               try{ENCHANT_CHANCE_ARMOR_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
  70. +                               catch (NumberFormatException nfe){
  71. +                               if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
  72. +                           }
  73. +                       }
  74. +                   }
  75. +                   if (propertySplitJewelry.length > 1)
  76. +                   {
  77. +                       for (String enchant : propertySplitJewelry)
  78. +                       {
  79. +                           String[] enchantSplit = enchant.split(",");
  80. +                           if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
  81. +                           else
  82. +                           {
  83. +                               try{ENCHANT_CHANCE_JEWELRY_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
  84. +                               catch (NumberFormatException nfe){
  85. +                               if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
  86. +                           }
  87. +                       }
  88. +                   }
  89. +                   if (propertySplitBlessedWeapon.length > 1)
  90. +                   {
  91. +                       for (String enchant : propertySplitBlessedWeapon)
  92. +                       {
  93. +                           String[] enchantSplit = enchant.split(",");
  94. +                           if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
  95. +                           else
  96. +                           {
  97. +                               try{BLESSED_ENCHANT_CHANCE_WEAPON_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
  98. +                               catch (NumberFormatException nfe){
  99. +                               if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
  100. +                           }
  101. +                       }
  102. +                   }
  103. +                   if (propertySplitBlessedArmor.length > 1)
  104. +                   {
  105. +                       for (String enchant : propertySplitBlessedArmor)
  106. +                       {
  107. +                           String[] enchantSplit = enchant.split(",");
  108. +                           if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
  109. +                           else
  110. +                           {
  111. +                               try{BLESSED_ENCHANT_CHANCE_ARMOR_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
  112. +                               catch (NumberFormatException nfe){
  113. +                               if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
  114. +                           }
  115. +                       }
  116. +                   }
  117. +                   if (propertySplitBlessedJewelry.length > 1)
  118. +                   {
  119. +                       for (String enchant : propertySplitBlessedJewelry)
  120. +                       {
  121. +                           String[] enchantSplit = enchant.split(",");
  122. +                           if (enchantSplit.length != 2)_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchant, "\""));
  123. +                           else
  124. +                           {
  125. +                               try{BLESSED_ENCHANT_CHANCE_JEWELRY_LIST.put(Integer.valueOf(enchantSplit[0]), Integer.valueOf(enchantSplit[1]));}
  126. +                               catch (NumberFormatException nfe){
  127. +                               if (!enchant.isEmpty())_log.warning(StringUtil.concat("[CustomEnchantSystem]: invalid config property -> EnchantList \"", enchantSplit[0], "\"", enchantSplit[1]));}
  128. +                           }
  129. +                       }
  130. +                   }
  131.                 ENCHANT_MAX_ALLOWED_WEAPON = Integer.parseInt(otherSettings.getProperty("EnchantMaxAllowedWeapon", "255"));
  132.                 ENCHANT_MAX_ALLOWED_ARMOR = Integer.parseInt(otherSettings.getProperty("EnchantMaxAllowedArmor", "255"));
  133.                 ENCHANT_MAX_ALLOWED_JEWELRY = Integer.parseInt(otherSettings.getProperty("EnchantMaxAllowedJewelry", "255"));
  134. Index: java/com/equal/gameserver/network/clientpackets/RequestEnchantItem.java
  135. ===================================================================
  136. --- java/com/equal/gameserver/network/clientpackets/RequestEnchantItem.java (revision 341)
  137. +++ java/com/equal/gameserver/network/clientpackets/RequestEnchantItem.java (working copy)
  138. @@ -206,7 +206,13 @@
  139.             {
  140.                 if (scroll.getItemId() == scrollId)
  141.                 {
  142. -                   chance = Config.ENCHANT_CHANCE_WEAPON;
  143. +                   if (!Config.ENCHANT_CHANCE_WEAPON_LIST.isEmpty())
  144. +                   {
  145. +                       if (Config.ENCHANT_CHANCE_WEAPON_LIST.containsKey(item.getEnchantLevel()+1))
  146. +                       chance = Config.ENCHANT_CHANCE_WEAPON_LIST.get(item.getEnchantLevel()+1);
  147. +                       else chance = Config.ENCHANT_CHANCE_WEAPON;
  148. +                   }
  149. +                   else chance = Config.ENCHANT_CHANCE_WEAPON;
  150.                     break;
  151.                 }
  152.             }
  153. @@ -223,7 +229,13 @@
  154.             {
  155.                 if (scroll.getItemId() == scrollId)
  156.                 {
  157. -                   chance = Config.ENCHANT_CHANCE_WEAPON_BLESSED;
  158. +                   if (!Config.BLESSED_ENCHANT_CHANCE_WEAPON_LIST.isEmpty())
  159. +                   {
  160. +                       if (Config.BLESSED_ENCHANT_CHANCE_WEAPON_LIST.containsKey(item.getEnchantLevel()+1))
  161. +                       chance = Config.BLESSED_ENCHANT_CHANCE_WEAPON_LIST.get(item.getEnchantLevel()+1);
  162. +                       else chance = Config.ENCHANT_CHANCE_WEAPON_BLESSED;
  163. +                   }
  164. +                   else chance = Config.ENCHANT_CHANCE_WEAPON_BLESSED;
  165.                     break;
  166.                 }
  167.             }
  168. @@ -235,7 +247,13 @@
  169.             {
  170.                 if (scroll.getItemId() == scrollId)
  171.                 {
  172. -                   chance = Config.ENCHANT_CHANCE_ARMOR;
  173. +                   if (!Config.ENCHANT_CHANCE_ARMOR_LIST.isEmpty())
  174. +                   {
  175. +                       if (Config.ENCHANT_CHANCE_ARMOR_LIST.containsKey(item.getEnchantLevel()+1))
  176. +                       chance = Config.ENCHANT_CHANCE_ARMOR_LIST.get(item.getEnchantLevel()+1);
  177. +                       else chance = Config.ENCHANT_CHANCE_ARMOR;
  178. +                   }
  179. +                   else chance = Config.ENCHANT_CHANCE_ARMOR; 
  180.                     break;
  181.                 }
  182.             }
  183. @@ -251,7 +269,13 @@
  184.             {
  185.                 if (scroll.getItemId() == scrollId)
  186.                 {
  187. -                   chance = Config.ENCHANT_CHANCE_ARMOR_BLESSED;
  188. +                   if (!Config.BLESSED_ENCHANT_CHANCE_ARMOR_LIST.isEmpty())
  189. +                   {
  190. +                       if (Config.BLESSED_ENCHANT_CHANCE_ARMOR_LIST.containsKey(item.getEnchantLevel()+1))
  191. +                       chance = Config.BLESSED_ENCHANT_CHANCE_ARMOR_LIST.get(item.getEnchantLevel()+1);
  192. +                       else chance = Config.ENCHANT_CHANCE_ARMOR_BLESSED;
  193. +                   }
  194. +                   else chance = Config.ENCHANT_CHANCE_ARMOR_BLESSED; 
  195.                     break;
  196.                 }
  197.             }
  198. @@ -262,7 +286,13 @@
  199.             {
  200.                 if (scroll.getItemId() == scrollId)
  201.                 {
  202. -                   chance = Config.ENCHANT_CHANCE_JEWELRY;
  203. +                   if (!Config.ENCHANT_CHANCE_JEWELRY_LIST.isEmpty())
  204. +                   {
  205. +                       if (Config.ENCHANT_CHANCE_JEWELRY_LIST.containsKey(item.getEnchantLevel()+1))
  206. +                       chance = Config.ENCHANT_CHANCE_JEWELRY_LIST.get(item.getEnchantLevel()+1);
  207. +                       else chance = Config.ENCHANT_CHANCE_JEWELRY;
  208. +                   }
  209. +                   else chance = Config.ENCHANT_CHANCE_JEWELRY;   
  210.                     break;
  211.                 }
  212.             }
  213. @@ -278,7 +308,13 @@
  214.             {
  215.                 if (scroll.getItemId() == scrollId)
  216.                 {
  217. -                   chance = Config.ENCHANT_CHANCE_JEWELRY_BLESSED;
  218. +                   if (!Config.BLESSED_ENCHANT_CHANCE_JEWELRY_LIST.isEmpty())
  219. +                   {
  220. +                       if (Config.BLESSED_ENCHANT_CHANCE_JEWELRY_LIST.containsKey(item.getEnchantLevel()+1))
  221. +                       chance = Config.BLESSED_ENCHANT_CHANCE_JEWELRY_LIST.get(item.getEnchantLevel()+1);
  222. +                       else chance = Config.ENCHANT_CHANCE_JEWELRY_BLESSED;
  223. +                   }
  224. +                   else chance = Config.ENCHANT_CHANCE_JEWELRY_BLESSED;   
  225.                     break;
  226.                 }
  227.             }
  228. Index: config/other.properties
  229. ===================================================================
  230. --- config/other.properties (revision 341)
  231. +++ config/other.properties (working copy)
  232. @@ -61,7 +61,30 @@
  233.  EnchantChanceArmorBlessed = 100
  234.  EnchantChanceJewelryBlessed = 100
  235.  
  236. +# This is a list where you define different enchant chance on different enchant levels
  237. +# Format: enchantLevel1,enchantChance1;enchantLevel2,enchantChance2...
  238. +# Example:
  239. +#  The "\"indicates new line, and is only set for formating purposes.
  240. +#  EnchantChanceWeaponList = 4,90;5,80;6,75;7,70;8,65;\
  241. +#  9,60;10,50;11,20;12,10;13,50;14,25;15,20
  242. +#  No ";" or ";\" at the end
  243. +# So, if the enchant chance for +15 is set to 30%, the enchanter will have 30%
  244. +# chance to enchant the weapon from +14 to +15
  245. +# If a specific enchant level isnt described in the list, or the list is empty,
  246. +# the chance will be the one set at default configs
  247. +# (ex. EnchantChanceWeapon = ?? / EnchantChanceArmor = ?? / EnchantChanceJewelry = ??)
  248. +# So if you miss in the list for example, +15 for weapon, the chance will be
  249. +# the one set at EnchantChanceWeapon (BlessedEnchantChanceWeapon for blessed)
  250. +EnchantChanceWeaponList =
  251. +EnchantChanceArmorList =
  252. +EnchantChanceJewelryList =
  253.  
  254. +BlessedEnchantChanceWeaponList =
  255. +BlessedEnchantChanceArmorList =
  256. +BlessedEnchantChanceJewelryList =
  257. +
  258. # Enchant limit [default = 0 (unlimited)]
  259. # EnchantMaxAllowe is if any player has bigger enchant gets banned. EnchantMax is what max value can be put by scrols.
  260. EnchantMaxAllowedWeapon = 65535
  261.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement