Esempio n. 1
0
        public void method_3(int int_1)
        {
            AvatarEffect @class = this.method_5(int_1, false);

            if (@class != null && [email protected]_0 && [email protected]_0 && (this.method_8() != null && this.method_8().GetHabbo() != null))
            {
                Room class2 = this.method_9();
                if (class2 != null)
                {
                    RoomUser class3 = class2.GetRoomUserByHabbo(this.method_8().GetHabbo().Id);
                    if (class3.byte_1 <= 0 && class3.class34_1 == null)
                    {
                        using (DatabaseClient class4 = Essential.GetDatabase().GetClient())
                        {
                            class4.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE user_effects SET is_activated = '1', activated_stamp = '",
                                Essential.GetUnixTimestamp(),
                                "' WHERE user_id = '",
                                this.uint_0,
                                "' AND effect_id = '",
                                int_1,
                                "' LIMIT 1"
                            }));
                        }
                        @class.method_0();
                        ServerMessage Message = new ServerMessage(Outgoing.EnableEffect); // Updated
                        Message.AppendInt32(@class.int_0);
                        Message.AppendInt32(@class.int_1);
                        this.method_8().SendMessage(Message);
                    }
                }
            }
        }
Esempio n. 2
0
        public void method_16(GameClient Session, uint uint_0, string string_0, bool bool_0)
        {
            GameClient @class = Essential.GetGame().GetClientManager().GetClient(uint_0);

            if (@class != null && @class.GetHabbo().Id != Session.GetHabbo().Id)
            {
                if (bool_0 && @class.GetHabbo().Rank >= Session.GetHabbo().Rank)
                {
                    Session.SendNotification(EssentialEnvironment.GetExternalText("mod_error_permission_caution"));
                    //bool_0 = false;
                    return;
                }
                @class.SendNotification(string_0, 0);
                //if (bool_0)
                //{
                using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                {
                    try
                    {
                        class2.AddParamWithValue("description", string_0);
                        class2.AddParamWithValue("timestamp", (int)Essential.GetUnixTimestamp());
                        class2.ExecuteQuery("INSERT INTO hp_verwarnungen (user_id,title,beschreibung,timestamp,endtimestamp_verwarnung,mod_id,mod_ip) VALUES (" + uint_0 + ",'Mod-Tool',@description,@timestamp,'0'," + Session.GetHabbo().Id + ",'" + Session.GetConnection().LocalEndPoint.ToString().Split(':')[0] + "')");
                        class2.ExecuteQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = '" + uint_0 + "' LIMIT 1");
                    }catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }
                //}
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string message = Essential.FilterString(Event.PopFixedString());

            if (string.IsNullOrEmpty(message.Trim()))
            {
                return;
            }
            if (Essential.GetAntiAd().ContainsIllegalWord(message))
            {
                ServerMessage Message2 = new ServerMessage(Outgoing.InstantChat);
                Message2.AppendUInt(0u);
                Message2.AppendString("[AWS] " + Session.GetHabbo().Username + ": " + message);
                Message2.AppendString(Essential.GetUnixTimestamp() + string.Empty);
                Essential.GetGame().GetClientManager().SendToStaffs(Session, Message2);
                Session.SendNotification(Essential.GetGame().GetRoleManager().GetConfiguration().getData("antiad.alert"));
                return;
            }
            // I don't "bobba" filter the word.. I just check if the message contains a Illegal word. And if,
            // I "close" the Event!
            Essential.GetGame().GetGuideManager().GetTicket(Session.GetHabbo().Id).StoreMessage(message, Session.GetHabbo().Id);
            ServerMessage Message = new ServerMessage(Outgoing.GuideSessionMessage); //Rootkit

            Message.AppendString(message);
            Message.AppendInt32(Session.GetHabbo().Id);
            Essential.GetGame().GetGuideManager().GetTicket(Session.GetHabbo().Id).SendToTicket(Message);
        }
Esempio n. 4
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string message = Event.PopFixedString();

            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                DataRow dr          = dbClient.ReadDataRow("SELECT * FROM friend_stream WHERE userid='" + Session.GetHabbo().Id.ToString() + "' ORDER BY time DESC LIMIT 1");
                double  currentTime = Essential.GetUnixTimestamp();
                if (dr == null)
                {
                    string Id     = Session.GetHabbo().Id.ToString();
                    string Gender = Session.GetHabbo().Gender.ToString();
                    string look   = Session.GetHabbo().Figure.ToString();
                    dbClient.AddParamWithValue("@endstring", message);
                    dbClient.ExecuteQuery("INSERT INTO friend_stream (`type`,`userid`,`gender`,`look`,`time`,`data`,`data_extra`) VALUES ('1','" + Id + "','" + Gender + "','" + look + "','" + currentTime + "', @endstring, '0');");
                }
                else
                {
                    double lastTime = (double)dr["time"];
                    double seconds  = currentTime - lastTime;
                    if (seconds > 300)
                    {
                        string Id     = Session.GetHabbo().Id.ToString();
                        string Gender = Session.GetHabbo().Gender.ToString();
                        string look   = Session.GetHabbo().Figure.ToString();
                        dbClient.AddParamWithValue("@endstring", message);
                        dbClient.ExecuteQuery("INSERT INTO friend_stream (`type`,`userid`,`gender`,`look`,`time`,`data`,`data_extra`) VALUES ('1','" + Id + "','" + Gender + "','" + look + "','" + currentTime + "', @endstring, '0');");
                    }
                    else
                    {
                        Session.SendNotification("Du kannst nur alle 15 Minuten einen Friendstream Eintrag erstellen! Versuchs später nochmal.");
                    }
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            uint   num  = Event.PopWiredUInt();
            string text = Essential.FilterString(Event.PopFixedString());

            if (Session != null && Session.GetHabbo() != null && Session.GetHabbo().GetMessenger() != null && Session.GetHabbo().PassedSafetyQuiz)
            {
                Session.GetHabbo().CheckForUnmute();
                if (num == 0u && Session.GetHabbo().HasFuse("cmd_sa"))
                {
                    ServerMessage Message = new ServerMessage(Outgoing.InstantChat);
                    Message.AppendUInt(0u);
                    Message.AppendString(Session.GetHabbo().Username + ": " + text);
                    Message.AppendString(Essential.GetUnixTimestamp() + string.Empty);
                    Essential.GetGame().GetClientManager().SendToStaffs(Session, Message, false);
                }
                else
                {
                    if (num == 0u)
                    {
                        /* ServerMessage Message2 = new ServerMessage(1133);
                         *                       Message2.AppendInt32(4);
                         *                       Message2.AppendUInt(0u);
                         *                       Session.SendMessage(Message2);*/
                    }
                    else
                    {
                        if (Session != null && Session.GetHabbo() != null)
                        {
                            Session.GetHabbo().GetMessenger().method_18(num, text);
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        internal void UpdatePlate(int LobbyId, int ShieldId, int UserId, double Distance, double Speed, bool Failed)
        {
            int ShieldStatue = 0;
            int Stars        = 0;
            int CurrentPlate = 1;

            foreach (GamePlayer Player in Lobbys[LobbyId].Players)
            {
                if (Player.UserId == UserId)
                {
                    ShieldStatue              = Player.ShieldStatus;
                    Stars                     = Player.Stars;
                    Player.PlateLocation      = 1.00;
                    Player.PlateTimer.Enabled = false;
                    if (ShieldStatue == 1)
                    {
                        Player.Stars++;
                        Stars                = Player.Stars;
                        CurrentPlate         = Player.CurrentPlate + 1;
                        Player.CurrentPlate  = CurrentPlate;
                        Player.ShieldStatus  = 0;
                        Player.PlateLocation = 1.00;
                        Player.PlateWaiter   = Essential.GetUnixTimestamp() + 3;
                    }
                }
            }
            foreach (GamePlayer Playeri in Lobbys[LobbyId].Players)
            {
                ServerMessage UpdatePlayer = new ServerMessage(Outgoing.UpdatePlayer);
                UpdatePlayer.AppendInt32(CurrentPlate);              //plate id(?)
                UpdatePlayer.AppendInt32(UserId);                    //user id
                UpdatePlayer.AppendString(Distance.ToString());      //distance
                UpdatePlayer.AppendString(Speed.ToString());         //speed
                UpdatePlayer.AppendInt32(ShieldStatue == 1 ? 3 : 4); //state
                UpdatePlayer.AppendBoolean(false);                   //failed
                Playeri.UClient.SendMessage(UpdatePlayer);

                if (ShieldStatue == 1)
                {
                    ServerMessage PlateDown = new ServerMessage(Outgoing.PlateDown);
                    PlateDown.AppendInt32(Stars);
                    PlateDown.AppendInt32(Playeri.UserId);
                    PlateDown.AppendInt32(3);
                    PlateDown.AppendInt32(CurrentPlate);
                    PlateDown.AppendInt32(12);
                    Playeri.UClient.SendMessage(PlateDown);
                }
                else
                {
                    ServerMessage PlateDown = new ServerMessage(Outgoing.PlateDown);
                    PlateDown.AppendInt32(Stars);
                    PlateDown.AppendInt32(Playeri.UserId);
                    PlateDown.AppendInt32(3);
                    PlateDown.AppendInt32(CurrentPlate);
                    PlateDown.AppendInt32(12);
                    Playeri.UClient.SendMessage(PlateDown);
                }
            }
        }
Esempio n. 7
0
        internal GameLobby CreateLobby()
        {
            int       NlobbId = Lobbys.Count + 1;
            GameLobby NLobby  = new GameLobby(NlobbId, Essential.GetUnixTimestamp());

            Lobbys.Add(NlobbId, NLobby);
            return(Lobbys[NlobbId]);
        }
Esempio n. 8
0
        public void method_3(string type, int time)
        {
            type = type.ToLower();

            if (this.Subscriptions.ContainsKey(type))
            {
                Subscription subscription = this.Subscriptions[type];

                subscription.AppendTime(time);

                if (subscription.ExpirationTime <= 0 || subscription.ExpirationTime >= 2147483647)
                {
                    return;
                }

                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("subcrbr", type);

                    dbClient.ExecuteQuery(string.Concat(new object[]
                    {
                        "UPDATE user_subscriptions SET timestamp_expire = '",
                        subscription.ExpirationTime,
                        "' WHERE user_id = '",
                        this.UserId,
                        "' AND subscription_id = @subcrbr LIMIT 1"
                    }));
                    return;
                }
            }

            if (!this.Subscriptions.ContainsKey("habbo_vip"))
            {
                int now        = (int)Essential.GetUnixTimestamp();
                int expiration = (int)Essential.GetUnixTimestamp() + time;

                Subscription subscription = new Subscription(type, now, expiration);

                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("subcrbr", type);

                    dbClient.ExecuteQuery(string.Concat(new object[]
                    {
                        "INSERT INTO user_subscriptions (user_id,subscription_id,timestamp_activated,timestamp_expire) VALUES ('",
                        this.UserId,
                        "',@subcrbr,'",
                        now,
                        "','",
                        expiration,
                        "')"
                    }));
                }

                this.Subscriptions.Add(subscription.Type.ToLower(), subscription);
            }
        }
Esempio n. 9
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string        ReqTimer       = Event.PopFixedString();
            int           RemLeng        = (int.Parse(ReqTimer) - (int)Essential.GetUnixTimestamp());
            ServerMessage ReceptionTimer = new ServerMessage(Outgoing.ReceptionTimer);

            ReceptionTimer.AppendString(ReqTimer);
            ReceptionTimer.AppendInt32((RemLeng > 0 ? RemLeng : 0));
            Session.SendMessage(ReceptionTimer);
        }
Esempio n. 10
0
        public int CalculateHCSubscription(Habbo habbo)
        {
            if (habbo.GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                return(((int)Essential.GetUnixTimestamp() - habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").StartingTime) / 2678400);
            }
            else
            {
                if (habbo.GetSubscriptionManager().GetSubscriptionByType(habbo.Id.ToString()) != null)
                {
                    return((habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").ExpirationTime - habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").StartingTime) / 2678400);
                }

                return(0);
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int GameId = Event.PopWiredInt32();

            string UserAuthTicket = Essential.GetGame().GetGamesManager().CreateAuthTicket(Session.GetHabbo().Id);

            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                // Check exist auth tokens and delete them.

                if (dbClient.ReadInt32("SELECT COUNT(token) FROM basejump_auth_tokens WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1") == 1)
                {
                    dbClient.ExecuteQuery("DELETE FROM `basejump_auth_tokens` WHERE `user_id`='" + Session.GetHabbo().Id + "'");
                }

                dbClient.AddParamWithValue("auth_token", UserAuthTicket);
                dbClient.AddParamWithValue("user_id", Session.GetHabbo().Id);
                dbClient.AddParamWithValue("expire", Essential.GetUnixTimestamp() + 1800); // +30 min expires

                dbClient.ExecuteQuery("INSERT INTO `basejump_auth_tokens` (`token`, `user_id`, `expire`) VALUES (@auth_token, @user_id, @expire)");
            }

            ServerMessage LoadGame = new ServerMessage(Outgoing.LoadGame);

            LoadGame.AppendInt32(GameId);
            LoadGame.AppendString(Session.GetHabbo().Id.ToString());          // ??
            LoadGame.AppendString(Session.ClientVar + "/games/BaseJump.swf"); // url
            LoadGame.AppendString("best");
            LoadGame.AppendString("showAll");
            LoadGame.AppendInt32(60);
            LoadGame.AppendInt32(10);
            LoadGame.AppendInt32(0);
            LoadGame.AppendInt32(6);
            LoadGame.AppendString("assetUrl");
            LoadGame.AppendString(Session.ClientVar + "/games/BasicAssets.swf");
            LoadGame.AppendString("habboHost");
            LoadGame.AppendString("http://fusees-private-httpd-fe-1");
            LoadGame.AppendString("accessToken");
            LoadGame.AppendString(UserAuthTicket);
            LoadGame.AppendString("gameServerHost");
            LoadGame.AppendString(Essential.GetConfig().data["game.tcp.bindip"]);
            LoadGame.AppendString("gameServerPort");
            LoadGame.AppendString(Essential.GetConfig().data["game.tcp.port"]);
            LoadGame.AppendString("socketPolicyPort");
            LoadGame.AppendString(Essential.GetConfig().data["game.tcp.port"]);
            Session.SendMessage(LoadGame);
        }
Esempio n. 12
0
 public ServerMessage method_18(uint uint_0)
 {
     try
     {
         ServerMessage result;
         using (DatabaseClient @class = Essential.GetDatabase().GetClient())
         {
             DataRow dataRow  = @class.ReadDataRow("SELECT Id, username, online, mail, look, account_created, last_online FROM users WHERE Id = '" + uint_0 + "' LIMIT 1");
             DataRow dataRow2 = @class.ReadDataRow("SELECT reg_timestamp, login_timestamp, cfhs, cfhs_abusive, cautions, bans FROM user_info WHERE user_id = '" + uint_0 + "' LIMIT 1");
             if (dataRow == null)
             {
                 throw new ArgumentException();
             }
             ServerMessage Message = new ServerMessage(Outgoing.UserTool); // Updated
             Message.AppendUInt((uint)dataRow["Id"]);
             Message.AppendStringWithBreak((string)dataRow["username"]);
             Message.AppendString((string)dataRow["look"]);
             Message.AppendInt32((int)Math.Ceiling((Essential.GetUnixTimestamp() - Convert.ToDouble(dataRow["account_created"].ToString())) / 60.0));
             Message.AppendInt32((int)Math.Ceiling((Essential.GetUnixTimestamp() - Convert.ToDouble(dataRow["last_online"].ToString())) / 60.0));
             if (dataRow["online"].ToString() == "1")
             {
                 Message.AppendBoolean(true);
             }
             else
             {
                 Message.AppendBoolean(false);
             }
             Message.AppendInt32(@class.ReadInt32("SELECT COUNT(*) FROM moderation_tickets WHERE sender_id=" + uint_0));                           //cfhs
             Message.AppendInt32(@class.ReadInt32("SELECT COUNT(*) FROM moderation_tickets WHERE sender_id=" + uint_0 + " AND status='abusive'")); //cfhs_abusive
             Message.AppendInt32(0);                                                                                                               // cautions
             @class.AddParamWithValue("username", dataRow["username"].ToString());
             Message.AppendInt32(@class.ReadInt32("SELECT COUNT(*) FROM banlog WHERE bantype='user' AND value=@username"));                        // bans
             Message.AppendString("");                                                                                                             // last_purchase_txt
             Message.AppendInt32(0);                                                                                                               // identityinformationtool.url + this
             Message.AppendInt32(0);                                                                                                               // id_bans_txt
             Message.AppendString((string)dataRow["mail"]);                                                                                        // email_address_txt
             result = Message;
         }
         return(result);
     }catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(null);
 }
Esempio n. 13
0
        public MessengerBuddy(uint mUserId, string mUsername, string mLook, string mMotto, string mLastOnline, int mRelation)
        {
            this.UserId   = mUserId;
            this.Username = mUsername;
            this.Look     = mLook;
            this.Motto    = mMotto;
            double timestamp;

            if (double.TryParse(mLastOnline, NumberStyles.Any, CustomCultureInfo.GetCustomCultureInfo(), out timestamp))
            {
                this.LastOnline = Essential.TimestampToDate(timestamp).ToString();
            }
            else
            {
                this.LastOnline = Essential.TimestampToDate(Essential.GetUnixTimestamp()).ToString();
            }
            this.bool_0             = false;
            this.RelationshipStatus = mRelation;
        }
 public void PlaySong()
 {
     if (this.mSongQueuePosition >= this.mPlaylist.Count)
     {
         this.mSongQueuePosition = 0;
     }
     if (this.mPlaylist.Count == 0)
     {
         this.Stop();
     }
     else
     {
         if (!this.mPlaylist.ContainsKey(this.mSongQueuePosition))
         {
             this.mSongQueuePosition = 0;
         }
         this.mSong       = this.mPlaylist[this.mSongQueuePosition];
         this.mSongLength = this.mSong.SongData.Length / 1000;
         this.mStartedPlayingTimestamp = Essential.GetUnixTimestamp();
         mBroadcastNeeded = true;
     }
 }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            ServerMessage Message = new ServerMessage(Outgoing.SerializeClub); // Updated

            Message.AppendString("club_habbo");
            if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                double expireTime = Session.GetHabbo().GetSubscriptionManager().GetSubscriptionByType("habbo_club").ExpirationTime;
                double num2       = expireTime - Essential.GetUnixTimestamp();
                int    num3       = (int)Math.Ceiling((double)(num2 / 86400.0));
                int    i          = num3 / 0x1f;
                if (i >= 1)
                {
                    i--;
                }
                Message.AppendInt32((int)(num3 - (i * 0x1f)));
                Message.AppendInt32(2);//2
                Message.AppendInt32(i);
                Message.AppendInt32(1);
                Message.AppendBoolean(true);
                Message.AppendBoolean(true);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0x1ef);
            }
            else
            {
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendBoolean(false);
                Message.AppendBoolean(true);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
            }
            Session.SendMessage(Message);
        }
Esempio n. 16
0
        public void MuteUser(GameClient Session, uint userId, string Message, int TimeInMinutes)
        {
            GameClient TargetClient = Essential.GetGame().GetClientManager().GetClient(userId);

            if (TargetClient != null && TargetClient.GetHabbo().CurrentRoomId >= 1u && TargetClient.GetHabbo().Id != Session.GetHabbo().Id)
            {
                if (TargetClient.GetHabbo().Rank >= Session.GetHabbo().Rank)
                {
                    Session.SendNotification(EssentialEnvironment.GetExternalText("mod_error_permission_kick"));
                }
                else
                {
                    TargetClient.GetHabbo().IsMuted    = true;
                    TargetClient.GetHabbo().UnmuteTime = (int)Essential.GetUnixTimestamp() + (TimeInMinutes * 60);
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        dbClient.ExecuteQuery("UPDATE users SET is_muted='1' WHERE id=" + userId);
                        dbClient.ExecuteQuery("UPDATE users SET unmute_timestamp='" + TargetClient.GetHabbo().UnmuteTime + "' WHERE id=" + userId);
                    }
                    TargetClient.SendNotification(Message);
                }
            }
        }
Esempio n. 17
0
 public void UpdateNeeded(GameClient Session)
 {
     try
     {
         if (Session.GetHabbo().InRoom)
         {
             RoomUser @class = Session.GetHabbo().CurrentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id);
             if (@class.int_1 <= ServerConfiguration.SleepTimer)
             {
                 double double_ = Essential.GetUnixTimestamp();
                 Session.GetHabbo().LastActivityPointsUpdate = double_;
                 if (ServerConfiguration.PointingAmount > 0 && (Session.GetHabbo().ActivityPoints < ServerConfiguration.PixelLimit || ServerConfiguration.PixelLimit == 0))
                 {
                     Session.GetHabbo().ActivityPoints += ServerConfiguration.PointingAmount;
                     Session.GetHabbo().method_16(ServerConfiguration.PointingAmount);
                 }
                 if (ServerConfiguration.CreditingAmount > 0 && (Session.GetHabbo().GetCredits() < ServerConfiguration.CreditLimit || ServerConfiguration.CreditLimit == 0))
                 {
                     Session.GetHabbo().GiveCredits(ServerConfiguration.CreditingAmount, "Pixelmanager");
                     if (Session.GetHabbo().IsVIP)
                     {
                         Session.GetHabbo().GiveCredits(ServerConfiguration.CreditingAmount, "VIP Bonus (Pixelmanager)");
                     }
                     Session.GetHabbo().UpdateCredits(true);
                 }
                 if (ServerConfiguration.PixelingAmount > 0 && (Session.GetHabbo().VipPoints < ServerConfiguration.PointLimit || ServerConfiguration.PointLimit == 0))
                 {
                     Session.GetHabbo().VipPoints += ServerConfiguration.PixelingAmount;
                     Session.GetHabbo().UpdateVipPoints(false, true);
                 }
             }
         }
     }
     catch
     {
     }
 }
Esempio n. 18
0
 public void method_0()
 {
     this.bool_0   = true;
     this.double_0 = Essential.GetUnixTimestamp();
 }
Esempio n. 19
0
        internal void tryLogin(string AuthTicket)
        {
            try
            {
                UserDataFactory @class = new UserDataFactory(AuthTicket, this.GetConnection().String_0, true);
                if ([email protected])
                {
                    @class = new UserDataFactory(AuthTicket, this.GetConnection().String_0, true);
                }
                if ([email protected])
                {
                    string str = "";
                    if (ServerConfiguration.EnableSSO)
                    {
                        str = EssentialEnvironment.GetExternalText("emu_sso_wrong_secure") + "(" + this.GetConnection().String_0 + ")";
                    }
                    SendNotifWithScroll(EssentialEnvironment.GetExternalText("emu_sso_wrong") + str);
                    return;
                }
                Habbo class2 = Authenticator.CreateHabbo(AuthTicket, this, @class, @class);
                Essential.GetGame().GetClientManager().Disconnect(class2.Id, "New Session");
                this.Habbo = class2;
                this.Habbo.method_2(@class);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Logging login error because you are on alpha test!");
                Logging.LogException(ex.ToString());
                if (this != null)
                {
                    this.SendNotification(ex.ToString());
                    this.Disconnect("Login Error");
                }
                return;
            }

            try
            {
                Essential.GetGame().GetBanManager().method_1(this);
            }
            catch (ModerationBanException gException)
            {
                this.NotifyBan(gException.Message);
                this.Disconnect("Banned!");
                return;
            }
            #region "AKS"
            if (this.MachineId != "" && !Essential.StringToBoolean(this.GetHabbo().GetUserDataFactory().GetUserData()["staff_inacc"].ToString()))
            {
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    string oldMachineId = dbClient.SpecialString("SELECT machineId FROM user_machineids WHERE userid=" + this.GetHabbo().Id);

                    dbClient.AddParamWithValue("machineid", this.MachineId);
                    if ((oldMachineId == "" || oldMachineId != this.MachineId))
                    {
                        dbClient.AddParamWithValue("username", this.GetHabbo().Username);
                        dbClient.ExecuteQuery("INSERT INTO user_machineids (username,userid,timestamp,machineId) VALUES (@username," + this.GetHabbo().Id + ",'" + Convert.ToInt32(Essential.GetUnixTimestamp()) + "',@machineid)");
                    }
                }
            }
            #endregion
            ServerMessage Message2 = new ServerMessage(Outgoing.Fuserights);
            if (this == null || this.GetHabbo() == null)
            {
                return;
            }
            if (this.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes)
            {
                Message2.AppendInt32(2);
            }
            else
            {
                if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                {
                    Message2.AppendInt32(1);
                }
                else
                {
                    Message2.AppendInt32(0);
                }
            }
            if (this.GetHabbo().HasFuse("acc_anyroomowner"))
            {
                Message2.AppendInt32(7);
            }
            else
            {
                if (this.GetHabbo().HasFuse("acc_anyroomrights"))
                {
                    Message2.AppendInt32(5);
                }
                else
                {
                    if (this.GetHabbo().HasFuse("acc_supporttool"))
                    {
                        Message2.AppendInt32(4);
                    }
                    else
                    {
                        if (this.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes || this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                        {
                            Message2.AppendInt32(2);
                        }
                        else
                        {
                            Message2.AppendInt32(0);
                        }
                    }
                }
            }

            this.SendMessage(Message2);

            this.SendMessage(this.GetHabbo().GetEffectsInventoryComponent().method_6());

            ServerMessage Message3 = new ServerMessage(Outgoing.AvailabilityStatus);
            Message3.AppendBoolean(true);
            Message3.AppendBoolean(false);
            this.SendMessage(Message3);
            ServerMessage message = new ServerMessage(Outgoing.UniqueID);
            message.AppendString(this.MachineId);
            this.SendMessage(message);
            ServerMessage Message5_ = new ServerMessage(Outgoing.AuthenticationOK);
            this.SendMessage(Message5_);

            if (GetHabbo().HomeRoomId <= 0)
            {
                GetHabbo().HomeRoomId = 64259;
            }
            ServerMessage Message5 = new ServerMessage(Outgoing.HomeRoom);
            Message5.AppendUInt(this.GetHabbo().HomeRoomId);
            Message5.AppendUInt(this.GetHabbo().HomeRoomId);
            this.SendMessage(Message5);
            Console.WriteLine("[" + this.GetConnection().UInt32_0 + "] [" + this.GetHabbo().Username + "] [" + this.GetHabbo().Id + "] [" + this.GetConnection().String_0 + "] [" + DateTime.Now.Hour + ":" + DateTime.Now.Minute + "]");
            GetHabbo().UpdateCredits(false);
            GetHabbo().UpdateActivityPoints(false);
            if (this.GetHabbo().HasFuse("acc_supporttool"))
            {
                this.SendMessage(Essential.GetGame().GetModerationTool().SerializeTool());
                Essential.GetGame().GetModerationTool().method_4(this);
            }
            if (Essential.GetGame().GetPixelManager().CanHaveReward(this))
            {
                Essential.GetGame().GetPixelManager().UpdateNeeded(this);
            }

            ServerMessage Message6 = new ServerMessage(Outgoing.FavouriteRooms);
            Message6.AppendInt32(30);
            Message6.AppendInt32(this.GetHabbo().list_1.Count);
            foreach (uint current in this.GetHabbo().list_1)
            {
                Message6.AppendUInt(current);
            }
            this.SendMessage(Message6);
            try
            {
                this.GetHabbo().CheckTotalTimeOnlineAchievements();
                this.GetHabbo().CheckHappyHourAchievements();
                this.GetHabbo().CheckTrueHabboAchievements();
                this.GetHabbo().CheckRegularVisitorAchievements();
                this.GetHabbo().CheckFootballGoalHostScoreAchievements();
                this.GetHabbo().CheckStaffPicksAchievement();
            }
            catch { }
            if (ServerConfiguration.MOTD != "")
            {
                this.SendNotification(ServerConfiguration.MOTD, 2);
            }
            for (uint num = (uint)Essential.GetGame().GetRoleManager().GetRankCount(); num > 1u; num -= 1u)
            {
                if (Essential.GetGame().GetRoleManager().GetBadgeByRank(num).Length > 0)
                {
                    if (!this.GetHabbo().GetBadgeComponent().HasBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(num)) && this.GetHabbo().Rank == num)
                    {
                        this.GetHabbo().GetBadgeComponent().SendBadge(this, Essential.GetGame().GetRoleManager().GetBadgeByRank(num), true);
                    }
                    else
                    {
                        if (this.GetHabbo().GetBadgeComponent().HasBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(num)) && this.GetHabbo().Rank < num)
                        {
                            this.GetHabbo().GetBadgeComponent().RemoveBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(num));
                        }
                    }
                }
            }
            if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                this.GetHabbo().CheckHCAchievements();
            }
            if (this.GetHabbo().IsVIP&& !this.GetHabbo().GetBadgeComponent().HasBadge("VIP"))
            {
                this.GetHabbo().GetBadgeComponent().SendBadge(this, "VIP", true);
            }
            else
            {
                if (!this.GetHabbo().IsVIP&& this.GetHabbo().GetBadgeComponent().HasBadge("VIP"))
                {
                    this.GetHabbo().GetBadgeComponent().RemoveBadge("VIP");
                }
            }
            if (this.GetHabbo().CurrentQuestId > 0u)
            {
                Essential.GetGame().GetQuestManager().ActivateQuest(this.GetHabbo().CurrentQuestId, this);
            }
            if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$"))
            {
                ServerMessage Message5_2 = new ServerMessage(Outgoing.Disconnect);
                this.SendMessage(Message5_2);
            }
            this.GetHabbo().Motto = Essential.FilterString(this.GetHabbo().Motto);
            DataTable dataTable = null;
            using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
            {
                dataTable = class3.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'");
            }
            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    Essential.GetGame().GetAchievementManager().addAchievement(this, (uint)dataRow["achievement"], (int)dataRow["achlevel"]);
                    using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
                    {
                        class3.ExecuteQuery(string.Concat(new object[]
                        {
                            "DELETE FROM achievements_owed WHERE achievement = '",
                            (uint)dataRow["achievement"],
                            "' AND user = '******' LIMIT 1"
                        }));
                    }
                }
            }
            if (this.GetHabbo().list_2 != null && this.GetHabbo().list_2.Count > 0)
            {
                ServerMessage IgnoringList = new ServerMessage(Outgoing.IgnoringList);
                IgnoringList.AppendInt32(this.GetHabbo().list_2.Count);
                foreach (uint userId in this.GetHabbo().list_2)
                {
                    IgnoringList.AppendString(Essential.GetGame().GetClientManager().GetNameById(userId));
                }
                this.SendMessage(IgnoringList);
            }
            //this.GetClientMessageHandler().method_5(this.GetHabbo().HomeRoomId, "");
        }
Esempio n. 20
0
        public static void Work()
        {
            double lastDatabaseUpdate = Essential.GetUnixTimestamp();

            while (true)
            {
                try
                {
                    DateTime now      = DateTime.Now;
                    TimeSpan timeSpan = now - Essential.ServerStarted;
                    new PerformanceCounter("Processor", "% Processor Time", "_Total");
                    int Status = 1;

                    int UsersOnline = Essential.GetGame().GetClientManager().ClientCount;
                    //  Essential.GetGame().GetRoomManager().UnloadEmptyRooms();
                    int    RoomsLoaded = Essential.GetGame().GetRoomManager().LoadedRoomsCount;
                    double timestamp   = Essential.GetUnixTimestamp() - lastDatabaseUpdate;

                    if (timestamp >= 5)
                    {
                        using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                        {
                            dbClient.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE server_status SET stamp = UNIX_TIMESTAMP(), status = '", Status, "', users_online = '", UsersOnline, "', rooms_loaded = '", RoomsLoaded, "', server_ver = '", Essential.PrettyVersion, "' LIMIT 1"
                            }));
                            uint num3 = (uint)dbClient.ReadInt32("SELECT users FROM system_stats ORDER BY ID DESC LIMIT 1");
                            if ((long)UsersOnline > (long)((ulong)num3))
                            {
                                dbClient.ExecuteQuery(string.Concat(new object[]
                                {
                                    "UPDATE system_stats SET users = '",
                                    UsersOnline,
                                    "', rooms = '",
                                    RoomsLoaded,
                                    "' ORDER BY ID DESC LIMIT 1"
                                }));
                            }
                        }

                        lastDatabaseUpdate = Essential.GetUnixTimestamp();
                    }

                    Essential.GetGame().GetClientManager().UpdateEffects();

                    Console.Title = string.Concat(new object[]
                    {
                        "Essential | Online Users: ",
                        UsersOnline,
                        " | Rooms Loaded: ",
                        RoomsLoaded,
                        " | Uptime: ",
                        timeSpan.Days,
                        " days, ",
                        timeSpan.Hours,
                        " hours and ",
                        timeSpan.Minutes,
                        " minutes"
                    });
                }
                catch (Exception ex)
                {
                    Program.DeleteMenu(Program.GetSystemMenu(Program.GetConsoleWindow(), true), Program.SC_CLOSE, Program.MF_BYCOMMAND);
                    Logging.LogThreadException(ex.ToString(), "Server status update task");
                }
                Thread.Sleep(5000);
            }
        }
Esempio n. 21
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && Session != null && Session.GetHabbo().PassedSafetyQuiz)
            {
                Session.GetHabbo().CheckForUnmute();
                if (Session.GetHabbo().IsMuted)
                {
                    Session.SendNotification(EssentialEnvironment.GetExternalText("error_muted"));
                }
                else
                {
                    if (Session.GetHabbo().HasFuse("ignore_roommute") || [email protected]_4)
                    {
                        string text = Essential.FilterString(Event.PopFixedString());
                        if (!String.IsNullOrEmpty(text) || !String.IsNullOrWhiteSpace(text))
                        {
                            string text2 = text.Split(new char[]
                            {
                                ' '
                            })[0];
                            string text3 = text.Substring(text2.Length + 1);
                            text3 = ChatCommandHandler.ApplyFilter(text3);
                            RoomUser class2 = @class.GetRoomUserByHabbo(Session.GetHabbo().Id);
                            RoomUser class3 = @class.method_56(text2);
                            if (Session.GetHabbo().method_4() > 0)
                            {
                                TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().dateTime_0;
                                if (timeSpan.Seconds > 4)
                                {
                                    Session.GetHabbo().int_23 = 0;
                                }
                                if (timeSpan.Seconds < 4 && Session.GetHabbo().int_23 > 5 && !class2.IsBot)
                                {
                                    ServerMessage Message = new ServerMessage(Outgoing.FloodFilter);
                                    Message.AppendInt32(Session.GetHabbo().method_4());
                                    Session.SendMessage(Message);
                                    Session.GetHabbo().IsMuted = true;
                                    Session.GetHabbo().int_4   = Session.GetHabbo().method_4();
                                    return;
                                }
                                Session.GetHabbo().dateTime_0 = DateTime.Now;
                                Session.GetHabbo().int_23++;
                            }
                            ServerMessage Message2 = new ServerMessage(Outgoing.Whisp); // OLD 25 UPDATED
                            Message2.AppendInt32(class2.VirtualId);
                            Message2.AppendStringWithBreak(text3);
                            Message2.AppendInt32(0);
                            Message2.AppendInt32(Event.PopWiredInt32());
                            Message2.AppendInt32(0);
                            Message2.AppendInt32(-1);
                            if (class2 != null && !class2.IsBot && !Essential.GetAntiAd().ContainsIllegalWord(text3))
                            {
                                class2.GetClient().SendMessage(Message2);
                            }
                            class2.Unidle();
                            if (class3 != null && !class3.IsBot && (class3.GetClient().GetHabbo().list_2.Count <= 0 || !class3.GetClient().GetHabbo().list_2.Contains(Session.GetHabbo().Id)))
                            {
                                if (!Essential.GetAntiAd().ContainsIllegalWord(text3))
                                {
                                    class3.GetClient().SendMessage(Message2);
                                }
                                if (ServerConfiguration.EnableChatlog)
                                {
                                    using (DatabaseClient class4 = Essential.GetDatabase().GetClient())
                                    {
                                        class4.AddParamWithValue("message", "<Whisper to " + class3.GetClient().GetHabbo().Username + ">: " + text3);
                                        class4.ExecuteQuery(string.Concat(new object[]
                                        {
                                            "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('",
                                            Session.GetHabbo().Id,
                                            "','",
                                            @class.Id,
                                            "','",
                                            DateTime.Now.Hour,
                                            "','",
                                            DateTime.Now.Minute,
                                            "',UNIX_TIMESTAMP(),@message,'",
                                            Session.GetHabbo().Username,
                                            "','",
                                            DateTime.Now.ToLongDateString(),
                                            "')"
                                        }));
                                    }
                                }
                                if (Essential.GetAntiAd().ContainsIllegalWord(text3))
                                {
                                    ServerMessage Message3 = new ServerMessage(Outgoing.InstantChat);
                                    Message3.AppendUInt(0u);
                                    Message3.AppendString("[AWS] " + Session.GetHabbo().Username + ": " + text3);
                                    Message3.AppendString(Essential.GetUnixTimestamp() + string.Empty);
                                    Essential.GetGame().GetClientManager().SendToStaffs(Session, Message3);
                                    Session.SendNotification(Essential.GetGame().GetRoleManager().GetConfiguration().getData("antiad.alert"));
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 22
0
        public ServerMessage SerializeMyOffers(uint uint_0)
        {
            int int_ = 0;

            using (DatabaseClient @class = Essential.GetDatabase().GetClient())
            {
                DataTable dataTable = @class.ReadDataTable("SELECT timestamp, state, offer_id, item_type, sprite_id, total_price, furni_id FROM catalog_marketplace_offers WHERE user_id = '" + uint_0 + "'");
                string    text      = @class.ReadDataRow("SELECT SUM(asking_price) FROM catalog_marketplace_offers WHERE state = '2' AND user_id = '" + uint_0 + "'")[0].ToString();
                if (text.Length > 0)
                {
                    int_ = int.Parse(text);
                }
                ServerMessage Message = new ServerMessage(Outgoing.Offerstats); // Update
                Message.AppendInt32(int_);
                if (dataTable != null)
                {
                    Message.AppendInt32(dataTable.Rows.Count);
                    IEnumerator enumerator = dataTable.Rows.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            DataRow dataRow = (DataRow)enumerator.Current;
                            int     num     = (int)Math.Floor(((double)dataRow["timestamp"] + 172800.0 - Essential.GetUnixTimestamp()) / 60.0);
                            int     num2    = int.Parse(dataRow["state"].ToString());
                            if (num <= 0 && num2 != 2)
                            {
                                num2 = 3;
                                num  = 0;
                            }
                            Message.AppendUInt((uint)dataRow["offer_id"]);
                            Message.AppendInt32(num2);
                            Message.AppendInt32(int.Parse(dataRow["item_type"].ToString()));
                            if (int.Parse(dataRow["item_type"].ToString()) == 2)
                            {
                                Message.AppendInt32((int)dataRow["sprite_id"]);
                                Message.AppendStringWithBreak((@class.ReadInt32("SELECT COUNT(extra_data) FROM items_extra_data WHERE item_id = '" + dataRow["furni_id"] + "'") > 0 ? @class.ReadString("SELECT extra_data FROM items_extra_data WHERE item_id = '" + dataRow["furni_id"] + "'") : ""));
                            }
                            else
                            {
                                Message.AppendInt32((int)dataRow["sprite_id"]);
                                Message.AppendInt32(0);
                                Message.AppendStringWithBreak("");
                            }
                            Message.AppendInt32((int)dataRow["total_price"]);
                            Message.AppendInt32(num);
                            Message.AppendInt32((int)dataRow["sprite_id"]);
                        }
                        goto IL_1DE;
                    }
                    finally
                    {
                        IDisposable disposable = enumerator as IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                }
                Message.AppendInt32(0);
IL_1DE:
                return(Message);
            }
        }
Esempio n. 23
0
 internal double FormatTimestamp()
 {
     return(Essential.GetUnixTimestamp() - 172800.0);
 }
Esempio n. 24
0
 public void method_3(GameClient Session, int int_0, uint uint_0, string string_0)
 {
     if (Session.GetHabbo().CurrentRoomId > 0u)
     {
         RoomData @class = Essential.GetGame().GetRoomManager().method_11(Session.GetHabbo().CurrentRoomId);
         uint     uint_  = 0u;
         using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
         {
             class2.AddParamWithValue("message", string_0);
             class2.AddParamWithValue("name", @class.Name);
             class2.ExecuteQuery(string.Concat(new object[]
             {
                 "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'",
                 int_0,
                 "','open','",
                 Session.GetHabbo().Id,
                 "','",
                 uint_0,
                 "','0',@message,'",
                 @class.Id,
                 "',@name,UNIX_TIMESTAMP())"
             }));
             class2.ExecuteQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1");
             uint_ = (uint)class2.ReadDataRow("SELECT Id FROM moderation_tickets WHERE sender_id = '" + Session.GetHabbo().Id + "' ORDER BY Id DESC LIMIT 1")[0];
         }
         SupportTicket class3 = new SupportTicket(uint_, 1, int_0, Session.GetHabbo().Id, uint_0, string_0, @class.Id, @class.Name, Essential.GetUnixTimestamp(), 0u);
         this.Tickets.Add(class3);
         this.method_11(class3);
     }
 }
Esempio n. 25
0
        public void ParsePacket(string data)
        {
            string text = data.Split(new char[]
            {
                Convert.ToChar(1)
            })[0];

            string text2 = data.Split(new char[]
            {
                Convert.ToChar(1)
            })[1];

            GameClient client  = null;
            DataRow    dataRow = null;

            string text3 = text.ToLower();

            if (text3 != null)
            {
                if (MusCommands.dictionary_0 == null)
                {
                    MusCommands.dictionary_0 = new Dictionary <string, int>(29)
                    {
                        {
                            "update_items",
                            0
                        },

                        {
                            "update_catalogue",
                            1
                        },

                        {
                            "update_catalog",
                            2
                        },

                        {
                            "updateusersrooms",
                            3
                        },

                        {
                            "senduser",
                            4
                        },

                        {
                            "updatevip",
                            5
                        },

                        {
                            "giftitem",
                            6
                        },

                        {
                            "giveitem",
                            7
                        },

                        {
                            "unloadroom",
                            8
                        },

                        {
                            "roomalert",
                            9
                        },

                        {
                            "updategroup",
                            10
                        },

                        {
                            "updateusersgroups",
                            11
                        },

                        {
                            "shutdown",
                            12
                        },

                        {
                            "update_filter",
                            13
                        },

                        {
                            "refresh_filter",
                            14
                        },

                        {
                            "updatecredits",
                            15
                        },

                        {
                            "updatesettings",
                            16
                        },

                        {
                            "updatepixels",
                            17
                        },

                        {
                            "updatepoints",
                            18
                        },

                        {
                            "reloadbans",
                            19
                        },

                        {
                            "update_bots",
                            20
                        },

                        {
                            "signout",
                            21
                        },

                        {
                            "exe",
                            22
                        },

                        {
                            "alert",
                            23
                        },

                        {
                            "sa",
                            24
                        },

                        {
                            "ha",
                            25
                        },

                        {
                            "hal",
                            26
                        },

                        {
                            "updatemotto",
                            27
                        },
                        {
                            "update_badges",
                            29
                        },
                        {
                            "update_navigator",
                            40
                        },
                        {
                            "startquestion",
                            31
                        },
                        {
                            "roomkick",
                            37
                        },
                        {
                            "setinapp",
                            38
                        },
                        {
                            "lockroom",
                            39
                        },
                        {
                            "updatelook",
                            28
                        },
                        {
                            "infobuspoll",
                            34
                        },
                        {
                            "givebadge",
                            32
                        },
                        {
                            "update_permissions",
                            33
                        },
                        {
                            "update_catalogid",
                            35
                        },
                        {
                            "addFriend",
                            36
                        },
                        {
                            "ref_websocket",
                            50
                        },
                        {
                            "eventha",
                            51
                        }
                    };
                }

                int num;

                if (MusCommands.dictionary_0.TryGetValue(text3, out num))
                {
                    uint   num2;
                    uint   uint_2;
                    Room   class4;
                    uint   num3;
                    string text5;

                    switch (num)
                    {
                    case 0:
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetItemManager().Initialize(class2);

                            goto IL_C70;
                        }

                    case 1:
                    case 2:
                        break;

                    case 3:
                    {
                        Habbo class3 = Essential.GetGame().GetClientManager().GetClient(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                            {
                                class3.method_1(class2);
                                goto IL_C70;
                            }
                        }
                        goto IL_C70;
                    }

                    case 4:
                        goto IL_34E;

                    case 5:
                    {
                        Habbo class3 = Essential.GetGame().GetClientManager().GetClient(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            class3.UpdateRights();
                            goto IL_C70;
                        }
                        goto IL_C70;
                    }

                    case 6:
                    case 7:
                    {
                        num2 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        uint uint_ = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[1]);
                        int int_ = int.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[2]);
                        string string_ = text2.Substring(num2.ToString().Length + uint_.ToString().Length + int_.ToString().Length + 3);
                        Essential.GetGame().GetCatalog().CreateGift(string_, num2, uint_, int_);

                        goto IL_C70;
                    }

                    case 8:
                        uint_2 = uint.Parse(text2);
                        class4 = Essential.GetGame().GetRoomManager().GetRoom(uint_2);
                        Essential.GetGame().GetRoomManager().method_16(class4);
                        goto IL_C70;

                    case 37:
                        num3 = uint.Parse(text2.Split(new char[]
                        {
                            ' '
                        })[0]);

                        class4 = Essential.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            Essential.GetGame().GetModerationTool().ClearRoomFromUsers(num3);
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 38:
                        num3 = uint.Parse(text2.Split(new char[]
                        {
                            ' '
                        })[0]);

                        class4 = Essential.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            Essential.GetGame().GetModerationTool().SetInApp(num3);
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 39:
                        num3 = uint.Parse(text2.Split(new char[]
                        {
                            ' '
                        })[0]);

                        class4 = Essential.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            Essential.GetGame().GetModerationTool().LockRoom(num3);
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 40:
                        using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetNavigator().Initialize(dbClient);
                            Essential.GetGame().GetRoomManager().method_8(dbClient);
                            Essential.GetGame().GetRoomManager().LoadMagicTiles(dbClient);
                            Essential.GetGame().GetRoomManager().LoadBillboards(dbClient);
                        }
                        goto IL_C70;

                    case 9:
                        num3 = uint.Parse(text2.Split(new char[]
                        {
                            ' '
                        })[0]);
                        class4 = Essential.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            string string_2 = text2.Substring(num3.ToString().Length + 1);
                            for (int i = 0; i < class4.RoomUsers.Length; i++)
                            {
                                RoomUser class5 = class4.RoomUsers[i];
                                if (class5 != null && !class5.IsBot && !class5.IsPet)
                                {
                                    class5.GetClient().SendNotification(string_2);
                                }
                            }
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 10:
                    {
                        int int_2 = int.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            Groups.UpdateGroup(class2, int_2);
                            goto IL_C70;
                        }
                    }

                    case 11:
                        goto IL_5BF;

                    case 12:
                        goto IL_602;

                    case 13:
                    case 14:
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            ChatCommandHandler.InitWords(class2);
                            goto IL_C70;
                        }

                    case 15:
                        goto IL_633;

                    case 16:
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().LoadServerSettings(class2);
                            goto IL_C70;
                        }

                    case 17:
                        goto IL_6F7;

                    case 18:
                        client = Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2));
                        if (client != null)
                        {
                            client.GetHabbo().UpdateVipPoints(true, false);
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 19:
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetBanManager().Initialise(class2);
                        }
                        Essential.GetGame().GetClientManager().UpdateBans();
                        goto IL_C70;

                    case 20:
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetBotManager().Initialize(class2);
                            goto IL_C70;
                        }

                    case 21:
                        goto IL_839;

                    case 22:
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            class2.ExecuteQuery(text2);
                            goto IL_C70;
                        }

                    case 23:
                        goto IL_880;

                    case 24:
                    {
                        ServerMessage Message = new ServerMessage(Outgoing.InstantChat);
                        Message.AppendUInt(0u);
                        Message.AppendString("Habbo: " + text2);
                        Message.AppendString(Essential.GetUnixTimestamp() + string.Empty);
                        Essential.GetGame().GetClientManager().SendToStaffs(Message, Message);
                        goto IL_C70;
                    }

                    case 25:
                    {
                        ServerMessage Message2 = new ServerMessage(Outgoing.BroadcastMessage);
                        Message2.AppendStringWithBreak(EssentialEnvironment.GetExternalText("mus_ha_title") + "\n\n" + text2);
                        Message2.AppendStringWithBreak("");

                        /*ServerMessage Message3 = new ServerMessage(161u);
                         * Message3.AppendStringWithBreak(text2);
                         */
                        Essential.GetGame().GetClientManager().SendToHotel(Message2, Message2);
                        goto IL_C70;
                    }

                    case 26:
                    {
                        string text4 = text2.Split(new char[]
                            {
                                ' '
                            })[0];
                        text5 = text2.Substring(text4.Length + 1);
                        ServerMessage Message4 = new ServerMessage(Outgoing.SendNotif); // Updated
                        Message4.AppendStringWithBreak(string.Concat(new string[]
                            {
                                EssentialEnvironment.GetExternalText("mus_hal_title"),
                                "\r\n",
                                text5,
                                "\r\n-",
                                EssentialEnvironment.GetExternalText("mus_hal_tail")
                            }));
                        Message4.AppendStringWithBreak(text4);
                        Essential.GetGame().GetClientManager().BroadcastMessage(Message4);
                        goto IL_C70;
                    }

                    case 29:
                    {
                        num3 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        uint UserIidu3 = num3;
                        client = Essential.GetGame().GetClientManager().GetClient(UserIidu3);
                        if (client != null)
                        {
                            client.GetHabbo().GetBadgeComponent().AddBadge(text2.Split(new char[]
                                {
                                    ' '
                                })[1], 0, false);
                        }

                        ServerMessage Message = new ServerMessage(Outgoing.AddBadge);

                        Message.AppendInt32(1);
                        Message.AppendInt32(4);
                        Message.AppendInt32(1);

                        Message.AppendUInt(0);

                        client.SendMessage(Message);

                        client.SendMessage(client.GetHabbo().GetBadgeComponent().ComposeBadgeListMessage());


                        goto IL_C70;
                    }

                    case 30:
                    {
                        uint UserIidu = uint.Parse(text2);
                        client = Essential.GetGame().GetClientManager().GetClient(UserIidu);
                        if (client != null)
                        {
                            if (client.GetHabbo().InRoom)
                            {
                                if (client.GetHabbo().CurrentRoom.CCTs.Contains("park"))
                                {
                                    if (!client.GetHabbo().CurrentRoom.IsInfobusOpen)
                                    {
                                        client.GetHabbo().CurrentRoom.IsInfobusOpen = true;
                                    }
                                    else
                                    {
                                        client.GetHabbo().CurrentRoom.IsInfobusOpen = false;
                                    }

                                    for (int i = 0; i < client.GetHabbo().CurrentRoom.RoomUsers.Length; i++)
                                    {
                                        RoomUser RoomiUser = client.GetHabbo().CurrentRoom.RoomUsers[i];
                                        if (RoomiUser != null)
                                        {
                                            ServerMessage ParkBusDoorMessage = new ServerMessage(Outgoing.ParkBusDoor);
                                            ParkBusDoorMessage.AppendBoolean(client.GetHabbo().CurrentRoom.IsInfobusOpen);
                                            RoomiUser.GetClient().SendMessage(ParkBusDoorMessage);
                                        }
                                    }
                                }
                                else
                                {
                                    // client.SendNotification("Sinun täytyy olla puistossa avataksesi tietolinjurin oven!");
                                }
                            }
                        }
                        goto IL_C70;
                    }

                    case 355:
                    {
                        uint UserIidu2 = uint.Parse(text2.Split(';')[0]);
                        client = Essential.GetGame().GetClientManager().GetClient(UserIidu2);
                        if (client != null)
                        {
                            if (client.GetHabbo().InRoom)
                            {
                                Room      Room       = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                                DataTable Data       = null;
                                int       QuestionId = int.Parse(text2.Split(';')[1]);
                                Room.CurrentPollId = QuestionId;
                                string Question;

                                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                                {
                                    Question = dbClient.ReadString("SELECT question FROM infobus_questions WHERE id = '" + QuestionId + "' LIMIT 1");
                                    Data     = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id = '" + QuestionId + "'");
                                }

                                ServerMessage InfobusQuestion = new ServerMessage(Outgoing.InfobusPoll3); // Updated
                                InfobusQuestion.AppendStringWithBreak(Question);
                                InfobusQuestion.AppendInt32(Data.Rows.Count);
                                if (Data != null)
                                {
                                    foreach (DataRow Row in Data.Rows)
                                    {
                                        InfobusQuestion.AppendInt32((int)Row["id"]);
                                        InfobusQuestion.AppendStringWithBreak((string)Row["answer_text"]);
                                    }
                                }
                                Room.SendMessage(InfobusQuestion, null);

                                Thread Infobus = new Thread(delegate() { Room.ShowResults(Room, QuestionId, client); });
                                Infobus.Start();
                            }
                        }
                        goto IL_C70;
                    }

                    case 27:
                    case 28:
                    {
                        uint_2 = uint.Parse(text2);
                        client = Essential.GetGame().GetClientManager().GetClient(uint_2);
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            dataRow = class2.ReadDataRow("SELECT look,gender,motto,mutant_penalty,block_newfriends FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1");
                        }
                        client.GetHabbo().Figure          = (string)dataRow["look"];
                        client.GetHabbo().Gender          = dataRow["gender"].ToString().ToLower();
                        client.GetHabbo().Motto           = Essential.FilterString((string)dataRow["motto"]);
                        client.GetHabbo().BlockNewFriends = Essential.StringToBoolean(dataRow["block_newfriends"].ToString());

                        /*ServerMessage Message5 = new ServerMessage(Outgoing.UpdateUserInformation);
                         *                      Message5.AppendInt32(-1);
                         *                      Message5.AppendStringWithBreak(client.GetHabbo().Figure);
                         *                      Message5.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                         *                      Message5.AppendStringWithBreak(client.GetHabbo().Motto);
                         *                      client.SendMessage(Message5);*/
                        if (client.GetHabbo().InRoom)
                        {
                            class4 = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                            RoomUser      class6   = class4.GetRoomUserByHabbo(client.GetHabbo().Id);
                            ServerMessage Message6 = new ServerMessage(Outgoing.UpdateUserInformation);
                            Message6.AppendInt32(class6.VirtualId);
                            Message6.AppendStringWithBreak(client.GetHabbo().Figure);
                            Message6.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            Message6.AppendStringWithBreak(client.GetHabbo().Motto);
                            Message6.AppendInt32(client.GetHabbo().AchievementScore);
                            class4.SendMessage(Message6, null);
                        }
                        text3 = text.ToLower();
                        if (text3 == null)
                        {
                            goto IL_C70;
                        }
                        if (text3 == "updatemotto")
                        {
                            class4 = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                            RoomUser      class6   = class4.GetRoomUserByHabbo(client.GetHabbo().Id);
                            ServerMessage Message6 = new ServerMessage(Outgoing.UpdateUserInformation);
                            Message6.AppendInt32(class6.VirtualId);
                            Message6.AppendStringWithBreak(client.GetHabbo().Figure);
                            Message6.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            Message6.AppendStringWithBreak(client.GetHabbo().Motto);
                            Message6.AppendInt32(client.GetHabbo().AchievementScore);
                            class4.SendMessage(Message6, null);
                            client.GetHabbo().MottoAchievementsCompleted();
                            goto IL_C70;
                        }
                        if (text3 == "updatelook")
                        {
                            ServerMessage serverMessage = new ServerMessage(Outgoing.UpdateUserInformation);
                            serverMessage.AppendInt32(-1);
                            serverMessage.AppendStringWithBreak(client.GetHabbo().Figure);
                            serverMessage.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            serverMessage.AppendStringWithBreak(client.GetHabbo().Motto);
                            serverMessage.AppendInt32(client.GetHabbo().AchievementScore);
                            // serverMessage.AppendStringWithBreak("");
                            client.SendMessage(serverMessage);
                            class4 = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                            RoomUser      class6   = class4.GetRoomUserByHabbo(client.GetHabbo().Id);
                            ServerMessage Message6 = new ServerMessage(Outgoing.UpdateUserInformation);
                            Message6.AppendInt32(class6.VirtualId);
                            Message6.AppendStringWithBreak(client.GetHabbo().Figure);
                            Message6.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            Message6.AppendStringWithBreak(client.GetHabbo().Motto);
                            Message6.AppendInt32(client.GetHabbo().AchievementScore);
                            class4.SendMessage(Message6, null);
                            client.GetHabbo().AvatarLookAchievementsCompleted();
                            goto IL_C70;
                        }
                        goto IL_C70;
                    }

                    case 31:
                    {
                        int QuestionID = int.Parse(text2.Split(';')[1]);
                        using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                        {
                            DataRow   QuestionRow  = dbClient.ReadDataRow("SELECT * FROM infobus_questions WHERE id='" + QuestionID + "' LIMIT 1");
                            DataTable AnswersTable = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id='" + QuestionID + "'");
                            Room      PollRoom     = Essential.GetGame().GetClientManager().GetClientByHabbo(QuestionRow["owner"].ToString()).GetHabbo().CurrentRoom;
                            if (PollRoom.Owner == QuestionRow["owner"].ToString() || Essential.GetGame().GetClientManager().GetClientByHabbo(QuestionRow["owner"].ToString()).GetHabbo().Rank < 5)
                            {
                                PollRoom.GetPollManager().SetCurrentPoll(PollRoom.GetPollManager().CreateNewRoomPoll(QuestionRow, AnswersTable));
                                PollRoom.SendMessage(PollRoom.GetPollManager().GetCurrentPoll().PollToServerMessage(new ServerMessage(Outgoing.InfobusPoll3)), null);
                                Thread Poll = new Thread(delegate() { PollRoom.GetPollManager().GetCurrentPoll().ShowResults(); });
                                Poll.Start();
                            }
                        }

                        goto IL_C70;
                    }

                    case 32:
                    {
                        uint   UserId    = uint.Parse(text2.Split(new char[] { ' ' })[0]);
                        string BadgeCode = text2.Split(new char[] { ' ' })[1];

                        GameClient Session = Essential.GetGame().GetClientManager().GetClientByHabbo(Essential.GetGame().GetClientManager().GetNameById(UserId));
                        if (Session != null)
                        {
                            Session.GetHabbo().GetBadgeComponent().SendBadge(Session, BadgeCode, true);
                        }
                        else
                        {
                            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                            {
                                DataRow dr = dbClient.ReadDataRow("SELECT username FROM users WHERE id=" + UserId + " LIMIT 1");
                                if (dr != null)
                                {
                                    dbClient.AddParamWithValue("badge", BadgeCode);
                                    DataRow dr2 = dbClient.ReadDataRow("SELECT * FROM user_badges WHERE user_id=" + UserId + " AND badge_id=@badge LIMIT 1");
                                    if (dr2 == null)
                                    {
                                        dbClient.AddParamWithValue("badge", BadgeCode);
                                        dbClient.ExecuteQuery(string.Concat(new object[]
                                            {
                                                "INSERT INTO user_badges (user_id,badge_id,badge_slot) VALUES ('",
                                                UserId,
                                                "',@badge,'0')"
                                            }));
                                    }
                                }
                            }
                        }
                    }
                        goto IL_C70;

                    case 33:
                        using (DatabaseClient class5 = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetRoleManager().Initialize(class5);
                        }
                        goto IL_C70;

                    case 35:
                    {
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetCatalog().Initialize(class2);
                        }
                        Essential.GetGame().GetCatalog().InitializeCache();
                        goto IL_C70;
                    }

                    case 36:
                    {
                        uint sender   = uint.Parse(text2.Split(new char[] { ' ' })[0]);
                        uint reciever = uint.Parse(text2.Split(new char[] { ' ' })[1]);
                        if (!this.FriendshipExists(reciever, sender))
                        {
                            using (DatabaseClient @class = Essential.GetDatabase().GetClient())
                            {
                                @class.AddParamWithValue("toid", reciever);
                                @class.AddParamWithValue("userid", sender);
                                @class.ExecuteQuery("INSERT INTO messenger_friendships (user_one_id,user_two_id) VALUES (@userid,@toid)");
                                @class.ExecuteQuery("INSERT INTO messenger_friendships (user_one_id,user_two_id) VALUES (@toid,@userid)");
                            }
                            GameClient SenderClient   = Essential.GetGame().GetClientManager().GetClient(sender);
                            GameClient RecieverClient = Essential.GetGame().GetClientManager().GetClient(reciever);
                            if (RecieverClient != null)
                            {
                                RecieverClient.GetHabbo().GetMessenger().method_14(sender);
                            }
                            if (SenderClient != null)
                            {
                                SenderClient.GetHabbo().GetMessenger().method_14(reciever);
                            }
                        }
                        goto IL_C70;
                    }

                    case 50:
                    {
                        Essential.getWebSocketManager().Dispose();
                        Essential.InitWebsocketManager();
                        goto IL_C70;
                    }

                    case 51:
                    {
                        Room   room      = Essential.GetGame().GetRoomManager().GetRoom(uint.Parse(text2.Split(';')[0]));
                        string Eventname = text2.Split(';')[1];
                        if (Eventname.Length > 1)
                        {
                            Eventname = AntiAd.Utf8ToUtf16(Eventname);
                            string toSend = "5|" + Eventname + "|" + room.Owner + "|" + room.Id;
                            Essential.getWebSocketManager().SendMessageToEveryConnection(toSend);
                            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                            {
                                dbClient.AddParamWithValue("param1", room.Id);
                                dbClient.AddParamWithValue("param2", Eventname);
                                dbClient.ExecuteQuery("INSERT INTO hp_aktivitaetenstream (`user_id`,`type`,`extra_data`,`extra_data2`,`timestamp`) VALUES ('" + room.OwnerId + "','makeevent',@param1,@param2,'" + Convert.ToInt32(Essential.GetUnixTimestamp()) + "');");
                            }
                        }
                        goto IL_C70;
                    }

                    default:
                        goto IL_C70;
                    }
                    using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                    {
                        Essential.GetGame().GetCatalog().Initialize(class2);
                    }
                    Essential.GetGame().GetCatalog().InitializeCache();
                    Essential.GetGame().GetClientManager().BroadcastMessage(new ServerMessage(Outgoing.UpdateShop)); // Updated
                    goto IL_C70;
IL_34E:
                    num2 = uint.Parse(text2.Split(new char[]
                    {
                        ' '
                    })[0]);
                    num3 = uint.Parse(text2.Split(new char[]
                    {
                        ' '
                    })[1]);
                    GameClient class7 = Essential.GetGame().GetClientManager().GetClient(num2);
                    class4 = Essential.GetGame().GetRoomManager().GetRoom(num3);
                    if (class7 != null)
                    {
                        ServerMessage Message = new ServerMessage(Outgoing.RoomForward);
                        Message.AppendBoolean(class4.IsPublic);
                        Message.AppendUInt(class4.Id);
                        class7.SendMessage(Message);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_5BF:
                    uint_2 = uint.Parse(text2);
                    using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                    {
                        Essential.GetGame().GetClientManager().GetClient(uint_2).GetHabbo().method_0(class2);
                        goto IL_C70;
                    }
IL_602:
                    Essential.Close();
                    goto IL_C70;
IL_633:
                    client = Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2));
                    if (client != null)
                    {
                        int int_3 = 0;
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            int_3 = (int)class2.ReadDataRow("SELECT credits FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1")[0];
                        }
                        client.GetHabbo().SetCredits(int_3, "MUS UPDATE", "");
                        client.GetHabbo().UpdateCredits(false);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_6F7:
                    client = Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2));
                    if (client != null)
                    {
                        int int_4 = 0;
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            int_4 = (int)class2.ReadDataRow("SELECT activity_points FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1")[0];
                        }
                        client.GetHabbo().ActivityPoints = int_4;
                        client.GetHabbo().UpdateActivityPoints(false);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_839:
                    Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2)).Disconnect("MUS");
                    goto IL_C70;
IL_880:
                    string text6 = text2.Split(new char[]
                    {
                        ' '
                    })[0];
                    text5 = text2.Substring(text6.Length + 1);

                    Essential.GetGame().GetClientManager().GetClient(uint.Parse(text6)).SendNotification(text5);
                }
            }
IL_C70:
            try
            {
                ServerMessage Message9 = new ServerMessage(Outgoing.MusAnswer);
                Message9.AppendString("Essential 5");
                Message9.AppendString("MUS Handler");
                this.ClientSocket.Send(Message9.GetBytes());
            }
            catch {}
        }
Esempio n. 26
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            try
            {
                if ((Session != null) && (Session.GetHabbo().GetCredits() >= 10))
                {
                    List <int> gStates     = new List <int>();
                    string     name        = Event.PopFixedString();
                    string     description = Event.PopFixedString();
                    int        roomid      = Event.PopWiredInt32();
                    int        color       = Event.PopWiredInt32();
                    int        num3        = Event.PopWiredInt32();
                    Event.PopWiredInt32();
                    int guildBase      = Event.PopWiredInt32();
                    int guildBaseColor = Event.PopWiredInt32();
                    int num6           = Event.PopWiredInt32();
                    if (Essential.GetGame().GetRoomManager().method_15((uint)roomid).RoomData.GuildId != 0)
                    {
                        return;
                    }
                    for (int i = 0; i < (num6 * 3); i++)
                    {
                        int item = Event.PopWiredInt32();
                        gStates.Add(item);
                    }

                    string image       = Groups.GenerateGuildImage(guildBase, guildBaseColor, gStates);
                    string htmlColor   = Groups.GetHtmlColor(color);
                    string str5        = Groups.GetHtmlColor(num3);
                    string datecreated = DateTime.Now.ToShortDateString();

                    int id = (int)Session.GetHabbo().Id;

                    string username = Session.GetHabbo().Username;

                    Dictionary <int, string> members = new Dictionary <int, string>();
                    members.Add(id, DateTime.Now.Day + " - " + DateTime.Now.Month + " -  " + DateTime.Now.Year);



                    Room room = Essential.GetGame().GetRoomManager().GetRoom(Convert.ToUInt32(roomid));

                    if (room != null && room.CheckRights(Session, true))
                    {
                        GroupsManager guild = Groups.AddGuild(0, name, id, username, description, roomid, image, color, num3, guildBase, guildBaseColor, gStates, htmlColor, str5, Essential.GetUnixTimestamp().ToString(), members, new List <int>(), 0, 0);

                        using (DatabaseClient adapter = Essential.GetDatabase().GetClient())
                        {
                            Session.GetHabbo().dataTable_0    = adapter.ReadDataTable("SELECT * FROM group_memberships WHERE userid = " + Session.GetHabbo().Id);
                            Session.GetHabbo().FavouriteGroup = guild.Id;

                            adapter.ExecuteQuery(string.Concat(new object[] { "UPDATE user_stats SET groupid = '", guild.Id, "' WHERE Id = '", guild.OwnerId, "'" }));
                        }
                        ServerMessage message = new ServerMessage(Outgoing.SerializePurchaseInformation); //Rootkit
                        message.AppendInt32(0x1815);
                        message.AppendString("CREATE_GUILD");
                        message.AppendInt32(10);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendBoolean(true);
                        message.AppendInt32(0);
                        message.AppendInt32(2);
                        message.AppendBoolean(false);

                        Session.SendMessage(message);
                        Session.GetHabbo().TakeCredits(10, "Bought Guild");
                        Session.GetHabbo().UpdateCredits(true);

                        ServerMessage message2 = new ServerMessage(Outgoing.SendHtmlColors);
                        message2.AppendInt32(Session.GetHabbo().dataTable_0.Rows.Count);
                        foreach (DataRow drow in Session.GetHabbo().dataTable_0.Rows)
                        {
                            GroupsManager guild2 = Groups.GetGroupById((int)drow["groupid"]);
                            message2.AppendInt32(guild2.Id);
                            message2.AppendString(guild2.Name);
                            message2.AppendString(guild2.Badge);
                            message2.AppendString(guild2.ColorOne);
                            message2.AppendString(guild2.ColorTwo);
                            message2.AppendBoolean(guild2.Id == Session.GetHabbo().FavouriteGroup);
                        }

                        Session.SendMessage(message2);

                        if ((Session != null) && (room != null) && Session.GetHabbo().CurrentRoomId == roomid)
                        {
                            ServerMessage message3 = new ServerMessage(Outgoing.SetRoomUser); //Rootkit
                            message3.AppendInt32(1);
                            room.GetRoomUserByHabbo(Session.GetHabbo().Id).method_14(message3);
                            room.SendMessage(message3, null);
                        }

                        ServerMessage message4 = new ServerMessage(Outgoing.UpdateRoom); //Rootkit
                        message4.AppendInt32(guild.RoomId);
                        Session.SendMessage(message4);

                        ServerMessage message5 = new ServerMessage(Outgoing.ConfigureWallandFloor); //Rootkit
                        message5.AppendBoolean(room.Hidewall);
                        message5.AppendInt32(room.Wallthick);
                        message5.AppendInt32(room.Floorthick);
                        Session.SendMessage(message5);

                        ServerMessage message6 = new ServerMessage(Outgoing.SendRoomAndGroup); //Rootkit
                        message6.AppendInt32(guild.RoomId);
                        message6.AppendInt32(guild.Id);
                        Session.SendMessage(message6);

                        ServerMessage message7 = new ServerMessage(Outgoing.RoomData); //Rootkit
                        message7.AppendBoolean(true);
                        message7.AppendInt32(guild.RoomId);
                        message7.AppendString(room.Name);
                        message7.AppendBoolean(true);
                        message7.AppendInt32(room.OwnerId);
                        message7.AppendString(room.Owner);
                        message7.AppendInt32(room.State);
                        message7.AppendInt32(room.UsersNow);
                        message7.AppendInt32(room.UsersMax);
                        message7.AppendString(room.Description);
                        message7.AppendInt32(0);
                        message7.AppendInt32((room.Category == 0x34) ? 2 : 0);
                        message7.AppendInt32(room.Score);
                        message7.AppendInt32(0);
                        message7.AppendInt32(room.Category);

                        if (room.RoomData.GuildId == 0)
                        {
                            message7.AppendInt32(0);
                            message7.AppendInt32(0);
                        }
                        else
                        {
                            message7.AppendInt32(guild.Id);
                            message7.AppendString(guild.Name);
                            message7.AppendString(guild.Badge);
                        }

                        message7.AppendString("");
                        message7.AppendInt32(room.Tags.Count);

                        foreach (string str8 in room.Tags.ToArray())
                        {
                            message7.AppendString(str8);
                        }

                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendBoolean(true);
                        message7.AppendBoolean(true);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendBoolean(false);
                        message7.AppendBoolean(false);
                        message7.AppendBoolean(false);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendBoolean(false);
                        message7.AppendBoolean(true);
                        room.SendMessage(message7, null);
                    }
                }
            }catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Esempio n. 27
0
        public UserDataFactory(string ssoTicket, string ipAddress, bool getAllData)
        {
            if (string.IsNullOrEmpty(ssoTicket))
            {
                this.Validated = false;
            }
            else
            {
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("auth_ticket", ssoTicket);
                    string str = "";
                    try
                    {
                        if (int.Parse(Essential.GetConfig().data["debug"]) == 1)
                        {
                            str = "";
                        }
                    }
                    catch { }

                    this.UserData = dbClient.ReadDataRow("SELECT * FROM users WHERE auth_ticket = @auth_ticket " + str + " LIMIT 1;");

                    if (this.UserData != null)
                    {
                        this.Validated = true;

                        uint id = (uint)this.UserData["Id"];

                        if (getAllData)
                        {
                            this.Achievements   = dbClient.ReadDataTable("SELECT achievement_id,achievement_level FROM user_achievements WHERE user_id = '" + id + "'");
                            this.Favorites      = dbClient.ReadDataTable("SELECT room_id FROM user_favorites WHERE user_id = '" + id + "'");
                            this.Ignores        = dbClient.ReadDataTable("SELECT ignore_id FROM user_ignores WHERE user_id = '" + id + "'");
                            this.Tags           = dbClient.ReadDataTable("SELECT tag FROM user_tags WHERE user_id = '" + id + "'");
                            this.Subscriptions  = dbClient.ReadDataTable("SELECT subscription_id, timestamp_activated, timestamp_expire FROM user_subscriptions WHERE user_id = '" + id + "'");
                            this.Badges         = dbClient.ReadDataTable("SELECT user_badges.badge_id,user_badges.badge_slot FROM user_badges WHERE user_id = " + id);
                            this.Items          = dbClient.ReadDataTable("SELECT items.Id,items.base_item,items.ltd_id,items.ltd_cnt,items.guild_data,items_extra_data.extra_data FROM items LEFT JOIN items_extra_data ON items_extra_data.item_id = items.Id WHERE room_id = 0 AND user_id = " + id);
                            this.Effects        = dbClient.ReadDataTable("SELECT user_effects.effect_id,user_effects.total_duration,user_effects.is_activated,user_effects.activated_stamp FROM user_effects WHERE user_id =  " + id);
                            this.Friends        = dbClient.ReadDataTable("SELECT users.Id,users.username,users.motto,users.look,users.last_online FROM users JOIN messenger_friendships ON users.Id = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = '" + id + "'");
                            this.FriendRequests = dbClient.ReadDataTable("SELECT messenger_requests.Id,messenger_requests.from_id,users.username,users.gender,users.look FROM users JOIN messenger_requests ON users.Id = messenger_requests.from_id WHERE messenger_requests.to_id = '" + id + "'");

                            dbClient.AddParamWithValue("name", (string)this.UserData["username"]);

                            this.Rooms = dbClient.ReadDataTable("SELECT * FROM rooms WHERE owner = @name ORDER BY Id ASC LIMIT " + ServerConfiguration.RoomUserLimit);
                            this.Pets  = dbClient.ReadDataTable("SELECT Id, user_id, room_id, name, type, race, color, expirience, energy, nutrition, respect, createstamp, x, y, z FROM user_pets WHERE user_id = " + id + " AND room_id = 0");
                            this.Bots  = dbClient.ReadDataTable("SELECT * FROM user_bots WHERE owner_id = '" + id + "' AND room_id=0");

                            dbClient.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE users SET online = '1' WHERE Id = '",
                                id,
                                "' LIMIT 1; UPDATE user_info SET login_timestamp = '",
                                Essential.GetUnixTimestamp(),
                                "' WHERE user_id = '",
                                id,
                                "' LIMIT 1;"
                            }));
                            double loginStamp = Essential.GetUnixTimestamp();
                            this.LoginTime = loginStamp;
                            dbClient.ExecuteQuery("INSERT INTO user_clientsessions (`userId`,`login_timestamp`,`logout_timestamp`) VALUES ('" + id + "','" + loginStamp + "','0');");
                            //    @class.ExecuteQuery(string.Concat(new object[]
                            //{
                            //    "UPDATE users SET online = '1'" + /*auth_ticket = ''*/ "WHERE Id = '",
                            //    num,
                            //    "' LIMIT 1; UPDATE user_info SET login_timestamp = '",
                            //    Essential.GetUnixTimestamp(),
                            //    "' WHERE user_id = '",
                            //    num,
                            //    "' LIMIT 1;"
                            //}));
                            DataTable table;
                            DataTable table2;
                            //Profile Initialization - Might don't need all friends information, just the count but I didn't want to brake the system, so let them go..
                            //Altrough this is not the best perfomance scenario
                            table = dbClient.ReadDataTable("SELECT * FROM user_relationships WHERE requester_id = " + id);
                            uint target, rstatus;
                            List <Relationship.Relationship> relationships = new List <Relationship.Relationship>();
                            Dictionary <uint, uint>          tempRelationshipsDictionary = new Dictionary <uint, uint>();

                            foreach (DataRow row3 in table.Rows)
                            {
                                target  = Convert.ToUInt32(row3["target_id"]);
                                rstatus = Convert.ToUInt32(row3["relationshipstatus"]);
                                relationships.Add(new Relationship.Relationship(target, rstatus));
                            }
                            this.relationships = relationships;
                        }
                    }
                    else
                    {
                        this.Validated = false;
                    }
                }
            }
        }
Esempio n. 28
0
 public int GetMinutes(double TimeStamp)
 {
     return(Convert.ToInt32(Math.Round((Essential.GetUnixTimestamp() - TimeStamp) / 60)));
 }
Esempio n. 29
0
        public void method_10()
        {
            List <UserItem> list_  = this.method_1(this.uint_1).OfferedItems;
            List <UserItem> list_2 = this.method_1(this.uint_2).OfferedItems;

            foreach (UserItem current in list_)
            {
                if (this.method_1(this.uint_1).method_1().GetHabbo().GetInventoryComponent().GetItemById(current.uint_0) == null)
                {
                    this.method_1(this.uint_1).method_1().SendNotification("Tausch abgebrochen.");
                    this.method_1(this.uint_2).method_1().SendNotification("Tausch abgebrochen.");
                    return;
                }
            }
            foreach (UserItem current in list_2)
            {
                if (this.method_1(this.uint_2).method_1().GetHabbo().GetInventoryComponent().GetItemById(current.uint_0) == null)
                {
                    this.method_1(this.uint_1).method_1().SendNotification("Tausch abgebrochen.");
                    this.method_1(this.uint_2).method_1().SendNotification("Tausch abgebrochen.");
                    return;
                }
            }
            this.method_1(this.uint_2).method_1().GetHabbo().GetInventoryComponent().SavePets();
            this.method_1(this.uint_1).method_1().GetHabbo().GetInventoryComponent().SavePets();
            string trade1 = "";
            string trade2 = "";

            foreach (UserItem current in list_)
            {
                using (DatabaseClient @class = Essential.GetDatabase().GetClient())
                {
                    @class.ExecuteQuery(string.Concat(new object[]
                    {
                        "UPDATE items SET room_id = '0', user_id = '",
                        this.method_1(this.uint_2).method_1().GetHabbo().Id,
                        "' WHERE Id = '",
                        current.uint_0,
                        "' LIMIT 1"
                    }));
                }
                if (trade1 == "")
                {
                    trade1 = current.uint_0.ToString();
                }
                else
                {
                    trade1 = trade1 + "," + current.uint_0;
                }
                this.method_1(this.uint_1).method_1().GetHabbo().GetInventoryComponent().method_12(current.uint_0, this.method_1(this.uint_2).method_1().GetHabbo().Id, true);
                this.method_1(this.uint_2).method_1().GetHabbo().GetInventoryComponent().method_11(current.uint_0, current.uint_1, current.string_0, false, current.LtdId, current.LtdCnt, current.GuildData);
            }
            foreach (UserItem current in list_2)
            {
                using (DatabaseClient @class = Essential.GetDatabase().GetClient())
                {
                    @class.ExecuteQuery(string.Concat(new object[]
                    {
                        "UPDATE items SET room_id = '0', user_id = '",
                        this.method_1(this.uint_1).method_1().GetHabbo().Id,
                        "' WHERE Id = '",
                        current.uint_0,
                        "' LIMIT 1"
                    }));
                }
                if (trade2 == "")
                {
                    trade2 = current.uint_0.ToString();
                }
                else
                {
                    trade2 = trade2 + "," + current.uint_0;
                }
                this.method_1(this.uint_2).method_1().GetHabbo().GetInventoryComponent().method_12(current.uint_0, this.method_1(this.uint_1).method_1().GetHabbo().Id, true);
                this.method_1(this.uint_1).method_1().GetHabbo().GetInventoryComponent().method_11(current.uint_0, current.uint_1, current.string_0, false, current.LtdId, current.LtdCnt, current.GuildData);
            }
            this.method_1(this.uint_1).method_1().GetHabbo().GetInventoryComponent().method_9(true);
            this.method_1(this.uint_2).method_1().GetHabbo().GetInventoryComponent().method_9(true);
            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery(string.Concat(new object[]
                {
                    "INSERT INTO trades (owner_before,owner_after,items,timestamp) VALUES (",
                    this.method_1(this.uint_2).method_1().GetHabbo().Id,
                    ",",
                    this.method_1(this.uint_1).method_1().GetHabbo().Id,
                    ",'",
                    trade2,
                    "','",
                    Essential.GetUnixTimestamp(),
                    "')"
                }));
                dbClient.ExecuteQuery(string.Concat(new object[]
                {
                    "INSERT INTO trades (owner_before,owner_after,items,timestamp) VALUES (",
                    this.method_1(this.uint_1).method_1().GetHabbo().Id,
                    ",",
                    this.method_1(this.uint_2).method_1().GetHabbo().Id,
                    ",'",
                    trade1,
                    "','",
                    Essential.GetUnixTimestamp(),
                    "')"
                }));
            }
        }
Esempio n. 30
0
        internal void HandleSpeech(GameClient Session, string str, bool bool_13, int TextColor = 0)
        {
            if (TextColor == 23 && Session.GetHabbo().Rank < 4)
            {
                TextColor = 0;
            }
            if (TextColor > 23 || TextColor < 0 || TextColor == 1 || TextColor == 8 || TextColor == 2)
            {
                TextColor = 0;
            }
            if (!String.IsNullOrEmpty(str) || !String.IsNullOrWhiteSpace(str))
            {
                string object_ = str;

                // string linkRegex = @"((http|https):\/\/|www.)?[a-zA-Z0-9\-\.]+\b(com|co\.uk|org|net|eu|cf|info|ml|nl|ca|es|fi)\b";

                if (Session == null || (Session.GetHabbo().HasFuse("ignore_roommute") || !this.GetRoom().bool_4))
                {
                    this.Unidle();

                    if (!this.IsBot && this.GetClient().GetHabbo().IsMuted)
                    {
                        this.GetClient().SendNotification(EssentialEnvironment.GetExternalText("error_muted"));
                    }
                    else
                    {
                        if (!str.StartsWith(":") || Session == null || !ChatCommandHandler.HandleCommands(Session, str.Substring(1)))
                        {
                            uint num = Outgoing.Talk; // Updated
                            if (bool_13)
                            {
                                num = Outgoing.Shout; // Updated
                            }
                            if (!this.IsBot && Session.GetHabbo().method_4() > 0)
                            {
                                TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().dateTime_0;
                                if (timeSpan.Seconds > 4)
                                {
                                    Session.GetHabbo().int_23 = 0;
                                }
                                if (timeSpan.Seconds < 4 && Session.GetHabbo().int_23 > 5 && !this.IsBot)
                                {
                                    ServerMessage Message = new ServerMessage(Outgoing.FloodFilter);
                                    Message.AppendInt32(Session.GetHabbo().method_4());
                                    this.GetClient().SendMessage(Message);
                                    this.GetClient().GetHabbo().IsMuted = true;
                                    this.GetClient().GetHabbo().int_4   = Session.GetHabbo().method_4();
                                    return;
                                }
                                Session.GetHabbo().dateTime_0 = DateTime.Now;
                                Session.GetHabbo().int_23++;
                            }

                            if (!this.IsBot)
                            {
                                str = ChatCommandHandler.ApplyFilter(str);
                            }

                            if (!this.GetRoom().method_9(this, str))
                            {
                                ServerMessage Message2 = new ServerMessage(num);
                                Message2.AppendInt32(this.VirtualId);
                                string Site = "";
                                if (str.Contains("http://") || str.Contains("www."))
                                {
                                    string[] Split = str.Split(' ');

                                    foreach (string Msg in Split)
                                    {
                                        if (Msg.StartsWith("http://") || Msg.StartsWith("www."))
                                        {
                                            Site = Msg;
                                        }
                                    }

                                    //str = str.Replace(Site, "{0}");
                                }

                                Message2.AppendStringWithBreak(str);
                                Message2.AppendInt32(ParseEmoticon(str));
                                Message2.AppendInt32(this.IsBot && !this.IsPet ? 2 : TextColor);
                                Message2.AppendInt32(0);
                                Message2.AppendInt32(-1);
                                if (!Essential.GetAntiAd().ContainsIllegalWord(object_))
                                {
                                    if (!this.IsBot && this.GetClient() != null && this.GetClient().GetHabbo().PassedSafetyQuiz)
                                    {
                                        this.GetRoom().method_58(Message2, Session.GetHabbo().list_2, Session.GetHabbo().Id);
                                    }
                                    else
                                    {
                                        this.GetRoom().SendMessage(Message2, this.IsPet ? this.GetRoom().RoomUsers.Where(p => p != null && p.GetClient() != null && p.GetClient().GetHabbo() != null && p.GetClient().GetHabbo().MutePets).Select(o => o.GetClient().GetHabbo().Id).ToList() : this.IsBot ? this.GetRoom().RoomUsers.Where(p => p != null && p.GetClient() != null && p.GetClient().GetHabbo() != null && p.GetClient().GetHabbo().MuteBots).Select(o => o.GetClient().GetHabbo().Id).ToList() : null);
                                    }
                                }
                                else if (Essential.GetAntiAd().ContainsIllegalWord(object_) && this.GetClient() != null)
                                {
                                    ServerMessage Message3 = new ServerMessage(Outgoing.InstantChat);
                                    Message3.AppendUInt(0u);
                                    Message3.AppendString("[AWS] " + Session.GetHabbo().Username + ": " + object_);
                                    Message3.AppendString(Essential.GetUnixTimestamp() + string.Empty);
                                    Essential.GetGame().GetClientManager().SendToStaffs(Session, Message3);

                                    Session.SendNotification(Essential.GetGame().GetRoleManager().GetConfiguration().getData("antiad.alert"));
                                    return;
                                }
                            }
                            else
                            {
                                if (!this.IsBot)
                                {
                                    Session.GetHabbo().Whisper(str);
                                }
                            }

                            if (!this.IsBot)
                            {
                                this.GetRoom().method_7(this, str, bool_13);

                                if (Session.GetHabbo().CurrentQuestId > 0 && Essential.GetGame().GetQuestManager().GetQuestAction(Session.GetHabbo().CurrentQuestId) == "CHAT_WITH_SOMEONE")
                                {
                                    Essential.GetGame().GetQuestManager().ProgressUserQuest(Session.GetHabbo().CurrentQuestId, Session);
                                }
                            }

                            if (ServerConfiguration.EnableChatlog && !this.IsBot && !Essential.GetAntiAd().ContainsIllegalWord(object_) && this.GetRoom().Id != 74402)
                            {
                                using (DatabaseClient @class = Essential.GetDatabase().GetClient())
                                {
                                    @class.AddParamWithValue("message", object_);
                                    @class.ExecuteQuery(string.Concat(new object[]
                                    {
                                        "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('",
                                        Session.GetHabbo().Id,
                                        "','",
                                        this.GetRoom().Id,
                                        "','",
                                        DateTime.Now.Hour,
                                        "','",
                                        DateTime.Now.Minute,
                                        "',UNIX_TIMESTAMP(),@message,'",
                                        Session.GetHabbo().Username,
                                        "','",
                                        DateTime.Now.ToLongDateString(),
                                        "')"
                                    }));
                                }
                            }
                        }
                    }
                }
            }
        }