- Joined
- Dec 11, 2010
- Messages
- 2,955
- Reaction score
- 2,688
Icarus
Icarus is a server which is emulating the most recent version of Habbo. It's programmed in Java 1.8. The server aims at minimising memory leaks, easy to maintain and expand upon and to maximise the server uptime/stability.
All files which access and query the database are called data access objects (DAO) and they have been completely separated from the rest of the server, and the only calls to the database are forced through the data access objects.
This server is created by me and built from the ground up, it is not based on any previous servers
Example of the database access separated from the main project.
Code:
package org.alexdev.icarus.dao.mysql.item;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.alexdev.icarus.dao.mysql.Dao;
import org.alexdev.icarus.dao.mysql.Storage;
public class TeleporterDao {
/**
* Gets the pair id.
*
* [USER=2000183830]para[/USER]m id the id
* [USER=850422]return[/USER] the pair id
*/
public static int getPairId(int id) {
Connection sqlConnection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try {
sqlConnection = Dao.getStorage().getConnection();
preparedStatement = Dao.getStorage().prepare("SELECT * FROM item_teleporter_links WHERE item_one = ? OR item_two = ? LIMIT 1;", sqlConnection);
preparedStatement.setInt(1, id);
preparedStatement.setInt(2, id);
resultSet = preparedStatement.executeQuery();
if (resultSet.next()) {
if (resultSet.getInt("item_two") != id) {
return resultSet.getInt("item_two");
} else {
return resultSet.getInt("item_one");
}
}
} catch (Exception e) {
Storage.logError(e);
} finally {
Storage.closeSilently(resultSet);
Storage.closeSilently(preparedStatement);
Storage.closeSilently(sqlConnection);
}
return 0;
}
/**
* Save pair.
*
* [USER=2000183830]para[/USER]m item1 the item 1
* [USER=2000183830]para[/USER]m item2 the item 2
*/
public static void savePair(int item1, int item2) {
Connection sqlConnection = null;
PreparedStatement preparedStatement = null;
try {
sqlConnection = Dao.getStorage().getConnection();
preparedStatement = Dao.getStorage().prepare("INSERT into item_teleporter_links (item_one, item_two) VALUES(?, ?);", sqlConnection);
preparedStatement.setInt(1, item1);
preparedStatement.setInt(2, item2);
preparedStatement.execute();
} catch (Exception e) {
Storage.logError(e);
} finally {
Storage.closeSilently(preparedStatement);
Storage.closeSilently(sqlConnection);
}
}
}
Open-source
Yes, this project is open source, the stable source can code can be located at:
You must be registered to see links
(All pull requests will be rejected while this project is in alpha and beta stage).
Features
The current client version it's using is called PRODUCTION-201710172204-432325793 this includes the new loader and the new navigator which gives more customisation on how you want your navigator displayed.
- User
- Login with SSO (single sign on) ticket
- Show targeted offers (special deals)
- Show Habbo Club susbcription (can expire)
- Navigator
- View public spaces
- View most popular rooms
- View own rooms
- View promoted events
- Messenger
- Search for users
- Send a friend request
- Accept friend request
- Reject friend request
- Send friend a message
- Delete friend
- Invite friend
- Follow friend
- Rooms
- Create own room
- Edit room details
- Room entry
- Delete room
- Walking/pathfinding around items and users (if walking through people is ticked)
- Give rights
- Take away rights
- Remove all rights
- Edit floor plan
- Save floor plan
- Items
- Take photo
- Purchase photo
- Place items
- Rotate and move items
- Pickup items
- Sit on items
- Interact with items
- Take photo
- Purchase photo
- Take photo for room thumbail
- Inventory
- Load floor items
- Load wall items
- Load pets
- Update inventory when a new item is purchased/picked up
- Show new item in inventory once item is purchased/picked up
- Update inventory when a pet is purchased/picked up
- Show new item when a pet is purchased/picked up
- Catalogue
- Catalogue tabs
- Catalogue pages, visible depending on rank
- Catalogue item discount
- Purchase items
- Buy Habbo Club subscription
- Promotions
- Buy promotion
- Edit promotion
- Show promotion in the special promotions part of the navigator
- Pets
- Purchase pet
- Load pet races
- Verify pet name
- Place pet
- Pick up pet
- Groups
- Purchase grpup
- Set group homeroom
- Delete group
- Group furni
- Edit group settings
- Manage group users
- Group decorative rights
Completed Interaction Types
- Default
- Vending
- Gate
- Rollers
- Teleporters
- Moodlights
- Bed
- Chair
- One way gates
- Mannequins
- ads_background
- Background Toner
Libraries
- Netty 4.1.16
- HikariCP 2.7.1
- Gson 2.8.0
- ini4j 0.5.4
- Luaj 3.0-beta2
- MySQL Connector Java 6.0.6
- slf4j 1.7.25
- log4j 1.2.17
The source code is built using the Gradle (which is like Maven, except doesn't require XML configuration). So once imported, all libraries will be downloaded automatically without the need to maintain third-party Jar files.
Plugin System
Icarus has a plugin system, completely in Lua. Using Luaj it's possible to extend the functionality of the server without writing any Java or recompiling the server.
The following events coded right now are listed below, and the name next to them indicates the event function name will be called.
Player Events
- PLAYER_LOGIN_EVENT
- PLAYER_DISCONNECT_EVENT
Messenger Events
- MESSENGER_TALK_EVENT
Room Events
- ROOM_REQUEST_ENTER_EVENT
- ROOM_FIRST_ENTRY_EVENT
- ROOM_ENTER_EVENT
- ROOM_LEAVE_EVENT
- ROOM_PLAYER_CHAT_EVENT
- ROOM_PLAYER_SHOUT_EVENT
- ROOM_PLAYER_WHISPER_EVENT
- ROOM_WALK_REQUEST_EVENT
- ROOM_STOP_WALKING_EVENT
Item Events
- PLACE_FLOOR_ITEM_EVENT
- PLACE_WALL_ITEM_EVENT
- FLOOR_ITEM_INTERACT_EVENT
- WALL_ITEM_INTERACT_EVENT
More will be added as more development time passes, and each event will be documentated on what event does what, and what parameters each event takes.
For example, this will create 200 bots that will walk around when a user enters a room.
Code:
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
Screenshots
Server
Credits
- Leon, giving me some help for fixing structures, etc.
- Glaceon, guidance on fixing client crash when item quantity is enabled on the catalogue.
Attachments
You must be registered for see attachments list
Last edited: