您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
chat test
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/534139/1590693/koc%20chat.js
Tabs.AutoPorterTracker = { tabOrder: 2200, tabLabel: "Porter Tracker", tabColor: "cyan", myDiv: null, porters: [], // Array to store tracked porters init(div) { this.myDiv = div; this.paint(); }, paint() { const m = ` <div class="divHeader" align="center">Auto Porter Tracker</div> <br> <div align="center"> <label for="porterInput">Porter Name/UID:</label> <input type="text" id="porterInput" class="btInput"> <button id="addPorterButton" class="buttonv2 std blue">Track Porter</button> <div id="porterList"></div> <br> <div id="porterTrackerStatus"></div> </div> `; this.myDiv.innerHTML = m; // Add click listener $("#addPorterButton").click(() => this.addPorter()); }, async addPorter() { const porterInput = $("#porterInput").val().trim(); if (porterInput === "") return; try { const player = await getPlayerInfo(porterInput); // You must define this if (player) { this.porters.push({ player, lastSeenLocation: player.location, // Assuming player has this lastSeenAt: Date.now() }); this.savePorters(); this.displayPorterList(); this.updateStatus(`Porter ${player.name} added to tracking list.`); } else { this.updateStatus("Player not found."); } } catch (err) { this.updateStatus("Error retrieving player data."); } $("#porterInput").val(""); // Clear input field }, displayPorterList() { const listDiv = $("#porterList"); if (!this.porters.length) { listDiv.html("<i>No porters are currently being tracked.</i>"); return; } let html = "<table class='portersTable'><tr><th>Name</th><th>UID</th><th>Last Location</th><th>Last Seen</th></tr>"; this.porters.forEach(({ player, lastSeenLocation, lastSeenAt }) => { html += `<tr> <td>${player.name}</td> <td>${player.uid}</td> <td>${lastSeenLocation}</td> <td>${new Date(lastSeenAt).toLocaleString()}</td> </tr>`; }); html += "</table>"; listDiv.html(html); }, async checkPorterLocations() { for (const porterData of this.porters) { const { player, lastSeenLocation } = porterData; const updatedPlayer = await getPlayerInfo(player.uid); // Use UID for accuracy if (updatedPlayer && updatedPlayer.location !== lastSeenLocation) { this.notifyPort(updatedPlayer, updatedPlayer.location); porterData.player = updatedPlayer; porterData.lastSeenLocation = updatedPlayer.location; porterData.lastSeenAt = Date.now(); this.savePorters(); this.displayPorterList(); } } }, notifyPort(player, newLocation) { this.updateStatus(`⚠️ Porter ${player.name} has ported to ${newLocation}!`); // Optional: play a sound or flash tab }, updateStatus(message) { $("#porterTrackerStatus").html(`<b>${message}</b>`); }, savePorters() { GM_setValue("trackedPorters", JSON.stringify(this.porters)); }, loadPorters() { const saved = GM_getValue("trackedPorters", "[]"); this.porters = JSON.parse(saved); }, show() { this.loadPorters(); this.displayPorterList(); }, hide() { // Optional cleanup }, EverySecond() { this.checkPorterLocations(); } };