Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Project 'Habbo Shockwave Revival' - V5/V18 - Java - From Scratch - Encryption

Status
Not open for further replies.
Custom Title Activated
Loyal Member
Joined
Oct 26, 2012
Messages
2,357
Reaction score
1,086
Hello guys. This is a big update from this project, since I've been pretty busy. This is a v5 and v18 emulator if you didn't know :) It is completely written from scratch in Java, using IntelliJ as IDE and Maven to load dependencies for external libraries like BoneCP, MySQL driver, Netty and more.

Why Java?
Since Java is a great language and it's multi-platform without you having to install mono (which for nooby users is a pain in the butt...) when you want to use this on Linux. Also, it's because I did most of my projects (also non-habbo projects) in C#, I wanted to switch sides one time and to go with Java.

Why shockwave?
I loved the shockwave times. They were great! You just logged in and made fun in the hotel. No crappy things like: you need to get friends in order to trade and all that kind of stuff. The old times were better and much more fun!

Why IntelliJ?
People recommended it, and it's better than Netbeans/Eclipse to be honest.

Why Maven?
Since you can easy add new dependencies for your project. Say you want Netty, you search for the XML code and paste it into pom.xml, and that's all! No .jar downloading and adding to your project and make sure it's in the same folder to always have it. Maven makes it so easy ;-)

I will rewrite the project, but only the core side. I won't rewrite any functions I had before. New snippets + screens are coming soon, but just to show you SOMETHING, let me show you the pom.xml file as example of Maven.

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>LunaEmu</groupId>
    <artifactId>LunaEmu</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>com.jolbox</groupId>
            <artifactId>bonecp</artifactId>
            <version>0.8.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.4</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.18</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
        </dependency>
    </dependencies>


</project>

Sorry about the lack of progress. I've been pretty busy in real life...
 
Last edited:
Custom Title Activated
Loyal Member
Joined
Oct 26, 2012
Messages
2,357
Reaction score
1,086
Indigo was pretty feature complete.

Also, why are you not using Netty or even NIO?

v5 has annoying things like the MacInTosh check which also changes packets which is actually read right after you login, haven't really tried on changing it though. Will do that probably do that either today or Wednesday (tomorrow I have no time since I'm taking driver lesson and I have theory lesson in the evening)

I might concider using Netty. At least for now, I'll just test things out on these sockets until I try to use Netty (I would use Netty since I'm more used to it).

Offtopic:

Since when are you a moderator?
 
Custom Title Activated
Loyal Member
Joined
May 23, 2011
Messages
1,607
Reaction score
589
v5 has annoying things like the MacInTosh check which also changes packets which is actually read right after you login, haven't really tried on changing it though. Will do that probably do that either today or Wednesday (tomorrow I have no time since I'm taking driver lesson and I have theory lesson in the evening)

I might concider using Netty. At least for now, I'll just test things out on these sockets until I try to use Netty (I would use Netty since I'm more used to it).

Offtopic:

Since when are you a moderator?
Have you looked into blunk?
--
I became a mod a few days ago. :p
 

AWA

Master Summoner
Loyal Member
Joined
Feb 24, 2008
Messages
595
Reaction score
389
I don't know if you intended or not, but V17 is the last "oldskool" version, not V18. (Although it seems like everyone here seem to think so)
The new clothes and the new website came with V18.
Source:
 
Custom Title Activated
Loyal Member
Joined
Oct 26, 2012
Messages
2,357
Reaction score
1,086
I don't know if you intended or not, but V17 is the last "oldskool" version, not V18. (Although it seems like everyone here seem to think so)
The new clothes and the new website came with V18.
Source:

I didn't know AWA, I always thought V18 belonged to oldskool. If you say V18 isn't oldskool, so be it, I'll go over to an older -V1X range (V14 for example), depends on which one I feel like to do.

Yesterday had zero time to work on Timer and this evening I'll try to finish my packet manager and the server/client message classes. I delay the Netty for this weekend since I also have other things to do. Don't worry, I think I'll have Netty working this weekend.

I'm not being sarcastic.

Then, no code is really from scratch until you write in binary or assembly. You always use pre-made code.

PHP:
Console.WriteLine("hi");

You use pre-made code by Microsoft. Then you should really program in binary/assembly to have everything from scratch. Even the 'printf' function in C is pre-made by D. Ritchie, so it's basically not from scratch ;)
 
Custom Title Activated
Loyal Member
Joined
Oct 26, 2012
Messages
2,357
Reaction score
1,086
I'm home from school now, I will do some things this evening (yes, yesterday I said the same but well, did SOME stuff).

Please note all codes can be temporarily, and thus can be changed.

PHP:
package timer.messages;

/**
 * The class used to send messages from the server to the client.
 * @author Joshua
 */
public class ServerMessage {

    private final StringBuilder buffer;

    public ServerMessage() {
        buffer = new StringBuilder();
    }

    public ServerMessage(String header) {
        buffer = new StringBuilder(header);
    }

    public void addCharacter(char character) {
        buffer.append(character);
    }

    public void addString(String text) {
        buffer.append(text);
    }
    
    public void addInteger(int number) {
        buffer.append(Integer.toString(number));
    }
    
        [USER=2000004426]Override[/USER]
    public String toString() {
        return buffer.toString();
    }

}

(I will use the ChannelBuffer from Netty when I'll use that)

Edit:

Please fix the MENTION poop in the PHP bbcode

----------------------------

Edit 2:

There are a few things done:

- Session class
- Client and servermessage class
- 'Fix' for MacInTosh (just one thing to do)
- MessageHandler class

Can't figure out why the client sends the 'MESSENGER_SENDUPDATE' packet without even being logged in...

Bugs:

- Heap space error when closing connection, 'fixed' with an if-statement. But now it'll keep receiving nothing at all (even if the while loop variable is false) so I'll fix that.

---------------

Edit3:

Started Netty? :D

PHP:
package timer.net.tcp;

import java.net.InetSocketAddress;
import java.util.concurrent.Executors;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;        
import timer.Timer;

public class TcpListener {

    private final NioServerSocketChannelFactory factory;
    private final ServerBootstrap bootstrap;

    public TcpListener() {
        this.factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
        this.bootstrap = new ServerBootstrap(factory);
        this.bootstrap.bind(new InetSocketAddress(Timer.getConfiguration().getString("tcp.ip"), Timer.getConfiguration().getInt("tcp.port")));
    }

}

(IDK if I'm doing something wrong so if so, please correct me)
 
Last edited:
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,688
Started Netty? :D

PHP:
package timer.net.tcp;

import java.net.InetSocketAddress;
import java.util.concurrent.Executors;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;        
import timer.Timer;

public class TcpListener {

    private final NioServerSocketChannelFactory factory;
    private final ServerBootstrap bootstrap;

    public TcpListener() {
        this.factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
        this.bootstrap = new ServerBootstrap(factory);
        this.bootstrap.bind(new InetSocketAddress(Timer.getConfiguration().getString("tcp.ip"), Timer.getConfiguration().getInt("tcp.port")));
    }

}

(IDK if I'm doing something wrong so if so, please correct me)

You require a NetworkDecoder, NetworkEncoder and ChannelHandler attached to the bootstrap instance for it to work.
 
Custom Title Activated
Loyal Member
Joined
Oct 26, 2012
Messages
2,357
Reaction score
1,086
You require a NetworkDecoder, NetworkEncoder and ChannelHandler attached to the bootstrap instance for it to work.

Yeah, I attached them earlier. I use them all in one class (so no new class for the encoder and decoder, but they're in the same class as connecting, disconnecting etc.).
 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top