Kogama Player Tracers and Names

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);

})();