Ejemplo n.º 1
0
        public void LoadSettings(DatabaseClient adapter)
        {
            Logging.Write("Loading your settings..");
            DataRow Row = adapter.ReadDataRow("SELECT * FROM server_settings LIMIT 1");

            GlobalClass.MaxRoomsPerUser          = (int)Row["MaxRoomsPerUser"];
            GlobalClass.Motd                     = (string)Row["motd"];
            GlobalClass.Timer                    = (int)Row["timer"];
            GlobalClass.Credits                  = (int)Row["credits"];
            GlobalClass.Pixels                   = (int)Row["pixels"];
            GlobalClass.Points                   = (int)Row["points"];
            GlobalClass.pixels_max               = (int)Row["pixels_max"];
            GlobalClass.credits_max              = (int)Row["credits_max"];
            GlobalClass.points_max               = (int)Row["points_max"];
            GlobalClass.MaxPetsPerRoom           = (int)Row["MaxPetsPerRoom"];
            GlobalClass.MaxMarketPlacePrice      = (int)Row["MaxMarketPlacePrice"];
            GlobalClass.MarketPlaceTax           = (int)Row["MarketPlaceTax"];
            GlobalClass.AntiDDoSEnabled          = PhoenixEnvironment.EnumToBool(Row["enable_antiddos"].ToString());
            GlobalClass.VIPclothesforHCusers     = PhoenixEnvironment.EnumToBool(Row["vipclothesforhcusers"].ToString());
            GlobalClass.RecordChatlogs           = PhoenixEnvironment.EnumToBool(Row["enable_chatlogs"].ToString());
            GlobalClass.RecordCmdlogs            = PhoenixEnvironment.EnumToBool(Row["enable_cmdlogs"].ToString());
            GlobalClass.RecordRoomVisits         = PhoenixEnvironment.EnumToBool(Row["enable_roomlogs"].ToString());
            GlobalClass.ExternalLinkMode         = (string)Row["enable_externalchatlinks"];
            GlobalClass.SecureSessions           = PhoenixEnvironment.EnumToBool(Row["enable_securesessions"].ToString());
            GlobalClass.AllowFriendlyFurni       = PhoenixEnvironment.EnumToBool(Row["allow_friendfurnidrops"].ToString());
            GlobalClass.cmdRedeemCredits         = PhoenixEnvironment.EnumToBool(Row["enable_cmd_redeemcredits"].ToString());
            GlobalClass.UnloadCrashedRooms       = PhoenixEnvironment.EnumToBool(Row["unload_crashedrooms"].ToString());
            GlobalClass.ShowUsersAndRoomsInAbout = PhoenixEnvironment.EnumToBool(Row["ShowUsersAndRoomsInAbout"].ToString());
            GlobalClass.IdleSleep                = (int)Row["idlesleep"];
            GlobalClass.IdleKick                 = (int)Row["idlekick"];
            GlobalClass.UseIP_Last               = PhoenixEnvironment.EnumToBool(Row["ip_lastforbans"].ToString());
            Logging.WriteLine("completed!");
        }
Ejemplo n.º 2
0
        public void LoadBots(DatabaseClient adapter)
        {
            Logging.Write("Loading Bot data..");
            this.Bots = new List <RoomBot>();
            DataTable           dataTable  = adapter.ReadDataTable("SELECT * FROM bots;");
            DataTable           dataTable2 = adapter.ReadDataTable("SELECT Id, bot_id, keywords, response_text, mode, serve_id FROM bots_responses;");
            DataTable           dataTable3 = adapter.ReadDataTable("SELECT text, shout, bot_id FROM bots_speech;");
            List <BotResponse>  Response   = new List <BotResponse>();
            List <RandomSpeech> Speech     = new List <RandomSpeech>();

            foreach (DataRow dataRow in dataTable2.Rows)
            {
                Response.Add(new BotResponse((uint)dataRow["Id"], (uint)dataRow["bot_id"], (string)dataRow["keywords"], (string)dataRow["response_text"], dataRow["mode"].ToString(), (int)dataRow["serve_id"]));
            }
            foreach (DataRow dataRow in dataTable3.Rows)
            {
                Speech.Add(new RandomSpeech((string)dataRow["text"], PhoenixEnvironment.EnumToBool(dataRow["shout"].ToString()), (uint)dataRow["bot_id"]));
            }
            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    string text  = (string)dataRow["ai_type"];
                    string text2 = text;
                    if (text2 == null)
                    {
                        goto IL_201;
                    }
                    AIType enum2_;
                    if (!(text2 == "generic"))
                    {
                        if (!(text2 == "guide"))
                        {
                            if (!(text2 == "pet"))
                            {
                                goto IL_201;
                            }
                            enum2_ = AIType.Pet;
                        }
                        else
                        {
                            enum2_ = AIType.Guide;
                        }
                    }
                    else
                    {
                        enum2_ = AIType.Generic;
                    }
IL_204:
                    this.Bots.Add(new RoomBot((uint)dataRow["Id"], (uint)dataRow["room_id"], enum2_, (string)dataRow["walk_mode"], (string)dataRow["name"], (string)dataRow["motto"], (string)dataRow["look"], (int)dataRow["x"], (int)dataRow["y"], (int)dataRow["z"], (int)dataRow["rotation"], (int)dataRow["min_x"], (int)dataRow["min_y"], (int)dataRow["max_x"], (int)dataRow["max_y"], ref Speech, ref Response, (int)dataRow["effect"]));
                    continue;
IL_201:
                    enum2_ = AIType.Generic;
                    goto IL_204;
                }
                Logging.WriteLine("completed!");
            }
        }
Ejemplo n.º 3
0
        public void UpdateVIP()
        {
            DataRow dataRow;

            using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
            {
                dataRow = adapter.ReadDataRow("SELECT vip FROM users WHERE Id = '" + this.Id + "' LIMIT 1;");
            }
            this.Vip = PhoenixEnvironment.EnumToBool(dataRow["vip"].ToString());
            ServerMessage Message = new ServerMessage(2u);

            if (this.Vip || GlobalClass.VIPclothesforHCusers)
            {
                Message.AppendInt32(2);
            }
            else
            {
                if (this.GetSubscriptionManager().HasSubscription("habbo_club"))
                {
                    Message.AppendInt32(1);
                }
                else
                {
                    Message.AppendInt32(0);
                }
            }
            if (this.HasRole("acc_anyroomowner"))
            {
                Message.AppendInt32(7);
            }
            else
            {
                if (this.HasRole("acc_anyroomrights"))
                {
                    Message.AppendInt32(5);
                }
                else
                {
                    if (this.HasRole("acc_supporttool"))
                    {
                        Message.AppendInt32(4);
                    }
                    else
                    {
                        if (this.Vip || GlobalClass.VIPclothesforHCusers || this.GetSubscriptionManager().HasSubscription("habbo_club"))
                        {
                            Message.AppendInt32(2);
                        }
                        else
                        {
                            Message.AppendInt32(0);
                        }
                    }
                }
            }
            this.GetClient().SendMessage(Message);
        }
Ejemplo n.º 4
0
 public MoodlightPreset method_3(string string_0)
 {
     string[] array = string_0.Split(new char[]
     {
         ','
     });
     if (!this.method_5(array[0]))
     {
         array[0] = "#000000";
     }
     return(new MoodlightPreset(array[0], int.Parse(array[1]), PhoenixEnvironment.EnumToBool(array[2])));
 }
Ejemplo n.º 5
0
        internal void RequestBuddy(string UserQuery)
        {
            DataRow dataRow = null;

            using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
            {
                adapter.AddParamWithValue("query", UserQuery.ToLower());
                dataRow = adapter.ReadDataRow("SELECT Id,block_newfriends FROM users WHERE username = @query LIMIT 1");
            }
            if (dataRow != null)
            {
                if (PhoenixEnvironment.EnumToBool(dataRow["block_newfriends"].ToString()) && !this.GetClient().GetHabbo().HasRole("ignore_friendsettings"))
                {
                    ServerMessage Message = new ServerMessage(260);
                    Message.AppendInt32(39);
                    Message.AppendInt32(3);
                    this.GetClient().SendMessage(Message);
                }
                else
                {
                    uint ToId = (uint)dataRow["Id"];
                    if (!this.method_8(this.UserId, ToId))
                    {
                        using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                        {
                            adapter.AddParamWithValue("toid", ToId);
                            adapter.AddParamWithValue("userid", UserId);
                            adapter.ExecuteQuery("INSERT INTO messenger_requests (to_id,from_id) VALUES (@toid,@userid)");
                        }
                        GameClient ToUser = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(ToId);
                        if (ToUser != null && ToUser.GetHabbo() != null)
                        {
                            uint num2 = 0;
                            using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                            {
                                adapter.AddParamWithValue("toid", ToId);
                                adapter.AddParamWithValue("userid", UserId);
                                num2 = adapter.ReadUInt32("SELECT Id FROM messenger_requests WHERE to_id = @toid AND from_id = @userid ORDER BY Id DESC LIMIT 1");
                            }
                            MessengerRequest Request = new MessengerRequest(num2, ToId, UserId, PhoenixEnvironment.GetGame().GetClientManager().GetNameById(this.UserId));
                            ToUser.GetHabbo().GetMessenger().OnNewRequest(num2, ToId, UserId);
                            ServerMessage Message = new ServerMessage(132);
                            Request.Serialize(Message);
                            ToUser.SendMessage(Message);
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public MoodlightData(uint mItemId)
        {
            this.ItemId = mItemId;
            DataRow Row = null;

            using (DatabaseClient @class = PhoenixEnvironment.GetDatabase().GetClient())
            {
                Row = @class.ReadDataRow("SELECT enabled,current_preset,preset_one,preset_two,preset_three FROM room_items_moodlight WHERE item_id = '" + mItemId + "' LIMIT 1");
            }
            if (Row == null)
            {
                throw new ArgumentException();
            }
            this.Enabled       = PhoenixEnvironment.EnumToBool(Row["enabled"].ToString());
            this.CurrentPreset = (int)Row["current_preset"];
            this.Presets       = new List <MoodlightPreset>();
            this.Presets.Add(this.method_3((string)Row["preset_one"]));
            this.Presets.Add(this.method_3((string)Row["preset_two"]));
            this.Presets.Add(this.method_3((string)Row["preset_three"]));
        }
Ejemplo n.º 7
0
        public static void LoadAchievements(DatabaseClient dbClient)
        {
            Logging.Write("Loading Achievements..");
            AchievementManager.Achievements.Clear();
            DataTable dataTable = dbClient.ReadDataTable("SELECT * FROM achievements");

            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    AchievementManager.Achievements.Add((uint)dataRow["Id"], new Achievement((uint)dataRow["Id"], (string)dataRow["type"], (int)dataRow["levels"], (string)dataRow["badge"], (int)dataRow["pixels_base"], (double)dataRow["pixels_multiplier"], PhoenixEnvironment.EnumToBool(dataRow["dynamic_badgelevel"].ToString()), (int)dataRow["score_base"]));
                }
                AchievementManager.Badges.Clear();
                dataTable = dbClient.ReadDataTable("SELECT * FROM badges");
                if (dataTable != null)
                {
                    foreach (DataRow dataRow in dataTable.Rows)
                    {
                        AchievementManager.Badges.Add((string)dataRow["badge"], (uint)dataRow["Id"]);
                    }
                    Logging.WriteLine("completed!");
                }
            }
        }
Ejemplo n.º 8
0
        public void method_1(DataRow Row)
        {
            this.Id          = (uint)Row["Id"];
            this.Name        = (string)Row["caption"];
            this.Description = (string)Row["description"];
            this.Type        = (string)Row["roomtype"];
            this.Owner       = (string)Row["owner"];
            this.Achievement = Convert.ToUInt32(Row["achievement"]);
            string text = Row["state"].ToString().ToLower();

            if (text != null)
            {
                if (text == "open")
                {
                    this.State = 0;
                    goto IL_DF;
                }
                if (text == "password")
                {
                    this.State = 2;
                    goto IL_DF;
                }
                if (!(text == "locked"))
                {
                }
            }
            this.State = 1;
IL_DF:
            this.Category         = (int)Row["category"];
            this.UsersNow         = (int)Row["users_now"];
            this.UsersMax         = (int)Row["users_max"];
            this.ModelName        = (string)Row["model_name"];
            this.CCTs             = (string)Row["public_ccts"];
            this.Score            = (int)Row["score"];
            this.Tags             = new List <string>();
            this.AllowPet         = PhoenixEnvironment.EnumToBool(Row["allow_pets"].ToString());
            this.AllowPetsEating  = PhoenixEnvironment.EnumToBool(Row["allow_pets_eat"].ToString());
            this.AllowWalkthrough = PhoenixEnvironment.EnumToBool(Row["allow_walkthrough"].ToString());
            this.bool_3           = false;
            this.Hidewall         = PhoenixEnvironment.EnumToBool(Row["allow_hidewall"].ToString());
            this.Wallthick        = (int)Row["wallthick"];
            this.Floorthick       = (int)Row["floorthick"];
            this.Password         = (string)Row["password"];
            this.Wallpaper        = (string)Row["wallpaper"];
            this.Floor            = (string)Row["floor"];
            this.Landscape        = (string)Row["landscape"];
            this.Event            = null;
            Dictionary <int, int> IconItems = new Dictionary <int, int>();

            string[] array;
            if (Row["icon_items"].ToString() != "")
            {
                array = Row["icon_items"].ToString().Split(new char[]
                {
                    '|'
                });
                for (int i = 0; i < array.Length; i++)
                {
                    string text2 = array[i];
                    if (!string.IsNullOrEmpty(text2))
                    {
                        string[] array2 = text2.Replace('.', ',').Split(new char[]
                        {
                            ','
                        });
                        int key   = 0;
                        int value = 0;
                        int.TryParse(array2[0], out key);
                        if (array2.Length > 1)
                        {
                            int.TryParse(array2[1], out value);
                        }
                        try
                        {
                            if (!IconItems.ContainsKey(key))
                            {
                                IconItems.Add(key, value);
                            }
                        }
                        catch (Exception ex)
                        {
                            Logging.LogException(string.Concat(new string[]
                            {
                                "Exception: ",
                                ex.ToString(),
                                "[",
                                text2,
                                "]"
                            }));
                        }
                    }
                }
            }
            this.myIcon = new RoomIcon((int)Row["icon_bg"], (int)Row["icon_fg"], IconItems);
            array       = Row["tags"].ToString().Split(new char[]
            {
                ','
            });
            for (int i = 0; i < array.Length; i++)
            {
                string Tag = array[i];
                this.Tags.Add(Tag);
            }
            this.class28_0 = PhoenixEnvironment.GetGame().GetRoomManager().GetModel(this.ModelName, this.Id);
        }
Ejemplo n.º 9
0
        private static Habbo GenerateHabbo(DataRow Data, string AuthTicket, GameClient Client, HabboData UserData)
        {
            uint   id             = (uint)Data["id"];
            string username       = (string)Data["username"];
            string realName       = (string)Data["real_name"];
            uint   rank           = (uint)Data["rank"];
            string motto          = (string)Data["motto"];
            string ip_last        = (string)Data["ip_last"];
            string look           = (string)Data["look"];
            string gender         = (string)Data["gender"];
            int    credits        = (int)Data["credits"];
            int    activityPoints = (int)Data["activity_points"];

            return(new Habbo(id, username, realName, AuthTicket, rank, motto, look, gender, credits, activityPoints, (double)Data["activity_points_lastupdate"], PhoenixEnvironment.EnumToBool(Data["is_muted"].ToString()), (uint)Data["home_room"], (int)Data["newbie_status"], PhoenixEnvironment.EnumToBool(Data["block_newfriends"].ToString()), PhoenixEnvironment.EnumToBool(Data["hide_inroom"].ToString()), PhoenixEnvironment.EnumToBool(Data["hide_online"].ToString()), PhoenixEnvironment.EnumToBool(Data["vip"].ToString()), (int)Data["volume"], (int)Data["vip_points"], PhoenixEnvironment.EnumToBool(Data["accept_trading"].ToString()), ip_last, Client, UserData, PhoenixEnvironment.EnumToBool(Data["friend_stream_enabled"].ToString())));
        }
Ejemplo n.º 10
0
        public void LoadItems(DatabaseClient adapter)
        {
            Logging.Write("Loading Items..");
            this.Item = new Dictionary <uint, Item>();
            DataTable ItemData = adapter.ReadDataTable("SELECT * FROM furniture;");

            if (ItemData != null)
            {
                foreach (DataRow dataRow in ItemData.Rows)
                {
                    try
                    {
                        this.Item.Add((uint)dataRow["Id"], new Item((uint)dataRow["Id"], (int)dataRow["sprite_id"], (string)dataRow["public_name"], (string)dataRow["item_name"], (string)dataRow["type"], (int)dataRow["width"], (int)dataRow["length"], (double)dataRow["stack_height"], PhoenixEnvironment.EnumToBool(dataRow["can_stack"].ToString()), PhoenixEnvironment.EnumToBool(dataRow["is_walkable"].ToString()), PhoenixEnvironment.EnumToBool(dataRow["can_sit"].ToString()), PhoenixEnvironment.EnumToBool(dataRow["allow_recycle"].ToString()), PhoenixEnvironment.EnumToBool(dataRow["allow_trade"].ToString()), PhoenixEnvironment.EnumToBool(dataRow["allow_marketplace_sell"].ToString()), PhoenixEnvironment.EnumToBool(dataRow["allow_gift"].ToString()), PhoenixEnvironment.EnumToBool(dataRow["allow_inventory_stack"].ToString()), (string)dataRow["interaction_type"], (int)dataRow["interaction_modes_count"], (string)dataRow["vending_ids"], dataRow["height_adjustable"].ToString(), Convert.ToByte((int)dataRow["EffectF"]), Convert.ToByte((int)dataRow["EffectM"])));
                    }
                    catch (Exception)
                    {
                        Logging.WriteLine("Could not load item #" + (uint)dataRow["Id"] + ", please verify the data is okay.");
                    }
                }
            }
            Logging.WriteLine("completed!");
            //Logging.Write("Loading Soundtracks..");
            //this.Sound = new Dictionary<int, Soundtrack>();
            //DataTable SoundData = adapter.ReadDataTable("SELECT * FROM soundtracks;");
            //if (SoundData != null)
            //{
            //    foreach (DataRow dataRow in SoundData.Rows)
            //    {
            //        try
            //        {
            //            this.Sound.Add((int)dataRow["Id"], new Soundtrack((int)dataRow["Id"], (string)dataRow["name"], (string)dataRow["author"], (string)dataRow["track"], (int)dataRow["length"]));
            //        }
            //        catch (Exception)
            //        {
            //            Logging.WriteLine("Could not load item #" + (uint)dataRow["Id"] + ", please verify the data is okay.");
            //        }
            //    }
            //}
            //Logging.WriteLine("completed!");
            Logging.Write("Loading Soundtracks..");
            SongManager.Initialize();
            Logging.WriteLine("completed!");
        }
Ejemplo n.º 11
0
        public AvatarEffectsInventoryComponent(uint UserId, GameClient pClient, HabboData UserData)
        {
            this.Session       = pClient;
            this.Effects       = new List <AvatarEffect>();
            this.UserId        = UserId;
            this.CurrentEffect = -1;
            this.Effects.Clear();

            DataTable     getUserEffects = UserData.GetUserEffects;
            StringBuilder QueryBuilder   = new StringBuilder();

            foreach (DataRow dataRow in getUserEffects.Rows)
            {
                AvatarEffect item = new AvatarEffect((int)dataRow["effect_id"], (int)dataRow["total_duration"], PhoenixEnvironment.EnumToBool(dataRow["is_activated"].ToString()), (double)dataRow["activated_stamp"]);
                if (item.HasExpired)
                {
                    QueryBuilder.Append(string.Concat(new object[]
                    {
                        "DELETE FROM user_effects WHERE user_id = '",
                        UserId,
                        "' AND effect_id = '",
                        item.EffectId,
                        "' LIMIT 1; "
                    }));
                }
                else
                {
                    this.Effects.Add(item);
                }
            }
            if (QueryBuilder.Length > 0)
            {
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    adapter.ExecuteQuery(QueryBuilder.ToString());
                }
            }
        }
Ejemplo n.º 12
0
        public void LoadModels(DatabaseClient class6_0)
        {
            Logging.Write("Loading Room Models..");
            this.Models.Clear();
            DataTable dataTable = class6_0.ReadDataTable("SELECT Id,door_x,door_y,door_z,door_dir,heightmap,public_items,club_only FROM room_models");

            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    string text = (string)dataRow["Id"];
                    this.Models.Add(text, new RoomModel(text, (int)dataRow["door_x"], (int)dataRow["door_y"], (double)dataRow["door_z"], (int)dataRow["door_dir"], (string)dataRow["heightmap"], (string)dataRow["public_items"], PhoenixEnvironment.EnumToBool(dataRow["club_only"].ToString())));
                }
                Logging.WriteLine("completed!");
            }
        }
Ejemplo n.º 13
0
        public void processCommand(string data)
        {
            string str = data.Split(new char[] { Convert.ToChar(1) })[0];
            string s   = data.Split(new char[] { Convert.ToChar(1) })[1];

            GameClient clientByUserID = null;
            DataRow    Row            = null;
            Habbo      habbo;
            Room       room;
            GameClient clientByUsername;
            string     text3 = str.ToLower();
            uint       uint_2;
            uint       num2;
            uint       num3;
            string     text5;

            switch (str.ToLower())
            {
            case "update_items":
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    PhoenixEnvironment.GetGame().GetItemManager().LoadItems(adapter);
                }
                break;

            case "updateusersrooms":
                habbo = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(Convert.ToUInt32(s)).GetHabbo();
                if (habbo != null)
                {
                    using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                    {
                        habbo.UpdateRooms(adapter);
                    }
                }
                break;

            case "senduser":
                num2 = uint.Parse(s.Split(new char[] { ' ' })[0]);
                num3 = uint.Parse(s.Split(new char[] { ' ' })[1]);

                clientByUsername = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(num2);
                room             = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(num3);
                if (clientByUsername != null)
                {
                    ServerMessage message1 = new ServerMessage(286);
                    message1.AppendBoolean(room.IsPublic);
                    message1.AppendUInt(num3);
                    clientByUsername.SendMessage(message1);
                }
                break;

            case "updatevip":
                habbo = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(Convert.ToUInt32(s)).GetHabbo();
                if (habbo != null)
                {
                    habbo.UpdateVIP();
                }
                break;

            case "giftitem":
            case "giveitem":
                num2 = uint.Parse(s.Split(new char[] { ' ' })[0]);
                uint   uint_   = uint.Parse(s.Split(new char[] { ' ' })[1]);
                int    int_    = int.Parse(s.Split(new char[] { ' ' })[2]);
                string string_ = s.Substring(num2.ToString().Length + uint_.ToString().Length + int_.ToString().Length + 3);

                PhoenixEnvironment.GetGame().GetCatalog().GiveGift(string_, num2, uint_, int_);
                break;

            case "unloadroom":
                uint_2 = uint.Parse(s);
                room   = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(uint_2);
                PhoenixEnvironment.GetGame().GetRoomManager().UnloadRoom(room);
                break;

            case "roomalert":
                num3 = uint.Parse(s.Split(new char[] { ' ' })[0]);

                room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(num3);
                if (room != null)
                {
                    string msg = s.Substring(num3.ToString().Length + 1);
                    for (int i = 0; i < room.UserList.Length; i++)
                    {
                        RoomUser user = room.UserList[i];
                        if (user != null)
                        {
                            user.GetClient().SendNotif(msg);
                        }
                    }
                }
                break;

            case "updategroup":
                int int_2 = int.Parse(s.Split(new char[] { ' ' })[0]);

                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    GroupManager.UpdateGroup(adapter, int_2);
                }
                break;

            case "updateusersgroups":
                uint_2 = uint.Parse(s);
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint_2).GetHabbo().UpdateGroups(adapter);
                }
                break;

            case "shutdown":
                PhoenixEnvironment.BeginShutDown();
                break;

            case "update_filter":
            case "refresh_filter":
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    ChatCommandHandler.UpdateFilters(adapter);
                }
                break;

            case "updatecredits":
                clientByUserID = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(s));
                if (clientByUserID != null)
                {
                    int int_3 = 0;
                    using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                    {
                        int_3 = (int)adapter.ReadDataRow("SELECT credits FROM users WHERE UserId = '" + clientByUserID.GetHabbo().Id + "' LIMIT 1")[0];
                    }
                    clientByUserID.GetHabbo().Credits = int_3;
                    clientByUserID.GetHabbo().UpdateCreditsBalance(false);
                }
                break;

            case "updatesettings":
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    PhoenixEnvironment.GetGame().LoadSettings(adapter);
                }
                break;

            case "updatepixels":
                clientByUserID = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(s));
                if (clientByUserID != null)
                {
                    int int_4 = 0;
                    using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                    {
                        int_4 = (int)adapter.ReadDataRow("SELECT activity_points FROM users WHERE UserId = '" + clientByUserID.GetHabbo().Id + "' LIMIT 1")[0];
                    }
                    clientByUserID.GetHabbo().ActivityPoints = int_4;
                    clientByUserID.GetHabbo().UpdateActivityPointsBalance(false);
                }
                break;

            case "updatepoints":
                clientByUserID = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(s));
                if (clientByUserID != null)
                {
                    clientByUserID.GetHabbo().UpdateShellsBalance(true, false);
                }
                break;

            case "reloadbans":
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    PhoenixEnvironment.GetGame().GetBanManager().LoadBans(adapter);
                }
                PhoenixEnvironment.GetGame().GetClientManager().CheckForAllBanConflicts();
                break;

            case "update_bots":
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    PhoenixEnvironment.GetGame().GetBotManager().LoadBots(adapter);
                }
                break;

            case "signout":
                PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(s)).Disconnect();
                break;

            case "exe":
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    adapter.ExecuteQuery(s);
                }
                break;

            case "alert":
                string text6 = s.Split(new char[] { ' ' })[0];
                text5 = s.Substring(text6.Length + 1);
                ServerMessage Message8 = new ServerMessage(808);
                Message8.AppendStringWithBreak(TextManager.GetText("mus_alert_title"));
                Message8.AppendStringWithBreak(text5);
                PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint.Parse(text6)).SendMessage(Message8);
                break;

            case "sa":
                ServerMessage Message = new ServerMessage(134);
                Message.AppendUInt(0);
                Message.AppendString("PHX: " + s);
                PhoenixEnvironment.GetGame().GetClientManager().BroadcastMessageToStaff(Message, Message);
                break;

            case "ha":
                ServerMessage Message2 = new ServerMessage(808);
                Message2.AppendStringWithBreak(TextManager.GetText("mus_ha_title"));
                Message2.AppendStringWithBreak(s);
                ServerMessage hotelView = new ServerMessage(161);
                hotelView.AppendStringWithBreak(s);
                PhoenixEnvironment.GetGame().GetClientManager().BroadcastMessage(Message2, hotelView);
                break;

            case "hal":
                string text4 = s.Split(new char[] { ' ' })[0];
                text5 = s.Substring(text4.Length + 1);
                ServerMessage Message4 = new ServerMessage(161u);
                Message4.AppendStringWithBreak(string.Concat(new string[]
                {
                    TextManager.GetText("mus_hal_title"),
                    "\r\n",
                    text5,
                    "\r\n-",
                    TextManager.GetText("mus_hal_tail")
                }));
                Message4.AppendStringWithBreak(text4);
                PhoenixEnvironment.GetGame().GetClientManager().BroadcastMessage(Message4);
                break;

            case "updatemotto":
            case "updatelook":
                uint_2         = uint.Parse(s);
                clientByUserID = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(uint_2);
                using (DatabaseClient class2 = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    Row = class2.ReadDataRow("SELECT look,gender,motto,mutant_penalty,block_newfriends FROM users WHERE UserId = '" + clientByUserID.GetHabbo().Id + "' LIMIT 1");
                }
                clientByUserID.GetHabbo().Look            = (string)Row["look"];
                clientByUserID.GetHabbo().Gender          = Row["gender"].ToString().ToLower();
                clientByUserID.GetHabbo().Motto           = PhoenixEnvironment.FilterInjectionChars((string)Row["motto"]);
                clientByUserID.GetHabbo().BlockNewFriends = PhoenixEnvironment.EnumToBool(Row["block_newfriends"].ToString());
                ServerMessage Message5 = new ServerMessage(266);
                Message5.AppendInt32(-1);
                Message5.AppendStringWithBreak(clientByUserID.GetHabbo().Look);
                Message5.AppendStringWithBreak(clientByUserID.GetHabbo().Gender.ToLower());
                Message5.AppendStringWithBreak(clientByUserID.GetHabbo().Motto);
                clientByUserID.SendMessage(Message5);
                if (clientByUserID.GetHabbo().InRoom)
                {
                    room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(clientByUserID.GetHabbo().CurrentRoomId);
                    RoomUser      class6   = room.GetRoomUserByHabbo(clientByUserID.GetHabbo().Id);
                    ServerMessage Message6 = new ServerMessage(266u);
                    Message6.AppendInt32(class6.VirtualId);
                    Message6.AppendStringWithBreak(clientByUserID.GetHabbo().Look);
                    Message6.AppendStringWithBreak(clientByUserID.GetHabbo().Gender.ToLower());
                    Message6.AppendStringWithBreak(clientByUserID.GetHabbo().Motto);
                    Message6.AppendInt32(clientByUserID.GetHabbo().AchievementScore);
                    Message6.AppendStringWithBreak("");
                    room.SendMessage(Message6, null);
                }
                text3 = str.ToLower();
                //if (text3 == null)
                //{
                //    ServerMessage message = new ServerMessage(1);
                //    message.AppendString("Hello Housekeeping, Love from Phoenix Emu");
                //    socket.Send(message.GetBytes());
                //}
                if (text3 == "updatemotto")
                {
                    PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(clientByUserID, 5u, 1);
                }
                if (text3 == "updatelook")
                {
                    PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(clientByUserID, 1u, 1);
                }
                break;

            default:
                ServerMessage message11 = new ServerMessage(1);
                message11.AppendString("Hello Housekeeping, Love from Phoenix Emu");
                socket.Send(message11.GetBytes());
                break;
            }
        }
Ejemplo n.º 14
0
        public void Initialize(DatabaseClient adapter)
        {
            Logging.Write("Loading Navigator..");
            this.PrivateCategories.Clear();
            this.PublicItems.Clear();
            this.dictionary_1.Clear();
            DataTable dataTable  = adapter.ReadDataTable("SELECT Id,caption,min_rank,cantrade FROM navigator_flatcats WHERE enabled = '1'");
            DataTable dataTable2 = adapter.ReadDataTable("SELECT Id,bannertype,caption,image,image_type,room_id,category,category_parent_id FROM navigator_publics ORDER BY ordernum ASC;");

            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    this.PrivateCategories.Add(new FlatCat((int)dataRow["Id"], (string)dataRow["caption"], (int)dataRow["min_rank"], PhoenixEnvironment.EnumToBool(dataRow["cantrade"].ToString())));
                }
            }
            if (dataTable2 != null)
            {
                foreach (DataRow dataRow in dataTable2.Rows)
                {
                    this.PublicItems.Add((int)dataRow["Id"], new PublicItem((int)dataRow["Id"], int.Parse(dataRow["bannertype"].ToString()), (string)dataRow["caption"], (string)dataRow["image"], (dataRow["image_type"].ToString().ToLower() == "internal") ? PublicImageType.INTERNAL : PublicImageType.EXTERNAL, (uint)dataRow["room_id"], PhoenixEnvironment.EnumToBool(dataRow["category"].ToString()), (int)dataRow["category_parent_id"]));
                    if (!this.PublicItems[(int)dataRow["Id"]].Category)
                    {
                        this.dictionary_1.Add((int)dataRow["Id"], this.PublicItems[(int)dataRow["Id"]]);
                    }
                }
            }
            Logging.WriteLine("completed!");
        }