Ejemplo n.º 1
0
        private static void smethod_6(Session session_0, ClientMessage clientMessage_0)
        {
            uint num = clientMessage_0.ReadUnsignedInteger();

            using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
            {
                client.SetParameter("user1", session_0.CharacterId);
                client.SetParameter("user2", num);
                client.SetParameter("confirmed", 1);
                if (client.ExecuteNonQuery("UPDATE laptop_amigos SET aceptado = @confirmed WHERE id_usuario = @user1 AND id_amigo = @user2 LIMIT 1") > 0)
                {
                    client.SetParameter("user1", num);
                    client.SetParameter("user2", session_0.CharacterId);
                    client.SetParameter("confirmed", 1);
                    client.ExecuteNonQuery("INSERT INTO laptop_amigos (id_usuario,id_amigo,aceptado) VALUES (@user1,@user2,@confirmed)");
                    session_0.LaptopFriendCache.AddToCache(num);
                    Session sessionByCharacterId = SessionManager.GetSessionByCharacterId(num);
                    if (sessionByCharacterId != null)
                    {
                        sessionByCharacterId.LaptopFriendCache.AddToCache(session_0.CharacterId);
                        ForceLaptopUpdateForSession(sessionByCharacterId);
                        sessionByCharacterId.SendData(LaptopNewFriendComposer.Compose(session_0.CharacterInfo), false);
                    }
                    session_0.SendData(LaptopAcceptFriendComposer.Compose(num), false);
                }
            }
        }
Ejemplo n.º 2
0
        private static void smethod_6(Session session_0, ClientMessage clientMessage_0)
        {
            uint num = clientMessage_0.ReadUnsignedInteger();

            using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
            {
                client.SetParameter("user1", session_0.CharacterId);
                client.SetParameter("user2", num);
                client.SetParameter("confirmed", 1);
                string query1 = "UPDATE laptop_amigos SET aceptado = '1' WHERE id_usuario = " + session_0.CharacterId + " AND id_amigo = " + num + " LIMIT 1";
                Console.WriteLine(query1);
                if (client.ExecuteNonQuery(query1) > 0)
                {
                    client.ExecuteNonQuery("UPDATE laptop_amigos SET aceptado = '1' WHERE id_usuario = " + num + " AND id_amigo = " + session_0.CharacterId + " LIMIT 1");
                    session_0.LaptopFriendCache.AddToCache(num);
                    Session sessionByCharacterId = SessionManager.GetSessionByCharacterId(num);
                    if (sessionByCharacterId != null)
                    {
                        sessionByCharacterId.LaptopFriendCache.AddToCache(session_0.CharacterId);
                        ForceLaptopUpdateForSession(sessionByCharacterId);
                        sessionByCharacterId.SendData(LaptopNewFriendComposer.Compose(session_0.CharacterInfo));
                    }
                    session_0.SendData(LaptopAcceptFriendComposer.Compose(num));
                }
            }
        }