-
[R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Hello. Today I created a small base (simple, but I did almost everything from scratch, but I looked at Sierra for an example for Sockets and for MySQL, so thanks to quackster) in Java. It's created to run the Post-Shuffled SWF and is currently in Development.
However, you can download it if you want:
Love.rar
It's good as base for your development if you don't need all special Hibernate stuff (however, I've added some Hibernate jar's as I will make Hibernate) and want to create a java emulator.
Credits:
- All the people who made the jars for mysql and netty etc.
- Quackster
- Me
Snippets:
ClientMessage.java:
PHP Code:
package love.packets;
import org.jboss.netty.buffer.ChannelBuffer;
public class ClientMessage {
private ChannelBuffer Buffer;
public ClientMessage(ChannelBuffer Buffer)
{
this.Buffer = Buffer;
}
public short getHeader()
{
return this.Buffer.readShort();
}
public String getUTF()
{
short Strlen = this.Buffer.readShort();
return new String(this.Buffer.readBytes(Strlen).array());
}
public int getInt32()
{
return this.Buffer.readInt();
}
public boolean getBoolean()
{
return (this.Buffer.readByte() == 1);
}
@Override
public String toString()
{
String Data = new String(this.Buffer.array()).substring(2);
for (char c : Data.toCharArray())
{
if (c < 20)
Data = Data.replace(Character.toString(c), "[" + (int)c + "]");
}
return Data;
}
}
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Like Like Like!
Stable enough to run an hotel on it?
-Butler
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Quote:
Originally Posted by
Butler
Like Like Like!
Stable enough to run an hotel on it?
-Butler
Haven't tested it out, but feel free to develop + test. I am also developing this, and I think if you code it good it is stable enough.
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Quote:
Originally Posted by
djtroy39
Haven't tested it out, but feel free to develop + test. I am also developing this, and I think if you code it good it is stable enough.
I'll try.
-Butler
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
What release are those headers for?
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
You can't even write C# properly..
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Quote:
Originally Posted by
Caustik
You can't even write C# properly..
Perhaps. But as long as nobody helps me / give me tips, you shouldn't complain.
@Ric Flair - RELEASE63-201210031134-547314780
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Whenever you get the chance, you mind passing those packets and the rest of the headers over? :P
Quote:
Originally Posted by
Caustik
You can't even write C# properly..
He's making more of an effort to release things then you are; stop complaining.
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Quote:
Originally Posted by
Makarov
Whenever you get the chance, you mind passing those packets and the rest of the headers over? :P
He's making more of an effort to release things then you are; stop complaining.
Maybe but first I have to fix a lot of things.
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Your doing the same, like your C# projects, releasing uncompleted projects. Basically your re-writing the same code over and over again.
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Quote:
Originally Posted by
Zak©
Your doing the same, like your C# projects, releasing uncompleted projects. Basically your re-writing the same code over and over again.
Okay, show me the release where I made the exactly same source in Java? I'll pay if you find, and if you don't find, you pay.
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Your events block. Use concurrency in the form of:
PHP Code:
ExecutorService executors = Executors.newFixedThreadPool(int size);
// ...
public class RunnableTask implements Runnable {
public RunnableTask() {
// Constructor logic here
}
public void run() {
System.out.println("Called by executor service.");
}
}
executors.execute(new RunnableTask());
Your decoder generates too much overhead. You are doing:
PHP Code:
byte[] Data = arg2.array();
As you only need one byte for the policy file request, you can do:
PHP Code:
byte policyCheck = buffer.readByte();
// 60 = '<'
if(byte == 60) {
// handle the request here
}
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Quote:
Originally Posted by
Caustik
Your events block. Use concurrency in the form of:
PHP Code:
ExecutorService executors = Executors.newFixedThreadPool(int size);
// ...
public class RunnableTask implements Runnable {
public RunnableTask() {
// Constructor logic here
}
public void run() {
System.out.println("Called by executor service.");
}
}
executors.execute(new RunnableTask());
Your decoder generates too much overhead. You are doing:
PHP Code:
byte[] Data = arg2.array();
As you only need one byte for the policy file request, you can do:
PHP Code:
byte policyCheck = buffer.readByte();
// 60 = '<'
if(byte == 60) {
// handle the request here
}
This is way better. Is it so much work to give me tips? From this I learn. If you only say this is bad, it won't help me.
Thanks, you deserve a like + rep.
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Quote:
Originally Posted by
Caustik
Your events block. Use concurrency in the form of:
PHP Code:
ExecutorService executors = Executors.newFixedThreadPool(int size);
// ...
public class RunnableTask implements Runnable {
public RunnableTask() {
// Constructor logic here
}
public void run() {
System.out.println("Called by executor service.");
}
}
executors.execute(new RunnableTask());
Your decoder generates too much overhead. You are doing:
PHP Code:
byte[] Data = arg2.array();
As you only need one byte for the policy file request, you can do:
PHP Code:
byte policyCheck = buffer.readByte();
// 60 = '<'
if(byte == 60) {
// handle the request here
}
And were to put the event block?
Still learning.
-Butler
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Quote:
Originally Posted by
Butler
And were to put the event block?
Still learning.
-Butler
You'd have two classes..
E.g
PHP Code:
package net.hybridcore.shark.habbo.message.incoming.user;
import net.hybridcore.shark.Shark;
import net.hybridcore.shark.habbo.game.GameSession;
import net.hybridcore.shark.habbo.message.ClientMessage;
import net.hybridcore.shark.habbo.message.IMessageEvent;
import net.hybridcore.shark.habbo.message.outgoing.user.UserParams;
public class UserObjectEvent implements IMessageEvent {
public void invoke(ClientMessage cMessage, GameSession session) {
Shark.getExecutors().execute(new UserParams(session));
}
}
And
PHP Code:
package net.hybridcore.shark.habbo.message.outgoing.user;
import net.hybridcore.shark.habbo.game.GameSession;
import net.hybridcore.shark.habbo.message.ClientMessage;
import net.hybridcore.shark.habbo.message.IMessageEvent;
import net.hybridcore.shark.habbo.message.OutgoingMessage;
import net.hybridcore.shark.habbo.message.ServerMessage;
import org.apache.log4j.Logger;
public class UserParams extends OutgoingMessage
{
public UserParams(GameSession session) {
super(session);
// TODO Auto-generated constructor stub
}
public void run() {
session.send(new ServerMessage(5)
.appendString(session.getHabbo().getID().toString())
.appendString(session.getHabbo().getUsername()) //c'mon dude
.appendString(session.getHabbo().getFigure()) //figure
.appendString(session.getHabbo().getGender().toLowerCase()) //gender
.appendString(session.getHabbo().getMotto()) //motto - do .getMotto() here
.appendWireInt(100) //tickets - do .getTickets()
.appendString("") //pool figure - .getPoolFigure()
.appendWireInt(0)); //film - .getFilm()
session.send(new ServerMessage(139)
.appendString("Hello, "+session.getHabbo().getUsername()));
}
}
As you can see, the Event class (UserObjectEvent.java) calls for the Response class (UserParams.java) to be executed in the pool. This allows for concurrent operations within the 'pool'.
EDIT
This would be called by:
PHP Code:
public void registerUserHandlers()
{
this.messages.put(7, new UserObjectEvent());
this.messages.put(8, new GetCreditsEvent());
this.messages.put(26, new GetSubscriptionsEvent());
this.messages.put(228, new GetSoundSettingsEvent());
}
-
Re: [R63, Java, Netty, Post-Shuffle] Codename 'LOVE' [BASE!]
Not being rude, just asking a question...
But do you know how to make an emulator any further than this... because im pretty sure this is the second time you've released an incomplete base?
Id like to see some of your work beyond the "base" stage.
Obviously i appreciate your contribution but one does wonder...
Will