Jump to content

Recommended Posts

Posted

First of all hello. few days ago i was interesed by this and with help of Rizlaaa I created config for enchant chance of weapon by their type.

 

Index: other.properties
===================================================================
--- other.properties	(revision 5511)
+++ other.properties	(working copy)
@@ -41,6 +41,16 @@
MaximumFreightSlots = 20

# % Chance of succeding to enchant an item when it has a chance of breaking
+EnchantChanceByTypes = False
+EnchantChanceBow=80
+EnchantChanceSword=75
+EnchantChanceBigSword=90
+EnchantChanceBlunt=65
+EnchantChanceBigBlunt=90
+EnchantChanceDagger=70
+EnchantChancePole=85
+EnchantChanceFist=85
+EnchantChanceDual=90
EnchantChanceWeapon = 68
EnchantChanceArmor = 52
EnchantChanceJewelry = 54
Index: Config.java
===================================================================
--- Config.java	(revision 5511)
+++ Config.java	(working copy)
@@ -933,6 +933,16 @@
     public static boolean AUTODELETE_INVALID_QUEST_DATA;

     /** Chance that an item will succesfully be enchanted */
+    public static boolean ENCHANT_CHANCE_BY_WEAPON_TYPE;	
+    public static int ENCHANT_CHANCE_BOW;
+    public static int ENCHANT_CHANCE_SWORD;
+    public static int ENCHANT_CHANCE_BIGSWORD;
+    public static int ENCHANT_CHANCE_BLUNT;
+    public static int ENCHANT_CHANCE_BIGBLUNT;
+    public static int ENCHANT_CHANCE_DAGGER;
+    public static int ENCHANT_CHANCE_POLE;
+    public static int ENCHANT_CHANCE_FIST;
+    public static int ENCHANT_CHANCE_DUAL;
     public static int ENCHANT_CHANCE_WEAPON;
     public static int ENCHANT_CHANCE_ARMOR;
     public static int ENCHANT_CHANCE_JEWELRY;
@@ -1475,6 +1485,16 @@


                 /* chance to enchant an item over +3 */
+				ENCHANT_CHANCE_BY_WEAPON_TYPE = Boolean.valueOf(otherSettings.getProperty("EnchantChanceByTypes", "False"));
+                ENCHANT_CHANCE_BOW  = Integer.parseInt(otherSettings.getProperty("EnchantChanceBow", "80"));	
+                ENCHANT_CHANCE_SWORD  = Integer.parseInt(otherSettings.getProperty("EnchantChanceSword", "75"));
+                ENCHANT_CHANCE_BIGSWORD = Integer.parseInt(otherSettings.getProperty("EnchantChanceBigSword", "90"));
+                ENCHANT_CHANCE_BLUNT  = Integer.parseInt(otherSettings.getProperty("EnchantChanceBlunt", "65"));
+                ENCHANT_CHANCE_BIGBLUNT  = Integer.parseInt(otherSettings.getProperty("EnchantChanceBigBlunt", "90"));
+                ENCHANT_CHANCE_DAGGER = Integer.parseInt(otherSettings.getProperty("EnchantChanceDagger", "70"));
+                ENCHANT_CHANCE_POLE = Integer.parseInt(otherSettings.getProperty("EnchantChancePole", "85"));
+                ENCHANT_CHANCE_FIST  = Integer.parseInt(otherSettings.getProperty("EnchantChanceFist", "85"));
+                ENCHANT_CHANCE_DUAL = Integer.parseInt(otherSettings.getProperty("EnchantChanceDual", "90"));				
                 ENCHANT_CHANCE_WEAPON  = Integer.parseInt(otherSettings.getProperty("EnchantChanceWeapon", "68"));
                 ENCHANT_CHANCE_ARMOR  = Integer.parseInt(otherSettings.getProperty("EnchantChanceArmor", "52"));
                 ENCHANT_CHANCE_JEWELRY  = Integer.parseInt(otherSettings.getProperty("EnchantChanceJewelry", "54"));
Index: gameserver/clientpackets/RequestEnchantItem.java
===================================================================
--- gameserver/clientpackets/RequestEnchantItem.java	(revision 5511)
+++ gameserver/clientpackets/RequestEnchantItem.java	(working copy)
@@ -185,12 +185,44 @@

         int chance = 0;
         int maxEnchantLevel = 0;
-
-        if (item.getItem().getType2() == L2Item.TYPE2_WEAPON)
-        {
-	        chance = Config.ENCHANT_CHANCE_WEAPON;
-	        maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;
-        }
+		
+		//Enchant Chance by Weapons Type
+		if (item.getItem().getType2() == L2Item.TYPE2_WEAPON && Config.CHANCE_BY_WEAPON_TYPE)
+		{
+			if(item.getItem().getItemType() == L2WeaponType.BOW)
+			chance = Config.CHANCE_BOW;
+			maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;
+			else if(item.getItem().getItemType() == L2WeaponType.SWORD)		
+			chance = Config.CHANCE_SWORD;
+			maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;			
+			else if(item.getItem().getItemType() == L2WeaponType.DAGGER)		
+			chance = Config.CHANCE_DAGGER;
+			maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;
+			else if(item.getItem().getItemType() == L2WeaponType.BLUNT)		
+			chance = Config.CHANCE_BLUNT;
+			maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;			
+			else if(item.getItem().getItemType() == L2WeaponType.POLE)		
+			chance = Config.CHANCE_POLE;
+			maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;
+			else if(item.getItem().getItemType() == L2WeaponType.DUAL)		
+			chance = Config.CHANCE_DUAL;
+			maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;
+			else if(item.getItem().getItemType() == L2WeaponType.BIGSWORD)		
+			chance = Config.CHANCE_BIGSWORD;
+			maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;
+			else if(item.getItem().getItemType() == L2WeaponType.BIGBLUNT)		
+			chance = Config.CHANCE_BIGBLUNT;
+			maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;			
+			else if(item.getItem().getItemType() == L2WeaponType.FIST)		
+			chance = Config.CHANCE_FIST;
+			maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;			
+		}
+		else if (item.getItem().getType2() == L2Item.TYPE2_WEAPON && !Config.CHANCE_BY_WEAPON_TYPE)
+				{
+			        chance = Config.ENCHANT_CHANCE_WEAPON;
+					maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;
+				}
+		
         else if (item.getItem().getType2() == L2Item.TYPE2_SHIELD_ARMOR)
         {
	        chance = Config.ENCHANT_CHANCE_ARMOR;

 

Not tested! forgive me if it is already shared!

  • 3 weeks later...
Posted

Index: other.properties
===================================================================
--- other.properties	(revision 5511)
+++ other.properties	(working copy)
@@ -41,6 +41,16 @@
MaximumFreightSlots = 20

# % Chance of succeding to enchant an item when it has a chance of breaking
+EnchantChanceByTypes = False
+EnchantChanceBow=80
+EnchantChanceSword=75
+EnchantChanceBigSword=90
+EnchantChanceBlunt=65
+EnchantChanceBigBlunt=90
+EnchantChanceDagger=70
+EnchantChancePole=85
+EnchantChanceFist=85
+EnchantChanceDual=90
EnchantChanceWeapon = 68
EnchantChanceArmor = 52
EnchantChanceJewelry = 54
Index: Config.java
===================================================================
--- Config.java	(revision 5511)
+++ Config.java	(working copy)
@@ -933,6 +933,16 @@
     public static boolean AUTODELETE_INVALID_QUEST_DATA;

     /** Chance that an item will succesfully be enchanted */
+    public static boolean ENCHANT_CHANCE_BY_WEAPON_TYPE;	
+    public static int ENCHANT_CHANCE_BOW;
+    public static int ENCHANT_CHANCE_SWORD;
+    public static int ENCHANT_CHANCE_BIGSWORD;
+    public static int ENCHANT_CHANCE_BLUNT;
+    public static int ENCHANT_CHANCE_BIGBLUNT;
+    public static int ENCHANT_CHANCE_DAGGER;
+    public static int ENCHANT_CHANCE_POLE;
+    public static int ENCHANT_CHANCE_FIST;
+    public static int ENCHANT_CHANCE_DUAL;
     public static int ENCHANT_CHANCE_WEAPON;
     public static int ENCHANT_CHANCE_ARMOR;
     public static int ENCHANT_CHANCE_JEWELRY;
@@ -1475,6 +1485,16 @@


                 /* chance to enchant an item over +3 */
+				ENCHANT_CHANCE_BY_WEAPON_TYPE = Boolean.valueOf(otherSettings.getProperty("EnchantChanceByTypes", "False"));
+                ENCHANT_CHANCE_BOW  = Integer.parseInt(otherSettings.getProperty("EnchantChanceBow", "80"));	
+                ENCHANT_CHANCE_SWORD  = Integer.parseInt(otherSettings.getProperty("EnchantChanceSword", "75"));
+                ENCHANT_CHANCE_BIGSWORD = Integer.parseInt(otherSettings.getProperty("EnchantChanceBigSword", "90"));
+                ENCHANT_CHANCE_BLUNT  = Integer.parseInt(otherSettings.getProperty("EnchantChanceBlunt", "65"));
+                ENCHANT_CHANCE_BIGBLUNT  = Integer.parseInt(otherSettings.getProperty("EnchantChanceBigBlunt", "90"));
+                ENCHANT_CHANCE_DAGGER = Integer.parseInt(otherSettings.getProperty("EnchantChanceDagger", "70"));
+                ENCHANT_CHANCE_POLE = Integer.parseInt(otherSettings.getProperty("EnchantChancePole", "85"));
+                ENCHANT_CHANCE_FIST  = Integer.parseInt(otherSettings.getProperty("EnchantChanceFist", "85"));
+                ENCHANT_CHANCE_DUAL = Integer.parseInt(otherSettings.getProperty("EnchantChanceDual", "90"));				
                 ENCHANT_CHANCE_WEAPON  = Integer.parseInt(otherSettings.getProperty("EnchantChanceWeapon", "68"));
                 ENCHANT_CHANCE_ARMOR  = Integer.parseInt(otherSettings.getProperty("EnchantChanceArmor", "52"));
                 ENCHANT_CHANCE_JEWELRY  = Integer.parseInt(otherSettings.getProperty("EnchantChanceJewelry", "54"));
Index: gameserver/clientpackets/RequestEnchantItem.java
===================================================================
--- gameserver/clientpackets/RequestEnchantItem.java	(revision 5511)
+++ gameserver/clientpackets/RequestEnchantItem.java	(working copy)
@@ -185,12 +185,44 @@

         int chance = 0;
         int maxEnchantLevel = 0;
-
-        if (item.getItem().getType2() == L2Item.TYPE2_WEAPON)
-        {
-	        chance = Config.ENCHANT_CHANCE_WEAPON;
-	        maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;
-        }
+		
+		//Enchant Chance by Weapons Type
+		if (item.getItem().getType2() == L2Item.TYPE2_WEAPON && Config.CHANCE_BY_WEAPON_TYPE)
+		{
+			if(item.getItem().getItemType() == L2WeaponType.BOW)
+				chance = Config.CHANCE_BOW;
+			else if(item.getItem().getItemType() == L2WeaponType.SWORD)		
+				chance = Config.CHANCE_SWORD;		
+			else if(item.getItem().getItemType() == L2WeaponType.DAGGER)		
+				chance = Config.CHANCE_DAGGER;
+			else if(item.getItem().getItemType() == L2WeaponType.BLUNT)		
+				chance = Config.CHANCE_BLUNT;		
+			else if(item.getItem().getItemType() == L2WeaponType.POLE)		
+				chance = Config.CHANCE_POLE;
+			else if(item.getItem().getItemType() == L2WeaponType.DUAL)		
+				chance = Config.CHANCE_DUAL;
+			else if(item.getItem().getItemType() == L2WeaponType.BIGSWORD)		
+				chance = Config.CHANCE_BIGSWORD;
+			else if(item.getItem().getItemType() == L2WeaponType.BIGBLUNT)		
+				chance = Config.CHANCE_BIGBLUNT;			
+			else if(item.getItem().getItemType() == L2WeaponType.FIST)		
+				chance = Config.CHANCE_FIST;
+			maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;			
+		}
+		else if (item.getItem().getType2() == L2Item.TYPE2_WEAPON && !Config.CHANCE_BY_WEAPON_TYPE)
+				{
+			        chance = Config.ENCHANT_CHANCE_WEAPON;
+					maxEnchantLevel = Config.ENCHANT_MAX_WEAPON;
+				}
+		
         else if (item.getItem().getType2() == L2Item.TYPE2_SHIELD_ARMOR)
         {
	        chance = Config.ENCHANT_CHANCE_ARMOR;

its a bit better version, copy my code to your first post.

 

if i modyfie that and instead of type make it tier also a tier table in weapons.sql will it work?

yes

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...