Greasy Fork is available in English.
try to take over the world!
当前为
// ==UserScript==
// @name Xbox Cloud Gaming Aim Assist
// @namespace http://tampermonkey.net/
// @version 0.3
// @description try to take over the world!
// @author You
// @match https://xcloud.gg/*
// @match https://www.xbox.com/play/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Set the aim assist settings
var aimAssistSettings = {
enabled: true,
sensitivity: 15, // Adjust this value to change the aim assist's sensitivity
range: 150, // Adjust this value to change the aim assist's range
speed: 10, // Adjust this value to change the aim assist's speed
accuracy: 0.8, // Adjust this value to change the aim assist's accuracy (0 = random, 1 = precise)
smoothing: 0.05, // Adjust this value to change the aim assist's smoothing (0 = instant, 1 = slow)
threshold: 15, // Adjust this value to change the aim assist's threshold (minimum distance to trigger aim assist)
maxDistance: 250, // Adjust this value to change the aim assist's maximum distance
minDistance: 75, // Adjust this value to change the aim assist's minimum distance
};
// Get the game's canvas element
var canvas = document.querySelector('canvas');
// Add an event listener to the canvas to track the user's mouse movements
canvas.addEventListener('mousemove', function(event) {
// Get the user's mouse position
var mouseX = event.clientX;
var mouseY = event.clientY;
// Get the game's crosshair position
var crosshairX = mouseX;
var crosshairY = mouseY;
// Calculate the aim assist's target position
var targets = getTargets(crosshairX, crosshairY);
var bestTarget = getBestTarget(targets, crosshairX, crosshairY);
// Calculate the aim assist's movement vector
if (bestTarget) {
var movementX = bestTarget.x - crosshairX;
var movementY = bestTarget.y - crosshairY;
// Normalize the movement vector
var length = Math.sqrt(movementX * movementX + movementY * movementY);
movementX /= length;
movementY /= length;
// Apply the aim assist's movement
if (aimAssistSettings.enabled && length > aimAssistSettings.threshold && length < aimAssistSettings.maxDistance) {
// Move the crosshair towards the target position
crosshairX += movementX * aimAssistSettings.speed * aimAssistSettings.sensitivity;
crosshairY += movementY * aimAssistSettings.speed * aimAssistSettings.sensitivity;
// Update the game's crosshair position
// NOTE: This will depend on the game's implementation and may require additional code to work correctly
// For example, you might need to use the game's API to update the crosshair position
// or simulate a mouse movement event to move the crosshair
simulateMouseMovement(crosshairX, crosshairY);
}
}
});
// Function to get targets (e.g. enemies, objects, etc.)
function getTargets(x, y) {
// NOTE: This function should return an array of target objects with x and y properties
// For example, you could use the game's API to get a list of enemies on the screen
// or use image recognition to detect objects on the screen
return [
{ x: 100, y: 100 },
{ x: 200, y: 200 },
{ x: 300, y: 300 },
];
}
// Function to get the best target
function getBestTarget(targets, x, y) {
// NOTE: This function should return the best target object based on the aim assist's settings
// For example, you could use the aim assist's accuracy setting to determine the best target
var bestTarget = null;
var bestDistance = Infinity;
for (var i = 0; i < targets.length; i++) {
var target = targets[i];
var distance = Math.sqrt(Math.pow(target.x - x, 2) + Math.pow(target.y - y, 2));
if (distance < bestDistance && distance > aimAssistSettings.minDistance) {
bestTarget = target;
bestDistance = distance;
}
}
return bestTarget;
}
// Function to simulate a mouse movement event
function simulateMouseMovement(x, y) {
// Create a new mouse movement event
var event = new MouseEvent('mousemove', {
bubbles: true,
cancelable: true,
clientX: x,
clientY: y,
});
// Dispatch the event to the canvas element
canvas.dispatchEvent(event);
}
})();