[FIX][SWIFT] Group Purchase - Database spamming and more [EDITED][FIX]

Results 1 to 7 of 7
  1. #1
    Member Japaojp is offline
    MemberRank
    Nov 2011 Join Date
    BrazilLocation
    95Posts

    [FIX][SWIFT] Group Purchase - Database spamming and more [EDITED][FIX]

    Hey,
    I see a old fix for the same problem of Leenster for BcStorm -> Link Here

    But it don't work in swift, and I have adaptaded it. With this simple fix, you don't need to reconnect to see your new group and you will not have exceptions when you buy a group to a room what are you not inside. Let's do this:

    Go to /Butterfly/Messages/GameClientMessageHandler.cs and find:
    Code:
    public void BuyGroup()
    Replace ALL VOID for:
    Code:
    public void BuyGroup()
            {
                if ((this.Session != null) && (this.Session.GetHabbo().Credits >= 10))
                {
                    List<int> gStates = new List<int>();
                    string name = this.Request.PopFixedString();
                    string description = this.Request.PopFixedString();
                    int roomid = this.Request.PopWiredInt32();
                    int color = this.Request.PopWiredInt32();
                    int num3 = this.Request.PopWiredInt32();
                    this.Request.PopWiredInt32();
                    int guildBase = this.Request.PopWiredInt32();
                    int guildBaseColor = this.Request.PopWiredInt32();
                    int num6 = this.Request.PopWiredInt32();
    
                    for (int i = 0; i < (num6 * 3); i++)
                    {
                        int item = this.Request.PopWiredInt32();
                        gStates.Add(item);
                    }
    
                    string image = ButterflyEnvironment.GetGame().GetGuilds().GenerateGuildImage(guildBase, guildBaseColor, gStates);
                    string htmlColor = ButterflyEnvironment.GetGame().GetGuilds().GetHtmlColor(color);
                    string str5 = ButterflyEnvironment.GetGame().GetGuilds().GetHtmlColor(num3);
                    string datecreated = DateTime.Now.ToShortDateString();
    
                    int id = (int)this.Session.GetHabbo().Id;
    
                    string username = this.Session.GetHabbo().Username;
    
                    Dictionary<int, string> members = new Dictionary<int, string>();
                    members.Add(id, DateTime.Now.Day + " - " + DateTime.Now.Month + " -  " + DateTime.Now.Year);
    
                    Room room = ButterflyEnvironment.GetGame().GetRoomManager().LoadRoom((uint)roomid);
    
                    if (room != null)
                    {
                        MyGuild guild = ButterflyEnvironment.GetGame().GetGuilds().AddGuild(0, name, id, username, description, roomid, image, color, num3, guildBase, guildBaseColor, gStates, htmlColor, str5, datecreated, members, new List<int>(), 0, 0);
    
                        room.GroupId = guild.Id;
                        room.GenerateGuild(guild);
                        room.RoomData.GroupId = guild.Id;
    
                        this.Session.GetHabbo().ImGuilds.Add(guild.Id);
                        this.Session.GetHabbo().FavoriteGuild = guild.Id;
    
                        using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                        {
                            adapter.runFastQuery(string.Concat(new object[] { "UPDATE users SET FavoriteGroup = '", guild.Id, "' WHERE Id = '", guild.OwnerId, "'" }));
                            adapter.runFastQuery(string.Concat(new object[] { "INSERT INTO user_groups VALUES (NULL, '", this.Session.GetHabbo().Username, "','", this.Session.GetHabbo().Id, "','", guild.Id, "','", DateTime.Now.Day, " - ", DateTime.Now.Month, " -  ", DateTime.Now.Year, "', '0')" }));
                            adapter.runFastQuery(string.Concat(new object[] { "INSERT INTO user_stream VALUES (NULL, '", this.Session.GetHabbo().Id, "','", ButterflyEnvironment.LinkConfig, guild.Image, ".gif','10','", guild.Id, "','0','')" }));
                        }
    
                        ServerMessage message = new ServerMessage(Outgoing.SerializePurchaseInformation);
    
                        message.AppendInt32(0x1815);
                        message.AppendString("CREATE_GUILD");
                        message.AppendInt32(10);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendBoolean(true);
                        message.AppendInt32(0);
                        message.AppendInt32(2);
                        message.AppendBoolean(false);
    
                        this.Session.SendMessage(message);
    
                        Habbo habbo = this.Session.GetHabbo();
                        habbo.Credits -= 10;
    
                        this.Session.GetHabbo().UpdateCreditsBalance();
    
                        ServerMessage message2 = new ServerMessage(Outgoing.SendHtmlColors);
                        message2.AppendInt32(this.Session.GetHabbo().ImGuilds.Count);
    
                        foreach (int num10 in this.Session.GetHabbo().ImGuilds)
                        {
                            MyGuild guild2 = ButterflyEnvironment.GetGame().GetGuilds().GetGuild(num10);
                            message2.AppendInt32(guild2.Id);
                            message2.AppendString(guild2.Name);
                            message2.AppendString(guild2.Image);
                            message2.AppendString(guild2.HtmlColor1);
                            message2.AppendString(guild2.HtmlColor2);
                            message2.AppendBoolean(guild2.Id == Session.GetHabbo().FavoriteGuild);
                        }
    
                        this.Session.SendMessage(message2);
    
                        if ((ButterflyEnvironment.GetGame().GetClientManager().GetClient(habbo.Id) != null) && (room != null))
                        {
                            ServerMessage message3 = new ServerMessage(Outgoing.SetRoomUser);
                            message3.AppendInt32(1);
                            room.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Id).Serialize(message3, false);
    
                            room.SendMessage(message3);
                        }
    
                        ServerMessage message4 = new ServerMessage(Outgoing.UpdateRoom);
                        message4.AppendInt32(guild.RoomId);
                        this.Session.SendMessage(message4);
    
                        ServerMessage message5 = new ServerMessage(Outgoing.ConfigureWallandFloor);
                        message5.AppendBoolean(room.Hidewall);
                        message5.AppendInt32(room.WallThickness);
                        message5.AppendInt32(room.FloorThickness);
                        this.Session.SendMessage(message5);
    
                        ServerMessage message6 = new ServerMessage(Outgoing.SendRoomAndGroup);
                        message6.AppendInt32(guild.RoomId);
                        message6.AppendInt32(guild.Id);
                        this.Session.SendMessage(message6);
    
                        ServerMessage message7 = new ServerMessage(Outgoing.RoomData);
                        message7.AppendBoolean(true);
                        message7.AppendInt32(guild.RoomId);
                        message7.AppendString(room.Name);
                        message7.AppendBoolean(true);
                        message7.AppendInt32(room.OwnerId);
                        message7.AppendString(room.Owner);
                        message7.AppendInt32(room.State);
                        message7.AppendInt32(room.UsersNow);
                        message7.AppendInt32(room.UsersMax);
                        message7.AppendString(room.Description);
                        message7.AppendInt32(0);
                        message7.AppendInt32((room.Category == 0x34) ? 2 : 0);
                        message7.AppendInt32(room.Score);
                        message7.AppendInt32(0);
                        message7.AppendInt32(room.Category);
    
                        if (room.GetRoomGuild() == null)
                        {
                            message7.AppendInt32(0);
                            message7.AppendInt32(0);
                        }
                        else
                        {
                            message7.AppendInt32(guild.Id);
                            message7.AppendString(guild.Name);
                            message7.AppendString(guild.Image);
                        }
    
                        message7.AppendString("");
                        message7.AppendInt32(room.TagCount);
    
                        foreach (string str8 in room.Tags.ToArray())
                        {
                            message7.AppendString(str8);
                        }
    
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendBoolean(true);
                        message7.AppendBoolean(true);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendBoolean(false);
                        message7.AppendBoolean(false);
                        message7.AppendBoolean(false);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendBoolean(false);
                        message7.AppendBoolean(true);
    
                        room.SendMessage(message7);
                    }
                }
            }
    Remember: This fix is only for SWIFT AKIIX Edition revision 5+

    Credits:
    -Leenster for the original code
    -Japaojp (me) to adapt it and correct some bugs

    EDITED

    I found another bug. When you buy a group, it give automatic rights to any person who join. Just execute this SQL and your problem is solved:
    Code:
    ALTER TABLE  `groups` CHANGE  `RightsType`  `RightsType` INT( 11 ) NOT NULL DEFAULT  '1'
    Credits:
    - Japaojp (me)


    Done :)
    LIKE and REP+
    Last edited by Japaojp; 15-11-13 at 02:51 AM. Reason: New fixes


  2. #2
    C# Developer neto737 is offline
    MemberRank
    Oct 2010 Join Date
    Environment.csLocation
    274Posts

    Re: [FIX][SWIFT] Group Purchase - Database spamming and more [FIX]

    Thanks brow!

  3. #3
    Account Upgraded | Title Enabled! Marceline is offline
    MemberRank
    Oct 2012 Join Date
    Guess.Location
    228Posts

    Re: [FIX][SWIFT] Group Purchase - Database spamming and more [FIX]

    Thank you! :)

  4. #4
    LETS REACH 666 POSTS?!!!! ImNotSatan is offline
    MemberRank
    Apr 2013 Join Date
    google.devLocation
    573Posts

    Re: [FIX][SWIFT] Group Purchase - Database spamming and more [FIX]

    wasnt this already fixed?

  5. #5
    Member Japaojp is offline
    MemberRank
    Nov 2011 Join Date
    BrazilLocation
    95Posts

    Re: [FIX][SWIFT] Group Purchase - Database spamming and more [FIX]

    Quote Originally Posted by ImNotSatan View Post
    wasnt this already fixed?
    How did I say, not in Swift Emulator.

    Ty guys :)

  6. #6
    LETS REACH 666 POSTS?!!!! ImNotSatan is offline
    MemberRank
    Apr 2013 Join Date
    google.devLocation
    573Posts

    Re: [FIX][SWIFT] Group Purchase - Database spamming and more [EDITED][FIX]

    I can buy groups w/o reloading? And without this fix o.o?


    Tapatalk.

  7. #7
    Apprentice YeahhSmile is offline
    MemberRank
    Jul 2013 Join Date
    MaasmechelenLocation
    9Posts

    Re: [FIX][SWIFT] Group Purchase - Database spamming and more [EDITED][FIX]

    Can you fix the bus questions maybe? But, Nice! Thanks



Advertisement