Exemplo n.º 1
0
        public override bool Execute(GameClient session, string[] pms)
        {
            Room room = session.GetHabbo().CurrentRoom;

            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                queryReactor.RunFastQuery(
                    $"UPDATE rooms_data SET roomtype = 'public' WHERE id = {room.RoomId}");

            uint            roomId = session.GetHabbo().CurrentRoom.RoomId;
            List <RoomUser> users  = new List <RoomUser>(session.GetHabbo().CurrentRoom.GetRoomUserManager().UserList.Values);

            Yupi.GetGame().GetRoomManager().UnloadRoom(session.GetHabbo().CurrentRoom, "Unload command");

            Yupi.GetGame().GetRoomManager().LoadRoom(roomId);

            ServerMessage roomFwd = new ServerMessage(LibraryParser.OutgoingRequest("RoomForwardMessageComposer"));

            roomFwd.AppendInteger(roomId);

            byte[] data = roomFwd.GetReversedBytes();

            foreach (RoomUser user in users.Where(user => user != null && user.GetClient() != null))
            {
                user.GetClient().SendMessage(data);
            }

            return(true);
        }
Exemplo n.º 2
0
        public override bool Execute(GameClient session, string[] pms)
        {
            if (pms[0].Length < 2)
            {
                return(true);
            }
            Room room = session.GetHabbo().CurrentRoom;

            foreach (RoomUser current in room.GetRoomUserManager().UserList.Values)
            {
                try
                {
                    if (!current.IsBot && current.GetClient() != null &&
                        current.GetClient().GetHabbo() != null)
                    {
                        current.GetClient()
                        .GetHabbo()
                        .GetBadgeComponent()
                        .GiveBadge(pms[0], true, current.GetClient());
                    }
                }
                catch
                {
                }
            }
            Yupi.GetGame().GetModerationTool()
            .LogStaffEntry(session.GetHabbo().UserName,
                           string.Empty, "Badge",
                           string.Concat("Roombadge in room [", room.RoomId, "] with badge [", pms[0], "]"));
            return(true);
        }
Exemplo n.º 3
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().Diamonds += amount;
            client.GetHabbo().UpdateSeasonalCurrencyBalance();

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

            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Called when [respect].
        /// </summary>
        internal void OnRespect()
        {
            Respect++;

            GameClient ownerSession = Yupi.GetGame().GetClientManager().GetClientByUserId(OwnerId);

            if (ownerSession != null)
            {
                Yupi.GetGame()
                .GetAchievementManager()
                .ProgressUserAchievement(ownerSession, "ACH_PetRespectReceiver", 1);
            }

            RespectPetComposer.GenerateMessage(this);

            RespectPetNotificationComposer.GenerateMessage(this);

            if (DbState != DatabaseUpdateState.NeedsInsert)
            {
                DbState = DatabaseUpdateState.NeedsUpdate;
            }

            if (Type != "pet_monster" && Experience <= 51900)
            {
                AddExperience(10);
            }

            if (Type == "pet_monster")
            {
                Energy = 100;
            }

            LastHealth = DateTime.Now.AddSeconds(129600.0);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the popular rooms.
 /// </summary>
 internal void GetPopularRooms()
 {
     if (Session.GetHabbo() == null)
     {
         return;
     }
     Session.SendMessage(Yupi.GetGame().GetNavigator().SerializeNavigator(Session, int.Parse(Request.GetString())));
 }
Exemplo n.º 6
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);
 }
Exemplo n.º 7
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);
 }
Exemplo n.º 8
0
 /// <summary>
 ///     News the navigator flat cats.
 /// </summary>
 internal void NewNavigatorFlatCats()
 {
     if (Session.GetHabbo() == null)
     {
         return;
     }
     Session.SendMessage(Yupi.GetGame().GetNavigator().SerializeNewFlatCategories());
 }
Exemplo n.º 9
0
 /// <summary>
 ///     Gets the popular tags.
 /// </summary>
 internal void GetPopularTags()
 {
     if (Session.GetHabbo() == null)
     {
         return;
     }
     Session.SendMessage(Yupi.GetGame().GetNavigator().SerializePopularRoomTags());
 }
Exemplo n.º 10
0
 /// <summary>
 ///     Gets the popular groups.
 /// </summary>
 internal void GetPopularGroups()
 {
     if (Session.GetHabbo() == null)
     {
         return;
     }
     Session.SendMessage(Yupi.GetGame().GetNavigator().SerializeNavigator(Session, -2));
 }
Exemplo n.º 11
0
 /// <summary>
 ///     Gets the recent rooms.
 /// </summary>
 internal void GetRecentRooms()
 {
     if (Session.GetHabbo() == null)
     {
         return;
     }
     Session.SendMessage(Yupi.GetGame().GetNavigator().SerializeRecentRooms(Session));
 }
Exemplo n.º 12
0
 /// <summary>
 ///     Gets the high rated rooms.
 /// </summary>
 internal void GetHighRatedRooms()
 {
     if (Session.GetHabbo() == null)
     {
         return;
     }
     Session.SendMessage(Yupi.GetGame().GetNavigator().SerializeNavigator(Session, -2));
 }
Exemplo n.º 13
0
        /// <summary>
        ///     Sends the ticket to moderators.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        internal static void SendTicketToModerators(SupportTicket ticket)
        {
            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolIssueMessageComposer"));

            message = ticket.Serialize(message);

            Yupi.GetGame().GetClientManager().StaffAlert(message);
        }
Exemplo n.º 14
0
 /// <summary>
 ///     Gets the rooms with friends.
 /// </summary>
 internal void GetRoomsWithFriends()
 {
     if (Session.GetHabbo() == null)
     {
         return;
     }
     Session.SendMessage(Yupi.GetGame().GetNavigator().SerializeNavigator(Session, -5));
 }
Exemplo n.º 15
0
        /// <summary>
        ///     Guides the feedback.
        /// </summary>
        internal void GuideFeedback()
        {
            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("OnGuideSessionDetachedMessageComposer"));

            Session.SendMessage(message);

            Yupi.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_GuideFeedbackGiver", 1);
        }
Exemplo n.º 16
0
 /// <summary>
 ///     Determines whether the specified fuse has fuse.
 /// </summary>
 /// <param name="fuse">The fuse.</param>
 /// <returns><c>true</c> if the specified fuse has fuse; otherwise, <c>false</c>.</returns>
 internal bool HasFuse(string fuse)
 {
     return(Yupi.GetGame().GetRoleManager().RankHasRight(Rank, fuse) ||
            (GetSubscriptionManager().HasSubscription&&
             Yupi.GetGame()
             .GetRoleManager()
             .HasVip(GetSubscriptionManager().GetSubscription().SubscriptionId, fuse)));
 }
Exemplo n.º 17
0
 /// <summary>
 ///     Gets the pubs.
 /// </summary>
 internal void GetPubs()
 {
     if (Session.GetHabbo() == null)
     {
         return;
     }
     Session.SendMessage(Yupi.GetGame().GetNavigator().SerializePublicRooms());
 }
Exemplo n.º 18
0
 /// <summary>
 ///     News the navigator.
 /// </summary>
 internal void NewNavigator()
 {
     if (Session == null)
     {
         return;
     }
     Yupi.GetGame().GetNavigator().EnableNewNavigator(Session);
 }
Exemplo n.º 19
0
        /// <summary>
        ///     Gets the user data.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <returns>UserData.</returns>
        internal static UserData GetUserData(int userId)
        {
            DataRow   dataRow;
            DataRow   row;
            DataTable table;

            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.SetQuery($"SELECT * FROM users WHERE id = {userId} LIMIT 1");

                dataRow = queryReactor.GetRow();

                Yupi.GetGame().GetClientManager().LogClonesOut((uint)userId);

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

                if (Yupi.GetGame().GetClientManager().GetClientByUserId((uint)userId) != null)
                {
                    return(null);
                }

                queryReactor.SetQuery($"SELECT * FROM groups_members WHERE user_id={userId}");
                queryReactor.GetTable();

                queryReactor.SetQuery($"SELECT * FROM users_stats WHERE id = {userId}");
                row = queryReactor.GetRow();

                queryReactor.SetQuery($"SELECT * FROM users_relationships WHERE user_id={userId}");
                table = queryReactor.GetTable();
            }

            Dictionary <string, UserAchievement> achievements = new Dictionary <string, UserAchievement>();
            Dictionary <int, UserTalent>         talents      = new Dictionary <int, UserTalent>();
            List <uint>         favouritedRooms          = new List <uint>();
            List <uint>         ignores                  = new List <uint>();
            List <string>       tags                     = new List <string>();
            List <Badge>        badges                   = new List <Badge>();
            List <UserItem>     inventory                = new List <UserItem>();
            List <AvatarEffect> effects                  = new List <AvatarEffect>();
            Dictionary <uint, MessengerBuddy>   friends  = new Dictionary <uint, MessengerBuddy>();
            Dictionary <uint, MessengerRequest> requests = new Dictionary <uint, MessengerRequest>();
            HashSet <RoomData>         rooms             = new HashSet <RoomData>();
            Dictionary <uint, Pet>     pets              = new Dictionary <uint, Pet>();
            Dictionary <int, int>      quests            = new Dictionary <int, int>();
            Dictionary <uint, RoomBot> bots              = new Dictionary <uint, RoomBot>();
            HashSet <GroupMember>      group             = new HashSet <GroupMember>();
            HashSet <uint>             pollData          = new HashSet <uint>();

            Dictionary <int, Relationship> dictionary = table.Rows.Cast <DataRow>().ToDictionary(dataRow2 => (int)dataRow2["id"], dataRow2 => new Relationship((int)dataRow2["id"], (int)dataRow2["target"], Convert.ToInt32(dataRow2["type"].ToString())));

            Habbo user = HabboFactory.GenerateHabbo(dataRow, row, group);

            return(new UserData((uint)userId, achievements, talents, favouritedRooms, ignores, tags, null, badges, inventory,
                                effects, friends, requests, rooms, pets, quests, user, bots, dictionary, pollData, 0));
        }
Exemplo n.º 20
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);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Determines whether this instance can talk the specified session.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="message">The message.</param>
        /// <returns><c>true</c> if this instance can talk the specified session; otherwise, <c>false</c>.</returns>
        internal static bool CanTalk(GameClient session, string message)
        {
            if (CheckForBannedPhrases(message) && session.GetHabbo().Rank < 4)
            {
                if (!Yupi.MutedUsersByFilter.ContainsKey(session.GetHabbo().Id))
                {
                    session.GetHabbo().BobbaFiltered++;
                }

                if (session.GetHabbo().BobbaFiltered < 3)
                {
                    session.SendNotif("Your language is inappropriate. If you do not change this , measures are being taken by the automated system of Habbo.");
                }
                else if (session.GetHabbo().BobbaFiltered >= 3)
                {
                    if (session.GetHabbo().BobbaFiltered == 3)
                    {
                        session.GetHabbo().BobbaFiltered = 4;
                        Yupi.MutedUsersByFilter.Add(session.GetHabbo().Id, uint.Parse((Yupi.GetUnixTimeStamp() + 300 * 60).ToString()));

                        return(false);
                    }

                    if (session.GetHabbo().BobbaFiltered == 4)
                    {
                        session.SendNotif("Now you can not talk for 5 minutes . This is because your exhibits inappropriate language in Habbo Hotel.");
                    }
                    else if (session.GetHabbo().BobbaFiltered == 5)
                    {
                        session.SendNotif("You risk a ban if you continue to scold it . This is your last warning");
                    }
                    else if (session.GetHabbo().BobbaFiltered >= 7)
                    {
                        session.GetHabbo().BobbaFiltered = 0;

                        Yupi.GetGame().GetBanManager().BanUser(session, "Auto-system-ban", 3600, "ban.", false, false);
                    }
                }
            }

            if (Yupi.MutedUsersByFilter.ContainsKey(session.GetHabbo().Id))
            {
                if (Yupi.MutedUsersByFilter[session.GetHabbo().Id] < Yupi.GetUnixTimeStamp())
                {
                    Yupi.MutedUsersByFilter.Remove(session.GetHabbo().Id);
                }
                else
                {
                    DateTime now             = DateTime.Now;
                    TimeSpan timeStillBanned = now - Yupi.UnixToDateTime(Yupi.MutedUsersByFilter[session.GetHabbo().Id]);

                    session.SendNotif("Damn! you can't talk for " + timeStillBanned.Minutes.ToString().Replace("-", "") + " minutes and " + timeStillBanned.Seconds.ToString().Replace("-", "") + " seconds.");
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 22
0
 public override bool Execute(GameClient session, string[] pms)
 {
     Yupi.GetGame()
     .GetModerationTool()
     .LogStaffEntry(session.GetHabbo().UserName, string.Empty, "Shutdown",
                    "Issued shutdown command!");
     new Task(Yupi.PerformShutDown).Start();
     return(true);
 }
Exemplo n.º 23
0
        /// <summary>
        ///     Removes all rooms.
        /// </summary>
        internal void RemoveAllRooms()
        {
            foreach (Room current in LoadedRooms.Values)
            {
                Yupi.GetGame().GetRoomManager().UnloadRoom(current, "RemoveAllRooms void called");
            }

            Writer.WriteLine("RoomManager Destroyed", "Yupi.Rooms", ConsoleColor.DarkYellow);
        }
Exemplo n.º 24
0
        /// <summary>
        ///     Handles the publicist.
        /// </summary>
        /// <param name="word">The word.</param>
        /// <param name="message">The message.</param>
        /// <param name="method">The method.</param>
        /// <param name="settings">The settings.</param>
        internal void HandlePublicist(string word, string message, string method, BlackWordTypeSettings settings)
        {
            ServerMessage serverMessage;

            if (GetHabbo().Rank < 5 && settings.MaxAdvices == PublicistCount++ && settings.AutoBan)
            {
                serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));
                serverMessage.AppendString("staffcloud");
                serverMessage.AppendInteger(2);
                serverMessage.AppendString("title");
                serverMessage.AppendString("Staff Internal Alert");
                serverMessage.AppendString("message");
                serverMessage.AppendString("O usuário " + GetHabbo().UserName + " Foi banido por enviar repetidamente palavras repetidas. A última palavra foi: " +
                                           word + ", na frase: " + message);

                Yupi.GetGame().GetClientManager().StaffAlert(serverMessage);

                Yupi.GetGame().GetBanManager().BanUser(this, GetHabbo().UserName, 3600, "Você está passando muitos spams de outros hotéis. Por esta razão, sancioná-lo por 1 hora, de modo que você aprender a controlar-se.", false, false);
                return;
            }

            //if (PublicistCount > 4)
            //    return;

            // Queremos que os Staffs Saibam desses dados.

            string alert = settings.Alert.Replace("{0}", GetHabbo().UserName);

            alert = alert.Replace("{1}", GetHabbo().Id.ToString());
            alert = alert.Replace("{2}", word);
            alert = alert.Replace("{3}", message);
            alert = alert.Replace("{4}", method);

            serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("UsersClassificationMessageComposer"));
            serverMessage.AppendInteger(1);

            serverMessage.AppendInteger(GetHabbo().Id);
            serverMessage.AppendString(GetHabbo().UserName);
            serverMessage.AppendString("BadWord: " + word);

            Yupi.GetGame().GetClientManager().StaffAlert(serverMessage);

            serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));
            serverMessage.AppendString(settings.ImageAlert);
            serverMessage.AppendInteger(4);
            serverMessage.AppendString("title");
            serverMessage.AppendString("${generic.notice}");
            serverMessage.AppendString("message");
            serverMessage.AppendString(alert);
            serverMessage.AppendString("link");
            serverMessage.AppendString("event:");
            serverMessage.AppendString("linkTitle");
            serverMessage.AppendString("ok");

            Yupi.GetGame().GetClientManager().StaffAlert(serverMessage);
        }
Exemplo n.º 25
0
        public override bool Execute(GameClient session, string[] pms)
        {
            string        str     = string.Join(" ", pms);
            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("BroadcastNotifMessageComposer"));

            message.AppendString($"{str}\r\n- {session.GetHabbo().UserName}");
            Yupi.GetGame().GetClientManager().QueueBroadcaseMessage(message);

            return(true);
        }
Exemplo n.º 26
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="SongItem" /> class.
        /// </summary>
        /// <param name="itemId">The item identifier.</param>
        /// <param name="songId">The song identifier.</param>
        /// <param name="baseName">The base item.</param>
        /// <param name="extraData">The extra data.</param>
        /// <param name="songCode">The song code.</param>
        public SongItem(uint itemId, uint songId, string baseName, string extraData, string songCode)
        {
            ItemId = itemId;
            SongId = songId;

            BaseItem = Yupi.GetGame().GetItemManager().GetItemByName(baseName);

            ExtraData = extraData;
            SongCode  = songCode;
        }
Exemplo n.º 27
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);
 }
Exemplo n.º 28
0
        /// <summary>
        ///     Mods the action result.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <param name="result">if set to <c>true</c> [result].</param>
        internal static void ModActionResult(uint userId, bool result)
        {
            GameClient clientByUserId = Yupi.GetGame().GetClientManager().GetClientByUserId(userId);

            clientByUserId.GetMessageHandler()
            .GetResponse()
            .Init(LibraryParser.OutgoingRequest("ModerationActionResultMessageComposer"));
            clientByUserId.GetMessageHandler().GetResponse().AppendInteger(userId);
            clientByUserId.GetMessageHandler().GetResponse().AppendBool(false);
            clientByUserId.GetMessageHandler().SendResponse();
        }
Exemplo n.º 29
0
        /// <summary>
        ///     Searches the new navigator.
        /// </summary>
        internal void SearchNewNavigator()
        {
            if (Session == null)
            {
                return;
            }
            string name = Request.GetString();
            string junk = Request.GetString();

            Session.SendMessage(Yupi.GetGame().GetNavigator().SerializeNewNavigator(name, junk, Session));
        }
Exemplo n.º 30
0
        public override bool Execute(GameClient session, string[] pms)
        {
            string messageUrl = pms[0];
            string messageStr = string.Join(" ", pms.Skip(1));

            Yupi.GetGame()
            .GetClientManager()
            .SendSuperNotif("${catalog.alert.external.link.title}", messageStr, "game_promo_small", session,
                            messageUrl, "${facebook.create_link_in_web}", true, false);
            return(true);
        }