Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[BcStorm][Add-On] Preferred speech bubble

Status
Not open for further replies.
Developer
Joined
Nov 26, 2011
Messages
509
Reaction score
81
Hey people!
I'm coming with a cute add-on for your BcStorm emulator!
It's a add-on for you cms and client.

You have to script the settings page on you own to set the preferred speech bubble style! (Make this page only available for vip users)

First you have to do something in you database.
Add in the table users a field called: speech_bubble_prefer with type = int and length = 5 (for sure)

Go to you emulator source. Go to RoomUser.cs
We're going to replace a hole internal void.

Search for the void:
PHP:
internal void Chat(GameClient Session, string Message, bool Shout, int TextColor = 0)

Replace the hole void with:
PHP:
internal void Chat(GameClient Session, string Message, bool Shout, int TextColor = 0)
        {
            if (TextColor > 0 && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip") || TextColor > 22)
            {
                TextColor = 0;
                Session.SendNotif("You must be vip to use this chat bubble styles.");
            }

            if (((Session == null) || (Session.GetHabbo().Rank >= 5)) || !this.GetRoom().RoomMuted)
            {

                this.Unidle();
                if (!this.IsPet && !this.IsBot)
                {

                    ServerMessage message;
                    Habbo habbo = this.GetClient().GetHabbo();

                    if (TextColor == 0)
                    {
                        if (!habbo.GetSubscriptionManager().HasSubscription("habbo_vip"))
                        {
                            if (habbo.Rank > 5)
                            {
                                TextColor = 2;
                            }
                            else
                            {
                                TextColor = 0;
                            }
                        }
                        else
                        {
                            using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                            {
                                adapter.setQuery("SELECT speech_bubble_prefer FROM users WHERE username = '" + habbo.Username + "'");
                                DataRow row = adapter.getRow();
                                if ((int)row[0] == 0)
                                {
                                    if (habbo.Rank > 5)
                                    {
                                        TextColor = 2;
                                    }
                                    else
                                    {
                                        TextColor = 0;
                                    }
                                }
                                else
                                {
                                    TextColor = (int)row["speech_bubble_prefer"];
                                }
                            }
                        }
                    }

                    if (habbo.Muted)
                    {
                        this.GetClient().SendNotif("Jij bent gemuted.");
                        return;
                    }
                    if ((Message.StartsWith(":") && (Session != null)) && ChatCommandRegister.IsChatCommand(Message.Split(new char[] { ' ' })[0].ToLower().Substring(1)))
                    {
                        ChatCommandHandler handler = new ChatCommandHandler(Message.Split(new char[] { ' ' }), Session);
                        if (handler.WasExecuted())
                        {
                            Logging.LogMessage(string.Format("User {0} issued command {1}", this.GetUsername(), Message));
                            if (Session.GetHabbo().Rank > 5)
                            {
                                ButterflyEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Chat command", string.Format("Issued chat command {0}", Message));
                            }
                            return;
                        }
                    }
                    uint rank = 1;
                    Message = LanguageLocale.FilterSwearwords(Message);
                    if ((Session != null) && (Session.GetHabbo() != null))
                    {
                        rank = Session.GetHabbo().Rank;
                    }
                    TimeSpan span = (TimeSpan)(DateTime.Now - habbo.spamFloodTime);
                    if ((span.TotalSeconds > habbo.spamProtectionTime) && habbo.spamProtectionBol)
                    {
                        this.FloodCount = 0;
                        habbo.spamProtectionBol = false;
                        habbo.spamProtectionAbuse = 0;
                    }
                    else if (span.TotalSeconds > 4.0)
                    {
                        this.FloodCount = 0;
                    }
                    if ((span.TotalSeconds < habbo.spamProtectionTime) && habbo.spamProtectionBol)
                    {
                        message = new ServerMessage(Outgoing.FloodFilter);
                        int i = habbo.spamProtectionTime - span.Seconds;
                        message.AppendInt32(i);
                        this.GetClient().SendMessage(message);
                        if (ButterflyEnvironment.spamBans)
                        {
                            habbo.spamProtectionAbuse++;
                            GameClient clientByUsername = ButterflyEnvironment.GetGame().GetClientManager().GetClientByUsername(Session.GetHabbo().Username);
                            if (habbo.spamProtectionAbuse >= ButterflyEnvironment.spamBans_limit)
                            {
                                ButterflyEnvironment.GetGame().GetBanManager().BanUser(clientByUsername, "SPAM*ABUSE", 800.0, LanguageLocale.GetValue("flood.banmessage"), false);
                            }
                            else
                            {
                                clientByUsername.SendNotif(LanguageLocale.GetValue("flood.pleasewait").Replace("%secs%", Convert.ToString(i)));
                            }
                        }
                        return;
                    }
                    if (((span.TotalSeconds < 4.0) && (this.FloodCount > 5)) && (rank < 5))
                    {
                        message = new ServerMessage(Outgoing.FloodFilter);
                        habbo.spamProtectionCount++;
                        if ((habbo.spamProtectionCount % 2) == 0)
                        {
                            habbo.spamProtectionTime = 10 * habbo.spamProtectionCount;
                        }
                        else
                        {
                            habbo.spamProtectionTime = 10 * (habbo.spamProtectionCount - 1);
                        }
                        habbo.spamProtectionBol = true;
                        message.AppendInt32((int)(habbo.spamProtectionTime - span.Seconds));
                        this.GetClient().SendMessage(message);
                        return;
                    }
                    habbo.spamFloodTime = DateTime.Now;
                    this.FloodCount++;
                    if (!this.IsBot)
                    {
                        ChatMessage message2 = new ChatMessage(Session.GetHabbo().Id, Session.GetHabbo().Username, this.mRoom.RoomId, this.mRoom.Name, this.mRoom.IsPublic, Message, DateTime.Now);
                        Session.GetHabbo().GetChatMessageManager().AddMessage(message2);
                        this.mRoom.GetChatMessageManager().AddMessage(message2);
                    }
                }

                InvokedChatMessage message3 = new InvokedChatMessage(this, Message, Shout, TextColor);
                this.GetRoom().QueueChatMessage(message3);
            }
        }

And you're done!

Little list of the added functions in it:

- If you aren't vip you can't use chat bubble styles (for people who are having these by accident)
- If your TextColor is 0, you have no vip and your rank is above the 5, you'll get TextColor 2. If your rank is below the 5 you'll get TextColor 0.
- If your TextColor is 0, you have vip, your chosen TextColor is 0 and your rank is above the 5. You'll get 2. If your rank is below the 5 you'll get TextColor 0.
- If you TextColor is 0, you have vip, your chosen TextColor isn't 0. You'll get your chosen TextColor.

This little thing is very easy to edit.

You'll get more add-on's! Even I will look for some fixes :)
 
[̲̅$̲̅(̲̅1̲̅)̲̅$ ̲̅]
Joined
May 4, 2008
Messages
831
Reaction score
741
Didn't look at it real close but does it do that query every time someone says something?

 
Initiate Mage
Joined
Jan 7, 2012
Messages
65
Reaction score
17
Can you not do other ones, and not only pet chat and Bot chat, cant you do one of the chats that you can choose when your VIP ?
 
Last edited:
Developer
Developer
Joined
Dec 11, 2010
Messages
2,956
Reaction score
2,683
No. Only when you loaded the room ;).

Every time someone chats. Not when the room is loaded.

UAPgNXe - [BcStorm][Add-On] Preferred speech bubble - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
[̲̅$̲̅(̲̅1̲̅)̲̅$ ̲̅]
Joined
May 4, 2008
Messages
831
Reaction score
741
That's what I thought. It would be better to load this with the user data when a user logs in. If you want a user to be able to change it while they are logged in you could write a rcon command for them to be able to do that.

I like the idea but the way you did it is hard on your db when there are many users online.

 
Developer
Joined
Nov 26, 2011
Messages
509
Reaction score
81
Hmm.. I thought it would load when you it's loading the room..

I will fix that ;).

Verstuurd van mijn GT-I9000 met Tapatalk

That's what I thought. It would be better to load this with the user data when a user logs in. If you want a user to be able to change it while they are logged in you could write a rcon command for them to be able to do that.

I like the idea but the way you did it is hard on your db when there are many users online.

I like your idea too. But if I should make a new command than it's again in the client. Why should people use a command to change their preferred speech bubble if they also can click on it? Nobody would use it.

I made this little cute add-on for you settingspage on your cms to fill the page. I thought most of the settingspages are quite empty.

And this add-on is coded very fast. So I didn't looked at it very close. I will fix it and release it. Then it loads when you are loging in.

Verstuurd van mijn GT-I9000 met Tapatalk
 
Experienced Elementalist
Joined
Oct 17, 2008
Messages
293
Reaction score
64
Will this make chat bubbles only selectable to VIP?
 
[̲̅$̲̅(̲̅1̲̅)̲̅$ ̲̅]
Joined
May 4, 2008
Messages
831
Reaction score
741
I like your idea too. But if I should make a new command than it's again in the client. Why should people use a command to change their preferred speech bubble if they also can click on it? Nobody would use it.


What I mean that if people change their preferred speech bubble through the website than you could could use a mus/rcon command to update it the client.
 
Developer
Joined
Nov 26, 2011
Messages
509
Reaction score
81
What I mean that if people change their preferred speech bubble through the website than you could could use a mus/rcon command to update it the client.

Never thought about it. I like it ;). I keep it in mind.
 
Status
Not open for further replies.
Back
Top