您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Modify from ASI in Squad Overview script
当前为
- // ==UserScript==
- // @name TMVN Squad BP WA XP
- // @version 3
- // @description Modify from ASI in Squad Overview script
- // @namespace https://trophymanager.com
- // @include https://trophymanager.com/club/*/squad/*
- // @include https://trophymanager.com/club/*/squad/*
- // @include https://trophymanager.com/club/%20/squad/
- // @grant none
- // ==/UserScript==
- function collect() {
- var ret = {};
- var len = arguments.length;
- for (var i = 0; i < len; i++) {
- for (var p in arguments[i]) {
- if (arguments[i].hasOwnProperty(p)) {
- ret[p] = arguments[i][p];
- }
- }
- }
- return ret;
- }
- var new_player_array = [];
- var team_b_id = "";
- $.ajaxSetup({
- async: false
- });
- $.post("/ajax/players_get_select.ajax.php", {
- "type": "change",
- "club_id": SUBPAGE
- }, function (data) {
- data = JSON.parse(data);
- new_player_array = data.post;
- });
- function objectLength(obj) {
- var result = 0;
- for (var prop in obj) {
- if (obj.hasOwnProperty(prop)) {
- result++;
- }
- }
- return result;
- }
- $("#player_table tr:eq(0)")[0].childNodes[5].innerHTML = 'Recommend';
- $("#player_table tr:eq(0)").append('<th align="right">BP</th><th align="right">WA</th><th align="right">XP</th>');
- var count = 0;
- var countU21 = 0;
- var totalBankPrice = 0;
- var totalBankPriceU21 = 0;
- var totalWage = 0;
- var totalWageU21 = 0;
- var totalASI = 0;
- var totalASIU21 = 0;
- var totalXP = 0;
- var totalXPU21 = 0;
- var national = $('.box_sub_header a')[2].getAttribute('href').substring(16, 18);
- $("#player_table tr > .text_fade > div").not(".text_fade_overlay").find("a[player_link]").each(function () {
- player_link = $(this).attr("player_link");
- if (new_player_array[player_link] == null && team_b_id === "") {
- console.log("finding team b id");
- $.post("https://trophymanager.com/ajax/players_get_info.ajax.php", {
- "player_id": player_link,
- "type": "history",
- "show_non_pro_graphs": false
- }, function (data) {
- data = JSON.parse(data);
- team_b_id = data.table.nat[0].klub_id;
- });
- $.post("/ajax/players_get_select.ajax.php", {
- "type": "change",
- "club_id": team_b_id
- }, function (data) {
- data = JSON.parse(data);
- new_player_array = collect(new_player_array, data.post);
- });
- }
- current_player_info = new_player_array[player_link];
- parent_select = $(this).parent().parent().parent();
- parent_select.find("td:eq(2)").append("." + Number(current_player_info.month));
- let pow = Math.pow;
- let bp = 0;
- if (current_player_info.fp === "GK") {
- bp = (current_player_info.asi * 500 * pow((300 / (Number(current_player_info.age) * 12 + Number(current_player_info.month))), 2.5)) * 0.75;
- } else {
- bp = (current_player_info.asi * 500 * pow((300 / (Number(current_player_info.age) * 12 + Number(current_player_info.month))), 2.5));
- }
- if (current_player_info.country !== national) {
- parent_select.append('<td align="right"><span style="color:Orange;">' + (bp / 1000000).toFixed(1) + '</span></td>');
- } else {
- parent_select.append('<td align="right">' + (bp / 1000000).toFixed(1) + '</td>');
- }
- parent_select.append('<td align="right">' + Math.round(current_player_info.wage / 1000) + '</td>');
- parent_select.append('<td align="right" style="color:Orange;">' + current_player_info.rutine + '</td>');
- if (Number(current_player_info.age) > 21) {
- count++;
- } else {
- countU21++;
- }
- if (Number(current_player_info.age) > 21) {
- totalBankPrice += bp;
- } else {
- totalBankPriceU21 += bp;
- }
- if (Number(current_player_info.age) > 21) {
- totalWage += Number(current_player_info.wage);
- } else {
- totalWageU21 += Number(current_player_info.wage);
- }
- if (Number(current_player_info.age) > 21) {
- totalASI += current_player_info.asi;
- } else {
- totalASIU21 += current_player_info.asi;
- }
- if (Number(current_player_info.age) > 21) {
- totalXP += Number(current_player_info.rutine);
- } else {
- totalXPU21 += Number(current_player_info.rutine);
- }
- });
- var clubId = $('.box_sub_header a')[1].getAttribute('club_link');
- if (clubId) {
- localStorage.setItem(clubId + "_SQUAD_VALUE", JSON.stringify({
- "Time": new Date(),
- "BP": (totalBankPrice + totalBankPriceU21),
- "Wage": (totalWage + totalWageU21),
- "Count": (count + countU21)
- }));
- localStorage.setItem(clubId + "_U21_SQUAD_VALUE", JSON.stringify({
- "Time": new Date(),
- "BP": (totalBankPriceU21),
- "Wage": (totalWageU21),
- "Count": (countU21)
- }));
- localStorage.setItem(clubId + "_O21_SQUAD_VALUE", JSON.stringify({
- "Time": new Date(),
- "BP": (totalBankPrice),
- "Wage": (totalWage),
- "Count": (count)
- }));
- }
- $('div.column3_a')[0].childNodes[3].childNodes[3].childNodes[2].childNodes[1].innerHTML +=
- '<br>' +
- 'Total Bank Price: <span style="color:Orange;">' + totalBankPrice.toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Total Wage: <span style="color:Orange;">' + totalWage.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Total ASI: <span style="color:Orange;">' + totalASI.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Total XP: <span style="color:Orange;">' + totalXP.toFixed(1) + '</span><br>' +
- '<br>' +
- 'Average Bank Price: <span style="color:Orange;">' + (totalBankPrice / (count > 0 ? count : 1)).toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Average Wage: <span style="color:Orange;">' + Math.round(totalWage / (count > 0 ? count : 1)).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Average ASI: <span style="color:Orange;">' + (totalASI / (count > 0 ? count : 1)).toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Average XP: <span style="color:Orange;">' + (totalXP / (count > 0 ? count : 1)).toFixed(1) + '</span><br>';
- $('div.column3_a')[0].childNodes[3].childNodes[3].childNodes[6].childNodes[1].innerHTML +=
- '<br>' +
- 'Total Bank Price: <span style="color:Orange;">' + totalBankPriceU21.toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Total Wage: <span style="color:Orange;">' + totalWageU21.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Total ASI: <span style="color:Orange;">' + totalASIU21.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Total XP: <span style="color:Orange;">' + totalXPU21.toFixed(1) + '</span><br>' +
- '<br>' +
- 'Average Bank Price: <span style="color:Orange;">' + (totalBankPriceU21 / (countU21 > 0 ? countU21 : 1)).toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Average Wage: <span style="color:Orange;">' + Math.round(totalWageU21 / (countU21 > 0 ? countU21 : 1)).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Average ASI: <span style="color:Orange;">' + (totalASIU21 / (countU21 > 0 ? countU21 : 1)).toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span><br>' +
- 'Average XP: <span style="color:Orange;">' + (totalXPU21 / (countU21 > 0 ? countU21 : 1)).toFixed(1) + '</span><br>';
- $.ajaxSetup({
- async: true
- });