EventAlert Command doesn't work

Twister

New Member
May 24, 2015
29
1
Hello DevBest,
I install new PRODUCTION-201802201205-141713395 on PlusEmuR2 and I try to fixe EventAlertCommand. But she doesn't work, when I execute this commande on the client nothing is coming.
This is my EventCommand.cs
Code:
using Plus.Communication.Packets.Outgoing.Moderation;
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.GameClients;
using System;
using System.Linq;
namespace Plus.HabboHotel.Rooms.Chat.Commands.Events
{
    internal class EventAlertCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get
            {
                return "command_event_alert";
            }
        }
        public string Parameters
        {
            get
            {
                return "";
            }
        }
        public string Description
        {
            get
            {
                return "Permet d'envoyer une alerte concernant les animations.";
            }
        }
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Merci d'entrer un message pour l'évenement a annoncer exemple d'utilisation de la commande :eventha message");
                return;
            }

            string Message = CommandManager.MergeParams(Params, 1);
            PlusEnvironment.GetGame().GetClientManager().SendPacket(new RoomNotificationComposer("Messages des animateurs", "Une nouvelle animation se déroule chez <b> " + Room.OwnerName + "</b>.\n\nDépêche toi de participer avan que l'appart ne soit fermé ! Clique sur le bouton <b><i> Aller dans l'appart</i></b> pour participer à l'animation. \n\n" + "Plus de détails :<b> " + Message + "</b>\n\n", "evento", "Aller dans l'appart", "event:navigator/goto/" + Session.GetHabbo().CurrentRoom.RoomId));

        }
    }
}

and the code of RoomNotificationComposer.cs
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

namespace Plus.Communication.Packets.Outgoing.Rooms.Notifications
{
    class RoomNotificationComposer : ServerPacket
    {
        public RoomNotificationComposer(string Title, string Message, string Image, string HotelName = "", string HotelURL = "")
            : base(ServerPacketHeader.RoomNotificationMessageComposer)
        {
            base.WriteString(Image);
            base.WriteInteger(string.IsNullOrEmpty(HotelName) ? 2 : 4);
            base.WriteString("title");
            base.WriteString(Title);
            base.WriteString("message");
            base.WriteString(Message);

            if (!string.IsNullOrEmpty(HotelName))
            {
                base.WriteString("linkUrl");
                base.WriteString(HotelURL);
                base.WriteString("linkTitle");
                base.WriteString(HotelName);
            }
        }

        public RoomNotificationComposer(string Type, string Key, string Value)
            : base(ServerPacketHeader.RoomNotificationMessageComposer)
        {
            base.WriteString(Type);
            base.WriteInteger(1);//Count
            {
                base.WriteString(Key);//Type of message
                base.WriteString(Value);
            }
        }

        public RoomNotificationComposer(string type, Dictionary<string, string> dataDict)
            : base(ServerPacketHeader.RoomNotificationMessageComposer)
        {
            base.WriteString(type);

            // Assumed 'count' of key-value pairs is equal to num keys.
            // Hopefully no one puts a null value.
            base.WriteInteger(dataDict.Keys.Count);

            foreach (KeyValuePair<string, string> dictPair in dataDict)
            {
                base.WriteString(dictPair.Key);
                base.WriteString(dictPair.Value);
            }
        }

        public static ServerPacket SendBubble(string image, string message, string linkUrl = "")
        {
            var bubbleNotification = new ServerPacket(ServerPacketHeader.RoomNotificationMessageComposer);
            bubbleNotification.WriteString(image);
            bubbleNotification.WriteInteger(string.IsNullOrEmpty(linkUrl) ? 2 : 3);
            bubbleNotification.WriteString("display");
            bubbleNotification.WriteString("BUBBLE");
            bubbleNotification.WriteString("message");
            bubbleNotification.WriteString(message);
            if (string.IsNullOrEmpty(linkUrl)) return bubbleNotification;
            bubbleNotification.WriteString("linkUrl");
            bubbleNotification.WriteString(linkUrl);
            return bubbleNotification;
        }

        public RoomNotificationComposer(string Type)
            : base(ServerPacketHeader.RoomNotificationMessageComposer)
        {
            base.WriteString(Type);
            base.WriteInteger(0);//Count
        }

    }
}

My packet for RoomNotificationMessageComposer -> 2940

Thnks for your help
Have a good day

PS: I have see my AboutCommand doesn't work. I think the problem come RoomNotificationComposer
 

Pollak

Active Member
Oct 12, 2017
161
51
Try this:
Code:
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Rooms.Engine;
using System.Linq;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Events
{
    internal class EventAlertCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get
            {
                return "command_event_alert";
            }
        }
        public string Parameters
        {
            get
            {
                return "%message%";
            }
        }
        public string Description
        {
            get
            {
                return "Envoyer une alerte d'événement";
            }
        }
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            if (Session != null)
            {
                if (Room != null)
                {
                    if (Params.Length == 1)
                    {
                        Session.SendWhisper("S'il vous plaît entrer un message à envoyer.");
                        return;
                    }
                    foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
                        if (client.GetHabbo().AllowEvents == true)
                        {
                            string Message = CommandManager.MergeParams(Params, 1);

                            client.SendMessage(new RoomNotificationComposer("Un événement se produit!",
                                 "Il y a un nouveau jeu joué par le personnel! <br><br>Ceci est destiné à fournir plus de divertissement pour les utilisateurs!<br><br>Événement:<b>  " + Message +
                                 "</b><br>Par:<b>  " + Session.GetHabbo().Username +
                                 "</b> <br><br>Si vous voulez participer, cliquez sur le bouton ci-dessous! <br><br>Si vous ne souhaitez pas être averti des événements, entrez cette commande<b>  :alertes</b> !",
                                 "events", "Participar do Evento", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
                        }
                        else
                            client.SendWhisper("On dirait qu'il y a un nouvel événement dans notre hôtel. Pour réactiver les messages d'événement, tapez ;alertes", 1);

                }
            }
        }
    }
}
 

c4353b8e

New Member
May 26, 2018
20
8
Without looking at your code too much, I would guess it's something to do with RoomNotificationComposer, since you said it stopped working after a revision change? ( Can you verify that, it wasn't 100% clear. ) Check your logs, and make sure that composer has the correct packet structure and header.

You can also try a different method overload, you have many constructors in that class, make sure you're calling the right one. I think this is just a simple mistake that you haven't yet noticed.
 

Twister

New Member
May 24, 2015
29
1
Any packet errors in your log file?
No, my logs are empty.

Try this:
Code:
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Rooms.Engine;
using System.Linq;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Events
{
    internal class EventAlertCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get
            {
                return "command_event_alert";
            }
        }
        public string Parameters
        {
            get
            {
                return "%message%";
            }
        }
        public string Description
        {
            get
            {
                return "Envoyer une alerte d'événement";
            }
        }
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            if (Session != null)
            {
                if (Room != null)
                {
                    if (Params.Length == 1)
                    {
                        Session.SendWhisper("S'il vous plaît entrer un message à envoyer.");
                        return;
                    }
                    foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
                        if (client.GetHabbo().AllowEvents == true)
                        {
                            string Message = CommandManager.MergeParams(Params, 1);

                            client.SendMessage(new RoomNotificationComposer("Un événement se produit!",
                                 "Il y a un nouveau jeu joué par le personnel! <br><br>Ceci est destiné à fournir plus de divertissement pour les utilisateurs!<br><br>Événement:<b>  " + Message +
                                 "</b><br>Par:<b>  " + Session.GetHabbo().Username +
                                 "</b> <br><br>Si vous voulez participer, cliquez sur le bouton ci-dessous! <br><br>Si vous ne souhaitez pas être averti des événements, entrez cette commande<b>  :alertes</b> !",
                                 "events", "Participar do Evento", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
                        }
                        else
                            client.SendWhisper("On dirait qu'il y a un nouvel événement dans notre hôtel. Pour réactiver les messages d'événement, tapez ;alertes", 1);

                }
            }
        }
    }
}
I will try but I'm sur it's not my command because before she work and my AboutCommand doesn't work and it's compose with the same RoomNotificationComposer method

Without looking at your code too much, I would guess it's something to do with RoomNotificationComposer, since you said it stopped working after a revision change? ( Can you verify that, it wasn't 100% clear. ) Check your logs, and make sure that composer has the correct packet structure and header.

You can also try a different method overload, you have many constructors in that class, make sure you're calling the right one. I think this is just a simple mistake that you haven't yet noticed.
I have take the packet on DevBest here

And yes I check it's the right method who is call.
 
Up please :s
 
I have resolve my probleme, it's packet errreur
In this subject RoomNotificationMessage it's not good

The good id is on this subject
 

Users who are viewing this thread

Top