Chapter 4: Learning L2JMobius – importing L2JMobius source code

L2JMobius is a set of open source LineageII server-side code written in Java language. We can go to his official website to download (sometimes inaccessible), or we can download through our network disk:

https://pan.baidu.com/s/1XdlcCFPvXnzfwFoVK7Sn7Q?pwd=avd4

In the network disk, we only need to download "L2J_Mobius_C6_Interlude.zip". After unzipping, it looks like this

There are two important folders here, java is the source code directory, and dist is the data directory, which is what we need.

In the previous chapter, we have created a "L2J_Mobius" Java project. Next, we will copy the Java directory source code in "L2J_Mobius_C6_Interlude" to the src directory in our project.

We need to copy the entire "org" directory to the src directory in our project. This operation is performed in the file directory, just use the Ctrl+C and Ctrl+V commands, not in eclipse. Then right-click the project name in eclipse, select "Refresh" to refresh the menu, and you can see the code in the project panel. The default is the collapsed state, and we can see it by clicking Open.

There are a lot of codes inside, under normal circumstances, we still click the small triangle in front of the src directory to collapse it.

Next, copy all the files under L2J_Mobius_C6_Interlude\dist\game to the root directory of our project, and then continue to copy all the files under 2J_Mobius_C6_Interlude\dist\login to the root directory of our project. This is the configuration and data files required by the code. This operation is performed in the file directory, just use the Ctrl+C and Ctrl+V commands, not in eclipse. It ends up looking like this:

Then right-click the project name in eclipse, select "Refresh" to refresh the menu, and you can see it in the project panel.

This is what our project will look like in the end. Next, we need to modify the database link configuration file. Modify the config/LoginServer.ini configuration file and Server.ini configuration file under our project. Both modifications are the same, as follows

# ---------------------------------------------------------------------------
# Database
# ---------------------------------------------------------------------------

# Specify the appropriate driver and url for the database you're using.
# Default: org.mariadb.jdbc.Driver
Driver = org.mariadb.jdbc.Driver

# Database URL
# Default: jdbc:mariadb://localhost/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false
URL = jdbc:mariadb://localhost/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false

# Database user info (default is "root" but it's not recommended)
Login = root

# Database connection password
Password = 

# Default: 100
MaximumDbConnections = 100

What we want to modify is the URL and Password. If we did not modify port 3306 when we installed the mariadb database, the URL does not need to be modified. However, we changed it to 3307, so a change is needed here.

URL = jdbc:mariadb://localhost:3307/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false

We just add ":3307" after localhost, isn't it very simple?

Then add our password. When we installed mariadb, we set the root password to 123456.

Password = 123456

Next, let's run our project. For a Java project, the essence of the operation is the Java class with the entry main method. They are \src\org\l2jmobius\gameserver\GameServer.java and \src\org\l2jmobius\loginserver\LoginServer.java respectively. One of them is a game service and the other is a login service. Running them is very simple, we find these two classes in the src directory in the Eclipse project panel, and right click on them.

 We right-click "GameServer.java", select "Run AS" -> "Java Application", and a window will pop up after running successfully

 Then, we continue to right-click "LoginServer.java", select "Run AS" -> "Java Application",

In this way, both services are started.

Next, go to our network disk to download the client. There are LineageII_C6.7z and system.zip in the network disk, unzip the two into the same file directory, then enter the system directory, and double-click "l2.exe" to start the file.

If the download speed of the network disk is slow, you can enter the plus penguin exchange skirt 874700842, and you can also download all the content in the skirt file. There are 5 small compressed packages in the skirt file, you can decompress them all with the decompression number 001. Then we also enter the system directory, double-click "l2.exe" to start the file. After starting, just log in directly, and the default login is registration.

Since this is an English version, a lot of content is displayed in English, and I will add a Chinese version later.

Guess you like

Origin blog.csdn.net/konkon2012/article/details/131570246