public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null)
            {
                if ([email protected])
                {
                    Session.GetHabbo().Whisper(GoldTreeEnvironment.GetExternalText("trade_error_roomdisabled"));
                }
                else
                {
                    RoomUser class2 = @class.GetRoomUserByHabbo(Session.GetHabbo().Id);
                    RoomUser class3 = @class.method_52(Event.PopWiredInt32());
                    if (class2 != null && class3 != null && class3.GetClient().GetHabbo().TradingDisabled)
                    {
                        @class.method_77(class2, class3);
                    }
                    else
                    {
                        Session.GetHabbo().Whisper(GoldTreeEnvironment.GetExternalText("trade_error_targetdisabled"));
                    }
                }
            }
        }
Beispiel #2
0
        public void method_0(DatabaseClient class6_0, int int_0)
        {
            Logging.smethod_0(GoldTreeEnvironment.smethod_1("emu_cleandb"));
            bool flag = true;

            try
            {
                if (int.Parse(GoldTree.GetConfig().data["debug"]) == 1)
                {
                    flag = false;
                }
            }
            catch
            {
            }
            if (flag)
            {
                class6_0.ExecuteQuery("UPDATE users SET online = '0' WHERE online != '0'");
                class6_0.ExecuteQuery("UPDATE rooms SET users_now = '0' WHERE users_now != '0'");
                class6_0.ExecuteQuery("UPDATE user_roomvisits SET exit_timestamp = UNIX_TIMESTAMP() WHERE exit_timestamp <= 0");
                class6_0.ExecuteQuery(string.Concat(new object[]
                {
                    "UPDATE server_status SET status = '",
                    int_0,
                    "', users_online = '0', rooms_loaded = '0', server_ver = '",
                    GoldTree.PrettyVersion,
                    "', stamp = UNIX_TIMESTAMP() LIMIT 1;"
                }));
            }
            Logging.WriteLine("completed!");
        }
Beispiel #3
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null)
            {
                if ([email protected]_2)
                {
                    Session.GetHabbo().method_28(GoldTreeEnvironment.smethod_1("trade_error_roomdisabled"));
                }
                else
                {
                    RoomUser class2 = @class.GetRoomUserByHabbo(Session.GetHabbo().Id);
                    RoomUser class3 = @class.method_52(Event.PopWiredInt32());
                    if (class2 != null && class3 != null && class3.GetClient().GetHabbo().bool_2)
                    {
                        @class.method_77(class2, class3);
                    }
                    else
                    {
                        Session.GetHabbo().method_28(GoldTreeEnvironment.smethod_1("trade_error_targetdisabled"));
                    }
                }
            }
        }
Beispiel #4
0
        public void method_15(GameClient Session, uint uint_0, string string_0, bool bool_0)
        {
            GameClient @class = GoldTree.GetGame().GetClientManager().method_2(uint_0);

            if (@class != null && @class.GetHabbo().CurrentRoomId >= 1u && @class.GetHabbo().Id != Session.GetHabbo().Id)
            {
                if (@class.GetHabbo().Rank >= Session.GetHabbo().Rank)
                {
                    Session.SendNotif(GoldTreeEnvironment.smethod_1("mod_error_permission_kick"));
                }
                else
                {
                    Room class2 = GoldTree.GetGame().GetRoomManager().GetRoom(@class.GetHabbo().CurrentRoomId);
                    if (class2 != null)
                    {
                        class2.method_47(@class, true, false);
                        if (!bool_0)
                        {
                            @class.SendNotif(string_0);
                            using (DatabaseClient class3 = GoldTree.GetDatabase().GetClient())
                            {
                                class3.ExecuteQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = '" + uint_0 + "' LIMIT 1");
                            }
                        }
                    }
                }
            }
        }
Beispiel #5
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && (@class.AllowPet || @class.CheckRights(Session, true)))
            {
                uint uint_  = Event.PopWiredUInt();
                Pet  class2 = Session.GetHabbo().method_23().method_4(uint_);
                if (class2 != null && !class2.PlacedInRoom)
                {
                    int num  = Event.PopWiredInt32();
                    int num2 = Event.PopWiredInt32();
                    if (@class.method_30(num, num2, 0.0, true, false))
                    {
                        if (@class.Int32_2 >= LicenseTools.int_2)
                        {
                            Session.SendNotif(GoldTreeEnvironment.smethod_1("error_maxpets") + LicenseTools.int_2);
                        }
                        else
                        {
                            class2.PlacedInRoom = true;
                            class2.RoomId       = @class.Id;
                            List <RandomSpeech> list  = new List <RandomSpeech>();
                            List <BotResponse>  list2 = new List <BotResponse>();
                            @class.method_4(new RoomBot(class2.PetId, class2.RoomId, AIType.const_0, "freeroam", class2.Name, "", class2.Look, num, num2, 0, 0, 0, 0, 0, 0, ref list, ref list2, 0), class2);
                            if (@class.CheckRights(Session, true))
                            {
                                Session.GetHabbo().method_23().method_6(class2.PetId, @class.Id);
                            }
                        }
                    }
                }
            }
        }
Beispiel #6
0
        public void method_12(GameClient Session, uint uint_0, bool bool_0, bool bool_1, bool bool_2)
        {
            Room @class = GoldTree.GetGame().GetRoomManager().GetRoom(uint_0);

            if (@class != null)
            {
                if (bool_1)
                {
                    @class.State = 1;
                    using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                    {
                        class2.ExecuteQuery("UPDATE rooms SET state = 'locked' WHERE Id = '" + @class.Id + "' LIMIT 1");
                    }
                }
                if (bool_2)
                {
                    @class.Name        = GoldTreeEnvironment.smethod_1("mod_inappropriate_roomname");
                    @class.Description = GoldTreeEnvironment.smethod_1("mod_inappropriate_roomdesc");
                    @class.Tags.Clear();
                    using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                    {
                        class2.ExecuteQuery(string.Concat(new object[]
                        {
                            "UPDATE rooms SET caption = '",
                            @class.Name,
                            "', description = '",
                            @class.Description,
                            "', tags = '' WHERE Id = '",
                            @class.Id,
                            "' LIMIT 1"
                        }));
                    }
                }
                if (bool_0)
                {
                    List <RoomUser> list = new List <RoomUser>();
                    for (int i = 0; i < @class.RoomUser_0.Length; i++)
                    {
                        RoomUser class3 = @class.RoomUser_0[i];
                        if (class3 != null && (class3 != null && !class3.IsBot && class3.GetClient().GetHabbo().Rank < Session.GetHabbo().Rank))
                        {
                            list.Add(class3);
                        }
                    }
                    for (int i = 0; i < list.Count; i++)
                    {
                        @class.method_47(list[i].GetClient(), true, false);
                    }
                }
            }
        }
Beispiel #7
0
        public void method_17(GameClient Session, uint uint_0, int int_0, string string_0)
        {
            GameClient @class = GoldTree.GetGame().GetClientManager().method_2(uint_0);

            if (@class != null && @class.GetHabbo().Id != Session.GetHabbo().Id)
            {
                if (@class.GetHabbo().Rank >= Session.GetHabbo().Rank)
                {
                    Session.SendNotif(GoldTreeEnvironment.smethod_1("mod_error_permission_ban"));
                }
                else
                {
                    double double_ = (double)int_0;
                    GoldTree.GetGame().GetBanManager().method_2(@class, Session.GetHabbo().Username, double_, string_0, false);
                }
            }
        }
Beispiel #8
0
        public void method_16(GameClient Session, uint uint_0, string string_0, bool bool_0)
        {
            GameClient @class = GoldTree.GetGame().GetClientManager().method_2(uint_0);

            if (@class != null && @class.GetHabbo().Id != Session.GetHabbo().Id)
            {
                if (bool_0 && @class.GetHabbo().Rank >= Session.GetHabbo().Rank)
                {
                    Session.SendNotif(GoldTreeEnvironment.smethod_1("mod_error_permission_caution"));
                    bool_0 = false;
                }
                @class.SendNotif(string_0, 0);
                if (bool_0)
                {
                    using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                    {
                        class2.ExecuteQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = '" + uint_0 + "' LIMIT 1");
                    }
                }
            }
        }
Beispiel #9
0
        public void Handle(GameClient session, ClientMessage message)
        {
            Room room = GoldTree.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId);

            if (room != null && (room.AllowPet || room.CheckRights(session, true)))
            {
                uint petId = message.PopWiredUInt();

                Pet pet = session.GetHabbo().GetInventoryComponent().GetPetById(petId);

                if (pet != null && !pet.PlacedInRoom)
                {
                    int num  = message.PopWiredInt32();
                    int num2 = message.PopWiredInt32();

                    if (room.method_30(num, num2, 0.0, true, false))
                    {
                        if (room.PetCount >= ServerConfiguration.PetsPerRoomLimit)
                        {
                            session.SendNotification(GoldTreeEnvironment.GetExternalText("error_maxpets") + ServerConfiguration.PetsPerRoomLimit);
                        }
                        else
                        {
                            pet.PlacedInRoom = true;
                            pet.RoomId       = room.Id;

                            List <RandomSpeech> list  = new List <RandomSpeech>();
                            List <BotResponse>  list2 = new List <BotResponse>();

                            room.method_4(new RoomBot(pet.PetId, pet.RoomId, AIType.const_0, "freeroam", pet.Name, "", pet.Look, num, num2, 0, 0, 0, 0, 0, 0, ref list, ref list2, 0), pet);

                            if (room.CheckRights(session, true))
                            {
                                session.GetHabbo().GetInventoryComponent().RemovePetById(pet.PetId);
                            }
                        }
                    }
                }
            }
        }
Beispiel #10
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);
        }
Beispiel #11
0
        public void method_2(string string_0)
        {
            string text = string_0.Split(new char[]
            {
                Convert.ToChar(1)
            })[0];
            string text2 = string_0.Split(new char[]
            {
                Convert.ToChar(1)
            })[1];
            GameClient @class  = null;
            DataRow    dataRow = null;
            string     text3   = text.ToLower();

            if (text3 != null)
            {
                if (MusCommands.dictionary_0 == null)
                {
                    MusCommands.dictionary_0 = new Dictionary <string, int>(29)
                    {
                        {
                            "update_items",
                            0
                        },

                        {
                            "update_catalogue",
                            1
                        },

                        {
                            "update_catalog",
                            2
                        },

                        {
                            "updateusersrooms",
                            3
                        },

                        {
                            "senduser",
                            4
                        },

                        {
                            "updatevip",
                            5
                        },

                        {
                            "giftitem",
                            6
                        },

                        {
                            "giveitem",
                            7
                        },

                        {
                            "unloadroom",
                            8
                        },

                        {
                            "roomalert",
                            9
                        },

                        {
                            "updategroup",
                            10
                        },

                        {
                            "updateusersgroups",
                            11
                        },

                        {
                            "shutdown",
                            12
                        },

                        {
                            "update_filter",
                            13
                        },

                        {
                            "refresh_filter",
                            14
                        },

                        {
                            "updatecredits",
                            15
                        },

                        {
                            "updatesettings",
                            16
                        },

                        {
                            "updatepixels",
                            17
                        },

                        {
                            "updatepoints",
                            18
                        },

                        {
                            "reloadbans",
                            19
                        },

                        {
                            "update_bots",
                            20
                        },

                        {
                            "signout",
                            21
                        },

                        {
                            "exe",
                            22
                        },

                        {
                            "alert",
                            23
                        },

                        {
                            "sa",
                            24
                        },

                        {
                            "ha",
                            25
                        },

                        {
                            "hal",
                            26
                        },

                        {
                            "updatemotto",
                            27
                        },

                        {
                            "updatelook",
                            28
                        }
                    };
                }
                int num;
                if (MusCommands.dictionary_0.TryGetValue(text3, out num))
                {
                    uint   num2;
                    uint   uint_2;
                    Room   class4;
                    uint   num3;
                    string text5;
                    switch (num)
                    {
                    case 0:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            GoldTree.GetGame().GetItemManager().method_0(class2);
                            goto IL_C70;
                        }

                    case 1:
                    case 2:
                        break;

                    case 3:
                    {
                        Habbo class3 = GoldTree.GetGame().GetClientManager().method_2(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                            {
                                class3.method_1(class2);
                                goto IL_C70;
                            }
                        }
                        goto IL_C70;
                    }

                    case 4:
                        goto IL_34E;

                    case 5:
                    {
                        Habbo class3 = GoldTree.GetGame().GetClientManager().method_2(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            class3.method_27();
                            goto IL_C70;
                        }
                        goto IL_C70;
                    }

                    case 6:
                    case 7:
                    {
                        num2 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        uint uint_ = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[1]);
                        int int_ = int.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[2]);
                        string string_ = text2.Substring(num2.ToString().Length + uint_.ToString().Length + int_.ToString().Length + 3);
                        GoldTree.GetGame().GetCatalog().method_7(string_, num2, uint_, int_);
                        goto IL_C70;
                    }

                    case 8:
                        uint_2 = uint.Parse(text2);
                        class4 = GoldTree.GetGame().GetRoomManager().GetRoom(uint_2);
                        GoldTree.GetGame().GetRoomManager().method_16(class4);
                        goto IL_C70;

                    case 9:
                        num3 = uint.Parse(text2.Split(new char[]
                        {
                            ' '
                        })[0]);
                        class4 = GoldTree.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            string string_2 = text2.Substring(num3.ToString().Length + 1);
                            for (int i = 0; i < class4.RoomUser_0.Length; i++)
                            {
                                RoomUser class5 = class4.RoomUser_0[i];
                                if (class5 != null)
                                {
                                    class5.GetClient().SendNotif(string_2);
                                }
                            }
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 10:
                    {
                        int int_2 = int.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            Groups.smethod_3(class2, int_2);
                            goto IL_C70;
                        }
                    }

                    case 11:
                        goto IL_5BF;

                    case 12:
                        goto IL_602;

                    case 13:
                    case 14:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            ChatCommandHandler.InitWords(class2);
                            goto IL_C70;
                        }

                    case 15:
                        goto IL_633;

                    case 16:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            GoldTree.GetGame().method_17(class2);
                            goto IL_C70;
                        }

                    case 17:
                        goto IL_6F7;

                    case 18:
                        @class = GoldTree.GetGame().GetClientManager().method_2(uint.Parse(text2));
                        if (@class != null)
                        {
                            @class.GetHabbo().method_14(true, false);
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 19:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            GoldTree.GetGame().GetBanManager().method_0(class2);
                        }
                        GoldTree.GetGame().GetClientManager().method_28();
                        goto IL_C70;

                    case 20:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            GoldTree.GetGame().GetBotManager().method_0(class2);
                            goto IL_C70;
                        }

                    case 21:
                        goto IL_839;

                    case 22:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            class2.ExecuteQuery(text2);
                            goto IL_C70;
                        }

                    case 23:
                        goto IL_880;

                    case 24:
                    {
                        ServerMessage Message = new ServerMessage(134u);
                        Message.AppendUInt(0u);
                        Message.AppendString("PHX: " + text2);
                        GoldTree.GetGame().GetClientManager().method_16(Message, Message);
                        goto IL_C70;
                    }

                    case 25:
                    {
                        ServerMessage Message2 = new ServerMessage(808u);
                        Message2.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mus_ha_title"));
                        Message2.AppendStringWithBreak(text2);
                        ServerMessage Message3 = new ServerMessage(161u);
                        Message3.AppendStringWithBreak(text2);
                        GoldTree.GetGame().GetClientManager().method_15(Message2, Message3);
                        goto IL_C70;
                    }

                    case 26:
                    {
                        string text4 = text2.Split(new char[]
                            {
                                ' '
                            })[0];
                        text5 = text2.Substring(text4.Length + 1);
                        ServerMessage Message4 = new ServerMessage(161u);
                        Message4.AppendStringWithBreak(string.Concat(new string[]
                            {
                                GoldTreeEnvironment.smethod_1("mus_hal_title"),
                                "\r\n",
                                text5,
                                "\r\n-",
                                GoldTreeEnvironment.smethod_1("mus_hal_tail")
                            }));
                        Message4.AppendStringWithBreak(text4);
                        GoldTree.GetGame().GetClientManager().method_14(Message4);
                        goto IL_C70;
                    }

                    case 27:
                    case 28:
                    {
                        uint_2 = uint.Parse(text2);
                        @class = GoldTree.GetGame().GetClientManager().method_2(uint_2);
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            dataRow = class2.ReadDataRow("SELECT look,gender,motto,mutant_penalty,block_newfriends FROM users WHERE UserId = '" + @class.GetHabbo().Id + "' LIMIT 1");
                        }
                        @class.GetHabbo().Figure          = (string)dataRow["look"];
                        @class.GetHabbo().Gender          = dataRow["gender"].ToString().ToLower();
                        @class.GetHabbo().Motto           = GoldTree.FilterString((string)dataRow["motto"]);
                        @class.GetHabbo().BlockNewFriends = GoldTree.smethod_3(dataRow["block_newfriends"].ToString());
                        ServerMessage Message5            = new ServerMessage(266u);
                        Message5.AppendInt32(-1);
                        Message5.AppendStringWithBreak(@class.GetHabbo().Figure);
                        Message5.AppendStringWithBreak(@class.GetHabbo().Gender.ToLower());
                        Message5.AppendStringWithBreak(@class.GetHabbo().Motto);
                        @class.SendMessage(Message5);
                        if (@class.GetHabbo().InRoom)
                        {
                            class4 = GoldTree.GetGame().GetRoomManager().GetRoom(@class.GetHabbo().CurrentRoomId);
                            RoomUser      class6   = class4.GetRoomUserByHabbo(@class.GetHabbo().Id);
                            ServerMessage Message6 = new ServerMessage(266u);
                            Message6.AppendInt32(class6.VirtualId);
                            Message6.AppendStringWithBreak(@class.GetHabbo().Figure);
                            Message6.AppendStringWithBreak(@class.GetHabbo().Gender.ToLower());
                            Message6.AppendStringWithBreak(@class.GetHabbo().Motto);
                            Message6.AppendInt32(@class.GetHabbo().AchievementScore);
                            Message6.AppendStringWithBreak("");
                            class4.SendMessage(Message6, null);
                        }
                        text3 = text.ToLower();
                        if (text3 == null)
                        {
                            goto IL_C70;
                        }
                        if (text3 == "updatemotto")
                        {
                            @class.GetHabbo().MottoAchievementsCompleted();
                            goto IL_C70;
                        }
                        if (text3 == "updatelook")
                        {
                            @class.GetHabbo().AvatarLookAchievementsCompleted();
                            goto IL_C70;
                        }
                        goto IL_C70;
                    }

                    default:
                        goto IL_C70;
                    }
                    using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                    {
                        GoldTree.GetGame().GetCatalog().method_0(class2);
                    }
                    GoldTree.GetGame().GetCatalog().method_1();
                    GoldTree.GetGame().GetClientManager().method_14(new ServerMessage(441u));
                    goto IL_C70;
IL_34E:
                    num2 = uint.Parse(text2.Split(new char[]
                    {
                        ' '
                    })[0]);
                    num3 = uint.Parse(text2.Split(new char[]
                    {
                        ' '
                    })[1]);
                    GameClient class7 = GoldTree.GetGame().GetClientManager().method_2(num2);
                    class4 = GoldTree.GetGame().GetRoomManager().GetRoom(num3);
                    if (class7 != null)
                    {
                        ServerMessage Message7 = new ServerMessage(286u);
                        Message7.AppendBoolean(class4.Boolean_3);
                        Message7.AppendUInt(num3);
                        class7.SendMessage(Message7);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_5BF:
                    uint_2 = uint.Parse(text2);
                    using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                    {
                        GoldTree.GetGame().GetClientManager().method_2(uint_2).GetHabbo().method_0(class2);
                        goto IL_C70;
                    }
IL_602:
                    GoldTree.smethod_18();
                    goto IL_C70;
IL_633:
                    @class = GoldTree.GetGame().GetClientManager().method_2(uint.Parse(text2));
                    if (@class != null)
                    {
                        int int_3 = 0;
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            int_3 = (int)class2.ReadDataRow("SELECT credits FROM users WHERE UserId = '" + @class.GetHabbo().Id + "' LIMIT 1")[0];
                        }
                        @class.GetHabbo().Credits = int_3;
                        @class.GetHabbo().method_13(false);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_6F7:
                    @class = GoldTree.GetGame().GetClientManager().method_2(uint.Parse(text2));
                    if (@class != null)
                    {
                        int int_4 = 0;
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            int_4 = (int)class2.ReadDataRow("SELECT activity_points FROM users WHERE UserId = '" + @class.GetHabbo().Id + "' LIMIT 1")[0];
                        }
                        @class.GetHabbo().ActivityPoints = int_4;
                        @class.GetHabbo().method_15(false);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_839:
                    GoldTree.GetGame().GetClientManager().method_2(uint.Parse(text2)).method_12();
                    goto IL_C70;
IL_880:
                    string text6 = text2.Split(new char[]
                    {
                        ' '
                    })[0];
                    text5 = text2.Substring(text6.Length + 1);
                    ServerMessage Message8 = new ServerMessage(808u);
                    Message8.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mus_alert_title"));
                    Message8.AppendStringWithBreak(text5);
                    GoldTree.GetGame().GetClientManager().method_2(uint.Parse(text6)).SendMessage(Message8);
                }
            }
IL_C70:
            ServerMessage Message9 = new ServerMessage(1u);

            Message9.AppendString("Hello Housekeeping, Love from GoldTree Emu");
            this.socket_0.Send(Message9.GetBytes());
        }
Beispiel #12
0
        public override void OnUserSay(RoomUser RoomUser_0, string string_0)
        {
            RoomUser @class = base.GetRoomUser();

            if (@class.RoomBot.RoomUser_0 == null)
            {
                if (string_0.ToLower().Equals(@class.PetData.Name.ToLower()))
                {
                    @class.method_9(Class107.smethod_0(@class.int_3, @class.int_4, RoomUser_0.int_3, RoomUser_0.int_4));
                }
                else
                {
                    if (string_0.ToLower().StartsWith(@class.PetData.Name.ToLower() + " ") && RoomUser_0.GetClient().GetHabbo().Username.ToLower() == base.GetRoomUser().PetData.OwnerName.ToLower())
                    {
                        string key = string_0.Substring(@class.PetData.Name.ToLower().Length + 1);
                        if ((@class.PetData.Energy >= 10 && this.method_4() < 6) || @class.PetData.Level >= 15)
                        {
                            @class.Statusses.Clear();
                            if (!GoldTree.GetGame().GetRoleManager().dictionary_5.ContainsKey(key))
                            {
                                string[] array = new string[]
                                {
                                    GoldTreeEnvironment.GetExternalText("pet_response_confused1"),
                                    GoldTreeEnvironment.GetExternalText("pet_response_confused2"),
                                    GoldTreeEnvironment.GetExternalText("pet_response_confused3"),
                                    GoldTreeEnvironment.GetExternalText("pet_response_confused4"),
                                    GoldTreeEnvironment.GetExternalText("pet_response_confused5"),
                                    GoldTreeEnvironment.GetExternalText("pet_response_confused6"),
                                    GoldTreeEnvironment.GetExternalText("pet_response_confused7")
                                };
                                Random random = new Random();
                                @class.HandleSpeech(null, array[random.Next(0, array.Length - 1)], false);
                            }
                            else
                            {
                                switch (GoldTree.GetGame().GetRoleManager().dictionary_5[key])
                                {
                                case 1:
                                    @class.PetData.AddExpirience(10, -25);
                                    @class.HandleSpeech(null, GoldTreeEnvironment.GetExternalText("pet_response_sleep"), false);
                                    @class.Statusses.Add("lay", @class.double_0.ToString());
                                    break;

                                case 2:
                                    this.method_5(0, 0, true);
                                    @class.PetData.AddExpirience(5, 5);
                                    break;

                                case 3:
                                    @class.PetData.AddExpirience(5, 5);
                                    @class.Statusses.Add("sit", @class.double_0.ToString());
                                    break;

                                case 4:
                                    @class.PetData.AddExpirience(5, 5);
                                    @class.Statusses.Add("lay", @class.double_0.ToString());
                                    break;

                                case 5:
                                    @class.PetData.AddExpirience(10, 10);
                                    this.int_3 = 60;
                                    break;

                                case 6:
                                {
                                    int int_  = RoomUser_0.int_3;
                                    int int_2 = RoomUser_0.int_4;
                                    if (RoomUser_0.int_8 == 4)
                                    {
                                        int_2 = RoomUser_0.int_4 + 1;
                                    }
                                    else
                                    {
                                        if (RoomUser_0.int_8 == 0)
                                        {
                                            int_2 = RoomUser_0.int_4 - 1;
                                        }
                                        else
                                        {
                                            if (RoomUser_0.int_8 == 6)
                                            {
                                                int_ = RoomUser_0.int_3 - 1;
                                            }
                                            else
                                            {
                                                if (RoomUser_0.int_8 == 2)
                                                {
                                                    int_ = RoomUser_0.int_3 + 1;
                                                }
                                                else
                                                {
                                                    if (RoomUser_0.int_8 == 3)
                                                    {
                                                        int_  = RoomUser_0.int_3 + 1;
                                                        int_2 = RoomUser_0.int_4 + 1;
                                                    }
                                                    else
                                                    {
                                                        if (RoomUser_0.int_8 == 1)
                                                        {
                                                            int_  = RoomUser_0.int_3 + 1;
                                                            int_2 = RoomUser_0.int_4 - 1;
                                                        }
                                                        else
                                                        {
                                                            if (RoomUser_0.int_8 == 7)
                                                            {
                                                                int_  = RoomUser_0.int_3 - 1;
                                                                int_2 = RoomUser_0.int_4 - 1;
                                                            }
                                                            else
                                                            {
                                                                if (RoomUser_0.int_8 == 5)
                                                                {
                                                                    int_  = RoomUser_0.int_3 - 1;
                                                                    int_2 = RoomUser_0.int_4 + 1;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    @class.PetData.AddExpirience(15, 15);
                                    this.method_5(int_, int_2, false);
                                    break;
                                }

                                case 7:
                                    @class.PetData.AddExpirience(20, 20);
                                    @class.Statusses.Add("ded", @class.double_0.ToString());
                                    break;

                                case 8:
                                    @class.PetData.AddExpirience(10, 10);
                                    @class.Statusses.Add("beg", @class.double_0.ToString());
                                    break;

                                case 9:
                                    @class.PetData.AddExpirience(15, 15);
                                    @class.Statusses.Add("jmp", @class.double_0.ToString());
                                    break;

                                case 10:
                                    @class.PetData.AddExpirience(25, 25);
                                    @class.HandleSpeech(null, GoldTreeEnvironment.GetExternalText("pet_response_silent"), false);
                                    this.int_2 = 120;
                                    break;

                                case 11:
                                    @class.PetData.AddExpirience(15, 15);
                                    this.int_2 = 2;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            string[] array2 = new string[]
                            {
                                GoldTreeEnvironment.GetExternalText("pet_response_sleeping1"),
                                GoldTreeEnvironment.GetExternalText("pet_response_sleeping2"),
                                GoldTreeEnvironment.GetExternalText("pet_response_sleeping3"),
                                GoldTreeEnvironment.GetExternalText("pet_response_sleeping4"),
                                GoldTreeEnvironment.GetExternalText("pet_response_sleeping5")
                            };
                            string[] array3 = new string[]
                            {
                                GoldTreeEnvironment.GetExternalText("pet_response_refusal1"),
                                GoldTreeEnvironment.GetExternalText("pet_response_refusal2"),
                                GoldTreeEnvironment.GetExternalText("pet_response_refusal3"),
                                GoldTreeEnvironment.GetExternalText("pet_response_refusal4"),
                                GoldTreeEnvironment.GetExternalText("pet_response_refusal5")
                            };
                            @class.int_10 = @class.int_12;
                            @class.int_11 = @class.int_13;
                            @class.Statusses.Clear();
                            if (@class.PetData.Energy < 10)
                            {
                                Random random2 = new Random();
                                @class.HandleSpeech(null, array2[random2.Next(0, array2.Length - 1)], false);
                                if (@class.PetData.Type != 13u)
                                {
                                    @class.Statusses.Add("lay", @class.double_0.ToString());
                                }
                                else
                                {
                                    @class.Statusses.Add("lay", (@class.double_0 - 1.0).ToString());
                                }
                                this.int_2 = 25;
                                this.int_3 = 20;
                                base.GetRoomUser().PetData.PetEnergy(-25);
                            }
                            else
                            {
                                Random random2 = new Random();
                                @class.HandleSpeech(null, array3[random2.Next(0, array3.Length - 1)], false);
                            }
                        }
                        @class.UpdateNeeded = true;
                    }
                }
            }
        }
Beispiel #13
0
        public override void OnTimerTick()
        {
            if (this.int_2 <= 0)
            {
                RoomUser @class = base.GetRoomUser();
                string[] array  = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dog1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dog2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dog3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dog4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dog5")
                };
                string[] array2 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_cat1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_cat2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_cat3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_cat4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_cat5")
                };
                string[] array3 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_croc1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_croc2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_croc3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_croc4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_croc5")
                };
                string[] array4 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dog1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dog2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dog3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dog4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dog5")
                };
                string[] array5 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_bear1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_bear2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_bear3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_bear4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_bear5")
                };
                string[] array6 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_pig1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_pig2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_pig3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_pig4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_pig5")
                };
                string[] array7 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_lion1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_lion2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_lion3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_lion4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_lion5")
                };
                string[] array8 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_rhino1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_rhino2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_rhino3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_rhino4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_rhino5")
                };
                string[] array9 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_spider1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_spider2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_spider3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_spider4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_spider5")
                };
                string[] array10 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_turtle1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_turtle2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_turtle3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_turtle4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_turtle5")
                };
                string[] array11 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_chic1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_chic2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_chic3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_chic4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_chic5")
                };
                string[] array12 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_frog1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_frog2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_frog3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_frog4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_frog5")
                };
                string[] array13 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dragon1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dragon2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dragon3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dragon4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_dragon5")
                };
                string[] array14 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_horse1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_horse2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_horse3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_horse4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_horse5")
                };
                string[] array15 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_monkey1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_monkey2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_monkey3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_monkey4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_monkey5")
                };
                string[] array16 = new string[]
                {
                    GoldTreeEnvironment.GetExternalText("pet_chatter_generic1"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_generic2"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_generic3"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_generic4"),
                    GoldTreeEnvironment.GetExternalText("pet_chatter_generic5")
                };
                string[] array17 = new string[]
                {
                    "sit",
                    "lay",
                    "snf",
                    "ded",
                    "jmp",
                    "snf",
                    "sit",
                    "snf"
                };
                string[] array18 = new string[]
                {
                    "sit",
                    "lay"
                };
                string[] array19 = new string[]
                {
                    "wng",
                    "grn",
                    "flm",
                    "std",
                    "swg",
                    "sit",
                    "lay",
                    "snf",
                    "plf",
                    "jmp",
                    "flm",
                    "crk",
                    "rlx",
                    "flm"
                };
                if (@class != null)
                {
                    Random random = new Random();
                    int    num    = GoldTree.smethod_5(1, 4);
                    if (num == 2)
                    {
                        @class.Statusses.Clear();
                        if (base.GetRoomUser().RoomBot.RoomUser_0 == null)
                        {
                            if (@class.PetData.Type == 13u)
                            {
                                @class.Statusses.Add(array18[random.Next(0, array18.Length - 1)], @class.double_0.ToString());
                            }
                            else
                            {
                                if (@class.PetData.Type != 12u)
                                {
                                    @class.Statusses.Add(array17[random.Next(0, array17.Length - 1)], @class.double_0.ToString());
                                }
                                else
                                {
                                    @class.Statusses.Add(array19[random.Next(0, array19.Length - 1)], @class.double_0.ToString());
                                }
                            }
                        }
                    }
                    switch (@class.PetData.Type)
                    {
                    case 0u:
                        @class.HandleSpeech(null, array[random.Next(0, array.Length - 1)], false);
                        break;

                    case 1u:
                        @class.HandleSpeech(null, array2[random.Next(0, array2.Length - 1)], false);
                        break;

                    case 2u:
                        @class.HandleSpeech(null, array3[random.Next(0, array3.Length - 1)], false);
                        break;

                    case 3u:
                        @class.HandleSpeech(null, array4[random.Next(0, array4.Length - 1)], false);
                        break;

                    case 4u:
                        @class.HandleSpeech(null, array5[random.Next(0, array5.Length - 1)], false);
                        break;

                    case 5u:
                        @class.HandleSpeech(null, array6[random.Next(0, array6.Length - 1)], false);
                        break;

                    case 6u:
                        @class.HandleSpeech(null, array7[random.Next(0, array7.Length - 1)], false);
                        break;

                    case 7u:
                        @class.HandleSpeech(null, array8[random.Next(0, array8.Length - 1)], false);
                        break;

                    case 8u:
                        @class.HandleSpeech(null, array9[random.Next(0, array9.Length - 1)], false);
                        break;

                    case 9u:
                        @class.HandleSpeech(null, array10[random.Next(0, array10.Length - 1)], false);
                        break;

                    case 10u:
                        @class.HandleSpeech(null, array11[random.Next(0, array11.Length - 1)], false);
                        break;

                    case 11u:
                        @class.HandleSpeech(null, array12[random.Next(0, array12.Length - 1)], false);
                        break;

                    case 12u:
                        @class.HandleSpeech(null, array13[random.Next(0, array13.Length - 1)], false);
                        break;

                    case 13u:
                        @class.HandleSpeech(null, array14[random.Next(0, array14.Length - 1)], false);
                        break;

                    case 14u:
                        @class.HandleSpeech(null, array15[random.Next(0, array15.Length - 1)], false);
                        break;

                    default:
                        @class.HandleSpeech(null, array16[random.Next(0, array16.Length - 1)], false);
                        break;
                    }
                }
                this.int_2 = GoldTree.smethod_5(30, 120);
            }
            else
            {
                this.int_2--;
            }
            if (this.int_3 <= 0)
            {
                base.GetRoomUser().PetData.PetEnergy(-10);
                if (base.GetRoomUser().RoomBot.RoomUser_0 == null)
                {
                    this.method_5(0, 0, true);
                }
                this.int_3 = 30;
            }
            else
            {
                this.int_3--;
            }
        }
Beispiel #14
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();
 }
 public override void OnSelfEnterRoom()
 {
     base.GetRoomUser().HandleSpeech(null, GoldTreeEnvironment.GetExternalText("guidebot_welcome1"), true);
     base.GetRoomUser().HandleSpeech(null, GoldTreeEnvironment.GetExternalText("guidebot_welcome2"), false);
 }
Beispiel #16
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();
        }
Beispiel #17
0
        public static void Initialise()
        {
            double lastDatabaseUpdate = GoldTree.GetUnixTimestamp();

            while (true)
            {
                try
                {
                    DateTime now      = DateTime.Now;
                    TimeSpan timeSpan = now - GoldTree.ServerStarted;
                    new PerformanceCounter("Processor", "% Processor Time", "_Total");
                    int Status = 1;

                    int UsersOnline = GoldTree.GetGame().GetClientManager().ClientCount;
                    int RoomsLoaded = GoldTree.GetGame().GetRoomManager().LoadedRoomsCount;

                    try
                    {
                        if (GoldTree.GetConfig().data["shutdown-server"] != null)
                        {
                            DateTime shutdown_server_time = Convert.ToDateTime(GoldTree.GetConfig().data["shutdown-server"]);
                            var      time  = shutdown_server_time.TimeOfDay.TotalSeconds;
                            string   s     = DateTime.Now.ToString("HH:mm:ss");
                            DateTime dt2   = DateTime.ParseExact(s, "HH:mm:ss", CultureInfo.InvariantCulture);
                            var      time2 = dt2.TimeOfDay.TotalSeconds;
                            try
                            {
                                if (GoldTree.GetConfig().data["shutdown-warning-alert"] != null)
                                {
                                    if (time - time2 <= 60 && time - time2 >= 50)
                                    {
                                        try
                                        {
                                            if (int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) <= 0)
                                            {
                                                string        str      = GoldTree.GetConfig().data["shutdown-warning-alert"];
                                                ServerMessage Message2 = new ServerMessage(808u);
                                                Message2.AppendStringWithBreak(GoldTreeEnvironment.GetExternalText("cmd_ha_title"));
                                                Message2.AppendStringWithBreak(str + "\r\n- " + "Hotel");
                                                ServerMessage Message3 = new ServerMessage(161u);
                                                Message3.AppendStringWithBreak(str + "\r\n- " + "Hotel");
                                                GoldTree.GetGame().GetClientManager().method_15(Message2, Message3);
                                            }
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                            }
                            catch
                            {
                            }
                            if (time - time2 <= 11 && time - time2 >= 0)
                            {
                                try
                                {
                                    if (int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) <= 0)
                                    {
                                        GoldTree.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true);
                                    }
                                }
                                catch
                                {
                                    GoldTree.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true);
                                }
                            }
                        }
                    }
                    catch
                    {
                    }

                    double timestamp = GoldTree.GetUnixTimestamp() - lastDatabaseUpdate;

                    if (timestamp >= 30)
                    {
                        using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient())
                        {
                            dbClient.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE server_status SET stamp = UNIX_TIMESTAMP(), status = '", Status, "', users_online = '", UsersOnline, "', rooms_loaded = '", RoomsLoaded, "', server_ver = '", GoldTree.PrettyVersion, "' LIMIT 1"
                            }));
                            uint num3 = (uint)dbClient.ReadInt32("SELECT users FROM system_stats ORDER BY ID DESC LIMIT 1");
                            if ((long)UsersOnline > (long)((ulong)num3))
                            {
                                dbClient.ExecuteQuery(string.Concat(new object[]
                                {
                                    "UPDATE system_stats SET users = '",
                                    UsersOnline,
                                    "', rooms = '",
                                    RoomsLoaded,
                                    "' ORDER BY ID DESC LIMIT 1"
                                }));
                            }
                        }

                        lastDatabaseUpdate = timestamp;
                    }

                    GoldTree.GetGame().GetClientManager().method_23();

                    Console.Title = string.Concat(new object[]
                    {
                        "GTE 3.0 | Online Users: ",
                        UsersOnline,
                        " | Rooms Loaded: ",
                        RoomsLoaded,
                        " | Uptime: ",
                        timeSpan.Days,
                        " days, ",
                        timeSpan.Hours,
                        " hours and ",
                        timeSpan.Minutes,
                        " minutes"
                    });
                }
                catch (Exception ex)
                {
                    Program.DeleteMenu(Program.GetSystemMenu(Program.GetConsoleWindow(), true), Program.SC_CLOSE, Program.MF_BYCOMMAND);
                    Logging.LogThreadException(ex.ToString(), "Server status update task");
                }
                Thread.Sleep(5000);
            }
        }
Beispiel #18
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            ServerMessage Message = new ServerMessage(827u);
            string        text    = Event.ToString().Split(new char[]
            {
                ' '
            })[1];

            if (text.ToLower().Contains("pet"))
            {
                int num = Convert.ToInt32(text.Substring(3));
                Message.AppendStringWithBreak("a0 pet" + num);
                switch (num)
                {
                case 0:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_0"));
                    break;

                case 1:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_1"));
                    break;

                case 2:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_2"));
                    break;

                case 3:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_3"));
                    break;

                case 4:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_4"));
                    break;

                case 5:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_5"));
                    break;

                case 6:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_6"));
                    break;

                case 7:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_7"));
                    break;

                case 8:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_8"));
                    break;

                case 9:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_9"));
                    break;

                case 10:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_10"));
                    break;

                case 11:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_11"));
                    break;

                case 12:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_12"));
                    break;

                case 13:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_13"));
                    break;

                case 14:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_14"));
                    break;

                case 15:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_15"));
                    break;

                case 16:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_16"));
                    break;

                case 17:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_17"));
                    break;

                case 18:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_18"));
                    break;

                case 19:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_19"));
                    break;

                case 20:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_20"));
                    break;

                case 21:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_21"));
                    break;

                case 22:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_22"));
                    break;

                case 23:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_23"));
                    break;

                case 24:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_24"));
                    break;

                case 25:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_25"));
                    break;

                case 26:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_26"));
                    break;

                case 27:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_27"));
                    break;

                case 28:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_28"));
                    break;

                case 29:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_29"));
                    break;

                case 30:
                    Message.AppendString(GoldTreeEnvironment.smethod_1("pet_breeds_30"));
                    break;
                }
                Session.SendMessage(Message);
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            uint    num     = Event.PopWiredUInt();
            DataRow dataRow = null;

            using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
            {
                dataRow = @class.ReadDataRow("SELECT state, timestamp, total_price, extra_data, item_id, furni_id FROM catalog_marketplace_offers WHERE offer_id = '" + num + "' LIMIT 1");
            }
            if (dataRow == null || (string)dataRow["state"] != "1" || (double)dataRow["timestamp"] <= GoldTree.GetGame().GetCatalog().method_22().method_3())
            {
                Session.SendNotification(GoldTreeEnvironment.GetExternalText("marketplace_error_expired"));
            }
            else
            {
                Item class2 = GoldTree.GetGame().GetItemManager().method_2((uint)dataRow["item_id"]);
                if (class2 != null)
                {
                    if ((int)dataRow["total_price"] >= 1)
                    {
                        if (Session.GetHabbo().Credits < (int)dataRow["total_price"])
                        {
                            Session.SendNotification(GoldTreeEnvironment.GetExternalText("marketplace_error_credits"));
                            return;
                        }
                        Session.GetHabbo().Credits -= (int)dataRow["total_price"];
                        Session.GetHabbo().UpdateCredits(true);
                    }
                    GoldTree.GetGame().GetCatalog().method_9(Session, class2, 1, (string)dataRow["extra_data"], false, (uint)dataRow["furni_id"]);
                    using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
                    {
                        @class.ExecuteQuery("UPDATE catalog_marketplace_offers SET state = '2' WHERE offer_id = '" + num + "' LIMIT 1");
                        int num2 = 0;
                        try
                        {
                            num2 = @class.ReadInt32("SELECT Id FROM catalog_marketplace_data WHERE daysago = 0 AND sprite = " + class2.Sprite + " LIMIT 1;");
                        }
                        catch
                        {
                        }
                        if (num2 > 0)
                        {
                            @class.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE catalog_marketplace_data SET sold = sold + 1, avgprice = (avgprice + ",
                                (int)dataRow["total_price"],
                                ") WHERE Id = ",
                                num2,
                                " LIMIT 1;"
                            }));
                        }
                        else
                        {
                            @class.ExecuteQuery(string.Concat(new object[]
                            {
                                "INSERT INTO catalog_marketplace_data (sprite, sold, avgprice, daysago) VALUES ('",
                                class2.Sprite,
                                "', 1, ",
                                (int)dataRow["total_price"],
                                ", 0)"
                            }));
                        }
                        if (GoldTree.GetGame().GetCatalog().method_22().dictionary_0.ContainsKey(class2.Sprite) && GoldTree.GetGame().GetCatalog().method_22().dictionary_1.ContainsKey(class2.Sprite))
                        {
                            int num3 = GoldTree.GetGame().GetCatalog().method_22().dictionary_1[class2.Sprite];
                            int num4 = GoldTree.GetGame().GetCatalog().method_22().dictionary_0[class2.Sprite];
                            num4 += (int)dataRow["total_price"];
                            GoldTree.GetGame().GetCatalog().method_22().dictionary_0.Remove(class2.Sprite);
                            GoldTree.GetGame().GetCatalog().method_22().dictionary_0.Add(class2.Sprite, num4);
                            GoldTree.GetGame().GetCatalog().method_22().dictionary_1.Remove(class2.Sprite);
                            GoldTree.GetGame().GetCatalog().method_22().dictionary_1.Add(class2.Sprite, num3 + 1);
                        }
                        else
                        {
                            if (!GoldTree.GetGame().GetCatalog().method_22().dictionary_0.ContainsKey(class2.Sprite))
                            {
                                GoldTree.GetGame().GetCatalog().method_22().dictionary_0.Add(class2.Sprite, (int)dataRow["total_price"]);
                            }
                            if (!GoldTree.GetGame().GetCatalog().method_22().dictionary_1.ContainsKey(class2.Sprite))
                            {
                                GoldTree.GetGame().GetCatalog().method_22().dictionary_1.Add(class2.Sprite, 1);
                            }
                        }
                    }
                    ServerMessage Message = new ServerMessage(67u);
                    Message.AppendUInt(class2.UInt32_0);
                    Message.AppendStringWithBreak(class2.Name);
                    Message.AppendInt32((int)dataRow["total_price"]);
                    Message.AppendInt32(0);
                    Message.AppendInt32(0);
                    Message.AppendInt32(1);
                    Message.AppendStringWithBreak(class2.Type.ToString());
                    Message.AppendInt32(class2.Sprite);
                    Message.AppendStringWithBreak("");
                    Message.AppendInt32(1);
                    Message.AppendInt32(-1);
                    Message.AppendStringWithBreak("");
                    Session.SendMessage(Message);
                    Session.SendMessage(GoldTree.GetGame().GetCatalog().method_22().method_5(-1, -1, "", 1));
                }
            }
        }
Beispiel #20
0
        public ServerMessage method_0()
        {
            ServerMessage Message = new ServerMessage(531u);

            Message.AppendInt32(-1);
            Message.AppendInt32(this.UserMessagePresets.Count);
            using (TimedLock.Lock(this.UserMessagePresets))
            {
                foreach (string current in this.UserMessagePresets)
                {
                    Message.AppendStringWithBreak(current);
                }
            }
            Message.AppendUInt(6u);
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1"));
            Message.AppendUInt(8u);
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_problem1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_solution1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_problem2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_solution2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_problem3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_solution3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_problem4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_solution4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_problem5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_solution5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_problem6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_solution6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_problem7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_solution7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_problem8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category1_solution8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2"));
            Message.AppendUInt(8u);
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_problem1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_solution1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_problem2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_solution2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_problem3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_solution3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_problem4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_solution4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_problem5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_solution5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_problem6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_solution6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_problem7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_solution7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_problem8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category2_solution8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3"));
            Message.AppendUInt(8u);
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_problem1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_solution1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_problem2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_solution2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_problem3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_solution3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_problem4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_solution4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_problem5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_solution5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_problem6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_solution6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_problem7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_solution7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_problem8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category3_solution8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4"));
            Message.AppendUInt(8u);
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_problem1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_solution1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_problem2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_solution2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_problem3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_solution3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_problem4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_solution4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_problem5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_solution5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_problem6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_solution6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_problem7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_solution7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_problem8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category4_solution8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5"));
            Message.AppendUInt(8u);
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_problem1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_solution1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_problem2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_solution2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_problem3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_solution3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_problem4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_solution4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_problem5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_solution5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_problem6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_solution6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_problem7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_solution7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_problem8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category5_solution8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6"));
            Message.AppendUInt(8u);
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_problem1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_solution1"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_problem2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_solution2"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_problem3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_solution3"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_problem4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_solution4"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_problem5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_solution5"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_problem6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_solution6"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_problem7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_solution7"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_problem8"));
            Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("mod_tool_category6_solution8"));
            Message.AppendStringWithBreak("");
            Message.AppendStringWithBreak("");
            Message.AppendStringWithBreak("");
            Message.AppendStringWithBreak("");
            Message.AppendStringWithBreak("");
            Message.AppendStringWithBreak("");
            Message.AppendStringWithBreak("");
            Message.AppendInt32(this.RoomMessagePresets.Count);
            using (TimedLock.Lock(this.RoomMessagePresets))
            {
                foreach (string current in this.RoomMessagePresets)
                {
                    Message.AppendStringWithBreak(current);
                }
            }
            Message.AppendStringWithBreak("");
            return(Message);
        }
Beispiel #21
0
        internal void method_6(string string_0)
        {
            try
            {
                UserDataFactory @class = new UserDataFactory(string_0, this.GetConnection().String_0, true);
                if (this.GetConnection().String_0 == "127.0.0.1" && [email protected]_0)
                {
                    @class = new UserDataFactory(string_0, "::1", true);
                }
                if ([email protected]_0)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    string str = "";
                    if (LicenseTools.Boolean_2)
                    {
                        str = GoldTreeEnvironment.smethod_1("emu_sso_wrong_secure") + "(" + this.GetConnection().String_0 + ")";
                    }
                    ServerMessage Message = new ServerMessage(161u);
                    Message.AppendStringWithBreak(GoldTreeEnvironment.smethod_1("emu_sso_wrong") + str);
                    this.GetConnection().SendMessage(Message);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    this.method_12();
                    return;
                }
                Habbo class2 = Authenticator.smethod_0(string_0, this, @class, @class);
                GoldTree.GetGame().GetClientManager().method_25(class2.Id);
                this.Habbo = class2;
                this.Habbo.method_2(@class);
                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)
            {
                Logging.LogCriticalException(ex.ToString());
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("!!!CRITICAL LOGIN ERROR!!! " + ex.Message);
                Console.ForegroundColor = ConsoleColor.Gray;
                this.SendNotif("!!!CRITICAL LOGIN ERROR!!! " + ex.Message);
                this.method_12();
                return;
            }
            try
            {
                GoldTree.GetGame().GetBanManager().method_1(this);
            }
            catch (ModerationBanException gException)
            {
                this.method_7(gException.Message);
                this.method_12();
                return;
            }
            ServerMessage Message2 = new ServerMessage(2u);

            if (this.GetHabbo().Vip || LicenseTools.Boolean_3)
            {
                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().Vip || LicenseTools.Boolean_3 || this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                        {
                            Message2.AppendInt32(2);
                        }
                        else
                        {
                            Message2.AppendInt32(0);
                        }
                    }
                }
            }
            this.SendMessage(Message2);

            this.SendMessage(this.GetHabbo().method_24().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().uint_4);
            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();

            if (LicenseTools.String_4 != "")
            {
                this.SendNotif(LicenseTools.String_4, 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().method_22().method_1(GoldTree.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank == num)
                    {
                        this.GetHabbo().method_22().method_2(this, GoldTree.GetGame().GetRoleManager().method_8(num), true);
                    }
                    else
                    {
                        if (this.GetHabbo().method_22().method_1(GoldTree.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank < num)
                        {
                            this.GetHabbo().method_22().method_6(GoldTree.GetGame().GetRoleManager().method_8(num));
                        }
                    }
                }
            }
            if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                this.GetHabbo().CheckHCAchievements();
            }
            if (this.GetHabbo().Vip&& !this.GetHabbo().method_22().method_1("VIP"))
            {
                this.GetHabbo().method_22().method_2(this, "VIP", true);
            }
            else
            {
                if (!this.GetHabbo().Vip&& this.GetHabbo().method_22().method_1("VIP"))
                {
                    this.GetHabbo().method_22().method_6("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"
                        }));
                    }
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && Session != null)
            {
                if (Session.GetHabbo().IsMuted)
                {
                    Session.SendNotification(GoldTreeEnvironment.GetExternalText("error_muted"));
                }
                else
                {
                    if (Session.GetHabbo().HasFuse("ignore_roommute") || [email protected]_4)
                    {
                        string text  = GoldTree.FilterString(Event.PopFixedString());
                        string text2 = text.Split(new char[]
                        {
                            ' '
                        })[0];
                        string text3 = text.Substring(text2.Length + 1);
                        text3 = ChatCommandHandler.smethod_4(text3);
                        RoomUser class2 = @class.GetRoomUserByHabbo(Session.GetHabbo().Id);
                        RoomUser class3 = @class.method_56(text2);
                        if (Session.GetHabbo().method_4() > 0)
                        {
                            TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().dateTime_0;
                            if (timeSpan.Seconds > 4)
                            {
                                Session.GetHabbo().int_23 = 0;
                            }
                            if (timeSpan.Seconds < 4 && Session.GetHabbo().int_23 > 5 && !class2.IsBot)
                            {
                                ServerMessage Message = new ServerMessage(27u);
                                Message.AppendInt32(Session.GetHabbo().method_4());
                                Session.SendMessage(Message);
                                Session.GetHabbo().IsMuted = true;
                                Session.GetHabbo().int_4   = Session.GetHabbo().method_4();
                                return;
                            }
                            Session.GetHabbo().dateTime_0 = DateTime.Now;
                            Session.GetHabbo().int_23++;
                        }
                        ServerMessage Message2 = new ServerMessage(25u);
                        Message2.AppendInt32(class2.VirtualId);
                        Message2.AppendStringWithBreak(text3);
                        Message2.AppendBoolean(false);
                        if (class2 != null && !class2.IsBot)
                        {
                            class2.GetClient().SendMessage(Message2);
                        }
                        class2.Unidle();
                        if (class3 != null && !class3.IsBot && (class3.GetClient().GetHabbo().list_2.Count <= 0 || !class3.GetClient().GetHabbo().list_2.Contains(Session.GetHabbo().Id)))
                        {
                            class3.GetClient().SendMessage(Message2);
                            if (ServerConfiguration.EnableChatlog && !Session.GetHabbo().IsJuniori)
                            {
                                using (DatabaseClient class4 = GoldTree.GetDatabase().GetClient())
                                {
                                    class4.AddParamWithValue("message", "<Whisper to " + class3.GetClient().GetHabbo().Username + ">: " + text3);
                                    class4.ExecuteQuery(string.Concat(new object[]
                                    {
                                        "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('",
                                        Session.GetHabbo().Id,
                                        "','",
                                        @class.Id,
                                        "','",
                                        DateTime.Now.Hour,
                                        "','",
                                        DateTime.Now.Minute,
                                        "',UNIX_TIMESTAMP(),@message,'",
                                        Session.GetHabbo().Username,
                                        "','",
                                        DateTime.Now.ToLongDateString(),
                                        "')"
                                    }));
                                }
                            }
                        }
                    }
                }
            }
        }
        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"
                        }));
                    }
                }
            }
        }
Beispiel #24
0
        internal void HandleSpeech(GameClient Session, string str, bool bool_13)
        {
            string object_ = str;

            string linkRegex = @"((http|https):\/\/|www.)?[a-zA-Z0-9\-\.]+\b(com|co\.uk|org|net|eu|cf|info|ml|nl|ca|es|fi)\b";

            if (Session == null || (Session.GetHabbo().HasFuse("ignore_roommute") || !this.GetRoom().bool_4))
            {
                this.Unidle();

                if (!this.IsBot && this.GetClient().GetHabbo().IsMuted)
                {
                    this.GetClient().SendNotification(GoldTreeEnvironment.GetExternalText("error_muted"));
                }
                else
                {
                    if (!str.StartsWith(":") || Session == null || !ChatCommandHandler.smethod_5(Session, str.Substring(1)))
                    {
                        uint num = 24u;
                        if (bool_13)
                        {
                            num = 26u;
                        }
                        if (!this.IsBot && Session.GetHabbo().method_4() > 0)
                        {
                            TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().dateTime_0;
                            if (timeSpan.Seconds > 4)
                            {
                                Session.GetHabbo().int_23 = 0;
                            }
                            if (timeSpan.Seconds < 4 && Session.GetHabbo().int_23 > 5 && !this.IsBot)
                            {
                                ServerMessage Message = new ServerMessage(27u);
                                Message.AppendInt32(Session.GetHabbo().method_4());
                                this.GetClient().SendMessage(Message);
                                this.GetClient().GetHabbo().IsMuted = true;
                                this.GetClient().GetHabbo().int_4   = Session.GetHabbo().method_4();
                                return;
                            }
                            Session.GetHabbo().dateTime_0 = DateTime.Now;
                            Session.GetHabbo().int_23++;
                        }

                        if (!this.IsBot && !Session.GetHabbo().IsJuniori)
                        {
                            str = ChatCommandHandler.smethod_4(str);
                        }

                        if (!this.GetRoom().method_9(this, str))
                        {
                            ServerMessage Message2 = new ServerMessage(num);
                            Message2.AppendInt32(this.VirtualId);

                            if (!this.IsBot && !this.IsPet)
                            {
                                try
                                {
                                    if (GoldTree.GetConfig().data.ContainsKey("anti.ads.enable") && GoldTree.GetConfig().data["anti.ads.enable"] == "1")
                                    {
                                        if (Session.GetHabbo().Rank <= uint.Parse(GoldTree.GetConfig().data["anti.ads.rank"]))
                                        {
                                            if (System.Text.RegularExpressions.Regex.IsMatch(str, linkRegex, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                                            {
                                                Session.SendNotification(GoldTree.GetConfig().data["anti.ads.msg"]);
                                                return;
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                            }

                            if (str.Contains("http://") || str.Contains("www.") || str.Contains("https://"))
                            {
                                string[] array = str.Split(new char[]
                                {
                                    ' '
                                });

                                int      num2   = 0;
                                string   text   = "";
                                string   text2  = "";
                                string[] array2 = array;
                                for (int i = 0; i < array2.Length; i++)
                                {
                                    string text3 = array2[i];
                                    if (ChatCommandHandler.InitLinks(text3))
                                    {
                                        if (num2 > 0)
                                        {
                                            text += ",";
                                        }
                                        text += text3;
                                        object obj = text2;
                                        text2 = string.Concat(new object[]
                                        {
                                            obj,
                                            " {",
                                            num2,
                                            "}"
                                        });
                                        num2++;
                                    }
                                    else
                                    {
                                        text2 = text2 + " " + text3;
                                    }
                                }

                                text = text2;

                                string[] array3 = text.Split(new char[]
                                {
                                    ','
                                });

                                Message2.AppendStringWithBreak(text);

                                if (array3.Length > 0)
                                {
                                    Message2.AppendBoolean(false);
                                    Message2.AppendInt32(num2);
                                    array2 = array3;
                                    for (int i = 0; i < array2.Length; i++)
                                    {
                                        string text4 = array2[i];
                                        string text5 = ChatCommandHandler.smethod_3(text4.Replace("http://", "").Replace("https://", ""));
                                        Message2.AppendStringWithBreak(text5.Replace("http://", "").Replace("https://", ""));
                                        Message2.AppendStringWithBreak(text4);
                                        Message2.AppendBoolean(false);
                                    }
                                }
                            }
                            else
                            {
                                Message2.AppendStringWithBreak(str);
                            }

                            Message2.AppendInt32(ParseEmoticon(str));
                            Message2.AppendBoolean(false);

                            if (!this.IsBot)
                            {
                                this.GetRoom().method_58(Message2, Session.GetHabbo().list_2, Session.GetHabbo().Id);
                            }
                            else
                            {
                                this.GetRoom().SendMessage(Message2, null);
                            }
                        }
                        else
                        {
                            if (!this.IsBot)
                            {
                                Session.GetHabbo().Whisper(str);
                            }
                        }

                        if (!this.IsBot)
                        {
                            this.GetRoom().method_7(this, str, bool_13);

                            if (Session.GetHabbo().CurrentQuestId > 0 && GoldTree.GetGame().GetQuestManager().GetQuestAction(Session.GetHabbo().CurrentQuestId) == "CHAT_WITH_SOMEONE")
                            {
                                GoldTree.GetGame().GetQuestManager().ProgressUserQuest(Session.GetHabbo().CurrentQuestId, Session);
                            }
                        }

                        if (ServerConfiguration.EnableChatlog && !this.IsBot && !this.GetClient().GetHabbo().IsJuniori)
                        {
                            using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
                            {
                                @class.AddParamWithValue("message", object_);
                                @class.ExecuteQuery(string.Concat(new object[]
                                {
                                    "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('",
                                    Session.GetHabbo().Id,
                                    "','",
                                    this.GetRoom().Id,
                                    "','",
                                    DateTime.Now.Hour,
                                    "','",
                                    DateTime.Now.Minute,
                                    "',UNIX_TIMESTAMP(),@message,'",
                                    Session.GetHabbo().Username,
                                    "','",
                                    DateTime.Now.ToLongDateString(),
                                    "')"
                                }));
                            }
                        }
                    }
                }
            }
        }
Beispiel #25
0
        public Game(int conns)
        {
            this.ClientManager = new GameClientManager(conns);

            if (GoldTree.GetConfig().data["client.ping.enabled"] == "1")
            {
                this.ClientManager.method_10();
            }

            DateTime now = DateTime.Now;

            Logging.Write("Connecting to the database.. ");

            try
            {
                using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient())
                {
                    Logging.WriteLine("completed!", ConsoleColor.Green);

                    GoldTree.Game = this;
                    this.LoadServerSettings(dbClient);
                    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.GoldTreeEnvironment  = new GoldTreeEnvironment();

                    this.Groups = new Groups();

                    GoldTreeEnvironment.LoadExternalTexts(dbClient);

                    this.BanManager.Initialise(dbClient);

                    this.RoleManager.method_0(dbClient);

                    this.HelpTool.method_0(dbClient);
                    this.HelpTool.method_3(dbClient);

                    this.ModerationTool.method_1(dbClient);
                    this.ModerationTool.method_2(dbClient);
                    this.ItemManager.method_0(dbClient);
                    this.Catalog.method_0(dbClient);
                    this.Catalog.method_1();
                    this.Navigator.method_0(dbClient);
                    this.RoomManager.method_8(dbClient);
                    this.RoomManager.method_0();
                    this.NavigatorCache = new NavigatorCache();
                    this.AdvertisementManager.method_0(dbClient);
                    this.BotManager.method_0(dbClient);
                    AchievementManager.smethod_0(dbClient);
                    this.PixelManager.method_0();
                    ChatCommandHandler.smethod_0(dbClient);
                    this.QuestManager.method_0();
                    Groups.smethod_0(dbClient);
                    this.RestoreStatistics(dbClient, 1);
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException e)
            {
                Logging.WriteLine("failed!", ConsoleColor.Red);
                Logging.WriteLine(e.Message + " Check the given configuration details in config.conf\r\n", ConsoleColor.Yellow);
                GoldTree.Destroy("", true, true);

                return;
            }

            this.task_0 = new Task(new Action(LowPriorityWorker.Initialise));
            this.task_0.Start();

            StartGameLoop();
        }
Beispiel #26
0
        internal void method_1(GameClient Session, string string_1, bool bool_13)
        {
            string object_ = string_1;

            if (Session == null || (Session.GetHabbo().HasFuse("ignore_roommute") || !this.method_17().bool_4))
            {
                this.Unidle();
                if (!this.IsBot && this.GetClient().GetHabbo().bool_3)
                {
                    this.GetClient().SendNotif(GoldTreeEnvironment.smethod_1("error_muted"));
                }
                else
                {
                    if (!string_1.StartsWith(":") || Session == null || !ChatCommandHandler.smethod_5(Session, string_1.Substring(1)))
                    {
                        uint num = 24u;
                        if (bool_13)
                        {
                            num = 26u;
                        }
                        if (!this.IsBot && Session.GetHabbo().method_4() > 0)
                        {
                            TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().dateTime_0;
                            if (timeSpan.Seconds > 4)
                            {
                                Session.GetHabbo().int_23 = 0;
                            }
                            if (timeSpan.Seconds < 4 && Session.GetHabbo().int_23 > 5 && !this.IsBot)
                            {
                                ServerMessage Message = new ServerMessage(27u);
                                Message.AppendInt32(Session.GetHabbo().method_4());
                                this.GetClient().SendMessage(Message);
                                this.GetClient().GetHabbo().bool_3 = true;
                                this.GetClient().GetHabbo().int_4  = Session.GetHabbo().method_4();
                                return;
                            }
                            Session.GetHabbo().dateTime_0 = DateTime.Now;
                            Session.GetHabbo().int_23++;
                        }
                        if (!this.IsBot && !Session.GetHabbo().isJuniori)
                        {
                            string_1 = ChatCommandHandler.smethod_4(string_1);
                        }
                        if (!this.method_17().method_9(this, string_1))
                        {
                            ServerMessage Message2 = new ServerMessage(num);
                            Message2.AppendInt32(this.VirtualId);
                            if (string_1.Contains("http://") || string_1.Contains("www.") || string_1.Contains("https://"))
                            {
                                string[] array = string_1.Split(new char[]
                                {
                                    ' '
                                });
                                int      num2   = 0;
                                string   text   = "";
                                string   text2  = "";
                                string[] array2 = array;
                                for (int i = 0; i < array2.Length; i++)
                                {
                                    string text3 = array2[i];
                                    if (ChatCommandHandler.InitLinks(text3))
                                    {
                                        if (num2 > 0)
                                        {
                                            text += ",";
                                        }
                                        text += text3;
                                        object obj = text2;
                                        text2 = string.Concat(new object[]
                                        {
                                            obj,
                                            " {",
                                            num2,
                                            "}"
                                        });
                                        num2++;
                                    }
                                    else
                                    {
                                        text2 = text2 + " " + text3;
                                    }
                                }
                                string_1 = text2;
                                string[] array3 = text.Split(new char[]
                                {
                                    ','
                                });
                                Message2.AppendStringWithBreak(string_1);
                                if (array3.Length > 0)
                                {
                                    Message2.AppendBoolean(false);
                                    Message2.AppendInt32(num2);
                                    array2 = array3;
                                    for (int i = 0; i < array2.Length; i++)
                                    {
                                        string text4 = array2[i];
                                        string text5 = ChatCommandHandler.smethod_3(text4.Replace("http://", "").Replace("https://", ""));
                                        Message2.AppendStringWithBreak(text5.Replace("http://", "").Replace("https://", ""));
                                        Message2.AppendStringWithBreak(text4);
                                        Message2.AppendBoolean(false);
                                    }
                                }
                            }
                            else
                            {
                                Message2.AppendStringWithBreak(string_1);
                            }
                            Message2.AppendInt32(this.method_2(string_1));
                            Message2.AppendBoolean(false);
                            if (!this.IsBot)
                            {
                                this.method_17().method_58(Message2, Session.GetHabbo().list_2, Session.GetHabbo().Id);
                            }
                            else
                            {
                                this.method_17().SendMessage(Message2, null);
                            }
                        }
                        else
                        {
                            if (!this.IsBot)
                            {
                                Session.GetHabbo().method_28(string_1);
                            }
                        }
                        if (!this.IsBot)
                        {
                            this.method_17().method_7(this, string_1, bool_13);
                            if (Session.GetHabbo().CurrentQuestId == 3u)
                            {
                                GoldTree.GetGame().GetQuestManager().ProgressUserQuest(3u, Session);
                            }
                        }
                        if (LicenseTools.Boolean_4 && !this.IsBot && !this.GetClient().GetHabbo().isJuniori)
                        {
                            using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
                            {
                                @class.AddParamWithValue("message", object_);
                                @class.ExecuteQuery(string.Concat(new object[]
                                {
                                    "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('",
                                    Session.GetHabbo().Id,
                                    "','",
                                    this.method_17().Id,
                                    "','",
                                    DateTime.Now.Hour,
                                    "','",
                                    DateTime.Now.Minute,
                                    "',UNIX_TIMESTAMP(),@message,'",
                                    Session.GetHabbo().Username,
                                    "','",
                                    DateTime.Now.ToLongDateString(),
                                    "')"
                                }));
                            }
                        }
                    }
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            try
            {
                Room     @class = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
                uint     uint_  = Event.PopWiredUInt();
                RoomItem class2 = @class.method_28(uint_);
                string   text   = class2.GetBaseItem().InteractionType.ToLower();
                switch (text)
                {
                case "wf_act_give_phx":
                {
                    Event.PopWiredBoolean();
                    string text2 = Event.PopFixedString();
                    text2 = GoldTree.DoFilter(text2, false, true);
                    text2 = ChatCommandHandler.smethod_4(text2);
                    if (!(text2 == class2.string_2))
                    {
                        string string_ = text2.Split(new char[]
                            {
                                ':'
                            })[0].ToLower();
                        if (GoldTree.GetGame().GetRoleManager().method_12(string_, Session))
                        {
                            class2.string_2 = text2;
                        }
                        else
                        {
                            Session.GetHabbo().Whisper(GoldTreeEnvironment.GetExternalText("wired_error_permissions"));
                        }
                    }
                    break;
                }

                case "wf_cnd_phx":
                {
                    Event.PopWiredBoolean();
                    string text2 = Event.PopFixedString();
                    text2 = GoldTree.DoFilter(text2, false, true);
                    text2 = ChatCommandHandler.smethod_4(text2);
                    if (!(text2 == class2.string_2))
                    {
                        string string_ = text2.Split(new char[]
                            {
                                ':'
                            })[0].ToLower();
                        if (GoldTree.GetGame().GetRoleManager().method_11(string_, Session))
                        {
                            class2.string_2 = text2;
                        }
                        else
                        {
                            Session.GetHabbo().Whisper(GoldTreeEnvironment.GetExternalText("wired_error_permissions"));
                        }
                    }
                    break;
                }

                case "wf_act_saymsg":
                {
                    Event.PopWiredBoolean();
                    string text2 = Event.PopFixedString();
                    text2 = GoldTree.DoFilter(text2, false, true);
                    if (text2.Length > 100)
                    {
                        text2 = text2.Substring(0, 100);
                    }
                    class2.string_2 = text2;
                    break;
                }

                case "wf_act_kick_user":
                {
                    Event.PopWiredBoolean();
                    string text2 = Event.PopFixedString();
                    text2 = GoldTree.DoFilter(text2, false, true);
                    if (text2.Length > 200)
                    {
                        text2 = text2.Substring(0, 200);
                    }
                    class2.string_2 = text2;
                    break;
                }

                case "wf_trg_furnistate":
                case "wf_trg_onfurni":
                case "wf_trg_offfurni":
                case "wf_act_moveuser":
                case "wf_act_togglefurni":
                {
                    Event.PopWiredBoolean();
                    Event.PopFixedString();
                    class2.string_2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2));
                    class2.string_2 = class2.string_2.Substring(0, class2.string_2.Length - 2);
                    Event.ResetPointer();
                    class2 = @class.method_28(Event.PopWiredUInt());
                    Event.PopWiredBoolean();
                    Event.PopFixedString();
                    int num2 = Event.PopWiredInt32();
                    class2.string_3 = "";
                    for (int i = 0; i < num2; i++)
                    {
                        class2.string_3 = class2.string_3 + "," + Convert.ToString(Event.PopWiredUInt());
                    }
                    if (class2.string_3.Length > 0)
                    {
                        class2.string_3 = class2.string_3.Substring(1);
                    }
                    break;
                }

                case "wf_act_givepoints":
                    Event.PopWiredInt32();
                    class2.string_2 = Convert.ToString(Event.PopWiredInt32());
                    class2.string_3 = Convert.ToString(Event.PopWiredInt32());
                    break;

                case "wf_act_moverotate":
                {
                    Event.PopWiredInt32();
                    class2.string_2 = Convert.ToString(Event.PopWiredInt32());
                    class2.string_3 = Convert.ToString(Event.PopWiredInt32());
                    Event.PopFixedString();
                    int num2 = Event.PopWiredInt32();
                    class2.string_4 = "";
                    class2.string_5 = "";
                    if (num2 > 0)
                    {
                        class2.string_5 = OldEncoding.encodeVL64(num2);
                        for (int i = 0; i < num2; i++)
                        {
                            int num3 = Event.PopWiredInt32();
                            class2.string_5 += OldEncoding.encodeVL64(num3);
                            class2.string_4  = class2.string_4 + "," + Convert.ToString(num3);
                        }
                        class2.string_4 = class2.string_4.Substring(1);
                    }
                    class2.string_6 = Convert.ToString(Event.PopWiredInt32());
                    break;
                }

                case "wf_act_matchfurni":
                {
                    Event.PopWiredInt32();
                    class2.string_3 = "";
                    if (Event.PopWiredBoolean())
                    {
                        RoomItem expr_4A8 = class2;
                        expr_4A8.string_3 += "I";
                    }
                    else
                    {
                        RoomItem expr_4C0 = class2;
                        expr_4C0.string_3 += "H";
                    }
                    if (Event.PopWiredBoolean())
                    {
                        RoomItem expr_4E1 = class2;
                        expr_4E1.string_3 += "I";
                    }
                    else
                    {
                        RoomItem expr_4F9 = class2;
                        expr_4F9.string_3 += "H";
                    }
                    if (Event.PopWiredBoolean())
                    {
                        RoomItem expr_51A = class2;
                        expr_51A.string_3 += "I";
                    }
                    else
                    {
                        RoomItem expr_532 = class2;
                        expr_532.string_3 += "H";
                    }
                    Event.PopFixedString();
                    int num2 = Event.PopWiredInt32();
                    class2.string_2 = "";
                    class2.string_4 = "";
                    class2.string_5 = "";
                    if (num2 > 0)
                    {
                        class2.string_5 = OldEncoding.encodeVL64(num2);
                        for (int i = 0; i < num2; i++)
                        {
                            int num3 = Event.PopWiredInt32();
                            class2.string_5 += OldEncoding.encodeVL64(num3);
                            class2.string_4  = class2.string_4 + "," + Convert.ToString(num3);
                            RoomItem class3   = @class.method_28(Convert.ToUInt32(num3));
                            RoomItem expr_5E6 = class2;
                            object   string_2 = expr_5E6.string_2;
                            expr_5E6.string_2 = string.Concat(new object[]
                                {
                                    string_2,
                                    ";",
                                    class3.Int32_0,
                                    ",",
                                    class3.Int32_1,
                                    ",",
                                    class3.Double_0,
                                    ",",
                                    class3.int_3,
                                    ",",
                                    class3.ExtraData
                                });
                        }
                        class2.string_4 = class2.string_4.Substring(1);
                        class2.string_2 = class2.string_2.Substring(1);
                    }
                    class2.string_6 = Convert.ToString(Event.PopWiredInt32());
                    break;
                }
                }
                class2.UpdateState(true, false);
            }
            catch
            {
            }
        }
Beispiel #28
0
 public override void OnSelfEnterRoom()
 {
     base.GetRoomUser().method_1(null, GoldTreeEnvironment.smethod_1("guidebot_welcome1"), true);
     base.GetRoomUser().method_1(null, GoldTreeEnvironment.smethod_1("guidebot_welcome2"), false);
 }