CostyKiller

Support for enchant limit on items, limits for kaliel bracelets and correction for AbstractEnchant Condition

Dec 3rd, 2020 (edited)
592
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Index: java/org/l2jmobius/gameserver/model/items/Item.java
  2. ===================================================================
  3. --- java/org/l2jmobius/gameserver/model/items/Item.java (revision 7857)
  4. +++ java/org/l2jmobius/gameserver/model/items/Item.java (working copy)
  5. @@ -143,6 +143,7 @@
  6.     private boolean _tradeable;
  7.     private boolean _depositable;
  8.     private int _enchantable;
  9. +   private int _enchantLimit;
  10.     private boolean _elementable;
  11.     private boolean _questItem;
  12.     private boolean _freightable;
  13. @@ -219,6 +220,7 @@
  14.        
  15.         _elementable = set.getBoolean("element_enabled", false);
  16.         _enchantable = set.getInt("enchant_enabled", 0);
  17. +       _enchantLimit = set.getInt("enchant_limit", 0);
  18.         _freightable = set.getBoolean("is_freightable", false);
  19.         _allowSelfResurrection = set.getBoolean("allow_self_resurrection", false);
  20.         _isOlyRestricted = set.getBoolean("is_oly_restricted", false);
  21. @@ -624,6 +626,15 @@
  22.     }
  23.    
  24.     /**
  25. +    * Returns the enchantment limit of the item
  26. +    * @return int
  27. +    */
  28. +   public int getEnchantLimit()
  29. +   {
  30. +       return _enchantLimit > 0 ? _enchantLimit : 0;
  31. +   }
  32. +  
  33. +   /**
  34.      * @return {@code true} if the item can be elemented, {@code false} otherwise.
  35.      */
  36.     public boolean isElementable()
  37.  
  38. Index: java/org/l2jmobius/gameserver/model/items/enchant/AbstractEnchantItem.java
  39. ===================================================================
  40. --- java/org/l2jmobius/gameserver/model/items/enchant/AbstractEnchantItem.java  (revision 7857)
  41. +++ java/org/l2jmobius/gameserver/model/items/enchant/AbstractEnchantItem.java  (working copy)
  42. @@ -142,7 +142,7 @@
  43.         {
  44.             return false;
  45.         }
  46. -       else if (itemToEnchant.isEnchantable() == 0)
  47. +       else if ((itemToEnchant.isEnchantable() == 0) || (!(itemToEnchant.getItem().getEnchantLimit() == 0) && (itemToEnchant.getEnchantLevel() == itemToEnchant.getItem().getEnchantLimit())))
  48.         {
  49.             return false;
  50.         }
  51. @@ -150,7 +150,7 @@
  52.         {
  53.             return false;
  54.         }
  55. -       else if (((_minEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() < _minEnchantLevel)) && ((_maxEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevel)))
  56. +       else if (((_minEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() < _minEnchantLevel)) || ((_maxEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevel)))
  57.         {
  58.             return false;
  59.         }
  60.  
  61. Index: java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java
  62. ===================================================================
  63. --- java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java (revision 7857)
  64. +++ java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java (working copy)
  65. @@ -119,7 +119,7 @@
  66.         }
  67.        
  68.         // first validation check - also over enchant check
  69. -       if (!scrollTemplate.isValid(item, supportTemplate) || (Config.DISABLE_OVER_ENCHANTING && (item.getEnchantLevel() == scrollTemplate.getMaxEnchantLevel())))
  70. +       if (!scrollTemplate.isValid(item, supportTemplate) || (Config.DISABLE_OVER_ENCHANTING && ((item.getEnchantLevel() == scrollTemplate.getMaxEnchantLevel()) || (!(item.getItem().getEnchantLimit() == 0) && (item.getEnchantLevel() == item.getItem().getEnchantLimit())))))
  71.         {
  72.             client.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
  73.             player.removeRequest(request.getClass());
  74.  
  75. Index: dist/game/data/EnchantItemData.xml
  76. ===================================================================
  77. --- dist/game/data/EnchantItemData.xml  (revision 7855)
  78. +++ dist/game/data/EnchantItemData.xml  (working copy)
  79. @@ -19,13 +19,9 @@
  80.     </enchant>
  81.    
  82.     <!-- Enchant Scroll: Blessed Bracelet -->
  83. -   <enchant id="80838" maxEnchant="5">
  84. +   <enchant id="80838" maxEnchant="10">
  85.         <item id="80835" />
  86.         <item id="80836" />
  87. -   </enchant>
  88. -  
  89. -   <!-- Enchant Scroll: Blessed Bracelet -->
  90. -   <enchant id="80838" maxEnchant="10">
  91.         <item id="80837" />
  92.     </enchant>
  93.  
  94. Index: dist/game/data/xsd/items.xsd
  95. ===================================================================
  96. --- dist/game/data/xsd/items.xsd    (revision 7857)
  97. +++ dist/game/data/xsd/items.xsd    (working copy)
  98. @@ -71,6 +71,7 @@
  99.                     <xs:enumeration value="duration" />
  100.                     <xs:enumeration value="element_enabled" />
  101.                     <xs:enumeration value="enchant_enabled" />
  102. +                   <xs:enumeration value="enchant_limit" />
  103.                     <xs:enumeration value="enchant4_skill" />
  104.                     <xs:enumeration value="enchanted" />
  105.                     <xs:enumeration value="equip_condition" />
  106.  
  107. Index: dist/game/data/stats/items/80800-80899.xml
  108. ===================================================================
  109. --- dist/game/data/stats/items/80800-80899.xml  (revision 7857)
  110. +++ dist/game/data/stats/items/80800-80899.xml  (working copy)
  111. @@ -455,6 +455,7 @@
  112.         <set name="immediate_effect" val="true" />
  113.         <set name="commissionItemType" val="BRACELET" />
  114.         <set name="enchant_enabled" val="1" />
  115. +       <set name="enchant_limit" val="5" />
  116.         <skills>
  117.             <skill id="35524" level="1" /> <!-- Kaliel's Bracelet -->
  118.             <skill id="35524" level="2" type="ON_ENCHANT" type_value="1" /> <!-- Kaliel's Bracelet +1 -->
  119. @@ -473,6 +474,7 @@
  120.         <set name="immediate_effect" val="true" />
  121.         <set name="commissionItemType" val="BRACELET" />
  122.         <set name="enchant_enabled" val="1" />
  123. +       <set name="enchant_limit" val="5" />
  124.         <skills>
  125.             <skill id="35525" level="1" /> <!-- Kaliel's Greater Bracelet -->
  126.             <skill id="35525" level="2" type="ON_ENCHANT" type_value="1" /> <!-- Kaliel's Greater Bracelet +1 -->
RAW Paste Data