Example #1
0
		public TeleUserData(GameClientMessageHandler pHandler, Habbo pUserRefference, uint RoomId, uint TeleId)
		{
			this.class17_0 = pHandler;
			this.class11_0 = pUserRefference;
			this.uint_0 = RoomId;
			this.uint_1 = TeleId;
		}
Example #2
0
 public void Stop()
 {
     if (this.Connection != null)
     {
         this.Connection.Dispose();
         this.Connection = null;
     }
     if (this.GetHabbo() != null)
     {
         this.Habbo.OnDisconnect();
         this.Habbo = null;
     }
     if (this.GetMessageHandler() != null)
     {
         this.MessageHandler.Destroy();
         this.MessageHandler = null;
     }
 }
Example #3
0
        internal void Login(string AuthTicket)
        {
            try
            {
                HabboData pData = new HabboData(AuthTicket, this.GetConnection().ipAddress, true);
                if (this.GetConnection().ipAddress == "127.0.0.1" && !pData.UserFound)
                {
                    pData = new HabboData(AuthTicket, "::1", true);
                }
                if (!pData.UserFound)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    string str = "";
                    if (GlobalClass.SecureSessions)
                    {
                        str = TextManager.GetText("emu_sso_wrong_secure") + "(" + this.GetConnection().ipAddress + ")";
                    }
                    ServerMessage Message = new ServerMessage(161);
                    Message.AppendStringWithBreak(TextManager.GetText("emu_sso_wrong") + str);
                    this.GetConnection().SendMessage(Message);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    this.Disconnect();
                    return;
                }
                Habbo habbo = Authenticator.TryLoginHabbo(AuthTicket, this, pData, pData);
                PhoenixEnvironment.GetGame().GetClientManager().LogClonesOut(habbo.Id);
                this.Habbo = habbo;
                this.Habbo.LoadData(pData);
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    adapter.ReadString("SELECT ip_last FROM users WHERE Id = " + GetHabbo().Id + " LIMIT 1;");
                }
                this.Habbo.isAaron = false;
                if (Habbo.isAaron)
                {
                    Habbo.Rank = (uint)PhoenixEnvironment.GetGame().GetRoleManager().RankCount();
                    Habbo.Vip = true;
                }
            }
            catch (Exception ex)
            {
                this.SendNotif("Login error: " + ex.Message);
                this.Disconnect();
                return;
            }
            try
            {
                PhoenixEnvironment.GetGame().GetBanManager().CheckForBanConflicts(this);
            }
            catch (ModerationBanException gException)
            {
                this.SendBanMessage(gException.Message);
                this.Disconnect();
                return;
            }
            ServerMessage Message2 = new ServerMessage(2);
            if (this.GetHabbo().Vip || GlobalClass.VIPclothesforHCusers)
            {
                Message2.AppendInt32(2);
            }
            else if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                Message2.AppendInt32(1);
            }
            else
            {
                Message2.AppendInt32(0);
            }
            if (this.GetHabbo().HasRole("acc_anyroomowner"))
            {
                Message2.AppendInt32(7);
            }
            else if (this.GetHabbo().HasRole("acc_anyroomrights"))
            {
                Message2.AppendInt32(5);
            }
            else if (this.GetHabbo().HasRole("acc_supporttool"))
            {
                Message2.AppendInt32(4);
            }
            else if (this.GetHabbo().Vip || GlobalClass.VIPclothesforHCusers || this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                Message2.AppendInt32(2);
            }
            else
            {
                Message2.AppendInt32(0);
            }
            this.SendMessage(Message2);

            this.SendMessage(this.GetHabbo().GetAvatarEffectsInventoryComponent().Serialize());

            ServerMessage Message3 = new ServerMessage(290);
            Message3.AppendBoolean(true);
            Message3.AppendBoolean(false);
            this.SendMessage(Message3);

            ServerMessage message4 = new ServerMessage(3);
            this.SendMessage(message4);

            if (this.GetHabbo().HasRole("acc_supporttool"))
            {
                this.SendMessage(PhoenixEnvironment.GetGame().GetModerationTool().SerializeTool());
                PhoenixEnvironment.GetGame().GetModerationTool().SendOpenTickets(this);
            }

            ServerMessage Logging = new ServerMessage(517);
            Logging.AppendBoolean(true);
            this.SendMessage(Logging);
            if (PhoenixEnvironment.GetGame().GetPixelManager().NeedsUpdate(this))
            {
                PhoenixEnvironment.GetGame().GetPixelManager().GivePixels(this);
            }
            ServerMessage Message5 = new ServerMessage(455);
            Message5.AppendUInt(this.GetHabbo().HomeRoom);
            this.SendMessage(Message5);
            ServerMessage Message6 = new ServerMessage(458);
            Message6.AppendInt32(30);
            Message6.AppendInt32(this.GetHabbo().FavoriteRooms.Count);
            foreach (uint current in this.GetHabbo().FavoriteRooms)
            {
                Message6.AppendUInt(current);
            }
            this.SendMessage(Message6);
            if (this.GetHabbo().Stat_OnlineTime > 8294400)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 10);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 4147200)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 9);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 2073600)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 8);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 1036800)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 7);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 518400)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 6);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 172800)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 5);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 57600)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 4);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 28800)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 3);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 10800)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 2);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 3600)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 1);
            }
            if (GlobalClass.Motd != "")
            {
                this.SendNotif(GlobalClass.Motd, 2);
            }
            for (uint i = (uint)PhoenixEnvironment.GetGame().GetRoleManager().RankCount(); i > 1; i -= 1)
            {
                if (PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i).Length > 0)
                {
                    if (!GetHabbo().GetBadgeComponent().HasBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i)) && GetHabbo().Rank == i)
                    {
                        GetHabbo().GetBadgeComponent().GiveBadge(this, PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i), true);
                    }
                    else if (GetHabbo().GetBadgeComponent().HasBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i)) && GetHabbo().Rank < i)
                    {
                        GetHabbo().GetBadgeComponent().RemoveBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i));
                    }
                }
            }
            if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && !GetHabbo().GetBadgeComponent().HasBadge("HC1"))
            {
                GetHabbo().GetBadgeComponent().GiveBadge(this, "HC1", true);
            }
            else
            {
                if (!GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && GetHabbo().GetBadgeComponent().HasBadge("HC1"))
                {
                    GetHabbo().GetBadgeComponent().RemoveBadge("HC1");
                }
            }
            if (GetHabbo().Vip && !GetHabbo().GetBadgeComponent().HasBadge("VIP"))
            {
                this.GetHabbo().GetBadgeComponent().GiveBadge(this, "VIP", true);
            }
            else
            {
                if (!GetHabbo().Vip && GetHabbo().GetBadgeComponent().HasBadge("VIP"))
                {
                    GetHabbo().GetBadgeComponent().RemoveBadge("VIP");
                }
            }
            if (GetHabbo().CurrentQuestId > 0)
            {
                PhoenixEnvironment.GetGame().GetQuestManager().HandleQuest(GetHabbo().CurrentQuestId, this);
            }
            if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$"))
            {
                ServerMessage message8 = new ServerMessage(573);
                this.SendMessage(message8);
            }
            this.GetHabbo().Motto = PhoenixEnvironment.FilterInjectionChars(this.GetHabbo().Motto);
            DataTable table = null;
            using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
            {
                table = adapter.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'");
            }
            if (table != null)
            {
                foreach (DataRow row in table.Rows)
                {
                    PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, (uint)row["achievement"], (int)row["achlevel"]);
                    using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                    {
                        adapter.ExecuteQuery(string.Concat(new object[]
						{
							"DELETE FROM achievements_owed WHERE achievement = '",
							(uint)row["achievement"],
							"' AND user = '******' LIMIT 1"
						}));
                    }
                }
            }
        }