[PLUS][FEATURE] Staff Chat

Velaski

winner
Aug 4, 2015
562
165
Found this on the rival forum and I see a lot of people requesting it.

1. Go to UserDataFactory.cs

Change
PHP:
 return new UserData(UserId, Achievements, favouritedRooms, ignores, badges, friends, requests, rooms, quests, user, Relationships);

to
PHP:
if (user.Rank >= 6) //Change it to the minimum rank you want
            friends.Add(0x7fffffff, new MessengerBuddy(0x7fffffff, "Staff Chat", "hr-831-45.fa-1206-91.sh-290-1331.ha-3129-100.hd-180-2.cc-3039-73.ch-3215-92.lg-270-73", "Solo Staffs", 0, true, false));
            return new UserData(UserId, Achievements, favouritedRooms, ignores, badges, friends, requests, rooms, quests, user, Relationships);

2. Go to SendMsgEvent.cs and replace everything with
PHP:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.Communication.Packets.Outgoing.Messenger;

namespace Plus.Communication.Packets.Incoming.Messenger
{
    class SendMsgEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null)
                return;

            int userId = Packet.PopInt();
            if (userId == 0 || userId == Session.GetHabbo().Id)
                return;

            string message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
            if (string.IsNullOrWhiteSpace(message))
                return;


            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendNotification("Oops, you're currently muted - you cannot send messages.");
                return;
            }

            if (userId == 0x7fffffff)
            {

                PlusEnvironment.GetGame().GetClientManager().StaffAlert(new NewConsoleMessageComposer(0x7fffffff, Session.GetHabbo().Username + ": " + message), Session.GetHabbo().Id);
                return;
            }


            Session.GetHabbo().GetMessenger().SendInstantMessage(userId, message);

        }
    }
}

3.Finally, go to BuddyListComposer.cs and replace everything with:
PHP:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Plus.HabboHotel.Users;
using Plus.HabboHotel.Users.Messenger;
using Plus.HabboHotel.Users.Relationships;

namespace Plus.Communication.Packets.Outgoing.Messenger
{
    class BuddyListComposer : ServerPacket
    {
        public BuddyListComposer(ICollection<MessengerBuddy> Friends, Habbo Player)
            : base(ServerPacketHeader.BuddyListMessageComposer)
        {
            base.WriteInteger(1);
            base.WriteInteger(0);

            base.WriteInteger(Friends.Count);
            foreach (MessengerBuddy Friend in Friends.ToList())
            {
                if (Friend.Id == 0x7fffffff)
                {
                    base.WriteInteger(0x7fffffff);
                    base.WriteString(Friend.mUsername);
                    base.WriteInteger(1);//Gender.
                    base.WriteBoolean(true);
                    base.WriteBoolean(Friend.InRoom);
                    base.WriteString(Friend.mLook);
                    base.WriteInteger(0); // category id
                    base.WriteString(string.Empty);
                    base.WriteString(string.Empty);//Alternative name?
                    base.WriteString(string.Empty);
                    base.WriteBoolean(true);
                    base.WriteBoolean(false);
                    base.WriteBoolean(false);//Pocket Habbo user.
                    base.WriteShort(0);


                }
                else
                {
                Relationship Relationship = Player.Relationships.FirstOrDefault(x => x.Value.UserId == Convert.ToInt32(Friend.UserId)).Value;

                base.WriteInteger(Friend.Id);
               base.WriteString(Friend.mUsername);
                base.WriteInteger(1);//Gender.
                base.WriteBoolean(Friend.IsOnline);
                base.WriteBoolean(Friend.IsOnline && Friend.InRoom);
               base.WriteString(Friend.IsOnline ? Friend.mLook : string.Empty);
                base.WriteInteger(0); // category id
               base.WriteString(Friend.IsOnline ? Friend.mMotto : string.Empty);
               base.WriteString(string.Empty);//Alternative name?
               base.WriteString(string.Empty);
                base.WriteBoolean(true);
                base.WriteBoolean(false);
                base.WriteBoolean(false);//Pocket Habbo user.
                base.WriteShort(Relationship == null ? 0 : Relationship.Type);
                }
            }
        }
    }
}
Not even sure if it works but hopefully it does.
I take no credit for this, found it on the rival forum.
 

Etrion

?
Dec 22, 2016
108
32
It works but why re-release it?
It's already released everywhere and credz to french community :p

PS: Why didn't you just give them group chat? :confused:
 

Velaski

winner
Aug 4, 2015
562
165
It works but why re-release it?
It's already released everywhere and credz to french community :p

PS: Why didn't you just give them group chat? :confused:
What do you mean re-release it? I'm making accessible to people on Devbest. I can give them the group chats later on when I actually finish it.
 

Joe

Well-Known Member
Jun 10, 2012
4,172
1,955
It works nicely, just wondering if this can be tweaked so you can see their username and avatar like in a normal chat - just multiple people can talk, like a group chat.
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
434
647
It works nicely, just wondering if this can be tweaked so you can see their username and avatar like in a normal chat - just multiple people can talk, like a group chat.
Can indeed, the username and avatar only works for <=0. And since there is no group with the id of 0 you can set that as staff chat. Which is what I've done on my server.
 

dominic

Active Member
Dec 16, 2011
175
84
Can indeed, the username and avatar only works for <=0. And since there is no group with the id of 0 you can set that as staff chat. Which is what I've done on my server.
So if chat id = 0 avatars would be present?
 

Simba2002

Member
Dec 8, 2015
38
2
I have set the rank on 4. My people with rank 2 and 3 see not the staff chat. Get also the blue icon and can open it. How can i fix this?
 

Kak

Posting Freak
Apr 21, 2017
951
165
im using the latest plusemu where is Sendmsgevent.cs? all i see is Messengereventtypes.cs is this possibly it? i know this thread was made with the older emulator but will this still work on the newest one?
 

Anglo

New Member
Jun 19, 2017
24
13
im using the latest plusemu where is Sendmsgevent.cs? all i see is Messengereventtypes.cs is this possibly it? i know this thread was made with the older emulator but will this still work on the newest one?
By latest PlusEMU you mean..? You could of downloaded it from anywhere, however did you even attempt to read the code you was supplied? It says "namespace Plus.Communication.Packets.Incoming.Messenger" so go into your Communication Folder, Packets folder and so on until you reach SendMsgEvent.cs
 

Kak

Posting Freak
Apr 21, 2017
951
165
By latest PlusEMU you mean..? You could of downloaded it from anywhere, however did you even attempt to read the code you was supplied? It says "namespace Plus.Communication.Packets.Incoming.Messenger" so go into your Communication Folder, Packets folder and so on until you reach SendMsgEvent.cs
latest emu as in the last one released by sledmore? it doesnt really matter where i downloaded it its the same but thanks for the second part
 

Users who are viewing this thread

Top