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!

[PRE-SHUFFLE] IDK Java Emulator v2 [SCRATCH]

Skilled Illusionist
Joined
Jul 2, 2009
Messages
313
Reaction score
139
I have discovered a small bug with pets. When you place a pet the room_id of the pets get saved and when you leave the room, the room_id gets set back to -1 (so the pet is back in your hand). However... When you enter the "stop" command during your session in the room with the pet, in the next relog of the client+server the pet is still there.

So basically, on EVERY room LEAVE, the pet gets put back to -1 in the database for a room_id.

Other than that its a very nice emulator. Hopefully somebody can give me a fix for the pet issue and I will certainly use it for production.



Seems I have already fixed the issue :)! It was with the kick void. When you leave the room it instantly trigger the removeBotFromRoom, where is defined to put -1 in room_id. Fixed by creating a new TakeBot void, and adding:

Code:
public void takePet() {
        if (this.isBot() && this.isPet()) {
        this.room.removeBotFromRoom(this);
        }
    }

    public void kick(final boolean soft) {
        if (this.isBot() && !this.isPet()) {
                this.room.removeBotFromRoom(this);
                return;
        }

And changing the packethandler to use takePet, for picking up pets.
 
Last edited:
Joined
Aug 24, 2012
Messages
603
Reaction score
300
I have discovered a small bug with pets. When you place a pet the room_id of the pets get saved and when you leave the room, the room_id gets set back to -1 (so the pet is back in your hand). However... When you enter the "stop" command during your session in the room with the pet, in the next relog of the client+server the pet is still there.

So basically, on EVERY room LEAVE, the pet gets put back to -1 in the database for a room_id.

Other than that its a very nice emulator. Hopefully somebody can give me a fix for the pet issue and I will certainly use it for production.



Seems I have already fixed the issue :)! It was with the kick void. When you leave the room it instantly trigger the removeBotFromRoom, where is defined to put -1 in room_id. Fixed by creating a new TakeBot void, and adding:

Code:
public void takePet() {
        if (this.isBot() && this.isPet()) {
        this.room.removeBotFromRoom(this);
        }
    }

    public void kick(final boolean soft) {
        if (this.isBot() && !this.isPet()) {
                this.room.removeBotFromRoom(this);
                return;
        }

And changing the packethandler to use takePet, for picking up pets.
Well, then prepare your beans for writing staff recommendations :love: @steffchef You realize that when you leave a room, it does not get removed from the popular rooms list?
 
Junior Spellweaver
Joined
May 14, 2011
Messages
174
Reaction score
325
steffchef You realize that when you leave a room, it does not get removed from the popular rooms list?

Of course, I do.
Saw it in the sandbox hotel of Habbo being handled like that (max. of 40[?] rooms) and so I thought that it's how it should be done.

Cheers,
Steve Winfield
 
git bisect -m
Loyal Member
Joined
Sep 2, 2011
Messages
2,171
Reaction score
916
I have discovered a small bug with pets. When you place a pet the room_id of the pets get saved and when you leave the room, the room_id gets set back to -1 (so the pet is back in your hand). However... When you enter the "stop" command during your session in the room with the pet, in the next relog of the client+server the pet is still there.

So basically, on EVERY room LEAVE, the pet gets put back to -1 in the database for a room_id.

Other than that its a very nice emulator. Hopefully somebody can give me a fix for the pet issue and I will certainly use it for production.



Seems I have already fixed the issue :)! It was with the kick void. When you leave the room it instantly trigger the removeBotFromRoom, where is defined to put -1 in room_id. Fixed by creating a new TakeBot void, and adding:

Code:
public void takePet() {
        if (this.isBot() && this.isPet()) {
        this.room.removeBotFromRoom(this);
        }
    }

    public void kick(final boolean soft) {
        if (this.isBot() && !this.isPet()) {
                this.room.removeBotFromRoom(this);
                return;
        }

And changing the packethandler to use takePet, for picking up pets.

Really nice! I really like steffcheff Emulator, already i love the name, is so creative ..
 
Skilled Illusionist
Joined
Jul 2, 2009
Messages
313
Reaction score
139
Really nice! I really like steffcheff Emulator, already i love the name, is so creative ..

Seems I have made a small mistake in that code, now it will generate exceptions, but I have another fix for that :)...

Replace:
Code:
public void kick(final boolean soft) {
        if (this.isBot() && !this.isPet()) {
                this.room.removeBotFromRoom(this);
                return;
        }

With:
Code:
public void kick(final boolean soft) {
        if (this.isBot()) {
                this.room.removeBotFromRoom(this);
                return;
        }



Exactly.

Cheers,
Steve Winfield

Thats a good choice, just because its anoying to have an empty list. Like the idea =)!
 
git bisect -m
Loyal Member
Joined
Sep 2, 2011
Messages
2,171
Reaction score
916
Where exactly are these checks located?

For Bot (public void kick(final boolean soft) {)
if (this.isBot() && !this.isPet()) {

For Pet(public void takePet() {)

Are you a developer or what?
if (this.isBot() && this.isPet()) {


@EvilCoder idk how this emulator is coded, but if Every PET is a PetBot, so i think you doesn't need to check if the Pet is also a Bot, because he is.

So best approach:

Code:
public void takePet() {
        if (this.isPet()) {
        this.room.removeBotFromRoom(this);
        }
    }

public void kick(final boolean soft) {
        if (this.isBot()) {
                this.room.removeBotFromRoom(this);
                return;
        }
 
Joined
Aug 24, 2012
Messages
603
Reaction score
300
For Bot (public void kick(final boolean soft) {)
if (this.isBot() && !this.isPet()) {

For Pet(public void takePet() {)

Are you a developer or what?
if (this.isBot() && this.isPet()) {


@EvilCoder idk how this emulator is coded, but if Every PET is a PetBot, so i think you doesn't need to check if the Pet is also a Bot, because he is.

So best approach:

Code:
public void takePet() {
        if (this.isPet()) {
        this.room.removeBotFromRoom(this);
        }
    }

public void kick(final boolean soft) {
        if (this.isBot()) {
                this.room.removeBotFromRoom(this);
                return;
        }
That was not anywhere near my question.
 
Junior Spellweaver
Joined
May 14, 2011
Messages
174
Reaction score
325
Where exactly are these checks located?

The rooms of a popular list are sorted and managed by org.stevewinfield.suja.idk.game.navigator.NavigatorList, that is executed by org.stevewinfield.suja.idk.game.navigator.tasks.SortNavigatorTask every 2 seconds.

In Phoenix (and later Butterfly versions as well I think) all rooms are sorted on every single request which is quite inefficient in my opinion.

Cheers,
Steve Winfield
 
Joined
Aug 24, 2012
Messages
603
Reaction score
300
The rooms of a popular list are sorted and managed by org.stevewinfield.suja.idk.game.navigator.NavigatorList, that is executed by org.stevewinfield.suja.idk.game.navigator.tasks.SortNavigatorTask every 2 seconds.

In Phoenix (and later Butterfly versions as well I think) all rooms are sorted on every single request which is quite inefficient in my opinion.

Cheers,
Steve Winfield
But where are the rooms being removed from the popular rooms list?
 
Junior Spellweaver
Joined
May 14, 2011
Messages
174
Reaction score
325
But where are the rooms being removed from the popular rooms list?

As I said: org.stevewinfield.suja.idk.game.navigator.NavigatorList

Code:
if (this.size == 50 && this.lowestPlayers < playersTotal) {
    this.lowestPlayers = playersTotal;
    this.rooms.remove(this.lowestRoom); // SEE HERE
    this.lowestRoom = room;
    this.writerUpdateNeeded = true;
    this.rooms.add(room);
}

Cheers,
Steve Winfield
 
Last edited:
Skilled Illusionist
Joined
Jul 2, 2009
Messages
313
Reaction score
139
For Bot (public void kick(final boolean soft) {)
if (this.isBot() && !this.isPet()) {

For Pet(public void takePet() {)

Are you a developer or what?
if (this.isBot() && this.isPet()) {


@EvilCoder idk how this emulator is coded, but if Every PET is a PetBot, so i think you doesn't need to check if the Pet is also a Bot, because he is.

So best approach:

Code:
public void takePet() {
        if (this.isPet()) {
        this.room.removeBotFromRoom(this);
        }
    }

public void kick(final boolean soft) {
        if (this.isBot()) {
                this.room.removeBotFromRoom(this);
                return;
        }

This is a bit confusing...

1. I already replied with what you just said in your message.
2. There are 2 type of bots, where you can also have the "Help Guide Bot" in your room and should be kicked upon leaving the room but not the pets.
3. If you have read the source you can see that "this.room.removeBotFromRoom(this);" will instantly put the roombot on room_id = -1. Meaning that it will leave the room, if you do that for the pet, you need to put them in your room everytime you enter the room.
 
Junior Spellweaver
Joined
May 14, 2011
Messages
174
Reaction score
325
Make an onKick() method in an interface and have users, pets & bots interface that or extend from some kind of base class. Then the implementation can be done differently for each type.

It would be even better to split it all up and to improve the abstraction by structuring it like..
RoomObject (removable) > RoomFloorObject > RoomEntity (kickable)

RoomPlayer extends RoomEntity

RoomBot extends RoomEntity
RoomPet extends RoomBot

I would have done it differently if I had known better in the beginning.

Cheers,
Steve Winfield
 
git bisect -m
Loyal Member
Joined
Sep 2, 2011
Messages
2,171
Reaction score
916
This is a bit confusing...

1. I already replied with what you just said in your message.
2. There are 2 type of bots, where you can also have the "Help Guide Bot" in your room and should be kicked upon leaving the room but not the pets.
3. If you have read the source you can see that "this.room.removeBotFromRoom(this);" will instantly put the roombot on room_id = -1. Meaning that it will leave the room, if you do that for the pet, you need to put them in your room everytime you enter the room.

Oh Exactly. But the Guide Bot must be automatically kicked out after he explanning all the things. And not after the room unloads, or user kick him (optional), or unload commands..

I'm wrong?
 
Skilled Illusionist
Joined
Jul 2, 2009
Messages
313
Reaction score
139
Such a shame, after running it for a week, stuff starting to crash. With nobody online.

Code:
[New I/O worker #11] ERROR - Failed to handle packet
java.lang.NullPointerException
        at org.stevewinfield.suja.idk.network.sessions.Session.tryAuthenticate(Session.java:253)
        at org.stevewinfield.suja.idk.communication.handshake.readers.AuthenticatePlayerReader.parse(AuthenticatePlayerReader.java:47)
        at org.stevewinfield.suja.idk.communication.MessageHandler.handleMessage(MessageHandler.java:451)
        at org.stevewinfield.suja.idk.network.codec.NetworkDecoder.decode(NetworkDecoder.java:47)
        at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:425)
        at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
        at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.jboss.netty.channel.SimpleChannelHandler.messageReceived(SimpleChannelHandler.java:142)
        at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:88)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
        at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:109)
        at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90)
        at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
        at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
 
Newbie Spellweaver
Joined
Jan 18, 2016
Messages
12
Reaction score
14
Such a shame, after running it for a week, stuff starting to crash. With nobody online.

Code:
[New I/O worker #11] ERROR - Failed to handle packet
java.lang.NullPointerException
        at org.stevewinfield.suja.idk.network.sessions.Session.tryAuthenticate(Session.java:253)
        at org.stevewinfield.suja.idk.communication.handshake.readers.AuthenticatePlayerReader.parse(AuthenticatePlayerReader.java:47)
        at org.stevewinfield.suja.idk.communication.MessageHandler.handleMessage(MessageHandler.java:451)
        at org.stevewinfield.suja.idk.network.codec.NetworkDecoder.decode(NetworkDecoder.java:47)
        at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:425)
        at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
        at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
        at org.jboss.netty.channel.SimpleChannelHandler.messageReceived(SimpleChannelHandler.java:142)
        at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:88)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
        at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:109)
        at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90)
        at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
        at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
I'm assuming it wasn't able to fetch the players table properly. You should check if the auth_token is null when trying to sign in.
Under if (row.next()) {
Add "System.out.println(row.getInt("id"));" to test what's nulling out. :]
 

JHD

Initiate Mage
Joined
Jan 31, 2016
Messages
2
Reaction score
0
Will this emulator still get updates?
The concept with the plugins looks very interesting. Never saw that on a emulator before.

I'm thinking to use this for my future project. For myself I would edit it, but updates from the developer itself would be very cool.
 
Back
Top