[BcStorm][Add-On] Preferred speech bubble
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 Code:
internal void Chat(GameClient Session, string Message, bool Shout, int TextColor = 0)
Replace the hole void with:
PHP Code:
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 :)
Re: [BcStorm][Add-On] Preferred speech bubble
Re: [BcStorm][Add-On] Preferred speech bubble
You should cache it LOL but nice job :P
[BcStorm][Add-On] Preferred speech bubble
Didn't look at it real close but does it do that query every time someone says something?
Sent from my BlackBerry 9800 using Tapatalk
Re: [BcStorm][Add-On] Preferred speech bubble
Quote:
Originally Posted by
leenster
Didn't look at it real close but does it do that query every time someone says something?
Sent from my BlackBerry 9800 using Tapatalk
No. Only when you loaded the room ;).
Re: [BcStorm][Add-On] Preferred speech bubble
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 ?
Re: [BcStorm][Add-On] Preferred speech bubble
Quote:
Originally Posted by
PremiumEye
No. Only when you loaded the room ;).
Every time someone chats. Not when the room is loaded.
http://i.imgur.com/UAPgNXe.png
[BcStorm][Add-On] Preferred speech bubble
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.
Sent from my BlackBerry 9800 using Tapatalk
Re: [BcStorm][Add-On] Preferred speech bubble
Hmm.. I thought it would load when you it's loading the room..
I will fix that ;).
Verstuurd van mijn GT-I9000 met Tapatalk
Quote:
Originally Posted by
leenster
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.
Sent from my BlackBerry 9800 using Tapatalk
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
Re: [BcStorm][Add-On] Preferred speech bubble
Will this make chat bubbles only selectable to VIP?
Re: [BcStorm][Add-On] Preferred speech bubble
Quote:
Originally Posted by
BoomHotel
Will this make chat bubbles only selectable to VIP?
That's ready coded in the swf's :)
Verstuurd van mijn GT-I9000 met Tapatalk
Re: [BcStorm][Add-On] Preferred speech bubble
Quote:
Originally Posted by
PremiumEye
That's ready coded in the swf's :)
Verstuurd van mijn GT-I9000 met Tapatalk
I mean to the other type of VIP the people who purchased it?
Re: [BcStorm][Add-On] Preferred speech bubble
Quote:
Originally Posted by
BoomHotel
I mean to the other type of VIP the people who purchased it?
Oh no.. than you have to add the gethabbo().rank call
Verstuurd van mijn GT-I9000 met Tapatalk
Re: [BcStorm][Add-On] Preferred speech bubble
Great release. Will use if you fix it up.