Esempio n. 1
0
        public void DatabaseCleanup(DatabaseClient adapter, int serverStatus)
        {
            Logging.Write(TextManager.GetText("emu_cleandb"));
            bool debug = true;

            try
            {
                if (int.Parse(PhoenixEnvironment.GetConfig().data["debug"]) == 1)
                {
                    debug = false;
                }
            }
            catch
            {
            }
            if (debug)
            {
                adapter.ExecuteQuery("UPDATE users SET online = '0' WHERE online != '0'");
                adapter.ExecuteQuery("UPDATE rooms SET users_now = '0' WHERE users_now != '0'");
                adapter.ExecuteQuery("UPDATE user_roomvisits SET exit_timestamp = UNIX_TIMESTAMP() WHERE exit_timestamp <= 0");
                adapter.ExecuteQuery(string.Concat(new object[] { "UPDATE server_status SET status = '", serverStatus, "', users_online = '0', rooms_loaded = '0', server_ver = '", PhoenixEnvironment.PrettyVersion, "', stamp = UNIX_TIMESTAMP() LIMIT 1;" }));
            }
            Logging.WriteLine("completed!");
        }
Esempio n. 2
0
        public List <HauspaketAttributZuord> GetAllHauspaketAttributZuordInsert()
        {
            ClientDB2 = DatabaseClientFactory.GetClient(DatabaseType.DB2);
            DataTable hauspaketAttributZuordTable = ClientDB2.ExecuteQuery(new HauspaketAttributZuord().GetSelectAllString(), null);

            var resultSet = from hauspaketAttributZuord in hauspaketAttributZuordTable.AsEnumerable()
                            select new HauspaketAttributZuord()
            {
                SyncOperation = "INSERT",
                HauspaketId   = HandleInt(hauspaketAttributZuord[0].ToString()),
                WertId        = HandleInt(hauspaketAttributZuord[1].ToString())
            };

            return(resultSet.ToList <HauspaketAttributZuord>());
        }
Esempio n. 3
0
        public List <Hersteller> GetAllHerstellerInsert()
        {
            ClientDB2 = DatabaseClientFactory.GetClient(DatabaseType.DB2);
            DataTable herstellerTable = ClientDB2.ExecuteQuery(new Hersteller().GetSelectAllString(), null);

            var resultSet = from hersteller in herstellerTable.AsEnumerable()
                            select new Hersteller()
            {
                SyncOperation = "INSERT",
                HerstellerId  = HandleInt(hersteller[0].ToString()),
                Name          = hersteller[0].ToString()
            };

            return(resultSet.ToList <Hersteller>());
        }
Esempio n. 4
0
        public void UpdateCredits(bool save)
        {
            this.GetSession().SendMessage(BasicUtilies.GetRevisionPacketManager(this.GetSession().Revision).GetOutgoing(OutgoingPacketsEnum.UpdateCredits).Handle(new ValueHolder().AddValue("Credits", this.Credits)));

            if (save)
            {
                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                {
                    dbClient.AddParamWithValue("credits", this.Credits);
                    dbClient.AddParamWithValue("userId", this.ID);

                    dbClient.ExecuteQuery("UPDATE users SET credits = @credits WHERE id = @userId LIMIT 1");
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && !Session.GetHabbo().list_4.Contains(@class.Id) && [email protected](Session, true))
            {
                switch (Event.PopWiredInt32())
                {
                case -1:
                    @class.Score--;
                    break;

                case 0:
                    return;

                case 1:
                    @class.Score++;
                    if (Session.GetHabbo().FriendStreamEnabled)
                    {
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            string look = GoldTree.FilterString(Session.GetHabbo().Figure);
                            class2.AddParamWithValue("look", look);
                            class2.ExecuteQuery("INSERT INTO `friend_stream` (`id`, `type`, `userid`, `gender`, `look`, `time`, `data`) VALUES (NULL, '1', '" + Session.GetHabbo().Id + "', '" + Session.GetHabbo().Gender + "', @look, UNIX_TIMESTAMP(), '" + Session.GetHabbo().CurrentRoomId + "');");
                        }
                    }
                    break;

                default:
                    return;
                }
                using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                {
                    class2.ExecuteQuery(string.Concat(new object[]
                    {
                        "UPDATE rooms SET score = '",
                        @class.Score,
                        "' WHERE Id = '",
                        @class.Id,
                        "' LIMIT 1"
                    }));
                }
                Session.GetHabbo().list_4.Add(@class.Id);
                ServerMessage Message = new ServerMessage(345u);
                Message.AppendInt32(@class.Score);
                Session.SendMessage(Message);
            }
        }
Esempio n. 6
0
        public void method_11(uint uint_1, uint uint_2, string string_0, bool bool_0)
        {
            UserItem item = new UserItem(uint_1, uint_2, string_0);

            this.list_0.Add(item);
            if (this.list_1.Contains(uint_1))
            {
                this.list_1.Remove(uint_1);
            }
            if (!this.hashtable_1.ContainsKey(uint_1))
            {
                if (bool_0)
                {
                    using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
                    {
                        @class.AddParamWithValue("extra_data", string_0);
                        @class.ExecuteQuery(string.Concat(new object[]
                        {
                            "INSERT INTO items (Id,user_id,base_item,extra_data,wall_pos) VALUES ('",
                            uint_1,
                            "','",
                            this.uint_0,
                            "','",
                            uint_2,
                            "',@extra_data, '')"
                        }));
                        return;
                    }
                }

                if (item.method_1().InteractionType == "musicdisc")
                {
                    this.discs.Add(item.uint_0, item);
                }

                using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
                {
                    @class.ExecuteQuery(string.Concat(new object[]
                    {
                        "UPDATE items SET room_id = 0, user_id = '",
                        this.uint_0,
                        "' WHERE Id = '",
                        uint_1,
                        "'"
                    }));
                }
            }
        }
Esempio n. 7
0
 public void GiveBadge(string Badge, int Slot, bool InDatabase)
 {
     if (HasBadge(Badge))
     {
         return;
     }
     if (InDatabase)
     {
         using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
         {
             adapter.AddParamWithValue("badge", Badge);
             adapter.ExecuteQuery("INSERT INTO user_badges (user_id,badge_id,badge_slot) VALUES ('" + UserId + "',@badge,'" + Slot + "')");
         }
     }
     Badges.Add(new Badge(Badge, Slot));
 }
Esempio n. 8
0
        public void ClearItems()
        {
            using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
            {
                adapter.AddParamWithValue("userid", UserId);
                adapter.ExecuteQuery("DELETE FROM items WHERE room_id = 0 AND user_id = @userid;");
            }

            this.discs.Clear();
            this.mAddedItems.Clear();
            this.mRemovedItems.Clear();
            this.InventoryItems.Clear();
            ServerMessage Message = new ServerMessage(101);

            this.GetClient().SendMessage(Message);
        }
Esempio n. 9
0
        private static void TestDB2()
        {
            Logger.Info("Start TestDB2 ");

            Logger.Info("Obtaining DB2 Client");
            DatabaseClient mysqlClient = DatabaseClientFactory.GetClient(DatabaseType.DB2);

            Logger.Info("Executing query DB2: " + DB2_TEST_QUERY);
            DataTable dataTable = mysqlClient.ExecuteQuery(DB2_TEST_QUERY, null);

            Logger.Info("Printing ResultSet");
            foreach (DataRow row in dataTable.Rows)
            {
                Console.WriteLine(row);
            }
        }
Esempio n. 10
0
        private static void TestMySQL()
        {
            Logger.Info("Start TestMySQL ");

            Logger.Info("Obtaining MYSQL Client");
            DatabaseClient mysqlClient = DatabaseClientFactory.GetClient(DatabaseType.MYSQL);

            Logger.Info("Executing query MYSQL: " + MYSQL_TEST_QUERY);
            DataTable dataTable = mysqlClient.ExecuteQuery(MYSQL_TEST_QUERY, null);

            Logger.Info("Printing ResultSet");
            foreach (DataRow row in dataTable.Rows)
            {
                Console.WriteLine(row);
            }
        }
Esempio n. 11
0
        public List <HauspaketAttribut> GetAllHauspaketAttributInsert()
        {
            ClientDB2 = DatabaseClientFactory.GetClient(DatabaseType.DB2);
            DataTable hauspaketAttributTable = ClientDB2.ExecuteQuery(new HauspaketAttribut().GetSelectAllString(), null);

            var resultSet = from hauspaketAttribut in hauspaketAttributTable.AsEnumerable()
                            select new HauspaketAttribut()
            {
                SyncOperation      = "INSERT",
                AttributId         = HandleInt(hauspaketAttribut[0].ToString()),
                AttributTyp        = hauspaketAttribut[1].ToString(),
                AttributTypAnzeige = "" + hauspaketAttribut[2]
            };

            return(resultSet.ToList <HauspaketAttribut>());
        }
Esempio n. 12
0
        public void ClearInventory()
        {
            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("DELETE FROM items WHERE room_id = 0 AND user_id = '" + this.UserId + "';");
            }

            this.Discs.Clear();
            this.hashtable_1.Clear();
            this.list_1.Clear();
            this.Items.Clear();

            ServerMessage Message5_ = new ServerMessage(Outgoing.UpdateInventary); // Updated

            this.GetClient().SendMessage(Message5_);
        }
        public void ClearInventory()
        {
            using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("DELETE FROM items WHERE room_id = 0 AND user_id = '" + this.UserId + "';");
            }

            this.Discs.Clear();
            this.hashtable_1.Clear();
            this.list_1.Clear();
            this.Items.Clear();

            ServerMessage Message5_ = new ServerMessage(101u);

            this.GetClient().SendMessage(Message5_);
        }
Esempio n. 14
0
        public void RemoveItemFromHand(uint id, bool delete)
        {
            if (delete)
            {
                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                {
                    dbClient.AddParamWithValue("itemId", id);
                    dbClient.ExecuteQuery("DELETE FROM items WHERE id = @itemId LIMIT 1;");
                }
            }

            this.SendData(BasicUtilies.GetRevisionPacketManager(this.Session.Revision).GetOutgoing(OutgoingPacketsEnum.RemoveItemFromHand).Handle(new ValueHolder("InventoryManager", this, "ID", id)));

            this.FloorItems.Remove(id);
            this.WallItems.Remove(id);
        }
Esempio n. 15
0
        public void SetCurrentPresetSettings(int preset, bool backgroundOnly, string colorCode, int colorIntensity)
        {
            if (this.IsValidColor(colorCode) && colorIntensity >= 0 && colorIntensity <= 255)
            {
                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                {
                    dbClient.AddParamWithValue("data", colorCode + "," + colorIntensity + "," + TextUtilies.BoolToString(backgroundOnly));
                    dbClient.AddParamWithValue("itemId", this.ItemID);
                    dbClient.ExecuteQuery("UPDATE items_moodlight SET preset_" + (this.CurrentPreset == 1 ? "one" : this.CurrentPreset == 2 ? "two" : "three") + " = @data WHERE item_id = @itemId LIMIT 1");
                }

                this.GetPreset(preset).BackgroundOnly = backgroundOnly;
                this.GetPreset(preset).ColorCode      = colorCode;
                this.GetPreset(preset).ColorIntensity = colorIntensity;
            }
        }
        public void RemovePetsFromInventory()
        {
            using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("DELETE FROM user_pets WHERE user_id = " + this.UserId + " AND room_id = 0;");
            }

            foreach (Pet pet in Pets.Values)
            {
                ServerMessage Message = new ServerMessage(604u);
                Message.AppendUInt(pet.PetId);
                this.GetClient().SendMessage(Message);
            }

            this.Pets.Clear();
        }
Esempio n. 17
0
 public void method_3(string string_0, int int_0)
 {
     string_0 = string_0.ToLower();
     if (this.dictionary_0.ContainsKey(string_0))
     {
         Subscription @class = this.dictionary_0[string_0];
         @class.method_1(int_0);
         if (@class.Int32_0 <= 0 || @class.Int32_0 >= 2147483647)
         {
             return;
         }
         using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
         {
             class2.AddParamWithValue("subcrbr", string_0);
             class2.ExecuteQuery(string.Concat(new object[]
             {
                 "UPDATE user_subscriptions SET timestamp_expire = '",
                 @class.Int32_0,
                 "' WHERE user_id = '",
                 this.uint_0,
                 "' AND subscription_id = @subcrbr LIMIT 1"
             }));
             return;
         }
     }
     if (!this.dictionary_0.ContainsKey("habbo_vip"))
     {
         int          num    = (int)GoldTree.GetUnixTimestamp();
         int          num2   = (int)GoldTree.GetUnixTimestamp() + int_0;
         Subscription class3 = new Subscription(string_0, num, num2);
         using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
         {
             class2.AddParamWithValue("subcrbr", string_0);
             class2.ExecuteQuery(string.Concat(new object[]
             {
                 "INSERT INTO user_subscriptions (user_id,subscription_id,timestamp_activated,timestamp_expire) VALUES ('",
                 this.uint_0,
                 "',@subcrbr,'",
                 num,
                 "','",
                 num2,
                 "')"
             }));
         }
         this.dictionary_0.Add(class3.String_0.ToLower(), class3);
     }
 }
Esempio n. 18
0
        public void doInsertQuery(string Table, Dictionary <string, object> mcollection)
        {
            int ValueInt32 = 0, KeyInt32 = 0;

            //Inialize the query builder
            StringBuilder queryBuilder = new StringBuilder("INSERT INTO " + Table + " ");

            //Initalize the key builder
            StringBuilder keyBuilder = new StringBuilder("(");

            //Initalize the insert builder
            StringBuilder valueBuilder = new StringBuilder(") VALUES (");

            foreach (string Key in mcollection.Keys)
            {
                KeyInt32++;

                if (KeyInt32 != mcollection.Count)
                {
                    keyBuilder.Append("`" + Filter(Key) + "`, ");
                }
                else
                {
                    keyBuilder.Append("`" + Filter(Key) + "`");
                }
            }
            foreach (object Value in mcollection.Values)
            {
                ValueInt32++;

                if (ValueInt32 != mcollection.Count)
                {
                    valueBuilder.Append("'" + Filter(Convert.ToString(Value)) + "', ");
                }
                else
                {
                    valueBuilder.Append("'" + Filter(Convert.ToString(Value)) + "')");
                }
            }
            using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery(queryBuilder.ToString() + keyBuilder.ToString() + valueBuilder.ToString());
            }

            //Clears them
            mcollection.Clear();
        }
Esempio n. 19
0
        public void UnloadRoom()
        {
            if (!this.RoomUnloaded)
            {
                this.RoomUnloaded = true;

                ServerMessage Message = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                Message.Init(r63aOutgoing.LeaveRoom);
                byte[] bytes = Message.GetBytes();

                foreach (RoomUnitUser user in this.RoomUserManager.GetRealUsers())
                {
                    user.Session.GetHabbo().GetRoomSession().LeavedRoom();
                    user.Session.SendData(bytes);
                }

                this.RoomItemManager.SaveAll();
                this.RoomUserManager.SaveAll();

                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                {
                    dbClient.AddParamWithValue("roomId", this.ID);
                    dbClient.AddParamWithValue("data", JsonConvert.SerializeObject(this.RoomData.ExtraData));
                    dbClient.ExecuteQuery("UPDATE rooms SET data = @data WHERE id = @roomId LIMIT 1");
                }

                //achievement saving
                if (!this.EquestrianTrackHost(0) || !this.FootballGoalHost(0) || !this.RoomHost(0))
                {
                    using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                    {
                        dbClient.AddParamWithValue("ownerId", this.RoomData.OwnerID);
                        dbClient.AddParamWithValue("equestrianTrackHost", this.EquestrianTrackHost_Offline);
                        dbClient.AddParamWithValue("footballGoalHost", this.FootballGoalHost_Offline);
                        dbClient.AddParamWithValue("roomHost", this.RoomHost_Offline);
                        dbClient.ExecuteQuery("UPDATE user_stats SET equestrian_track_host = equestrian_track_host + @equestrianTrackHost, football_goal_host = football_goal_host + @footballGoalHost, room_host = room_host + @roomHost WHERE user_id = @ownerId LIMIT 1");
                    }

                    this.EquestrianTrackHost_Offline = 0;
                    this.FootballGoalHost_Offline    = 0;
                    this.RoomHost_Offline            = 0;
                }
            }

            GC.SuppressFinalize(this);
        }
Esempio n. 20
0
        public List <Berater> GetAllBeraterInsert()
        {
            ClientDB2 = DatabaseClientFactory.GetClient(DatabaseType.DB2);
            DataTable beraterTable = ClientDB2.ExecuteQuery(new Berater().GetSelectAllString(), null);

            var resultSet = from berater in beraterTable.AsEnumerable()
                            select new Berater()
            {
                SyncOperation = "INSERT",
                BeraterId     = HandleInt(berater[0].ToString()),
                HerstellerId  = HandleInt(berater[1].ToString()),
                BenutzerId    = HandleInt(berater[2].ToString()),
                Bild          = berater[3].ToString()
            };

            return(resultSet.ToList <Berater>());
        }
Esempio n. 21
0
        public void remove_tags()
        {
            if (Session.GetHabbo().HasFuse("fuse_admin") || Session.GetHabbo().HasFuse("fuse_sysadmin") || Session.GetHabbo().HasFuse("fuse_mod") || RoomUser.CalculateRights(Session.GetHabbo().RoomId, Session.GetHabbo().ID))
            {
                using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("UPDATE private_rooms SET tags = '' WHERE id = '" + Session.GetHabbo().RoomId + "'");

                    //Set the variable
                    AleedaEnvironment.GetCache().GetPrivateRooms().getRoom(Session.GetHabbo().RoomId).Tags = "";

                    ServerMessage msg = new ServerMessage(139); // "BK"
                    msg.Append("Removed all tags");
                    Session.GetMessageHandler().SendRoom(msg);
                }
            }
        }
Esempio n. 22
0
        public virtual void Handle(GameClient session, ClientMessage message)
        {
            if (session?.GetHabbo()?.GetMessenger() != null)
            {
                foreach (uint userId in this.RemovedFriends)
                {
                    session.GetHabbo().GetMessenger().RemoveFriendFromBoth(userId);
                }

                string friendIds = string.Join(",", this.RemovedFriends);
                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                {
                    dbClient.AddParamWithValue("userid", session.GetHabbo().ID);
                    dbClient.ExecuteQuery("DELETE FROM messenger_friends WHERE (user_one_id = @userid AND user_two_id IN(" + friendIds + ")) OR (user_one_id IN(" + friendIds + ") AND user_two_id = @userid) LIMIT " + this.RemovedFriends.Length);
                }
            }
        }
Esempio n. 23
0
        public void Pick(GameClient picker, bool updateToDB)
        {
            this.Status         = SupportTicketStatus.Picked;
            this.PickerID       = picker.GetHabbo().ID;
            this.PickerUsername = picker.GetHabbo().Username;

            if (updateToDB)
            {
                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                {
                    dbClient.AddParamWithValue("ticketId", this.ID);
                    dbClient.AddParamWithValue("pickerId", this.PickerID);
                    dbClient.AddParamWithValue("pickerUsername", this.PickerUsername);
                    dbClient.ExecuteQuery("UPDATE moderation_tickets SET status = 'picked', picker_id = @pickerId WHERE id = @ticketId LIMIT 1");
                }
            }
        }
Esempio n. 24
0
        public void parse(GameClient Session, ClientMessage Event)
        {
            uint     HomeRoom = Event.PopWiredUInt();
            RoomData Data     = PhoenixEnvironment.GetGame().GetRoomManager().GenerateRoomData(HomeRoom);

            if (HomeRoom == 0 || (Data != null && !(Data.Owner.ToLower() != Session.GetHabbo().Username.ToLower())))
            {
                Session.GetHabbo().HomeRoom = HomeRoom;
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    adapter.ExecuteQuery("UPDATE users SET home_room = '" + HomeRoom + "' WHERE Id = '" + Session.GetHabbo().Id + "' LIMIT 1;");
                }
                ServerMessage Message = new ServerMessage(455);
                Message.AppendUInt(HomeRoom);
                Session.SendMessage(Message);
            }
        }
Esempio n. 25
0
        public void Handle(GameClient session, ClientMessage message)
        {
            if (session != null && session.GetHabbo() != null)
            {
                RoomUnitUser roomUser = session.GetHabbo().GetRoomSession().GetRoomUser();
                if (roomUser != null)
                {
                    string gender = message.PopFixedString().ToUpper();
                    string figure = message.PopFixedString();

                    session.GetHabbo().Gender = gender;
                    session.GetHabbo().Look   = figure;

                    roomUser.FootballGateFigureActive = false;

                    using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                    {
                        dbClient.AddParamWithValue("userId", session.GetHabbo().ID);
                        dbClient.AddParamWithValue("look", figure);
                        dbClient.AddParamWithValue("gender", gender);

                        dbClient.ExecuteQuery("UPDATE users SET look = @look, gender = @gender WHERE id = @userId LIMIT 1");
                    }

                    ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                    message_.Init(r63aOutgoing.UpdateUser);
                    message_.AppendInt32(-1);
                    message_.AppendString(session.GetHabbo().Look);
                    message_.AppendString(session.GetHabbo().Gender.ToLower());
                    message_.AppendString(session.GetHabbo().Motto);
                    message_.AppendInt32(session.GetHabbo().GetUserStats().AchievementPoints);
                    session.SendMessage(message_);

                    ServerMessage message_2 = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                    message_2.Init(r63aOutgoing.UpdateUser);
                    message_2.AppendInt32(roomUser.VirtualID);
                    message_2.AppendString(session.GetHabbo().Look);
                    message_2.AppendString(session.GetHabbo().Gender.ToLower());
                    message_2.AppendString(session.GetHabbo().Motto);
                    message_2.AppendInt32(session.GetHabbo().GetUserStats().AchievementPoints);
                    roomUser.Room.SendToAll(message_2);

                    Skylight.GetGame().GetAchievementManager().AddAchievement(session, "AvatarLook", 1);
                }
            }
        }
Esempio n. 26
0
 public void ActivateQuest(uint uint_0, GameClient Session)
 {
     if (Session != null && Session.GetHabbo() != null)
     {
         if (Session.GetHabbo().CurrentQuestId != uint_0)
         {
             Session.GetHabbo().CurrentQuestId       = uint_0;
             Session.GetHabbo().CurrentQuestProgress = 0;
             using (DatabaseClient @class = Essential.GetDatabase().GetClient())
             {
                 @class.AddParamWithValue("uid", Session.GetHabbo().Id);
                 @class.AddParamWithValue("qid", uint_0);
                 @class.ExecuteQuery("UPDATE user_stats SET quest_id = @qid, quest_progress = '0' WHERE Id = @uid LIMIT 1");
             }
         }
         if (uint_0 == 0u)
         {
             Session.SendMessage(this.SerializeQuests(Session));
             ServerMessage Message5_ = new ServerMessage(Outgoing.QuestCancel); // Updated QuestCancel 803 old
             Message5_.AppendBoolean(false);                                    // Is expired
             Session.SendMessage(Message5_);
         }
         else
         {
             Quest class2 = this.GetQuest(uint_0);
             if (class2.NeedForLevel <= Session.GetHabbo().CurrentQuestProgress)
             {
                 this.CompleteQuest(uint_0, Session);
             }
             else
             {
                 /*ServerMessage Message = new ServerMessage(Outgoing.LoadQuests); // Updated
                  * Message.AppendInt32(QuestsCount);
                  * this.method_9(Session, Message);
                  * Message.AppendBoolean(true);
                  * Session.SendMessage(Message);*/
                 ServerMessage message1 = new ServerMessage(Outgoing.ActivateQuest);
                 this.GetQuest(uint_0).Serialize(message1, Session, true);
                 //this.method_9(Session, message1);
                 message1.AppendBoolean(true);
                 Session.SendMessage(message1);
             }
         }
     }
 }
Esempio n. 27
0
 internal void StoreCommand(GameClient class16_1, string string_0, string string_1)
 {
     if (ServerConfiguration.EnableCommandLog)
     {
         using (DatabaseClient @class = Essential.GetDatabase().GetClient())
         {
             @class.AddParamWithValue("extra_data", string_1);
             @class.AddParamWithValue("username", class16_1.GetHabbo().Username);
             @class.AddParamWithValue("cmd", string_0);
             @class.ExecuteQuery(string.Concat(new object[]
             {
                 "INSERT INTO cmdlogs (user_id,user_name,command,extra_data,timestamp) VALUES ('",
                 class16_1.GetHabbo().Id,
                 "',@username,@cmd, @extra_data, UNIX_TIMESTAMP())"
             }));
         }
     }
 }
Esempio n. 28
0
        public void LogIn(string username, string password, uint userId, int time)
        {
            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
            {
                password = BitConverter.ToString(MD5CryptoServiceProvider.Create().ComputeHash(Encoding.UTF8.GetBytes(password))).Replace("-", "").ToLower();

                string sso = "Temp-SSO-Login-With-Username-And-Password-" + username + "-" + time + "-" + TimeUtilies.GetUnixTimestamp();
                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                {
                    dbClient.AddParamWithValue("username", username);
                    dbClient.AddParamWithValue("password", password);
                    dbClient.AddParamWithValue("sso", sso);
                    dbClient.ExecuteQuery("UPDATE users SET auth_ticket = @sso WHERE `username` = @username AND `password` = @password LIMIT 1");
                }

                this.LogIn(sso, true);
            }
        }
Esempio n. 29
0
        public void Handle(GameClient session, ClientMessage message)
        {
            uint roomId = message.PopWiredUInt();

            if (session.GetHabbo().HomeRoom != roomId)
            {
                session.GetHabbo().HomeRoom = roomId;

                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                {
                    dbClient.AddParamWithValue("roomId", roomId);
                    dbClient.AddParamWithValue("userId", session.GetHabbo().ID);
                    dbClient.ExecuteQuery("UPDATE users SET home_room = @roomId WHERE id = @userId LIMIT 1");
                }

                session.SendMessage(OutgoingPacketsEnum.HomeRoom, new ValueHolder("HomeRoom", session.GetHabbo().HomeRoom));
            }
        }
Esempio n. 30
0
 public void UpdateShellsBalance(bool FromDatabase, bool ToDatabase)
 {
     if (FromDatabase)
     {
         using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
         {
             this.shells = adapter.ReadInt32("SELECT vip_points FROM users WHERE Id = '" + Id + "' LIMIT 1;");
         }
     }
     if (ToDatabase)
     {
         using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
         {
             adapter.ExecuteQuery("UPDATE users SET vip_points = '" + shells + "' WHERE Id = '" + Id + "' LIMIT 1;");
         }
     }
     UpdateActivityPointsBalance(0);
 }