Beispiel #1
0
 public UserObjectComposer(Habbo Habbo)
     : base(ServerPacketHeader.UserObjectMessageComposer)
 {
     base.WriteInteger(Habbo.Id);
     base.WriteString(Habbo.Username);
     base.WriteString(Habbo.Look);
     base.WriteString(Habbo.Gender.ToUpper());
     base.WriteString(Habbo.Motto);
     base.WriteString("");
     base.WriteBoolean(false);
     base.WriteInteger(Habbo.Respect);
     base.WriteInteger(Habbo.DailyRespectPoints);
     base.WriteInteger(Habbo.DailyPetRespectPoints);
     base.WriteBoolean(true); // Friends stream active
     base.WriteString(Habbo.LastOnline.ToString()); // last online?
     base.WriteBoolean(false); // Can change name
     base.WriteBoolean(false);
 }
Beispiel #2
0
 public UserData(uint userID, Dictionary<string, UserAchievement> achievements, List<uint> favouritedRooms, List<uint> ignores, List<string> tags, 
     Subscription Sub, List<Badge> badges, List<UserItem> inventory, List<AvatarEffect> effects,
     Dictionary<uint, MessengerBuddy> friends, Dictionary<uint, MessengerRequest> requests, List<RoomData> rooms, Dictionary<uint, Pet> pets, Dictionary<uint, int> quests, Hashtable inventorySongs, Habbo user, Dictionary<uint, RoomBot> bots,
     Dictionary<int, Relationship> Relations)
 {
     this.userID = userID;
     this.achievements = achievements;
     this.favouritedRooms = favouritedRooms;
     this.ignores = ignores;
     this.tags = tags;
     this.subscriptions = Sub;
     this.badges = badges;
     this.inventory = inventory;
     this.effects = effects;
     this.friends = friends;
     this.requests = requests;
     this.rooms = rooms;
     this.pets = pets;
     this.quests = quests;
     this.inventorySongs = inventorySongs;
     this.user = user;
     this.Botinv = bots;
     this.Relations = Relations;
 }
Beispiel #3
0
 internal TeleUserData(GameClientMessageHandler pHandler, Habbo pUserRefference, UInt32 RoomId, UInt32 TeleId)
 {
     //this.User = User;
     this.mHandler = pHandler;
     this.mUserRefference = pUserRefference;
     this.RoomId = RoomId;
     this.TeleId = TeleId;
 }
Beispiel #4
0
        internal void Stop()
        {
            if (GetMessageHandler() != null)
                MessageHandler.Destroy();

            if (GetHabbo() != null)
                Habbo.OnDisconnect();
            CurrentRoomUserID = -1;

            this.MessageHandler = null;
            this.Habbo = null;
            this.Connection = null;
        }
Beispiel #5
0
        internal bool tryLogin(string AuthTicket)
        {
            try
            {
                string ip = GetConnection().getIp();
                byte errorCode = 0;
                UserData userData = UserDataFactory.GetUserData(AuthTicket, ip, out errorCode);
                if (errorCode == 1)
                {
                    SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso"));
                    return false;
                }
                else if (errorCode == 2)
                {
                    SendNotifWithScroll(LanguageLocale.GetValue("login.loggedin"));
                    return false;
                }

                SilverwaveEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                this.Habbo = userData.user;
                this.Habbo.SSOTicket = AuthTicket;
                userData.user.LoadData(userData);

                string banReason = SilverwaveEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip, MachineId);
                if (!string.IsNullOrEmpty(banReason) || userData.user.Username == null)
                {
                    SendNotifWithScroll(banReason);
                    Logging.WriteLine("Banned access from " + MachineId, ConsoleColor.Red);
                    using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
                    {
                        dbClient.setQuery("SELECT ip_last FROM users WHERE id=" + this.GetHabbo().Id + " LIMIT 1");
                        string IP = dbClient.getString();
                        dbClient.setQuery("SELECT COUNT(0) FROM bans_access WHERE user_id=" + this.Habbo.Id + " LIMIT 1");
                        int Count = dbClient.getInteger();
                        if (Count > 0)
                        {
                            dbClient.runFastQuery("UPDATE bans_access SET attempts = attempts + 1, ip='" + IP + "' WHERE user_id=" + this.GetHabbo().Id + " LIMIT 1");
                        }
                        else
                        {
                            dbClient.runFastQuery("INSERT INTO bans_access (user_id, ip) VALUES (" + this.GetHabbo().Id + ", '" + IP + "')");
                        }
                    }
                    return false;
                }

                userData.user.Init(this, userData);

                QueuedServerMessage response = new QueuedServerMessage(Connection);

                ServerMessage UniqueId = new ServerMessage(Outgoing.UniqueID);
                UniqueId.AppendString(this.MachineId);
                response.appendResponse(UniqueId);

                response.appendResponse(new AuthenticationOKComposer());

                if (this.Habbo != null)
                {

                    ServerMessage HomeRoom1 = new ServerMessage(Outgoing.HomeRoom);
                    HomeRoom1.AppendInt32(this.Habbo.HomeRoom); // first home
                    HomeRoom1.AppendInt32(this.Habbo.HomeRoom); // current home
                    response.appendResponse(HomeRoom1);
                }


                ServerMessage MiniMail = new ServerMessage(Outgoing.SerializeMiniMailCount);
                MiniMail.AppendInt32(0);
                response.appendResponse(MiniMail);


                ServerMessage FavouriteRooms = new ServerMessage(Outgoing.FavouriteRooms);
                FavouriteRooms.AppendInt32(30); // max rooms
                FavouriteRooms.AppendInt32(userData.user.FavoriteRooms.Count);
                foreach (uint Id in userData.user.FavoriteRooms.ToArray())
                {
                    FavouriteRooms.AppendInt32(Id);
                }
                response.appendResponse(FavouriteRooms);

                if (this.GetHabbo().GetAvatarEffectsInventoryComponent() != null)
                    SendMessage(this.GetHabbo().GetAvatarEffectsInventoryComponent().Serialize());

                response.appendResponse(new UserRightsComposer((this.Habbo == null) ? 1 : this.Habbo.Rank));

                ServerMessage bools1 = new ServerMessage(Outgoing.bools1);
                bools1.AppendBoolean(true);
                bools1.AppendBoolean(false);
                response.appendResponse(bools1);

                ServerMessage StartConsole = new ServerMessage(Outgoing.EnableConsole);
                StartConsole.AppendBoolean(true);
                response.appendResponse(StartConsole);

                //PixelManager.GivePixels(this, 0);

                ServerMessage mClient = new ServerMessage(Outgoing.ActivityPoints);
                mClient.AppendInt32(11); // ?
                mClient.AppendInt32(0);
                mClient.AppendInt32(Habbo.ActivityPoints);
                mClient.AppendInt32(1);
                mClient.AppendInt32(0);
                mClient.AppendInt32(2);
                mClient.AppendInt32(0);
                mClient.AppendInt32(3);
                mClient.AppendInt32(0);
                mClient.AppendInt32(4);
                mClient.AppendInt32(0); // Pixels
                mClient.AppendInt32(5);
                mClient.AppendInt32(Habbo.BelCredits);
                //seasonal currency
                mClient.AppendInt32(101);
                mClient.AppendInt32(0);
                mClient.AppendInt32(102);
                mClient.AppendInt32(0);
                mClient.AppendInt32(103);
                mClient.AppendInt32(0);
                mClient.AppendInt32(104);
                mClient.AppendInt32(0);
                mClient.AppendInt32(105);
                mClient.AppendInt32(Habbo.BelCredits);
                response.appendResponse(mClient);
                userData.user.UpdateCreditsBalance();

                ServerMessage fuserights = new ServerMessage(Outgoing.Fuserights);
                fuserights.AppendInt32(2);
                if (Habbo.GetSubscriptionManager().HasSubscription)
                {
                    fuserights.AppendInt32(1); //suscription
                }
                else 
                {
                    fuserights.AppendInt32(0); //no-suscription
                }
                //fuserights.AppendInt32(userData.user.Rank);
                fuserights.AppendInt32(0);
                response.appendResponse(fuserights);

                ServerMessage Constructors = new ServerMessage(Outgoing.ConstructorsClubLimits);
                Constructors.AppendInt32(0);  //current used furni
                Constructors.AppendInt32(100);  //max furni
                Constructors.AppendInt32(20000);  // club timestamp ? ye
                response.appendResponse(Constructors);

                ServerMessage KeysEvent = new ServerMessage(Outgoing.HabboColoredKeysEvent);
                KeysEvent.AppendString("");
                KeysEvent.AppendString("");
                response.appendResponse(KeysEvent);

                if (userData.user.HasFuse("fuse_mod"))
                {
                    response.appendResponse(SilverwaveEnvironment.GetGame().GetModerationTool().SerializeTool());
                }

                response.sendResponse();

                if (!string.IsNullOrWhiteSpace(SilverwaveEnvironment.GetDBConfig().DBData["welcome_message"]))
                {
                    this.SendBroadcastMessage(SilverwaveEnvironment.GetDBConfig().DBData["welcome_message"]);
                }
                return true;

            }
            catch (UserDataNotFoundException)
            {
                SendNotifWithScroll("User not found or already logged in.");
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Bug duing user login: " + e.ToString());
            }
            return false;
        }