Kogama Player Tracers and Names

Adds visual tracers and player names to Kogama games (for personal use)

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Kogama Player Tracers and Names
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds visual tracers and player names to Kogama games (for personal use)
// @author       Your Name
// @match        *://*.kogama.com/games/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to create and update visual effects
    function updateVisuals() {
        // Remove any existing overlays
        document.querySelectorAll('.custom-tracer').forEach(el => el.remove());
        document.querySelectorAll('.custom-name').forEach(el => el.remove());

        // Example: Assuming player elements have the class 'player' and a data attribute 'data-name'
        const players = document.querySelectorAll('.player'); // Adjust this selector as needed

        players.forEach(player => {
            // Create tracer
            const tracer = document.createElement('div');
            tracer.className = 'custom-tracer';
            tracer.style.position = 'absolute';
            tracer.style.width = '2px';
            tracer.style.height = '100px'; // Adjust height as needed
            tracer.style.backgroundColor = 'red';
            tracer.style.top = (player.offsetTop - 50) + 'px'; // Position it above the player
            tracer.style.left = (player.offsetLeft + (player.offsetWidth / 2)) + 'px'; // Centered
            document.body.appendChild(tracer);

            // Create name label
            const nameLabel = document.createElement('div');
            nameLabel.className = 'custom-name';
            nameLabel.style.position = 'absolute';
            nameLabel.style.top = (player.offsetTop - 20) + 'px'; // Position it above the player
            nameLabel.style.left = (player.offsetLeft + (player.offsetWidth / 2)) + 'px'; // Centered
            nameLabel.style.color = 'white';
            nameLabel.style.textAlign = 'center';
            nameLabel.textContent = player.getAttribute('data-name'); // Adjust based on how names are stored
            document.body.appendChild(nameLabel);
        });
    }

    // Update visuals every 500ms
    setInterval(updateVisuals, 500);

})();