Esempio n. 1
0
 public UserData(uint userID, Dictionary<string, UserAchievement> achievements, List<uint> favouritedRooms, List<uint> ignores, List<string> tags, 
     Dictionary<string, Subscription> subscriptions, 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)
 {
     this.userID = userID;
     this.achievements = achievements;
     this.favouritedRooms = favouritedRooms;
     this.ignores = ignores;
     this.tags = tags;
     this.subscriptions = subscriptions;
     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;
 }
Esempio n. 2
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;
                }

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

                if (userData.user.Username == null)
                {
                    SendBanMessage("You have no username.");
                    return false;
                }
                string banReason = PiciEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip);
                if (!string.IsNullOrEmpty(banReason))
                {
                    SendBanMessage(banReason);
                    return false;
                }

                userData.user.Init(this, userData);

                QueuedServerMessage response = new QueuedServerMessage(Connection);

                userData.user.SerializeQuests(ref response);

                GetMessageHandler().GetResponse().Init(2);
                if (userData.user.HasRight("acc_anyroomowner"))
                    GetMessageHandler().GetResponse().AppendInt32(7);
                else if (userData.user.HasRight("acc_anyroomrights"))
                    GetMessageHandler().GetResponse().AppendInt32(5);
                else if (userData.user.HasRight("acc_supporttool"))
                    GetMessageHandler().GetResponse().AppendInt32(4);
                else if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip"))
                    GetMessageHandler().GetResponse().AppendInt32(2);
                else if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                    GetMessageHandler().GetResponse().AppendInt32(1);
                else
                    GetMessageHandler().GetResponse().AppendInt32(0);

                GetMessageHandler().SendResponse();

                if (userData.user.HasRight("acc_supporttool"))
                {
                    SendMessage(PiciEnvironment.GetGame().GetModerationTool().SerializeTool());
                    PiciEnvironment.GetGame().GetModerationTool().SerializeOpenTickets(this);
                }

                SendMessage(userData.user.GetAvatarEffectsInventoryComponent().Serialize());

                GetMessageHandler().GetResponse().Init(290);
                GetMessageHandler().GetResponse().AppendBoolean(true);
                GetMessageHandler().GetResponse().AppendBoolean(false);
                GetMessageHandler().SendResponse();

                GetMessageHandler().GetResponse().Init(3);
                GetMessageHandler().SendResponse();

                GetMessageHandler().GetResponse().Init(517);
                GetMessageHandler().GetResponse().AppendBoolean(true);
                GetMessageHandler().SendResponse();

                //if (PixelManager.NeedsUpdate(this))
                //    PixelManager.GivePixels(this);

                if (PiciEnvironment.GetGame().GetClientManager().pixelsOnLogin > 0)
                {
                    PixelManager.GivePixels(this, PiciEnvironment.GetGame().GetClientManager().pixelsOnLogin);
                }

                if (PiciEnvironment.GetGame().GetClientManager().creditsOnLogin > 0)
                {
                    userData.user.Credits += PiciEnvironment.GetGame().GetClientManager().creditsOnLogin;
                    userData.user.UpdateCreditsBalance();
                }

                if (userData.user.HomeRoom > 0)
                {
                    GetMessageHandler().GetResponse().Init(455);
                    GetMessageHandler().GetResponse().AppendUInt(userData.user.HomeRoom);
                    GetMessageHandler().SendResponse();
                }

                GetMessageHandler().GetResponse().Init(458);
                GetMessageHandler().GetResponse().AppendInt32(30);
                GetMessageHandler().GetResponse().AppendInt32(userData.user.FavoriteRooms.Count);

                foreach (uint Id in userData.user.FavoriteRooms.ToArray())
                {
                    GetMessageHandler().GetResponse().AppendUInt(Id);
                }

                GetMessageHandler().SendResponse();

                if (!userData.user.GetBadgeComponent().HasBadge("ACH_BasicClub1"))
                {
                    userData.user.GetBadgeComponent().GiveBadge("ACH_BasicClub1", true);
                }
                else if (userData.user.GetBadgeComponent().HasBadge("ACH_BasicClub1"))
                {
                    userData.user.GetBadgeComponent().RemoveBadge("ACH_BasicClub1");
                }

                if (!userData.user.GetBadgeComponent().HasBadge("Z63"))
                    userData.user.GetBadgeComponent().GiveBadge("Z63", true);

                if (userData.user.Rank > 5 && !userData.user.GetBadgeComponent().HasBadge("ADM"))
                    userData.user.GetBadgeComponent().GiveBadge("ADM", true);

                ServerMessage alert = new ServerMessage(810);
                alert.AppendUInt(1);
                alert.AppendStringWithBreak(LanguageLocale.welcomeAlert);
                SendMessage(alert);
                Logging.WriteLine("[" + Habbo.Username + "] logged in");

                return true;
            }
            catch (UserDataNotFoundException e)
            {
                SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso") + "extra data: " + e.ToString());
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Invalid Dario bug duing user login: "******"Login error: " + e.ToString());
                SendNotifWithScroll("Login error: " + e.ToString());
            }
            return false;
        }
Esempio n. 3
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;
        }
Esempio n. 4
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;
 }