コード例 #1
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int     userID = Packet.PopInt();
            Boolean IsMe   = Packet.PopBoolean();

            Habbo targetData = QuasarEnvironment.GetHabboById(userID);

            if (targetData == null)
            {
                Session.SendNotification("Er is een fout opgetreden bij het willen bekijken van deze Habbis profiel.");
                return;
            }

            List <Group> Groups = QuasarEnvironment.GetGame().GetGroupManager().GetGroupsForUser(targetData.Id);

            int friendCount = 0;

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT COUNT(0) FROM `messenger_friendships` WHERE (`user_one_id` = @userid OR `user_two_id` = @userid)");
                dbClient.AddParameter("userid", userID);
                friendCount = dbClient.getInteger();
            }

            Session.SendMessage(new ProfileInformationComposer(targetData, Session, Groups, friendCount));
            QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_CheckUsersProfile", 1);
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int GroupId = Packet.PopInt();
            int UserId  = Packet.PopInt();

            Group Group = null;

            if (!QuasarEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group))
            {
                return;
            }

            if ((Session.GetHabbo().Id != Group.CreatorId && !Group.IsAdmin(Session.GetHabbo().Id)) && !Session.GetHabbo().GetPermissions().HasRight("fuse_group_accept_any"))
            {
                return;
            }

            if (!Group.HasRequest(UserId))
            {
                return;
            }

            Habbo Habbo = QuasarEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendNotification("Oeps! Er is een fout opgetreden tijdens het ontvangen van dit verzoek.");
                return;
            }

            Group.HandleRequest(UserId, true);

            Session.SendMessage(new GroupMemberUpdatedComposer(GroupId, Habbo, 4));
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                return;
            }

            int   UserId = Packet.PopInt();
            Habbo Habbo  = QuasarEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendNotification("Oeps! Deze gebruiker is niet in de kamer aanwezig.");
                return;
            }

            try
            {
                Session.SendMessage(new ModeratorUserChatlogComposer(UserId));
            }
            catch { Session.SendNotification("Overflow :/"); }
        }
コード例 #4
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int   UserId = Packet.PopInt();
            Habbo Habbo  = QuasarEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                return;
            }

            Session.SendMessage(new HabboUserBadgesComposer(Habbo));
        }
コード例 #5
0
 public void Pick(int pModeratorId, Boolean UpdateInDb)
 {
     Status      = TicketStatus.PICKED;
     ModeratorId = pModeratorId;
     ModName     = QuasarEnvironment.GetHabboById(pModeratorId).Username;
     if (UpdateInDb)
     {
         using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
         {
             dbClient.RunQuery("UPDATE moderation_tickets SET status = 'picked', moderator_id = " + pModeratorId + ", timestamp = '" + QuasarEnvironment.GetUnixTimestamp() + "' WHERE id = " + Id + "");
         }
     }
 }
コード例 #6
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Days     = (Packet.PopInt() / 1440);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            double Length = (QuasarEnvironment.GetUnixTimestamp() + (Days * 86400));

            Habbo Habbo = QuasarEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Oeps! Deze gebruiker kan niet worden gevonden.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze gebruiker een ruil blokkering op te leggen.");
                return;
            }

            if (Days < 1)
            {
                Days = 1;
            }

            if (Days > 365)
            {
                Days = 365;
            }

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TradingLockExpiry = Length;
                Habbo.GetClient().SendNotification("Je hebt een ruilban voor " + Days + " dag(en)!\r\rReden:\r\r" + Message);
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int GroupId = Packet.PopInt();
            int UserId  = Packet.PopInt();

            Group Group = null;

            if (!QuasarEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group))
            {
                return;
            }

            if (Session.GetHabbo().Id != Group.CreatorId || !Group.IsMember(UserId))
            {
                return;
            }

            Habbo Habbo = QuasarEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendNotification("Oeps! Deze gebruiker bestaat niet.");
                return;
            }

            Group.TakeAdmin(UserId);

            Room Room = null;

            if (QuasarEnvironment.GetGame().GetRoomManager().TryGetRoom(Group.RoomId, out Room))
            {
                RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(UserId);
                if (User != null)
                {
                    if (User.Statusses.ContainsKey("flatctrl 3"))
                    {
                        User.RemoveStatus("flatctrl 3");
                    }
                    User.UpdateNeeded = true;
                    if (User.GetClient() != null)
                    {
                        User.GetClient().SendMessage(new YouAreControllerComposer(0));
                    }
                }
            }

            Session.SendMessage(new GroupMemberUpdatedComposer(GroupId, Habbo, 2));
        }
        public bool Execute(params object[] Params)
        {
            if (Params == null || Params.Length == 0)
            {
                return(false);
            }

            Habbo Owner = QuasarEnvironment.GetHabboById(Item.UserID);

            if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards"))
            {
                return(false);
            }

            Habbo Player = (Habbo)Params[0];

            if (Player == null || Player.GetClient() == null)
            {
                return(false);
            }

            RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username);

            if (User == null)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(StringData))
            {
                return(false);
            }

            if (Player.GetBadgeComponent().HasBadge(StringData))
            {
                Player.GetClient().SendNotification("Oeps! Je hebt een Badge ontvangen die je al in je inventaris hebt staan.");
            }
            else
            {
                Player.GetBadgeComponent().GiveBadge(StringData, true, Player.GetClient());
                Player.GetClient().SendNotification("Je hebt een Badge ontvangen!");
            }

            return(true);
        }
コード例 #9
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            Habbo Habbo = QuasarEnvironment.GetHabboById(Packet.PopInt());

            if (Habbo == null)
            {
                return;
            }

            var rand = new Random();

            Habbo.Relationships = Habbo.Relationships.OrderBy(x => rand.Next()).ToDictionary(item => item.Key, item => item.Value);

            int Loves = Habbo.Relationships.Count(x => x.Value.Type == 1);
            int Likes = Habbo.Relationships.Count(x => x.Value.Type == 2);
            int Hates = Habbo.Relationships.Count(x => x.Value.Type == 3);

            Session.SendMessage(new GetRelationshipsComposer(Habbo, Loves, Likes, Hates));
        }
        public ModeratorTicketChatlogComposer(SupportTicket Ticket, RoomData RoomData, double Timestamp)
            : base(ServerPacketHeader.ModeratorTicketChatlogMessageComposer)
        {
            base.WriteInteger(Ticket.TicketId);
            base.WriteInteger(Ticket.SenderId);
            base.WriteInteger(Ticket.ReportedId);
            base.WriteInteger(RoomData.Id);

            base.WriteByte(1);
            base.WriteShort(2);//Count
            base.WriteString("roomName");
            base.WriteByte(2);
            base.WriteString(RoomData.Name);
            base.WriteString("roomId");
            base.WriteByte(1);
            base.WriteInteger(RoomData.Id);

            base.WriteShort(Ticket.ReportedChats.Count);
            foreach (string Chat in Ticket.ReportedChats)
            {
                Habbo Habbo = QuasarEnvironment.GetHabboById(Ticket.ReportedId);

                DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
                dtDateTime = dtDateTime.AddSeconds(Ticket.Timestamp).ToLocalTime();

                base.WriteString(dtDateTime.Hour + ":" + dtDateTime.Minute);
                base.WriteInteger(Ticket.ReportedId);
                base.WriteString(Habbo != null ? Habbo.Username : "******");
                base.WriteString(Chat);
                base.WriteBoolean(false);

                //DateTime dDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
                //dDateTime = dDateTime.AddSeconds(Convert.ToInt32(Log["timestamp"])).ToLocalTime();

                //base.WriteString(dDateTime.Hour + ":" + dDateTime.Minute);
                //base.WriteInteger(Habbo.Id);
                //base.WriteString(Habbo.Username);
                //base.WriteString(string.IsNullOrWhiteSpace(Convert.ToString(Log["message"])) ? "*stemen*" : Convert.ToString(Log["message"]));
                //base.WriteBoolean(false);
            }
        }
コード例 #11
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_mute"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Length   = (Packet.PopInt() * 60);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            Habbo Habbo = QuasarEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Oeps! Deze gebruiker kan niet worden gevonden.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_mute") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any"))
            {
                Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze gebruiker een spreekverbod op te leggen.");
                return;
            }

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + Length + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TimeMuted = Length;
                //Habbo.GetClient().SendNotification("Usted ha sido silenciado por tener un mal comportamiento en Habbi Hotel. Cómportese para evitar futuras sanciones");
                Habbo.GetClient().SendNotification("Je hebt een spreekverbod  " + Length + " seconden!");
            }
        }
コード例 #12
0
 public Habbo GetDeleter()
 {
     return(QuasarEnvironment.GetHabboById(DeleterUserId));
 }
コード例 #13
0
 public Habbo GetAuthor()
 {
     return(QuasarEnvironment.GetHabboById(UserId));
 }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_soft_ban"))
            {
                return;
            }

            int    UserId     = Packet.PopInt();
            string Message    = Packet.PopString();
            double Length     = (Packet.PopInt() * 3600) + QuasarEnvironment.GetUnixTimestamp();
            string Unknown1   = Packet.PopString();
            string Unknown2   = Packet.PopString();
            bool   IPBan      = Packet.PopBoolean();
            bool   MachineBan = Packet.PopBoolean();

            if (MachineBan)
            {
                IPBan = false;
            }

            Habbo Habbo = QuasarEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Oeps! Deze gebruiker besaat niet.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                Session.SendWhisper("Oeps! Je kunt deze actie niet op deze gebruiker uitvoeren.");
                return;
            }

            Message = (Message != null ? Message : "geen reden (nodig).");

            string Username = Habbo.Username;

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (IPBan == false && MachineBan == false)
            {
                QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length);
            }
            else if (IPBan == true)
            {
                QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length);
            }
            else if (MachineBan == true)
            {
                QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length);
                QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length);
                QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.Username, Message, Length);
            }

            GameClient TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUsername(Habbo.Username);

            if (TargetClient != null)
            {
                TargetClient.Disconnect();
            }
        }
コード例 #15
0
        public bool Execute(params object[] Params)
        {
            if (Params == null || Params.Length == 0)
            {
                return(false);
            }

            Habbo Owner = QuasarEnvironment.GetHabboById(Item.UserID);

            if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards"))
            {
                return(false);
            }

            Habbo Player = (Habbo)Params[0];

            if (Player == null || Player.GetClient() == null)
            {
                return(false);
            }

            RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username);

            if (User == null)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(StringData))
            {
                return(false);
            }

            int  amountLeft = int.Parse(this.StringData.Split('-')[2]);
            int  often      = int.Parse(this.StringData.Split('-')[1]);
            bool unique     = this.BoolData;

            bool premied = false;

            if (amountLeft == 1)
            {
                Player.GetClient().SendNotification("Ya no hay mas premios, vuelve mas tarde.");
                return(true);
            }

            foreach (var dataStr in (this.StringData.Split('-')[0]).Split(';'))
            {
                var dataArray = dataStr.Split(',');

                var isbadge    = dataArray[0] == "0";
                var code       = dataArray[1];
                var percentage = int.Parse(dataArray[2]);

                var random = QuasarEnvironment.GetRandomNumber(0, 100);

                if (!unique && percentage < random)
                {
                    continue;
                }
                premied = true;

                if (isbadge)
                {
                    if (Player.GetBadgeComponent().HasBadge(code))
                    {
                        Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "Je hebt een Badge ontvangen die je al eerder in je inventaris had staan!", 0, User.LastBubble));
                    }
                    else
                    {
                        Player.GetBadgeComponent().GiveBadge(code, true, Player.GetClient());
                        Player.GetClient().SendNotification("Je hebt een Badge ontvangen!");
                    }
                }
                else
                {
                    ItemData ItemData = null;

                    if (!QuasarEnvironment.GetGame().GetItemManager().GetItem(int.Parse(code), out ItemData))
                    {
                        Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "Kon item niet laden: " + code, 0, User.LastBubble));
                        return(false);
                    }

                    Item Item = ItemFactory.CreateSingleItemNullable(ItemData, Player.GetClient().GetHabbo(), "", "", 0, 0, 0);


                    if (Item != null)
                    {
                        Player.GetClient().GetHabbo().GetInventoryComponent().TryAddItem(Item);
                        Player.GetClient().SendMessage(new FurniListNotificationComposer(Item.Id, 1));
                        Player.GetClient().SendMessage(new PurchaseOKComposer());
                        Player.GetClient().SendMessage(new FurniListAddComposer(Item));
                        Player.GetClient().SendMessage(new FurniListUpdateComposer());
                        Player.GetClient().SendNotification("¡Has recibido un regalo! Revisa tu inventario.");
                    }
                }
            }

            if (!premied)
            {
                Player.GetClient().SendNotification("Mweh, volgende keer weer een kans.");
            }
            else if (amountLeft > 1)
            {
                amountLeft--;
                this.StringData.Split('-')[2] = amountLeft.ToString();
            }

            return(true);
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null)
            {
                return;
            }

            int User = Packet.PopInt();
            int Type = Packet.PopInt();

            if (!Session.GetHabbo().GetMessenger().FriendshipExists(User))
            {
                Session.SendMessage(new BroadcastMessageAlertComposer("Oeps! Je kunt alleen vrienden toevoegen aan je relatie status."));
                return;
            }

            if (Type < 0 || Type > 3)
            {
                Session.SendMessage(new BroadcastMessageAlertComposer("Oeps! Er een onbekende fout opgetreden bij het kiezen van een relatie status."));
                return;
            }

            if (Session.GetHabbo().Relationships.Count > 2000)
            {
                Session.SendMessage(new BroadcastMessageAlertComposer("Oeps! Je hebt het relatie status limiet overstreden (2000)."));
                return;
            }

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                if (Type == 0)
                {
                    dbClient.SetQuery("SELECT `id` FROM `user_relationships` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `target` = @target LIMIT 1");
                    dbClient.AddParameter("target", User);
                    int Id = dbClient.getInteger();

                    dbClient.SetQuery("DELETE FROM `user_relationships` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `target` = @target LIMIT 1");
                    dbClient.AddParameter("target", User);
                    dbClient.RunQuery();

                    if (Session.GetHabbo().Relationships.ContainsKey(User))
                    {
                        Session.GetHabbo().Relationships.Remove(User);
                    }
                }
                else
                {
                    dbClient.SetQuery("SELECT id FROM `user_relationships` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `target` = @target LIMIT 1");
                    dbClient.AddParameter("target", User);
                    int Id = dbClient.getInteger();

                    if (Id > 0)
                    {
                        dbClient.SetQuery("DELETE FROM `user_relationships` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `target` = @target LIMIT 1");
                        dbClient.AddParameter("target", User);
                        dbClient.RunQuery();

                        if (Session.GetHabbo().Relationships.ContainsKey(Id))
                        {
                            Session.GetHabbo().Relationships.Remove(Id);
                        }
                    }

                    dbClient.SetQuery("INSERT INTO `user_relationships` (`user_id`,`target`,`type`) VALUES ('" + Session.GetHabbo().Id + "', @target, @type)");
                    dbClient.AddParameter("target", User);
                    dbClient.AddParameter("type", Type);
                    int newId = Convert.ToInt32(dbClient.InsertQuery());
                    QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_RelatieStatus", 1);

                    if (!Session.GetHabbo().Relationships.ContainsKey(User))
                    {
                        Session.GetHabbo().Relationships.Add(User, new Relationship(newId, User, Type));
                    }
                }

                GameClient Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(User);
                if (Client != null)
                {
                    Session.GetHabbo().GetMessenger().UpdateFriend(User, Client, true);
                }
                else
                {
                    Habbo Habbo = QuasarEnvironment.GetHabboById(User);
                    if (Habbo != null)
                    {
                        MessengerBuddy Buddy = null;
                        if (Session.GetHabbo().GetMessenger().TryGetFriend(User, out Buddy))
                        {
                            Session.SendMessage(new FriendListUpdateComposer(Session, Buddy));
                        }
                    }
                }
            }
        }