Advertisement
LIONN

[Server Side] Donator Enchant Item

Mar 16th, 2012
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 12.10 KB | None | 0 0
  1. Index: config/head/enchant.properties
  2. ===================================================================
  3. --- config/head/enchant.properties  (revision 923)
  4. +++ config/head/enchant.properties  (working copy)
  5. @@ -46,6 +46,19 @@
  6.  # Jewel
  7.  CrystalJewelryEnchantLevel = 1,100;2,100;3,100;4,97;5,94;6,91;7,88;8,85;9,82;10,79;11,76;12,73;13,70;14,67;15,64;16,61;
  8.  
  9. +# ---------------------------------------------
  10. +#  Chance For Donator Scrolls -
  11. +# ---------------------------------------------
  12. +# Weapon
  13. +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,10;17,10;18,10;19,10;20,10;
  14. +# Armor
  15. +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;
  16. +# Jewel
  17. +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;
  18. +
  19. +# Enchant after break with donator scroll.
  20. +DonatorEnchantAfterBreak = 3
  21. +
  22.  # Safe enchant
  23.  EnchantSafeMax = 3
  24.  EnchantSafeMaxFull = 4
  25. Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java
  26. ===================================================================
  27. --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (revision 923)
  28. +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (working copy)
  29. @@ -40,6 +40,10 @@
  30.  public final class RequestEnchantItem extends L2GameClientPacket
  31.  {
  32.     protected static final Logger _log = Logger.getLogger(Inventory.class.getName());
  33. +
  34. +   private static final int[] DONATOR_WEAPON_SCROLL=   { 10000 };
  35. +   private static final int[] DONATOR_ARMOR_SCROLL =   { 10001 };
  36. +
  37.     private static final int[] CRYSTAL_SCROLLS =
  38.     {
  39.             731, 732, 949, 950, 953, 954, 957, 958, 961, 962
  40. @@ -154,6 +158,7 @@
  41.         int itemType2 = item.getItem().getType2();
  42.         boolean enchantItem = false;
  43.         boolean blessedScroll = false;
  44. +       boolean donatorScroll = false;
  45.         boolean crystalScroll = false;
  46.         int crystalId = 0;
  47.  
  48. @@ -167,6 +172,7 @@
  49.                     case 729:
  50.                     case 731:
  51.                     case 6569:
  52. +                   case 10000:
  53.                         if(itemType2 == L2Item.TYPE2_WEAPON)
  54.                         {
  55.                             enchantItem = true;
  56. @@ -175,6 +181,7 @@
  57.                     case 730:
  58.                     case 732:
  59.                     case 6570:
  60. +                   case 10001:
  61.                         if(itemType2 == L2Item.TYPE2_SHIELD_ARMOR || itemType2 == L2Item.TYPE2_ACCESSORY)
  62.                         {
  63.                             enchantItem = true;
  64. @@ -189,6 +196,7 @@
  65.                     case 947:
  66.                     case 949:
  67.                     case 6571:
  68. +                   case 10000:
  69.                         if(itemType2 == L2Item.TYPE2_WEAPON)
  70.                         {
  71.                             enchantItem = true;
  72. @@ -197,6 +205,7 @@
  73.                     case 948:
  74.                     case 950:
  75.                     case 6572:
  76. +                   case 10001:
  77.                         if(itemType2 == L2Item.TYPE2_SHIELD_ARMOR || itemType2 == L2Item.TYPE2_ACCESSORY)
  78.                         {
  79.                             enchantItem = true;
  80. @@ -211,6 +220,7 @@
  81.                     case 951:
  82.                     case 953:
  83.                     case 6573:
  84. +                   case 10000:
  85.                         if(itemType2 == L2Item.TYPE2_WEAPON)
  86.                         {
  87.                             enchantItem = true;
  88. @@ -219,6 +229,7 @@
  89.                     case 952:
  90.                     case 954:
  91.                     case 6574:
  92. +                   case 10001:
  93.                         if(itemType2 == L2Item.TYPE2_SHIELD_ARMOR || itemType2 == L2Item.TYPE2_ACCESSORY)
  94.                         {
  95.                             enchantItem = true;
  96. @@ -233,6 +244,7 @@
  97.                     case 955:
  98.                     case 957:
  99.                     case 6575:
  100. +                   case 10000:
  101.                         if(itemType2 == L2Item.TYPE2_WEAPON)
  102.                         {
  103.                             enchantItem = true;
  104. @@ -241,6 +253,7 @@
  105.                     case 956:
  106.                     case 958:
  107.                     case 6576:
  108. +                   case 10001:
  109.                         if(itemType2 == L2Item.TYPE2_SHIELD_ARMOR || itemType2 == L2Item.TYPE2_ACCESSORY)
  110.                         {
  111.                             enchantItem = true;
  112. @@ -255,6 +268,7 @@
  113.                     case 959:
  114.                     case 961:
  115.                     case 6577:
  116. +                   case 10000:
  117.                         if(itemType2 == L2Item.TYPE2_WEAPON)
  118.                         {
  119.                             enchantItem = true;
  120. @@ -263,6 +277,7 @@
  121.                     case 960:
  122.                     case 962:
  123.                     case 6578:
  124. +                   case 10001:
  125.                         if(itemType2 == L2Item.TYPE2_SHIELD_ARMOR || itemType2 == L2Item.TYPE2_ACCESSORY)
  126.                         {
  127.                             enchantItem = true;
  128. @@ -283,6 +298,10 @@
  129.         {
  130.             blessedScroll = true;
  131.         }
  132. +       else if(scroll.getItemId() == 10000 || scroll.getItemId() == 10001)
  133. +       {
  134. +           donatorScroll = true;
  135. +       }
  136.         else
  137.         {
  138.             for(int crystalscroll : CRYSTAL_SCROLLS)
  139. @@ -350,6 +369,24 @@
  140.                     }
  141.                 }
  142.                
  143. +           }else if(donatorScroll){
  144. +
  145. +               for (int scrollId : DONATOR_WEAPON_SCROLL)
  146. +               {
  147. +                   if (scroll.getItemId() == scrollId)
  148. +                   {
  149. +                       if(item.getEnchantLevel() >= Config.DONATOR_WEAPON_ENCHANT_LEVEL.size())
  150. +                       {
  151. +                           chance = Config.DONATOR_WEAPON_ENCHANT_LEVEL.get(Config.DONATOR_WEAPON_ENCHANT_LEVEL.size());
  152. +                       }
  153. +                       else
  154. +                       {
  155. +                           chance = Config.DONATOR_WEAPON_ENCHANT_LEVEL.get(item.getEnchantLevel() + 1);
  156. +                       }
  157. +                       maxEnchantLevel = Config.ENCHANT_WEAPON_MAX;
  158. +                       break;
  159. +                   }
  160. +               }
  161.             }else{ //normal scrolls
  162.                
  163.                 for(int normalweaponscroll : NORMAL_WEAPON_SCROLLS)
  164. @@ -416,6 +453,25 @@
  165.                     }
  166.                 }
  167.                
  168. +           }else if(donatorScroll){
  169. +
  170. +               for (int scrollId : DONATOR_ARMOR_SCROLL)
  171. +               {
  172. +                   if (scroll.getItemId() == scrollId)
  173. +                   {
  174. +                       if(item.getEnchantLevel() >= Config.DONATOR_ARMOR_ENCHANT_LEVEL.size())
  175. +                       {
  176. +                           chance = Config.DONATOR_ARMOR_ENCHANT_LEVEL.get(Config.DONATOR_ARMOR_ENCHANT_LEVEL.size());
  177. +                       }
  178. +                       else
  179. +                       {
  180. +                           chance = Config.DONATOR_ARMOR_ENCHANT_LEVEL.get(item.getEnchantLevel() + 1);
  181. +                       }
  182. +                       maxEnchantLevel = Config.ENCHANT_ARMOR_MAX;
  183. +                      
  184. +                       break;
  185. +                   }
  186. +               }
  187.             }else{ //normal scrolls
  188.                
  189.                 for(int normalarmorscroll : NORMAL_ARMOR_SCROLLS)
  190. @@ -482,6 +538,25 @@
  191.                     }
  192.                 }
  193.                
  194. +           }else if(donatorScroll){
  195. +
  196. +               for (int scrollId : DONATOR_ARMOR_SCROLL)
  197. +               {
  198. +                   if (scroll.getItemId() == scrollId)
  199. +                   {
  200. +                       if(item.getEnchantLevel() >= Config.DONATOR_JEWELRY_ENCHANT_LEVEL.size())
  201. +                       {
  202. +                           chance = Config.DONATOR_JEWELRY_ENCHANT_LEVEL.get(Config.DONATOR_JEWELRY_ENCHANT_LEVEL.size());
  203. +                       }
  204. +                       else
  205. +                       {
  206. +                           chance = Config.DONATOR_JEWELRY_ENCHANT_LEVEL.get(item.getEnchantLevel() + 1);
  207. +                       }
  208. +                       maxEnchantLevel = Config.ENCHANT_JEWELRY_MAX;
  209. +                      
  210. +                       break;
  211. +                   }
  212. +               }
  213.             }else{
  214.                
  215.                 for(int normaljewelscroll : NORMAL_ARMOR_SCROLLS)
  216. @@ -585,6 +660,9 @@
  217.                 }else if(blessedScroll){
  218.                     sm = new SystemMessage(SystemMessageId.BLESSED_ENCHANT_FAILED);
  219.                     activeChar.sendPacket(sm);
  220. +               }else if(donatorScroll){
  221. +                   sm = SystemMessage.sendString("Failed in Donator Enchant. The enchant value of the item become " + Config.DONATOR_ENCHANT_AFTER_BREAK + ".");
  222. +                   activeChar.sendPacket(sm);
  223.                 }else{
  224.                     if(item.getEnchantLevel() > 0)
  225.                     {
  226. @@ -601,7 +679,7 @@
  227.                     }
  228.                 }
  229.                
  230. -               if(!blessedScroll && !crystalScroll)
  231. +               if(!blessedScroll && !crystalScroll && !donatorScroll)
  232.                 {
  233.                     if(item.getEnchantLevel() > 0)
  234.                     {
  235. @@ -693,9 +771,10 @@
  236.                     }else if(crystalScroll){
  237.                         item.setEnchantLevel(Config.CRYSTAL_ENCHANT_MIN);
  238.                         item.updateDatabase();
  239. +                   }else if(donatorScroll){
  240. +                       item.setEnchantLevel(Config.DONATOR_ENCHANT_AFTER_BREAK);
  241. +                       item.updateDatabase();
  242.                     }
  243. -                  
  244. -                  
  245.                 }
  246.             }
  247.         }
  248. Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/EnchantScrolls.java
  249. ===================================================================
  250. --- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/EnchantScrolls.java  (revision 923)
  251. +++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/EnchantScrolls.java  (working copy)
  252. @@ -54,8 +54,9 @@
  253.             961,
  254.             962,
  255.             6577,
  256. -           6578
  257. -   // s grade
  258. +           6578, // s grade
  259. +           10000,
  260. +           10001 // Donator Scroll
  261.     };
  262.  
  263.     @Override
  264. Index: head-src/com/l2jfrozen/Config.java
  265. ===================================================================
  266. --- head-src/com/l2jfrozen/Config.java  (revision 923)
  267. +++ head-src/com/l2jfrozen/Config.java  (working copy)
  268. @@ -2772,15 +2776,20 @@
  269.     public static FastMap<Integer, Integer> NORMAL_WEAPON_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  270.     public static FastMap<Integer, Integer> BLESS_WEAPON_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  271.     public static FastMap<Integer, Integer> CRYSTAL_WEAPON_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  272. +   public static FastMap<Integer, Integer> DONATOR_WEAPON_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  273.  
  274.     public static FastMap<Integer, Integer> NORMAL_ARMOR_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  275.     public static FastMap<Integer, Integer> BLESS_ARMOR_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  276.     public static FastMap<Integer, Integer> CRYSTAL_ARMOR_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  277. +   public static FastMap<Integer, Integer> DONATOR_ARMOR_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  278.  
  279.     public static FastMap<Integer, Integer> NORMAL_JEWELRY_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  280.     public static FastMap<Integer, Integer> BLESS_JEWELRY_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  281.     public static FastMap<Integer, Integer> CRYSTAL_JEWELRY_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  282. +   public static FastMap<Integer, Integer> DONATOR_JEWELRY_ENCHANT_LEVEL = new FastMap<Integer, Integer>();
  283.  
  284. +   public static int DONATOR_ENCHANT_AFTER_BREAK;
  285. +
  286.     public static int ENCHANT_SAFE_MAX;
  287.     public static int ENCHANT_SAFE_MAX_FULL;
  288.     public static int ENCHANT_WEAPON_MAX;
  289. @@ -2915,6 +2924,32 @@
  290.                 }
  291.             }
  292.  
  293. +           propertySplit = ENCHANTSetting.getProperty("DonatorWeaponEnchantLevel", "").split(";");
  294. +           for(String readData : propertySplit)
  295. +           {
  296. +               String[] writeData = readData.split(",");
  297. +               if(writeData.length != 2)
  298. +               {
  299. +                   System.out.println("invalid config property");
  300. +               }
  301. +               else
  302. +               {
  303. +                   try
  304. +                   {
  305. +                       DONATOR_WEAPON_ENCHANT_LEVEL.put(Integer.parseInt(writeData[0]), Integer.parseInt(writeData[1]));
  306. +                   }
  307. +                   catch(NumberFormatException nfe)
  308. +                   {
  309. +                       if(Config.ENABLE_ALL_EXCEPTIONS)
  310. +                           nfe.printStackTrace();
  311. +                       if(!readData.equals(""))
  312. +                       {
  313. +                           System.out.println("invalid config property");
  314. +                       }
  315. +                   }
  316. +               }
  317. +           }
  318. +
  319.             propertySplit = ENCHANTSetting.getProperty("NormalArmorEnchantLevel", "").split(";");
  320.             for(String readData : propertySplit)
  321.             {
  322. @@ -2993,6 +3028,32 @@
  323.                 }
  324.             }
  325.  
  326. +           propertySplit = ENCHANTSetting.getProperty("DonatorArmorEnchantLevel", "").split(";");
  327. +           for(String readData : propertySplit)
  328. +           {
  329. +               String[] writeData = readData.split(",");
  330. +               if(writeData.length != 2)
  331. +               {
  332. +                   System.out.println("invalid config property");
  333. +               }
  334. +               else
  335. +               {
  336. +                   try
  337. +                   {
  338. +                       DONATOR_ARMOR_ENCHANT_LEVEL.put(Integer.parseInt(writeData[0]), Integer.parseInt(writeData[1]));
  339. +                   }
  340. +                   catch(NumberFormatException nfe)
  341. +                   {
  342. +                       if(Config.ENABLE_ALL_EXCEPTIONS)
  343. +                           nfe.printStackTrace();
  344. +                       if(!readData.equals(""))
  345. +                       {
  346. +                           System.out.println("invalid config property");
  347. +                       }
  348. +                   }
  349. +               }
  350. +           }
  351. +
  352.             propertySplit = ENCHANTSetting.getProperty("NormalJewelryEnchantLevel", "").split(";");
  353.             for(String readData : propertySplit)
  354.             {
  355. @@ -3075,6 +3136,35 @@
  356.                 }
  357.             }
  358.  
  359. +           propertySplit = ENCHANTSetting.getProperty("DonatorJewelryEnchantLevel", "").split(";");
  360. +           for(String readData : propertySplit)
  361. +           {
  362. +               String[] writeData = readData.split(",");
  363. +               if(writeData.length != 2)
  364. +               {
  365. +                   System.out.println("invalid config property");
  366. +               }
  367. +               else
  368. +               {
  369. +                   try
  370. +                   {
  371. +                       DONATOR_JEWELRY_ENCHANT_LEVEL.put(Integer.parseInt(writeData[0]), Integer.parseInt(writeData[1]));
  372. +                   }
  373. +                   catch(NumberFormatException nfe)
  374. +                   {
  375. +                       if(Config.ENABLE_ALL_EXCEPTIONS)
  376. +                           nfe.printStackTrace();
  377. +                      
  378. +                       if(!readData.equals(""))
  379. +                       {
  380. +                           System.out.println("invalid config property");
  381. +                       }
  382. +                   }
  383. +               }
  384. +           }
  385. +
  386. +           DONATOR_ENCHANT_AFTER_BREAK = Integer.parseInt(ENCHANTSetting.getProperty("DonatorEnchantAfterBreak", "3"));
  387. +
  388.             /** limit of safe enchant normal **/
  389.             ENCHANT_SAFE_MAX = Integer.parseInt(ENCHANTSetting.getProperty("EnchantSafeMax", "3"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement