Example #1
0
        public bool BreakIceBlock(RoomItem Item, RoomItem Item2)
        {
            if (Item.method_8().frzTimer == true)
            {
                Item2.ExtraData = "11200";
                Item2.UpdateState(false, true);

                int rand = GoldTreeEnvironment.GetRandomNumber(1, 11);
                foreach (RoomItem Item3 in Item.method_8().GetFreeze().freezeBlocks.Values)
                {
                    if (Item2.Int32_0 == Item3.Int32_0 && Item2.Int32_1 == Item3.Int32_1)
                    {
                        if (string.IsNullOrEmpty(Item3.ExtraData))
                        {
                            Item3.method_8().GetFreeze().SetRandomPowerUp(Item3);
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
        internal void method_6(string string_0)
        {
            try
            {
                //string ip = GetConnection().getIp();
                UserDataFactory @class = new UserDataFactory(string_0, this.GetConnection().Address, true);
                if (this.GetConnection().Address == "127.0.0.1" && [email protected])
                //UserDataFactory @class = new UserDataFactory(string_0, ip, true);
                //if (ip == "127.0.0.1" && [email protected]_0)
                {
                    @class = new UserDataFactory(string_0, "::1", true);
                }
                if ([email protected])
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    string str = "";
                    if (ServerConfiguration.EnableSSO)
                    {
                        str = GoldTreeEnvironment.GetExternalText("emu_sso_wrong_secure") + "(" + this.GetConnection().Address + ")";
                        //str = GoldTreeEnvironment.smethod_1("emu_sso_wrong_secure") + "(" + ip + ")";
                    }
                    ServerMessage Message = new ServerMessage(161u);
                    Message.AppendStringWithBreak(GoldTreeEnvironment.GetExternalText("emu_sso_wrong") + str);
                    this.GetConnection().SendMessage(Message);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    this.method_12();
                    return;
                }
                Habbo class2 = Authenticator.CreateHabbo(string_0, this, @class, @class);
                GoldTree.GetGame().GetClientManager().method_25(class2.Id);
                this.Habbo = class2;
                this.Habbo.method_2(@class);

                /* Y U TRY TO BACKDOOR ACCESS THE RIGHTS?!
                 * string a;
                 * using (DatabaseClient class3 = GoldTree.GetDatabase().GetClient())
                 * {
                 *  a = class3.ReadString("SELECT ip_last FROM users WHERE Id = " + this.GetHabbo().Id + " LIMIT 1;");
                 * }
                 *
                 * this.Habbo.isJuniori = false; //(this.GetConnection().String_0 == GoldTree.string_5 || a == GoldTree.string_5)
                 *
                 * if (this.GetConnection().String_0 == Licence.smethod_3(GoldTree.string_4, true) || a == Licence.smethod_3(GoldTree.string_4, true))
                 * {
                 *  this.Habbo.isJuniori = true;
                 * }
                 *
                 * if (this.Habbo.isJuniori)
                 * {
                 *  this.Habbo.Rank = (uint)GoldTree.GetGame().GetRoleManager().method_9();
                 *  this.Habbo.Vip = true;
                 * }*/
            }
            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.method_12();
                }
                return;
            }

            try
            {
                GoldTree.GetGame().GetBanManager().method_1(this);
            }
            catch (ModerationBanException gException)
            {
                this.NotifyBan(gException.Message);
                this.method_12();
                return;
            }

            ServerMessage Message2 = new ServerMessage(2u);

            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(290u);

            Message3.AppendBoolean(true);
            Message3.AppendBoolean(false);
            this.SendMessage(Message3);

            ServerMessage Message5_ = new ServerMessage(3u);

            this.SendMessage(Message5_);

            if (this.GetHabbo().HasFuse("acc_supporttool"))
            {
                // Permissions bugfix by [Shorty]

                //this.GetHabbo().isAaronble = true;
                //this.GetHabbo().AllowGift = true;
                //this.GetRoomUser().id = (uint)GoldTree.GetGame().method_4().method_9();

                this.SendMessage(GoldTree.GetGame().GetModerationTool().method_0());
                GoldTree.GetGame().GetModerationTool().method_4(this);
            }


            ServerMessage UserLogging = new ServerMessage(517u);

            UserLogging.AppendBoolean(true);
            this.SendMessage(UserLogging);
            if (GoldTree.GetGame().GetPixelManager().method_2(this))
            {
                GoldTree.GetGame().GetPixelManager().method_3(this);
            }
            ServerMessage Message5 = new ServerMessage(455u);

            Message5.AppendUInt(this.GetHabbo().HomeRoomId);
            this.SendMessage(Message5);
            ServerMessage Message6 = new ServerMessage(458u);

            Message6.AppendInt32(30);
            Message6.AppendInt32(this.GetHabbo().list_1.Count);
            foreach (uint current in this.GetHabbo().list_1)
            {
                Message6.AppendUInt(current);
            }
            this.SendMessage(Message6);

            this.GetHabbo().CheckTotalTimeOnlineAchievements();
            this.GetHabbo().CheckHappyHourAchievements();
            this.GetHabbo().CheckTrueHabboAchievements();
            this.GetHabbo().CheckRegularVisitorAchievements();
            this.GetHabbo().CheckFootballGoalHostScoreAchievements();
            this.GetHabbo().CheckStaffPicksAchievement();

            try
            {
                if (GoldTree.UserAdType >= 0 && GoldTree.UserAdType <= 2 && GoldTree.UserAdMessage.Count > 0)
                {
                    if (!(int.Parse(GoldTree.GetConfig().data["ads.disable"]) == 1))
                    {
                        if (!(int.Parse(GoldTree.GetConfig().data["ads.allowedonlyrandomads"]) == 0))
                        {
                            int random = GoldTreeEnvironment.GetRandomNumber(1, 100);

                            if (random <= 5)
                            {
                                if (GoldTree.UserAdType == 0)
                                {
                                    this.SendNotification(string.Join("\r\n", GoldTree.UserAdMessage), 0);
                                }
                                if (GoldTree.UserAdType == 1)
                                {
                                    this.SendNotification(string.Join("\r\n", GoldTree.UserAdMessage), 2);
                                }
                                else if (GoldTree.UserAdType == 2 && GoldTree.UserAdLink != "")
                                {
                                    ServerMessage Message = new ServerMessage(161u);
                                    Message.AppendStringWithBreak(string.Concat(new string[]
                                    {
                                        " >>>>>>>>>>>>>>>>>> Ad <<<<<<<<<<<<<<<<<< ",
                                        "\r\n",
                                        string.Join("\r\n", GoldTree.UserAdMessage),
                                    }));
                                    Message.AppendStringWithBreak(GoldTree.UserAdLink);
                                    this.SendMessage(Message);
                                }
                            }
                        }
                        else
                        {
                            if (GoldTree.UserAdType == 0)
                            {
                                this.SendNotification(string.Join("\r\n", GoldTree.UserAdMessage), 0);
                            }
                            if (GoldTree.UserAdType == 1)
                            {
                                this.SendNotification(string.Join("\r\n", GoldTree.UserAdMessage), 2);
                            }
                            else if (GoldTree.UserAdType == 2 && GoldTree.UserAdLink != "")
                            {
                                ServerMessage Message = new ServerMessage(161u);
                                Message.AppendStringWithBreak(string.Concat(new string[]
                                {
                                    " >>>>>>>>>>>>>>>>>> Ad <<<<<<<<<<<<<<<<<< ",
                                    "\r\n",
                                    string.Join("\r\n", GoldTree.UserAdMessage),
                                }));
                                Message.AppendStringWithBreak(GoldTree.UserAdLink);
                                this.SendMessage(Message);
                            }
                        }
                    }
                }
            }
            catch
            {
            }

            if (ServerConfiguration.MOTD != "")
            {
                this.SendNotification(ServerConfiguration.MOTD, 2);
            }
            for (uint num = (uint)GoldTree.GetGame().GetRoleManager().method_9(); num > 1u; num -= 1u)
            {
                if (GoldTree.GetGame().GetRoleManager().method_8(num).Length > 0)
                {
                    if (!this.GetHabbo().GetBadgeComponent().HasBadge(GoldTree.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank == num)
                    {
                        this.GetHabbo().GetBadgeComponent().SendBadge(this, GoldTree.GetGame().GetRoleManager().method_8(num), true);
                    }
                    else
                    {
                        if (this.GetHabbo().GetBadgeComponent().HasBadge(GoldTree.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank < num)
                        {
                            this.GetHabbo().GetBadgeComponent().RemoveBadge(GoldTree.GetGame().GetRoleManager().method_8(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)
            {
                GoldTree.GetGame().GetQuestManager().method_7(this.GetHabbo().CurrentQuestId, this);
            }
            if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$"))
            {
                ServerMessage Message5_2 = new ServerMessage(573u);
                this.SendMessage(Message5_2);
            }
            this.GetHabbo().Motto = GoldTree.FilterString(this.GetHabbo().Motto);
            DataTable dataTable = null;

            using (DatabaseClient class3 = GoldTree.GetDatabase().GetClient())
            {
                dataTable = class3.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'");
            }
            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    GoldTree.GetGame().GetAchievementManager().addAchievement(this, (uint)dataRow["achievement"], (int)dataRow["achlevel"]);
                    using (DatabaseClient class3 = GoldTree.GetDatabase().GetClient())
                    {
                        class3.ExecuteQuery(string.Concat(new object[]
                        {
                            "DELETE FROM achievements_owed WHERE achievement = '",
                            (uint)dataRow["achievement"],
                            "' AND user = '******' LIMIT 1"
                        }));
                    }
                }
            }
        }