Advertisement
VANPER

Enchant System

Feb 11th, 2020
1,483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 40.60 KB | None | 0 0
  1. Index: net.sf.l2j;Config.java
  2. ===================================================================
  3. --- net.sf.l2j;Config.java (revision 84)
  4. +++ net.sf.l2j;Config.java (working copy)
  5.  
  6. -   public static final String GEOENGINE_FILE = "./config/main/geoengine.properties";
  7.  
  8. +   public static final String GEOENGINE_FILE = "./config/main/geoengine.properties";
  9.  
  10. +   public static final String ENCHANT_FILE = "./config/main/enchant.properties";
  11.  
  12. +   /** Enchant item custom */
  13. +   public static HashMap<Integer, Integer> NORMAL_WEAPON_ENCHANT_LEVEL = new HashMap<>();
  14. +   public static HashMap<Integer, Integer> BLESS_WEAPON_ENCHANT_LEVEL = new HashMap<>();
  15. +   public static HashMap<Integer, Integer> CRYSTAL_WEAPON_ENCHANT_LEVEL = new HashMap<>();
  16. +   public static HashMap<Integer, Integer> DONATOR_WEAPON_ENCHANT_LEVEL = new HashMap<>();
  17. +   public static HashMap<Integer, Integer> NORMAL_ARMOR_ENCHANT_LEVEL = new HashMap<>();
  18. +   public static HashMap<Integer, Integer> BLESS_ARMOR_ENCHANT_LEVEL = new HashMap<>();
  19. +   public static HashMap<Integer, Integer> CRYSTAL_ARMOR_ENCHANT_LEVEL = new HashMap<>();
  20. +   public static HashMap<Integer, Integer> DONATOR_ARMOR_ENCHANT_LEVEL = new HashMap<>();
  21. +   public static HashMap<Integer, Integer> NORMAL_JEWELRY_ENCHANT_LEVEL = new HashMap<>();
  22. +   public static HashMap<Integer, Integer> BLESS_JEWELRY_ENCHANT_LEVEL = new HashMap<>();
  23. +   public static HashMap<Integer, Integer> CRYSTAL_JEWELRY_ENCHANT_LEVEL = new HashMap<>();
  24. +   public static HashMap<Integer, Integer> DONATOR_JEWELRY_ENCHANT_LEVEL = new HashMap<>();
  25. +   public static boolean ENCHANT_HERO_WEAPON;
  26. +   public static boolean SCROLL_STACKABLE;
  27. +   public static int GOLD_WEAPON;
  28. +   public static int GOLD_ARMOR;
  29. +   public static int ENCHANT_SAFE_MAX;
  30. +   public static int ENCHANT_SAFE_MAX_FULL;
  31. +   public static int ENCHANT_WEAPON_MAX;
  32. +   public static int ENCHANT_ARMOR_MAX;
  33. +   public static int ENCHANT_JEWELRY_MAX;
  34. +   public static int BLESSED_ENCHANT_WEAPON_MAX;
  35. +   public static int BLESSED_ENCHANT_ARMOR_MAX;
  36. +   public static int BLESSED_ENCHANT_JEWELRY_MAX;
  37. +   public static int BREAK_ENCHANT;
  38. +   public static int CRYSTAL_ENCHANT_MIN;
  39. +   public static int CRYSTAL_ENCHANT_WEAPON_MAX;
  40. +   public static int CRYSTAL_ENCHANT_ARMOR_MAX;
  41. +   public static int CRYSTAL_ENCHANT_JEWELRY_MAX;
  42. +   public static int DONATOR_ENCHANT_MIN;
  43. +   public static int DONATOR_ENCHANT_WEAPON_MAX;
  44. +   public static int DONATOR_ENCHANT_ARMOR_MAX;
  45. +   public static int DONATOR_ENCHANT_JEWELRY_MAX;
  46. +   public static boolean DONATOR_DECREASE_ENCHANT;
  47. +   public static boolean ENABLE_ENCHANT_ANNOUNCE;
  48. +   public static String ENCHANT_ANNOUNCE_LEVEL;
  49. +   public static ArrayList<Integer> LIST_ENCHANT_ANNOUNCE_LEVEL = new ArrayList<>();
  50. +  
  51.  
  52. +   /**
  53. +    * Loads enchant settings.
  54. +    */
  55. +   private static final void loadEnchant()
  56. +   {
  57. +       final ExProperties enchant = initProperties(Config.ENCHANT_FILE);
  58. +  
  59. +       String[] propertySplit = enchant.getProperty("NormalWeaponEnchantLevel", "").split(";");
  60. +       for (String readData : propertySplit)
  61. +       {
  62. +           String[] writeData = readData.split(",");
  63. +           if (writeData.length != 2)
  64. +               _log.info("invalid config property");
  65. +           else
  66. +               try
  67. +           {
  68. +                   NORMAL_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  69. +           }
  70. +           catch (NumberFormatException nfe)
  71. +           {
  72. +               if (DEBUG)
  73. +                   nfe.printStackTrace();
  74. +               if (!readData.equals(""))
  75. +                   _log.info("invalid config property");
  76. +           }
  77. +       }
  78. +       propertySplit = enchant.getProperty("BlessWeaponEnchantLevel", "").split(";");
  79. +       for (String readData : propertySplit)
  80. +       {
  81. +           String[] writeData = readData.split(",");
  82. +           if (writeData.length != 2)
  83. +               _log.info("invalid config property");
  84. +           else
  85. +               try
  86. +           {
  87. +                   BLESS_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  88. +           }
  89. +           catch (NumberFormatException nfe)
  90. +           {
  91. +               if (DEBUG)
  92. +                   nfe.printStackTrace();
  93. +               if (!readData.equals(""))
  94. +                   _log.info("invalid config property");
  95. +           }
  96. +       }
  97. +       propertySplit = enchant.getProperty("CrystalWeaponEnchantLevel", "").split(";");
  98. +       for (String readData : propertySplit)
  99. +       {
  100. +           String[] writeData = readData.split(",");
  101. +           if (writeData.length != 2)
  102. +               _log.info("invalid config property");
  103. +           else
  104. +               try
  105. +           {
  106. +                   CRYSTAL_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  107. +           }
  108. +           catch (NumberFormatException nfe)
  109. +           {
  110. +               if (DEBUG)
  111. +                   nfe.printStackTrace();
  112. +               if (!readData.equals(""))
  113. +                   _log.info("invalid config property");
  114. +           }
  115. +       }
  116. +       propertySplit = enchant.getProperty("DonatorWeaponEnchantLevel", "").split(";");
  117. +       for (String readData : propertySplit)
  118. +       {
  119. +           String[] writeData = readData.split(",");
  120. +           if (writeData.length != 2)
  121. +               System.out.println("invalid config property");
  122. +           else
  123. +               try
  124. +           {
  125. +                   DONATOR_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  126. +           }
  127. +           catch (NumberFormatException nfe)
  128. +           {
  129. +               if (DEBUG)
  130. +                   nfe.printStackTrace();
  131. +               if (!readData.equals(""))
  132. +                   System.out.println("invalid config property");
  133. +           }
  134. +       }
  135. +       propertySplit = enchant.getProperty("NormalArmorEnchantLevel", "").split(";");
  136. +       for (String readData : propertySplit)
  137. +       {
  138. +           String[] writeData = readData.split(",");
  139. +           if (writeData.length != 2)
  140. +               _log.info("invalid config property");
  141. +           else
  142. +               try
  143. +           {
  144. +                   NORMAL_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  145. +           }
  146. +           catch (NumberFormatException nfe)
  147. +           {
  148. +               if (DEBUG)
  149. +                   nfe.printStackTrace();
  150. +               if (!readData.equals(""))
  151. +                   _log.info("invalid config property");
  152. +           }
  153. +       }
  154. +       propertySplit = enchant.getProperty("BlessArmorEnchantLevel", "").split(";");
  155. +       for (String readData : propertySplit)
  156. +       {
  157. +           String[] writeData = readData.split(",");
  158. +           if (writeData.length != 2)
  159. +               _log.info("invalid config property");
  160. +           else
  161. +               try
  162. +           {
  163. +                   BLESS_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  164. +           }
  165. +           catch (NumberFormatException nfe)
  166. +           {
  167. +               if (DEBUG)
  168. +                   nfe.printStackTrace();
  169. +               if (!readData.equals(""))
  170. +                   _log.info("invalid config property");
  171. +           }
  172. +       }
  173. +       propertySplit = enchant.getProperty("CrystalArmorEnchantLevel", "").split(";");
  174. +       for (String readData : propertySplit)
  175. +       {
  176. +           String[] writeData = readData.split(",");
  177. +           if (writeData.length != 2)
  178. +               _log.info("invalid config property");
  179. +           else
  180. +               try
  181. +           {
  182. +                   CRYSTAL_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  183. +           }
  184. +           catch (NumberFormatException nfe)
  185. +           {
  186. +               if (DEBUG)
  187. +                   nfe.printStackTrace();
  188. +               if (!readData.equals(""))
  189. +                   _log.info("invalid config property");
  190. +           }
  191. +       }
  192. +       propertySplit = enchant.getProperty("DonatorArmorEnchantLevel", "").split(";");
  193. +       for (String readData : propertySplit)
  194. +       {
  195. +           String[] writeData = readData.split(",");
  196. +           if (writeData.length != 2)
  197. +               System.out.println("invalid config property");
  198. +           else
  199. +               try
  200. +           {
  201. +                   DONATOR_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  202. +           }
  203. +           catch (NumberFormatException nfe)
  204. +           {
  205. +               if (DEBUG)
  206. +                   nfe.printStackTrace();
  207. +               if (!readData.equals(""))
  208. +                   System.out.println("invalid config property");
  209. +           }
  210. +       }
  211. +       propertySplit = enchant.getProperty("NormalJewelryEnchantLevel", "").split(";");
  212. +       for (String readData : propertySplit)
  213. +       {
  214. +           String[] writeData = readData.split(",");
  215. +           if (writeData.length != 2)
  216. +               _log.info("invalid config property");
  217. +           else
  218. +               try
  219. +           {
  220. +                   NORMAL_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  221. +           }
  222. +           catch (NumberFormatException nfe)
  223. +           {
  224. +               if (DEBUG)
  225. +                   nfe.printStackTrace();
  226. +               if (!readData.equals(""))
  227. +                   _log.info("invalid config property");
  228. +           }
  229. +       }
  230. +       propertySplit = enchant.getProperty("BlessJewelryEnchantLevel", "").split(";");
  231. +       for (String readData : propertySplit)
  232. +       {
  233. +           String[] writeData = readData.split(",");
  234. +           if (writeData.length != 2)
  235. +               _log.info("invalid config property");
  236. +           else
  237. +               try
  238. +           {
  239. +                   BLESS_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  240. +           }
  241. +           catch (NumberFormatException nfe)
  242. +           {
  243. +               if (DEBUG)
  244. +                   nfe.printStackTrace();
  245. +               if (!readData.equals(""))
  246. +                   _log.info("invalid config property");
  247. +           }
  248. +       }
  249. +       propertySplit = enchant.getProperty("CrystalJewelryEnchantLevel", "").split(";");
  250. +       for (String readData : propertySplit)
  251. +       {
  252. +           String[] writeData = readData.split(",");
  253. +           if (writeData.length != 2)
  254. +               _log.info("invalid config property");
  255. +           else
  256. +               try
  257. +           {
  258. +                   CRYSTAL_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  259. +           }
  260. +           catch (NumberFormatException nfe)
  261. +           {
  262. +               if (DEBUG)
  263. +                   nfe.printStackTrace();
  264. +               if (!readData.equals(""))
  265. +                   _log.info("invalid config property");
  266. +           }
  267. +       }
  268. +       propertySplit = enchant.getProperty("DonatorJewelryEnchantLevel", "").split(";");
  269. +       for (String readData : propertySplit)
  270. +       {
  271. +           String[] writeData = readData.split(",");
  272. +           if (writeData.length != 2)
  273. +               System.out.println("invalid config property");
  274. +           else
  275. +               try
  276. +           {
  277. +                   DONATOR_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1])));
  278. +           }
  279. +           catch (NumberFormatException nfe)
  280. +           {
  281. +               if (DEBUG)
  282. +                   nfe.printStackTrace();
  283. +               if (!readData.equals(""))
  284. +                   System.out.println("invalid config property");
  285. +           }
  286. +       }
  287. +       ENCHANT_HERO_WEAPON = Boolean.parseBoolean(enchant.getProperty("EnableEnchantHeroWeapons", "False"));
  288. +  
  289. +       GOLD_WEAPON = Integer.parseInt(enchant.getProperty("IdEnchantDonatorWeapon", "10010"));
  290. +  
  291. +       GOLD_ARMOR = Integer.parseInt(enchant.getProperty("IdEnchantDonatorArmor", "10011"));
  292. +  
  293. +       ENCHANT_SAFE_MAX = Integer.parseInt(enchant.getProperty("EnchantSafeMax", "3"));
  294. +  
  295. +       ENCHANT_SAFE_MAX_FULL = Integer.parseInt(enchant.getProperty("EnchantSafeMaxFull", "4"));
  296. +  
  297. +       SCROLL_STACKABLE = Boolean.parseBoolean(enchant.getProperty("ScrollStackable", "False"));
  298. +  
  299. +       ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("EnchantWeaponMax", "25"));
  300. +       ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("EnchantArmorMax", "25"));
  301. +       ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("EnchantJewelryMax", "25"));
  302. +  
  303. +       BLESSED_ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("BlessedEnchantWeaponMax", "25"));
  304. +       BLESSED_ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("BlessedEnchantArmorMax", "25"));
  305. +       BLESSED_ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("BlessedEnchantJewelryMax", "25"));
  306. +  
  307. +       BREAK_ENCHANT = Integer.valueOf(enchant.getProperty("BreakEnchant", "0")).intValue();
  308. +  
  309. +       CRYSTAL_ENCHANT_MIN = Integer.parseInt(enchant.getProperty("CrystalEnchantMin", "20"));
  310. +       CRYSTAL_ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("CrystalEnchantWeaponMax", "25"));
  311. +       CRYSTAL_ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("CrystalEnchantArmorMax", "25"));
  312. +       CRYSTAL_ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("CrystalEnchantJewelryMax", "25"));
  313. +  
  314. +       DONATOR_ENCHANT_MIN = Integer.parseInt(enchant.getProperty("DonatorEnchantMin", "20"));
  315. +       DONATOR_ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("DonatorEnchantWeaponMax", "25"));
  316. +       DONATOR_ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("DonatorEnchantArmorMax", "25"));
  317. +       DONATOR_ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("DonatorEnchantJewelryMax", "25"));
  318. +       DONATOR_DECREASE_ENCHANT = Boolean.valueOf(enchant.getProperty("DonatorDecreaseEnchant", "false")).booleanValue();
  319. +  
  320. +   }
  321. +  
  322. -   // hexID
  323. -   loadHexID();
  324.        
  325. +   // hexID
  326. +   loadHexID();
  327.  
  328. +   // Loads Enchant Custom
  329. +   loadEnchant();
  330.  
  331. Index: net.sf.l2j.gameserver.network.clientpackets;RequestEnchantItem.java
  332. ===================================================================
  333. --- net.sf.l2j.gameserver.network.clientpackets;RequestEnchantItem.java (revision 84)
  334. +++ net.sf.l2j.gameserver.network.clientpackets;RequestEnchantItem.java (working copy)
  335.  
  336. +   private static final int[] DONATOR_WEAPON_SCROLL =
  337. +   {
  338. +       Config.GOLD_WEAPON
  339. +   };
  340. +   private static final int[] DONATOR_ARMOR_SCROLL =
  341. +   {
  342. +       Config.GOLD_ARMOR
  343. +   };
  344. +   private static final int[] CRYSTAL_SCROLLS =
  345. +   {
  346. +       731,
  347. +       732,
  348. +       949,
  349. +       950,
  350. +       953,
  351. +       954,
  352. +       957,
  353. +       958,
  354. +       961,
  355. +       962
  356. +   };
  357. +   private static final int[] NORMAL_WEAPON_SCROLLS =
  358. +   {
  359. +       729,
  360. +       947,
  361. +       951,
  362. +       955,
  363. +       959
  364. +   };
  365. +   private static final int[] BLESSED_WEAPON_SCROLLS =
  366. +   {
  367. +       6569,
  368. +       6571,
  369. +       6573,
  370. +       6575,
  371. +       6577
  372. +   };
  373. +   private static final int[] CRYSTAL_WEAPON_SCROLLS =
  374. +   {
  375. +       731,
  376. +       949,
  377. +       953,
  378. +       957,
  379. +       961
  380. +   };
  381. +   private static final int[] NORMAL_ARMOR_SCROLLS =
  382. +   {
  383. +       730,
  384. +       948,
  385. +       952,
  386. +       956,
  387. +       960
  388. +   };
  389. +   private static final int[] BLESSED_ARMOR_SCROLLS =
  390. +   {
  391. +       6570,
  392. +       6572,
  393. +       6574,
  394. +       6576,
  395. +       6578
  396. +   };
  397. +   private static final int[] CRYSTAL_ARMOR_SCROLLS =
  398. +   {
  399. +       732,
  400. +       950,
  401. +       954,
  402. +       958,
  403. +       962
  404. +   };
  405.    
  406. -   private int _objectId;
  407. +   private int _objectId;
  408.  
  409.  
  410. -   if (item == null || scroll == null)
  411. -   {
  412. -       player.sendPacket(SystemMessageId.ENCHANT_SCROLL_CANCELLED);
  413. -       player.setActiveEnchantItem(null);
  414. -       player.sendPacket(EnchantResult.CANCELLED);
  415. -       return;
  416. -   }
  417.  
  418.  
  419. +       if (!Config.ENCHANT_HERO_WEAPON && item.getItemId() >= 6611 && item.getItemId() <= 6621)
  420. +       {
  421. +           player.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
  422. +           player.setActiveEnchantItem(null);
  423. +           return;
  424. +       }
  425. +       int itemType2 = item.getItem().getType2();
  426. +       boolean enchantItem = false;
  427. +       boolean blessedScroll = false;
  428. +       boolean crystalScroll = false;
  429. +       boolean donatorScroll = false;
  430. +       int crystalId = 0;
  431. +       switch (item.getItem().getCrystalType())
  432. +       {
  433. +           case A:
  434. +               crystalId = 1461;
  435. +               if (scroll.getItemId() == Config.GOLD_WEAPON && itemType2 == 0)
  436. +                   enchantItem = true;
  437. +               else if (scroll.getItemId() == Config.GOLD_ARMOR && (itemType2 == 1 || itemType2 == 2))
  438. +                   enchantItem = true;
  439. +               switch (scroll.getItemId())
  440. +               {
  441. +                   case 729:
  442. +                   case 731:
  443. +                   case 6569:
  444. +                       if (itemType2 == 0)
  445. +                           enchantItem = true;
  446. +                       break;
  447. +                   case 730:
  448. +                   case 732:
  449. +                   case 6570:
  450. +                       if (itemType2 == 1 || itemType2 == 2)
  451. +                           enchantItem = true;
  452. +                       break;
  453. +               }
  454. +               break;
  455. +           case B:
  456. +               crystalId = 1460;
  457. +               if (scroll.getItemId() == Config.GOLD_WEAPON && itemType2 == 0)
  458. +                   enchantItem = true;
  459. +               else if (scroll.getItemId() == Config.GOLD_ARMOR && (itemType2 == 1 || itemType2 == 2))
  460. +                   enchantItem = true;
  461. +               switch (scroll.getItemId())
  462. +               {
  463. +                   case 947:
  464. +                   case 949:
  465. +                   case 6571:
  466. +                       if (itemType2 == 0)
  467. +                           enchantItem = true;
  468. +                       break;
  469. +                   case 948:
  470. +                   case 950:
  471. +                   case 6572:
  472. +                       if (itemType2 == 1 || itemType2 == 2)
  473. +                           enchantItem = true;
  474. +                       break;
  475. +               }
  476. +               break;
  477. +           case C:
  478. +               crystalId = 1459;
  479. +               if (scroll.getItemId() == Config.GOLD_WEAPON && itemType2 == 0)
  480. +                   enchantItem = true;
  481. +               else if (scroll.getItemId() == Config.GOLD_ARMOR && (itemType2 == 1 || itemType2 == 2))
  482. +                   enchantItem = true;
  483. +               switch (scroll.getItemId())
  484. +               {
  485. +                   case 951:
  486. +                   case 953:
  487. +                   case 6573:
  488. +                       if (itemType2 == 0)
  489. +                           enchantItem = true;
  490. +                       break;
  491. +                   case 952:
  492. +                   case 954:
  493. +                   case 6574:
  494. +                       if (itemType2 == 1 || itemType2 == 2)
  495. +                           enchantItem = true;
  496. +                       break;
  497. +               }
  498. +               break;
  499. +           case D:
  500. +               crystalId = 1458;
  501. +               if (scroll.getItemId() == Config.GOLD_WEAPON && itemType2 == 0)
  502. +                   enchantItem = true;
  503. +               else if (scroll.getItemId() == Config.GOLD_ARMOR && (itemType2 == 1 || itemType2 == 2))
  504. +                   enchantItem = true;
  505. +               switch (scroll.getItemId())
  506. +               {
  507. +                   case 955:
  508. +                   case 957:
  509. +                   case 6575:
  510. +                       if (itemType2 == 0)
  511. +                           enchantItem = true;
  512. +                       break;
  513. +                   case 956:
  514. +                   case 958:
  515. +                   case 6576:
  516. +                       if (itemType2 == 1 || itemType2 == 2)
  517. +                           enchantItem = true;
  518. +                       break;
  519. +               }
  520. +               break;
  521. +           case S:
  522. +               crystalId = 1462;
  523. +               if (scroll.getItemId() == Config.GOLD_WEAPON && itemType2 == 0)
  524. +                   enchantItem = true;
  525. +               else if (scroll.getItemId() == Config.GOLD_ARMOR && (itemType2 == 1 || itemType2 == 2))
  526. +                   enchantItem = true;
  527. +               switch (scroll.getItemId())
  528. +               {
  529. +                   case 959:
  530. +                   case 961:
  531. +                   case 6577:
  532. +                       if (itemType2 == 0)
  533. +                           enchantItem = true;
  534. +                       break;
  535. +                   case 960:
  536. +                   case 962:
  537. +                   case 6578:
  538. +                       if (itemType2 == 1 || itemType2 == 2)
  539. +                           enchantItem = true;
  540. +                       break;
  541. +               }
  542. +               break;
  543. +       }
  544. +       if (!enchantItem)
  545. +       {
  546. +           player.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
  547. +           return;
  548. +       }
  549. +       if (scroll.getItemId() >= 6569 && scroll.getItemId() <= 6578)
  550. +           blessedScroll = true;
  551. +       else if (scroll.getItemId() == Config.GOLD_WEAPON || scroll.getItemId() == Config.GOLD_ARMOR)
  552. +           donatorScroll = true;
  553. +       else
  554. +           for (int crystalscroll : CRYSTAL_SCROLLS)
  555. +               if (scroll.getItemId() == crystalscroll)
  556. +               {
  557. +                   crystalScroll = true;
  558. +                   break;
  559. +               }
  560. +       int chance = 0;
  561. +       int maxEnchantLevel = 0;
  562. +       int minEnchantLevel = 0;
  563. +       int nextEnchantLevel = item.getEnchantLevel() + 1;
  564. +       if (item.getItem().getType2() == 0)
  565. +       {
  566. +           if (blessedScroll)
  567. +           {
  568. +               for (int blessedweaponscroll : BLESSED_WEAPON_SCROLLS)
  569. +                   if (scroll.getItemId() == blessedweaponscroll)
  570. +                   {
  571. +                       if (item.getEnchantLevel() >= Config.BLESS_WEAPON_ENCHANT_LEVEL.size())
  572. +                           chance = Config.BLESS_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.BLESS_WEAPON_ENCHANT_LEVEL.size())).intValue();
  573. +                       else
  574. +                           chance = Config.BLESS_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  575. +                       maxEnchantLevel = Config.BLESSED_ENCHANT_WEAPON_MAX;
  576. +                       break;
  577. +                   }
  578. +           }
  579. +           else if (crystalScroll)
  580. +           {
  581. +               for (int crystalweaponscroll : CRYSTAL_WEAPON_SCROLLS)
  582. +                   if (scroll.getItemId() == crystalweaponscroll)
  583. +                   {
  584. +                       if (item.getEnchantLevel() >= Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.size())
  585. +                           chance = Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.size())).intValue();
  586. +                       else
  587. +                           chance = Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  588. +                       minEnchantLevel = Config.CRYSTAL_ENCHANT_MIN;
  589. +                       maxEnchantLevel = Config.CRYSTAL_ENCHANT_WEAPON_MAX;
  590. +                       break;
  591. +                   }
  592. +           }
  593. +           else if (donatorScroll)
  594. +           {
  595. +               for (int donateweaponscroll : DONATOR_WEAPON_SCROLL)
  596. +                   if (scroll.getItemId() == donateweaponscroll)
  597. +                   {
  598. +                       if (item.getEnchantLevel() >= Config.DONATOR_WEAPON_ENCHANT_LEVEL.size())
  599. +                           chance = Config.DONATOR_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.DONATOR_WEAPON_ENCHANT_LEVEL.size())).intValue();
  600. +                       else
  601. +                           chance = Config.DONATOR_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  602. +                       minEnchantLevel = Config.DONATOR_ENCHANT_MIN;
  603. +                       maxEnchantLevel = Config.DONATOR_ENCHANT_WEAPON_MAX;
  604. +                       break;
  605. +                   }
  606. +           }
  607. +           else
  608. +               for (int normalweaponscroll : NORMAL_WEAPON_SCROLLS)
  609. +                   if (scroll.getItemId() == normalweaponscroll)
  610. +                   {
  611. +                       if (item.getEnchantLevel() >= Config.NORMAL_WEAPON_ENCHANT_LEVEL.size())
  612. +                           chance = Config.NORMAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.NORMAL_WEAPON_ENCHANT_LEVEL.size())).intValue();
  613. +                       else
  614. +                           chance = Config.NORMAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  615. +                       maxEnchantLevel = Config.ENCHANT_WEAPON_MAX;
  616. +                       break;
  617. +                   }
  618. +       }
  619. +       else if (item.getItem().getType2() == 1)
  620. +       {
  621. +           if (blessedScroll)
  622. +           {
  623. +               for (int blessedarmorscroll : BLESSED_ARMOR_SCROLLS)
  624. +                   if (scroll.getItemId() == blessedarmorscroll)
  625. +                   {
  626. +                       if (item.getEnchantLevel() >= Config.BLESS_ARMOR_ENCHANT_LEVEL.size())
  627. +                           chance = Config.BLESS_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.BLESS_ARMOR_ENCHANT_LEVEL.size())).intValue();
  628. +                       else
  629. +                           chance = Config.BLESS_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  630. +                       maxEnchantLevel = Config.BLESSED_ENCHANT_ARMOR_MAX;
  631. +                       break;
  632. +                   }
  633. +           }
  634. +           else if (crystalScroll)
  635. +           {
  636. +               for (int crystalarmorscroll : CRYSTAL_ARMOR_SCROLLS)
  637. +                   if (scroll.getItemId() == crystalarmorscroll)
  638. +                   {
  639. +                       if (item.getEnchantLevel() >= Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.size())
  640. +                           chance = Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.size())).intValue();
  641. +                       else
  642. +                           chance = Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  643. +                       minEnchantLevel = Config.CRYSTAL_ENCHANT_MIN;
  644. +                       maxEnchantLevel = Config.CRYSTAL_ENCHANT_ARMOR_MAX;
  645. +                       break;
  646. +                   }
  647. +           }
  648. +           else if (donatorScroll)
  649. +           {
  650. +               for (int donatorarmorscroll : DONATOR_ARMOR_SCROLL)
  651. +                   if (scroll.getItemId() == donatorarmorscroll)
  652. +                   {
  653. +                       if (item.getEnchantLevel() >= Config.DONATOR_ARMOR_ENCHANT_LEVEL.size())
  654. +                           chance = Config.DONATOR_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.DONATOR_ARMOR_ENCHANT_LEVEL.size())).intValue();
  655. +                       else
  656. +                           chance = Config.DONATOR_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  657. +                       minEnchantLevel = Config.DONATOR_ENCHANT_MIN;
  658. +                       maxEnchantLevel = Config.DONATOR_ENCHANT_ARMOR_MAX;
  659. +                       break;
  660. +                   }
  661. +           }
  662. +           else
  663. +               for (int normalarmorscroll : NORMAL_ARMOR_SCROLLS)
  664. +                   if (scroll.getItemId() == normalarmorscroll)
  665. +                   {
  666. +                       if (item.getEnchantLevel() >= Config.NORMAL_ARMOR_ENCHANT_LEVEL.size())
  667. +                           chance = Config.NORMAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.NORMAL_ARMOR_ENCHANT_LEVEL.size())).intValue();
  668. +                       else
  669. +                           chance = Config.NORMAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  670. +                       maxEnchantLevel = Config.ENCHANT_ARMOR_MAX;
  671. +                       break;
  672. +                   }
  673. +       }
  674. +       else if (item.getItem().getType2() == 2)
  675. +           if (blessedScroll)
  676. +           {
  677. +               for (int blessedjewelscroll : BLESSED_ARMOR_SCROLLS)
  678. +                   if (scroll.getItemId() == blessedjewelscroll)
  679. +                   {
  680. +                       if (item.getEnchantLevel() >= Config.BLESS_JEWELRY_ENCHANT_LEVEL.size())
  681. +                           chance = Config.BLESS_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.BLESS_JEWELRY_ENCHANT_LEVEL.size())).intValue();
  682. +                       else
  683. +                           chance = Config.BLESS_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  684. +                       maxEnchantLevel = Config.BLESSED_ENCHANT_JEWELRY_MAX;
  685. +                       break;
  686. +                   }
  687. +           }
  688. +           else if (crystalScroll)
  689. +           {
  690. +               for (int crystaljewelscroll : CRYSTAL_ARMOR_SCROLLS)
  691. +                   if (scroll.getItemId() == crystaljewelscroll)
  692. +                   {
  693. +                       if (item.getEnchantLevel() >= Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.size())
  694. +                           chance = Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.size())).intValue();
  695. +                       else
  696. +                           chance = Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  697. +                       minEnchantLevel = Config.CRYSTAL_ENCHANT_MIN;
  698. +                       maxEnchantLevel = Config.CRYSTAL_ENCHANT_JEWELRY_MAX;
  699. +
  700. +                       break;
  701. +                   }
  702. +           }
  703. +           else if (donatorScroll)
  704. +           {
  705. +               for (int donatorjewelscroll : DONATOR_ARMOR_SCROLL)
  706. +                   if (scroll.getItemId() == donatorjewelscroll)
  707. +                   {
  708. +                       if (item.getEnchantLevel() >= Config.DONATOR_JEWELRY_ENCHANT_LEVEL.size())
  709. +                           chance = Config.DONATOR_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.DONATOR_JEWELRY_ENCHANT_LEVEL.size())).intValue();
  710. +                       else
  711. +                           chance = Config.DONATOR_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  712. +                       minEnchantLevel = Config.DONATOR_ENCHANT_MIN;
  713. +                       maxEnchantLevel = Config.DONATOR_ENCHANT_JEWELRY_MAX;
  714. +                       break;
  715. +                   }
  716. +           }
  717. +           else
  718. +               for (int normaljewelscroll : NORMAL_ARMOR_SCROLLS)
  719. +                   if (scroll.getItemId() == normaljewelscroll)
  720. +                   {
  721. +                       if (item.getEnchantLevel() >= Config.NORMAL_JEWELRY_ENCHANT_LEVEL.size())
  722. +                           chance = Config.NORMAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.NORMAL_JEWELRY_ENCHANT_LEVEL.size())).intValue();
  723. +                       else
  724. +                           chance = Config.NORMAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue();
  725. +                       maxEnchantLevel = Config.ENCHANT_JEWELRY_MAX;
  726. +                       break;
  727. +                   }
  728. +       if (maxEnchantLevel != 0 && item.getEnchantLevel() >= maxEnchantLevel || item.getEnchantLevel() < minEnchantLevel)
  729. +       {
  730. +           player.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
  731. +           return;
  732. +       }
  733. +       if (Config.SCROLL_STACKABLE)
  734. +           scroll = player.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, player, item);
  735. +       else
  736. +           scroll = player.getInventory().destroyItem("Enchant", scroll, player, item);
  737. +       if (scroll == null)
  738. +       {
  739. +           player.sendPacket(SystemMessageId.NOT_ENOUGH_ITEMS);
  740. +           return;
  741. +       }
  742. +       if (item.getEnchantLevel() < Config.ENCHANT_SAFE_MAX || item.getItem().getBodyPart() == 32768 && item.getEnchantLevel() < Config.ENCHANT_SAFE_MAX_FULL)
  743. +           chance = 100;
  744. +       int rndValue = Rnd.get(100);
  745. +
  746. +       Object aChance = item.fireEvent("calcEnchantChance", new Object[chance]);
  747. +       if (aChance != null)
  748. +           chance = ((Integer) aChance).intValue();
  749. +       synchronized (item)
  750. +       {
  751. +           if (rndValue < chance)
  752. +           {
  753. +               if (item.getOwnerId() != player.getObjectId())
  754. +               {
  755. +                   player.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
  756. +                   return;
  757. +               }
  758. +               if (item.getLocation() != ItemInstance.ItemLocation.INVENTORY && item.getLocation() != ItemInstance.ItemLocation.PAPERDOLL)
  759. +               {
  760. +                   player.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION);
  761. +                   return;
  762. +               }
  763. +               if (item.getEnchantLevel() == 0)
  764. +               {
  765. +                   SystemMessage sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
  766. +                   sm.addItemName(item.getItemId());
  767. +                   player.sendPacket(sm);
  768. +                   if (Config.ENABLE_ENCHANT_ANNOUNCE && Config.LIST_ENCHANT_ANNOUNCE_LEVEL.contains(Integer.valueOf(nextEnchantLevel)))
  769. +                   {
  770. +                       World.announceToOnlinePlayers(player.getName() + " enchantou " + item.getItemName() + " +" + nextEnchantLevel + " ..");
  771. +                       MagicSkillUse MSU = new MagicSkillUse(player, player, 2025, 1, 1, 0);
  772. +                       player.sendPacket(MSU);
  773. +                       player.broadcastPacket(MSU);
  774. +                   }
  775. +               }
  776. +               else
  777. +               {
  778. +                   SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
  779. +                   sm.addNumber(item.getEnchantLevel());
  780. +                   sm.addItemName(item.getItemId());
  781. +                   player.sendPacket(sm);
  782. +                   if (Config.ENABLE_ENCHANT_ANNOUNCE && Config.LIST_ENCHANT_ANNOUNCE_LEVEL.contains(Integer.valueOf(nextEnchantLevel)))
  783. +                   {
  784. +                       World.announceToOnlinePlayers(player.getName() + " enchantou " + item.getItemName() + " +" + nextEnchantLevel + " ..");
  785. +                       MagicSkillUse MSU = new MagicSkillUse(player, player, 2025, 1, 1, 0);
  786. +                       player.sendPacket(MSU);
  787. +                       player.broadcastPacket(MSU);
  788. +                   }
  789. +               }
  790. +               item.setEnchantLevel(item.getEnchantLevel() + 1);
  791. +               item.updateDatabase();
  792. +           }
  793. +           else
  794. +           {
  795. +               if (crystalScroll)
  796. +               {
  797. +                   SystemMessage sm = SystemMessage.sendString("Failed in Crystal Enchant. The enchant value of the item become " + Config.CRYSTAL_ENCHANT_MIN);
  798. +                   player.sendPacket(sm);
  799. +               }
  800. +               else if (blessedScroll)
  801. +               {
  802. +                   SystemMessage sm = new SystemMessage(SystemMessageId.BLESSED_ENCHANT_FAILED);
  803. +                   player.sendPacket(sm);
  804. +               }
  805. +               else if (donatorScroll)
  806. +               {
  807. +                   if (Config.DONATOR_DECREASE_ENCHANT)
  808. +                   {
  809. +                       if (item.getEnchantLevel() <= Config.DONATOR_ENCHANT_MIN)
  810. +                       {
  811. +                           SystemMessage sm1 = SystemMessage.sendString("Failed Golden Enchant.");
  812. +                           player.sendPacket(sm1);
  813. +                       }
  814. +                       else
  815. +                       {
  816. +                           SystemMessage sm1 = SystemMessage.sendString("Failed Golden Enchant. His equipment had 1 reduced enchant.");
  817. +                           player.sendPacket(sm1);
  818. +                       }
  819. +                   }
  820. +                   else
  821. +                   {
  822. +                       SystemMessage sm1 = SystemMessage.sendString("Failed Golden Enchant.");
  823. +                       player.sendPacket(sm1);
  824. +                   }
  825. +               }
  826. +               else if (item.getEnchantLevel() > 0)
  827. +               {
  828. +                   SystemMessage sm = new SystemMessage(SystemMessageId.ENCHANTMENT_FAILED_S1_S2_EVAPORATED);
  829. +                   sm.addNumber(item.getEnchantLevel());
  830. +                   sm.addItemName(item.getItemId());
  831. +                   player.sendPacket(sm);
  832. +               }
  833. +               else
  834. +               {
  835. +                   SystemMessage sm = new SystemMessage(SystemMessageId.ENCHANTMENT_FAILED_S1_EVAPORATED);
  836. +                   sm.addItemName(item.getItemId());
  837. +                   player.sendPacket(sm);
  838. +               }
  839. +               if (!blessedScroll && !crystalScroll && !donatorScroll)
  840. +               {
  841. +                   if (item.getEnchantLevel() > 0)
  842. +                   {
  843. +                       SystemMessage sm = new SystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED);
  844. +                       sm.addNumber(item.getEnchantLevel());
  845. +                       sm.addItemName(item.getItemId());
  846. +                       player.sendPacket(sm);
  847. +                   }
  848. +                   else
  849. +                   {
  850. +                       SystemMessage sm = new SystemMessage(SystemMessageId.S1_DISARMED);
  851. +                       sm.addItemName(item.getItemId());
  852. +                       player.sendPacket(sm);
  853. +                   }
  854. +                   if (item.isEquipped())
  855. +                   {
  856. +                       if (item.isAugmented())
  857. +                           item.getAugmentation().removeBonus(player);
  858. +                       ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(item.getEquipSlot());
  859. +
  860. +                       InventoryUpdate iu = new InventoryUpdate();
  861. +                       for (ItemInstance element : unequiped)
  862. +                           iu.addModifiedItem(element);
  863. +                       player.sendPacket(iu);
  864. +
  865. +                       player.broadcastUserInfo();
  866. +                   }
  867. +                   int count = item.getCrystalCount() - (item.getItem().getCrystalCount() + 1) / 2;
  868. +                   if (count < 1)
  869. +                       count = 1;
  870. +                   if (item.fireEvent("enchantFail", new Object[0]) != null)
  871. +                       return;
  872. +                   ItemInstance destroyItem = player.getInventory().destroyItem("Enchant", item, player, null);
  873. +                   if (destroyItem == null)
  874. +                       return;
  875. +                   ItemInstance crystals = player.getInventory().addItem("Enchant", crystalId, count, player, destroyItem);
  876. +
  877. +                   SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
  878. +                   sm.addItemName(crystals.getItemId());
  879. +                   sm.addNumber(count);
  880. +                   player.sendPacket(sm);
  881. +
  882. +                   player.sendPacket(new ItemList(player, true));
  883. +
  884. +                   StatusUpdate su = new StatusUpdate(player);
  885. +                   su.addAttribute(14, player.getCurrentLoad());
  886. +                   player.sendPacket(su);
  887. +
  888. +                   player.broadcastUserInfo();
  889. +
  890. +                   World world = World.getInstance();
  891. +                   world.removeObject(destroyItem);
  892. +               }
  893. +               else if (blessedScroll)
  894. +               {
  895. +                   item.setEnchantLevel(Config.BREAK_ENCHANT);
  896. +                   item.updateDatabase();
  897. +               }
  898. +               else if (crystalScroll)
  899. +               {
  900. +                   item.setEnchantLevel(Config.CRYSTAL_ENCHANT_MIN);
  901. +                   item.updateDatabase();
  902. +               }
  903. +               else if (donatorScroll)
  904. +               {
  905. +                   if (Config.DONATOR_DECREASE_ENCHANT)
  906. +                   {
  907. +                       if (item.getEnchantLevel() <= Config.DONATOR_ENCHANT_MIN)
  908. +                           item.setEnchantLevel(item.getEnchantLevel());
  909. +                       else
  910. +                           item.setEnchantLevel(item.getEnchantLevel() - 1);
  911. +                   }
  912. +                   else
  913. +                       item.setEnchantLevel(item.getEnchantLevel());
  914. +                   item.updateDatabase();
  915. +               }
  916. +           }
  917. +       }
  918. +
  919.  
  920. Index: net.sf.l2j.gameserver.network.serverpackets;SystemMessage.java
  921. ===================================================================
  922. --- net.sf.l2j.gameserver.network.serverpackets;SystemMessage.java (revision 84)
  923. +++ net.sf.l2j.gameserver.network.serverpackets;SystemMessage.java (working copy)
  924.  
  925. -   private SystemMessage(final SystemMessageId smId)
  926. -   {
  927. -       final int paramCount = smId.getParamCount();
  928. -       _smId = smId;
  929. -       _params = paramCount != 0 ? new SMParam[paramCount] : EMPTY_PARAM_ARRAY;
  930. -   }
  931.  
  932. +   public SystemMessage(final SystemMessageId smId)
  933. +   {
  934. +       final int paramCount = smId.getParamCount();
  935. +       _smId = smId;
  936. +       _params = paramCount != 0 ? new SMParam[paramCount] : EMPTY_PARAM_ARRAY;
  937. +   }
  938.  
  939. Index: net.sf.l2j.gameserver.model.item.instance;ItemInstance.java
  940. ===================================================================
  941. --- net.sf.l2j.gameserver.model.item.instance;ItemInstance.java (revision 84)
  942. +++ net.sf.l2j.gameserver.model.item.instance;ItemInstance.java (working copy)
  943.  
  944. -   import net.sf.l2j.gameserver.model.World;
  945. +   import net.sf.l2j.gameserver.model.World;
  946. +   import net.sf.l2j.gameserver.model.extender.BaseExtender;
  947.  
  948.  
  949.  
  950. +   private final BaseExtender _extender = null;
  951. +  
  952. +   public Object fireEvent(String event, Object... params)
  953. +   {
  954. +       if (_extender == null)
  955. +           return null;
  956. +       return _extender.onEvent(event, params);
  957. +   }
  958. +  
  959. +   public int getEquipSlot()
  960. +   {
  961. +       if (Config.DEBUG_PATH && _loc != ItemLocation.PAPERDOLL && _loc != ItemLocation.PET_EQUIP && _loc != ItemLocation.FREIGHT)
  962. +           throw new AssertionError();
  963. +       return _locData;
  964. +   }
  965.  
  966. Index: net.sf.l2j.gameserver.model.extender;BaseExtender.java (New Packt)
  967. ===================================================================
  968. --- net.sf.l2j.gameserver.model.extender;BaseExtender.java (New Packt)
  969. +++ net.sf.l2j.gameserver.model.extender;BaseExtender.java (New Packt)
  970.  
  971. +   package net.sf.l2j.gameserver.model.extender;
  972. +  
  973. +   import net.sf.l2j.gameserver.model.WorldObject;
  974. +  
  975. +   public class BaseExtender
  976. +   {
  977. +       protected WorldObject _owner;
  978. +  
  979. +       public static enum EventType
  980. +       {
  981. +           LOAD("load"),
  982. +           STORE("store"),
  983. +           CAST("cast"),
  984. +           ATTACK("attack"),
  985. +           CRAFT("craft"),
  986. +           ENCHANT("enchant"),
  987. +           SPAWN("spawn"),
  988. +           DELETE("delete"),
  989. +           SETOWNER("setwoner"),
  990. +           DROP("drop"),
  991. +           DIE("die"),
  992. +           REVIVE("revive"),
  993. +           SETINTENTION("setintention");
  994. +  
  995. +           public final String name;
  996. +  
  997. +           private EventType(String name)
  998. +           {
  999. +               this.name = name;
  1000. +           }
  1001. +       }
  1002. +  
  1003. +       public static boolean canCreateFor(WorldObject object)
  1004. +       {
  1005. +           return true;
  1006. +       }
  1007. +  
  1008. +       private BaseExtender _next = null;
  1009. +  
  1010. +       public BaseExtender(WorldObject owner)
  1011. +       {
  1012. +           _owner = owner;
  1013. +       }
  1014. +  
  1015. +       public WorldObject getOwner()
  1016. +       {
  1017. +           return _owner;
  1018. +       }
  1019. +  
  1020. +       public Object onEvent(String event, Object... params)
  1021. +       {
  1022. +           if (_next == null)
  1023. +               return null;
  1024. +           return _next.onEvent(event, params);
  1025. +       }
  1026. +  
  1027. +       public BaseExtender getExtender(String simpleClassName)
  1028. +       {
  1029. +           if (getClass().getSimpleName().compareTo(simpleClassName) == 0)
  1030. +               return this;
  1031. +           if (_next != null)
  1032. +               return _next.getExtender(simpleClassName);
  1033. +           return null;
  1034. +       }
  1035. +  
  1036. +       public void removeExtender(BaseExtender ext)
  1037. +       {
  1038. +           if (_next != null)
  1039. +               if (_next == ext)
  1040. +                   _next = _next._next;
  1041. +               else
  1042. +                   _next.removeExtender(ext);
  1043. +       }
  1044. +  
  1045. +       public BaseExtender getNextExtender()
  1046. +       {
  1047. +           return _next;
  1048. +       }
  1049. +  
  1050. +       public void addExtender(BaseExtender newExtender)
  1051. +       {
  1052. +           if (_next == null)
  1053. +               _next = newExtender;
  1054. +           else
  1055. +               _next.addExtender(newExtender);
  1056. +       }
  1057. +   }
  1058. +  
  1059.  
  1060. Index: config/enchant.properties
  1061. ===================================================================
  1062. --- config/enchant.properties (revision 84)
  1063. +++ config/enchant.properties (working copy)
  1064.  
  1065. +   #============================================================#
  1066. +   #                       ENCHANT SETTINGS                     #
  1067. +   #============================================================#
  1068. +   # ----------------------------------------------
  1069. +   #  Special Enchanting System -
  1070. +   # ----------------------------------------------
  1071. +   # Chance enchanting presented as a series of pairs of numbers where the first
  1072. +   # Indicates the number of levels, and the second chance of successful enchanting.
  1073. +   # Also have the option of limiting the maximum level of echanting
  1074. +   # For weapons / armor / jewelry.
  1075. +   # If you have a maximum level of grinding 50 and you do not want
  1076. +   # Give all the chances for each level (from 1 to 50) then
  1077. +   # You can specify for example:
  1078. +   # NormalWeaponEnchantLevel = 1,50; 2,50; 3,50; 4,75; 5,50;
  1079. +   # Example: 5,92; = if you enchant weapon to +5 you have 92% to success.
  1080. +   # ----------------------------------------------
  1081. +   #  CHANCE FOR NORMAL SCROLLS -
  1082. +   # ----------------------------------------------
  1083. +   # Weapon
  1084. +   NormalWeaponEnchantLevel = 1,50;2,50;3,50;4,70;5,70;6,70;7,70;8,70;9,70;10,70;11,70;12,70;13,70;14,70;15,70;16,70;17,70;18,70;19,70;20,70;21,70;22,70;23,70;24,70;25,70;
  1085. +   # Armor
  1086. +   NormalArmorEnchantLevel = 1,50;2,50;3,50;4,70;5,70;6,70;7,70;8,70;9,70;10,70;11,70;12,70;13,70;14,70;15,70;16,70;17,70;18,70;19,70;20,70;21,70;22,70;23,70;24,70;25,70;
  1087. +   # Jewel
  1088. +   NormalJewelryEnchantLevel = 1,50;2,50;3,50;4,70;5,70;6,70;7,70;8,70;9,70;10,70;11,70;12,70;13,70;14,70;15,70;16,70;17,70;18,70;19,70;20,70;21,70;22,70;23,70;24,70;25,70;
  1089. +  
  1090. +   # ----------------------------------------------
  1091. +   #  CHANCE FOR BLESSEDS SCROLLS -
  1092. +   # ----------------------------------------------
  1093. +   # Weapon
  1094. +   BlessWeaponEnchantLevel = 1,50;2,50;3,50;4,50;5,50;6,50;7,50;8,50;9,50;10,50;11,50;12,50;13,50;14,50;15,50;16,50;17,50;18,50;19,50;20,50;21,50;22,50;23,50;24,50;25,50;26,50;27,50;28,50;29,50;30,50;
  1095. +   # Armor
  1096. +   BlessArmorEnchantLevel = 1,50;2,50;3,50;4,50;5,50;6,50;7,50;8,50;9,50;10,50;11,50;12,50;13,50;14,50;15,50;16,50;17,50;18,50;19,50;20,50;21,50;22,50;23,50;24,50;25,50;26,50;27,50;28,50;29,50;30,50;
  1097. +   # Jewel
  1098. +   BlessJewelryEnchantLevel = 1,50;2,50;3,50;4,50;5,50;6,50;7,50;8,50;9,50;10,50;11,50;12,50;13,50;14,50;15,50;16,50;17,50;18,50;19,50;20,50;21,50;22,50;23,50;24,50;25,50;26,50;27,50;28,50;29,50;30,50;
  1099. +  
  1100. +   # ---------------------------------------------
  1101. +   #  CHANCE FOR CRYSTALS SCROLLS -
  1102. +   # ---------------------------------------------
  1103. +   # Weapon
  1104. +   CrystalWeaponEnchantLevel = 1,50;2,50;3,50;4,50;5,50;6,50;7,50;8,50;9,50;10,50;11,50;12,50;13,50;14,50;15,50;16,50;17,50;18,50;19,50;20,50;21,50;22,50;23,50;24,50;25,50;26,50;27,50;28,50;29,50;30,50;
  1105. +   # Armor
  1106. +   CrystalArmorEnchantLevel = 1,50;2,50;3,50;4,50;5,50;6,50;7,50;8,50;9,50;10,50;11,50;12,50;13,50;14,50;15,50;16,50;17,50;18,50;19,50;20,50;21,50;22,50;23,50;24,50;25,50;26,50;27,50;28,50;29,50;30,50;
  1107. +   # Jewel
  1108. +   CrystalJewelryEnchantLevel = 1,50;2,50;3,50;4,50;5,50;6,50;7,50;8,50;9,50;10,50;11,50;12,50;13,50;14,50;15,50;16,50;17,50;18,50;19,50;20,50;21,50;22,50;23,50;24,50;25,50;26,50;27,50;28,50;29,50;30,50;
  1109. +  
  1110. +   # ---------------------------------------------
  1111. +   #  CHANCE FOR DONATOR SCROLLS -
  1112. +   # ---------------------------------------------
  1113. +   # Weapon
  1114. +   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;
  1115. +   # Armor
  1116. +   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;
  1117. +   # Jewel
  1118. +   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;
  1119. +  
  1120. +   # On / off enchant hero weapons
  1121. +   EnableEnchantHeroWeapons = False
  1122. +  
  1123. +   # Scroll em um so slot
  1124. +   ScrollStackable = True
  1125. +  
  1126. +   # Safe enchant
  1127. +   EnchantSafeMax = 4
  1128. +   EnchantSafeMaxFull = 4
  1129. +  
  1130. +   # Max enchant Settings by scrolls.
  1131. +   EnchantWeaponMax=15
  1132. +   EnchantArmorMax=8
  1133. +   EnchantJewelryMax=8
  1134. +  
  1135. +   # Blessed Limit
  1136. +   BlessedEnchantWeaponMax = 15
  1137. +   BlessedEnchantArmorMax = 15
  1138. +   BlessedEnchantJewelryMax = 15
  1139. +  
  1140. +   # Enchant after break with blessed scroll.
  1141. +   BreakEnchant = 4
  1142. +  
  1143. +   # Crystal Limits
  1144. +   CrystalEnchantMin = 4
  1145. +   CrystalEnchantWeaponMax = 20
  1146. +   CrystalEnchantArmorMax = 20
  1147. +   CrystalEnchantJewelryMax = 20
  1148. +  
  1149. +   # Donator Enchant Limits
  1150. +   DonatorEnchantMin = 4
  1151. +   DonatorEnchantWeaponMax = 25
  1152. +   DonatorEnchantArmorMax = 25
  1153. +   DonatorEnchantJewelryMax = 25
  1154. +   DonatorBreakEnchant = 20
  1155. +  
  1156. +   # Se true quando enchant falhar, ira perder o enchant atual e reduzira 1 enchant no equipament
  1157. +   # se false o enchant falha, mas nao reduzira enchant no equipament, permanecera o mesmo enchant
  1158. +   DonatorDecreaseEnchant = True
  1159. +  
  1160. +   # Id donator scroll weapon
  1161. +   IdEnchantDonatorWeapon = 9506
  1162. +  
  1163. +   # Id donator scroll armor
  1164. +   IdEnchantDonatorArmor = 9507
  1165. +  
  1166. +   # Announce enchant successful
  1167. +   EnableEnchantAnnounce = True
  1168. +   EnchantAnnounceLevels = 20,21,22,23,24,25
  1169. +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement