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 Emulator Fixes & tweaks thread

Status
Not open for further replies.
Master Summoner
Joined
Jan 20, 2011
Messages
512
Reaction score
163
BC storm fixes Thread​


First of all this isn't a help thread so don't post for help here

Well the official bcstorm thread was overloading with post and it was hard to find fixes so here you go


Text colors exploit fix by =dj.matias= :
I found one exploit on text colors: You can crash all room clients, when you send too big text color id to emulator (No validating) (Text colors ids 0-22)

You can fix it add it to right place (Needs small edit):
Code:
if (Color > 0 && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip") || Color > 22)
            {
                Color = 0;
            }


exploits in guilds by jonty :
Exploit fix in guilds, easy fix though to fix alot of exploits;

Open Butterfly/ButterflyEnvironment.cs, add this to the top of your script:

PHP:
using System.Text.RegularExpressions;
then find

PHP:
internal static string FilterInjectionChars(string Input, bool AllowLinebreaks)
{
      return Input;
}
and replace it with

Code:
 internal static string FilterInjectionChars(string Input, bool AllowLinebreaks)
        {
            if (Input == null)
            {
                return null;
            }


            return Regex.Replace(Input, @"[\r\n\x00\x1a\\'""]", @"\$0");
        }

more guilds fix by jonty
We're going to be working on this and will probably release the fix.

Guilds.cs fix:

And in GameClientMessageHandler.cs, find;

PHP:
public void EditIdentidad()

and replace that void with

Code:
public void EditIdentidad()
        {
            int guildId = this.Request.PopWiredInt32();
            string str = this.Request.PopFixedString();
            string str2 = this.Request.PopFixedString();
            MyGuild guild = ButterflyEnvironment.GetGame().GetGuilds().GetGuild(guildId);
            if (guild != null)
            {
                Room room = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom((uint) guild.RoomId);
                if (room != null)
                {
                    guild.Name = str;
                    guild.Description = str2;
                    using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                    {
                        adapter.runFastQuery(string.Concat(new object[] { "UPDATE groups SET Name = '", ButterflyEnvironment.FilterInjectionChars(guild.Name), "', Description = '", ButterflyEnvironment.FilterInjectionChars(guild.Description), "' WHERE Id = '", guild.Id, "'" }));
                    }
                    this.SaveSettingsPackets(guild, room);
                }
            }
        }

# Marketplace Fix by rafa95123:
# Marketplace Fix
Whe you try to buy anything of MarketPlace, you can't buy!
It's simple.. search for:

PHP:
 Incoming.MarketplacePurchase

And replace with:

PHP:
Incoming.MarketplacePurchase = 3693;

And now you can buy the items of MarketPlace!

Cya,


Profile fix by durex
Lets fix the profile, online and account created ect..
Look for internal void LoadProfile() in GameClientMessageHandler.cs

Add above this:
PHP:
        public static DateTime UnixTimeStampToDateTime(double unixTimeStamp)
        {
            System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
            dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime();
            return dtDateTime;
        }

Then replace the whole LoadProfile() with:
PHP:
        internal void LoadProfile()
        {
            try
            {
                int num = this.Request.PopWiredInt32();
                bool flag = this.Request.PopWiredBoolean();
                Habbo habbo = ButterflyEnvironment.getHabboForId((uint) num);
                if (habbo == null)
                {
                    Console.WriteLine("can't get data por profile with userid = " + num);
                }
                else
                {
                    DataRow Info;
                    using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                    {
                        adapter.setQuery("SELECT `reg_timestamp` FROM `user_info` WHERE user_id = '" + habbo.Id + "'");
                        Info = adapter.getRow();
                    }
                    TimeSpan span = (TimeSpan) (DateTime.Now - Convert.ToDateTime(habbo.LastOnline));
                    List<MyGuild> list = new List<MyGuild>();
                    foreach (int num2 in habbo.ImGuilds)
                    {
                        MyGuild item = ButterflyEnvironment.GetGame().GetGuilds().GetGuild(num2);
                        if (!((item == null) || list.Contains(item)))
                        {
                            list.Add(item);
                        }
                    }
                    this.Response.Init(Outgoing.ProfileInformation);
                    this.Response.AppendInt32(habbo.Id);
                    this.Response.AppendString(habbo.Username);
                    this.Response.AppendString(habbo.Look);
                    this.Response.AppendString(habbo.Motto);
                    this.Response.AppendString(UnixTimeStampToDateTime((double)Info["reg_timestamp"]).ToShortDateString());
                    this.Response.AppendInt32(habbo.AchievementPoints);
                    this.Response.AppendInt32(habbo.GetMessenger().myFriends);
                    this.Response.AppendBoolean(habbo.Id != this.Session.GetHabbo().Id);
                    this.Response.AppendBoolean(false);
                    this.Response.AppendBoolean(ButterflyEnvironment.GetGame().GetClientManager().GetClientByUserID(habbo.Id) != null);
                    this.Response.AppendInt32(list.Count);
                    foreach (MyGuild guild2 in list)
                    {
                        this.Response.AppendInt32(guild2.Id);
                        this.Response.AppendString(guild2.Name);
                        this.Response.AppendString(guild2.Image);
                        this.Response.AppendString(guild2.HtmlColor1);
                        this.Response.AppendString(guild2.HtmlColor2);
                        this.Response.AppendBoolean(habbo.FavoriteGuild == guild2.Id);
                    }
                    this.Response.AppendInt32((int) span.TotalSeconds);
                    this.Response.AppendBoolean(true);
                    this.SendResponse();
                }
            }
            catch
            {
            }
        }

Also there are some images you don't have, look attachments! [Put the map in C_images!]

Ma Ma - Bcstorm Emulator Fixes & tweaks thread - RaGEZONE Forums



Jukebox fix by Bjork
I would too but I believe it's in the swf.

So i do some test for jukebox:

I added this on TextHandling.cs under "internal static int Parse":

Code:
internal static int Parse2(string a) // Come from R63A BF
        {
            int w = 0, i = 0, length = a.Length, k;

            if (length == 0)
                return 0;

            do
            {
                k = a[i++];
                if (k < 48 || k > 59)
                    return 0;
                w = 10 * w + k - 48;
            }
            while (i < length);

            return w;
        }

And i replace All Parse to Parse2 on "public SongItem(UserItem item)" (on SongItem.cs) and "public static ServerMessage SerializeSongInventory(Hashtable songs) (on JukeboxDiscksComposer.cs)"

The Jukebox works but i'm not a coder so i don't know if it's good...


Push and pull command fix by zjordan
I will contribute my fixes in a few hours, I'm just looking for exploits.

EDIT:

Okay a fix for the push and pull, and I've got more to come, this is just what is "clean enough" right now.
*This is not tested, I believe it should work if not there is minimal changes to be done to make it work.

Find internal void push() in ChatCommandHandler.cs and replace the entire void with this.
PHP:
internal void push()
        {
            Room room = Session.GetHabbo().CurrentRoom;
            if (room == null)
                return;

            RoomUser roomuser = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (roomuser == null)
                return;

            if (Params.Length == 1)
            {

                Point squareInfront = CoordinationUtil.GetPointInFront(roomuser.Coordinate, roomuser.RotBody);
                List<RoomUser> users = room.GetGameMap().GetRoomUsers(squareInfront);

                Point squareInFrontOfUserInFront = CoordinationUtil.GetPointInFront(squareInfront, roomuser.RotBody);
                if (room.GetGameMap().CanWalk(squareInFrontOfUserInFront.X, squareInFrontOfUserInFront.Y, false) == false)
                {
                    return;
                }

                foreach (RoomUser user in users)
                {
                    user.MoveTo(squareInFrontOfUserInFront);
                }
            }
            else
            {
                RoomUser roomuserTarget = room.GetRoomUserManager().GetRoomUserByHabbo(Params[1]);
                if (roomuserTarget == null)
                    return;

                Point furtherstSquare = CoordinationUtil.GetPointBehind(roomuserTarget.Coordinate, roomuserTarget.RotBody);

                Point a = new Point(furtherstSquare.X, furtherstSquare.Y++);
                if (CoordinationUtil.GetDistance(furtherstSquare, a) > CoordinationUtil.GetDistance(furtherstSquare, roomuserTarget.Coordinate))
                    furtherstSquare = a;

                Point b = new Point(furtherstSquare.X, furtherstSquare.Y--);
                if (CoordinationUtil.GetDistance(furtherstSquare, b) > CoordinationUtil.GetDistance(furtherstSquare, roomuserTarget.Coordinate))
                    furtherstSquare = b;

                Point c = new Point(furtherstSquare.X++, furtherstSquare.Y);
                if (CoordinationUtil.GetDistance(furtherstSquare, c) > CoordinationUtil.GetDistance(furtherstSquare, roomuserTarget.Coordinate))
                    furtherstSquare = c;

                Point d = new Point(furtherstSquare.X--, furtherstSquare.Y++);
                if (CoordinationUtil.GetDistance(furtherstSquare, d) > CoordinationUtil.GetDistance(furtherstSquare, roomuserTarget.Coordinate))
                    furtherstSquare = d;

                Point e = new Point(furtherstSquare.X++, furtherstSquare.Y--);
                if (CoordinationUtil.GetDistance(furtherstSquare, e) > CoordinationUtil.GetDistance(furtherstSquare, roomuserTarget.Coordinate))
                    furtherstSquare = e;

                Point f = new Point(furtherstSquare.X--, furtherstSquare.Y);
                if (CoordinationUtil.GetDistance(furtherstSquare, f) > CoordinationUtil.GetDistance(furtherstSquare, roomuserTarget.Coordinate))
                    furtherstSquare = f;

                roomuserTarget.MoveTo(furtherstSquare);
            }
        }
pull
*This is also not tested
PHP:
internal void pull()
        {
            Room room = Session.GetHabbo().CurrentRoom;
            if (room == null)
                return;


            RoomUser roomuser = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (roomuser == null)
                return;

            if (Params.Length == 1)
            {
                Point squareInFront = CoordinationUtil.GetPointInFront(roomuser.Coordinate, roomuser.RotBody);
                Point squareInFrontInFront = CoordinationUtil.GetPointBehind(squareInFront, CoordinationUtil.RotationIverse(roomuser.RotBody));
                List<RoomUser> users = room.GetGameMap().GetRoomUsers(squareInFrontInFront);

                foreach (RoomUser user in users)
                {
                    user.MoveTo(squareInFront);
                }
            }
            else
            {
                RoomUser roomuserTarget = room.GetRoomUserManager().GetRoomUserByHabbo(Params[1]);
                if (roomuserTarget == null)
                    return;

                Point closestSquare = CoordinationUtil.GetPointBehind(roomuserTarget.Coordinate, roomuserTarget.RotBody);

                Point a = new Point(closestSquare.X, closestSquare.Y++);
                if (CoordinationUtil.GetDistance(closestSquare, a) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                    closestSquare = a;

                Point b = new Point(closestSquare.X, closestSquare.Y--);
                if (CoordinationUtil.GetDistance(closestSquare, b) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                    closestSquare = b;

                Point c = new Point(closestSquare.X++, closestSquare.Y);
                if (CoordinationUtil.GetDistance(closestSquare, c) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                    closestSquare = c;

                Point d = new Point(closestSquare.X--, closestSquare.Y++);
                if (CoordinationUtil.GetDistance(closestSquare, d) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                    closestSquare = d;

                Point e = new Point(closestSquare.X++, closestSquare.Y--);
                if (CoordinationUtil.GetDistance(closestSquare, e) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                    closestSquare = e;

                Point f = new Point(closestSquare.X--, closestSquare.Y);
                if (CoordinationUtil.GetDistance(closestSquare, f) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                    closestSquare = f;

                roomuserTarget.MoveTo(closestSquare);
                }
            }

And I'm preparing the other fixes.


Trick for staff chatbubble by mininova & durex
Ok :D

Code:
Search for:
InvokedChatMessage message3 = new InvokedChatMessage(this, Message, Shout, TextColor);

Add BEFORE:
                if (Session.GetHabbo().GetBadgeComponent().BadgeHasSlot("ADM"))
                {
                    InvokedChatMessage messageadm = new InvokedChatMessage(this, Message, Shout, 1); //COULD BE 2, too
                    this.GetRoom().QueueChatMessage(messageadm);
                    return;
                }


Search for:
internal void RemoveBadge(string Badge)

Add after this Function:
        internal bool BadgeHasSlot(string Badge)
        {
                foreach (Badge badge in this.Badges.Values)
                {
                    if (badge.Code == Badge && badge.Slot != 0)
                    {
                        return true;
                    }
                }
                return false;
        }

Small but Cool Function :)
Now I start helping with Important Fixes :)


and another one added by durex
Why so complicated? also a little fix to use the other bubbles!

Code:
                if (TextColor == 0 && Session.GetHabbo().GetBadgeComponent().BadgeHasSlot("ADM"))
                {
                    TextColor = 1; // 1 for exclamation mark OR 2 for Bot
                }

You can do it with ranks that is much easier i think?, you can also create a command to disable and enable...
Code:
Search for:
InvokedChatMessage message3 = new InvokedChatMessage(this, Message, Shout, TextColor);

Add BEFORE:
                if (TextColor == 0 && Session.GetHabbo().Rank == 7 || Session.GetHabbo().Rank == 6)
                {
                    TextColor = 1; // 1 for exclamation mark OR 2 for Bot
                }


Diamonds fixed by mininova
Diamonds ;):

Code:
Search for:
internal int ActivityPoints;

Add after:
internal int Crystals;

Search for:
internal Habbo(uint Id, string Username, string RealName, uint Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, double LastActivityPointsUpdate, bool Muted, uint HomeRoom, int Respect, int DailyRespectPoints, int DailyPetRespectPoints, bool MutantPenalty, bool HasFriendRequestsDisabled, DataRow groupRow, int achievementPoints, string LastOnline, string quests, string queststates, bool canchangename, int favoriteGroup, bool PassedQuiz, int pointsOnline)
        {

Edit to:
        internal Habbo(uint Id, string Username, string RealName, uint Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int Crystals, double LastActivityPointsUpdate, bool Muted, uint HomeRoom, int Respect, int DailyRespectPoints, int DailyPetRespectPoints, bool MutantPenalty, bool HasFriendRequestsDisabled, DataRow groupRow, int achievementPoints, string LastOnline, string quests, string queststates, bool canchangename, int favoriteGroup, bool PassedQuiz, int pointsOnline)
        {

Search for:
this.ActivityPoints = ActivityPoints;

Add after:
this.Crystals = Crystals;


Search for:
        internal void UpdateActivityPointsBalance(int NotifAmount)
        {

Edit Function to:
        internal void UpdateActivityPointsBalance(int NotifAmount)
        {
            if (((this.mClient != null) && (this.mClient.GetMessageHandler() != null)) && (this.mClient.GetMessageHandler().GetResponse() != null))
            {
                this.mClient.GetMessageHandler().GetResponse().Init(Outgoing.ActivityPoints);
                this.mClient.GetMessageHandler().GetResponse().AppendInt32(2);
                this.mClient.GetMessageHandler().GetResponse().AppendInt32(0);
                this.mClient.GetMessageHandler().GetResponse().AppendInt32(this.ActivityPoints);
                this.mClient.GetMessageHandler().GetResponse().AppendInt32(105);
                this.mClient.GetMessageHandler().GetResponse().AppendInt32(this.Crystals);
                this.mClient.GetMessageHandler().SendResponse();
            }
        }

Search for:
return new Habbo(id, username, realName, rank, motto, look, gender, credits, activityPoints, lastActivityPointsUpdate, muted, homeRoom, respect, dailyRespectPoints, dailyPetRespectPoints, mutantPenalty, hasFriendRequestsDisabled, group, achievementPoints, lastOnline, quests, queststates, canchangename, favoriteGroup, passedQuiz, (int) dRow["points_online"]);

Edit to:
return new Habbo(id, username, realName, rank, motto, look, gender, credits, activityPoints, (int)dRow["crystals"], lastActivityPointsUpdate, muted, homeRoom, respect, dailyRespectPoints, dailyPetRespectPoints, mutantPenalty, hasFriendRequestsDisabled, group, achievementPoints, lastOnline, quests, queststates, canchangename, favoriteGroup, passedQuiz, (int) dRow["points_online"]);


Edit:
Now it works, it was 105 ;)


Stream user images fix by leenster
Fix for stream images:

First add this to your htaccess
PHP:
RewriteRule ^habbo-imaging/head/([^/]+) /habbo-imaging/head.php?figure=$1

In GameClientMessageHandler.cs find
PHP:
if (((int) row["Type"]) == 0)
                {
                    message.AppendString("http://habteen.com/heads/look.gif");
                }

Replace that with
PHP:
if (((int)row["Type"]) == 0)
                {
                    string im = ButterflyEnvironment.StreamLink + ButterflyEnvironment.GetGame().GetClientManager().GetLookById(Convert.ToUInt32(row["FriendId"])) + ".gif";
                    message.AppendString((string)im);
                }

In GameClientManager.cs find

PHP:
private void GiveAllOnlineCredits(int amount)

Above that add
PHP:
internal string GetLookById(uint Id)
        {
            using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                adapter.setQuery("SELECT look FROM users WHERE id = " + Id);
                return adapter.getString();
            }
        }


In Habbo-Imaging create a file called head.php and put this PHP code in there
PHP:
<?php
header('Content-Type: image/gif');

$figure = str_replace(".gif","",$_GET['figure']);
$url = 'http://habbo.com/habbo-imaging/avatarimage?figure='.$figure;

$image = imagecreatetruecolor(64, 60);
imagealphablending($image, false);
$col=imagecolorallocatealpha($image,255,255,255,127);
imagefilledrectangle($image,0,0,485, 500,$col);
imagealphablending($image,true);

$img_avatar = imagecreatefrompng($url);
imagecopyresampled($image, $img_avatar, 0, 0, 0, 0, 64, 60, 64, 60);
imagealphablending($image,true);

$fn = md5(microtime()."head").".png";

imagealphablending($image,false);
imagesavealpha($image,true);

imagepng($image);
imagedestroy($image);

?>

In your emulator configuration
PHP:
stream.link=http://YOUR_URL/habbo-imaging/avatarimage.php?figure=

Ma Ma - Bcstorm Emulator Fixes & tweaks thread - RaGEZONE Forums

IF you're gonna post only post fixes in the thread , if you need help go here http://forum.ragezone.com/f333/offical-bcstorm-help-thread-902373/
 
Developer
Member
Joined
Jul 28, 2009
Messages
983
Reaction score
133
Pretty much fixes, thanks for this.
Would be nice if someone included all the fixes into 1 server.
 
Junior Spellweaver
Joined
Oct 5, 2012
Messages
114
Reaction score
34
Nice fix's 10/10

Uhm, how to hide IP in Bcstorm?

And how to change hotelview?


Help please.
 
Zephyr Studios
Member
Joined
Feb 18, 2012
Messages
1,877
Reaction score
724
Wow! Really nice. Thanks! ;)
 
Initiate Mage
Joined
Dec 12, 2009
Messages
90
Reaction score
5
Do you have a fix for Snowstorm because snowstorm doesn't load.

Snowstorm aren't coded.

On-topic: Can anyone fix these issues and then release the fixed version? I would appreciate it! :eek:)
 
Developer
Member
Joined
Jul 28, 2009
Messages
983
Reaction score
133
I dont understand why you are all so desperate when there are obviously more important bugs which still need fixing..?
Adding new features = Funn
Fixing Stuff = Boring.
 
Initiate Mage
Joined
Jan 2, 2013
Messages
96
Reaction score
3
Please post where you can find the files.
I mean Butterfly/ButterflyEnvironment.cs etc.

I don't know where can I find it.
 
Experienced Elementalist
Joined
Feb 19, 2012
Messages
287
Reaction score
23
Please post where you can find the files.
I mean Butterfly/ButterflyEnvironment.cs etc.

I don't know where can I find it.

Just search at the search bar
 
Status
Not open for further replies.
Back
Top