Esempio n. 1
0
        public ServerMessage method_14(RoomData class27_0)
        {
            Room @class = Essential.GetGame().GetRoomManager().GetRoom(class27_0.Id);
            uint uint_  = 0u;

            using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
            {
                try
                {
                    class2.AddParamWithValue("owner", class27_0.Owner);
                    uint_ = (uint)class2.ReadDataRow("SELECT Id FROM users WHERE username = @owner LIMIT 1")[0];
                }
                catch (Exception)
                {
                }
            }
            ServerMessage Message = new ServerMessage(Outgoing.RoomTool); // PP

            Message.AppendUInt(class27_0.Id);
            Message.AppendInt32(class27_0.UsersNow);
            if (@class != null)
            {
                Message.AppendBoolean(@class.method_56(class27_0.Owner) != null);
            }
            else
            {
                Message.AppendBoolean(false);
            }
            Message.AppendUInt(uint_);
            Message.AppendStringWithBreak(class27_0.Owner);
            Message.AppendBoolean(class27_0 != null);
            //Message.AppendUInt(class27_0.Id);
            Message.AppendStringWithBreak(class27_0.Name);
            Message.AppendStringWithBreak(class27_0.Description);
            Message.AppendInt32(class27_0.TagCount);
            foreach (string current in class27_0.Tags)
            {
                Message.AppendStringWithBreak(current);
            }
            if (@class != null)
            {
                Message.AppendBoolean(@class.HasEvent);
                if (@class.Event == null)
                {
                    return(Message);
                }
                Message.AppendStringWithBreak(@class.Event.Name);
                Message.AppendStringWithBreak(@class.Event.Description);
                Message.AppendInt32(@class.Event.Tags.Count);
                using (TimedLock.Lock(@class.Event.Tags))
                {
                    foreach (string current in @class.Event.Tags)
                    {
                        Message.AppendStringWithBreak(current);
                    }
                    return(Message);
                }
            }
            Message.AppendBoolean(false);
            return(Message);
        }
Esempio n. 2
0
 internal Item GetBaseItem()
 {
     return(Essential.GetGame().GetItemManager().GetItemById(this.uint_1));
 }
 public void Handle(GameClient Session, ClientMessage Event)
 {
     Session.SendMessage(Essential.GetGame().GetNavigator().SerializePublicRooms());
 }
Esempio n. 4
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room     @class = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
            RoomItem class2 = @class.method_28(Event.PopWiredUInt());

            if (@class != null && class2 != null)
            {
                string text = class2.GetBaseItem().InteractionType.ToLower();
                if (text != null)
                {
                    if (text != null && (text == "wf_act_matchfurni" || text == "wf_cnd_match_snapshot" || text == "wf_cnd_not_match_snap"))
                    {
                        class2.ExtraData = "1";
                        class2.UpdateState(false, true);
                        class2.ReqUpdate(1);
                        class2.CheckExtraData4();
                        if (class2.string_4.Length > 0 && class2.string_2.Length > 0)
                        {
                            string[] collection = class2.string_4.Split(new char[]
                            {
                                ','
                            });
                            IEnumerable <string> enumerable  = new List <string>(collection);
                            string[]             collection2 = class2.string_2.Split(new char[]
                            {
                                ';'
                            });
                            List <string> list8 = new List <string>(collection2);
                            int           num8  = 0;
                            foreach (string current in enumerable)
                            {
                                RoomItem class3 = @class.method_28(Convert.ToUInt32(current));
                                if (class3 != null && !(class3.GetBaseItem().InteractionType.ToLower() == "dice"))
                                {
                                    string[] collection3 = list8[num8].Split(new char[]
                                    {
                                        ','
                                    });
                                    List <string> list9 = new List <string>(collection3);
                                    bool          flag6 = false;
                                    bool          flag7 = false;
                                    if (class2.string_3 != "" && class3 != null)
                                    {
                                        int int_  = class3.GetX;
                                        int int_2 = class3.Int32_1;
                                        if (class2.string_3.StartsWith("I"))
                                        {
                                            class3.ExtraData = list9[4];
                                            flag7            = true;
                                        }
                                        if (class2.string_3.Substring(1, 1) == "I")
                                        {
                                            class3.int_3 = Convert.ToInt32(list9[3]);
                                            flag6        = true;
                                        }
                                        if (class2.string_3.EndsWith("I"))
                                        {
                                            int_  = Convert.ToInt32(list9[0]);
                                            int_2 = Convert.ToInt32(list9[1]);
                                            flag6 = true;
                                        }
                                        if (flag6)
                                        {
                                            @class.method_40(class3, int_, int_2, class2.uint_0, class3.Double_0);
                                        }
                                        if (flag7)
                                        {
                                            class3.UpdateState(false, true);
                                        }
                                        @class.method_22();
                                    }
                                    num8++;
                                }
                            }
                        }
                    }
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            uint uint_ = Event.PopWiredUInt();

            Essential.GetGame().GetQuestManager().ActivateQuest(uint_, Session);
        }
Esempio n. 6
0
 internal void InitMsg()
 {
     this.mMessage = Essential.GetGame().GetCatalog().SerializePage(this);
 }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int           guildId = Event.PopWiredInt32();
            GroupsManager guild   = Groups.GetGroupById(guildId);
            int           UserId  = Event.PopWiredInt32();

            if (UserId != Session.GetHabbo().Id&& !guild.UserWithRanks.Contains((int)Session.GetHabbo().Id))
            {
                return;
            }
            if (guild != null)
            {
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("DELETE FROM `group_memberships` WHERE (`groupid`='" + guildId + "') AND (`userid`='" + UserId + "') LIMIT 1");
                    dbClient.ExecuteQuery("UPDATE user_stats SET groupid=0 WHERE (groupid=" + guildId + ") AND (id=" + UserId + ") LIMIT 1");
                }
                guild.Leave(UserId);
                if (guild.UserWithRanks.Contains((int)UserId))
                {
                    guild.UserWithRanks.Remove((int)UserId);
                }
                if ((uint)UserId != Session.GetHabbo().Id)
                {
                    LoadMembersPetitions(0, guildId, 0, "", Session);
                }
                GameClient habbo = Essential.GetGame().GetClientManager().GetClientById((uint)UserId);
                if (habbo != null)
                {
                    if (habbo.GetHabbo().FavouriteGroup == guild.Id)
                    {
                        habbo.GetHabbo().FavouriteGroup = 0;
                        if (habbo.GetHabbo().CurrentRoom != null)
                        {
                            List <RoomUser> list    = new List <RoomUser>(habbo.GetHabbo().CurrentRoom.RoomUsers);
                            ServerMessage   message = new ServerMessage(Outgoing.SendGroup);
                            message.AppendInt32(0);
                            Session.SendMessage(message);
                            ServerMessage message2 = new ServerMessage(Outgoing.SetRoomUser);
                            message2.AppendInt32(1);
                            foreach (RoomUser user in list)
                            {
                                if (user.UId == habbo.GetHabbo().Id)
                                {
                                    user.method_14(message2);
                                    user.RemoveStatus("flatctrl 1");
                                    user.AddStatus("flatctrl 0", "");
                                    user.UpdateNeeded = true;
                                }
                            }
                            habbo.GetHabbo().CurrentRoom.SendMessage(message2, null);
                        }

                        habbo.GetHabbo().RefreshGuilds();
                    }
                    if ((int)Session.GetHabbo().Id == UserId)
                    {
                        RoomData      data = Essential.GetGame().GetRoomManager().method_11((uint)guild.RoomId);
                        ServerMessage message;
                        message = new ServerMessage(Outgoing.SendAdvGroupInit);
                        message.AppendInt32(guild.Id);
                        message.AppendBoolean(true);
                        message.AppendInt32(guild.Type);
                        message.AppendString(guild.Name);
                        message.AppendString(guild.Description);
                        message.AppendString(guild.Badge);
                        message.AppendInt32(data.Id);
                        message.AppendString(data.Name);
                        if (guild.Petitions.Contains((int)Session.GetHabbo().Id))
                        {
                            message.AppendInt32(2);
                        }
                        else if (!Session.GetHabbo().InGuild(guild.Id))
                        {
                            message.AppendInt32(0);
                        }
                        else if (Session.GetHabbo().InGuild(guild.Id))
                        {
                            message.AppendInt32(1);
                        }
                        message.AppendInt32(guild.Members.Count);
                        message.AppendBoolean(false);
                        message.AppendString(guild.Created);
                        message.AppendBoolean(guild.UserWithRanks.Contains((int)Session.GetHabbo().Id));//(int)Session.GetHabbo().Id == guild.OwnerId);

                        if (Session.GetHabbo().InGuild(guild.Id))
                        {
                            if (guild.getRank((int)Session.GetHabbo().Id) < 2)
                            {
                                message.AppendBoolean(true);
                            }
                            else
                            {
                                message.AppendBoolean(false);
                            }
                        }
                        else
                        {
                            message.AppendBoolean(false);
                        }
                        message.AppendString(guild.OwnerName);
                        message.AppendBoolean(true);
                        message.AppendBoolean(true);
                        message.AppendInt32(guild.Members.Contains((int)Session.GetHabbo().Id) ? guild.Petitions.Count : 0);
                        Session.SendMessage(message);
                    }
                }
            }
        }
 public void Handle(GameClient Session, ClientMessage Event)
 {
     Essential.GetGame().GetQuestManager().ActivateQuest(0u, Session);
 }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int           guildId = Event.PopWiredInt32();
            GroupsManager guild   = Groups.GetGroupById(guildId);

            if (guild != null && guild.UserWithRanks.Contains((int)Session.GetHabbo().Id))
            {
                int        num2  = Event.PopWiredInt32();
                GameClient gc    = Essential.GetGame().GetClientManager().GetClientByHabbo(Essential.GetGame().GetClientManager().GetNameById((uint)num2));
                Habbo      habbo = gc.GetHabbo();
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    if (guild.UserWithRanks.Contains(num2))
                    {
                        dbClient.ExecuteQuery("UPDATE group_memberships SET hasRights='0' WHERE userid=" + num2 + " AND groupid=" + guild.Id);
                        guild.UserWithRanks.Remove(num2);
                    }
                    else
                    {
                        dbClient.ExecuteQuery("UPDATE group_memberships SET hasRights='1' WHERE userid=" + num2 + " AND groupid=" + guild.Id);
                        guild.UserWithRanks.Add(num2);
                    }
                }

                if (gc != null && habbo != null)
                {
                    RoomData data = Essential.GetGame().GetRoomManager().method_11((uint)guild.RoomId);
                    try
                    {
                        ServerMessage message = new ServerMessage(Outgoing.SendHtmlColors);
                        message.AppendInt32(habbo.dataTable_0.Rows.Count);
                        foreach (DataRow num3 in habbo.dataTable_0.Rows)
                        {
                            GroupsManager guild2 = Groups.GetGroupById((int)num3["groupid"]);
                            message.AppendInt32(guild2.Id);
                            message.AppendString(guild2.Name);
                            message.AppendString(guild2.Badge);
                            message.AppendString(guild2.ColorOne);
                            message.AppendString(guild2.ColorTwo);
                            message.AppendBoolean(guild2.Id == habbo.FavouriteGroup);
                        }

                        gc.SendMessage(message);
                        ServerMessage message1;

                        message1 = new ServerMessage(Outgoing.SendAdvGroupInit);
                        message1.AppendInt32(guild.Id);
                        message1.AppendBoolean(true);
                        message1.AppendInt32(guild.Type);
                        message1.AppendString(guild.Name);
                        message1.AppendString(guild.Description);
                        message1.AppendString(guild.Badge);
                        message1.AppendInt32(data.Id);
                        message1.AppendString(data.Name);
                        if (guild.Petitions.Contains((int)habbo.Id))
                        {
                            message1.AppendInt32(2);
                        }
                        else if (!habbo.InGuild(guild.Id))
                        {
                            message1.AppendInt32(0);
                        }
                        else if (habbo.InGuild(guild.Id))
                        {
                            message1.AppendInt32(1);
                        }
                        message1.AppendInt32(guild.Members.Count);
                        message1.AppendBoolean(false);
                        message1.AppendString(guild.Created);
                        message1.AppendBoolean(guild.UserWithRanks.Contains((int)Session.GetHabbo().Id));//habbo.Id == guild.OwnerId);

                        if (Session.GetHabbo().InGuild(guild.Id))
                        {
                            if (guild.UserWithRanks.Contains((int)habbo.Id))
                            {
                                message1.AppendBoolean(true);
                            }
                            else
                            {
                                message1.AppendBoolean(false);
                            }
                        }
                        else
                        {
                            message1.AppendBoolean(false);
                        }
                        message1.AppendString(guild.OwnerName);
                        message1.AppendBoolean(true);
                        message1.AppendBoolean(true);
                        message1.AppendInt32(guild.Members.Contains((int)habbo.Id) ? guild.Petitions.Count : 0);
                        gc.SendMessage(message);
                    }
                    catch
                    {
                    }
                    Session.GetClientMessageHandler().LoadMembersPetitions(0, guildId, 0, "", Session);
                }
            }
        }
Esempio n. 10
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(),
                                        "')"
                                    }));
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 11
0
 internal Room GetRoom()
 {
     return(Essential.GetGame().GetRoomManager().GetRoom(this.RoomId));
 }
Esempio n. 12
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int           guildId = Event.PopWiredInt32();
            GroupsManager guild   = Groups.GetGroupById(guildId);

            if (guild != null)
            {
                if (!guild.UserWithRanks.Contains((int)Session.GetHabbo().Id))
                {
                    return;
                }

                Room room = Essential.GetGame().GetRoomManager().method_15((uint)guild.RoomId);
                if (room != null)
                {
                    Event.PopWiredInt32();
                    guild.GuildBase      = Event.PopWiredInt32();
                    guild.GuildBaseColor = Event.PopWiredInt32();
                    Event.PopWiredInt32();
                    guild.GuildStates.Clear();
                    string str = "";
                    for (int i = 0; i < 12; i++)
                    {
                        int item = Event.PopWiredInt32();
                        guild.GuildStates.Add(item);
                        str = str + item + ";";
                    }
                    str         = str.Substring(0, str.Length - 1);
                    guild.Badge = Groups.GenerateGuildImage(guild.GuildBase, guild.GuildBaseColor, guild.GuildStates);
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE groups SET Badge = '", guild.Badge, "', GuildBase = '", guild.GuildBase, "', GuildBaseColor = '", guild.GuildBaseColor, "', GuildStates = '", str, "' WHERE Id = '", guild.Id, "'" }));
                    }
                    room.SaveSettingsPackets(guild, Session);
                    ServerMessage message;
                    message = new ServerMessage(Outgoing.SendAdvGroupInit);
                    message.AppendInt32(guild.Id);
                    message.AppendBoolean(true);
                    message.AppendInt32(guild.Type);
                    message.AppendString(guild.Name);
                    message.AppendString(guild.Description);
                    message.AppendString(guild.Badge);
                    message.AppendInt32(room.Id);
                    message.AppendString(room.Name);
                    if (guild.Petitions.Contains((int)Session.GetHabbo().Id))
                    {
                        message.AppendInt32(2);
                    }
                    else if (!Session.GetHabbo().InGuild(guild.Id))
                    {
                        message.AppendInt32(0);
                    }
                    else if (Session.GetHabbo().InGuild(guild.Id))
                    {
                        message.AppendInt32(1);
                    }
                    message.AppendInt32(guild.Members.Count);
                    message.AppendBoolean(false);
                    message.AppendString(guild.Created);

                    message.AppendBoolean(guild.UserWithRanks.Contains((int)Session.GetHabbo().Id));//Session.GetHabbo().Id == guild.OwnerId);

                    if (Session.GetHabbo().InGuild(guild.Id))
                    {
                        if (guild.UserWithRanks.Contains((int)Session.GetHabbo().Id))
                        {
                            message.AppendBoolean(true);
                        }
                        else
                        {
                            message.AppendBoolean(false);
                        }
                    }
                    else
                    {
                        message.AppendBoolean(false);
                    }
                    message.AppendString(Essential.GetGame().GetClientManager().GetNameById((uint)guild.OwnerId));
                    message.AppendBoolean(false);
                    message.AppendBoolean(false);
                    message.AppendInt32(guild.Members.Contains((int)Session.GetHabbo().Id) ? guild.Petitions.Count : 0);
                    Session.SendMessage(message);
                }
            }
        }
Esempio n. 13
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string text = Event.PopFixedString().ToUpper();

            if (!(text == "M" || text == "F"))
            {
                return;
            }

            string text2 = Essential.FilterString(Event.PopFixedString());

            if (AntiMutant.ValidateLook(text2, text))
            {
                if (Session.GetHabbo().CurrentQuestId > 0 && Essential.GetGame().GetQuestManager().GetQuestAction(Session.GetHabbo().CurrentQuestId) == "CHANGE_FIGURE")
                {
                    Essential.GetGame().GetQuestManager().ProgressUserQuest(Session.GetHabbo().CurrentQuestId, Session);
                }
                Session.GetHabbo().Figure = text2;
                Session.GetHabbo().Gender = text.ToLower();
                using (DatabaseClient client = Essential.GetDatabase().GetClient())
                {
                    client.AddParamWithValue("look", text2);
                    client.AddParamWithValue("gender", text);
                    client.ExecuteQuery("UPDATE users SET look = @look, gender = @gender WHERE id = " + Session.GetHabbo().Id + " LIMIT 1;");
                }
                Essential.GetGame().GetAchievementManager().addAchievement(Session, 1u, 1);
                ServerMessage serverMessage = new ServerMessage(Outgoing.UpdateUserInformation);
                serverMessage.AppendInt32(-1);
                serverMessage.AppendStringWithBreak(Session.GetHabbo().Figure);
                serverMessage.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                serverMessage.AppendStringWithBreak(Session.GetHabbo().Motto);
                serverMessage.AppendInt32(Session.GetHabbo().AchievementScore);
                // serverMessage.AppendStringWithBreak("");
                Session.SendMessage(serverMessage);
                if (Session.GetHabbo().InRoom)
                {
                    Room currentRoom = Session.GetHabbo().CurrentRoom;
                    if (currentRoom != null)
                    {
                        RoomUser roomUserByHabbo = currentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id);
                        if (roomUserByHabbo != null)
                        {
                            roomUserByHabbo.string_0 = "";
                            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)
                                {
                                    ServerMessage serverMessage2 = new ServerMessage(Outgoing.FigureData);
                                    serverMessage2.AppendInt32(Session.GetHabbo().method_4());
                                    Session.SendMessage(serverMessage2);
                                    return;
                                }
                                Session.GetHabbo().dateTime_0 = DateTime.Now;
                                Session.GetHabbo().int_23++;
                            }
                            ServerMessage serverMessage3 = new ServerMessage(Outgoing.UpdateUserInformation);
                            serverMessage3.AppendInt32(roomUserByHabbo.VirtualId);
                            serverMessage3.AppendStringWithBreak(Session.GetHabbo().Figure);
                            serverMessage3.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                            serverMessage3.AppendStringWithBreak(Session.GetHabbo().Motto);
                            serverMessage3.AppendInt32(Session.GetHabbo().AchievementScore);
                            //   serverMessage3.AppendStringWithBreak("");
                            currentRoom.SendMessage(serverMessage3, null);
                        }
                    }
                }
            }
        }
Esempio n. 14
0
        public ServerMessage method_20(uint uint_0)
        {
            ServerMessage result;

            using (DatabaseClient @class = Essential.GetDatabase().GetClient())
            {
                DataTable     dataTable = @class.ReadDataTable("SELECT room_id, exit_timestamp, MAX(entry_timestamp) AS entry_timestamp FROM user_roomvisits WHERE user_id = '" + uint_0 + "' GROUP BY room_id ORDER BY entry_timestamp DESC LIMIT 10");
                ServerMessage Message   = new ServerMessage(Outgoing.UserChatlog); // Updated
                Message.AppendUInt(uint_0);
                Message.AppendStringWithBreak(Essential.GetGame().GetClientManager().GetNameById(uint_0));
                if (dataTable != null)
                {
                    Message.AppendInt32(dataTable.Rows.Count);
                    IEnumerator enumerator = dataTable.Rows.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            DataRow   dataRow = (DataRow)enumerator.Current;
                            DataTable dataTable2;
                            if ((double)dataRow["exit_timestamp"] <= 0.0)
                            {
                                dataTable2 = @class.ReadDataTable(string.Concat(new object[]
                                {
                                    "SELECT user_id,user_name,message,hour,minute,timestamp FROM chatlogs WHERE room_id = '",
                                    (uint)dataRow["room_id"],
                                    //"' AND timestamp > ",
                                    //(double)dataRow["entry_timestamp"],
                                    "' AND timestamp < UNIX_TIMESTAMP() ORDER BY timestamp DESC LIMIT 200"
                                }));
                            }
                            else
                            {
                                dataTable2 = @class.ReadDataTable(string.Concat(new object[]
                                {
                                    "SELECT user_id,user_name,message,hour,minute,timestamp FROM chatlogs WHERE room_id = '",
                                    (uint)dataRow["room_id"],
                                    "'",
                                    //"' AND timestamp > ",
                                    //(double)dataRow["entry_timestamp"],
                                    //" AND timestamp < ",
                                    //(double)dataRow["exit_timestamp"],
                                    " ORDER BY timestamp DESC LIMIT 200"
                                }));
                            }
                            RoomData class2 = Essential.GetGame().GetRoomManager().method_11((uint)dataRow["room_id"]);
                            Message.AppendBoolean(class2.IsPublicRoom);
                            Message.AppendUInt(class2.Id);
                            Message.AppendStringWithBreak(class2.Name);
                            if (dataTable2 != null)
                            {
                                Message.AppendInt32(dataTable2.Rows.Count);
                                IEnumerator enumerator2 = dataTable2.Rows.GetEnumerator();
                                try
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        DataRow dataRow2 = (DataRow)enumerator2.Current;

                                        string hour   = (int)dataRow2["hour"].ToString().Length > 1 ? "" + (int)dataRow2["hour"] : "0" + (int)dataRow2["hour"];
                                        string minute = (int)dataRow2["minute"].ToString().Length > 1 ? "" + (int)dataRow2["minute"] : "0" + (int)dataRow2["minute"];
                                        Message.AppendInt32((int)((double)dataRow2["timestamp"]));
                                        Message.AppendInt32((uint)dataRow2["user_id"]);
                                        Message.AppendStringWithBreak((string)dataRow2["user_name"]);
                                        Message.AppendStringWithBreak((string)dataRow2["message"]);
                                        Message.AppendStringWithBreak(hour + ":" + minute);
                                    }
                                    continue;
                                }
                                finally
                                {
                                    IDisposable disposable = enumerator2 as IDisposable;
                                    if (disposable != null)
                                    {
                                        disposable.Dispose();
                                    }
                                }
                            }
                            Message.AppendInt32(0);
                        }
                        goto IL_2EF;
                    }
                    finally
                    {
                        IDisposable disposable = enumerator as IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                }
                Message.AppendInt32(0);
IL_2EF:
                result = Message;
            }
            return(result);
        }
Esempio n. 15
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            try
            {
                if ((Session != null) && (Session.GetHabbo().GetCredits() >= 10))
                {
                    List <int> gStates     = new List <int>();
                    string     name        = Event.PopFixedString();
                    string     description = Event.PopFixedString();
                    int        roomid      = Event.PopWiredInt32();
                    int        color       = Event.PopWiredInt32();
                    int        num3        = Event.PopWiredInt32();
                    Event.PopWiredInt32();
                    int guildBase      = Event.PopWiredInt32();
                    int guildBaseColor = Event.PopWiredInt32();
                    int num6           = Event.PopWiredInt32();
                    if (Essential.GetGame().GetRoomManager().method_15((uint)roomid).RoomData.GuildId != 0)
                    {
                        return;
                    }
                    for (int i = 0; i < (num6 * 3); i++)
                    {
                        int item = Event.PopWiredInt32();
                        gStates.Add(item);
                    }

                    string image       = Groups.GenerateGuildImage(guildBase, guildBaseColor, gStates);
                    string htmlColor   = Groups.GetHtmlColor(color);
                    string str5        = Groups.GetHtmlColor(num3);
                    string datecreated = DateTime.Now.ToShortDateString();

                    int id = (int)Session.GetHabbo().Id;

                    string username = Session.GetHabbo().Username;

                    Dictionary <int, string> members = new Dictionary <int, string>();
                    members.Add(id, DateTime.Now.Day + " - " + DateTime.Now.Month + " -  " + DateTime.Now.Year);



                    Room room = Essential.GetGame().GetRoomManager().GetRoom(Convert.ToUInt32(roomid));

                    if (room != null && room.CheckRights(Session, true))
                    {
                        GroupsManager guild = Groups.AddGuild(0, name, id, username, description, roomid, image, color, num3, guildBase, guildBaseColor, gStates, htmlColor, str5, Essential.GetUnixTimestamp().ToString(), members, new List <int>(), 0, 0);

                        using (DatabaseClient adapter = Essential.GetDatabase().GetClient())
                        {
                            Session.GetHabbo().dataTable_0    = adapter.ReadDataTable("SELECT * FROM group_memberships WHERE userid = " + Session.GetHabbo().Id);
                            Session.GetHabbo().FavouriteGroup = guild.Id;

                            adapter.ExecuteQuery(string.Concat(new object[] { "UPDATE user_stats SET groupid = '", guild.Id, "' WHERE Id = '", guild.OwnerId, "'" }));
                        }
                        ServerMessage message = new ServerMessage(Outgoing.SerializePurchaseInformation); //Rootkit
                        message.AppendInt32(0x1815);
                        message.AppendString("CREATE_GUILD");
                        message.AppendInt32(10);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendBoolean(true);
                        message.AppendInt32(0);
                        message.AppendInt32(2);
                        message.AppendBoolean(false);

                        Session.SendMessage(message);
                        Session.GetHabbo().TakeCredits(10, "Bought Guild");
                        Session.GetHabbo().UpdateCredits(true);

                        ServerMessage message2 = new ServerMessage(Outgoing.SendHtmlColors);
                        message2.AppendInt32(Session.GetHabbo().dataTable_0.Rows.Count);
                        foreach (DataRow drow in Session.GetHabbo().dataTable_0.Rows)
                        {
                            GroupsManager guild2 = Groups.GetGroupById((int)drow["groupid"]);
                            message2.AppendInt32(guild2.Id);
                            message2.AppendString(guild2.Name);
                            message2.AppendString(guild2.Badge);
                            message2.AppendString(guild2.ColorOne);
                            message2.AppendString(guild2.ColorTwo);
                            message2.AppendBoolean(guild2.Id == Session.GetHabbo().FavouriteGroup);
                        }

                        Session.SendMessage(message2);

                        if ((Session != null) && (room != null) && Session.GetHabbo().CurrentRoomId == roomid)
                        {
                            ServerMessage message3 = new ServerMessage(Outgoing.SetRoomUser); //Rootkit
                            message3.AppendInt32(1);
                            room.GetRoomUserByHabbo(Session.GetHabbo().Id).method_14(message3);
                            room.SendMessage(message3, null);
                        }

                        ServerMessage message4 = new ServerMessage(Outgoing.UpdateRoom); //Rootkit
                        message4.AppendInt32(guild.RoomId);
                        Session.SendMessage(message4);

                        ServerMessage message5 = new ServerMessage(Outgoing.ConfigureWallandFloor); //Rootkit
                        message5.AppendBoolean(room.Hidewall);
                        message5.AppendInt32(room.Wallthick);
                        message5.AppendInt32(room.Floorthick);
                        Session.SendMessage(message5);

                        ServerMessage message6 = new ServerMessage(Outgoing.SendRoomAndGroup); //Rootkit
                        message6.AppendInt32(guild.RoomId);
                        message6.AppendInt32(guild.Id);
                        Session.SendMessage(message6);

                        ServerMessage message7 = new ServerMessage(Outgoing.RoomData); //Rootkit
                        message7.AppendBoolean(true);
                        message7.AppendInt32(guild.RoomId);
                        message7.AppendString(room.Name);
                        message7.AppendBoolean(true);
                        message7.AppendInt32(room.OwnerId);
                        message7.AppendString(room.Owner);
                        message7.AppendInt32(room.State);
                        message7.AppendInt32(room.UsersNow);
                        message7.AppendInt32(room.UsersMax);
                        message7.AppendString(room.Description);
                        message7.AppendInt32(0);
                        message7.AppendInt32((room.Category == 0x34) ? 2 : 0);
                        message7.AppendInt32(room.Score);
                        message7.AppendInt32(0);
                        message7.AppendInt32(room.Category);

                        if (room.RoomData.GuildId == 0)
                        {
                            message7.AppendInt32(0);
                            message7.AppendInt32(0);
                        }
                        else
                        {
                            message7.AppendInt32(guild.Id);
                            message7.AppendString(guild.Name);
                            message7.AppendString(guild.Badge);
                        }

                        message7.AppendString("");
                        message7.AppendInt32(room.Tags.Count);

                        foreach (string str8 in room.Tags.ToArray())
                        {
                            message7.AppendString(str8);
                        }

                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendBoolean(true);
                        message7.AppendBoolean(true);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendBoolean(false);
                        message7.AppendBoolean(false);
                        message7.AppendBoolean(false);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendInt32(0);
                        message7.AppendBoolean(false);
                        message7.AppendBoolean(true);
                        room.SendMessage(message7, null);
                    }
                }
            }catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Esempio n. 16
0
        internal void StartGame(SnowStorm War)
        {
            War.AssignTeams();
            War.WarStarted = 1;
            ServerMessage SetStep1 = new ServerMessage(Outgoing.SetStep1);

            SetStep1.AppendInt32(War.WarId);
            SetStep1.AppendString("SnowStorm level " + War.WarLevel);
            SetStep1.AppendInt32(0);
            SetStep1.AppendInt32(War.WarLevel);
            SetStep1.AppendInt32(2);
            SetStep1.AppendInt32(War.MaxUsers);
            SetStep1.AppendString(War.WarOwner.Username);
            SetStep1.AppendInt32(15);
            SetStep1.AppendInt32(War.WarUsers.Count);
            foreach (Habbo habbo in War.WarUsers)
            {
                SetStep1.AppendInt32(habbo.Id);
                SetStep1.AppendString(habbo.Username);
                SetStep1.AppendString(habbo.Figure);
                SetStep1.AppendString((habbo.Gender.ToUpper() == "M") ? "M" : "f");
                SetStep1.AppendInt32(habbo.SnowTeam);
                SetStep1.AppendInt32(habbo.SnowLevel);
                SetStep1.AppendInt32(habbo.SnowPoints);
                SetStep1.AppendInt32(Essential.GetGame().GetStormWars().LevelScore[habbo.SnowLevel]);
            }
            SetStep1.AppendInt32(0);
            SetStep1.AppendInt32(120);
            War.SendToStorm(SetStep1, false, 0);
            ServerMessage EnterArena = new ServerMessage(Outgoing.Game2EnterArenaMessageEvent);

            EnterArena.AppendInt32(0);
            EnterArena.AppendInt32(War.WarLevel);
            EnterArena.AppendInt32(2);
            EnterArena.AppendInt32(War.WarUsers.Count);
            foreach (Habbo habbo in War.WarUsers)
            {
                EnterArena.AppendInt32(habbo.Id);
                EnterArena.AppendString(habbo.Username);
                EnterArena.AppendString(habbo.Figure);
                EnterArena.AppendString(habbo.Gender.ToLower());
                EnterArena.AppendInt32(habbo.SnowTeam);
            }
            EnterArena.AppendInt32(50);
            EnterArena.AppendInt32(50);
            EnterArena.AppendString(War.Model.SerializeHeightMap());
            EnterArena.AppendInt32(War.Model.SnowItems.Count);
            foreach (SnowItems items in War.Model.SnowItems)
            {
                items.SerializeItem(EnterArena);
            }
            War.SendToStorm(EnterArena, false, 0);
            foreach (Habbo habbo in War.WarUsers)
            {
                ServerMessage ArenaEntered = new ServerMessage(Outgoing.Game2ArenaEnteredMessageEvent);
                ArenaEntered.AppendInt32(habbo.Id);
                ArenaEntered.AppendString(habbo.Username);
                ArenaEntered.AppendString(habbo.Figure);
                ArenaEntered.AppendString(habbo.Gender.ToLower());
                ArenaEntered.AppendInt32(habbo.SnowTeam);
                War.SendToStorm(ArenaEntered, false, 0);
            }
            ServerMessage StageLoad = new ServerMessage(Outgoing.Game2StageLoadMessageEvent);

            StageLoad.AppendInt32(0);
            War.SendToStorm(StageLoad, false, 0);
            Action <object> action = delegate(object obj)
            {
                Thread.Sleep(0x1388);
                ServerMessage StageStillLoading = new ServerMessage(Outgoing.Game2StageStillLoadingMessageEvent);
                StageStillLoading.AppendInt32(0);
                StageStillLoading.AppendInt32(0);
                War.SendToStorm(StageStillLoading, false, 0);
                this.LoadArena(War);
            };

            new Task(action, "pingsession").Start();
        }
Esempio n. 17
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
            {
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int  num      = Event.PopWiredInt32();
            bool InWindow = false;

            InWindow = Event.PopWiredBoolean();
            string OwnerName = "Rootkit";

            if (num > 0 && (Session != null && Session.GetHabbo() != null))
            {
                GroupsManager @class = Groups.GetGroupById(num);
                if (@class != null)
                {
                    ServerMessage Message = new ServerMessage(Outgoing.GroupInfo); // Updated
                    Message.AppendInt32(@class.Id);
                    Message.AppendBoolean(true);
                    Message.AppendInt32(@class.Locked == "open" ? 0 : 1);
                    Message.AppendStringWithBreak(@class.Name);
                    Message.AppendStringWithBreak(@class.Description);
                    Message.AppendStringWithBreak(@class.Badge);
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        OwnerName = dbClient.ReadString("SELECT username FROM users WHERE id = '" + @class.OwnerId + "' LIMIT 1");
                    }
                    if (@class.RoomId > 0u)
                    {
                        Message.AppendUInt(@class.RoomId);
                        if (Essential.GetGame().GetRoomManager().GetRoom(@class.RoomId) != null)
                        {
                            Message.AppendStringWithBreak(Essential.GetGame().GetRoomManager().GetRoom(@class.RoomId).Name);
                            goto IL_15A;
                        }
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            try
                            {
                                DataRow dataRow_ = class2.ReadDataRow("SELECT * FROM rooms WHERE Id = " + @class.RoomId + " LIMIT 1;");
                                string  string_  = Essential.GetGame().GetRoomManager().method_17(@class.RoomId, dataRow_).Name;
                                Message.AppendStringWithBreak(string_);
                            }
                            catch
                            {
                                Message.AppendInt32(-1);
                                Message.AppendStringWithBreak("");
                            }
                            goto IL_15A;
                        }
                    }
                    Message.AppendInt32(-1);
                    Message.AppendStringWithBreak("");
IL_15A:
                    bool flag = false;
                    foreach (DataRow dataRow in Session.GetHabbo().dataTable_0.Rows)
                    {
                        if ((int)dataRow["groupid"] == @class.Id)
                        {
                            flag = true;
                        }
                    }
                    if (Session.GetHabbo().list_0.Contains(@class.Id))
                    {
                        Message.AppendInt32(2);
                    }
                    else
                    {
                        if (flag)
                        {
                            Message.AppendInt32(1);
                        }
                        else
                        {
                            if (@class.Members.Contains((int)Session.GetHabbo().Id))
                            {
                                Message.AppendInt32(1);
                            }
                            else
                            {
                                Message.AppendInt32(0);
                            }
                        }
                    }
                    Message.AppendInt32(@class.Members.Count);

                    Message.AppendBoolean(true);

                    Message.AppendString(@class.Created);
                    Message.AppendBoolean((@class.OwnerId == Session.GetHabbo().Id));
                    Message.AppendBoolean(false);
                    Message.AppendString(OwnerName);
                    Message.AppendBoolean(InWindow);
                    Message.AppendBoolean(true);
                    Message.AppendInt32(0); // Pending
                    Session.SendMessage(Message);
                }
            }
        }
        public void LoadMembersPetitions(int a, int gId, int b, string search, GameClient Session)
        {
            try
            {
                int           guildId = gId;
                int           num2    = a;
                int           num3    = b;
                string        str     = search;
                GroupsManager guild   = Groups.GetGroupById(guildId);
                if (guild != null)
                {
                    ServerMessage message;
                    int           memberCounter = 0;
                    int           results;
                    if (num3 == 0)
                    {
                        if (!string.IsNullOrEmpty(str))
                        {
                            results = 0;
                            foreach (int num4 in guild.Members)
                            {
                                if (Essential.GetGame().GetClientManager().GetNameById((uint)num4).ToLower().Contains(str.ToLower()))
                                {
                                    results++;
                                }
                            }
                        }
                        else
                        {
                            results = guild.Members.Count();
                        }
                        message = new ServerMessage(Outgoing.SendMembersAndPetitions);
                        message.AppendInt32(guild.Id);
                        message.AppendString(guild.Name);
                        message.AppendInt32(guild.RoomId);
                        message.AppendString(guild.Badge);
                        message.AppendInt32(results);

                        if (num2 == 0)
                        {
                            message.AppendInt32(results);
                        }
                        else
                        {
                            message.AppendInt32(results - (num2 * 14));
                        }

                        foreach (int num4 in guild.Members)
                        {
                            if (!string.IsNullOrEmpty(str))
                            {
                                if (Essential.GetGame().GetClientManager().GetNameById((uint)num4).ToLower().Contains(str.ToLower()))
                                {
                                    if (memberCounter >= ((num2) * 14))
                                    {
                                        if (guild.OwnerId == num4)
                                        {
                                            message.AppendInt32(0);
                                        }
                                        else
                                        {
                                            message.AppendInt32(guild.getRank(num4));
                                        }
                                        message.AppendInt32(num4);
                                        message.AppendString(Essential.GetGame().GetClientManager().GetNameById((uint)num4));
                                        using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                                            message.AppendString(dbClient.ReadString("SELECT look FROM users WHERE id=" + num4));
                                        message.AppendString("");
                                    }
                                    memberCounter++;
                                }
                            }

                            else
                            {
                                if (memberCounter >= (num2 * 14))
                                {
                                    if (guild.OwnerId == (uint)num4)
                                    {
                                        message.AppendInt32(0);
                                    }
                                    else
                                    {
                                        message.AppendInt32(guild.getRank(num4));
                                    }
                                    message.AppendInt32(num4);
                                    message.AppendString(Essential.GetGame().GetClientManager().GetNameById((uint)num4));
                                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                                        message.AppendString(dbClient.ReadString("SELECT look FROM users WHERE id=" + num4));
                                    message.AppendString("");
                                }
                                memberCounter++;
                            }
                        }

                        if (Session.GetHabbo().InGuild(guild.Id))
                        {
                            if (guild.UserWithRanks.Contains((int)Session.GetHabbo().Id))
                            {
                                message.AppendBoolean(true);
                            }
                            else
                            {
                                message.AppendBoolean(false);
                            }
                        }
                        else
                        {
                            message.AppendBoolean(false);
                        }
                        message.AppendInt32(14);
                        message.AppendInt32(num2);
                        message.AppendInt32(0);
                        message.AppendString(str);
                        Session.SendMessage(message);
                    }
                    else if (num3 == 1)
                    {
                        int admins = 0;

                        foreach (int num4 in guild.Members)
                        {
                            if (guild.UserWithRanks.Contains(num4))
                            {
                                admins++;
                            }
                        }

                        if (!string.IsNullOrEmpty(str))
                        {
                            results = 0;
                            foreach (int num4 in guild.Members)
                            {
                                if ((Essential.GetGame().GetClientManager().GetNameById((uint)num4).ToLower().Contains(str.ToLower())) && ((guild.UserWithRanks.Contains(num4))))
                                {
                                    results++;
                                }
                            }
                        }
                        else
                        {
                            results = admins;
                        }

                        message = new ServerMessage(Outgoing.SendMembersAndPetitions);
                        message.AppendInt32(guild.Id);
                        message.AppendString(guild.Name);
                        message.AppendInt32(guild.RoomId);
                        message.AppendString(guild.Badge);
                        message.AppendInt32(results);

                        if (num2 == 0)
                        {
                            message.AppendInt32(results);
                        }

                        else
                        {
                            message.AppendInt32(results - (num2 * 14));
                        }
                        memberCounter = 0;
                        foreach (int num4 in guild.Members)
                        {
                            if (!string.IsNullOrEmpty(str))
                            {
                                if (Essential.GetGame().GetClientManager().GetNameById((uint)num4).ToLower().Contains(str.ToLower()))
                                {
                                    if (guild.UserWithRanks.Contains(num4))
                                    {
                                        if (memberCounter >= ((num2) * 14))
                                        {
                                            if (guild.OwnerId == num4)
                                            {
                                                message.AppendInt32(0);
                                            }
                                            else
                                            {
                                                message.AppendInt32(guild.getRank(num4));
                                            }
                                            message.AppendInt32(num4);
                                            message.AppendString(Essential.GetGame().GetClientManager().GetNameById((uint)num4));
                                            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                                                message.AppendString(dbClient.ReadString("SELECT look FROM users WHERE id=" + num4));
                                            message.AppendString("");
                                        }
                                    }
                                    memberCounter++;
                                }
                            }

                            else
                            {
                                if (memberCounter >= (num2 * 14))
                                {
                                    if (guild.UserWithRanks.Contains(num4))
                                    {
                                        if (guild.OwnerId == num4)
                                        {
                                            message.AppendInt32(0);
                                        }
                                        else
                                        {
                                            message.AppendInt32(guild.getRank(num4));
                                        }
                                        message.AppendInt32(num4);
                                        message.AppendString(Essential.GetGame().GetClientManager().GetNameById((uint)num4));
                                        using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                                            message.AppendString(dbClient.ReadString("SELECT look FROM users WHERE id=" + num4));
                                        message.AppendString("");
                                    }
                                }
                                memberCounter++;
                            }
                        }
                        if (Session.GetHabbo().InGuild(guild.Id))
                        {
                            if (guild.UserWithRanks.Contains((int)Session.GetHabbo().Id))
                            {
                                message.AppendBoolean(true);
                            }
                            else
                            {
                                message.AppendBoolean(false);
                            }
                        }
                        else
                        {
                            message.AppendBoolean(false);
                        }
                        message.AppendInt32(14);
                        message.AppendInt32(num2);
                        message.AppendInt32(1);
                        message.AppendString(str);
                        Session.SendMessage(message);
                    }

                    else if (num3 == 2)
                    {
                        if (!string.IsNullOrEmpty(str))
                        {
                            results = 0;
                            foreach (int num4 in guild.Petitions)
                            {
                                if (Essential.GetGame().GetClientManager().GetNameById((uint)num4).ToLower().Contains(str.ToLower()))
                                {
                                    results++;
                                }
                            }
                        }

                        else
                        {
                            results = guild.Petitions.Count();
                        }

                        message = new ServerMessage(Outgoing.SendMembersAndPetitions);
                        message.AppendInt32(guild.Id);
                        message.AppendString(guild.Name);
                        message.AppendInt32(guild.RoomId);
                        message.AppendString(guild.Badge);
                        message.AppendInt32(results);
                        if (num2 == 0)
                        {
                            message.AppendInt32(results);
                        }

                        else
                        {
                            message.AppendInt32(results - (num2 * 14));
                        }
                        memberCounter = 0;
                        foreach (int num4 in guild.Petitions)
                        {
                            if (!string.IsNullOrEmpty(str))
                            {
                                if (Essential.GetGame().GetClientManager().GetNameById((uint)num4).ToLower().Contains(str.ToLower()))
                                {
                                    if (memberCounter >= ((num2) * 14))
                                    {
                                        message.AppendInt32(3);
                                        message.AppendInt32(num4);
                                        message.AppendString(Essential.GetGame().GetClientManager().GetNameById((uint)num4));
                                        using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                                            message.AppendString(dbClient.ReadString("SELECT look FROM users WHERE id=" + num4));
                                        message.AppendString("");
                                    }
                                    memberCounter++;
                                }
                            }

                            else
                            {
                                if (memberCounter >= (num2 * 14))
                                {
                                    message.AppendInt32(3);
                                    message.AppendInt32(num4);
                                    message.AppendString(Essential.GetGame().GetClientManager().GetNameById((uint)num4));
                                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                                        message.AppendString(dbClient.ReadString("SELECT look FROM users WHERE id=" + num4));
                                    message.AppendString("");
                                }
                                memberCounter++;
                            }
                        }
                        if (guild.UserWithRanks.Contains((int)Session.GetHabbo().Id))
                        {
                            message.AppendBoolean(true);
                        }
                        else
                        {
                            message.AppendBoolean(false);
                        }
                        message.AppendInt32(14);
                        message.AppendInt32(num2);
                        message.AppendInt32(2);
                        message.AppendString(str);
                        Session.SendMessage(message);
                    }
                }
            }catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Esempio n. 20
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            bool accept = Event.PopWiredBoolean();

            if (!accept)
            {
                Essential.GetGame().GetGuideManager().GetTicket(Session.GetHabbo().Id).SendToTicket(Essential.GetGame().GetGuideManager().DetachedMessage);
                Essential.GetGame().GetGuideManager().RemoveTicket(Session.GetHabbo().Id);
                Essential.GetGame().GetGuideManager().GetGuideById(Session.GetHabbo().Id).IsInUse = false;
                return;
            }
            ServerMessage Message = new ServerMessage(Outgoing.GuideSessionStarted); //Rootkit

            Essential.GetGame().GetGuideManager().GetTicket(Session.GetHabbo().Id).Serialize(Message);
            Essential.GetGame().GetGuideManager().GetTicket(Session.GetHabbo().Id).Answered = true;
            Essential.GetGame().GetGuideManager().GetTicket(Session.GetHabbo().Id).SendToTicket(Message);
        }
Esempio n. 21
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 {}
        }
Esempio n. 22
0
 public SongItem(int itemID, int songID, int baseItem)
 {
     this.itemID   = itemID;
     this.songID   = songID;
     this.baseItem = Essential.GetGame().GetItemManager().GetItemById((uint)baseItem);
 }
Esempio n. 23
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"));
                                }
                            }
                        }
                    }
                }
            }
        }
 public void Handle(GameClient Session, ClientMessage Event)
 {
     Essential.GetGame().GetQuestManager().OpenQuestTracker(Session);
 }
Esempio n. 25
0
 public Room GetRoom()
 {
     return(Essential.GetGame().GetRoomManager().GetRoom(this.uint_0));
 }
Esempio n. 26
0
 public void method_2(int int_1, bool bool_0)
 {
     if (this.method_4(int_1, true) || bool_0)
     {
         Room @class = this.method_9();
         if (@class != null && (this.method_8() != null && this.method_8().GetHabbo() != null))
         {
             RoomUser class2 = @class.GetRoomUserByHabbo(this.method_8().GetHabbo().Id);
             if (class2 != null && (class2.byte_1 <= 0 || int_1 == -1 || bool_0) && (class2.class34_1 == null || int_1 == 77 || int_1 == -1))
             {
                 this.oldeffect = this.int_0;
                 this.int_0     = int_1;
                 if (class2.GetClient() != null && class2.GetClient().GetHabbo().CurrentQuestId > 0 && Essential.GetGame().GetQuestManager().GetQuestAction(class2.GetClient().GetHabbo().CurrentQuestId) == "SWIM" && (this.int_0 == 28 || this.int_0 == 29 || this.int_0 == 30 || this.int_0 == 37))
                 {
                     Essential.GetGame().GetQuestManager().ProgressUserQuest(class2.GetClient().GetHabbo().CurrentQuestId, class2.GetClient());
                 }
                 ServerMessage Message = new ServerMessage(Outgoing.ApplyEffects); // P
                 Message.AppendInt32(class2.VirtualId);
                 Message.AppendInt32(int_1);
                 Message.AppendInt32(0);
                 @class.SendMessage(Message, null);
             }
         }
     }
 }
Esempio n. 27
0
        public static void Work()
        {
            double lastDatabaseUpdate = Essential.GetUnixTimestamp();

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

                    int UsersOnline = Essential.GetGame().GetClientManager().ClientCount;
                    //  Essential.GetGame().GetRoomManager().UnloadEmptyRooms();
                    int    RoomsLoaded = Essential.GetGame().GetRoomManager().LoadedRoomsCount;
                    double timestamp   = Essential.GetUnixTimestamp() - lastDatabaseUpdate;

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

                        lastDatabaseUpdate = Essential.GetUnixTimestamp();
                    }

                    Essential.GetGame().GetClientManager().UpdateEffects();

                    Console.Title = string.Concat(new object[]
                    {
                        "Essential | Online Users: ",
                        UsersOnline,
                        " | Rooms Loaded: ",
                        RoomsLoaded,
                        " | Uptime: ",
                        timeSpan.Days,
                        " days, ",
                        timeSpan.Hours,
                        " hours and ",
                        timeSpan.Minutes,
                        " minutes"
                    });
                }
                catch (Exception ex)
                {
                    Program.DeleteMenu(Program.GetSystemMenu(Program.GetConsoleWindow(), true), Program.SC_CLOSE, Program.MF_BYCOMMAND);
                    Logging.LogThreadException(ex.ToString(), "Server status update task");
                }
                Thread.Sleep(5000);
            }
        }
Esempio n. 28
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int num = Event.PopWiredInt32();

            if (num > 0 && (Session != null && Session.GetHabbo() != null))
            {
                Session.GetHabbo().FavouriteGroup = num;
                using (DatabaseClient @class = Essential.GetDatabase().GetClient())
                {
                    @class.ExecuteQuery(string.Concat(new object[]
                    {
                        "UPDATE user_stats SET groupid = ",
                        num,
                        " WHERE Id = ",
                        Session.GetHabbo().Id,
                        " LIMIT 1;"
                    }));
                }
                DataTable dataTable_ = Session.GetHabbo().dataTable_0;
                string    OwnerName  = "";
                if (dataTable_ != null)
                {
                    GroupsManager @class  = Groups.GetGroupById(Session.GetHabbo().FavouriteGroup);
                    ServerMessage Message = new ServerMessage(Outgoing.GroupInfo); // Updated
                    Message.AppendInt32(@class.Id);
                    Message.AppendBoolean(true);
                    Message.AppendInt32(@class.Locked == "open" ? 0 : 1);
                    Message.AppendStringWithBreak(@class.Name);
                    Message.AppendStringWithBreak(@class.Description);
                    Message.AppendStringWithBreak(@class.Badge);
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        OwnerName = dbClient.ReadString("SELECT username FROM users WHERE id = '" + @class.OwnerId + "' LIMIT 1");
                    }
                    if (@class.RoomId > 0u)
                    {
                        Message.AppendUInt(@class.RoomId);
                        if (Essential.GetGame().GetRoomManager().GetRoom(@class.RoomId) != null)
                        {
                            Message.AppendStringWithBreak(Essential.GetGame().GetRoomManager().GetRoom(@class.RoomId).Name);
                            goto IL_15A;
                        }
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            try
                            {
                                DataRow dataRow_ = class2.ReadDataRow("SELECT * FROM rooms WHERE Id = " + @class.RoomId + " LIMIT 1;");
                                string  string_  = Essential.GetGame().GetRoomManager().method_17(@class.RoomId, dataRow_).Name;
                                Message.AppendStringWithBreak(string_);
                            }
                            catch
                            {
                                Message.AppendInt32(-1);
                                Message.AppendStringWithBreak("");
                            }
                            goto IL_15A;
                        }
                    }
                    Message.AppendInt32(-1);
                    Message.AppendStringWithBreak("");
IL_15A:
                    bool flag = false;
                    foreach (DataRow dataRow in Session.GetHabbo().dataTable_0.Rows)
                    {
                        if ((int)dataRow["groupid"] == @class.Id)
                        {
                            flag = true;
                        }
                    }
                    if (Session.GetHabbo().list_0.Contains(@class.Id))
                    {
                        Message.AppendInt32(1);
                    }
                    else
                    {
                        if (flag)
                        {
                            Message.AppendInt32(1);
                        }
                        else
                        {
                            if (@class.Members.Contains((int)Session.GetHabbo().Id))
                            {
                                Message.AppendInt32(1);
                            }
                            else
                            {
                                Message.AppendInt32(0);
                            }
                        }
                    }
                    Message.AppendInt32(@class.Members.Count);

                    Message.AppendBoolean(false);

                    Message.AppendString(@class.Created);
                    Message.AppendBoolean((@class.OwnerId == Session.GetHabbo().Id));
                    Message.AppendBoolean((Session.GetHabbo().FavouriteGroup == @class.Id));
                    Message.AppendString(OwnerName);
                    Message.AppendBoolean(false);
                    Message.AppendBoolean(true);
                    Message.AppendInt32(0); // Pending
                    Session.SendMessage(Message);

                    ServerMessage UpdateFaver = new ServerMessage(Outgoing.UpdateFavGuild);
                    UpdateFaver.AppendUInt(Session.GetHabbo().Id);
                    Session.SendMessage(UpdateFaver);

                    if (Session.GetHabbo().InRoom)
                    {
                        Room          class14_ = Session.GetHabbo().CurrentRoom;
                        RoomUser      class3   = class14_.GetRoomUserByHabbo(Session.GetHabbo().Id);
                        ServerMessage Message2 = new ServerMessage(Outgoing.SetRoomUser); // P
                        Message2.AppendInt32(1);
                        class3.method_14(Message2);
                        class14_.SendMessage(Message2, null);
                        GroupsManager class4 = Groups.GetGroupById(Session.GetHabbo().FavouriteGroup);
                        if (!class14_.list_17.Contains(class4))
                        {
                            class14_.list_17.Add(class4);
                            ServerMessage Message3 = new ServerMessage(Outgoing.Guilds); // Updated
                            Message3.AppendInt32(class14_.list_17.Count);
                            foreach (GroupsManager class2 in class14_.list_17)
                            {
                                Message3.AppendInt32(class2.Id);
                                Message3.AppendStringWithBreak(class2.Badge);
                            }
                            class14_.SendMessage(Message3, null);
                        }
                        else
                        {
                            foreach (GroupsManager current in class14_.list_17)
                            {
                                if (current == class4 && current.Badge != class4.Badge)
                                {
                                    ServerMessage Message3 = new ServerMessage(Outgoing.Guilds); // Updated
                                    Message3.AppendInt32(class14_.list_17.Count);
                                    foreach (GroupsManager class2 in class14_.list_17)
                                    {
                                        Message3.AppendInt32(class2.Id);
                                        Message3.AppendStringWithBreak(class2.Badge);
                                    }
                                    class14_.SendMessage(Message3, null);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 29
0
 public Item GetItem()
 {
     return(Essential.GetGame().GetItemManager().GetItemById(ItemId));
 }
Esempio n. 30
0
 public void method_11(SupportTicket class111_0)
 {
     Essential.GetGame().GetClientManager().SendToClientsWithFuse(class111_0.Serialize(), "acc_supporttool");
 }