Jump to content

Recommended Posts

Posted

first you need some program to work with java.

you need:

 

java jdk: http://java.sun.com/javase/downloads/index.jsp

eclipse: http://www.maxcheaters.com/forum/index.php?topic=22102.0 (Guide how to install it and set it up)

maven: http://maven.apache.org/download.html

 

install them.(for easier use copy maven to c:/maven folder)

 

When you finish open the eclipse and start to work:)

Its really simple server maker teams have their own SVN repository thats the url where you download their DP.

Go to window->show window->others...->SVN->SVN repository now a window appear in eclipse.

right click in the window go to new->repository location

in the popup window you need to enter the svn link.The SVN links are:

 

l2jfree: svn://www.l2jfree.com/repo/l2j-free

L2j: http://www.l2jserver.com/svn/ (core svn) http://www.l2jdp.com/svn/ (DP svn)

L2emu: http://svn.assembla.com/svn/L2Emu/

 

I use l2jfree server pack so the guide based on l2jfree!

Now when you press ok you see the server pack in the SVN window.

The newest pack is in the trunk folder.We want the core and datapack right click on it and checkout.

Now its downloaded you see the downloaded pack in the package explorer window.

 

ABOUT COMPILING

Datapack:Really simple right click on Build.xml->Run as->1 Ant build.

Core:l2jfree use maven so you need to compile it with maven.(Other pack use Build.xml to core too)

Compile l2jfree core:

before you compile you need to do 2 things.

1st open control panel->system->special->variables

You need to add new system variable for java jdk.Add these lines to user and system variables.

Variable name:JAVA_HOME

Varible path:C:\Program Files\Java\jdk1.6.0_11

Now restart your PC.

Open maven\bin\mvn.bat with notepad go to line 157 and write this:

old one:%MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR%

new one:%MAVEN_JAVA_EXE% %MAVEN_OPTS% "-Xmx1024m" -classpath %CLASSWORLDS_JAR%

Now compile the core:

open a command line(start->run->cmd)

go to your core folder(for example the core is c:\workspace\l2jfree-core)

type cd C:\

type cd workspace

type cd l2jfree-core

Now you need to compile:

type C:\maven\bin\mvn clean:clean

thats delete the excisting compile(Target folder)if you have.

type C:\maven\bin\mvn assembly:assembly -Dmaven.test.skip=true

thats build your core and place it to l2jfree-core\target folder.

HOW TO MAKE JAVA MODIFICATIONS:

VOICED COMMAND:

You have the voiced commands in the com.l2jfree.gameserver.handler.voicedcommand folder

Voiced commands ingame starts with . for example .info

Insert the Info.java for example to voiced commands folder thats the first step.

After that you need to register it.

Open voicedcommandhandler.java

Search for the private VoiceCommandHandler() section there you can register your command

To register the .info command for example type this under the last registered command.

registerVoicedCommandHandler(new info());

Compile your core and you are done.

ITEM HANDLERS:

You have the item handlers in the com.l2jfree.gameserver.handler.itemhandler folder

The itemhandlers ingame works like for example you click on it and it summon your pet.

Same like the voiced commands just insert the java file into the itemhandler folder.

Registering in itemhandler.java

Go to private ItemHandler() section

and register your command under the last command like

registerItemHandler(new example());

Compile your core and you are done.

 

REGISTER NEW SQL COLUMN IN A TABLE AT JAVA:

open the L2PCinstance.java (com.l2jfree.gameserver.model.actor.instance)

to register it you need 2 easy step.

1st you see SQL string definitions named with the name of sql table.

For example look at // Character Character SQL String Definitions:

Lets an example you have a patch for vitality system but you need to register a new column at character table.

You see update and restore you need to insert your colums name into these two line like this:

trust_level=? WHERE charId=?"; thats the end of the update line if you want to insert a new one(example vitality)write this.

trust_level=?, vitality=? WHERE charId=?";

Now look at the restore line

trust_level FROM characters WHERE charId=?"; thats the end of the line to insert vitality column write this.

trust_level,vitality FROM characters WHERE charId=?";

Now thats ok you need to set a statement.

Search for the private void storeCharBase() section at L2PCinstance

you find statement's here go to statement.setInt(52, getObjectId());

Thats the end of it its gat the characters objectid(at which character the tables effect applyes)

Now insert vitality here.Insert above statement.setInt(52, getObjectId()); this:

statement.setInt(52, getvitality()); and rename the statement.setInt(52, getObjectId()); to statement.setInt(53, getObjectId());

compile your core and your done.

 

HOW TO MAKE CONFIG OPTIONS:

You can make config options for everything what you want i show you a simple.

You want to create config Option for a voiced command.

Go to voicedcommandhandler.java where you register the command.

Use this syntax for registering with config option:

		if (Config.ALLOW_EXAMPLE)
	{
		registerVoicedCommandHandler(new yourcommand());

	}

Thats the first step now open the Config.java (com.l2jfree)

You want to register it for example at other.properties.

Search for other.properties the section is ending with this line:

// *******************************************************************************************

// *******************************************************************************************

Above that search for the latest option press enter at the and of the line now you have a new line

For a false/true config you need to use public static boolean so to register the example use this:

public static boolean ALLOW_EXAMPLE;

Now search for public static void loadOtherConfig() (thats load the configuration of the other.properties)

Search for catch (Exception e) above that you see config options in other syntax.

Search for the latest option and press enter.In the new line register the config like this:

ALLOW_EXAMPLE = Integer.parseBoolean(otherSettings.getProperty("Example.properties", "default value false or true"));

Now thats ok lets write the config.

Open the properties file(Other in my example)

go to the end of it and press enter.

Example = false or true

If you want to write about the config option make it like this

# -----------

# Allow example

# -----------

Example = false or true

 

HOW TO CREATE/APPLY DIFF PATCH:

apply diff patch:

right click on the core->team->apply patch than select your destination.

if you get error for a diff dont apply it open it with notepad and with search function add it to the right place.

make diff patch:

right click on the edited file->team->create patch here you can choose copy to clipboard and then paste or save it to a file.

 

Credits to ALEX2008GR for the eclipse guide!And for me to that guide!

 

[move]When i have time i try to keep it updated whit other java basics :)[/move]

Posted

updated create and apply diff patches.

 

nice Guide..

 

+1 for that...

 

keep sharing ;)

 

Thanks for karma:)

 

Br0 this is awesome ... ;D i love you  :P also i'm w8ting for the photo :)

 

Keep up m8 !!!!

 

Edit:It will be added at my collection  :)

 

As i said on msn my vista has its own life when he dont want photos i dont make photos:D

Posted

lol 1st time from july (when i register)i see this post...

interpid It's very helpfull omG!

I try to do my best:)

Also i have some very good project i'm working on i think if its ready i share it(like automated 1v1 event engine and others)

Posted

I try to do my best:)

Also i have some very good project i'm working on i think if its ready i share it(like automated 1v1 event engine and others)

hmmm...

at school my pc proffesor say me that many codes of java

want open/close what i mean?

e.g. at html u cant make two path about left/right align

you must open

<div align="left">text

and then close

</div>

and the the right align

the java has this?

and if it easy give via pm your msn :P

Posted

In java it's { }

 

public void NameOfMethidHere()
{
      Code goes here
}

and if u make it at code? like

{ code goes here }

any difference?

Posted

No difference, it's about what you like, but it's easier the way I do it, especially if you have more lines within the { }

i know that..

at html all code i make to another line from text...

it's easily to understand when is the error if u have...

anyway thnx!

 

dont tell me nQQb :D

i'm at first steps with java :D

and if u want to know my age?

you laugh :P

i'm 14 years old...

4 feb i'll become 15

 

  • 2 weeks later...

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...