EdenEternal Posted July 14, 2012 Posted July 14, 2012 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!
Napster321 Posted July 30, 2012 Posted July 30, 2012 if i modyfie that and instead of type make it tier also a tier table in weapons.sql will it work?
vampir Posted July 30, 2012 Posted July 30, 2012 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now