Icarus (Production) - Java Server [MySQL, Netty]

Page 1 of 20 12345678911 ... LastLast
Results 1 to 15 of 289
  1. #1
    Moderator Quackster is online now
    ModeratorRank
    Dec 2010 Join Date
    AustraliaLocation
    3,081Posts

    Icarus (Production) - Java Server [MySQL, Netty]


    RaGEZONE Recommends

    RaGEZONE Recommends

    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.

    Spoiler:
    Code:
    package org.alexdev.icarus.dao.mysql.room;
    
    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;
    import org.alexdev.icarus.game.item.moodlight.MoodlightData;
    import org.alexdev.icarus.log.Log;
    
    public class MoodlightDao {
    
        public static boolean hasMoodlightData(int itemId) {
    
            boolean exists = false;
            
            Connection sqlConnection = null;
            PreparedStatement preparedStatement = null;
            ResultSet resultSet = null;
    
            try {
    
                sqlConnection = Dao.getStorage().getConnection();
                preparedStatement = Dao.getStorage().prepare("SELECT item_id FROM room_items_moodlight WHERE item_id = ? LIMIT 1", sqlConnection);
                preparedStatement.setInt(1, itemId);
                resultSet = preparedStatement.executeQuery();
                
                while (resultSet.next()) {
                    exists = true;
                }
    
            } catch (Exception e) {
                Log.exception(e);
            } finally {
                Storage.closeSilently(resultSet);
                Storage.closeSilently(preparedStatement);
                Storage.closeSilently(sqlConnection);
            }
    
            return exists;
        }
        
        public static MoodlightData getMoodlightData(int itemId) {
    
            MoodlightData data = null;
            
            Connection sqlConnection = null;
            PreparedStatement preparedStatement = null;
            ResultSet resultSet = null;
    
            try {
    
                sqlConnection = Dao.getStorage().getConnection();
                preparedStatement = Dao.getStorage().prepare("SELECT * FROM room_items_moodlight WHERE item_id = ? LIMIT 1", sqlConnection);
                preparedStatement.setInt(1, itemId);
                resultSet = preparedStatement.executeQuery();
    
                while (resultSet.next()) {
                    data = fill(resultSet);
                    
                }
    
            } catch (Exception e) {
                Log.exception(e);
            } finally {
                Storage.closeSilently(resultSet);
                Storage.closeSilently(preparedStatement);
                Storage.closeSilently(sqlConnection);
            }
    
            return data;
        }
    
        public static void saveMoodlightData(MoodlightData data) {
    
            Connection sqlConnection = null;
            PreparedStatement preparedStatement = null;
            ResultSet resultSet = null;
    
            try {
                sqlConnection = Dao.getStorage().getConnection();
                preparedStatement = Dao.getStorage().prepare("UPDATE room_items_moodlight SET enabled = ?, current_preset = ?, preset_one = ?, preset_two = ?, preset_three = ? WHERE item_id = ?", sqlConnection);
                preparedStatement.setInt(1, data.isEnabled() ? 1 : 0);
                preparedStatement.setInt(2, data.getCurrentPreset());
                preparedStatement.setString(3, data.getPresets().get(0).toString());
                preparedStatement.setString(4, data.getPresets().get(1).toString());
                preparedStatement.setString(5, data.getPresets().get(2).toString());
                preparedStatement.setInt(6, data.getId());
                preparedStatement.executeUpdate();
    
            } catch (Exception e) {
                Log.exception(e);
            } finally {
                Storage.closeSilently(resultSet);
                Storage.closeSilently(preparedStatement);
                Storage.closeSilently(sqlConnection);
            }
        }
    
        
        public static void newMoodlightData(int itemId) {
    
            Connection sqlConnection = null;
            PreparedStatement preparedStatement = null;
            ResultSet resultSet = null;
    
            try {
                sqlConnection = Dao.getStorage().getConnection();
                preparedStatement = Dao.getStorage().prepare("INSERT INTO room_items_moodlight (item_id, enabled, current_preset, preset_one, preset_two, preset_three) VALUES (?, ?, ?, ?, ?, ?)", sqlConnection);
                preparedStatement.setInt(1, itemId);
                preparedStatement.setInt(2, 0);
                preparedStatement.setInt(3, 1);
                preparedStatement.setString(4, "#000000,255,0");
                preparedStatement.setString(5, "#000000,255,0");
                preparedStatement.setString(6, "#000000,255,0");
                preparedStatement.executeUpdate();
    
            } catch (Exception e) {
                Log.exception(e);
            } finally {
                Storage.closeSilently(resultSet);
                Storage.closeSilently(preparedStatement);
                Storage.closeSilently(sqlConnection);
            }
        }
        
        public static void deleteMoodlightData(int itemId) {
    
            Connection sqlConnection = null;
            PreparedStatement preparedStatement = null;
            ResultSet resultSet = null;
    
            try {
                sqlConnection = Dao.getStorage().getConnection();
                preparedStatement = Dao.getStorage().prepare("DELETE FROM room_items_moodlight WHERE item_id = ?", sqlConnection);
                preparedStatement.setInt(1, itemId);
                preparedStatement.executeUpdate();
    
            } catch (Exception e) {
                Log.exception(e);
            } finally {
                Storage.closeSilently(resultSet);
                Storage.closeSilently(preparedStatement);
                Storage.closeSilently(sqlConnection);
            }
        }
    
        public static MoodlightData fill(ResultSet row) throws Exception {
            MoodlightData data = new MoodlightData(row.getInt("item_id"), row.getInt("current_preset"), row.getInt("enabled") == 1, row.getString("preset_one"), row.getString("preset_two"), row.getString("preset_three"));
            return data;
        }
    }


    Open-source

    Yes, this project is open source, the stable source can code can be located at:

    https://github.com/TheAmazingAussie/Icarus

    (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-201709052204-426856518 this includes the new loader and the new navigator which gives more customization 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)
      • Place items
      • Rotate and move items
      • Pickup items
      • Sit on items
      • Interact with items
      • Give rights
      • Take away rights
      • Remove all rights
        • Edit floor plan
        • Save floor plan
    • 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


    Completed Interaction Types

    • Default
    • Vending
    • Gate
    • Rollers
    • Teleporters
    • Moodlights
    • Bed
    • Chair


    Libraries

    - BoneCP (connection pooling)
    - Netty 3 (as an extension, can be easily switched out for a different library or one more up to date)
    - More libraries...

    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 - onPlayerLoginEvent
    • PLAYER_DISCONNECT_EVENT - onPlayerDisconnectEvent


    Messenger Events
    • MESSENGER_TALK_EVENT - onMessengerTalkEvent


    Room Events
    • ROOM_REQUEST_ENTER_EVENT - onRoomRequestEvent
    • ROOM_FIRST_ENTRY_EVENT - onRoomFirstEntryEvent
    • ROOM_ENTER_EVENT - onRoomEnterEvent
    • ROOM_LEAVE_EVENT - onRoomLeaveEvent
    • ROOM_PLAYER_CHAT_EVENT - onPlayerChatEvent
    • ROOM_PLAYER_SHOUT_EVENT - onPlayerShoutEvent
    • ROOM_PLAYER_WHISPER_EVENT - onPlayerWhisperEvent
    • 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


    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

    Content Management System

    (It has a template layout, so the layout can be switched for another one).







    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.
    Last edited by Quackster; 6 Days Ago at 06:12 PM.
    - Alex

    Latest cracked SWF releases: swfhub.com

    Also includes header dumps for easy header updating, and various other game files.


  2. #2
    Moderator asesinato is offline
    ModeratorRank
    Aug 2014 Join Date
    612Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Approved. Good luck with your development.

  3. #3
    C# Programmer Jax is offline
    True MemberRank
    Dec 2009 Join Date
    1,073Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Good luck my friend - this will be your magnum opus

  4. #4
    Demi-god. Dominic is offline
    SubscriberRank
    Aug 2012 Join Date
    DenmarkLocation
    568Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Good luck bro! Welcome back! :3

  5. #5
    Banned rafa95123 is offline
    BannedRank
    May 2009 Join Date
    /home/RaphaLocation
    566Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Good Luck man! Good to see you back :D

  6. #6
    Platina endorser SeanRog is offline
    True MemberRank
    Nov 2009 Join Date
    1,019Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Interesting.

    But didn't you receive a C&D?

  7. #7
    PENTAKILL! Alozi is offline
    True MemberRank
    Nov 2014 Join Date
    SwedenLocation
    446Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Good luck with this!

  8. #8
    Death from above! The General is offline
    The OmegaRank
    Aug 2011 Join Date
    8,805Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    First line says minimizing memory leaks, first example given already has 3 memory leaks.

    I don't have much hope for this.

    PS: John broke his neck.
    If you are using Arcturus, contact me
    Skype: wesley.jabbo
    Discord: TheGeneral#0063

  9. #9
    Demi-god. Dominic is offline
    SubscriberRank
    Aug 2012 Join Date
    DenmarkLocation
    568Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by The General View Post
    First line says minimizing memory leaks, first example given already has 3 memory leaks.

    I don't have much hope for this.

    PS: John broke his neck.
    Teach us master! Where is these memory leaks?

  10. #10
    Death from above! The General is offline
    The OmegaRank
    Aug 2011 Join Date
    8,805Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by Dominic View Post
    Teach us master! Where is these memory leaks?
    Not spoonfeeding. I've done (most) things all by myself with little suggestions. He'll figure it out if he ever gets to the point where he runs out of memory which, if he continues to work like this, is pretty soon.
    If you are using Arcturus, contact me
    Skype: wesley.jabbo
    Discord: TheGeneral#0063

  11. #11
    Demi-god. Dominic is offline
    SubscriberRank
    Aug 2012 Join Date
    DenmarkLocation
    568Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by The General View Post
    Not spoonfeeding. I've done (most) things all by myself with little suggestions. He'll figure it out if he ever gets to the point where he runs out of memory which, if he continues to work like this, is pretty soon.
    Not even close to spoonfeeding, but suit yourself

  12. #12
    Platina endorser SeanRog is offline
    True MemberRank
    Nov 2009 Join Date
    1,019Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by The General View Post
    Not spoonfeeding. I've done (most) things all by myself with little suggestions. He'll figure it out if he ever gets to the point where he runs out of memory which, if he continues to work like this, is pretty soon.
    You can not argue with no arguments.

    Says itself.

  13. #13
    C# Programmer Jax is offline
    True MemberRank
    Dec 2009 Join Date
    1,073Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by The General View Post
    First line says minimizing memory leaks, first example given already has 3 memory leaks.

    I don't have much hope for this.

    PS: John broke his neck.
    Is it due to the fact that he isn't disposing the memory after use?

  14. #14
    Death from above! The General is offline
    The OmegaRank
    Aug 2011 Join Date
    8,805Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by Jax View Post
    Is it due to the fact that he isn't disposing the memory after use?
    Thats what memory leaks are...
    If you are using Arcturus, contact me
    Skype: wesley.jabbo
    Discord: TheGeneral#0063

  15. #15
    C# / Java Programmer scottstamp851 is offline
    True MemberRank
    Jan 2007 Join Date
    EverywhereLocation
    521Posts

    re: Icarus Server (Production) - [Python, Multi-DB/MySQL]

    Quote Originally Posted by The General View Post
    Thats what memory leaks are...
    He's releasing objects after use, the GC handles disposal afterwards. This code is fine.


    Sent from my iPhone using Tapatalk
    hayhay.




Page 1 of 20 12345678911 ... LastLast

Advertisement