Esempio n. 1
0
 public Game(int conns)
 {
     this.ClientManager = new GameClientManager(conns);
     if (GoldTree.GetConfig().data["client.ping.enabled"] == "1")
     {
         this.ClientManager.method_10();
     }
     DateTime arg_45_0 = DateTime.Now;
     Logging.smethod_0("Connecting to database...");
     using (DatabaseClient adapter = GoldTree.GetDatabase().GetClient())
     {
         Logging.WriteLine("completed!");
         GoldTree.Class3_0 = this;
         this.method_17(adapter);
         this.BanManager = new ModerationBanManager();
         this.RoleManager = new RoleManager();
         this.HelpTool = new HelpTool();
         this.Catalog = new Catalog();
         this.Navigator = new Navigator();
         this.ItemManager = new ItemManager();
         this.RoomManager = new RoomManager();
         this.AdvertisementManager = new AdvertisementManager();
         this.PixelManager = new PixelManager();
         this.AchievementManager = new AchievementManager();
         this.ModerationTool = new ModerationTool();
         this.BotManager = new BotManager();
         this.Marketplace = new Marketplace();
         this.QuestManager = new QuestManager();
         this.class8_0 = new GoldTreeEnvironment();
         this.Groups = new Groups();
         GoldTreeEnvironment.smethod_0(adapter);
         this.BanManager.method_0(adapter);
         LicenseTools.String_5 = "FB3A78763D7819F39D79781F6F8DFCCD";
         this.RoleManager.method_0(adapter);
         this.HelpTool.method_0(adapter);
         this.HelpTool.method_3(adapter);
         this.ModerationTool.method_1(adapter);
         this.ModerationTool.method_2(adapter);
         LicenseTools.String_5 = "B8AC48FA7DB791129E59CBA4BC2CC5DD";
         this.ItemManager.method_0(adapter);
         LicenseTools.String_5 = "7866151A40EEB2379D61F640B26ED23B";
         this.Catalog.method_0(adapter);
         this.Catalog.method_1();
         this.Navigator.method_0(adapter);
         LicenseTools.String_5 = LicenseTools.String_6;
         this.RoomManager.method_8(adapter);
         this.RoomManager.method_0();
         this.class276_0 = new NavigatorCache();
         this.AdvertisementManager.method_0(adapter);
         this.BotManager.method_0(adapter);
         LicenseTools.String_5 = LicenseTools.String_3;
         LicenseTools.String_5 = LicenseTools.String_6.Length.ToString();
         AchievementManager.smethod_0(adapter);
         this.PixelManager.method_0();
         ChatCommandHandler.smethod_0(adapter);
         LicenseTools.String_5 = LicenseTools.String_3.Length.ToString();
         this.QuestManager.method_0();
         Groups.smethod_0(adapter);
         this.method_0(adapter, 1);
     }
     this.task_0 = new Task(new Action(LowPriorityWorker.smethod_0));
     this.task_0.Start();
 }
Esempio n. 2
0
        public void addAchievement(GameClient Session, uint uint_0, int int_0)
        {
            if (!AchievementManager.dictionary_0.ContainsKey(uint_0))
            {
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("AchievementID: " + uint_0 + " does not exist in our database!");
                Console.ForegroundColor = ConsoleColor.White;
            }
            else
            {
                Achievement @class = AchievementManager.dictionary_0[uint_0];
                if (@class != null && !this.method_1(Session, @class.Id, int_0) && int_0 >= 1 && int_0 <= @class.Levels)
                {
                    int num  = AchievementManager.smethod_2(@class.Dynamic_badgelevel, @class.PixelMultiplier, int_0);
                    int num2 = AchievementManager.smethod_2(@class.ScoreBase, @class.PixelMultiplier, int_0);
                    using (TimedLock.Lock(Session.GetHabbo().method_22().List_0))
                    {
                        List <string> list = new List <string>();
                        foreach (Badge current in Session.GetHabbo().method_22().List_0)
                        {
                            if (current.Code.StartsWith(@class.BadgeCode))
                            {
                                list.Add(current.Code);
                            }
                        }
                        foreach (string current2 in list)
                        {
                            Session.GetHabbo().method_22().method_6(current2);
                        }
                    }
                    Session.GetHabbo().method_22().method_2(Session, AchievementManager.smethod_3(@class.BadgeCode, int_0, @class.DynamicBadgeLevel), true);
                    if (Session.GetHabbo().dictionary_0.ContainsKey(@class.Id))
                    {
                        Session.GetHabbo().dictionary_0[@class.Id] = int_0;
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            class2.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE user_achievements SET achievement_level = '",
                                int_0,
                                "' WHERE user_id = '",
                                Session.GetHabbo().Id,
                                "' AND achievement_id = '",
                                @class.Id,
                                "' LIMIT 1; UPDATE user_stats SET AchievementScore = AchievementScore + ",
                                num2,
                                " WHERE Id = '",
                                Session.GetHabbo().Id,
                                "' LIMIT 1; "
                            }));
                            goto IL_346;
                        }
                    }
                    Session.GetHabbo().dictionary_0.Add(@class.Id, int_0);
                    using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                    {
                        class2.ExecuteQuery(string.Concat(new object[]
                        {
                            "INSERT INTO user_achievements (user_id,achievement_id,achievement_level) VALUES ('",
                            Session.GetHabbo().Id,
                            "','",
                            @class.Id,
                            "','",
                            int_0,
                            "'); UPDATE user_stats SET AchievementScore = AchievementScore + ",
                            num2,
                            " WHERE Id = '",
                            Session.GetHabbo().Id,
                            "' LIMIT 1; "
                        }));
                    }
IL_346:
                    ServerMessage Message = new ServerMessage(437u);
                    Message.AppendUInt(@class.Id);
                    Message.AppendInt32(int_0);
                    Message.AppendInt32(1337);
                    Message.AppendStringWithBreak(AchievementManager.smethod_3(@class.BadgeCode, int_0, @class.DynamicBadgeLevel));
                    Message.AppendInt32(num2);
                    Message.AppendInt32(num);
                    Message.AppendInt32(0);
                    Message.AppendInt32(0);
                    Message.AppendInt32(0);
                    if (int_0 > 1)
                    {
                        Message.AppendStringWithBreak(AchievementManager.smethod_3(@class.BadgeCode, int_0 - 1, @class.DynamicBadgeLevel));
                    }
                    else
                    {
                        Message.AppendStringWithBreak("");
                    }
                    Message.AppendStringWithBreak(@class.Type);
                    Session.SendMessage(Message);
                    Session.GetHabbo().AchievementScore += num2;
                    Session.GetHabbo().ActivityPoints   += num;
                    Session.GetHabbo().method_16(num);
                }
            }
        }
        public void addAchievement(GameClient Session, uint uint_0, int int_0)
        {
            if (!AchievementManager.dictionary_0.ContainsKey(uint_0))
            {
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("AchievementID: " + uint_0 + " does not exist in our database!");
                Console.ForegroundColor = ConsoleColor.White;
            }
            else
            {
                Achievement @class = AchievementManager.dictionary_0[uint_0];
                if (@class != null && !this.method_1(Session, @class.Id, int_0) && int_0 >= 1 && int_0 <= @class.Levels)
                {
                    int num  = AchievementManager.smethod_2(@class.Dynamic_badgelevel, @class.PixelMultiplier, int_0);
                    int num2 = AchievementManager.smethod_2(@class.ScoreBase, @class.PixelMultiplier, int_0);
                    using (TimedLock.Lock(Session.GetHabbo().GetBadgeComponent().GetBadges()))
                    {
                        List <string> list = new List <string>();
                        foreach (Badge current in Session.GetHabbo().GetBadgeComponent().GetBadges())
                        {
                            if (current.Code.StartsWith(@class.BadgeCode))
                            {
                                list.Add(current.Code);
                            }
                        }
                        foreach (string current2 in list)
                        {
                            Session.GetHabbo().GetBadgeComponent().RemoveBadge(current2);
                        }
                    }
                    Session.GetHabbo().GetBadgeComponent().SendBadge(Session, AchievementManager.smethod_3(@class.BadgeCode, int_0, @class.DynamicBadgeLevel), true);
                    if (Session.GetHabbo().dictionary_0.ContainsKey(@class.Id))
                    {
                        Session.GetHabbo().dictionary_0[@class.Id] = int_0;
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            class2.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE user_achievements SET achievement_level = '",
                                int_0,
                                "' WHERE user_id = '",
                                Session.GetHabbo().Id,
                                "' AND achievement_id = '",
                                @class.Id,
                                "' LIMIT 1; UPDATE user_stats SET AchievementScore = AchievementScore + ",
                                num2,
                                " WHERE Id = '",
                                Session.GetHabbo().Id,
                                "' LIMIT 1; "
                            }));
                            goto IL_346;
                        }
                    }
                    Session.GetHabbo().dictionary_0.Add(@class.Id, int_0);
                    using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                    {
                        class2.ExecuteQuery(string.Concat(new object[]
                        {
                            "INSERT INTO user_achievements (user_id,achievement_id,achievement_level) VALUES ('",
                            Session.GetHabbo().Id,
                            "','",
                            @class.Id,
                            "','",
                            int_0,
                            "'); UPDATE user_stats SET AchievementScore = AchievementScore + ",
                            num2,
                            " WHERE Id = '",
                            Session.GetHabbo().Id,
                            "' LIMIT 1; "
                        }));
                    }
IL_346:
                    ServerMessage Message = new ServerMessage(437u);
                    Message.AppendUInt(@class.Id);
                    Message.AppendInt32(int_0);
                    Message.AppendInt32(1337);
                    Message.AppendStringWithBreak(AchievementManager.smethod_3(@class.BadgeCode, int_0, @class.DynamicBadgeLevel));
                    Message.AppendInt32(num2);
                    Message.AppendInt32(num);
                    Message.AppendInt32(0);
                    Message.AppendInt32(0);
                    Message.AppendInt32(0);
                    if (int_0 > 1)
                    {
                        Message.AppendStringWithBreak(AchievementManager.smethod_3(@class.BadgeCode, int_0 - 1, @class.DynamicBadgeLevel));
                    }
                    else
                    {
                        Message.AppendStringWithBreak("");
                    }
                    Message.AppendStringWithBreak(@class.Type);
                    Session.SendMessage(Message);
                    Session.GetHabbo().AchievementScore += num2;
                    Session.GetHabbo().ActivityPoints   += num;
                    Session.GetHabbo().method_16(num);

                    if (Session.GetHabbo().FriendStreamEnabled)
                    {
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            string BadgeCode = "";
                            if (@class.DynamicBadgeLevel)
                            {
                                BadgeCode = @class.BadgeCode + int_0.ToString();
                            }
                            else
                            {
                                BadgeCode = @class.BadgeCode;
                            }

                            if (!string.IsNullOrEmpty(BadgeCode))
                            {
                                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, '2', '" + Session.GetHabbo().Id + "', '" + Session.GetHabbo().Gender + "', @look, UNIX_TIMESTAMP(), '" + BadgeCode + "');");
                            }
                        }
                    }
                }
            }
        }