您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Bring an element of surprise to your tank customization experience with the Tank Randomizer!
当前为
// ==UserScript== // @name Tank-Randomizer // @author Kamarov // @description Bring an element of surprise to your tank customization experience with the Tank Randomizer! // @version 0.0.4 // @namespace https://github.com/kamarov-therussiantank // @license GPL-3.0 // @match https://*.tanktrouble.com/* // @desc Randomize your tank in style! // @run-at document-end // @grant GM_addStyle // @require https://update.gf.qytechs.cn/scripts/482092/1297984/TankTrouble%20Development%20Library.js // @noframes // ==/UserScript== GM_addStyle(` .randomize-button { margin-bottom: 10px; } `); whenContentInitialized().then(() => { var id = Users.getAllPlayerIds()[0]; var turret = []; var back = []; var barrel = []; var front = []; var colours = []; var baseColor = ''; function randomize() { randomizePaint(); randomizeTankcessories(); } function randomizeTankcessories() { Backend.getInstance().setAccessory( function (result) { Users.updateUser(id, true, false); }, null, null, id, 'back', back[Math.floor(Math.random() * back.length)], Caches.getPlayerDetailsCache() ); Backend.getInstance().setAccessory( function (result) { Users.updateUser(id, true, false); }, null, null, id, 'turret', turret[Math.floor(Math.random() * turret.length)], Caches.getPlayerDetailsCache() ); Backend.getInstance().setAccessory( function (result) { Users.updateUser(id, true, false); }, null, null, id, 'front', front[Math.floor(Math.random() * front.length)], Caches.getPlayerDetailsCache() ); Backend.getInstance().setAccessory( function (result) { Users.updateUser(id, true, false); }, null, null, id, 'tread', Math.floor(Math.random() * 25) + 1, Caches.getPlayerDetailsCache() ); Backend.getInstance().setAccessory( function (result) { Users.updateUser(id, true, false); }, null, null, id, 'barrel', barrel[Math.floor(Math.random() * barrel.length)], Caches.getPlayerDetailsCache() ); } function randomizePaint() { var selectedColor = colours[Math.floor(Math.random() * colours.length)]; function setColorForPart(part) { Backend.getInstance().setColour( function (result) { Users.updateUser(id, true, false); }, function (result) { }, function (result) { }, id, part, selectedColor, Caches.getPlayerDetailsCache() ); } setColorForPart('base'); setColorForPart('turret'); setColorForPart('tread'); } function randomizeA() { randomizeTankcessoriesA(); } function randomizeTankcessoriesA() { Backend.getInstance().setAccessory( function (result) { Users.updateUser(id, true, false); }, null, null, id, 'back', back[Math.floor(Math.random() * back.length)], Caches.getPlayerDetailsCache() ); Backend.getInstance().setAccessory( function (result) { Users.updateUser(id, true, false); }, null, null, id, 'turret', turret[Math.floor(Math.random() * turret.length)], Caches.getPlayerDetailsCache() ); Backend.getInstance().setAccessory( function (result) { Users.updateUser(id, true, false); }, null, null, id, 'front', front[Math.floor(Math.random() * front.length)], Caches.getPlayerDetailsCache() ); Backend.getInstance().setAccessory( function (result) { Users.updateUser(id, true, false); }, null, null, id, 'tread', Math.floor(Math.random() * 25) + 1, Caches.getPlayerDetailsCache() ); Backend.getInstance().setAccessory( function (result) { Users.updateUser(id, true, false); }, null, null, id, 'barrel', barrel[Math.floor(Math.random() * barrel.length)], Caches.getPlayerDetailsCache() ); } function randomizeC() { randomizePaintC(); } function randomizePaintC() { var selectedColor = colours[Math.floor(Math.random() * colours.length)]; function setColorForPart(part) { Backend.getInstance().setColour( function (result) { Users.updateUser(id, true, false); }, function (result) { }, function (result) { }, id, part, selectedColor, Caches.getPlayerDetailsCache() ); } // Generate a new random color for each part setColorForPart('base'); setColorForPart('turret'); setColorForPart('tread'); } Backend.getInstance().getGarageContent( function (result) { boxes = result['boxes']; for (box in boxes) { accessories = boxes[box]['accessories']; sprays = boxes[box]['sprayCans']; for (accessory in accessories) { thing = accessories[accessory]; if (thing['type'] == 'front') { front.push(thing['value']); } if (thing['type'] == 'back') { back.push(thing['value']); } if (thing['type'] == 'barrel') { barrel.push(thing['value']); } if (thing['type'] == 'turret') { turret.push(thing['value']); } } for (spray in sprays) { thing = sprays[spray]['colour']; if (thing['type']) { colours.push(thing['rawValue']); } } } // Randomly select the base color baseColor = colours[Math.floor(Math.random() * colours.length)]; }, function (res) { }, function (res) { }, id, Caches.getGarageContentCache() ); var snippet = $(` <div id="randomizerSnippet" class="snippet"> <div class="header">Meet the Tank Randomizer</div> Inject a dash of unpredictability into your tank's appearance <hr> <div class="header" style="color: gold;">Randomize</div> </div> `); var content = $('<div></div>'); var allPartsButton = $('<button class="randomize-button button" type="button" tabindex="-1">All Parts</button>'); var accessoriesButton = $('<button class="randomize-button button" type="button" tabindex="-1">Accessories</button>'); var paintsButton = $('<button class="randomize-button button" type="button" tabindex="-1">Paints</button>'); allPartsButton.on('mouseup', () => randomize()); accessoriesButton.on('mouseup', () => randomizeA()); paintsButton.on('mouseup', () => randomizeC()); content.append([allPartsButton, accessoriesButton, paintsButton]); snippet.append(content); $('#secondaryContent').append(snippet); $('#tertiaryContent').append(` <div class="snippet" tabindex="-1" style="min-width: 100px; background-image: color(#666666);"> <h2 class="text" style="font-family: "TankTrouble"; font-size: 5; color: #333333;">Feedback</h2> <p><a class="report-bugs-link" href="https://gf.qytechs.cn/en/scripts/482239-tank-randomizer/feedback" style="text-decoration: underline; color: black; cursor: pointer;">here</a></p> </div> `); });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址