Exemplo n.º 1
0
        internal static ServerMessage SerializeRoomVisits(UInt32 UserId)
        {
            Habbo User = UsersCache.getHabboCache(UserId);

            ServerMessage Message = new ServerMessage(Outgoing.RoomsVisits);

            Message.AppendUInt(UserId);
            Message.AppendString(UsersCache.getUsernameById(UserId));
            if (User == null)
            {
                Message.AppendInt32(0);
            }
            else
            {
                Message.AppendInt32(User.RoomsVisited.Count);
                foreach (RoomVisits Room in User.RoomsVisited)
                {
                    // Message.AppendBoolean(Room.IsPublic);
                    Message.AppendUInt(Room.RoomId);
                    Message.AppendString(Room.RoomName);
                    Message.AppendInt32(Room.Hour);
                    Message.AppendInt32(Room.Minute);
                }
            }
            return(Message);
        }
Exemplo n.º 2
0
        internal void LoadLast()
        {
            using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT owner_id, date_created FROM groups_forums_boards WHERE groupid = '" + GroupId + "' AND sub_post_id = '" + this.Id + "' OR id = '" + this.Id + "' ORDER BY id DESC LIMIT 1");
                DataRow dRow = dbClient.getRow();

                if (dRow != null)
                {
                    this.LastOwnerId   = Convert.ToUInt32(dRow["owner_id"]);
                    this.LastOwnerName = UsersCache.getUsernameById(this.LastOwnerId);
                    this.LastUnix      = Convert.ToDouble(dRow["date_created"]);
                }
            }
        }
Exemplo n.º 3
0
        internal GroupItem(DataRow dRow)
        {
            Id                = Convert.ToUInt32(dRow["id"]);
            Name              = (string)dRow["name"];
            Description       = (string)dRow["description"];
            RoomId            = Convert.ToUInt32(dRow["roomid"]);
            CustomColor1      = (int)dRow["customcolor1"];
            CustomColor2      = (int)dRow["customcolor2"];
            temChat           = OtanixEnvironment.EnumToBool((string)dRow["temChat"]);
            GroupBase         = (int)dRow["groupbase"];
            GroupBaseColor    = (int)dRow["groupbasecolor"];
            GroupBasePosition = (int)dRow["groupbaseposition"];
            var zGroupItem1 = ((string)dRow["groupitem1"]).Split(';');

            if (zGroupItem1.Count() == 3)
            {
                GroupItem1 = new int[] { int.Parse(zGroupItem1[0]), int.Parse(zGroupItem1[1]), int.Parse(zGroupItem1[2]) }
            }
            ;
            var zGroupItem2 = ((string)dRow["groupitem2"]).Split(';');

            if (zGroupItem2.Count() == 3)
            {
                GroupItem2 = new int[] { int.Parse(zGroupItem2[0]), int.Parse(zGroupItem2[1]), int.Parse(zGroupItem2[2]) }
            }
            ;
            var zGroupItem3 = ((string)dRow["groupitem3"]).Split(';');

            if (zGroupItem3.Count() == 3)
            {
                GroupItem3 = new int[] { int.Parse(zGroupItem3[0]), int.Parse(zGroupItem3[1]), int.Parse(zGroupItem3[2]) }
            }
            ;
            var zGroupItem4 = ((string)dRow["groupitem4"]).Split(';');

            if (zGroupItem4.Count() == 3)
            {
                GroupItem4 = new int[] { int.Parse(zGroupItem4[0]), int.Parse(zGroupItem4[1]), int.Parse(zGroupItem4[2]) }
            }
            ;
            GroupImage  = (string)dRow["groupimage"];
            HtmlColor1  = (string)dRow["htmlcolor1"];
            HtmlColor2  = (string)dRow["htmlcolor2"];
            DateCreated = (string)dRow["datecreated"];
            OwnerId     = Convert.ToUInt32(dRow["ownerid"]);
            OwnerName   = UsersCache.getUsernameById(OwnerId);
            Type        = Convert.ToInt32(dRow["type"]);
            RightsType  = Convert.ToInt32(dRow["rightsType"]);

            using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT COUNT(*) FROM groups_users WHERE groupid = '" + Id + "' AND acepted = '1'");
                MembersCount = dbClient.getInteger();

                dbClient.setQuery("SELECT * FROM groups_forums WHERE groupid = " + Id);
                DataRow dForum = dbClient.getRow();

                if (dForum != null)
                {
                    Forum = new GroupForum(Id, Convert.ToInt32(dForum["can_read"]), Convert.ToInt32(dForum["can_write"]), Convert.ToInt32(dForum["can_create"]), Convert.ToInt32(dForum["can_moderate"]), true);
                }
            }
        }
Exemplo n.º 4
0
        internal override void OnUserSay(RoomUser User, string Message)
        {
            if (User == null || User.GetClient() == null)
            {
                return;
            }

            if (GetRoom() == null)
            {
                return;
            }

            if (GetRoom().RoomData.OwnerId == User.HabboId)
            {
                if (Message.ToLower().Equals(LanguageLocale.GetValue("bot.soplon.keyword")))
                {
                    StringBuilder botMessage = new StringBuilder();
                    if (GetBotData().SoplonLeaveRoom.Count > 0)
                    {
                        foreach (UInt32 HabboId in GetBotData().SoplonLeaveRoom)
                        {
                            string Username = UsersCache.getUsernameById(HabboId);
                            if (String.IsNullOrEmpty(Username))
                            {
                                continue;
                            }

                            if ((LanguageLocale.GetValue("bot.soplon.leave").Length + botMessage.Length + Username.Length) >= 100)
                            {
                                botMessage = botMessage.Remove(botMessage.Length - 2, 2);

                                ServerMessage ChatMessage = new ServerMessage(Outgoing.Talk);
                                ChatMessage.AppendInt32(GetRoomUser().VirtualId);
                                ChatMessage.AppendString(botMessage + " " + LanguageLocale.GetValue("bot.soplon.leave"));
                                ChatMessage.AppendInt32(0);
                                ChatMessage.AppendInt32(OtanixEnvironment.GetGame().GetRoomRankConfig().BOTS_DEFAULT_COLOR);
                                ChatMessage.AppendInt32(0);
                                ChatMessage.AppendInt32(-1);
                                User.GetClient().SendMessage(ChatMessage);

                                botMessage.Clear();
                            }

                            botMessage.Append(Username + ", ");
                        }

                        if (botMessage.Length > 0)
                        {
                            botMessage = botMessage.Remove(botMessage.Length - 2, 2);

                            ServerMessage ChatMessage = new ServerMessage(Outgoing.Talk);
                            ChatMessage.AppendInt32(GetRoomUser().VirtualId);
                            ChatMessage.AppendString(botMessage + " " + LanguageLocale.GetValue("bot.soplon.leave"));
                            ChatMessage.AppendInt32(0);
                            ChatMessage.AppendInt32(OtanixEnvironment.GetGame().GetRoomRankConfig().BOTS_DEFAULT_COLOR);
                            ChatMessage.AppendInt32(0);
                            ChatMessage.AppendInt32(-1);
                            User.GetClient().SendMessage(ChatMessage);

                            botMessage.Clear();
                        }

                        GetBotData().SoplonLeaveRoom.Clear();
                    }

                    if (GetBotData().SoplonOnRoom.Count > 0)
                    {
                        foreach (UInt32 HabboId in GetBotData().SoplonOnRoom)
                        {
                            string Username = UsersCache.getUsernameById(HabboId);
                            if (String.IsNullOrEmpty(Username))
                            {
                                continue;
                            }

                            if ((LanguageLocale.GetValue("bot.soplon.onroom").Length + botMessage.Length + Username.Length) >= 100)
                            {
                                botMessage = botMessage.Remove(botMessage.Length - 2, 2);

                                ServerMessage ChatMessage = new ServerMessage(Outgoing.Talk);
                                ChatMessage.AppendInt32(GetRoomUser().VirtualId);
                                ChatMessage.AppendString(botMessage + " " + LanguageLocale.GetValue("bot.soplon.onroom"));
                                ChatMessage.AppendInt32(0);
                                ChatMessage.AppendInt32(OtanixEnvironment.GetGame().GetRoomRankConfig().BOTS_DEFAULT_COLOR);
                                ChatMessage.AppendInt32(0);
                                ChatMessage.AppendInt32(-1);
                                User.GetClient().SendMessage(ChatMessage);

                                botMessage.Clear();
                            }

                            botMessage.Append(Username + ", ");
                        }

                        if (botMessage.Length > 0)
                        {
                            botMessage = botMessage.Remove(botMessage.Length - 2, 2);

                            ServerMessage ChatMessage = new ServerMessage(Outgoing.Talk);
                            ChatMessage.AppendInt32(GetRoomUser().VirtualId);
                            ChatMessage.AppendString(botMessage + " " + LanguageLocale.GetValue("bot.soplon.onroom"));
                            ChatMessage.AppendInt32(0);
                            ChatMessage.AppendInt32(OtanixEnvironment.GetGame().GetRoomRankConfig().BOTS_DEFAULT_COLOR);
                            ChatMessage.AppendInt32(0);
                            ChatMessage.AppendInt32(-1);
                            User.GetClient().SendMessage(ChatMessage);

                            botMessage.Clear();
                        }

                        GetBotData().SoplonOnRoom.Clear();
                    }
                }
            }
        }