Jump to content
  • 0

[request] Detailed, how to adopt mods for java!


Question

Posted

Hello guys!

 

I having difficulties on adopting mods for java, like tracing lines where to add some script, and I don't know what are some symbols means!

example:

@@ -0,0 +1,65 @@

and what is the significance of the "+" in the java codes that are provided and shared here!

 

I hope you will enlighten my mind!

 

thanks!

 

 

6 answers to this question

Recommended Posts

  • 0
Posted

yhe "+" significate you need to add the line 'without' the + in the file..

 

exemple

 

It's is an exmple

Of what you will doing

For make a

java mod

For make a

java mod

+ Good luck

 

So the file will be

It's is an exmple

Of what you will doing

For make a

java mod

Good luck

  • 0
Posted

Let's take for an example this share => http://www.maxcheaters.com/forum/index.php?topic=183542.0

 

 

Index: /Freya/java/l2j/gameserver/model/actor/instance/L2PcInstance.java

===================================================================

--- /Freya/java/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 381)

+++ /Freya/java/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 394)

@@ -8755,4 +8755,5 @@

case TARGET_SELF:

case TARGET_AREA_SUMMON:

+ case TARGET_SELF_AND_PET:

target = this;

break;

@@ -9020,4 +9021,5 @@

case TARGET_AREA_CORPSE_MOB:

case TARGET_GROUND:

+ case TARGET_SELF_AND_PET:

break;

default:

Index: /Freya/java/l2j/gameserver/model/actor/L2Character.java

===================================================================

--- /Freya/java/l2j/gameserver/model/actor/L2Character.java (revision 381)

+++ /Freya/java/l2j/gameserver/model/actor/L2Character.java (revision 394)

@@ -1546,4 +1546,5 @@

case TARGET_PARTY_CLAN:

case TARGET_ALLY:

+ case TARGET_SELF_AND_PET:

doit = true;

default:

Index: /Freya/java/l2j/gameserver/model/L2Skill.java

===================================================================

--- /Freya/java/l2j/gameserver/model/L2Skill.java (revision 381)

+++ /Freya/java/l2j/gameserver/model/L2Skill.java (revision 394)

@@ -75,4 +75,5 @@

TARGET_NONE,

TARGET_SELF,

+ TARGET_SELF_AND_PET,

TARGET_ONE,

TARGET_PARTY,

@@ -1349,4 +1350,17 @@

{

return new L2Character[] {activeChar};

+ }

+ case TARGET_SELF_AND_PET:

+ {

+ if (activeChar instanceof L2PcInstance)

+ {

+ final int radius = getSkillRadius();

+ if(!activeChar.isDead())

+ targetList.add(activeChar);

+ if (addSummon(activeChar, (L2PcInstance)activeChar, radius, false))

+ targetList.add(activeChar.getPet());

+ return targetList.toArray(new L2Character[targetList.size()]);

+ }

+ return _emptyTargetList;

}

case TARGET_HOLY:

 

Index: /Freya/java/l2j/gameserver/model/actor/instance/L2PcInstance.java

===================================================================

--- /Freya/java/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 381)

+++ /Freya/java/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 394)

 

This means that the file you must go to is located in l2j/gameserver/model/actor/instance/ and the file is L2PcInstance.java

 

--- /Freya/java/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 381)

+++ /Freya/java/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 394)

 

These lines will be different if in the last revision it was moved (if you are looking at l2jserver's timeline for example)

In 99% of times, they are the same.

 

@@ -8755,4 +8755,5 @@

case TARGET_SELF:

case TARGET_AREA_SUMMON:

+ case TARGET_SELF_AND_PET:

target = this;

break;

@@ -9020,4 +9021,5 @@

case TARGET_AREA_CORPSE_MOB:

case TARGET_GROUND:

+ case TARGET_SELF_AND_PET:

break;

default:

 

@@ -8755,4 +8755,5 @@

 

This means that in the mentioned above revision (revision 394) the line that the code is, is 8755.

 

case TARGET_SELF:

case TARGET_AREA_SUMMON:

+ case TARGET_SELF_AND_PET:

target = this;

break;

 

The line with the "+" is the line you must add, and the other ones are here so you can orient, where exactly you should put the code.

 

So, what I do is not to search for the line (8755). When you look the code there is "case TARGET_SELF_AND_PET", which you should add and "case TARGET_SELF" which should be already there. I copy the line "case TARGET_SELF", than I go to Eclipse and click "Ctrl + F" and paste the line. I click find and horay, you're in the correct line.  :D

 

@@ -9020,4 +9021,5 @@

case TARGET_AREA_CORPSE_MOB:

case TARGET_GROUND:

+ case TARGET_SELF_AND_PET:

break;

default:

 

This part of the patch, tells you that you must go to 9020 line, and add "case TARGET_SELF_AND_PET" after "case TARGET_GROUND". I choose one of the case's above and I copy it, paste in Eclipse and it will find the line. You make 1 new line after "case TARGET_GROUND" and add "case TARGET_SELF_AND_PET"

 

 

Index: /Freya/java/l2j/gameserver/model/actor/L2Character.java

===================================================================

--- /Freya/java/l2j/gameserver/model/actor/L2Character.java (revision 381)

+++ /Freya/java/l2j/gameserver/model/actor/L2Character.java (revision 394)

@@ -1546,4 +1546,5 @@

case TARGET_PARTY_CLAN:

case TARGET_ALLY:

+ case TARGET_SELF_AND_PET:

doit = true;

default:

 

This means that you should go to => l2j/gameserver/model/actor and open the file L2Character.java

 

Now you must find the line "case TARGET_ALLY:" or "case TARGET_PARTY_CLAN:" and add after "case TARGET_ALLY:" the new line which is "case TARGET_SELF_AND_PET:"

 

 

Index: /Freya/java/l2j/gameserver/model/L2Skill.java

===================================================================

--- /Freya/java/l2j/gameserver/model/L2Skill.java (revision 381)

+++ /Freya/java/l2j/gameserver/model/L2Skill.java (revision 394)

@@ -75,4 +75,5 @@

TARGET_NONE,

TARGET_SELF,

+ TARGET_SELF_AND_PET,

TARGET_ONE,

TARGET_PARTY,

@@ -1349,4 +1350,17 @@

{

return new L2Character[] {activeChar};

+ }

+ case TARGET_SELF_AND_PET:

+ {

+ if (activeChar instanceof L2PcInstance)

+ {

+ final int radius = getSkillRadius();

+ if(!activeChar.isDead())

+ targetList.add(activeChar);

+ if (addSummon(activeChar, (L2PcInstance)activeChar, radius, false))

+ targetList.add(activeChar.getPet());

+ return targetList.toArray(new L2Character[targetList.size()]);

+ }

+ return _emptyTargetList;

}

case TARGET_HOLY:

 

Now you must go to l2j/gameserver/model/ and open the file L2Skill.java

 

@@ -75,4 +75,5 @@

TARGET_NONE,

TARGET_SELF,

+ TARGET_SELF_AND_PET,

TARGET_ONE,

TARGET_PARTY,

 

Now find one of the lines that are below or above TARGET_SELF_AND_PET (I usually find the line above) and add the new line.

 

 

@@ -1349,4 +1350,17 @@

{

return new L2Character[] {activeChar};

+ }

+ case TARGET_SELF_AND_PET:

+ {

+ if (activeChar instanceof L2PcInstance)

+ {

+ final int radius = getSkillRadius();

+ if(!activeChar.isDead())

+ targetList.add(activeChar);

+ if (addSummon(activeChar, (L2PcInstance)activeChar, radius, false))

+ targetList.add(activeChar.getPet());

+ return targetList.toArray(new L2Character[targetList.size()]);

+ }

+ return _emptyTargetList;

}

case TARGET_HOLY:

 

Now here, you can find "return new L2Character[] {activeChar};" and add all these new lines

 

+ }

+ case TARGET_SELF_AND_PET:

+ {

+ if (activeChar instanceof L2PcInstance)

+ {

+ final int radius = getSkillRadius();

+ if(!activeChar.isDead())

+ targetList.add(activeChar);

+ if (addSummon(activeChar, (L2PcInstance)activeChar, radius, false))

+ targetList.add(activeChar.getPet());

+ return targetList.toArray(new L2Character[targetList.size()]);

+ }

+ return _emptyTargetList;

 

 

 

 

 

 

TIPS (READ THIS):

 

Always when searching a line (with a part of code..) go to the first line in the file and when you click find button, see if you click it again it won't find another time this line. If it finds another time the line, you must try with other line that is in the Patch and it ISN'T with "+"

 

 

When you add the code, probably you will get on all a red underline. Which means you must delete the "+" for example:

 

This:

 

+ }

+ case TARGET_SELF_AND_PET:

+ {

+ if (activeChar instanceof L2PcInstance)

+ {

+ final int radius = getSkillRadius();

+ if(!activeChar.isDead())

+ targetList.add(activeChar);

+ if (addSummon(activeChar, (L2PcInstance)activeChar, radius, false))

+ targetList.add(activeChar.getPet());

+ return targetList.toArray(new L2Character[targetList.size()]);

+ }

+ return _emptyTargetList;

 

In your server's core must look like this:

 

 

}

case TARGET_SELF_AND_PET:

{

if (activeChar instanceof L2PcInstance)

{

final int radius = getSkillRadius();

if(!activeChar.isDead())

targetList.add(activeChar);

if (addSummon(activeChar, (L2PcInstance)activeChar, radius, false))

targetList.add(activeChar.getPet());

return targetList.toArray(new L2Character[targetList.size()]);

}

return _emptyTargetList;

 

Without the pluses (+).

 

 

If you have minus (-) on a line, you must find it and remove this line.

 

If you can't find the you are looking for, there are some lines that in your server's core are written in 2 or 3 lines, but on the patch there is only 1. Try to copy the half of the line, and see if you will be able to find it. For example:

 

This code:

if (mainTarget == null || !(mainTarget instanceof L2Character))

return;

 

can be written like this too:

 

if (mainTarget == null ||

                            !(mainTarget instanceof L2Character))

return;

 

or this way:

 

if (mainTarget == null || !(mainTarget instanceof L2Character)) return;

 

or this way:

 

if (mainTarget == null ||

                            !(mainTarget instanceof L2Character)) return;

 

or this way:

 

if

                        (mainTarget == null || !(mainTarget instanceof L2Character))

return;

 

There are maybe 20 ways to write this code.

 

So try to search for example this part of the code:

 

(mainTarget == null

 

Now you must find it, but you must look the other part of the code if it's the same, because there can be only 1 time written this part of a code, and it can be written 20 times.

 

 

 

I hope you'll understand me, because I'm writing it real quick.  :)

 

 

 

Guest
This topic is now closed to further replies.


×
×
  • Create New...