Exemple #1
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string  ReqBadge = Event.PopFixedString();
            DataRow Checking = null;

            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                Checking = dbClient.ReadDataRow("SELECT * FROM reception_slot_configurations WHERE button_type = 'BADGE' AND extra_param = '" + ReqBadge + "'");
            }

            if (Checking == null)
            {
                ServerMessage ServerError = new ServerMessage(Outgoing.ServerError);
                ServerError.AppendInt32(1);
                ServerError.AppendInt32(1);
                ServerError.AppendString(DateTime.Now.ToShortDateString().ToString());
                Session.SendMessage(ServerError);
                return;
            }

            if (Session.GetHabbo().GetBadgeComponent().HasBadge(ReqBadge))
            {
                ServerMessage BadgeError = new ServerMessage(Outgoing.BadgeError);
                BadgeError.AppendInt32(1);
                Session.SendMessage(BadgeError);
            }
            else
            {
                ServerMessage BadgeError = new ServerMessage(Outgoing.BadgeError);
                BadgeError.AppendInt32(6);
                Session.SendMessage(BadgeError);

                Session.GetHabbo().GetBadgeComponent().AddBadge(ReqBadge, 0, true);
            }
        }
Exemple #2
0
        internal WarsData()
        {
            DatabaseClient adapter;
            DataTable      table;

            this.Wars      = new Dictionary <int, SnowStorm>();
            this.LastWarId = 0;
            this.GetLevelScore();
            this.RoomModel = new Dictionary <int, SnowModel>();
            this.RoomItems = new Dictionary <int, List <SnowItems> >();
            using (adapter = Essential.GetDatabase().GetClient())
            {
                table = adapter.ReadDataTable("SELECT * FROM storm_levels");
                foreach (DataRow row in table.Rows)
                {
                    List <SnowItems> list = new List <SnowItems>();
                    this.RoomItems.Add((int)row["level"], new SnowItems().GetSnowItems((int)row["level"], adapter));
                }
            }
            using (adapter = Essential.GetDatabase().GetClient())
            {
                table = adapter.ReadDataTable("SELECT * FROM storm_models");
                foreach (DataRow row in table.Rows)
                {
                    SnowModel model = new SnowModel(row)
                    {
                        SnowItems = this.RoomItems[(int)row["id"]]
                    };
                    this.RoomModel.Add((int)row["id"], model);
                }
            }
        }
Exemple #3
0
        public ServerMessage GetPopularGroups(GameClient Session)
        {
            ServerMessage result;

            using (DatabaseClient @class = Essential.GetDatabase().GetClient())
            {
                DataTable       dataTable = @class.ReadDataTable("SELECT * FROM rooms JOIN groups ON rooms.Id = groups.roomid WHERE groups.roomid > 0 LIMIT 50;");
                List <RoomData> list      = new List <RoomData>();
                List <uint>     list2     = new List <uint>();
                if (dataTable != null)
                {
                    foreach (DataRow dataRow in dataTable.Rows)
                    {
                        RoomData class2 = Essential.GetGame().GetRoomManager().method_17((uint)dataRow["Id"], dataRow);
                        class2.method_1(dataRow);
                        list.Add(class2);
                        list2.Add(class2.Id);
                    }
                }
                ServerMessage Message = new ServerMessage(Outgoing.NavigatorPacket);
                Message.AppendInt32(7);
                Message.AppendStringWithBreak("");
                Message.AppendInt32(list.Count);
                foreach (RoomData current in list)
                {
                    current.Serialize(Message, false, false);
                }
                Message.AppendBoolean(false);
                result = Message;
            }

            return(result);
        }
        public void AddBadge(string code, int slotId, bool addToDatabase)
        {
            if (this.HasBadge(code))
            {
                return;
            }

            if (addToDatabase)
            {
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("badge", code);

                    dbClient.ExecuteQuery(string.Concat(new object[]
                    {
                        "INSERT INTO user_badges (user_id,badge_id,badge_slot) VALUES ('",
                        this.UserId,
                        "',@badge,'",
                        slotId,
                        "')"
                    }));
                }
            }

            this.Badges.Add(new Badge(code, slotId));
        }
        public string GetNameById(uint uint_0)
        {
            GameClient @class = this.GetClient(uint_0);
            string     result;

            if (@class != null)
            {
                result = @class.GetHabbo().Username;
            }
            else
            {
                DataRow dataRow = null;
                using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                {
                    dataRow = class2.ReadDataRow("SELECT username FROM users WHERE Id = '" + uint_0 + "' LIMIT 1");
                }
                if (dataRow == null)
                {
                    result = "Unknown User";
                }
                else
                {
                    result = (string)dataRow[0];
                }
            }
            return(result);
        }
Exemple #6
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int guildId = Event.PopWiredInt32();
            //Console.WriteLine(Event.PopWiredInt32() + " | " + Event.PopWiredInt32() + " | " + 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(Convert.ToUInt32(guild.RoomId));
                if (room != null)
                {
                    int type = Event.PopWiredInt32();
                    guild.Locked = Groups.IntToType(type);
                    int onlyAdminMove = Event.PopWiredInt32();
                    guild.canMove           = !Essential.StringToBoolean(onlyAdminMove + "");
                    guild.OnlyAdminsCanMove = onlyAdminMove;
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        dbClient.ExecuteQuery("UPDATE groups SET locked='" + guild.Locked + "' WHERE id=" + guild.Id);
                        dbClient.ExecuteQuery("UPDATE groups SET members_canmove='" + (guild.canMove ? 1 : 0) + "' WHERE id=" + guild.Id);
                    }
                    room.SaveSettingsPackets(guild, Session);
                }
            }
        }
Exemple #7
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string message = Event.PopFixedString();

            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                DataRow dr          = dbClient.ReadDataRow("SELECT * FROM friend_stream WHERE userid='" + Session.GetHabbo().Id.ToString() + "' ORDER BY time DESC LIMIT 1");
                double  currentTime = Essential.GetUnixTimestamp();
                if (dr == null)
                {
                    string Id     = Session.GetHabbo().Id.ToString();
                    string Gender = Session.GetHabbo().Gender.ToString();
                    string look   = Session.GetHabbo().Figure.ToString();
                    dbClient.AddParamWithValue("@endstring", message);
                    dbClient.ExecuteQuery("INSERT INTO friend_stream (`type`,`userid`,`gender`,`look`,`time`,`data`,`data_extra`) VALUES ('1','" + Id + "','" + Gender + "','" + look + "','" + currentTime + "', @endstring, '0');");
                }
                else
                {
                    double lastTime = (double)dr["time"];
                    double seconds  = currentTime - lastTime;
                    if (seconds > 300)
                    {
                        string Id     = Session.GetHabbo().Id.ToString();
                        string Gender = Session.GetHabbo().Gender.ToString();
                        string look   = Session.GetHabbo().Figure.ToString();
                        dbClient.AddParamWithValue("@endstring", message);
                        dbClient.ExecuteQuery("INSERT INTO friend_stream (`type`,`userid`,`gender`,`look`,`time`,`data`,`data_extra`) VALUES ('1','" + Id + "','" + Gender + "','" + look + "','" + currentTime + "', @endstring, '0');");
                    }
                    else
                    {
                        Session.SendNotification("Du kannst nur alle 15 Minuten einen Friendstream Eintrag erstellen! Versuchs später nochmal.");
                    }
                }
            }
        }
Exemple #8
0
        public void ContinueLoading()
        {
            if (this.task_0 != null)
            {
                this.task_0 = null;
            }


            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                this.RestoreStatistics(dbClient, 0);
            }

            if (this.GetClientManager() != null)
            {
                this.GetClientManager().StopPingTask();
            }

            if (this.GetPixelManager() != null)
            {
                this.PixelManager.KeepAlive = false;
            }

            this.ClientManager = null;
            this.BanManager    = null;
            this.RoleManager   = null;
            this.HelpTool      = null;
            this.Catalog       = null;
            this.Navigator     = null;
            this.ItemManager   = null;
            this.RoomManager   = null;
            this.PixelManager  = null;
        }
 public void method_3(GameClient Session, int int_0, uint uint_0, string string_0)
 {
     if (Session.GetHabbo().CurrentRoomId > 0u)
     {
         RoomData @class = Essential.GetGame().GetRoomManager().method_11(Session.GetHabbo().CurrentRoomId);
         uint     uint_  = 0u;
         using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
         {
             class2.AddParamWithValue("message", string_0);
             class2.AddParamWithValue("name", @class.Name);
             class2.ExecuteQuery(string.Concat(new object[]
             {
                 "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'",
                 int_0,
                 "','open','",
                 Session.GetHabbo().Id,
                 "','",
                 uint_0,
                 "','0',@message,'",
                 @class.Id,
                 "',@name,UNIX_TIMESTAMP())"
             }));
             class2.ExecuteQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1");
             uint_ = (uint)class2.ReadDataRow("SELECT Id FROM moderation_tickets WHERE sender_id = '" + Session.GetHabbo().Id + "' ORDER BY Id DESC LIMIT 1")[0];
         }
         SupportTicket class3 = new SupportTicket(uint_, 1, int_0, Session.GetHabbo().Id, uint_0, string_0, @class.Id, @class.Name, Essential.GetUnixTimestamp(), 0u);
         this.Tickets.Add(class3);
         this.method_11(class3);
     }
 }
Exemple #10
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            uint     num    = Event.PopWiredUInt();
            RoomData @class = Essential.GetGame().GetRoomManager().method_12(num);

            if (num == 0u || (@class != null))
            {
                Session.GetHabbo().HomeRoomId = num;
                using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                {
                    class2.ExecuteQuery(string.Concat(new object[]
                    {
                        "UPDATE users SET home_room = '",
                        num,
                        "' WHERE Id = '",
                        Session.GetHabbo().Id,
                        "' LIMIT 1;"
                    }));
                }
                ServerMessage Message = new ServerMessage(Outgoing.HomeRoom); // Updated
                Message.AppendUInt(num);
                Message.AppendUInt(0);
                Session.SendMessage(Message);
            }
        }
Exemple #11
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Session.GetHabbo().FavouriteGroup = 0;
            using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE user_stats SET groupid = '0' WHERE Id = '", Session.GetHabbo().Id, "'" }));
            }
            ServerMessage message = new ServerMessage(Outgoing.UpdatePetitionsGuild);

            message.AppendInt32(0);
            message.AppendInt32(-1);
            message.AppendInt32(-1);
            message.AppendString("");
            if (Session.GetHabbo().CurrentRoomId > 0)
            {
                Session.GetHabbo().CurrentRoom.SendMessage(message, null);
            }
            else
            {
                Session.SendMessage(message);
            }
            ServerMessage message2 = new ServerMessage(Outgoing.RemoveGuildFavorite);

            message2.AppendInt32((int)Session.GetHabbo().Id);
            Session.SendMessage(message2);
        }
        public override void OnRemove(GameClient Session, RoomItem Item)
        {
            DataRow dataRow2;

            using (DatabaseClient @class = Essential.GetDatabase().GetClient())
            {
                dataRow2 = @class.ReadDataRow("SELECT fw_count FROM items_firework WHERE item_id = '" + Item.uint_0 + "'");

                if (dataRow2 != null)
                {
                    Item.FireWorkCount = (int)dataRow2["fw_count"];
                }
                else
                {
                    @class.ExecuteQuery("INSERT INTO items_firework(item_id, fw_count) VALUES ( '" + Item.uint_0 + "', '0')");
                }
            }

            if (Item.FireWorkCount > 0)
            {
                Item.ExtraData = "1";
                Item.UpdateState(true, true);
            }

            else if (Item.FireWorkCount <= 0)
            {
                Item.ExtraData = "0";
                Item.UpdateState(true, true);
            }
        }
        public void Action(RoomItem Item, Task Task, string ExtraData)
        {
            if (ExtraData == "1")
            {
                Task.Wait(7000);
                Item.FireWorkCount--;

                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("itemid", Item.uint_0);
                    dbClient.ExecuteQuery("UPDATE items_firework SET fw_count = fw_count - 1 WHERE item_id = @itemid LIMIT 1");
                }
            }

            if (Item.FireWorkCount == 0)
            {
                ExtraData = "0";
            }

            Item.ExtraData = ExtraData;
            Item.UpdateState(true, true);

            Task.Wait();
            Task.Dispose();
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            DataTable dataTable = null;

            using (DatabaseClient @class = Essential.GetDatabase().GetClient())
            {
                dataTable = @class.ReadDataTable("SELECT asking_price FROM catalog_marketplace_offers WHERE user_id = '" + Session.GetHabbo().Id + "' AND state = '2'");
            }
            if (dataTable != null)
            {
                int num = 0;
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    num += (int)dataRow["asking_price"];
                }
                if (num >= 1)
                {
                    Session.GetHabbo().GiveCredits(num, "Reedem Marketplace Offers");
                    Session.GetHabbo().UpdateCredits(true);
                }
                using (DatabaseClient @class = Essential.GetDatabase().GetClient())
                {
                    @class.ExecuteQuery("DELETE FROM catalog_marketplace_offers WHERE user_id = '" + Session.GetHabbo().Id + "' AND state = '2'");
                }
            }
        }
Exemple #15
0
        public void method_3(int int_1)
        {
            AvatarEffect @class = this.method_5(int_1, false);

            if (@class != null && [email protected]_0 && [email protected]_0 && (this.method_8() != null && this.method_8().GetHabbo() != null))
            {
                Room class2 = this.method_9();
                if (class2 != null)
                {
                    RoomUser class3 = class2.GetRoomUserByHabbo(this.method_8().GetHabbo().Id);
                    if (class3.byte_1 <= 0 && class3.class34_1 == null)
                    {
                        using (DatabaseClient class4 = Essential.GetDatabase().GetClient())
                        {
                            class4.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE user_effects SET is_activated = '1', activated_stamp = '",
                                Essential.GetUnixTimestamp(),
                                "' WHERE user_id = '",
                                this.uint_0,
                                "' AND effect_id = '",
                                int_1,
                                "' LIMIT 1"
                            }));
                        }
                        @class.method_0();
                        ServerMessage Message = new ServerMessage(Outgoing.EnableEffect); // Updated
                        Message.AppendInt32(@class.int_0);
                        Message.AppendInt32(@class.int_1);
                        this.method_8().SendMessage(Message);
                    }
                }
            }
        }
        public void method_15(GameClient Session, uint uint_0, string string_0, bool bool_0)
        {
            GameClient @class = Essential.GetGame().GetClientManager().GetClient(uint_0);

            if (@class != null && @class.GetHabbo().CurrentRoomId >= 1u && @class.GetHabbo().Id != Session.GetHabbo().Id)
            {
                if (@class.GetHabbo().Rank >= Session.GetHabbo().Rank)
                {
                    Session.SendNotification(EssentialEnvironment.GetExternalText("mod_error_permission_kick"));
                }
                else
                {
                    Room class2 = Essential.GetGame().GetRoomManager().GetRoom(@class.GetHabbo().CurrentRoomId);
                    if (class2 != null)
                    {
                        class2.RemoveUserFromRoom(@class, true, false);
                        if (!bool_0)
                        {
                            @class.SendNotification(string_0);
                            using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
                            {
                                class3.ExecuteQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = '" + uint_0 + "' LIMIT 1");
                            }
                        }
                    }
                }
            }
        }
Exemple #17
0
        public void method_1(int int_1)
        {
            AvatarEffect @class = this.method_5(int_1, true);

            if (@class != null && @class.Boolean_0)
            {
                using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                {
                    class2.ExecuteQuery(string.Concat(new object[]
                    {
                        "DELETE FROM user_effects WHERE user_id = '",
                        this.uint_0,
                        "' AND effect_id = '",
                        int_1,
                        "' AND is_activated = '1' LIMIT 1"
                    }));
                }
                this.list_0.Remove(@class);
                ServerMessage Message = new ServerMessage(Outgoing.StopEffect); // Updated
                Message.AppendInt32(int_1);
                this.method_8().SendMessage(Message);
                if (this.int_0 >= 0)
                {
                    this.method_2(-1, false);
                }
            }
        }
        public void method_16(GameClient Session, uint uint_0, string string_0, bool bool_0)
        {
            GameClient @class = Essential.GetGame().GetClientManager().GetClient(uint_0);

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

            if (@class != null && @class.method_26(Session))
            {
                int    num       = Event.PopWiredInt32();
                uint   Data      = Event.PopWiredUInt();
                string BrandData = "state" + Convert.ToChar(9) + "0";
                for (int i = 1; i <= Data; i++)
                {
                    BrandData = BrandData + Convert.ToChar(9) + Event.PopFixedString();
                }
                using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                {
                    class2.AddParamWithValue("extradata", BrandData);
                    class2.ExecuteQuery("UPDATE items_extra_data SET extra_data = @extradata WHERE item_id = '" + num + "' LIMIT 1");
                }

                /*ServerMessage Message = new ServerMessage();
                 * Message.Init(Outgoing.ObjectDataUpdate); // Update
                 * Message.AppendStringWithBreak(num.ToString());
                 * Message.AppendInt32(0);
                 * Message.AppendInt32(1);
                 * Message.AppendStringWithBreak(BrandData);
                 * @class.SendMessage(Message, null);*/
                @class.method_28((uint)num).ExtraData = BrandData;
                @class.method_79(Session, @class.method_28((uint)num), @class.method_28((uint)num).GetX, @class.method_28((uint)num).Int32_1, @class.method_28((uint)num).int_3, false, false, true);
                @class.method_28((uint)num).UpdateState(true, false, true);
            }
        }
Exemple #20
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int           guildId = Event.PopWiredInt32();
            GroupsManager guild   = Groups.GetGroupById(guildId);

            if (!guild.UserWithRanks.Contains((int)Session.GetHabbo().Id))
            {
                return;
            }
            if (guild != null)
            {
                Room room = Essential.GetGame().GetRoomManager().method_15(Convert.ToUInt32(guild.RoomId));
                if (room != null)
                {
                    guild.ColorOne = Groups.GetHtmlColor(Event.PopWiredInt32());
                    guild.ColorTwo = Groups.GetHtmlColor(Event.PopWiredInt32());
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        dbClient.ExecuteQuery("UPDATE groups SET color_one='" + guild.ColorOne + "', color_two='" + guild.ColorTwo + "' WHERE id=" + guild.Id);
                        dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE items SET guild_data = '", guildId, ";", guild.ColorOne, ";", guild.ColorTwo, "' WHERE guild_data LIKE '", guildId, ";%'" }));
                    }
                    room.SaveSettingsPackets(guild, Session);
                    //Session.SendNotif(guild.CustomColor1.ToString() + " " + guild.HtmlColor1.ToString() + guild.CustomColor2.ToString() + " " + guild.HtmlColor2.ToString());
                }
            }
        }
Exemple #21
0
        private RoomModel method_9(uint uint_0)
        {
            DataRow dataRow;

            using (DatabaseClient @class = Essential.GetDatabase().GetClient())
            {
                dataRow = @class.ReadDataRow("SELECT doorx,doory,height,modeldata FROM room_models_customs WHERE roomid = '" + uint_0 + "'");
            }
            RoomModel RoomModel = new RoomModel("custom", (int)dataRow["doorx"], (int)dataRow["doory"], (double)dataRow["height"], 2, (string)dataRow["modeldata"], "", false);

            if (RoomModel != null)
            {
                return(RoomModel);
            }
            else
            {
                Room Room = this.GetRoom(uint_0);
                if (Room != null)
                {
                    Room.method_34();
                    return(null);
                }
                else
                {
                    return(null);
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int           guildId = Event.PopWiredInt32();
            string        str     = Event.PopFixedString();
            string        str2    = Event.PopFixedString();
            GroupsManager guild   = Groups.GetGroupById(guildId);

            if (!guild.UserWithRanks.Contains((int)Session.GetHabbo().Id))
            {
                return;
            }
            if (guild != null)
            {
                Room room = Essential.GetGame().GetRoomManager().GetRoom((uint)guild.RoomId);
                if (room != null)
                {
                    guild.Name        = str;
                    guild.Description = str2;
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        dbClient.AddParamWithValue("gd1", guild.Name);
                        dbClient.AddParamWithValue("gd2", guild.Description);
                        dbClient.ExecuteQuery("UPDATE groups SET name=@gd1, groups.desc=@gd2 WHERE id=" + guildId);
                    }
                    room.SaveSettingsPackets(guild, Session);
                }
            }
        }
Exemple #23
0
        internal ServerMessage SerializeRelationshipUpdate(uint targetId, uint newRelationshipState)
        {
            GameClient gc = Essential.GetGame().GetClientManager().GetClientByHabbo(Essential.GetGame().GetClientManager().GetNameById(targetId));

            if (gc != null && gc.GetHabbo() != null)
            {
                this.RelationshipStatusUpdate(targetId, newRelationshipState);
                ServerMessage reply = new ServerMessage(Outgoing.FriendUpdate);
                reply.AppendInt32(0);
                reply.AppendInt32(1);
                reply.AppendInt32(0);
                new Messenger.MessengerBuddy(gc.GetHabbo().Id, gc.GetHabbo().Username, gc.GetHabbo().Figure, gc.GetHabbo().Motto, gc.GetHabbo().LastOnline, (int)newRelationshipState).Serialize(reply, false);
                return(reply);
            }
            else
            {
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    DataRow dRow = dbClient.ReadDataRow("SELECT username,look,motto,last_online FROM users WHERE id=" + targetId);
                    this.RelationshipStatusUpdate(targetId, newRelationshipState);
                    ServerMessage reply = new ServerMessage(Outgoing.FriendUpdate);
                    reply.AppendInt32(0);
                    reply.AppendInt32(1);
                    reply.AppendInt32(0);
                    new Messenger.MessengerBuddy(targetId, (string)dRow["username"], (string)dRow["look"], (string)dRow["motto"], (string)dRow["last_online"], (int)newRelationshipState).Serialize(reply, false);
                    reply.AppendInt32(newRelationshipState);
                    return(reply);
                }
            }
        }
Exemple #24
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room != null)
            {
                string   string_ = Event.PopFixedString();
                RoomUser @class  = Room.method_56(string_);
                if (@class != null)
                {
                    uint uint_ = @class.GetClient().GetHabbo().Id;
                    if (!Session.GetHabbo().list_2.Contains(uint_))
                    {
                        Session.GetHabbo().list_2.Add(uint_);
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            class2.ExecuteQuery(string.Concat(new object[]
                            {
                                "INSERT INTO user_ignores(user_id, ignore_id) VALUES (",
                                Session.GetHabbo().Id,
                                ", ",
                                uint_,
                                ");"
                            }));
                        }
                        ServerMessage Message = new ServerMessage(Outgoing.UpdateIgnoreStatus); // Updated
                        Message.AppendInt32(1);
                        Message.AppendString(string_);
                        Session.SendMessage(Message);
                    }
                }
            }
        }
        public uint GetIdByName(string string_0)
        {
            GameClient @class = this.GetClientByHabbo(string_0);
            uint       result;

            if (@class != null && @class.GetHabbo() != null)
            {
                result = @class.GetHabbo().Id;
            }
            else
            {
                DataRow dataRow = null;
                using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                {
                    class2.AddParamWithValue("username", string_0);
                    dataRow = class2.ReadDataRow("SELECT Id FROM users WHERE username = @username LIMIT 1");
                }
                if (dataRow == null)
                {
                    result = 0u;
                }
                else
                {
                    result = (uint)dataRow[0];
                }
            }
            return(result);
        }
Exemple #26
0
 public DataRow GetUserRow(string UserID)
 {
     using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
     {
         return(dbClient.ReadDataRow("SELECT username,look,gender FROM users WHERE id='" + UserID + "' LIMIT 1"));
     }
 }
        internal bool method_9(uint uint_1, uint uint_2)
        {
            bool result;

            using (DatabaseClient @class = Essential.GetDatabase().GetClient())
            {
                if (@class.ReadDataRow(string.Concat(new object[]
                {
                    "SELECT user_one_id FROM messenger_friendships WHERE user_one_id = '",
                    uint_1,
                    "' AND user_two_id = '",
                    uint_2,
                    "' LIMIT 1"
                })) != null)
                {
                    result = true;
                    return(result);
                }
                if (@class.ReadDataRow(string.Concat(new object[]
                {
                    "SELECT user_one_id FROM messenger_friendships WHERE user_one_id = '",
                    uint_2,
                    "' AND user_two_id = '",
                    uint_1,
                    "' LIMIT 1"
                })) != null)
                {
                    result = true;
                    return(result);
                }
            }
            result = false;
            return(result);
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room class14_ = Session.GetHabbo().CurrentRoom;

            if (class14_ != null)
            {
                string   string_ = Event.PopFixedString();
                RoomUser @class  = class14_.method_56(string_);
                if (@class != null)
                {
                    uint uint_ = @class.GetClient().GetHabbo().Id;
                    if (Session.GetHabbo().list_2.Contains(uint_))
                    {
                        Session.GetHabbo().list_2.Remove(uint_);
                        using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
                        {
                            class2.ExecuteQuery(string.Concat(new object[]
                            {
                                "DELETE FROM user_ignores WHERE user_id = ",
                                Session.GetHabbo().Id,
                                " AND ignore_id = ",
                                uint_,
                                " LIMIT 1;"
                            }));
                        }
                        ServerMessage Message = new ServerMessage(Outgoing.UpdateIgnoreStatus); // Updated
                        Message.AppendInt32(3);
                        Message.AppendString(string_);
                        Session.SendMessage(Message);
                    }
                }
            }
        }
Exemple #29
0
        public ServerMessage SerializeMyHistory(GameClient Session)
        {
            ServerMessage result;

            using (DatabaseClient @class = Essential.GetDatabase().GetClient())
            {
                DataTable       dataTable = @class.ReadDataTable("SELECT * FROM rooms JOIN user_roomvisits ON rooms.Id = user_roomvisits.room_id WHERE user_roomvisits.user_id = '" + Session.GetHabbo().Id + "' ORDER BY entry_timestamp DESC LIMIT 50;");
                List <RoomData> list      = new List <RoomData>();
                List <uint>     list2     = new List <uint>();
                if (dataTable != null)
                {
                    foreach (DataRow dataRow in dataTable.Rows)
                    {
                        RoomData class2 = Essential.GetGame().GetRoomManager().method_17((uint)dataRow["Id"], dataRow);
                        class2.method_1(dataRow);
                        list.Add(class2);
                        list2.Add(class2.Id);
                    }
                }
                ServerMessage Message = new ServerMessage(Outgoing.NavigatorPacket);
                Message.AppendInt32(7);
                Message.AppendStringWithBreak("");
                Message.AppendInt32(list.Count);
                foreach (RoomData current in list)
                {
                    current.Serialize(Message, false, false);
                }
                Message.AppendBoolean(false);
                result = Message;
            }

            return(result);
        }
Exemple #30
0
 internal void SavePets()
 {
     using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
     {
         this.SavePets(dbClient, false);
     }
 }