NuxMessageAlert welcome message tutorial

Maatt

Active Member
Aug 29, 2012
162
158
Hello all,

As promised here is a tutorial for adding a welcome message to your hotel like the one below, this is for Plus Hotels running PRODUCTION-201701242205-837386173. Please note, if you are running any other build you will need to finder the packet header id that is specific to your build to make this work. I use Plus R2, but I've had a glance over of R1 and I don't see any reason why this won't work. If you have issues reply below and ill try and find a solution.

You must be registered for see images attach

  1. In the first instance, I strongly advise that you update your URL Rewrite rules (if you haven't done so already) as this will fix the other help boxes in your client (those for the navigator and the chat bar). To do that, post the following rules into your wwwroot/web.config file and then restart your IIS. For this to work, you will need to paste the rules above the </rules> tag in the XML but below any other rules (</rule> tag). Note that the text file location needs to correspond with your SWF pack.

    Code:
                    <rule name="habbopages2">                    <match url="^swfs/gamedata/habbopages/chat/([^/]+)" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Rewrite" url="/swfs/gamedata/habbopages/chat/{R:1}.txt" appendQueryString="false" />
                    </rule>
                    <rule name="habbopages">
                        <match url="^swfs/gamedata/habbopages/([^/]+)" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Rewrite" url="/swfs/gamedata/habbopages/{R:1}.php" appendQueryString="false" />
                    </rule>

    N.B. For NGINX hotels this will be different. You'll need to convert the rewrite rules and put them in your NGINX.CONF file and then restart your NGINX. Unfortunately, I don't have an NGINX set up to test this on so you will need to figure out the rules yourself. If you're adept enough to use NGINX in production this won't be too difficult.

  2. Go into your swfs habbopages folder and create a file, call it welcome.txt - this will be the HTML content for your alert.

  3. Open your emulator source in Visual Studio. Create a new class in Communication/Packets/Outgoing/Notifications and call it NuxAlertComposer.cs replace its content with the packet structure below:

    Code:
    using System;using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Plus.Communication.Packets.Outgoing.Notifications
    {
        class NuxAlertComposer : ServerPacket
        {
            public NuxAlertComposer(string Message)
                : base(ServerPacketHeader.NuxAlertComposer)
            {
                base.WriteString(Message);
            }
        }
    }

  4. Go into ServerPacketHeader.cs and find:

    Code:
    public const int MOTDNotificationMessageComposer = 1368;

    paste the following directly below it:

    Code:
    public const int NuxAlertComposer = 2954;

  5. Now, go into GameClient.cs and look for the user.login.message enabled/mod_tools initialiser, below it paste the following;

    Code:
    SendPacket(new NuxAlertComposer("habbopages/welcome");

    by default, this will cache and therefore, your welcome message will not update until you clear your cache or your cache expires. If you want this to be more dynamic you can simply append a unix timestamp to the query string like so:

    Code:
    SendPacket(new NuxAlertComposer("habbopages/welcome?" + DateTimeOffset.UtcNow.ToUnixTimeSeconds()));

  6. Now compile your emulator and restart it and all being well you will see your welcome message.

BONUS TIPS:

You can tie this into your CMS, if you like, to create a more personalized, powerful welcome message with your site news etc. I'm using RevCMS and I use the following rewrite rule and a page in my skin folder to achieve this, you can edit this for your CMS:

Code:
                 <rule name="habbopages-welcome">
                    <match url="^swfs/gamedata/habbopages/welcome" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="Rewrite" url="index.php?url=welcome" appendQueryString="false" />
                </rule>


Thank you to those who helped me fix this in the first place :)
 

Users who are viewing this thread

Top