Exemple #1
0
        public override bool Execute(GameClient session, string[] pms)
        {
            ushort itemId;

            if (!ushort.TryParse(pms[0], out itemId))
            {
                return(true);
            }

            RoomUser user = session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().UserName);

            if (user.RidingHorse)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("horse_handitem_error"));
                return(true);
            }

            if (user.IsLyingDown)
            {
                return(true);
            }

            user.CarryItem(itemId);

            return(true);
        }
Exemple #2
0
        public override bool Execute(GameClient session, string[] pms)
        {
            GameClient user = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]);

            if (user == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }
            if (user.GetHabbo().Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_is_higher_rank"));
                return(true);
            }

            string userName = pms[0];
            string rank     = pms[1];

            using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                adapter.SetQuery("UPDATE users SET rank=@rank WHERE username=@user LIMIT 1");
                adapter.AddParameter("user", userName);
                adapter.AddParameter("rank", rank);
                adapter.RunQuery();
            }

            session.SendWhisper(Yupi.GetLanguage().GetVar("user_rank_update"));
            return(true);
        }
Exemple #3
0
        /// <summary>
        ///     Saveds the search.
        /// </summary>
        internal void SavedSearch()
        {
            if (Session.GetHabbo().NavigatorLogs.Count > 50)
            {
                Session.SendNotif(Yupi.GetLanguage().GetVar("navigator_max"));
                return;
            }
            string        value1   = Request.GetString();
            string        value2   = Request.GetString();
            UserSearchLog naviLogs = new UserSearchLog(Session.GetHabbo().NavigatorLogs.Count, value1, value2);

            if (!Session.GetHabbo().NavigatorLogs.ContainsKey(naviLogs.Id))
            {
                Session.GetHabbo().NavigatorLogs.Add(naviLogs.Id, naviLogs);
            }
            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("NavigatorSavedSearchesComposer"));

            message.AppendInteger(Session.GetHabbo().NavigatorLogs.Count);
            foreach (UserSearchLog navi in Session.GetHabbo().NavigatorLogs.Values)
            {
                message.AppendInteger(navi.Id);
                message.AppendString(navi.Value1);
                message.AppendString(navi.Value2);
                message.AppendString("");
            }
            Session.SendMessage(message);
        }
Exemple #4
0
        public override bool Execute(GameClient session, string[] pms)
        {
            Habbo user = Yupi.GetHabboForName(pms[0]);

            if (user == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }
            if (user.Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_is_higher_rank"));
                return(true);
            }
            using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                adapter.SetQuery("DELETE FROM users_bans WHERE value = @name");
                adapter.AddParameter("name", user.UserName);
                adapter.RunQuery();
                Yupi.GetGame()
                .GetModerationTool()
                .LogStaffEntry(session.GetHabbo().UserName, user.UserName, "Unban",
                               $"User has been Unbanned [{pms[0]}]");
                return(true);
            }
        }
Exemple #5
0
        public override bool Execute(GameClient session, string[] pms)
        {
            string userName = pms[0];

            if (string.Equals(userName, session.GetHabbo().UserName,
                              StringComparison.CurrentCultureIgnoreCase))
            {
                session.SendNotif(Yupi.GetLanguage().GetVar("summon_yourself"));
                return(true);
            }
            GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(userName);

            if (client == null)
            {
                session.SendNotif(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }
            if (session.GetHabbo().CurrentRoom != null &&
                session.GetHabbo().CurrentRoomId != client.GetHabbo().CurrentRoomId)
            {
                client.GetMessageHandler()
                .PrepareRoomForUser(session.GetHabbo().CurrentRoom.RoomId,
                                    session.GetHabbo().CurrentRoom.RoomData.PassWord);
            }
            return(true);
        }
Exemple #6
0
        /// <summary>
        ///     Tries the execute.
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="client">The client.</param>
        /// <param name="scommand"></param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        public static bool TryExecute(string scommand, string parameters, GameClient client)
        {
            if (string.IsNullOrEmpty(scommand) || string.IsNullOrEmpty(parameters) || client.GetHabbo() == null || !client.GetHabbo().InRoom)
                return false;

            string[] pms = parameters.Split(' ');

            string commandName = scommand;

            if (AliasDictionary.ContainsKey(commandName))
                commandName = AliasDictionary[commandName];

            if (!CommandsDictionary.ContainsKey(commandName))
                return false;

            Command command = CommandsDictionary[commandName];

            if (!CanUse(command.MinRank, client))
                return false;

            if (command.MinParams == -2 || (command.MinParams == -1 && pms.Length > 1) || command.MinParams != -1 && command.MinParams == pms.Length - 1)
                return command.Execute(client, pms.Skip(1).ToArray());

            client.SendWhisper(Yupi.GetLanguage().GetVar("use_the_command_as") + command.Usage);

            return true;
        }
Exemple #7
0
        public override bool Execute(GameClient session, string[] pms)
        {
            uint amount;

            if (!uint.TryParse(pms[0], out amount))
            {
                session.SendNotif(Yupi.GetLanguage().GetVar("enter_numbers"));
                return(true);
            }

            foreach (GameClient client in Yupi.GetGame().GetClientManager().Clients.Values)
            {
                if (client?.GetHabbo() == null)
                {
                    continue;
                }

                client.GetHabbo().Credits += amount;
                client.GetHabbo().UpdateCreditsBalance();
                client.SendNotif(Yupi.GetLanguage().GetVar("command_mass_credits_one_give") + amount +
                                 Yupi.GetLanguage().GetVar("command_mass_credits_two_give"));
            }

            return(true);
        }
Exemple #8
0
        public override bool Execute(GameClient session, string[] pms)
        {
            GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]);

            if (client == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }

            uint amount;

            if (!uint.TryParse(pms[1], out amount))
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("enter_numbers"));
                return(true);
            }

            client.GetHabbo().Credits += amount;
            client.GetHabbo().UpdateCreditsBalance();

            client.SendNotif(string.Format(Yupi.GetLanguage().GetVar("staff_gives_credits"), session.GetHabbo().UserName,
                                           amount));

            return(true);
        }
Exemple #9
0
        public override bool Execute(GameClient session, string[] pms)
        {
            ushort danceId;

            ushort.TryParse(pms[0], out danceId);

            if (danceId > 4)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("command_dance_wrong_syntax"));
                return(true);
            }
            Room room = Yupi.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId);
            HashSet <RoomUser> roomUsers = room.GetRoomUserManager().GetRoomUsers();

            foreach (RoomUser roomUser in roomUsers)
            {
                ServerMessage message =
                    new ServerMessage(LibraryParser.OutgoingRequest("DanceStatusMessageComposer"));
                message.AppendInteger(roomUser.VirtualId);
                message.AppendInteger(danceId);
                room.SendMessage(message);
                roomUser.DanceId = danceId;
            }
            return(true);
        }
Exemple #10
0
        public override bool Execute(GameClient session, string[] pms)
        {
            GameClient user = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]);

            if (user == null || user.GetHabbo() == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }
            if (user.GetHabbo().Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_is_higher_rank"));
                return(true);
            }
            try
            {
                user.GetConnection().Dispose();
                Yupi.GetGame()
                .GetModerationTool()
                .LogStaffEntry(session.GetHabbo().UserName, user.GetHabbo().UserName, "dc",
                               $"Disconnect User[{pms[1]}]");
            }
            catch
            {
            }

            return(true);
        }
Exemple #11
0
        public override bool Execute(GameClient session, string[] pms)
        {
            GameClient user = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]);

            if (user == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }
            if (user.GetHabbo().Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_is_higher_rank"));
                return(true);
            }
            try
            {
                Yupi.GetGame()
                .GetBanManager()
                .BanUser(user, session.GetHabbo().UserName, 788922000.0, string.Join(" ", pms.Skip(2)),
                         true, false);
            }
            catch
            {
                YupiLogManager.LogException($"An error occurred when {session.GetHabbo().UserName} tried to ban {user.GetHabbo().UserName}", "Failed Banning User.", "Yupi.Users");
            }

            return(true);
        }
Exemple #12
0
        public override bool Execute(GameClient session, string[] pms)
        {
            GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]);

            if (client == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }
            if (client.GetHabbo().Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_is_higher_rank"));
                return(true);
            }
            int time;

            if (!int.TryParse(pms[1], out time))
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("enter_numbers"));
                return(true);
            }

            client.GetHabbo().FloodTime = Yupi.GetUnixTimeStamp() + Convert.ToInt32(pms[1]);
            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("FloodFilterMessageComposer"));

            serverMessage.AppendInteger(Convert.ToInt32(pms[1]));
            client.SendMessage(serverMessage);
            return(true);
        }
Exemple #13
0
 public override bool Execute(GameClient session, string[] pms)
 {
     using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor())
         Yupi.ConfigData = new ServerDatabaseSettings(adapter);
     session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_settings"));
     return(true);
 }
Exemple #14
0
        /// <summary>
        ///     Initializes the messenger.
        /// </summary>
        internal void InitMessenger()
        {
            GameClient client = GetClient();

            if (client == null)
            {
                return;
            }

            client.SendMessage(_messenger.SerializeCategories());
            client.SendMessage(_messenger.SerializeFriends());
            client.SendMessage(_messenger.SerializeRequests());

            if (Yupi.OfflineMessages.ContainsKey(Id))
            {
                List <OfflineMessage> list = Yupi.OfflineMessages[Id];
                foreach (OfflineMessage current in list)
                {
                    client.SendMessage(_messenger.SerializeOfflineMessages(current));
                }
                Yupi.OfflineMessages.Remove(Id);
                OfflineMessage.RemoveAllMessages(Yupi.GetDatabaseManager().GetQueryReactor(), Id);
            }

            if (_messenger.Requests.Count > Yupi.FriendRequestLimit)
            {
                client.SendNotif(Yupi.GetLanguage().GetVar("user_friend_request_max"));
            }

            _messenger.OnStatusChanged(false);
        }
Exemple #15
0
        public override bool Execute(GameClient session, string[] pms)
        {
            session.GetHabbo().GetInventoryComponent().Redeemcredits(session);
            session.SendNotif(Yupi.GetLanguage().GetVar("command_redeem_credits"));

            return(true);
        }
Exemple #16
0
        public override bool Execute(GameClient session, string[] pms)
        {
            GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]);

            if (client == null)
            {
                session.SendNotif(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }

            if (client.GetHabbo().Rank >= session.GetHabbo().Rank)
            {
                session.SendNotif(Yupi.GetLanguage().GetVar("user_is_higher_rank"));
                return(true);
            }
            Yupi.GetGame()
            .GetModerationTool()
            .LogStaffEntry(session.GetHabbo().UserName, client.GetHabbo().UserName, "Ban",
                           "User has received a Super ban.");
            Yupi.GetGame()
            .GetBanManager()
            .BanUser(client, session.GetHabbo().UserName, 788922000.0, string.Join(" ", pms.Skip(1)),
                     false, false);
            return(true);
        }
Exemple #17
0
 public override bool Execute(GameClient session, string[] pms)
 {
     using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor())
         Yupi.GetGame().GetPollManager().Init(adapter);
     session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_polls"));
     return(true);
 }
Exemple #18
0
        /// <summary>
        ///     Creates the room.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="name">The name.</param>
        /// <param name="desc">The desc.</param>
        /// <param name="model">The model.</param>
        /// <param name="category">The category.</param>
        /// <param name="maxVisitors">The maximum visitors.</param>
        /// <param name="tradeState">State of the trade.</param>
        /// <returns>RoomData.</returns>
        internal RoomData CreateRoom(GameClient session, string name, string desc, string model, int category,
                                     int maxVisitors, int tradeState)
        {
            if (!_roomModels.Contains(model))
            {
                session.SendNotif(Yupi.GetLanguage().GetVar("user_room_model_error"));

                return(null);
            }

            uint roomId;

            using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO rooms_data (roomtype,caption,description,owner,model_name,category,users_max,trade_state) VALUES ('private',@caption,@desc,@UserId,@model,@cat,@usmax,@tstate)");
                dbClient.AddParameter("caption", name);
                dbClient.AddParameter("desc", desc);
                dbClient.AddParameter("UserId", session.GetHabbo().Id);
                dbClient.AddParameter("model", model);
                dbClient.AddParameter("cat", category);
                dbClient.AddParameter("usmax", maxVisitors);
                dbClient.AddParameter("tstate", tradeState.ToString());
                roomId = (uint)dbClient.InsertQuery();
            }
            RoomData data = GenerateRoomData(roomId);

            if (data == null)
            {
                return(null);
            }

            session.GetHabbo().UsersRooms.Add(data);
            return(data);
        }
Exemple #19
0
 public override bool Execute(GameClient session, string[] pms)
 {
     using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor())
         Yupi.GetGame().GetRoleManager().LoadRights(adapter);
     CommandsManager.UpdateInfo();
     session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_ranks"));
     return(true);
 }
Exemple #20
0
        public override bool Execute(GameClient session, string[] pms)
        {
            UserChatInputFilter.Reload();
            BlackWordsManager.Reload();

            session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_banned_hotels"));
            return(true);
        }
Exemple #21
0
 public override bool Execute(GameClient session, string[] pms)
 {
     FurnitureDataManager.SetCache();
     Yupi.GetGame().ReloadItems();
     FurnitureDataManager.Clear();
     session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_items"));
     return(true);
 }
Exemple #22
0
        public override bool Execute(GameClient session, string[] pms)
        {
            Room     room = session.GetHabbo().CurrentRoom;
            RoomUser user = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);

            if (user == null)
            {
                return(true);
            }

            GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]);

            if (client == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }
            if (client.GetHabbo().Id == session.GetHabbo().Id)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("command_pull_error_own"));
                return(true);
            }
            RoomUser user2 = room.GetRoomUserManager().GetRoomUserByHabbo(client.GetHabbo().Id);

            if (user2 == null)
            {
                return(true);
            }
            if (user2.TeleportEnabled)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("command_error_teleport_enable"));
                return(true);
            }

            if (user.RotBody % 2 != 0)
            {
                user.RotBody--;
            }
            switch (user.RotBody)
            {
            case 0:
                user2.MoveTo(user.X, user.Y - 1);
                break;

            case 2:
                user2.MoveTo(user.X + 1, user.Y);
                break;

            case 4:
                user2.MoveTo(user.X, user.Y + 1);
                break;

            case 6:
                user2.MoveTo(user.X - 1, user.Y);
                break;
            }
            return(true);
        }
Exemple #23
0
        public override bool Execute(GameClient session, string[] pms)
        {
            Room room = session.GetHabbo().CurrentRoom;

            room.MutedPets = !room.MutedPets;
            session.SendNotif(Yupi.GetLanguage().GetVar("user_room_mute_pets"));

            return(true);
        }
Exemple #24
0
        /// <summary>
        ///     Sends the super notif.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="notice">The notice.</param>
        /// <param name="picture">The picture.</param>
        /// <param name="client">The client.</param>
        /// <param name="link">The link.</param>
        /// <param name="linkTitle">The link title.</param>
        /// <param name="broadCast">if set to <c>true</c> [broad cast].</param>
        /// <param name="Event">if set to <c>true</c> [event].</param>
        internal void SendSuperNotif(string title, string notice, string picture, GameClient client, string link,
                                     string linkTitle, bool broadCast, bool Event)
        {
            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));

            serverMessage.AppendString(picture);
            serverMessage.AppendInteger(4);
            serverMessage.AppendString("title");
            serverMessage.AppendString(title);
            serverMessage.AppendString("message");

            if (broadCast)
            {
                if (Event)
                {
                    string text1 = Yupi.GetLanguage().GetVar("ha_event_one");
                    string text2 = Yupi.GetLanguage().GetVar("ha_event_two");
                    string text3 = Yupi.GetLanguage().GetVar("ha_event_three");
                    serverMessage.AppendString(
                        $"<b>{text1} {client.GetHabbo().CurrentRoom.RoomData.Owner}!</b>\r\n {text2} .\r\n<b>{text3}</b>\r\n{notice}");
                }
                else
                {
                    string text4 = Yupi.GetLanguage().GetVar("ha_title");
                    serverMessage.AppendString(string.Concat("<b>" + text4 + "</b>\r\n", notice, "\r\n- <i>",
                                                             client.GetHabbo().UserName, "</i>"));
                }
            }
            else
            {
                serverMessage.AppendString(notice);
            }

            if (link != string.Empty)
            {
                serverMessage.AppendString("linkUrl");
                serverMessage.AppendString(link);
                serverMessage.AppendString("linkTitle");
                serverMessage.AppendString(linkTitle);
            }
            else
            {
                serverMessage.AppendString("linkUrl");
                serverMessage.AppendString("event:");
                serverMessage.AppendString("linkTitle");
                serverMessage.AppendString("ok");
            }

            if (broadCast)
            {
                QueueBroadcaseMessage(serverMessage);

                return;
            }

            client.SendMessage(serverMessage);
        }
Exemple #25
0
        public override bool Execute(GameClient session, string[] pms)
        {
            Room room = session.GetHabbo().CurrentRoom;

            room.GetGameMap().DiagonalEnabled = !room.GetGameMap().DiagonalEnabled;
            session.SendNotif(Yupi.GetLanguage().GetVar("command_disable_diagonal"));

            return(true);
        }
Exemple #26
0
 public override bool Execute(GameClient session, string[] pms)
 {
     using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor())
     {
         Yupi.GetGame().GetNavigator().Initialize(adapter);
         Yupi.GetGame().GetRoomManager().LoadModels(adapter);
     }
     session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_navigator"));
     return(true);
 }
Exemple #27
0
        public override bool Execute(GameClient session, string[] pms)
        {
            GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]);

            if (client == null || client.GetHabbo().Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }
            client.GetHabbo().GetInventoryComponent().ClearItems();
            return(true);
        }
Exemple #28
0
 public override bool Execute(GameClient session, string[] pms)
 {
     try
     {
         session.GetHabbo().GetInventoryComponent().Redeemcredits(session);
         session.SendNotif(Yupi.GetLanguage().GetVar("command_redeem_credits"));
     }
     catch (Exception e)
     {
         Writer.LogException(e.ToString());
         session.SendNotif(Yupi.GetLanguage().GetVar("command_redeem_credits"));
     }
     return(true);
 }
        public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
        {
            RoomUser user = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);

            if (user == null)
            {
                return;
            }

            if (user.CurrentEffect != 172 && user.CurrentEffect != 5 && user.CurrentEffect != 173)
            {
                return;
            }

            if (item.ExtraData != "5")
            {
                if (item.VikingCotieBurning)
                {
                    return;
                }

                item.ExtraData = "1";
                item.UpdateState();

                item.VikingCotieBurning = true;

                GameClient clientByUsername =
                    Yupi.GetGame().GetClientManager().GetClientByUserName(item.GetRoom().RoomData.Owner);

                if (clientByUsername != null)
                {
                    if (clientByUsername.GetHabbo().UserName != item.GetRoom().RoomData.Owner)
                    {
                        clientByUsername.SendNotif(string.Format(Yupi.GetLanguage().GetVar("viking_burn_started"),
                                                                 user.GetUserName()));
                    }
                }

                _mItem = item;

                Timer timer = new Timer(5000);
                timer.Elapsed += OnElapse;
                timer.Enabled  = true;
            }
            else
            {
                session.SendNotif(Yupi.GetLanguage().GetVar("user_viking_error"));
            }
        }
Exemple #30
0
        public override bool Execute(GameClient session, string[] pms)
        {
            string userName = pms[0];
            string msg      = string.Join(" ", pms.Skip(1));

            GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(userName);

            if (client == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }
            client.SendNotif($"{msg} \r\r-{session.GetHabbo().UserName}");
            return(true);
        }