All pastes #963010 Raw Edit

Mine

public text v1 · immutable
#963010 ·published 2008-03-30 04:52 UTC
rendered paste body
Index: D:/Documents and Settings/Administrator/My Documents/workspace/L2_GameServer_Commit/java/net/sf/l2j/gameserver/clientpackets/RequestEnchantItem.java
===================================================================
--- D:/Documents and Settings/Administrator/My Documents/workspace/L2_GameServer_Commit/java/net/sf/l2j/gameserver/clientpackets/RequestEnchantItem.java	(revision 1874)
+++ D:/Documents and Settings/Administrator/My Documents/workspace/L2_GameServer_Commit/java/net/sf/l2j/gameserver/clientpackets/RequestEnchantItem.java	(working copy)
@@ -57,7 +57,7 @@
         L2ItemInstance scroll = activeChar.getActiveEnchantItem();
         if (item == null || scroll == null)
         {
-        	activeChar.setActiveEnchantItem(null);
+        activeChar.setActiveEnchantItem(null);
         	return;
         }
 
@@ -95,10 +95,18 @@
         		return;
         	}
         }
+        	
         int itemType2 = item.getItem().getType2();
         boolean enchantItem = false;
         boolean blessedScroll = false;
         int crystalId = 0;
+        
+        if (item.getEnchantLevel() > 10 && scroll.isCrystalScroll())
+        {
+        	activeChar.sendPacket(new SystemMessage(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION));
+        	activeChar.setActiveEnchantItem(null);
+            return;
+        }
 
         /** pretty code ;D */
         switch (item.getItem().getCrystalType())
@@ -183,16 +191,6 @@
             return;
         }
 
-        // Get the scroll type - Yesod
-        if (scroll.getItemId() >= 6569 && scroll.getItemId() <= 6578)
-            blessedScroll = true;
-        else
-            for (int crystalscroll : CRYSTAL_SCROLLS)
-                if(scroll.getItemId() == crystalscroll)
-                {
-                    blessedScroll = true; break;
-                }
-
         scroll = activeChar.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, activeChar, item);
         if(scroll == null)
         {
@@ -225,6 +223,25 @@
         	chance = Config.ENCHANT_CHANCE_JEWELRY;
         	maxEnchantLevel = Config.ENCHANT_MAX_JEWELRY;
         }
+        
+        // Get the scroll type - Yesod
+        if (scroll.getItemId() >= 6569 && scroll.getItemId() <= 6578)
+        {
+            blessedScroll = true;
+        }
+        else
+        {
+            for (int crystalscroll : CRYSTAL_SCROLLS)
+            {
+                if(scroll.getItemId() == crystalscroll)
+                {
+                    // 100% chance for crystal scrolls
+                    chance = 100;
+                    blessedScroll = true; 
+                    break;
+                }
+            }
+        }
 
         if (item.getEnchantLevel() < Config.ENCHANT_SAFE_MAX
                 || (item.getItem().getBodyPart() == L2Item.SLOT_FULL_ARMOR
@@ -382,4 +399,4 @@
     {
         return _C__58_REQUESTENCHANTITEM;
     }
-}
+}
\ No newline at end of file
Index: D:/Documents and Settings/Administrator/My Documents/workspace/L2_GameServer_Commit/java/net/sf/l2j/gameserver/model/L2ItemInstance.java
===================================================================
--- D:/Documents and Settings/Administrator/My Documents/workspace/L2_GameServer_Commit/java/net/sf/l2j/gameserver/model/L2ItemInstance.java	(revision 1874)
+++ D:/Documents and Settings/Administrator/My Documents/workspace/L2_GameServer_Commit/java/net/sf/l2j/gameserver/model/L2ItemInstance.java	(working copy)
@@ -420,6 +420,25 @@
 	{
 		return _itemId;
 	}
+	
+	public boolean isCrystalScroll()
+	{
+		switch (getItem().getItemId())
+        {
+            case 731: // CSEWA
+            case 732: // CSEAA
+            case 949: //CSEWB
+            case 950: //CSEAB
+            case 953: //CSEWC
+            case 954: //CSEAC
+            case 957: //CSEWD
+            case 958: //CSEAD
+            case 961: //CSEWS
+            case 962: //CSEAS
+            	return true;
+        }
+		return false;
+	}
 
     /**
      * Returns the quantity of crystals for crystallization