[SOLVED] How to set enchant to +6 when they are +20

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

[SOLVED] How to set enchant to +6 when they are +20

Post by HappyLDE »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision 6377:
L2JDP Revision 10159:

Hello,

I'm using one of the unstable revisions (just before all NPCs moved to xml!) :lol:

The question: I want to set internally the items to be as +6 even if they are +20 or even +100 so that skills don't get unbalanced. In what direction to go and can we do this by changing only one core file.

Like the file that is reading the enchant level of an item and set it? What file it is?

Thank you :twisted:
Last edited by HappyLDE on Sat Mar 22, 2014 9:26 am, edited 1 time in total.
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
User avatar
UnAfraid
L2j Veteran
L2j Veteran
Posts: 4199
Joined: Mon Jul 23, 2007 4:25 pm
Location: Bulgaria
Contact:

Re: How to set enchant to +6 when they are +20

Post by UnAfraid »

check L2ItemInstance there is a config for olympiad max enchant level use it as example.
Image
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

Re: How to set enchant to +6 when they are +20

Post by HappyLDE »

Thank you! In L2ItemInstance i changed the getEnchantLevel() function. In the insertIntoDb, restoreFromDb and updateInDb functions i used _enchantLevel instead of getEnchantLevel().

So items from +1 to +25 are calculated into +1 to +8

Code: Select all

public int getEnchantLevel()    {        // Any items enchanted higher than 25 (eg GM weapons) return the true enchantment        if (_enchantLevel > 25)        {            return _enchantLevel;        }                float percentEnchant25 = (_enchantLevel * 100) / 25;                // Bring +1 to +25 items to +1 to +8        // 8 / 100 = 0.08        int newEnchantValue = (int) (0.08 * percentEnchant25);                return newEnchantValue;    }
Edit: Well that doesn't seem to get the wanted result. If i enchant to +25 i get the item as +8... but i want it to be +25 and it's power as +8 :s
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
User avatar
Zoey76
L2j Inner Circle
L2j Inner Circle
Posts: 7008
Joined: Tue Aug 11, 2009 3:36 am

Re: How to set enchant to +6 when they are +20

Post by Zoey76 »

Of course it wouldn't work as you wish because that is the value returned to send to the clients to display "enchant glow".

Go to L2ItemInstace#getEnchantLevel() and right click it and select "Open Call Hierarchy" and it will bring up a window with about 35 calls, ignore all that related to system messages and packets (like trade and user info) follow those that go into the part of code related to HP and attack calculations and you could call getNerfedEnchantLevel() method that is your method and have your own formula. :lol:
Powered by Eclipse 4.34 🌌 | Eclipse Temurin 21 ☕ | MariaDB 11.3.2 🗃️ | L2J Server 2.6.3.0 - High Five 🚀

🔗 Join our Discord! 🎮💬
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

Re: How to set enchant to +6 when they are +20

Post by HappyLDE »

Right so i restored getEnchantLevel() to original and added getNerfedEnchantLevel() with the formula.

I only added the getNerfedEnchantLevel() to 2 files:

Code: Select all

-L2ItemInstance#getOlyEnchantLevel()             @Override-FuncEnchant#calc
And now it works! Since getNerfedEnchantLevel() return +8 if item is +25 and +26 if item is +26 the difference in damage, patk, pdef, skill and hp is huge as if applies correctly. And visually it looks +25 even if power +8 now.

Thank you! :twisted:
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
JMD
Advanced User
Advanced User
Posts: 1440
Joined: Wed Apr 15, 2009 10:07 am

Re: How to set enchant to +6 when they are +20

Post by JMD »

HappyLDE wrote:Right so i restored getEnchantLevel() to original and added getNerfedEnchantLevel() with the formula.

I only added the getNerfedEnchantLevel() to 2 files:

Code: Select all

-L2ItemInstance#getOlyEnchantLevel()             @Override-FuncEnchant#calc
And now it works! Since getNerfedEnchantLevel() return +8 if item is +25 and +26 if item is +26 the difference in damage, patk, pdef, skill and hp is huge as if applies correctly. And visually it looks +25 even if power +8 now.

Thank you! :twisted:
Can you share a patch for this?
User avatar
HappyLDE
Posts: 123
Joined: Tue Sep 10, 2013 6:22 pm
Location: Belgium
Contact:

Re: [SOLVED] How to set enchant to +6 when they are +20

Post by HappyLDE »

Sure:

Code: Select all

### Eclipse Workspace Patch 1.0#P L2J_Server_BETAIndex: java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java===================================================================--- java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java  (revision 6377)+++ java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java  (working copy)@@ -886,6 +886,23 @@        return _enchantLevel;    }    +   public int getNerfedEnchantLevel()+   {+       // Any items enchanted higher than 25 (eg GM weapons) return the true enchantment+       if (_enchantLevel > 25)+       {+           return _enchantLevel;+       }+       +       float percentEnchant25 = (_enchantLevel * 100) / 25;+       +       // Bring +1 - +25 items to +1 - +8+       // 8 / 100 = 0.08+       int newEnchantValue = (int) (0.08 * percentEnchant25);+       +       return newEnchantValue;+   }+       /**     * @param enchantLevel the enchant value to set     */@@ -1648,7 +1665,7 @@            ps.setLong(2, getCount());            ps.setString(3, _loc.name());            ps.setInt(4, _locData);-           ps.setInt(5, getEnchantLevel());+           ps.setInt(5, _enchantLevel);            ps.setInt(6, getCustomType1());            ps.setInt(7, getCustomType2());            ps.setInt(8, getMana());@@ -1684,7 +1701,7 @@            ps.setLong(3, getCount());            ps.setString(4, _loc.name());            ps.setInt(5, _locData);-           ps.setInt(6, getEnchantLevel());+           ps.setInt(6, _enchantLevel);            ps.setInt(7, getObjectId());            ps.setInt(8, _type1);            ps.setInt(9, _type2);@@ -2030,7 +2047,7 @@    public int getOlyEnchantLevel()    {        L2PcInstance player = getActingPlayer();-       int enchant = getEnchantLevel();+       int enchant = getNerfedEnchantLevel();                if (player == null)        { Index: java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchant.java===================================================================--- java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchant.java   (revision 6377)+++ java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchant.java   (working copy)@@ -42,7 +42,7 @@        }        L2ItemInstance item = (L2ItemInstance) funcOwner;        -       int enchant = item.getEnchantLevel();+       int enchant = item.getNerfedEnchantLevel();                if (enchant <= 0)        { 
Thank you for making L2JServer happen! :D
"If you believe you will fail or succeed, in both ways you are right." - Henry Ford
JMD
Advanced User
Advanced User
Posts: 1440
Joined: Wed Apr 15, 2009 10:07 am

Re: [SOLVED] How to set enchant to +6 when they are +20

Post by JMD »

HappyLDE wrote:Sure:

Code: Select all

### Eclipse Workspace Patch 1.0#P L2J_Server_BETAIndex: java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java===================================================================--- java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java  (revision 6377)+++ java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java  (working copy)@@ -886,6 +886,23 @@        return _enchantLevel;    }    +   public int getNerfedEnchantLevel()+   {+       // Any items enchanted higher than 25 (eg GM weapons) return the true enchantment+       if (_enchantLevel > 25)+       {+           return _enchantLevel;+       }+       +       float percentEnchant25 = (_enchantLevel * 100) / 25;+       +       // Bring +1 - +25 items to +1 - +8+       // 8 / 100 = 0.08+       int newEnchantValue = (int) (0.08 * percentEnchant25);+       +       return newEnchantValue;+   }+       /**     * @param enchantLevel the enchant value to set     */@@ -1648,7 +1665,7 @@            ps.setLong(2, getCount());            ps.setString(3, _loc.name());            ps.setInt(4, _locData);-           ps.setInt(5, getEnchantLevel());+           ps.setInt(5, _enchantLevel);            ps.setInt(6, getCustomType1());            ps.setInt(7, getCustomType2());            ps.setInt(8, getMana());@@ -1684,7 +1701,7 @@            ps.setLong(3, getCount());            ps.setString(4, _loc.name());            ps.setInt(5, _locData);-           ps.setInt(6, getEnchantLevel());+           ps.setInt(6, _enchantLevel);            ps.setInt(7, getObjectId());            ps.setInt(8, _type1);            ps.setInt(9, _type2);@@ -2030,7 +2047,7 @@    public int getOlyEnchantLevel()    {        L2PcInstance player = getActingPlayer();-       int enchant = getEnchantLevel();+       int enchant = getNerfedEnchantLevel();                if (player == null)        { Index: java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchant.java===================================================================--- java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchant.java   (revision 6377)+++ java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchant.java   (working copy)@@ -42,7 +42,7 @@        }        L2ItemInstance item = (L2ItemInstance) funcOwner;        -       int enchant = item.getEnchantLevel();+       int enchant = item.getNerfedEnchantLevel();                if (enchant <= 0)        { 
Thank you.
Post Reply