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!

[LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera]

Status
Not open for further replies.
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Re: Icarus (Production) - Java Server [MySQL, Netty]

Your page needs to have a specific 'external' link/index name, like, the string above/below the page display title in the packet. It tries to open a page with a specific index name. There is where you buy the room promotion.

I don't know the index name but I think you can easily find it searching on anything with promotion stuff. Gluck.

Thank you :D: Leon saw my post helped me last night by saying the same thing, but I shortly went to bed without saying I fixed it -- was tired. I appreciate your help nonetheless.

I don't know if you can tell, but I'm working on room promotions.
 
Joined
Oct 26, 2012
Messages
2,357
Reaction score
1,086
Re: Icarus (Production) - Java Server [MySQL, Netty]

Thank you :D: Leon saw my post helped me last night by saying the same thing, but I shortly went to bed without saying I fixed it -- was tired. I appreciate your help nonetheless.

I don't know if you can tell, but I'm working on room promotions.

No worries, glad it's fixed :)
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Re: Icarus (Production) - Java Server [MySQL, Netty]

Changelog

Fixes
  • Fixed bug where user could walk about of teleporter while it was teleporting.
  • Fixed bug where it wasn't possible to teleport into a locked, or password protected room if the owner of that room was offline (weird bug I know).
  • Fixed bug where if multiple purchases of HC was performed, they wouldn't stack.
  • Fixed room deletion where the user who deletes their own room now has all their items saved back into their inventory.
  • Fixed bug where if an item was picked up or removed underneath the player which raises the players height, the player would be considered floating. Now the player's height adjusts to the next item down when the item has been removed/picked up.

Additions
  • Added permission system, along with the ability for permissions to be inherited.
  • Added feature to save custom room floor plans.
  • Added Lua integration which is now a plugin management system with event handling

Lua Plugin System

So with the Lua plugin system it's possible to change the functionality of the server without requiring any extensive Java knowledge, or without the need to download a Java IDE for the ability to create the plugin .jar files.

What is required is a Notepad program, which is what is used to write these plugins, and the methods/class names within Icarus too.

I've written an example called "BotPlugin" which will load 200 bots into a single room. Here is how it's handled, first with bot_plugin.lua

These method names have been inspired by Bukkit plugins for Minecraft I used to write. When the server first starts up, the "onEnable" is called if the plugin wishes to perform anything while the server loads.

And then it loads all the .lua files that have their paths stored in an array.

Code:
plugin_details = {
	name = "BotPlugin",
	author = "Quackster",
	path = "plugins/BotPlugin"
}

event_register = {
	"ROOM_ENTER_EVENT"
}

event_files = {
	"room_events.lua"
}

[COLOR="#008000"]--[[
	Called when the plugin first starts up, so the plugin can load data if needed
	so when the event is called the plugin is ready
	
	param: plugin instance
	return: none
--]][/COLOR]
function onEnable(plugin)
	
	-- If you want, use log.println() to show everyone this method being called
	log:println(string.format('[Lua] Initialising plugin %s by %s', plugin:getName(), plugin:getAuthor()))
	
end
[COLOR="#008000"]
-- Load all event .lua files
-- If you delete this code, ABSOLUTELY NO events will work[/COLOR]

for i, file in ipairs(event_files) do
	dofile (string.format('%s/events/%s', plugin_details.path, file))
end

Here is the room event handler (room_events.lua):

Code:
[COLOR="#008000"]--[[
	Room enter event called when the user has entered a room
	Called when a user has truly entered the room
	
	param: 
			Player 	- person who entered room
			Room 	- the room they entered
			
	return: Boolean - event cancelled state
--]]
[/COLOR]function onRoomEnterEvent(player, room)
	log:println("Room enter event called")

	for i = 0, 200 - 1 do
		local bot = createBot(room)
		randomWalkEntity(bot)
	end
	
	return false
end

function createBot(room) 

	local bot = luajava.newInstance("org.alexdev.icarus.game.bot.Bot");
	bot:getDetails():setName("RandomAlexBot")
	bot:getDetails():setMotto("")
	
	room:addEntity(bot)

	return bot
end

function randomWalkEntity(entity)
	
	local randomX = math.random(0, 25)
	local randomY = math.random(0, 25)
	
	entity:getRoomUser():walkTo(randomX, randomY)
	plugin:runTaskLater(1, randomWalkEntity, { entity })
	
end

This will send a repeat call to randomWalkEntity(entity) every 1 second using the command I wrote called plugin:runTaskLater which will call a Lua function in a specified amount of seconds, along with using the function name and the array of parameters supplied.

I will be writing documentation on the plugin system in the future, for now I have created these events. Documentation is required for these events to know what parameters all of them require.

Player events
  • PLAYER_LOGIN_EVENT("onPlayerLoginEvent")
  • PLAYER_DISCONNECT_EVENT("onPlayerDisconnectEvent")

Console messenger events
  • MESSENGER_TALK_EVENT("onMessengerTalkEvent")

Room events
  • ROOM_REQUEST_ENTER_EVENT("onRoomRequestEvent")
  • ROOM_ENTER_EVENT("onRoomEnterEvent")
  • ROOM_LEAVE_EVENT("onRoomLeaveEvent")
  • ROOM_PLAYER_CHAT_EVENT("onPlayerChatEvent")
  • ROOM_PLAYER_SHOUT_EVENT("onPlayerShoutEvent")
  • ROOM_WALK_REQUEST_EVENT("onPlayerWalkRequestEvent")
  • ROOM_STOP_WALKING_EVENT("onPlayerStopWalkingEvent")

Item events
  • PLACE_FLOOR_ITEM_EVENT("onPlaceFloorItemEvent")
  • PLACE_WALL_ITEM_EVENT("onPlaceFloorItemEvent")
  • FLOOR_ITEM_INTERACT_EVENT("onInteractFloorItemEvent")
  • WALL_ITEM_INTERACT_EVENT("onInteractWallItemEvent")
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Re: Icarus (Production) - Java Server [MySQL, Netty]

As a proof of concept, I wrote the entire RCON/MUS server in Lua. It will probably need to be rewritten to handle things such as listening on a certain IP address/whitelist IP addresses but apart from that, it works :D:

pmzAYDA - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums




Code:
[COLOR="#008000"]--[[
    The server socket handler for incoming RCON/MUS connections
    
    @author: Quackster
--]][/COLOR]
function listenServer() 

    local server_socket = nil

    log:println(string.format("[Rcon] Attempting to create RCON server on port %s", rcon_port))
    server_socket = luajava.newInstance("java.net.ServerSocket", rcon_port);
    
    log:println(string.format("[Rcon] RCON server listening on port %s", rcon_port))
    log:println()
    
    plugin:runTaskAsynchronously(waitForConnections, { server_socket })
end

[COLOR="#008000"]--[[
    The function where the socket waits for incoming socket connections
    and listens for data.
    
    @author: Quackster
--]][/COLOR]
function waitForConnections(server_socket)

    while (plugin:isClosed() == false) do
        
        local socket = server_socket:accept()
        log:println(string.format("Accepted connection from %s", socket:toString()))

        local incoming_data = util:readToEnd(socket)
        handleRconCommands(incoming_data)
        
        socket:close()
    end
end

[COLOR="#008000"]--[[
    RCON command handler where it's possible to remote control
    the server.
    
    @author: Quackster
--]][/COLOR]
function handleRconCommands(incoming_data) 

    local rcon_data = util:split(incoming_data, ";")
    
    local password = rcon_data:get(0)
    local command = rcon_data:get(1)
    
    -- Do not continue if the password is incorrect.
    if password ~= rcon_password then
        do return end
    end
    
    -- Find function in global namespace and call it.
    _G[command_handlers[command]](rcon_data)
end

Code:
command_handlers = {
    ["ha"] = "cmdHotelAlert"
}

[COLOR="#008000"]--[[
    This is to send hotel alerts remotely.
    
       [USER=2000183830]para[/USER]meters: 
        rcon_data - split by ';' delimeter

    Handler for RCON command    : ha
    Syntax                      : password;command;message
    Example                     : password;ha;Hotel alert test!
--]][/COLOR]
function cmdHotelAlert(rcon_data) 

    local message = rcon_data:get(2)
    local players = playerManager:getPlayers()

    for i = 0, players:size() - 1 do
        local player = players:get(i)
        player:sendMessage(message)
    end
end


 

Attachments

You must be registered for see attachments list
Last edited:
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Re: Icarus (Production) - Java Server [MySQL, Netty]

I've done a lot since I last posted which was only 5 days ago! I've updated to PRODUCTION-201709052204-426856518 build, which is the most recent Habbo build.

Now here's the changelog...

Targeted Offers

I've added targeted offers, which are special deals that run for a set amount of time before they expire, and they can only be bought once. Basically they look like this:

CrXlDnW - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums

They will be able to be edited/deleted/added in the housekeeping, you can change the image, the text, how much credits (and/or other activity points such as duckets) cost, the items that can be purchased etc. In the housekeeping shown:

(if MUS/RCON is enabled, upon clicking submit, the targeted offers will be reloaded without restarting server)
bssoTio - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums

Promotions

I've added room promotions, which is the typical feature of having a special entry in the events part of the navigator. It's sorted by the remaining time that is left, so lets say there's a room with 10 minutes and another with 20, the room with the fewer minutes left will be ordered first as that's how it works on Habbo.

PO7RWw9 - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums

Pets

The second feature I started has been pets, you can purchase them, place them - they walk around, and pick them up, they also support the feature where you can let others places their own pets in your room too, and when they're kicked they are placed into their owners inventory. Right now they're incomplete.

QJgK6w - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums

Groups

The third feature I've started on has been groups, you can purchase a group for a home room, view its group information, and delete the group, not much apart from that, the group feature is still complete.

Z6aZxuo - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums

Backend

Fun fact! Just today I stripped down Room.java from 629 lines to 202 lines.

Before:
After:
 

Attachments

You must be registered for see attachments list
Last edited:
Junior Spellweaver
Joined
May 15, 2014
Messages
165
Reaction score
34
Re: Icarus (Production) - Java Server [MySQL, Netty]

I love the updates, looks really good so far. I've been reading the source and you just improve more and more. I like that you refactor code while updating other things instead of just adding bunch of code, just to 'work'. Goodluck with this! :D
 
Joined
Aug 10, 2011
Messages
7,401
Reaction score
3,299
Re: Icarus (Production) - Java Server [MySQL, Netty]

This is so weird:

Code:
 public void addEntity(Entity entity) {

        this.addEntity(entity, 
                this.getModel().getDoorLocation().getX(), 
                this.getModel().getDoorLocation().getY(), 
                this.getModel().getDoorLocation().getRotation());
    }

    public void addEntity(Entity entity, int x, int y, int rotation) {

        if (entity.getType() == EntityType.PLAYER) {
            return;
        }
    }

So basically you have an addEntity method but you cannot call that on players which are actually also entities?

And in remove entity:
Code:
if (entity.getType() != EntityType.PLAYER) {

            // Save coordinates of pet
            if (entity.getType() == EntityType.PET) {
                ((Pet)entity).savePosition();
            }

            entity.dispose();
        }

Why not use an interface or something so you don't have to check against the entity type? Also looking at this code entity is not disposed for players (Which makes me think there is a possible memory leak?).

Code:
public boolean hasRights(int userId, boolean ownerCheckOnly) {

Kind weird, why not make an isOwner(Habbo habbo) method?

Code:
public void dispose(boolean forceDisposal) {

        if (forceDisposal) {

            this.cleanupRoomData();
            RoomManager.removeRoom(this.getData().getId());

        } else {

 -->           if (this.getPlayers().size() > 0) {
                return;
            }
It is strange to see a dispose method not actually disposing if there are players in the room. Like, you expect it to dispose the room as thats what your method is named after... Unless you don't want to have it mimic a deconstructor, I think dispose is a bad name for a function that doesn't always dispose...

Instead of rushing with implementing features, take some good time to look at your design :)
 
Last edited:
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Re: Icarus (Production) - Java Server [MySQL, Netty]

This is so weird:

Code:
 public void addEntity(Entity entity) {

        this.addEntity(entity, 
                this.getModel().getDoorLocation().getX(), 
                this.getModel().getDoorLocation().getY(), 
                this.getModel().getDoorLocation().getRotation());
    }

    public void addEntity(Entity entity, int x, int y, int rotation) {

        if (entity.getType() == EntityType.PLAYER) {
            return;
        }
    }

So basically you have an addEntity method but you cannot call that on players which are actually also entities?

And in remove entity:
Code:
if (entity.getType() != EntityType.PLAYER) {

            // Save coordinates of pet
            if (entity.getType() == EntityType.PET) {
                ((Pet)entity).savePosition();
            }

            entity.dispose();
        }

Why not use an interface or something so you don't have to check against the entity type? Also looking at this code entity is not disposed for players (Which makes me think there is a possible memory leak?).

Code:
public boolean hasRights(int userId, boolean ownerCheckOnly) {

Kind weird, why not make an isOwner(Habbo habbo) method?

Code:
public void dispose(boolean forceDisposal) {

        if (forceDisposal) {

            this.cleanupRoomData();
            RoomManager.removeRoom(this.getData().getId());

        } else {

 -->           if (this.getPlayers().size() > 0) {
                return;
            }
It is strange to see a dispose method not actually disposing if there are players in the room. Like, you expect it to dispose the room as thats what your method is named after... Unless you don't want to have it mimic a deconstructor, I think dispose is a bad name for a function that doesn't always dispose...

Instead of rushing with implementing features, take some good time to look at your design :)

The addEntity and the check rights stuff was going to be rewritten, trust me on that. I'm in the process right now of refactoring everything actually.

Also looking at this code entity is not disposed for players (Which makes me think there is a possible memory leak?).

The snippet of code within Player.java takes care of being disposed, but after the refactoring I was still going to go over and check that everything gets nullified and is eligible for cleanup.
 
Initiate Mage
Joined
Mar 20, 2017
Messages
1
Reaction score
1
Re: Icarus (Production) - Java Server [MySQL, Netty]

Love it! nice work, also great to see other Aussies here :D
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Re: Icarus (Production) - Java Server [MySQL, Netty]

Changelog

- Upgraded to PRODUCTION-201709192204-203982672 (the latest version as of right now).



- Added user group management, support for requesting to be inside a group, along with locked groups etc.





- The entire source code has been commented too (or almost anyways, excluding message composers and event classes).

- I've also added encryption, but not sure if it's worth it?


Also I've been thinking about swapping out libraries? Is it worth it to switch to something like Apache MINA and HikariCP instead?
 
Last edited:
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Re: Icarus (Production) - Java Server [MySQL, Netty]

"your" RSA pcks unpad function is flawed. Sometimes it fails to unpad, never understood why.. I fixed it with this implementation:

Thanks :): That was actually the issue I had which made me question if adding encryption was worth it.

I'll have a look at your implementation.



"your" RSA pcks unpad function is flawed. Sometimes it fails to unpad, never understood why.. I fixed it with this implementation:

I've just committed the change.





It seems to work for now, though I don't trust my porting skills so we'll see. :wink:
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Re: Icarus (Production) - Java Server [MySQL, Netty]

Should have used System.arraycopy instead of a for loop :p

I didn't know that one existed. I was only looking at the class and thought there was no equivalent Java function. :p:
 
Last edited:
Junior Spellweaver
Joined
Nov 5, 2013
Messages
147
Reaction score
57
Re: Icarus (Production) - Java Server [MySQL, Netty]

Thanks for sharing this emu development! i loved your plugin manager so much that i decided to make my own plugin manager based on yours. I used luaj as you did and i used Rhino for javascript plugins.







i loved this because its simple and fast. thanks you again!
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Re: Icarus (Production) - Java Server [MySQL, Netty]

Thanks for sharing this emu development! i loved your plugin manager so much that i decided to make my own plugin manager based on yours. I used luaj as you did and i used Rhino for javascript plugins.







i loved this because its simple and fast. thanks you again!

Awesome! Glad I'm inspiring others :wink:

I'll do a wiki for documentation of my plugin system in the near future :p:
 
Last edited:
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Re: Project Icarus - Java Server (Up to date) [MySQL, Netty, Plugin System]

Updates

Added
- Updated to PRODUCTION-201709192204-203982672

- Thumbnails now working 100% (the previous thumbnail picture gets deleted if user sets a new thumbnail, or deletes the room, to save disk space).

- Camera photos now purchasable.

- Place photo in room.

- Pickup photo.

- Delete photo.

- One way gates interaction added.

- User management in groups finished.

- Ability to disable thumbnail functions in server properties file.

- Ability to disable camera functions in server properties file.

Fixed
- Furniture interaction sometimes doesn't work while on rugs.

fRHy0Ch - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums


0FwI4D - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Last edited:
Junior Spellweaver
Joined
May 15, 2014
Messages
165
Reaction score
34
Re: Project Icarus - Java Server (Up to date) [MySQL, Netty, Plugin System]

Updates

Added
- Updated to PRODUCTION-201709192204-203982672

- Thumbnails now working 100% (the previous thumbnail picture gets deleted if user sets a new thumbnail, or deletes the room, to save disk space).

- Camera photos now purchasable.

- Place photo in room.

- Pickup photo.

- Delete photo.

- One way gates interaction added.

- User management in groups finished.

- Ability to disable thumbnail functions in server properties file.

- Ability to disable camera functions in server properties file.

Fixed
- Furniture interaction sometimes doesn't work while on rugs.

fRHy0Ch - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums


0FwI4D - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums
Updates are looking really promising, I've been reading some of your commits on github and I must say you're good at keeping things simple. I love where this project is going, keep it up!

Skickat från min FRD-L09 via Tapatalk
 

Attachments

You must be registered for see attachments list
Initiate Mage
Joined
Nov 2, 2013
Messages
56
Reaction score
3
Re: Icarus - Java Server (Up to date) [MySQL, Netty, Plugin System]

already love this emulator, just wondering how far it is already? when will we have some kind of release because i'd love to use this
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,685
Updates

(Backend...)

- Finally switched to using Gradle, so no more packaging jar shenanigans when people want to recompile.

- Switched from using BoneCP, as it's end of life, to HikariCP.

- Switched to using Lo4j logger, but I noticed that's end of life too, so I maybe need to use Log4j 2 if I want Java 9 compatibility in future.

- Now I've personally switched to IntelliJ over from Eclipse, but due to the nature of .gitignore and how Gradle can be imported into various IDE's, people can still use Eclipse if they wish (although I wouldn't recommend it...).

(Frontend...)

Switched to using Plus' catalogue, but I noticed there's a lot of customs and stuff that I just don't want, as I want to give a vanilla Habbo experience. I don't want customs filling up the furnidata, catalogue, etc. By scrubbing out the customs, it gives users a choice if they wish to add specific customs into their own server anyways.

So I ended up writing a converter that set all sprite ids in my database to -1 and then I read Habbo's official furnidata and then applied the sprite ids to the furniture that it could find, if it was the same class name and item type (wallitemtypes for wall items, and flooritemtypes for floor items, these tags can be found in the XML file).

The reason is that it helped distinguish to me what was a custom, and what was Habbo's official furni. Now Icarus is compatible with Habbo's official furnidata.xml

And I've also been organising the catalogue, by that I mean adding furni that is seemingly missing from from the catalogue, such as the lack of country flags that current Habbo retros have in regards to official Habbo, I mean seriously, there was no Australian flag until I redid the posters/wall decorations page... :glare:

nfumE58 - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums


The catalogues avaliable are also missing the dark iced furniture, and the dark pura furniture that Habbo currently has their catalogue, so right now I've added all of them and they just need to be configured (don't worry, the original Iced furniture is still there!) :p:

rpaw9NQ - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums


Oh, and I've also recounted the item definition ids, the catalogue page ids, the catalogue item ids from 1 upwards, because I noticed the later rows had like, ID 8000000+ when there was only 7000 rows in the database, but that's all fixed too. :eek:tt1:

Three public rooms have been added

Welcome Lounge

YT5kvMw - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums


Coffee House

CXXuXdT - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums


Pinic

LfzBHvu - [LATEST] Icarus Emulator [Java, Netty, MySQL, Plugins, Camera] - RaGEZONE Forums

already love this emulator, just wondering how far it is already? when will we have some kind of release because i'd love to use this

It's still missing quite a few features, but it's the most complete server I've written myself so far. :p: I can't give an ETA on release, but I would appreciate it if people still kept replying to this thread.

It's been kind of dead lately even after posting updates :(:
 

Attachments

You must be registered for see attachments list
Last edited:
Status
Not open for further replies.
Back
Top