Esempio n. 1
0
        /// <summary>
        /// Obtiene la clase Habbo mediante el Id de usuario.
        /// </summary>
        /// <param name="userId">Id del usuario</param>
        /// <returns></returns>
        internal static Habbo getHabboCache(uint userId)
        {
            GameClient client = OtanixEnvironment.GetGame().GetClientManager().GetClientByUserID(userId);

            if (client != null && client.GetHabbo() != null)
            {
                if (usersHabboCache.ContainsKey(userId))
                {
                    usersHabboCache.Remove(userId);
                }

                return(client.GetHabbo());
            }

            if (usersHabboCache.ContainsKey(userId))
            {
                return(usersHabboCache[userId]);
            }

            Habbo habbo = UserDataFactory.GetUserDataCache(userId);

            if (habbo != null)
            {
                if (!usersHabboCache.ContainsKey(userId))
                {
                    usersHabboCache.Add(userId, habbo);
                }
            }

            return(habbo);
        }
Esempio n. 2
0
        /// <summary>
        /// Obtiene el nombre de usuario mediante el Id de usuario.
        /// </summary>
        /// <param name="userId">Id del usuario.</param>
        /// <returns></returns>
        internal static string getUsernameById(uint userId)
        {
            if (usernameById.ContainsKey(userId))
            {
                return(usernameById[userId]);
            }

            string     username = "";
            GameClient client   = OtanixEnvironment.GetGame().GetClientManager().GetClientByUserID(userId);

            if (client != null && client.GetHabbo() != null)
            {
                username = client.GetHabbo().Username;
            }
            else
            {
                using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT username FROM users WHERE id = " + userId);
                    username = dbClient.getString();
                }
            }

            if (username != "")
            {
                if (!usernameById.ContainsKey(userId))
                {
                    usernameById.Add(userId, username);
                }
            }

            return(username);
        }
Esempio n. 3
0
        /// <summary>
        /// Obtiene el Id de usuario mediante el nombre de usuario.
        /// </summary>
        /// <param name="username">Nombre de usuario.</param>
        /// <returns></returns>
        internal static uint getIdByUsername(string username)
        {
            if (idByUsername.ContainsKey(username))
            {
                return(idByUsername[username]);
            }

            uint       userId = 0;
            GameClient client = OtanixEnvironment.GetGame().GetClientManager().GetClientByUsername(username);

            if (client != null && client.GetHabbo() != null)
            {
                userId = client.GetHabbo().Id;
            }
            else
            {
                using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT id FROM users WHERE username = @usrname");
                    dbClient.addParameter("usrname", username);
                    userId = Convert.ToUInt32(dbClient.getInteger());
                }
            }

            if (userId > 0)
            {
                if (!idByUsername.ContainsKey(username))
                {
                    idByUsername.Add(username, userId);
                }
            }

            return(userId);
        }
Esempio n. 4
0
        internal static void enterProvisionalRoom(GameClient Session)
        {
            if (usersProvisionalHomes.ContainsKey(Session.GetHabbo().Id))
            {
                Room room = OtanixEnvironment.GetGame().GetRoomManager().LoadRoom(usersProvisionalHomes[Session.GetHabbo().Id]);
                if (room == null)
                {
                    return;
                }

                Session.GetMessageHandler().enterOnRoom3(room);

                usersProvisionalHomes.Remove(Session.GetHabbo().Id);
            }
        }
Esempio n. 5
0
        internal static void Initialize(IQueryAdapter dbClient)
        {
            Configuration = new ConfigurationData(Path.Combine(Application.StartupPath, @"Settings/values.ini"));

            HOTEL_LINK  = Configuration.data["hotel.link"];
            PIN_CLIENTE = Configuration.data["pin.client"];
            //HOTEL_ID = int.Parse(Configuration.data["hotel.id"]);
            TILE_STACKING_VALUE = Configuration.data["tile.stacking.value"];
            FURNIDATA_LINK      = Configuration.data["hotel.furnidata"];
            FIGUREDATA_LINK     = Configuration.data["hotel.figuredata"];
            EXCHANGE_DIAMONDS   = Configuration.data["exchange.diamonds"].ToLower() == "true";
            CRYPTO_CLIENT_SIDE  = Configuration.data["crypto.client.side"].ToLower() == "true";
            SHOW_PACKETS        = Configuration.data["show.packets"].ToLower() == "true";
            HOTEL_LUCRATIVO     = Configuration.data["hotel.lucrativo"].ToLower() == "true";
            HOTEL_LUCRATIVO_ALERTAR_GANHOU_MOEDAS = Configuration.data["hotel.lucrativo.alertar.ganhou.moedas"].ToLower() == "true";
            HOTEL_LUCRATIVO_DARMOEDAS             = Configuration.data["hotel.lucrativo.darmoedas"].ToLower() == "true";
            HOTEL_LUCRATIVO_MOEDAS_TEMPO          = int.Parse(Configuration.data["hotel.lucrativo.quantidade.tempo.minutos"]);
            HOTEL_LUCRATIVO_QUANTIDADE_MOEDAS     = int.Parse(Configuration.data["hotel.lucrativo.quantidade.moedas"]);

            // CAMERA
            CAMERA_SERVER_LOAD = Configuration.data["camera.server.load"];
            CAMERA_BASEID      = uint.Parse(Configuration.data["camera.baseid"]);

            // CHATS IDS
            CHAT_TYPES_USERS = new List <int>();
            string chattypesusers = Configuration.data["chat_types_users"];

            foreach (string value in chattypesusers.Split(','))
            {
                if (!CHAT_TYPES_USERS.Contains(int.Parse(value)))
                {
                    CHAT_TYPES_USERS.Add(int.Parse(value));
                }
            }
            CHAT_USER_ID = uint.Parse(Configuration.data["chat_user_id"]);

            // ANTI SPAM CONFIGURATION
            CHECK_EVERY            = int.Parse(Configuration.data["checkEveryXMessages"]);
            SENDINGS_TO_WHITE_LIST = int.Parse(Configuration.data["whitelistAfterXSendings"]);
            PROCESS_FOR_X_MINUTES  = int.Parse(Configuration.data["FullProcessingForXMinutes"]);

            // FRIENDS LIMITS
            FRIENDS_REQUEST_LIMIT = Int32.Parse(Configuration.data["client.maxrequests"]);
            FRIENDS_LIMIT         = Int32.Parse(Configuration.data["client.maxpossiblefriends"]);

            // INVENTARY LIMITS
            INVENTARY_ITEMS_LIMIT = uint.Parse(Configuration.data["client.maxitemsininventary"]);

            // MAXIMUMS
            MAX_NAME_CHANGES  = Int32.Parse(Configuration.data["game.maxnamechanges"]);
            MAX_BOTS_PER_ROOM = Int32.Parse(Configuration.data["max.bots.room"]);
            MAX_BOTS_MESSAGES = Int32.Parse(Configuration.data["max.bots.messages"]);
            MAX_PETS_PER_ROOM = Int32.Parse(Configuration.data["max.pets.room"]);

            // BOOLS AND URLS
            LOG_EXCEPTIONS = Configuration.data["logExceptions"].ToLower() == "true";
            PRISAOID       = uint.Parse(Configuration.data["prisaoId"]);

            // EXTRA INFO
            FIRST_PRESENT_ID         = UInt32.Parse(Configuration.data["first.present.wrap.id"]);
            LAST_PRESENT_SPRITEID    = UInt32.Parse(Configuration.data["last.present.wrap.id"]);
            FIRST_BALLOON_PRESENT_ID = UInt32.Parse(Configuration.data["first.balloon.present.id"]);
            LAST_BALLOON_PRESENT_ID  = UInt32.Parse(Configuration.data["last.balloon.present.id"]);
            CLUB_PAGE_ID             = Int32.Parse(Configuration.data["club.hc.page"]);

            dbClient.setQuery("SELECT item_id FROM items_base WHERE item_name = 'ecotron_box' LIMIT 1");
            FURNIMATIC_BOX_ITEMID = dbClient.getInteger();

            dbClient.setQuery("SELECT item_id FROM items_base WHERE item_name = 'song_disk' LIMIT 1");
            JUKEBOX_CD_BASEID = dbClient.getInteger();

            // CATALOGUE
            CATALOG_NOSEARCH_PAGES = new List <int>();
            if (Configuration.data["catalog.nosearch.pages"].Length > 0)
            {
                foreach (string value in Configuration.data["catalog.nosearch.pages"].Split(','))
                {
                    CATALOG_NOSEARCH_PAGES.Add(Int32.Parse(value));
                }
            }

            // DIAMONDS
            DIAMONDS_ENABLED = Configuration.data["diamonds.enable"].ToLower() == "true";
            DIAMONDS_AMOUNT  = UInt32.Parse(Configuration.data["diamonds.amount"]);
            DIAMONDS_MINUTES = UInt32.Parse(Configuration.data["diamonds.minutes"]);
            DIAMONDS_ALERT   = Configuration.data["diamonds.alert"].ToLower() == "true";

            // HORSE
            dbClient.setQuery("SELECT item_id FROM items_base WHERE item_name = 'horse_saddle1' LIMIT 1");
            HORSECHAIR1 = (uint)dbClient.getInteger();

            dbClient.setQuery("SELECT item_id FROM items_base WHERE item_name = 'horse_saddle2' LIMIT 1");
            HORSECHAIR2 = (uint)dbClient.getInteger();

            PET_FOODS = new int[38];

            // NAVIGATOR
            NAVIGATOR_STAFF_SELECTION = Configuration.data["navigator.selection.staff"];
            ROOMS_X_PESTAÑA           = Int32.Parse(Configuration.data["rooms.x.tab"]);

            // PREMIUM
            PREMIUM_BASEID = UInt32.Parse(Configuration.data["premium.baseid"]);

            EVENTHA_ICON = Configuration.data["eventha.icon"];

            if (OtanixEnvironment.GetGame() != null)
            {
                OtanixEnvironment.GetGame().GetRoomRankConfig().Initialize();
            }
        }