BrickEmulator [C#] Pooling Sockets + From Scratch

Page 35 of 38 FirstFirst ... 25272829303132333435363738 LastLast
Results 511 to 525 of 558
  1. #511
    Account Upgraded | Title Enabled! wichard is offline
    MemberRank
    Jul 2009 Join Date
    The NetherlandsLocation
    649Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Commands progress:

    Code:
                Handlers[new KeyValuePair<string, string>("pickall", "Pick all items in room.")] = new KeyValuePair<Handler, int>(new Handler(PickAll), 1);
                Handlers[new KeyValuePair<string, string>("about", "Shows an messagebox with server info.")] = new KeyValuePair<Handler, int>(new Handler(AboutMessage), 1);
                Handlers[new KeyValuePair<string, string>("commands", "Shows an messagebox with a list of commands.")] = new KeyValuePair<Handler, int>(new Handler(Commands), 1);
    
                Handlers[new KeyValuePair<string, string>("mute", "<username> <seconds in time> - mutes specifique user.")] = new KeyValuePair<Handler, int>(new Handler(Mute), 2);
                Handlers[new KeyValuePair<string, string>("unmute", "<username> - unmutes specifique user.")] = new KeyValuePair<Handler, int>(new Handler(UnMute), 2);
    
                Handlers[new KeyValuePair<string, string>("refresh_items", "Refreshes all base-items.")] = new KeyValuePair<Handler, int>(new Handler(RefreshItems), 7);
                Handlers[new KeyValuePair<string, string>("refresh_catalogue", "Refreshes all catalogue items.")] = new KeyValuePair<Handler, int>(new Handler(RefreshCatalogue), 7);
                Handlers[new KeyValuePair<string, string>("refresh_navigator", "Refreshes all Feactured items.")] = new KeyValuePair<Handler, int>(new Handler(RefreshNavigator), 7);
                Handlers[new KeyValuePair<string, string>("ha", "<message> - broadcast notif.")] = new KeyValuePair<Handler, int>(new Handler(HotelAlert), 7);
                Handlers[new KeyValuePair<string, string>("effect", "<effectid> - enables specifique effect.")] = new KeyValuePair<Handler, int>(new Handler(Effect), 7);


    - Generates command list from cache, o text

    Code:
            private void Commands(Client Client, List<string> Params)
            {
                StringBuilder Commands = new StringBuilder();
    
                Commands.AppendLine(string.Format("BrickEmulator [C#] ~ Commands : Rank [{0}]", Client.GetUser().Rank));
    
                foreach (KeyValuePair<KeyValuePair<string, string>, KeyValuePair<Handler, int>> kvp in Handlers)
                {
                    if (Client.GetUser().Rank >= kvp.Value.Value)
                    {
                        Commands.Append(string.Format(" :{0} {1}\r", kvp.Key.Key, kvp.Key.Value));
                    }
                }
    
                Client.LongNotif(Commands);
            }


    ---------- Post added at 03:30 PM ---------- Previous post was at 03:06 PM ----------

    Code:
            private void Summon(Client Client, List<string> Params)
            {
                if (Params.Count != 1)
                {
                    Client.Notif("Failed to summon user " + GetParams("summon"), false);
                    return;
                }
    
                string Username = Params[0];
    
                int HabboId = BrickEngine.GetUserReactor().GetId(Username);
    
                if (HabboId <= 0)
                {
                    Client.Notif(string.Format("User {0} not found in database/cache.", Username), false);
                    return;
                }
    
                if (!BrickEngine.GetUserReactor().IsOnline(HabboId))
                {
                    Client.Notif(string.Format("User {0} is offline.", Username), false);
                    return;
                }
    
                int CurrentRoomId = Client.GetUser().RoomId;
    
                if (CurrentRoomId <= 0)
                {
                    Client.Notif("You have to be in a room.", false);
                    return;
                }
    
                Client Target = BrickEngine.GetSocketShield().GetSocketClientByHabboId(HabboId).GetClient();
    
                Target.Notif(string.Format("You have been summoned by {0}.", Client.GetUser().Username), true);
    
                BrickEngine.GetPacketHandler().BeginLoadRoom(Target, CurrentRoomId, string.Empty);
    
                VirtualRoomUser TargetUser = Client.GetUser().GetRoom().GetRoomEngine().GetUserByHabboId(HabboId);
                VirtualRoomUser MyUser = Client.GetUser().GetRoomUser();
    
                if (TargetUser != null && MyUser != null)
                {
                    TargetUser.UnhandledGoalPoint = MyUser.FontPoint;
                }
            }

  2. #512
    Account Upgraded | Title Enabled! AWA is offline
    MemberRank
    Feb 2008 Join Date
    1,320Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Now that the newest swf is cracked, are you going to support the new binary change to the protocol? (I'm talking about what you said you cracked)

  3. #513
    Account Upgraded | Title Enabled! wichard is offline
    MemberRank
    Jul 2009 Join Date
    The NetherlandsLocation
    649Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Commands builded:

    Code:
                Handlers[new KeyValuePair<string, string>("pickall", "Pick all items in room.")] = new KeyValuePair<Handler, int>(new Handler(PickAll), 1);
                Handlers[new KeyValuePair<string, string>("about", "Shows an messagebox with server info.")] = new KeyValuePair<Handler, int>(new Handler(AboutMessage), 1);
                Handlers[new KeyValuePair<string, string>("commands", "Shows an messagebox with a list of commands.")] = new KeyValuePair<Handler, int>(new Handler(Commands), 1);
    
                Handlers[new KeyValuePair<string, string>("mute", "<username> <seconds in time> - mutes specifique user.")] = new KeyValuePair<Handler, int>(new Handler(Mute), 2);
                Handlers[new KeyValuePair<string, string>("unmute", "<username> - unmutes specifique user.")] = new KeyValuePair<Handler, int>(new Handler(UnMute), 2);
    
                Handlers[new KeyValuePair<string, string>("muteroom", "<seconds in time> - mutes all room visitors.")] = new KeyValuePair<Handler, int>(new Handler(MuteRoom), 5);
                Handlers[new KeyValuePair<string, string>("unmuteroom", "un-mutes all room visitors.")] = new KeyValuePair<Handler, int>(new Handler(UnMuteRoom), 5);
    
                Handlers[new KeyValuePair<string, string>("givepixels", "<username> <amount> give specifique user pixels.")] = new KeyValuePair<Handler, int>(new Handler(GivePixels), 5);
                Handlers[new KeyValuePair<string, string>("givecredits", "<username> <amount> give specifique user credits.")] = new KeyValuePair<Handler, int>(new Handler(GiveCredits), 5);
    
                Handlers[new KeyValuePair<string, string>("ha", "<message> - broadcast notif.")] = new KeyValuePair<Handler, int>(new Handler(HotelAlert), 6);
                Handlers[new KeyValuePair<string, string>("givebadge", "<username> <badgecode> give specifique user a badge.")] = new KeyValuePair<Handler, int>(new Handler(GiveBadge), 6);
                Handlers[new KeyValuePair<string, string>("ipban", "<username> <reason> - ipban specifique user.")] = new KeyValuePair<Handler, int>(new Handler(IPBan), 6);
    
                Handlers[new KeyValuePair<string, string>("refresh_items", "Refreshes all base-items.")] = new KeyValuePair<Handler, int>(new Handler(RefreshItems), 7);
                Handlers[new KeyValuePair<string, string>("refresh_catalogue", "Refreshes all catalogue items.")] = new KeyValuePair<Handler, int>(new Handler(RefreshCatalogue), 7);
                Handlers[new KeyValuePair<string, string>("refresh_navigator", "Refreshes all Feactured items.")] = new KeyValuePair<Handler, int>(new Handler(RefreshNavigator), 7);
                Handlers[new KeyValuePair<string, string>("effect", "<effectid> - enables specifique effect.")] = new KeyValuePair<Handler, int>(new Handler(Effect), 7);
                Handlers[new KeyValuePair<string, string>("summon", "<username> - sends user to your room and in font of you.")] = new KeyValuePair<Handler, int>(new Handler(Summon), 7);
    
                Handlers[new KeyValuePair<string, string>("broadcastcredits", "<amount> give every online user credits.")] = new KeyValuePair<Handler, int>(new Handler(BroadcastCredits), 7);
                Handlers[new KeyValuePair<string, string>("broadcastpixels", "<amount> give every onlien user pixels.")] = new KeyValuePair<Handler, int>(new Handler(BroadcastPixels), 7);
                Handlers[new KeyValuePair<string, string>("broadcastbadge", "<badgecode> give every online user a badge.")] = new KeyValuePair<Handler, int>(new Handler(BroadcastBadge), 7);
    
                Handlers[new KeyValuePair<string, string>("teleport", "you're lazy, you don't have to walk.")] = new KeyValuePair<Handler, int>(new Handler(Teleport), 7);
                Handlers[new KeyValuePair<string, string>("unloadroom", "<roomid> unload current room or specifique room.")] = new KeyValuePair<Handler, int>(new Handler(UnloadRoom), 7);

  4. #514
    GreenMaX keven007 is offline
    MemberRank
    Jul 2008 Join Date
    The NetherlandsLocation
    275Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Good job bro

  5. #515
    Account Upgraded | Title Enabled! wichard is offline
    MemberRank
    Jul 2009 Join Date
    The NetherlandsLocation
    649Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Quote Originally Posted by AWA View Post
    Now that the newest swf is cracked, are you going to support the new binary change to the protocol? (I'm talking about what you said you cracked)
    Maby, i dunno.

  6. #516
    The Legend Returns vista4life is offline
    MemberRank
    Mar 2007 Join Date
    The NetherlandsLocation
    843Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Quote Originally Posted by matty13 View Post
    Make a global message handler and message composer handler (if you want to do it that way) then initialize all handlers into a global handler which takes the parameters Session and Client Messages.

    Then route all users through the global handler when an incoming message comes in, don't use any locking as this will kill performance on anything globally accessed!!! and don't share any global variables inside the handler classes, this will cause race condition errors.

    I store all events on server bootup into a dictionary and access them by header packet ids.

    Code:
    public void HandleEvent(uint HeaderId, Session Session, ClientMessage Message)
            {
                IMessageEvent Event;
                if (_Events.TryGetValue(HeaderId, out Event))
                {
                    if (!Session.Authenticated && HeaderId != 206 & HeaderId != 415)
                    {
                        Console.Write("Un-authed packet received " + HeaderId);
                        return;
                    }
    
                    Event.Parse(Session, Message);
                }
                else
                {
                }
            }
    My code still needs finishing and cleaning up, but that is just a quick example.

    Anything inside the "Parse" function of Events is thread-safe as each Thread aka connected user/session creates its own stack, so it is thread-safe and extremely quick. Quick because events are accessed by index id's aka the header id's.

    So that is basically it :-)

    euh... Respect thanks for this :)!

  7. #517
    Custom Title Enabled James is offline
    LegendRank
    Jan 2007 Join Date
    DenverLocation
    2,288Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Quote Originally Posted by AWA View Post
    THat's what I'm trying to say!

    BTW Breakz0ne, fix that packet injection I used to send alerts with.

    To fix it all you have to do is convert all the bytes to bits :P

  8. #518
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Uhm, Is this server side or client side bug ;3


    YES image is fucked, But watch the dragon ;3, It slides


  9. #519
    Account Upgraded | Title Enabled! wichard is offline
    MemberRank
    Jul 2009 Join Date
    The NetherlandsLocation
    649Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Code:
        interface IFurniTrigger
        {
            void OnPlace(Item Item, VirtualRoomUser User);
            void OnUpdate(Item Item, VirtualRoomUser User);
            void OnRemove(Item Item, VirtualRoomUser User);
            void OnPointInteract(Item Item, VirtualRoomUser User);
            void OnTrigger(int TriggerId, Item Item, VirtualRoomUser User);
        }

  10. #520
    Lurking since '06 1ntel is offline
    MemberRank
    Jul 2006 Join Date
    401Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    You need to remove the 5 socket listeners idea, its very silly.

  11. #521
    Account Upgraded | Title Enabled! wichard is offline
    MemberRank
    Jul 2009 Join Date
    The NetherlandsLocation
    649Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Quote Originally Posted by matty13 View Post
    You need to remove the 5 socket listeners idea, its very silly.
    Ok stop, I DONT USE 5 SOCKETLISTNERS!

  12. #522
    this is title Shredinator is offline
    MemberRank
    May 2011 Join Date
    399Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Quote Originally Posted by matty13 View Post
    You need to remove the 5 socket listeners idea, its very silly.
    If you haven't seen the code; stfu.

  13. #523
    Lurking since '06 1ntel is offline
    MemberRank
    Jul 2006 Join Date
    401Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Quote Originally Posted by Shredinator View Post
    If you haven't seen the code; stfu.


    First one.

  14. #524
    this is title Shredinator is offline
    MemberRank
    May 2011 Join Date
    399Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    "Up to"

    but, I see your point.

  15. #525
    Account Upgraded | Title Enabled! wichard is offline
    MemberRank
    Jul 2009 Join Date
    The NetherlandsLocation
    649Posts

    Re: BrickEmulator [C#] Pooling Sockets + From Scratch

    Quote Originally Posted by Shredinator View Post
    "Up to"

    but, I see your point.
    its outdaet you fools. Read the whole thread.



Advertisement