Example #1
0
        public void method_15(GameClient Session, uint uint_0, string string_0, bool bool_0)
        {
            GameClient @class = Essential.GetGame().GetClientManager().GetClient(uint_0);

            if (@class != null && @class.GetHabbo().CurrentRoomId >= 1u && @class.GetHabbo().Id != Session.GetHabbo().Id)
            {
                if (@class.GetHabbo().Rank >= Session.GetHabbo().Rank)
                {
                    Session.SendNotification(EssentialEnvironment.GetExternalText("mod_error_permission_kick"));
                }
                else
                {
                    Room class2 = Essential.GetGame().GetRoomManager().GetRoom(@class.GetHabbo().CurrentRoomId);
                    if (class2 != null)
                    {
                        class2.RemoveUserFromRoom(@class, true, false);
                        if (!bool_0)
                        {
                            @class.SendNotification(string_0);
                            using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
                            {
                                class3.ExecuteQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = '" + uint_0 + "' LIMIT 1");
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        public void method_16(GameClient Session, uint uint_0, string string_0, bool bool_0)
        {
            GameClient @class = Essential.GetGame().GetClientManager().GetClient(uint_0);

            if (@class != null && @class.GetHabbo().Id != Session.GetHabbo().Id)
            {
                if (bool_0 && @class.GetHabbo().Rank >= Session.GetHabbo().Rank)
                {
                    Session.SendNotification(EssentialEnvironment.GetExternalText("mod_error_permission_caution"));
                    //bool_0 = false;
                    return;
                }
                @class.SendNotification(string_0, 0);
                //if (bool_0)
                //{
                using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                {
                    try
                    {
                        class2.AddParamWithValue("description", string_0);
                        class2.AddParamWithValue("timestamp", (int)Essential.GetUnixTimestamp());
                        class2.ExecuteQuery("INSERT INTO hp_verwarnungen (user_id,title,beschreibung,timestamp,endtimestamp_verwarnung,mod_id,mod_ip) VALUES (" + uint_0 + ",'Mod-Tool',@description,@timestamp,'0'," + Session.GetHabbo().Id + ",'" + Session.GetConnection().LocalEndPoint.ToString().Split(':')[0] + "')");
                        class2.ExecuteQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = '" + uint_0 + "' LIMIT 1");
                    }catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }
                //}
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null)
            {
                if ([email protected])
                {
                    Session.GetHabbo().Whisper(EssentialEnvironment.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(EssentialEnvironment.GetExternalText("trade_error_targetdisabled"));
                    }
                }
            }
        }
Example #4
0
        public void method_12(GameClient Session, uint uint_0, bool bool_0, bool bool_1, bool bool_2)
        {
            Room @class = Essential.GetGame().GetRoomManager().GetRoom(uint_0);

            if (@class != null)
            {
                if (bool_1)
                {
                    @class.State = 1;
                    using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                    {
                        class2.ExecuteQuery("UPDATE rooms SET state = 'locked' WHERE Id = '" + @class.Id + "' LIMIT 1");
                    }
                }
                if (bool_2)
                {
                    @class.Name        = EssentialEnvironment.GetExternalText("mod_inappropriate_roomname");
                    @class.Description = EssentialEnvironment.GetExternalText("mod_inappropriate_roomdesc");
                    @class.Tags.Clear();
                    using (DatabaseClient class2 = Essential.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.RoomUsers.Length; i++)
                    {
                        RoomUser class3 = @class.RoomUsers[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.RemoveUserFromRoom(list[i].GetClient(), true, false);
                    }
                }
            }
        }
Example #5
0
        public void method_17(GameClient Session, uint uint_0, int int_0, string string_0)
        {
            GameClient @class = Essential.GetGame().GetClientManager().GetClient(uint_0);

            if (@class != null && @class.GetHabbo().Id != Session.GetHabbo().Id)
            {
                if (@class.GetHabbo().Rank >= Session.GetHabbo().Rank)
                {
                    Session.SendNotification(EssentialEnvironment.GetExternalText("mod_error_permission_ban"));
                }
                else
                {
                    double double_ = (double)int_0;
                    Essential.GetGame().GetBanManager().BanUser(@class, Session.GetHabbo().Username, double_, string_0, false);
                }
            }
        }
Example #6
0
        public void Handle(GameClient session, ClientMessage message)
        {
            Room room = Essential.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(EssentialEnvironment.GetExternalText("error_maxpets") + ServerConfiguration.PetsPerRoomLimit);
                        }
                        else
                        {
                            try
                            {
                                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.Pet, "freeroam", pet.Name, "", pet.Look, num, num2, 0, 0, 0, 0, 0, 0, ref list, ref list2, 0), pet);
                                session.GetHabbo().GetInventoryComponent().RemovePetById(pet.PetId);
                            }catch (Exception ex)
                            {
                                Console.WriteLine(ex.ToString());
                            }
                        }
                    }
                }
            }
        }
Example #7
0
        public void MuteUser(GameClient Session, uint userId, string Message, int TimeInMinutes)
        {
            GameClient TargetClient = Essential.GetGame().GetClientManager().GetClient(userId);

            if (TargetClient != null && TargetClient.GetHabbo().CurrentRoomId >= 1u && TargetClient.GetHabbo().Id != Session.GetHabbo().Id)
            {
                if (TargetClient.GetHabbo().Rank >= Session.GetHabbo().Rank)
                {
                    Session.SendNotification(EssentialEnvironment.GetExternalText("mod_error_permission_kick"));
                }
                else
                {
                    TargetClient.GetHabbo().IsMuted    = true;
                    TargetClient.GetHabbo().UnmuteTime = (int)Essential.GetUnixTimestamp() + (TimeInMinutes * 60);
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        dbClient.ExecuteQuery("UPDATE users SET is_muted='1' WHERE id=" + userId);
                        dbClient.ExecuteQuery("UPDATE users SET unmute_timestamp='" + TargetClient.GetHabbo().UnmuteTime + "' WHERE id=" + userId);
                    }
                    TargetClient.SendNotification(Message);
                }
            }
        }
Example #8
0
        public void SetInApp(uint uint_0)
        {
            Room @class = Essential.GetGame().GetRoomManager().GetRoom(uint_0);

            if (@class != null)
            {
                @class.Name        = EssentialEnvironment.GetExternalText("mod_inappropriate_roomname");
                @class.Description = EssentialEnvironment.GetExternalText("mod_inappropriate_roomdesc");
                @class.Tags.Clear();
                using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                {
                    class2.ExecuteQuery(string.Concat(new object[]
                    {
                        "UPDATE rooms SET caption = '",
                        @class.Name,
                        "', description = '",
                        @class.Description,
                        "', tags = '' WHERE Id = '",
                        @class.Id,
                        "' LIMIT 1"
                    }));
                }
            }
        }
Example #9
0
        internal void tryLogin(string AuthTicket)
        {
            try
            {
                UserDataFactory @class = new UserDataFactory(AuthTicket, this.GetConnection().String_0, true);
                if ([email protected])
                {
                    @class = new UserDataFactory(AuthTicket, this.GetConnection().String_0, true);
                }
                if ([email protected])
                {
                    string str = "";
                    if (ServerConfiguration.EnableSSO)
                    {
                        str = EssentialEnvironment.GetExternalText("emu_sso_wrong_secure") + "(" + this.GetConnection().String_0 + ")";
                    }
                    SendNotifWithScroll(EssentialEnvironment.GetExternalText("emu_sso_wrong") + str);
                    return;
                }
                Habbo class2 = Authenticator.CreateHabbo(AuthTicket, this, @class, @class);
                Essential.GetGame().GetClientManager().Disconnect(class2.Id, "New Session");
                this.Habbo = class2;
                this.Habbo.method_2(@class);
            }
            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.Disconnect("Login Error");
                }
                return;
            }

            try
            {
                Essential.GetGame().GetBanManager().method_1(this);
            }
            catch (ModerationBanException gException)
            {
                this.NotifyBan(gException.Message);
                this.Disconnect("Banned!");
                return;
            }
            #region "AKS"
            if (this.MachineId != "" && !Essential.StringToBoolean(this.GetHabbo().GetUserDataFactory().GetUserData()["staff_inacc"].ToString()))
            {
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    string oldMachineId = dbClient.SpecialString("SELECT machineId FROM user_machineids WHERE userid=" + this.GetHabbo().Id);

                    dbClient.AddParamWithValue("machineid", this.MachineId);
                    if ((oldMachineId == "" || oldMachineId != this.MachineId))
                    {
                        dbClient.AddParamWithValue("username", this.GetHabbo().Username);
                        dbClient.ExecuteQuery("INSERT INTO user_machineids (username,userid,timestamp,machineId) VALUES (@username," + this.GetHabbo().Id + ",'" + Convert.ToInt32(Essential.GetUnixTimestamp()) + "',@machineid)");
                    }
                }
            }
            #endregion
            ServerMessage Message2 = new ServerMessage(Outgoing.Fuserights);
            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(Outgoing.AvailabilityStatus);
            Message3.AppendBoolean(true);
            Message3.AppendBoolean(false);
            this.SendMessage(Message3);
            ServerMessage message = new ServerMessage(Outgoing.UniqueID);
            message.AppendString(this.MachineId);
            this.SendMessage(message);
            ServerMessage Message5_ = new ServerMessage(Outgoing.AuthenticationOK);
            this.SendMessage(Message5_);

            if (GetHabbo().HomeRoomId <= 0)
            {
                GetHabbo().HomeRoomId = 64259;
            }
            ServerMessage Message5 = new ServerMessage(Outgoing.HomeRoom);
            Message5.AppendUInt(this.GetHabbo().HomeRoomId);
            Message5.AppendUInt(this.GetHabbo().HomeRoomId);
            this.SendMessage(Message5);
            Console.WriteLine("[" + this.GetConnection().UInt32_0 + "] [" + this.GetHabbo().Username + "] [" + this.GetHabbo().Id + "] [" + this.GetConnection().String_0 + "] [" + DateTime.Now.Hour + ":" + DateTime.Now.Minute + "]");
            GetHabbo().UpdateCredits(false);
            GetHabbo().UpdateActivityPoints(false);
            if (this.GetHabbo().HasFuse("acc_supporttool"))
            {
                this.SendMessage(Essential.GetGame().GetModerationTool().SerializeTool());
                Essential.GetGame().GetModerationTool().method_4(this);
            }
            if (Essential.GetGame().GetPixelManager().CanHaveReward(this))
            {
                Essential.GetGame().GetPixelManager().UpdateNeeded(this);
            }

            ServerMessage Message6 = new ServerMessage(Outgoing.FavouriteRooms);
            Message6.AppendInt32(30);
            Message6.AppendInt32(this.GetHabbo().list_1.Count);
            foreach (uint current in this.GetHabbo().list_1)
            {
                Message6.AppendUInt(current);
            }
            this.SendMessage(Message6);
            try
            {
                this.GetHabbo().CheckTotalTimeOnlineAchievements();
                this.GetHabbo().CheckHappyHourAchievements();
                this.GetHabbo().CheckTrueHabboAchievements();
                this.GetHabbo().CheckRegularVisitorAchievements();
                this.GetHabbo().CheckFootballGoalHostScoreAchievements();
                this.GetHabbo().CheckStaffPicksAchievement();
            }
            catch { }
            if (ServerConfiguration.MOTD != "")
            {
                this.SendNotification(ServerConfiguration.MOTD, 2);
            }
            for (uint num = (uint)Essential.GetGame().GetRoleManager().GetRankCount(); num > 1u; num -= 1u)
            {
                if (Essential.GetGame().GetRoleManager().GetBadgeByRank(num).Length > 0)
                {
                    if (!this.GetHabbo().GetBadgeComponent().HasBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(num)) && this.GetHabbo().Rank == num)
                    {
                        this.GetHabbo().GetBadgeComponent().SendBadge(this, Essential.GetGame().GetRoleManager().GetBadgeByRank(num), true);
                    }
                    else
                    {
                        if (this.GetHabbo().GetBadgeComponent().HasBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(num)) && this.GetHabbo().Rank < num)
                        {
                            this.GetHabbo().GetBadgeComponent().RemoveBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(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)
            {
                Essential.GetGame().GetQuestManager().ActivateQuest(this.GetHabbo().CurrentQuestId, this);
            }
            if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$"))
            {
                ServerMessage Message5_2 = new ServerMessage(Outgoing.Disconnect);
                this.SendMessage(Message5_2);
            }
            this.GetHabbo().Motto = Essential.FilterString(this.GetHabbo().Motto);
            DataTable dataTable = null;
            using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
            {
                dataTable = class3.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'");
            }
            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    Essential.GetGame().GetAchievementManager().addAchievement(this, (uint)dataRow["achievement"], (int)dataRow["achlevel"]);
                    using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
                    {
                        class3.ExecuteQuery(string.Concat(new object[]
                        {
                            "DELETE FROM achievements_owed WHERE achievement = '",
                            (uint)dataRow["achievement"],
                            "' AND user = '******' LIMIT 1"
                        }));
                    }
                }
            }
            if (this.GetHabbo().list_2 != null && this.GetHabbo().list_2.Count > 0)
            {
                ServerMessage IgnoringList = new ServerMessage(Outgoing.IgnoringList);
                IgnoringList.AppendInt32(this.GetHabbo().list_2.Count);
                foreach (uint userId in this.GetHabbo().list_2)
                {
                    IgnoringList.AppendString(Essential.GetGame().GetClientManager().GetNameById(userId));
                }
                this.SendMessage(IgnoringList);
            }
            //this.GetClientMessageHandler().method_5(this.GetHabbo().HomeRoomId, "");
        }
Example #10
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && Session != null && Session.GetHabbo().PassedSafetyQuiz)
            {
                Session.GetHabbo().CheckForUnmute();
                if (Session.GetHabbo().IsMuted)
                {
                    Session.SendNotification(EssentialEnvironment.GetExternalText("error_muted"));
                }
                else
                {
                    if (Session.GetHabbo().HasFuse("ignore_roommute") || [email protected]_4)
                    {
                        string text = Essential.FilterString(Event.PopFixedString());
                        if (!String.IsNullOrEmpty(text) || !String.IsNullOrWhiteSpace(text))
                        {
                            string text2 = text.Split(new char[]
                            {
                                ' '
                            })[0];
                            string text3 = text.Substring(text2.Length + 1);
                            text3 = ChatCommandHandler.ApplyFilter(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(Outgoing.FloodFilter);
                                    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(Outgoing.Whisp); // OLD 25 UPDATED
                            Message2.AppendInt32(class2.VirtualId);
                            Message2.AppendStringWithBreak(text3);
                            Message2.AppendInt32(0);
                            Message2.AppendInt32(Event.PopWiredInt32());
                            Message2.AppendInt32(0);
                            Message2.AppendInt32(-1);
                            if (class2 != null && !class2.IsBot && !Essential.GetAntiAd().ContainsIllegalWord(text3))
                            {
                                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)))
                            {
                                if (!Essential.GetAntiAd().ContainsIllegalWord(text3))
                                {
                                    class3.GetClient().SendMessage(Message2);
                                }
                                if (ServerConfiguration.EnableChatlog)
                                {
                                    using (DatabaseClient class4 = Essential.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(),
                                            "')"
                                        }));
                                    }
                                }
                                if (Essential.GetAntiAd().ContainsIllegalWord(text3))
                                {
                                    ServerMessage Message3 = new ServerMessage(Outgoing.InstantChat);
                                    Message3.AppendUInt(0u);
                                    Message3.AppendString("[AWS] " + Session.GetHabbo().Username + ": " + text3);
                                    Message3.AppendString(Essential.GetUnixTimestamp() + string.Empty);
                                    Essential.GetGame().GetClientManager().SendToStaffs(Session, Message3);
                                    Session.SendNotification(Essential.GetGame().GetRoleManager().GetConfiguration().getData("antiad.alert"));
                                }
                            }
                        }
                    }
                }
            }
        }
Example #11
0
        public void ParsePacket(string data)
        {
            string text = data.Split(new char[]
            {
                Convert.ToChar(1)
            })[0];

            string text2 = data.Split(new char[]
            {
                Convert.ToChar(1)
            })[1];

            GameClient client  = 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
                        },
                        {
                            "update_badges",
                            29
                        },
                        {
                            "update_navigator",
                            40
                        },
                        {
                            "startquestion",
                            31
                        },
                        {
                            "roomkick",
                            37
                        },
                        {
                            "setinapp",
                            38
                        },
                        {
                            "lockroom",
                            39
                        },
                        {
                            "updatelook",
                            28
                        },
                        {
                            "infobuspoll",
                            34
                        },
                        {
                            "givebadge",
                            32
                        },
                        {
                            "update_permissions",
                            33
                        },
                        {
                            "update_catalogid",
                            35
                        },
                        {
                            "addFriend",
                            36
                        },
                        {
                            "ref_websocket",
                            50
                        },
                        {
                            "eventha",
                            51
                        }
                    };
                }

                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 = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetItemManager().Initialize(class2);

                            goto IL_C70;
                        }

                    case 1:
                    case 2:
                        break;

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

                    case 4:
                        goto IL_34E;

                    case 5:
                    {
                        Habbo class3 = Essential.GetGame().GetClientManager().GetClient(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            class3.UpdateRights();
                            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);
                        Essential.GetGame().GetCatalog().CreateGift(string_, num2, uint_, int_);

                        goto IL_C70;
                    }

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

                    case 37:
                        num3 = uint.Parse(text2.Split(new char[]
                        {
                            ' '
                        })[0]);

                        class4 = Essential.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            Essential.GetGame().GetModerationTool().ClearRoomFromUsers(num3);
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 38:
                        num3 = uint.Parse(text2.Split(new char[]
                        {
                            ' '
                        })[0]);

                        class4 = Essential.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            Essential.GetGame().GetModerationTool().SetInApp(num3);
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 39:
                        num3 = uint.Parse(text2.Split(new char[]
                        {
                            ' '
                        })[0]);

                        class4 = Essential.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            Essential.GetGame().GetModerationTool().LockRoom(num3);
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 40:
                        using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetNavigator().Initialize(dbClient);
                            Essential.GetGame().GetRoomManager().method_8(dbClient);
                            Essential.GetGame().GetRoomManager().LoadMagicTiles(dbClient);
                            Essential.GetGame().GetRoomManager().LoadBillboards(dbClient);
                        }
                        goto IL_C70;

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

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

                    case 11:
                        goto IL_5BF;

                    case 12:
                        goto IL_602;

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

                    case 15:
                        goto IL_633;

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

                    case 17:
                        goto IL_6F7;

                    case 18:
                        client = Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2));
                        if (client != null)
                        {
                            client.GetHabbo().UpdateVipPoints(true, false);
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 19:
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetBanManager().Initialise(class2);
                        }
                        Essential.GetGame().GetClientManager().UpdateBans();
                        goto IL_C70;

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

                    case 21:
                        goto IL_839;

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

                    case 23:
                        goto IL_880;

                    case 24:
                    {
                        ServerMessage Message = new ServerMessage(Outgoing.InstantChat);
                        Message.AppendUInt(0u);
                        Message.AppendString("Habbo: " + text2);
                        Message.AppendString(Essential.GetUnixTimestamp() + string.Empty);
                        Essential.GetGame().GetClientManager().SendToStaffs(Message, Message);
                        goto IL_C70;
                    }

                    case 25:
                    {
                        ServerMessage Message2 = new ServerMessage(Outgoing.BroadcastMessage);
                        Message2.AppendStringWithBreak(EssentialEnvironment.GetExternalText("mus_ha_title") + "\n\n" + text2);
                        Message2.AppendStringWithBreak("");

                        /*ServerMessage Message3 = new ServerMessage(161u);
                         * Message3.AppendStringWithBreak(text2);
                         */
                        Essential.GetGame().GetClientManager().SendToHotel(Message2, Message2);
                        goto IL_C70;
                    }

                    case 26:
                    {
                        string text4 = text2.Split(new char[]
                            {
                                ' '
                            })[0];
                        text5 = text2.Substring(text4.Length + 1);
                        ServerMessage Message4 = new ServerMessage(Outgoing.SendNotif); // Updated
                        Message4.AppendStringWithBreak(string.Concat(new string[]
                            {
                                EssentialEnvironment.GetExternalText("mus_hal_title"),
                                "\r\n",
                                text5,
                                "\r\n-",
                                EssentialEnvironment.GetExternalText("mus_hal_tail")
                            }));
                        Message4.AppendStringWithBreak(text4);
                        Essential.GetGame().GetClientManager().BroadcastMessage(Message4);
                        goto IL_C70;
                    }

                    case 29:
                    {
                        num3 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        uint UserIidu3 = num3;
                        client = Essential.GetGame().GetClientManager().GetClient(UserIidu3);
                        if (client != null)
                        {
                            client.GetHabbo().GetBadgeComponent().AddBadge(text2.Split(new char[]
                                {
                                    ' '
                                })[1], 0, false);
                        }

                        ServerMessage Message = new ServerMessage(Outgoing.AddBadge);

                        Message.AppendInt32(1);
                        Message.AppendInt32(4);
                        Message.AppendInt32(1);

                        Message.AppendUInt(0);

                        client.SendMessage(Message);

                        client.SendMessage(client.GetHabbo().GetBadgeComponent().ComposeBadgeListMessage());


                        goto IL_C70;
                    }

                    case 30:
                    {
                        uint UserIidu = uint.Parse(text2);
                        client = Essential.GetGame().GetClientManager().GetClient(UserIidu);
                        if (client != null)
                        {
                            if (client.GetHabbo().InRoom)
                            {
                                if (client.GetHabbo().CurrentRoom.CCTs.Contains("park"))
                                {
                                    if (!client.GetHabbo().CurrentRoom.IsInfobusOpen)
                                    {
                                        client.GetHabbo().CurrentRoom.IsInfobusOpen = true;
                                    }
                                    else
                                    {
                                        client.GetHabbo().CurrentRoom.IsInfobusOpen = false;
                                    }

                                    for (int i = 0; i < client.GetHabbo().CurrentRoom.RoomUsers.Length; i++)
                                    {
                                        RoomUser RoomiUser = client.GetHabbo().CurrentRoom.RoomUsers[i];
                                        if (RoomiUser != null)
                                        {
                                            ServerMessage ParkBusDoorMessage = new ServerMessage(Outgoing.ParkBusDoor);
                                            ParkBusDoorMessage.AppendBoolean(client.GetHabbo().CurrentRoom.IsInfobusOpen);
                                            RoomiUser.GetClient().SendMessage(ParkBusDoorMessage);
                                        }
                                    }
                                }
                                else
                                {
                                    // client.SendNotification("Sinun täytyy olla puistossa avataksesi tietolinjurin oven!");
                                }
                            }
                        }
                        goto IL_C70;
                    }

                    case 355:
                    {
                        uint UserIidu2 = uint.Parse(text2.Split(';')[0]);
                        client = Essential.GetGame().GetClientManager().GetClient(UserIidu2);
                        if (client != null)
                        {
                            if (client.GetHabbo().InRoom)
                            {
                                Room      Room       = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                                DataTable Data       = null;
                                int       QuestionId = int.Parse(text2.Split(';')[1]);
                                Room.CurrentPollId = QuestionId;
                                string Question;

                                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                                {
                                    Question = dbClient.ReadString("SELECT question FROM infobus_questions WHERE id = '" + QuestionId + "' LIMIT 1");
                                    Data     = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id = '" + QuestionId + "'");
                                }

                                ServerMessage InfobusQuestion = new ServerMessage(Outgoing.InfobusPoll3); // Updated
                                InfobusQuestion.AppendStringWithBreak(Question);
                                InfobusQuestion.AppendInt32(Data.Rows.Count);
                                if (Data != null)
                                {
                                    foreach (DataRow Row in Data.Rows)
                                    {
                                        InfobusQuestion.AppendInt32((int)Row["id"]);
                                        InfobusQuestion.AppendStringWithBreak((string)Row["answer_text"]);
                                    }
                                }
                                Room.SendMessage(InfobusQuestion, null);

                                Thread Infobus = new Thread(delegate() { Room.ShowResults(Room, QuestionId, client); });
                                Infobus.Start();
                            }
                        }
                        goto IL_C70;
                    }

                    case 27:
                    case 28:
                    {
                        uint_2 = uint.Parse(text2);
                        client = Essential.GetGame().GetClientManager().GetClient(uint_2);
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            dataRow = class2.ReadDataRow("SELECT look,gender,motto,mutant_penalty,block_newfriends FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1");
                        }
                        client.GetHabbo().Figure          = (string)dataRow["look"];
                        client.GetHabbo().Gender          = dataRow["gender"].ToString().ToLower();
                        client.GetHabbo().Motto           = Essential.FilterString((string)dataRow["motto"]);
                        client.GetHabbo().BlockNewFriends = Essential.StringToBoolean(dataRow["block_newfriends"].ToString());

                        /*ServerMessage Message5 = new ServerMessage(Outgoing.UpdateUserInformation);
                         *                      Message5.AppendInt32(-1);
                         *                      Message5.AppendStringWithBreak(client.GetHabbo().Figure);
                         *                      Message5.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                         *                      Message5.AppendStringWithBreak(client.GetHabbo().Motto);
                         *                      client.SendMessage(Message5);*/
                        if (client.GetHabbo().InRoom)
                        {
                            class4 = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                            RoomUser      class6   = class4.GetRoomUserByHabbo(client.GetHabbo().Id);
                            ServerMessage Message6 = new ServerMessage(Outgoing.UpdateUserInformation);
                            Message6.AppendInt32(class6.VirtualId);
                            Message6.AppendStringWithBreak(client.GetHabbo().Figure);
                            Message6.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            Message6.AppendStringWithBreak(client.GetHabbo().Motto);
                            Message6.AppendInt32(client.GetHabbo().AchievementScore);
                            class4.SendMessage(Message6, null);
                        }
                        text3 = text.ToLower();
                        if (text3 == null)
                        {
                            goto IL_C70;
                        }
                        if (text3 == "updatemotto")
                        {
                            class4 = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                            RoomUser      class6   = class4.GetRoomUserByHabbo(client.GetHabbo().Id);
                            ServerMessage Message6 = new ServerMessage(Outgoing.UpdateUserInformation);
                            Message6.AppendInt32(class6.VirtualId);
                            Message6.AppendStringWithBreak(client.GetHabbo().Figure);
                            Message6.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            Message6.AppendStringWithBreak(client.GetHabbo().Motto);
                            Message6.AppendInt32(client.GetHabbo().AchievementScore);
                            class4.SendMessage(Message6, null);
                            client.GetHabbo().MottoAchievementsCompleted();
                            goto IL_C70;
                        }
                        if (text3 == "updatelook")
                        {
                            ServerMessage serverMessage = new ServerMessage(Outgoing.UpdateUserInformation);
                            serverMessage.AppendInt32(-1);
                            serverMessage.AppendStringWithBreak(client.GetHabbo().Figure);
                            serverMessage.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            serverMessage.AppendStringWithBreak(client.GetHabbo().Motto);
                            serverMessage.AppendInt32(client.GetHabbo().AchievementScore);
                            // serverMessage.AppendStringWithBreak("");
                            client.SendMessage(serverMessage);
                            class4 = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                            RoomUser      class6   = class4.GetRoomUserByHabbo(client.GetHabbo().Id);
                            ServerMessage Message6 = new ServerMessage(Outgoing.UpdateUserInformation);
                            Message6.AppendInt32(class6.VirtualId);
                            Message6.AppendStringWithBreak(client.GetHabbo().Figure);
                            Message6.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            Message6.AppendStringWithBreak(client.GetHabbo().Motto);
                            Message6.AppendInt32(client.GetHabbo().AchievementScore);
                            class4.SendMessage(Message6, null);
                            client.GetHabbo().AvatarLookAchievementsCompleted();
                            goto IL_C70;
                        }
                        goto IL_C70;
                    }

                    case 31:
                    {
                        int QuestionID = int.Parse(text2.Split(';')[1]);
                        using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                        {
                            DataRow   QuestionRow  = dbClient.ReadDataRow("SELECT * FROM infobus_questions WHERE id='" + QuestionID + "' LIMIT 1");
                            DataTable AnswersTable = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id='" + QuestionID + "'");
                            Room      PollRoom     = Essential.GetGame().GetClientManager().GetClientByHabbo(QuestionRow["owner"].ToString()).GetHabbo().CurrentRoom;
                            if (PollRoom.Owner == QuestionRow["owner"].ToString() || Essential.GetGame().GetClientManager().GetClientByHabbo(QuestionRow["owner"].ToString()).GetHabbo().Rank < 5)
                            {
                                PollRoom.GetPollManager().SetCurrentPoll(PollRoom.GetPollManager().CreateNewRoomPoll(QuestionRow, AnswersTable));
                                PollRoom.SendMessage(PollRoom.GetPollManager().GetCurrentPoll().PollToServerMessage(new ServerMessage(Outgoing.InfobusPoll3)), null);
                                Thread Poll = new Thread(delegate() { PollRoom.GetPollManager().GetCurrentPoll().ShowResults(); });
                                Poll.Start();
                            }
                        }

                        goto IL_C70;
                    }

                    case 32:
                    {
                        uint   UserId    = uint.Parse(text2.Split(new char[] { ' ' })[0]);
                        string BadgeCode = text2.Split(new char[] { ' ' })[1];

                        GameClient Session = Essential.GetGame().GetClientManager().GetClientByHabbo(Essential.GetGame().GetClientManager().GetNameById(UserId));
                        if (Session != null)
                        {
                            Session.GetHabbo().GetBadgeComponent().SendBadge(Session, BadgeCode, true);
                        }
                        else
                        {
                            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                            {
                                DataRow dr = dbClient.ReadDataRow("SELECT username FROM users WHERE id=" + UserId + " LIMIT 1");
                                if (dr != null)
                                {
                                    dbClient.AddParamWithValue("badge", BadgeCode);
                                    DataRow dr2 = dbClient.ReadDataRow("SELECT * FROM user_badges WHERE user_id=" + UserId + " AND badge_id=@badge LIMIT 1");
                                    if (dr2 == null)
                                    {
                                        dbClient.AddParamWithValue("badge", BadgeCode);
                                        dbClient.ExecuteQuery(string.Concat(new object[]
                                            {
                                                "INSERT INTO user_badges (user_id,badge_id,badge_slot) VALUES ('",
                                                UserId,
                                                "',@badge,'0')"
                                            }));
                                    }
                                }
                            }
                        }
                    }
                        goto IL_C70;

                    case 33:
                        using (DatabaseClient class5 = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetRoleManager().Initialize(class5);
                        }
                        goto IL_C70;

                    case 35:
                    {
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            Essential.GetGame().GetCatalog().Initialize(class2);
                        }
                        Essential.GetGame().GetCatalog().InitializeCache();
                        goto IL_C70;
                    }

                    case 36:
                    {
                        uint sender   = uint.Parse(text2.Split(new char[] { ' ' })[0]);
                        uint reciever = uint.Parse(text2.Split(new char[] { ' ' })[1]);
                        if (!this.FriendshipExists(reciever, sender))
                        {
                            using (DatabaseClient @class = Essential.GetDatabase().GetClient())
                            {
                                @class.AddParamWithValue("toid", reciever);
                                @class.AddParamWithValue("userid", sender);
                                @class.ExecuteQuery("INSERT INTO messenger_friendships (user_one_id,user_two_id) VALUES (@userid,@toid)");
                                @class.ExecuteQuery("INSERT INTO messenger_friendships (user_one_id,user_two_id) VALUES (@toid,@userid)");
                            }
                            GameClient SenderClient   = Essential.GetGame().GetClientManager().GetClient(sender);
                            GameClient RecieverClient = Essential.GetGame().GetClientManager().GetClient(reciever);
                            if (RecieverClient != null)
                            {
                                RecieverClient.GetHabbo().GetMessenger().method_14(sender);
                            }
                            if (SenderClient != null)
                            {
                                SenderClient.GetHabbo().GetMessenger().method_14(reciever);
                            }
                        }
                        goto IL_C70;
                    }

                    case 50:
                    {
                        Essential.getWebSocketManager().Dispose();
                        Essential.InitWebsocketManager();
                        goto IL_C70;
                    }

                    case 51:
                    {
                        Room   room      = Essential.GetGame().GetRoomManager().GetRoom(uint.Parse(text2.Split(';')[0]));
                        string Eventname = text2.Split(';')[1];
                        if (Eventname.Length > 1)
                        {
                            Eventname = AntiAd.Utf8ToUtf16(Eventname);
                            string toSend = "5|" + Eventname + "|" + room.Owner + "|" + room.Id;
                            Essential.getWebSocketManager().SendMessageToEveryConnection(toSend);
                            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                            {
                                dbClient.AddParamWithValue("param1", room.Id);
                                dbClient.AddParamWithValue("param2", Eventname);
                                dbClient.ExecuteQuery("INSERT INTO hp_aktivitaetenstream (`user_id`,`type`,`extra_data`,`extra_data2`,`timestamp`) VALUES ('" + room.OwnerId + "','makeevent',@param1,@param2,'" + Convert.ToInt32(Essential.GetUnixTimestamp()) + "');");
                            }
                        }
                        goto IL_C70;
                    }

                    default:
                        goto IL_C70;
                    }
                    using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                    {
                        Essential.GetGame().GetCatalog().Initialize(class2);
                    }
                    Essential.GetGame().GetCatalog().InitializeCache();
                    Essential.GetGame().GetClientManager().BroadcastMessage(new ServerMessage(Outgoing.UpdateShop)); // Updated
                    goto IL_C70;
IL_34E:
                    num2 = uint.Parse(text2.Split(new char[]
                    {
                        ' '
                    })[0]);
                    num3 = uint.Parse(text2.Split(new char[]
                    {
                        ' '
                    })[1]);
                    GameClient class7 = Essential.GetGame().GetClientManager().GetClient(num2);
                    class4 = Essential.GetGame().GetRoomManager().GetRoom(num3);
                    if (class7 != null)
                    {
                        ServerMessage Message = new ServerMessage(Outgoing.RoomForward);
                        Message.AppendBoolean(class4.IsPublic);
                        Message.AppendUInt(class4.Id);
                        class7.SendMessage(Message);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_5BF:
                    uint_2 = uint.Parse(text2);
                    using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                    {
                        Essential.GetGame().GetClientManager().GetClient(uint_2).GetHabbo().method_0(class2);
                        goto IL_C70;
                    }
IL_602:
                    Essential.Close();
                    goto IL_C70;
IL_633:
                    client = Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2));
                    if (client != null)
                    {
                        int int_3 = 0;
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            int_3 = (int)class2.ReadDataRow("SELECT credits FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1")[0];
                        }
                        client.GetHabbo().SetCredits(int_3, "MUS UPDATE", "");
                        client.GetHabbo().UpdateCredits(false);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_6F7:
                    client = Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2));
                    if (client != null)
                    {
                        int int_4 = 0;
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            int_4 = (int)class2.ReadDataRow("SELECT activity_points FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1")[0];
                        }
                        client.GetHabbo().ActivityPoints = int_4;
                        client.GetHabbo().UpdateActivityPoints(false);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_839:
                    Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2)).Disconnect("MUS");
                    goto IL_C70;
IL_880:
                    string text6 = text2.Split(new char[]
                    {
                        ' '
                    })[0];
                    text5 = text2.Substring(text6.Length + 1);

                    Essential.GetGame().GetClientManager().GetClient(uint.Parse(text6)).SendNotification(text5);
                }
            }
IL_C70:
            try
            {
                ServerMessage Message9 = new ServerMessage(Outgoing.MusAnswer);
                Message9.AppendString("Essential 5");
                Message9.AppendString("MUS Handler");
                this.ClientSocket.Send(Message9.GetBytes());
            }
            catch {}
        }
Example #12
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            try
            {
                Room     @class = Essential.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.PopWiredInt32();
                    string text2 = Event.PopFixedString();
                    text2 = Essential.DoFilter(text2, false, true);
                    text2 = ChatCommandHandler.ApplyFilter(text2);
                    if (!(text2 == class2.string_2))
                    {
                        string string_ = text2.Split(new char[]
                            {
                                ':'
                            })[0].ToLower();
                        if (Essential.GetGame().GetRoleManager().HasSuperWiredFXFuse(string_, Session))
                        {
                            class2.string_2 = text2;
                        }
                        else
                        {
                            Session.GetHabbo().Whisper(EssentialEnvironment.GetExternalText("wired_error_permissions"));
                        }
                    }
                    break;
                }

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

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

                case "wf_act_kick_user":
                {
                    Event.PopWiredInt32();
                    string text2 = Event.PopFixedString();
                    text2 = Essential.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.PopWiredInt32();
                    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);
                    }
                    class2.string_2 = (Convert.ToDouble(Event.PopWiredInt32()) / 2) + "";
                    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.PopWiredBoolean();
                    Event.PopWiredBoolean();
                    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();
                    Event.PopWiredBoolean();
                    Event.PopWiredBoolean();

                    class2.string_3 = "";

                    RoomItem expr_4A8 = class2;
                    expr_4A8.string_3 += "I";


                    RoomItem expr_4E1 = class2;
                    expr_4E1.string_3 += "I";

                    RoomItem expr_51A = class2;
                    expr_51A.string_3 += "I";

                    // 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.GetX,
                                    ",",
                                    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;
                }
                }
                Session.SendMessage(new ServerMessage(Outgoing.SaveWired)); // NEW
                class2.UpdateState(true, false);
            }
            catch
            {
            }
        }
Example #13
0
 public override void OnSelfEnterRoom()
 {
     base.GetRoomUser().HandleSpeech(null, EssentialEnvironment.GetExternalText("guidebot_welcome1"), true);
     base.GetRoomUser().HandleSpeech(null, EssentialEnvironment.GetExternalText("guidebot_welcome2"), false);
 }
Example #14
0
        internal void HandleSpeech(GameClient Session, string str, bool bool_13, int TextColor = 0)
        {
            if (TextColor == 23 && Session.GetHabbo().Rank < 4)
            {
                TextColor = 0;
            }
            if (TextColor > 23 || TextColor < 0 || TextColor == 1 || TextColor == 8 || TextColor == 2)
            {
                TextColor = 0;
            }
            if (!String.IsNullOrEmpty(str) || !String.IsNullOrWhiteSpace(str))
            {
                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(EssentialEnvironment.GetExternalText("error_muted"));
                    }
                    else
                    {
                        if (!str.StartsWith(":") || Session == null || !ChatCommandHandler.HandleCommands(Session, str.Substring(1)))
                        {
                            uint num = Outgoing.Talk; // Updated
                            if (bool_13)
                            {
                                num = Outgoing.Shout; // Updated
                            }
                            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(Outgoing.FloodFilter);
                                    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)
                            {
                                str = ChatCommandHandler.ApplyFilter(str);
                            }

                            if (!this.GetRoom().method_9(this, str))
                            {
                                ServerMessage Message2 = new ServerMessage(num);
                                Message2.AppendInt32(this.VirtualId);
                                string Site = "";
                                if (str.Contains("http://") || str.Contains("www."))
                                {
                                    string[] Split = str.Split(' ');

                                    foreach (string Msg in Split)
                                    {
                                        if (Msg.StartsWith("http://") || Msg.StartsWith("www."))
                                        {
                                            Site = Msg;
                                        }
                                    }

                                    //str = str.Replace(Site, "{0}");
                                }

                                Message2.AppendStringWithBreak(str);
                                Message2.AppendInt32(ParseEmoticon(str));
                                Message2.AppendInt32(this.IsBot && !this.IsPet ? 2 : TextColor);
                                Message2.AppendInt32(0);
                                Message2.AppendInt32(-1);
                                if (!Essential.GetAntiAd().ContainsIllegalWord(object_))
                                {
                                    if (!this.IsBot && this.GetClient() != null && this.GetClient().GetHabbo().PassedSafetyQuiz)
                                    {
                                        this.GetRoom().method_58(Message2, Session.GetHabbo().list_2, Session.GetHabbo().Id);
                                    }
                                    else
                                    {
                                        this.GetRoom().SendMessage(Message2, this.IsPet ? this.GetRoom().RoomUsers.Where(p => p != null && p.GetClient() != null && p.GetClient().GetHabbo() != null && p.GetClient().GetHabbo().MutePets).Select(o => o.GetClient().GetHabbo().Id).ToList() : this.IsBot ? this.GetRoom().RoomUsers.Where(p => p != null && p.GetClient() != null && p.GetClient().GetHabbo() != null && p.GetClient().GetHabbo().MuteBots).Select(o => o.GetClient().GetHabbo().Id).ToList() : null);
                                    }
                                }
                                else if (Essential.GetAntiAd().ContainsIllegalWord(object_) && this.GetClient() != null)
                                {
                                    ServerMessage Message3 = new ServerMessage(Outgoing.InstantChat);
                                    Message3.AppendUInt(0u);
                                    Message3.AppendString("[AWS] " + Session.GetHabbo().Username + ": " + object_);
                                    Message3.AppendString(Essential.GetUnixTimestamp() + string.Empty);
                                    Essential.GetGame().GetClientManager().SendToStaffs(Session, Message3);

                                    Session.SendNotification(Essential.GetGame().GetRoleManager().GetConfiguration().getData("antiad.alert"));
                                    return;
                                }
                            }
                            else
                            {
                                if (!this.IsBot)
                                {
                                    Session.GetHabbo().Whisper(str);
                                }
                            }

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

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

                            if (ServerConfiguration.EnableChatlog && !this.IsBot && !Essential.GetAntiAd().ContainsIllegalWord(object_) && this.GetRoom().Id != 74402)
                            {
                                using (DatabaseClient @class = Essential.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(),
                                        "')"
                                    }));
                                }
                            }
                        }
                    }
                }
            }
        }
Example #15
0
        public override void OnUserSay(RoomUser RoomUser, string string_0)
        {
            RoomUser Pet = base.GetRoomUser();

            //TODO: Pet Commands :D
            if (Pet.RoomBot.RoomUser_0 == null)
            {
                if (string_0.ToLower().Equals(Pet.PetData.Name.ToLower()))
                {
                    Pet.method_9(Rotation.GetRotation(Pet.X, Pet.Y, RoomUser.X, RoomUser.Y));
                }
                else
                {
                    if (string_0.ToLower().StartsWith(Pet.PetData.Name.ToLower() + " ") && RoomUser.GetClient().GetHabbo().Username.ToLower() == base.GetRoomUser().PetData.OwnerName.ToLower())
                    {
                        string key = string_0.Substring(Pet.PetData.Name.ToLower().Length + 1);
                        if ((Pet.PetData.Energy >= 10 && this.method_4() < 6) || Pet.PetData.Level >= 15)
                        {
                            Pet.Statusses.Clear();
                            if (!Essential.GetGame().GetRoleManager().dictionary_5.ContainsKey(key))
                            {
                                string[] array = new string[]
                                {
                                    EssentialEnvironment.GetExternalText("pet_response_confused1"),
                                    EssentialEnvironment.GetExternalText("pet_response_confused2"),
                                    EssentialEnvironment.GetExternalText("pet_response_confused3"),
                                    EssentialEnvironment.GetExternalText("pet_response_confused4"),
                                    EssentialEnvironment.GetExternalText("pet_response_confused5"),
                                    EssentialEnvironment.GetExternalText("pet_response_confused6"),
                                    EssentialEnvironment.GetExternalText("pet_response_confused7")
                                };
                                Random random = new Random();
                                Pet.HandleSpeech(null, array[random.Next(0, array.Length - 1)], false);
                            }
                            else
                            {
                                switch (Essential.GetGame().GetRoleManager().dictionary_5[key])
                                {
                                case 0:
                                    // Remove Status
                                    RemovePetStatus();

                                    this.SpeechTimer = 0;
                                    this.ActionTimer = 0;
                                    this.FollowType  = FollowType.None;

                                    // Add Status
                                    Pet.Statusses.Add("sit", TextHandling.GetString(Pet.double_0));
                                    break;

                                case 1:
                                    this.ActionTimer = 25;
                                    this.FollowType  = FollowType.None;

                                    // Remove Status
                                    RemovePetStatus();

                                    Pet.PetData.AddExpirience(10, -10);     // Give XP

                                    // Add Status
                                    Pet.Statusses.Add("sit", TextHandling.GetString(Pet.double_0));
                                    break;

                                case 2:
                                    this.ActionTimer = 30;
                                    this.FollowType  = FollowType.None;

                                    // Remove Status
                                    RemovePetStatus();

                                    Pet.PetData.AddExpirience(10, -10);     // Give XP

                                    // Add Status
                                    Pet.Statusses.Add("lay", TextHandling.GetString(Pet.double_0));
                                    break;

                                case 3:
                                    this.ActionTimer = 30;
                                    this.FollowType  = FollowType.None;

                                    RemovePetStatus();

                                    int NewX = RoomUser.X;
                                    int NewY = RoomUser.Y;

                                    #region Rotation
                                    if (RoomUser.BodyRotation == 4)
                                    {
                                        NewY = RoomUser.Y + 1;
                                    }
                                    else if (RoomUser.BodyRotation == 0)
                                    {
                                        NewY = RoomUser.Y - 1;
                                    }
                                    else if (RoomUser.BodyRotation == 6)
                                    {
                                        NewX = RoomUser.X - 1;
                                    }
                                    else if (RoomUser.BodyRotation == 2)
                                    {
                                        NewX = RoomUser.X + 1;
                                    }
                                    else if (RoomUser.BodyRotation == 3)
                                    {
                                        NewX = RoomUser.X + 1;
                                        NewY = RoomUser.Y + 1;
                                    }
                                    else if (RoomUser.BodyRotation == 1)
                                    {
                                        NewX = RoomUser.X + 1;
                                        NewY = RoomUser.Y - 1;
                                    }
                                    else if (RoomUser.BodyRotation == 7)
                                    {
                                        NewX = RoomUser.X - 1;
                                        NewY = RoomUser.Y - 1;
                                    }
                                    else if (RoomUser.BodyRotation == 5)
                                    {
                                        NewX = RoomUser.X - 1;
                                        NewY = RoomUser.Y + 1;
                                    }
                                    #endregion

                                    Pet.PetData.AddExpirience(11, -10);     // Give XP

                                    Pet.MoveTo(NewX, NewY);
                                    break;

                                case 4:
                                    this.ActionTimer = 10;
                                    this.FollowType  = FollowType.None;

                                    //Remove Status
                                    RemovePetStatus();

                                    Pet.PetData.AddExpirience(15, -13);     // Give XP

                                    Pet.Statusses.Add("beg", TextHandling.GetString(Pet.double_0));
                                    break;

                                case 5:
                                    this.ActionTimer = 30;
                                    this.FollowType  = FollowType.None;

                                    // Remove Status
                                    RemovePetStatus();

                                    // Add Status
                                    Pet.Statusses.Add("ded", TextHandling.GetString(Pet.double_0));

                                    Pet.PetData.AddExpirience(20, -18);     // Give XP
                                    break;

                                case 6:
                                    this.ActionTimer = 120;
                                    this.FollowType  = FollowType.None;

                                    // Remove Status
                                    RemovePetStatus();

                                    // Add Status
                                    Pet.Statusses.Add("sit", TextHandling.GetString(Pet.double_0));

                                    Pet.PetData.AddExpirience(20, -18);     // Give XP

                                    Pet.MoveTo(Pet.X, Pet.Y);
                                    break;

                                case 7:
                                    this.ActionTimer = 120;
                                    this.FollowType  = FollowType.Normal;
                                    this.FollowUser  = RoomUser;

                                    Pet.PetData.AddExpirience(30, -30);     // Give XP

                                    this.PetFollowUser(RoomUser, Pet, FollowType.Normal);
                                    break;

                                case 8:
                                    //Stand
                                    break;

                                case 9:
                                    this.ActionTimer = 5;
                                    this.FollowType  = FollowType.None;

                                    // Remove Status
                                    RemovePetStatus();

                                    // Add Status
                                    Pet.Statusses.Add("jmp", TextHandling.GetString(Pet.double_0));

                                    Pet.PetData.AddExpirience(35, -30);     // Give XP
                                    break;

                                case 10:
                                    // Remove Status
                                    RemovePetStatus();

                                    Pet.PetData.AddExpirience(35, -30);     // Give XP

                                    this.SpeechTimer = 2;
                                    this.FollowType  = FollowType.None;
                                    break;

                                case 11:
                                    //Play
                                    break;

                                case 12:
                                    // Remove Status
                                    RemovePetStatus();

                                    Pet.PetData.AddExpirience(35, -30);     // Give XP

                                    this.SpeechTimer = 120;
                                    this.FollowType  = FollowType.None;
                                    break;

                                case 13:
                                    //Nest Pesä

                                    this.ActionTimer = 30;
                                    List <RoomItem> Nests = new List <RoomItem>();
                                    foreach (RoomItem PetItem in this.GetRoomUser().GetRoom().Hashtable_0.Values)
                                    {
                                        if (PetItem.GetBaseItem().InteractionType.ToLower() == "pet_nest")
                                        {
                                            Nests.Add(PetItem);
                                        }
                                    }

                                    if (Nests.Count == 0)
                                    {
                                        return;
                                    }
                                    int PetNX = Nests[new Random().Next(0, Nests.Count - 1)].GetX;
                                    int PetNY = Nests[new Random().Next(0, Nests.Count - 1)].Int32_1;
                                    Pet.MoveTo(PetNX, PetNY);

                                    Nests.Clear();
                                    Nests = null;

                                    Pet.PetData.AddExpirience(15, -10);      // Give XP

                                    break;

                                case 14:
                                    //Drink

                                    this.ActionTimer = 30;
                                    List <RoomItem> Drinks = new List <RoomItem>();
                                    foreach (RoomItem PetItem in this.GetRoomUser().GetRoom().Hashtable_0.Values)
                                    {
                                        if (PetItem.GetBaseItem().InteractionType.ToLower() == "pet_drink")
                                        {
                                            Drinks.Add(PetItem);
                                        }
                                    }

                                    if (Drinks.Count == 0)
                                    {
                                        return;
                                    }
                                    int PetDX = Drinks[new Random().Next(0, Drinks.Count - 1)].GetX;
                                    int PetDY = Drinks[new Random().Next(0, Drinks.Count - 1)].Int32_1;
                                    Pet.MoveTo(PetDX, PetDY);

                                    Drinks.Clear();
                                    Drinks = null;

                                    Pet.PetData.AddExpirience(25, -10);      // Give XP

                                    break;

                                case 15:
                                    this.ActionTimer = 120;
                                    this.FollowType  = FollowType.Left;
                                    this.FollowUser  = RoomUser;

                                    Pet.PetData.AddExpirience(35, -30);     // Give XP

                                    this.PetFollowUser(RoomUser, Pet, FollowType.Left);
                                    break;

                                case 16:
                                    this.FollowType = FollowType.Right;
                                    this.FollowUser = RoomUser;

                                    Pet.PetData.AddExpirience(35, -30);     // Give XP

                                    this.PetFollowUser(RoomUser, Pet, FollowType.Right);
                                    break;

                                case 17:
                                    //Play football
                                    break;

                                case 24:
                                    //Move forwar
                                    break;

                                case 25:
                                    //Turn left
                                    break;

                                case 26:
                                    //Turn right
                                    break;

                                case 43:
                                    //Eat
                                    break;
                                }
                            }
                        }
                        else
                        {
                            string[] array2 = new string[]
                            {
                                EssentialEnvironment.GetExternalText("pet_response_sleeping1"),
                                EssentialEnvironment.GetExternalText("pet_response_sleeping2"),
                                EssentialEnvironment.GetExternalText("pet_response_sleeping3"),
                                EssentialEnvironment.GetExternalText("pet_response_sleeping4"),
                                EssentialEnvironment.GetExternalText("pet_response_sleeping5")
                            };
                            string[] array3 = new string[]
                            {
                                EssentialEnvironment.GetExternalText("pet_response_refusal1"),
                                EssentialEnvironment.GetExternalText("pet_response_refusal2"),
                                EssentialEnvironment.GetExternalText("pet_response_refusal3"),
                                EssentialEnvironment.GetExternalText("pet_response_refusal4"),
                                EssentialEnvironment.GetExternalText("pet_response_refusal5")
                            };
                            Pet.int_10 = Pet.int_12;
                            Pet.int_11 = Pet.int_13;
                            Pet.Statusses.Clear();
                            if (Pet.PetData.Energy < 10)
                            {
                                Random random2 = new Random();
                                Pet.HandleSpeech(null, array2[random2.Next(0, array2.Length - 1)], false);
                                if (Pet.PetData.Type != 13u)
                                {
                                    Pet.Statusses.Add("lay", Pet.double_0.ToString());
                                }
                                else
                                {
                                    Pet.Statusses.Add("lay", (Pet.double_0 - 1.0).ToString());
                                }
                                this.SpeechTimer = 25;
                                this.ActionTimer = 20;
                                base.GetRoomUser().PetData.PetEnergy(25);
                            }
                            else
                            {
                                Random random2 = new Random();
                                Pet.HandleSpeech(null, array3[random2.Next(0, array3.Length - 1)], false);
                            }
                        }
                        Pet.UpdateNeeded = true;
                    }
                }
            }
        }
Example #16
0
        public override void OnTimerTick()
        {
            if (this.SpeechTimer <= 0)
            {
                RoomUser @class = base.GetRoomUser();
                string[] array  = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_dog1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dog2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dog3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dog4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dog5")
                };
                string[] array2 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_cat1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_cat2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_cat3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_cat4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_cat5")
                };
                string[] array3 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_croc1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_croc2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_croc3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_croc4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_croc5")
                };
                string[] array4 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_dog1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dog2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dog3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dog4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dog5")
                };
                string[] array5 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_bear1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_bear2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_bear3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_bear4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_bear5")
                };
                string[] array6 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_pig1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_pig2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_pig3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_pig4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_pig5")
                };
                string[] array7 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_lion1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_lion2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_lion3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_lion4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_lion5")
                };
                string[] array8 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_rhino1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_rhino2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_rhino3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_rhino4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_rhino5")
                };
                string[] array9 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_spider1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_spider2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_spider3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_spider4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_spider5")
                };
                string[] array10 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_turtle1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_turtle2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_turtle3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_turtle4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_turtle5")
                };
                string[] array11 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_chic1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_chic2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_chic3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_chic4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_chic5")
                };
                string[] array12 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_frog1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_frog2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_frog3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_frog4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_frog5")
                };
                string[] array13 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_dragon1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dragon2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dragon3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dragon4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_dragon5")
                };
                string[] array14 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_horse1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_horse2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_horse3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_horse4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_horse5")
                };
                string[] array15 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_monkey1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_monkey2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_monkey3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_monkey4"),
                    EssentialEnvironment.GetExternalText("pet_chatter_monkey5")
                };
                string[] array16 = new string[]
                {
                    EssentialEnvironment.GetExternalText("pet_chatter_generic1"),
                    EssentialEnvironment.GetExternalText("pet_chatter_generic2"),
                    EssentialEnvironment.GetExternalText("pet_chatter_generic3"),
                    EssentialEnvironment.GetExternalText("pet_chatter_generic4"),
                    EssentialEnvironment.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    = Essential.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.SpeechTimer = Essential.smethod_5(30, 120);
            }
            else
            {
                this.SpeechTimer--;
            }
            if (this.ActionTimer <= 0)
            {
                base.GetRoomUser().PetData.PetEnergy(10);
                if (base.GetRoomUser().RoomBot.RoomUser_0 == null)
                {
                    this.method_5(0, 0, true);
                }
                this.ActionTimer = 30;
                this.FollowType  = FollowType.None;
                this.FollowUser  = null;
            }
            else
            {
                this.ActionTimer--;

                if (this.FollowType != FollowType.None && this.FollowUser != null)
                {
                    this.PetFollowUser(this.FollowUser, base.GetRoomUser(), this.FollowType);
                }
            }
        }
Example #17
0
        public Game(int conns)
        {
            this.ClientManager = new GameClientManager(conns);

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

            DateTime now = DateTime.Now;

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

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

                    Essential.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.PixelManager         = new PixelManager();
                    this.AchievementManager   = new AchievementManager();
                    this.ModerationTool       = new ModerationTool();
                    this.BotManager           = new BotManager();
                    this.Marketplace          = new Marketplace();
                    this.QuestManager         = new QuestManager();
                    this.EssentialEnvironment = new EssentialEnvironment();
                    this.GamesManager         = new GamesManager();
                    this.Groups    = new Groups();
                    this.StormWars = new WarsData();
                    EssentialEnvironment.LoadExternalTexts(dbClient);

                    this.BanManager.Initialise(dbClient);

                    this.RoleManager.Initialize(dbClient);

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

                    this.ModerationTool.method_1(dbClient);
                    this.ModerationTool.method_2(dbClient);
                    this.ItemManager.Initialize(dbClient);
                    this.Catalog.Initialize(dbClient);
                    this.Catalog.InitializeCache();
                    PetRace.Init(dbClient);
                    this.Navigator.Initialize(dbClient);
                    this.RoomManager.method_8(dbClient);
                    this.RoomManager.method_0();
                    this.NavigatorCache = new NavigatorCache();
                    this.RoomManager.LoadMagicTiles(dbClient);
                    this.RoomManager.LoadBillboards(dbClient);
                    this.BotManager.Initialize(dbClient);
                    AchievementManager.Load(dbClient);
                    this.PixelManager.Initialize();
                    ChatCommandHandler.Initialize(dbClient);
                    this.QuestManager.Initialize();
                    // this.GamesManager.LoadGameLocales(dbClient);
                    // this.GamesManager.LoadPowerupPackages(dbClient);
                    Groups.Initialize(dbClient);
                    guideManager = new GuideManager(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);
                Essential.Destroy("", true, true);

                return;
            }

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

            StartGameLoop();
        }
Example #18
0
        public string CreateAuthTicket(uint UserId)
        {
            string AuthTokenGen = "FF-GAMEMANAGER-" + UserId + EssentialEnvironment.GetRandomNumber(1, 10000) + Essential.GetUnixTimestamp();

            return(Hash(AuthTokenGen));
        }