public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int   GroupId = Packet.PopInt();
            Group Group   = null;

            if (!RavenEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group))
            {
                return;
            }
            if (Group.CreatorId != Session.GetHabbo().Id)
            {
                return;
            }
            int    Count = Packet.PopInt();
            string Badge = "";

            for (int i = 0; i < Count; i++)
            {
                Badge += BadgePartUtility.WorkBadgeParts(i == 0, Packet.PopInt().ToString(), Packet.PopInt().ToString(), Packet.PopInt().ToString());
            }
            Group.Badge = (string.IsNullOrWhiteSpace(Badge) ? "b05114s06114" : Badge);
            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `groups` SET `badge` = @badge WHERE `id` = @groupId LIMIT 1");
                dbClient.AddParameter("badge", Group.Badge);
                dbClient.AddParameter("groupId", Group.Id);
                dbClient.RunQuery();
            }
            Session.SendMessage(new GroupInfoComposer(Group, Session));
        }
Exemple #2
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket packet)
        {
            string word;
            string Name = packet.PopString();

            Name = CloudServer.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Name, out word) ? "Spam" : Name;
            string Description = packet.PopString();

            Description = CloudServer.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Description, out word) ? "Spam" : Description;
            int RoomId  = packet.PopInt();
            int Colour1 = packet.PopInt();
            int Colour2 = packet.PopInt();
            int Unknown = packet.PopInt();

            int groupCost = Convert.ToInt32(CloudServer.GetGame().GetSettingsManager().TryGetValue("catalog.group.purchase.cost"));

            if (Session.GetHabbo().Credits < groupCost)
            {
                Session.SendMessage(new BroadcastMessageAlertComposer("Um grupo custa " + groupCost + " creditos! E você tem " + Session.GetHabbo().Credits + "!"));
                return;
            }
            else
            {
                Session.GetHabbo().Credits -= groupCost;
                Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
            }

            RoomData Room = CloudServer.GetGame().GetRoomManager().GenerateRoomData(RoomId);

            if (Room == null || Room.OwnerId != Session.GetHabbo().Id || Room.Group != null)
            {
                return;
            }

            string Badge = string.Empty;

            for (int i = 0; i < 5; i++)
            {
                Badge += BadgePartUtility.WorkBadgeParts(i == 0, packet.PopInt().ToString(), packet.PopInt().ToString(), packet.PopInt().ToString());
            }

            Group Group = null;

            if (!CloudServer.GetGame().GetGroupManager().TryCreateGroup(Session.GetHabbo(), Name, Description, RoomId, Badge, Colour1, Colour2, out Group))
            {
                Session.SendNotification("Houve um erro ao tentar criar este grupo.\n\nTenta de novo.Se você receber esta mensagem mais de uma vez, fale com o moderador.\r\r");
                return;
            }

            Session.SendMessage(new PurchaseOKComposer());

            Room.Group = Group;

            if (Session.GetHabbo().CurrentRoomId != Room.Id)
            {
                Session.SendMessage(new RoomForwardComposer(Room.Id));
            }

            Session.SendMessage(new NewGroupInfoComposer(RoomId, Group.Id));
        }
        public void Parse(Player session, ClientPacket packet)
        {
            var groupId = packet.PopInt();

            if (!Program.GameContext.GetGroupManager().TryGetGroup(groupId, out var group))
            {
                return;
            }

            if (group.CreatorId != session.GetHabbo().Id)
            {
                return;
            }

            var count = packet.PopInt();

            var badge = "";

            for (var i = 0; i < count; i++)
            {
                badge += BadgePartUtility.WorkBadgeParts(i == 0, packet.PopInt().ToString(), packet.PopInt().ToString(), packet.PopInt().ToString());
            }

            group.Badge = string.IsNullOrWhiteSpace(badge) ? "b05114s06114" : badge;

            using (var dbClient = Program.DatabaseManager.GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `groups` SET `badge` = @badge WHERE `id` = @groupId LIMIT 1");
                dbClient.AddParameter("badge", group.Badge);
                dbClient.AddParameter("groupId", group.Id);
                dbClient.RunQuery();
            }

            session.SendPacket(new GroupInfoComposer(group, session));
        }
Exemple #4
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            int groupId = packet.PopInt();

            if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(groupId, out Group group))
            {
                return;
            }

            if (group.CreatorId != session.GetHabbo().Id)
            {
                return;
            }

            int count = packet.PopInt();

            string badge = "";

            for (int i = 0; i < count; i++)
            {
                badge += BadgePartUtility.WorkBadgeParts(i == 0, packet.PopInt().ToString(), packet.PopInt().ToString(), packet.PopInt().ToString());
            }

            group.Badge = (string.IsNullOrWhiteSpace(badge) ? "b05114s06114" : badge);

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `groups` SET `badge` = @badge WHERE `id` = @groupId LIMIT 1");
                dbClient.AddParameter("badge", group.Badge);
                dbClient.AddParameter("groupId", group.Id);
                dbClient.RunQuery();
            }

            session.SendPacket(new GroupInfoComposer(group, session));
        }
Exemple #5
0
        public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet)
        {
            string Name        = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            string Description = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            int    RoomId      = packet.PopInt();
            int    Colour1     = packet.PopInt();
            int    Colour2     = packet.PopInt();
            int    Unknown     = packet.PopInt();

            int groupCost = Convert.ToInt32(PlusEnvironment.GetSettingsManager().TryGetValue("catalog.group.purchase.cost"));

            if (session.GetHabbo().Credits < groupCost)
            {
                session.SendPacket(new BroadcastMessageAlertComposer("A group costs " + groupCost + " credits! You only have " + session.GetHabbo().Credits + "!"));
                return;
            }
            else
            {
                session.GetHabbo().Credits -= groupCost;
                session.SendPacket(new CreditBalanceComposer(session.GetHabbo().Credits));
            }

            RoomData Room = null;

            if (!RoomFactory.TryGetData(RoomId, out Room))
            {
                return;
            }

            if (Room == null || Room.OwnerId != session.GetHabbo().Id || Room.Group != null)
            {
                return;
            }

            string Badge = string.Empty;

            for (int i = 0; i < 5; i++)
            {
                Badge += BadgePartUtility.WorkBadgeParts(i == 0, packet.PopInt().ToString(), packet.PopInt().ToString(), packet.PopInt().ToString());
            }

            Group Group = null;

            if (!PlusEnvironment.GetGame().GetGroupManager().TryCreateGroup(session.GetHabbo(), Name, Description, RoomId, Badge, Colour1, Colour2, out Group))
            {
                session.SendNotification("An error occured whilst trying to create this group.\n\nTry again. If you get this message more than once, report it at the link below.\r\rhttp://boonboards.com");
                return;
            }

            session.SendPacket(new PurchaseOKComposer());

            Room.Group = Group;

            if (session.GetHabbo().CurrentRoomId != Room.Id)
            {
                session.SendPacket(new RoomForwardComposer(Room.Id));
            }

            session.SendPacket(new NewGroupInfoComposer(RoomId, Group.Id));
        }
Exemple #6
0
        public void Parse(Player session, ClientPacket packet)
        {
            var name            = Program.GameContext.GetChatManager().GetFilter().CheckMessage(packet.PopString());
            var description     = Program.GameContext.GetChatManager().GetFilter().CheckMessage(packet.PopString());
            var roomId          = packet.PopInt();
            var mainColour      = packet.PopInt();
            var secondaryColour = packet.PopInt();

            packet.PopInt(); //unknown

            var groupCost = Convert.ToInt32(Program.SettingsManager.TryGetValue("catalog.group.purchase.cost"));

            if (session.GetHabbo().Credits < groupCost)
            {
                session.SendPacket(new BroadcastMessageAlertComposer("A group costs " + groupCost + " credits! You only have " + session.GetHabbo().Credits + "!"));
                return;
            }

            session.GetHabbo().Credits -= groupCost;
            session.SendPacket(new CreditBalanceComposer(session.GetHabbo().Credits));

            if (!RoomFactory.TryGetData(roomId, out var room))
            {
                return;
            }

            if (room == null || room.OwnerId != session.GetHabbo().Id || room.Group != null)
            {
                return;
            }

            var badge = string.Empty;

            for (var i = 0; i < 5; i++)
            {
                badge += BadgePartUtility.WorkBadgeParts(i == 0, packet.PopInt().ToString(), packet.PopInt().ToString(), packet.PopInt().ToString());
            }

            if (!Program.GameContext.GetGroupManager().TryCreateGroup(session.GetHabbo(), name, description, roomId, badge, mainColour, secondaryColour, out var group))
            {
                session.SendNotification("An error occured whilst trying to create this group.\n\nTry again. If you get this message more than once, report it at the link below.\r\rhttp://boonboards.com");
                return;
            }

            session.SendPacket(new PurchaseOKComposer());

            room.Group = group;

            if (session.GetHabbo().CurrentRoomId != room.Id)
            {
                session.SendPacket(new RoomForwardComposer(room.Id));
            }

            session.SendPacket(new NewGroupInfoComposer(roomId, group.Id));
        }
        public void Parse(GameClient session, ClientPacket packet)
        {
            string Name        = ButterflyEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            string Description = ButterflyEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            int    RoomId      = packet.PopInt();
            int    Colour1     = packet.PopInt();
            int    Colour2     = packet.PopInt();
            int    Unknown     = packet.PopInt();

            int groupCost = 20;

            if (session.GetHabbo().Credits < groupCost)
            {
                return;
            }

            session.GetHabbo().Credits -= groupCost;
            session.SendPacket(new CreditBalanceComposer(session.GetHabbo().Credits));

            RoomData Room = ButterflyEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId);

            if (Room == null || Room.OwnerId != session.GetHabbo().Id || Room.Group != null)
            {
                return;
            }

            string Badge = string.Empty;

            for (int i = 0; i < 5; i++)
            {
                Badge += BadgePartUtility.WorkBadgeParts(i == 0, packet.PopInt().ToString(), packet.PopInt().ToString(), packet.PopInt().ToString());
            }

            Group Group = null;

            if (!ButterflyEnvironment.GetGame().GetGroupManager().TryCreateGroup(session.GetHabbo(), Name, Description, RoomId, Badge, Colour1, Colour2, out Group))
            {
                return;
            }

            session.SendPacket(new PurchaseOKComposer());

            Room.Group = Group;

            if (session.GetHabbo().CurrentRoomId != Room.Id)
            {
                session.SendPacket(new RoomForwardComposer(Room.Id));
            }

            session.SendPacket(new NewGroupInfoComposer(RoomId, Group.Id));
        }
Exemple #8
0
        public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet)
        {
            string word;
            string Name = packet.PopString();

            Name = RavenEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Name, out word) ? "Spam" : Name;
            string Description = packet.PopString();

            Description = RavenEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Description, out word) ? "Spam" : Description;
            int RoomId  = packet.PopInt();
            int Colour1 = packet.PopInt();
            int Colour2 = packet.PopInt();
            int Unknown = packet.PopInt();

            if (session.GetHabbo().Credits < RavenStaticGameSettings.GroupPurchaseAmount)
            {
                session.SendMessage(new BroadcastMessageAlertComposer("A group costs " + RavenStaticGameSettings.GroupPurchaseAmount + " credits! You only have " + session.GetHabbo().Credits + "!"));
                return;
            }
            else
            {
                session.GetHabbo().Credits -= RavenStaticGameSettings.GroupPurchaseAmount;
                session.SendMessage(new CreditBalanceComposer(session.GetHabbo().Credits));
            }
            RoomData Room = RavenEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId);

            if (Room == null || Room.OwnerId != session.GetHabbo().Id || Room.Group != null)
            {
                return;
            }
            string Badge = string.Empty;

            for (int i = 0; i < 5; i++)
            {
                Badge += BadgePartUtility.WorkBadgeParts(i == 0, packet.PopInt().ToString(), packet.PopInt().ToString(), packet.PopInt().ToString());
            }
            Group Group = null;

            if (!RavenEnvironment.GetGame().GetGroupManager().TryCreateGroup(session.GetHabbo(), Name, Description, RoomId, Badge, Colour1, Colour2, out Group))
            {
                session.SendNotification("An error occured whilst trying to create this group.\n\nTry again. If you get this message more than once, report it at the link below.\r\rhttp://boonboards.com");
                return;
            }
            session.SendMessage(new PurchaseOKComposer());
            Room.Group = Group;
            if (session.GetHabbo().CurrentRoomId != Room.Id)
            {
                session.SendMessage(new RoomForwardComposer(Room.Id));
            }
            session.SendMessage(new NewGroupInfoComposer(RoomId, Group.Id));
        }