Jump to content
metin2dev
Vanilla

[SRC] Vanilla Core [latest: r70220]

Recommended Posts

 

Greetings!

The new beta is finished! I'm proud to present r70140-BETA.
This time a few things have changed. And in this revision, we have a lot of new stuff.
That's the reason I want to make a BETA so everything's tested. In the following I'll provide
the download link along with the things I'd love you to test.

 


*** DISCLAIMER ***
The core is marked as stable. Anyway, I'll make it clear that I'm not responsible if you use this core since I can't give a warranty that I fixed every single security breach that potentially could happen - that's totally impossible. But we all together made the source great and secure so every public issue is fixed by now. You can use it in production environments now. 

 


So... What's new?

  • boot-trigger for quests
    • With this you can execute commands, timers, and all the stuff you'd like to have just on boot-time!
  • revisioning of the 'unique class' (+ a ton of posibilities)
    • added the functionality to create unique-groups
    • temp-Variables for quests
  • upgraded all libs
  • moved completely to the newest clang version
  • fixed some big security issues in the source code
  • fixed the ingame ban and unban commands
  • unified tables and gave them a new way: unify!
  • file clean-up
    • revisioned the makefiles
    • gave the source a new, easier structure
  • removed all external dependencies
    • just install them by ports.. No external-folder necessary!
    • removed 'boost' dependency (no boost lib needed yay)
  • partial implementation of the wolfman (claws etc. are added, needs review)
  • And basically everything that has been offered in the earlier versions of the vanilla core. Nothing should be missing.
    And if you miss something, just feel free to tell me!

 


What needs testing?

There are few things I'd love you to test out:

  1. Please check if the core is vulnerable to any security breaches you may know (also the public ones, don't know if I missed something)
  2. Please test out the new features! I'd really love to know if the new unique-functions and the boot-trigger does the job.

 


Explanation to new features:

  • Unique with container support
    • Unique has evolved! This time you have a few new possibilities. Don't know what unique is? Here's a short explanation:
      With the unique-questfunctions you can spawn or set mobs, npcs and now even players to have a unique name. This name is
      stored into a unique-container. You can access this container and get all the vid's by their unique name (also called: the key)
      So for example you can spawn a boss with a key. Later on you can check if this specific mob has been killed or not. Or you can
      set his hp on-the-fly. There's basically no limits!
    • And now with the revised system you'll have even more options. The new unique system works with containers. By default there are
      two containers reserved: __DEFAULT__ and __CHARACTER__. The first one is for all the basic stuff. And the second one is reserved for players. Now, as you may have noticed, there's a default one which means that the container-stuff is optional. If you just use the unique functions without specifying a container, it'll just use the default stuff. But you CAN use your own containers just
      as you want to. You can create, delete and list all the containers running. There is a list with all the quest-functions down below.

 

  • boot-trigger
    • This is pretty self-explanatory. With this release you can use "when boot begin" to specify a block of code that will be executed
      once the core has been booted.

 

  • temp-variables
    • With the new temp-variables you can set and remove player-specific variables. They are stored in the core and not written
      to disk or database. So be careful because they might get dropped once the core shutdowns. It's just a quick storage for people
      who want to have something like a cache for quick access.

 

  • new quest functions
    • nil unique.spawn_unique(string key, int vnum, string pos=unused, string container=optional)
    • nil unique.set_unique(string key, int vid, string container=optional)
    • nil unique.purge_unique(string key, string container=optional)
    • nil unique.kill_unique(string key, string container=optional)
    • bool unique.is_unique_dead(string key, string container=optional)
    • int unique.get_hp_perc(string key, string container=optional)
    • nil unique.set_def_grade(string key, int def, string container=optional)
    • nil unique.set_hp(string key, int hp, string container=optional)
    • nil unique.set_max_hp(string key, int maxhp, string container=optional)
    • int unique.get_vid(string key, string container=optional)
    • bool unique.exists(string key, string container=optional)
    • table unique.get_container_list()
      • this prints out all the unique containers
    • table unique.get_container_list(string key)
      • this prints out all the vids in the unique-container "key"
    • nil unique.remove_container(string key)
      • removes a whole container (flushes it when called on standard containers)
    • nil pc.temp_var_set(string key, string value)
    • string pc.temp_var_get(string key)
    • nil pc.temp_var_delete(string key)

 


Thanks a lot for participating!
If there are any questions, this is the topic related to it. Further releases will be made public here too!
If you'd like to contribute, just post code additions here.

 


Changelog


Download

Useful information: All necessary libs are included. If you're building your own vanilla binary you'll first have to move into every project of the Internal directory and rebuild the libs. The main makefile is not adapted yet, I was too lazy :P

 

 

Password for the binary archive is: vanilla
Password for the source archive is: vanillamt2


 

Best Regards
Vanilla

  • Like 30

Share this post


Link to post
Share on other sites

This is just a clean source yet, so you don't need to use a modified binary. The 40250 test-client just works fine.

 

Downloadlink:

https://mega.nz/#!xcVjTaDC!sKtebpM471a-rxoICGFK8VJVlE1ohj_-uqTIRnM1RQU

(copied from this post)

Share this post


Link to post
Share on other sites

I won't make a big project for the client. But I will do some few things like python 3.6 and I also will release a guide + source download for those things. But nothing like the core^^

Additionally I'm planning on gathering information for the next version of the core. Please share some feedback if you have and tell me what you'd like to see in the next revision. Few things I can already mention:

- Option to switch compression algorithms. You'll be able to switch from lzo to lz4 and backwards by CONFIG
- Option to switch encryption algorithms. You'll be able to switch from xtea to CAST-128 or AES and vice versa (does only work with enhanced security disabled)
- Option to setup pong and other stuff via CONFIG. Of course some stuff does only work with enhanced security disabled.
- Option to enable/disable custom MySQL-functions for passwords (so you can use e. g. salt for better security)
- Ingame Elevation with a standard passphrase (enabled by default!)

The next release focuses on stability and security. The goal is to add more diversity when it comes to encryptions and hardening your server. With custom passphrases and stuff you'll be able to switch to other implementations easily. Also the custom password functions will further protect the passwords even when an attacker gets insight on the database. Of course the core will also be able to use a custom phrase to further lengthen the password and making it more difficult for attackers to retrieve the original strings.

Let me hear your thoughts :)

 

 

EDIT: Btw. I tried to fix every bug that's been made public. But I'm not 100% sure I got everything. That's why I'm asking you kindly to revise the core and see if there's anything unstable before I brand it as a stable one. That's why It's called a BETA :D

  • Like 5

Share this post


Link to post
Share on other sites

Good idea, I already have used both Lz4 and Snappy for compression and exchange between game and client (such as server_attr & mark), I never changed Xtea though. The idea of switching between both of them is really nice but I think most people will only settle on one.

Pong via CONFIG is great, but what will you change in the clientside ? Otherwise we will need to compile the client too. Sending the pong to the client at each startup would be great, but also easier to sniff, unless you obfuscate it, but it'll also be possible. (Anyway we could also take it with reverse engineering currently so It'll maybe be better)

The elevation is what every server need, it's a nice way to see if you have a traitor in your team too. :P

I'm really excited for the python 3.6 thing otherwise, some SQL securities also took my attention.

By the way, you did an excellent job, well done, this project is dope !

  • Like 1

Share this post


Link to post
Share on other sites

Nice job! I'm really proud that there still are people interested in enhancing the serverfiles ^^

What did make you remove all the boost dependencies in the code? I mean, as boost is cross-platform, you could've ported all the BSD-only parts of the code to their boost counterparts, and then you would've had the possibility of compiling on Linux.

Also, I'm quite interested in those security issues, what do they most consist of? SQL injection vulnerabilities?

Share this post


Link to post
Share on other sites

I did not use the BSD-functions. I use c++ standards. Lots of stuff can be handled via std-lib. Since c++11 there's a lot of new features. For example I replaced the boost::unordered_map with std::unordered_map. This also ensures cross-compatibility since you can build libc also on unix-systems.

Also the security issues were SQL injections most of the time. For example the auth-messenger. But it's not limited to sql injections since there also were a few things not coded correctly with which you'd possibly crash the core. Most of them is already public so nothing too new.

 

@galet

Clientside you can just change the pong like you want to. There's nothing needed, unless you want to change the pong via config files there too (which shouldn't be done). The reason I implement this on the source is for people who just want to change those things on-the-fly and maybe release a updated binary. Or you just want to have the possibilities without messing with the core. It's more simple, the client part should be done too of course but that's not one of those things I'd do. I think I'll write a guide on how to change the encryption, e. g. xtea to AES regarding the client. This way they everyone can implement those things in their own client.

  • Like 4

Share this post


Link to post
Share on other sites

Does anyone have the download FS compatible?

 

Is there a way to compile on FreeBSD < 10?

Share this post


Link to post
Share on other sites

Is there a specific way that clang-devel should be installed? Cause it's installations is causing problems and it is not fullfilled successfully.
Also in the makefile the -std=c++14 returns " error: invalid value 'c++14' " 

OS: Freebsd 9.3 32bit

 

Share this post


Link to post
Share on other sites

clang-devel should be installed just via ports. It should work in FreeBSD < 10.
c++14 needs the newer clang version. If you're on one of the older compilers like gcc 4.2 it most likely won't work. Also you need devel/libc++ and devel/libcxxrt
To build you then only need security/googletest, security/cryptopp, graphics/devil (only jpg needed, all else is not needed), devel/gmake, devel/makedepend and database/mariadb101-client (or any other mysql client for the lib). These are all the dependencies. I've gathered them together into a list. Note that every additional port should be compiled with clang instead of gcc! You cannot use gcc-compiled libs in a clang-project.

 

First install:
- lang/clang-devel (you don't need to use the devel-version of clang, you can just install one of the most recent versions)
- devel/libc++
- devel/libcxxrt
- devel/gmake (should already be installed by one of the ports above)
- devel/makedepend

And then add the following to /etc/make.conf:
CC = clang-devel
CPP = clang-cpp-devel
CXX = clang++-devel
CFLAGS += -stdlib=libc++

After that you can start installing the dependencies:
- security/googletest
- security/cryptopp
- graphics/devil (note: Only jpg needed)
- databases/mariadb101-client (no server needed, only the client. You can also use mysql if you wish to, we only need the client lib)

If everything is installed, make sure you rebuild the Depend-File. For this you can just cd into the source directory and remove it. Then you can just execute the following command:
gmake depend

After that you'll have everything you need. You can build the sources.
gmake debug|release|all
Note that you can either choose to compile debug, release or all. You can also use install if you specified a path in your Makefile. This way the created binary will be pushed into a directory once it's finished.

  • Like 7

Share this post


Link to post
Share on other sites
2 hours ago, Vanilla said:

clang-devel should be installed just via ports. It should work in FreeBSD < 10.
c++14 needs the newer clang version. If you're on one of the older compilers like gcc 4.2 it most likely won't work. Also you need devel/libc++ and devel/libcxxrt
To build you then only need security/googletest, security/cryptopp, graphics/devil (only jpg needed, all else is not needed), devel/gmake, devel/makedepend and database/mariadb101-client (or any other mysql client for the lib). These are all the dependencies. I've gathered them together into a list. Note that every additional port should be compiled with clang instead of gcc! You cannot use gcc-compiled libs in a clang-project.

 

First install:
- lang/clang-devel (you don't need to use the devel-version of clang, you can just install one of the most recent versions)
- devel/libc++
- devel/libcxxrt
- devel/gmake (should already be installed by one of the ports above)
- devel/makedepend

And then add the following to /etc/make.conf:
CC = clang-devel
CPP = clang-cpp-devel
CXX = clang++-devel
CFLAGS += -stdlib=libc++

After that you can start installing the dependencies:
- security/googletest
- security/cryptopp
- graphics/devil (note: Only jpg needed)
- databases/mariadb101-client (no server needed, only the client. You can also use mysql if you wish to, we only need the client lib)

If everything is installed, make sure you rebuild the Depend-File. For this you can just cd into the source directory and remove it. Then you can just execute the following command:
gmake depend

After that you'll have everything you need. You can build the sources.
gmake debug|release|all
Note that you can either choose to compile debug, release or all. You can also use install if you specified a path in your Makefile. This way the created binary will be pushed into a directory once it's finished.

It really is not necessary for you to write so much.

pkg install clang38
pkg install googletest
pkg install cryptopp
pkg install devil
pkg install mariadb100-client
pkg install gmake

All in one..

pkg install clang38 googletest cryptopp devil mariadb101-client gmake

 I think the release version 3.8 of clang is enough

Share this post


Link to post
Share on other sites
Just now, Ikh said:

It really is not necessary for you to write so much.

pkg install clang38
pkg install googletest
pkg install cryptopp
pkg install devil
pkg install mariadb100-client
pkg install gmake

All in one..

pkg install clang38 googletest cryptopp devil mariadb101-client gmake

No need to write a love letter ..   I think the release version 3.8 of clang is enough

Using the pkg system isn't as effective. It's faster but it's not better. You'd compile the ports on your machine. I for myself experienced a lot of trouble especially when installing compilers via pkg. Additionally you don't need everything, just like in devil. And you sure know that we use clang and some ports may or may not use it depending on the system you're using? We don't need to link to gcc-prebuilt packages...

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, Vanilla said:

Using the pkg system isn't as effective. It's faster but it's not better. You'd compile the ports on your machine. I for myself experienced a lot of trouble especially when installing compilers via pkg. Additionally you don't need everything, just like in devil. And you sure know that we use clang and some ports may or may not use it depending on the system you're using? We don't need to link to gcc-prebuilt packages...

The difference is that you don't build these, but you also don't get to set options, and it's not guaranteed they will work with packages already on the system. That's why there are other commands like pkg upgrade.  There are some special cases like using -march and -mtune ..  Using march can cause problems , if you use march intro game core or db core and not using intro build ports can make a underfined behavior but that's not the case.

The only reason to use ports inseated of package manager is build options.  The packages is a prebuild port, and don't have flags like mtune and march.    Most likely you did something wrong if you had issues, It happens. I use package since years and it works like a charm..

***Note***

Since you use some modern coding standards consider using stdint.h stuffs also..  It is illegal to add functions in the namespace std , so consider removing that namspace.. xD   stl.h can be removed completly.

***Note***

any_function.h can be replaced with std::function / stable_priority_queue.h can be replaced with  std::priority_queue / thecore_memcpy bulshit can be replaced with std::memcpy  / noncpypable.h is useless it can be deleted /  clean constructors or destructors can be replaced with default or delete.

  • Like 1

Share this post


Link to post
Share on other sites
46 minutes ago, Ikh said:

The difference is that you don't build these, but you also don't get to set options, and it's not guaranteed they will work with packages already on the system. That's why there are other commands like pkg upgrade.  There are some special cases like using -march and -mtune ..  Using march can cause problems , if you use march intro game core or db core and not using intro build ports can make a underfined behavior but that's not the case.

The only reason to use ports inseated of package manager is build options.  The packages is a prebuild port, and don't have flags like mtune and march.    Most likely you did something wrong if you had issues, It happens. I use package since years and it works like a charm..

***Note***

Since you use some modern coding standards consider using stdint.h stuffs also..  It is illegal to add functions in the namespace std , so consider removing that namspace.. xD   stl.h can be removed completly.

***Note***

any_function.h can be replaced with std::function / stable_priority_queue.h can be replaced with  std::priority_queue / thecore_memcpy bulshit can be replaced with std::memcpy  / noncpypable.h is useless it can be deleted /  clean constructors or destructors can be replaced with default or delete.

Yep, the exact points you mentioned are the reasons I'd consider building them myself instead of using pkg. Though I don't blame people for using pkg, I write my guides like I'd do it and that's the way it worked. If that's too long for you, feel free to use pkg. But in Freebsd < 9.4 you might not have much fun with it. You need clang to be the compiler except you wish to change the compiler for your m2 source to gcc. Older FreeBSD versions don't have packages prebuilt with clang.

The project is ongoing and yes, code modernization is a part of the plan. Thanks for your feedback, I'll take that into account when preparing the next versions :)

  • Like 1

Share this post


Link to post
Share on other sites

When i use gmake in game/src, I get: fatal error : 'cryptopp/cryptoppLibLink.h' file not found

#include <cryptopp/cryptoppLibLink.h>

 

sorry, I'm not expert :/

Share this post


Link to post
Share on other sites

Hello,

There's a link above for both sources and compiled game. You can use it without any problem on a clean 40K client (Recommended to test the build because this is a beta). I recommend you to take the last official one (there's a lot of unpacked patches out there, the last one was published by xP3NG3R - thanks !) and compile a clean launcher.

You can also merge the game with your own sources and take what you want. As for me I'll come back here with feedbacks in a couple of days or more about the triggers & the brand new questfunctions.

Thanks again Vanilla !

PS : 1,200 Posts

  • Like 1

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×