// ==UserScript== // @name 【FSU】FIFA FUT WEB 增强器 // @namespace https://futcd.com/ // @version 2.1 // @description FIFAFUT模式SBC任务便捷操作增强器👍👍👍,固定球员筛选选项、近期低价一键查询、一键添加重复球员、拍卖行优化等等...👍👍👍 // @author Futcd_kcka // @match https://www.ea.com/fifa/ultimate-team/web-app/* // @match https://www.easports.com/*/fifa/ultimate-team/web-app/* // @match https://www.ea.com/*/fifa/ultimate-team/web-app/* // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAJ/ElEQVR4nO2dfbRVRRmHHxRNxDBNQlCWSqQ3MgOzUsNSCmOR5CIM+iJcZbhSpGWJSCpiUIvKzDJcoRCGRJlUrK5laloKSqRSkHx5L9GqqFiBukjFoAv98bunS+fMPmdmz+zZe9/O8w+LzZx3hv07Zz7eeeedHvv376eas+burnlWMHoBZwIXAAOAE4AewDbgb8DPgceB5/JqoA2rrulV86xnDu3woQ9wLTAJ6Fen3BRgF/AD4EbgL9k3LQwH5d0ABz4NtAFXU1+MCn2AS4DNwOeBg7NrWjjKIMi7gJXALcBrUnz+cOB6YCPwoXDNyoYiC/J64IfAL4C3B7D3OmAp8BBwXgB7mVBEQQ4B5gAbgPdnYH8E8DAwH+ifgX0viibIeNTnXxuhrsloTPpUhLqsKYogI4AVwN3ASRHr7Q3cBqwHPhyx3kTyFmQg6joeAobn2I4hwHeBVmBoju3IVZCrgHbUdRSFC4DfAjcDr8qjAXkIMg7YBHwFODSH+m24EthCDuNLTEHejKawy4BTItablqPR+LIGOD9WpTEEOQKYBzyJFnllYxhwP3AP8pllStaCVNwdlwWy9zTwReB24IU65fYBi5Efa2Wgui+iyw3TO5DNGrISZAxa2N0CHBvA3g7gE8Ab0RrlUmAwsNVQ9gU0a5oEzALOAd6LXCe+vAK5YbYAnwxgr4bQgrQAy4GfINdHCOYit8e3q55vB6Yays9E3+QD+RkSaTrwYoA29UO/0l8S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R+LZ2xrAOqdEx8LrEXf4BBro3bkJhpJoHE19J76cpRU+Crgn4Ft2zKL2oyfLcBPUTL9UJtqN6HjFUHTqWcV5PBVlOkzdVi+Byeg2dJ16JabRej2uFAZ7ZYiV9A0MogpyPJ8yA7URy9A+dFHZlhXNf3R9DUka9F4memGXIwwoLXoct/xaCAtG/9Ah3CGEmF3NGZc1j3IDT+d+vfYFonKOHFbrApjB8p1oOuDBqOr8orK/cjdMY2w1240JK/Ixe0o3/s5FCtIYiO6OW4UCn6ITt6hpCvpupoiVORHGnajTNZDiBjHayJvQSosRLdtXp9D3beiW4ESd/FiUhRBQAdD56BFXIg7DhvxIOoyp+Lp7ghJkQSpsJmuW0BD3E1STTu6zfN81GUWiiIKUqEVBUpMRndc+bIXdYknE+6+2+AUWZAKd6CX6LMWqKyB5lCsrYIayiAIyFF5OUqiuczhcw+jDajxKICv8MRMPhOCDcAH0M7eaGAE0I+uAOcdaI3zGNrL3pBDG734D+mntpkNC0pxAAAAAElFTkSuQmCC // @require https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/2.2.1/jquery.min.js // @grant GM_addStyle // @grant GM_log // @grant GM_openInTab // @grant GM_xmlhttpRequest // @connect ea.com // @connect futbin.com // @connect futcd.com // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; window.requirementTarget = ""; var futsbcup = {},events = {},info = {},cntlr = {},html = {},className = {}; info = { "unassigned":{"state":false,"run":0,"playerId":[]}, "task":{"obj":{"parent":".ut-tile-hub-objective","stat":{},"html":{}},"sbc":{"parent":".ut-tile-hub-sbc","stat":{},"html":{}}}, "base":{"state":false,"platform":"pc","price":{}}, "criteria":{"state":false,"data":{}}, }; cntlr = { "current":function(){return getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController().getCurrentController();}, "right":function(){return getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController().getCurrentController()._rightController._currentController}, "left":function(){return getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController().getCurrentController()._leftController}, }; events.notice = function(text,type){ services.Notification.queue([text,type]) }; events.init = function(){ GM_xmlhttpRequest({ method:"GET", url:"https://futcd.com/data/fsuupdata.json", headers: { "Content-type": "application/json" }, onload:function(res){ let urlText = "【FSU】插件使用说明"; let urlLink = "https://mfrasi851i.feishu.cn/docx/JJsjdos9go7pWxxaiaBcWNVinOf"; if(res.status == 404){ events.notice("查询新版本失败",2); }else{ let data = JSON.parse(res.response); let myVersion = Number(GM_info.script.version) || 0; if(data["version"] > myVersion){ urlText = "有新版FSU插件可升级"; urlLink = data["updateURL"]; events.notice("有新版本点击顶部链接查看",1); } } getAppMain()._FIFAHeader._view.__fifaLink.insertAdjacentHTML('afterend', "" + urlText + ""); }, onerror:function(){ events.notice("查询新版本失败",2); } }) let user = services.User.getUser().getSelectedPersona(); if(user.isXbox || user.isPlaystation || user.isStadia){ info.base.platform = "ps"; info.base.platform = "ps"; } services.User.maxAllowedAuctions = 100; GM_xmlhttpRequest({ method:"GET", url:"https://futcd.com/data/futpricenew.json", headers: { "Content-type": "application/json" }, onload:function(res){ let data = JSON.parse(res.response); if(info.base.platform == "pc"){ info.base.price = data["pc"]; }else{ info.base.price = data["tv"]; } }, }) let SID = services.Authentication.sessionUtas.id; console.log(SID) GM_xmlhttpRequest({ method:"GET", url:"https://utas.mob.v1.fut.ea.com/ut/game/fifa23/scmp/campaign/categories", headers: { "Content-type": "application/json", "X-UT-SID": SID }, onload:function(response){ let data = JSON.parse(response.response); let nowDate = Math.round(new Date().getTime()/1000); let objJson = {reward:"",new:{"-1":0}}; let rewardJson = {"球员":0,"组合包":0}; for (let i = 0; i < data.length; i++) { data[i].groupsList.forEach( (item,key) => { let tempJson = {"f":"0","e":"0"} if(item.title !== "每日目标"){ if(item.startTime >= nowDate - 86400){ tempJson.f = "1"; objJson.new["-1"]++; if(objJson.new.hasOwnProperty(String(i+1))){ objJson.new[String(i+1)]++; }else{ objJson.new[String(i+1)] = 1; } for (let z = 0; z < item.awardsList.length; z++) { if(item.awardsList[z].awardType == "pack"){ rewardJson["组合包"]++; } if(item.awardsList[z].awardType == "item"){ if(item.awardsList[z].itemDataReduced.itemType == "player"){ rewardJson["球员"]++; } } } } if(item.endTime <= nowDate + 86400 && item.endTime !== 0){ tempJson.e = "1"; } } objJson[item.groupType.toString()+"-"+item.groupId.toString()] = tempJson; }) } let reward = []; if(rewardJson["球员"] > 0){ reward.push("球员") } if(rewardJson["组合包"] > 0){ reward.push("组合包") } objJson.reward = reward.join("、"); info.task.obj.stat = objJson; info.task.obj.html = events.taskHtml(objJson.new["-1"],objJson.reward); }, }) GM_xmlhttpRequest({ method:"GET", url:"https://futcd.com/data/futsbc.json", headers: { "Content-type": "application/json", "Cache-Control": "600" }, onload:function(res){ let sbcJson = JSON.parse(res.response); info.task.sbc.stat = sbcJson; info.task.sbc.html = events.taskHtml(sbcJson.new["0"],sbcJson.reward); }, }) }; events.taskHtml = function(number,text){ let html = "
{Number}
{reward}
"; if(number > 0){ html = html.replace("{Number}","今日新增" + number + "个"); }else{ html = html.replace("tr","tr no"); html = html.replace("{Number}","今日无新增"); } if(text == "、"){ text = ""; } html = html.replace("{reward}",text); return html; }; events.uasReset = function(){ if($("#uasreset").length == 0){ $(".ut-section-header-view").eq(0).append(html.uasBtn); $("#uasreset").click(function () { services.Item.itemDao.itemRepo.unassigned.reset(); getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController()._backButton._tapDetected(this); events.notice("已重新载入列表 请重新进入查看",0); }) } }; html = { "priceBtn":"", "priceBtn2":"", "priceShow":"
近期低价
{price}
{price2}
", "priceShow2":"
评分低价
{price}
", "task":"
昨日新增{Number}个
{reward}
", "taskBar":"
{Number}
", "sbcInfo":"
造价预估:{price}
值得做:{up}不值得:{down}
", "copyBtn":"作业", "countBtn":"计算", "searchInput":"", "uasBtn":"", }; className = { "home":"UTHomeHubViewController", "object":"UTObjectivesHubViewController", "sbc":"UTSBCHubViewController", "sbcList":"UTSBCChallengesViewController", "sbcItem":"UTSBCSquadSplitViewController", "squadItem":"UTSquadSplitViewController", }; futsbcup.keys = { selector:{ game:".ut-tab-bar-view.game-navigation", SC:".SBCChallenges", SCH:".sbc-status-container div.expiry", SS:".SquadPanel.SBCSquadPanel", SSH:".ut-squad-summary-info--right", copyButton:".FSU_copy-button", searchInput:".FSU_filter-input", positionButton:".FSU_position-button", getPriceButton:".pagination.getprice", getPriceButton3:".ut-section-header-view .getprice", getPriceButton4:".view-modal-container.form-modal header .getprice", pagingContainer:".pagingContainer", }, requirements:["球隊評分最低為:","Min. Team Rating:","最低球队评分:"], search:["club","nation","league"], sytle:".FSU_copy-button,.FSU_count-button{margin: auto;background-color: #7e42f5;border-color: transparent;color: #29ffc9;padding-left: 1rem;padding-right: 1rem;line-height: 2rem; height: 2rem;font-size: 1rem; display: block; text-align: center; text-decoration: none;}.FSU_copy-button:hover{background-color: #a991f2;}.FSU_filter-input{}.FSU_filter-input{border: 0 !important;background-color: rgba(0,0,0,0) !important;padding-left: 0 !important;}.FSU_count-button{background-color: #1a96f6;color: #f2f2f2;}.FSU_count-button:hover{background-color: #45a9f7;}.FSU_position-button{font-family:UltimateTeam-Icons,sans-serif;font-style:normal;font-variant:normal;font-weight:400;text-transform:none;color:#c4f750;width:4rem;height:4rem;flex-shrink:0;font-size:1.6em;display:flex;text-decoration:none;text-align:center;justify-content:center;align-items:center;position:absolute;right:3rem;z-index:0;top:0;}.FSU_position-button::before{content:'\\E060';}.FSU_position-button:hover{color:#f2f2f2 !important;}html[dir=ltr] button.flat.pagination.next{order: 2;}button.flat.pagination.getprice::before{content: '\\\E04D';font-size: 1rem;margin-right: 0.2rem;font-family: UltimateTeam-Icons,sans-serif;}.pp{padding-left: 6.3rem;font-family: UltimateTeamCondensed,sans-serif;}.ppb{display: flex;margin-top: 0.4rem;align-items: center;}.ppt{font-size:.875rem;color: #a4a9b4;line-height: 1rem;padding-right: 0.3rem;}.ppv{font-size: 1rem;line-height: 1rem;}.rpp{z-index: 99;display: flex;width: 100px;left: 0;position: absolute;top: 0;flex-direction: column;font-family: UltimateTeamCondensed,sans-serif;font-size: 1em;line-height: 1.2;height: 100%;justify-content: center;align-items: flex-end;text-align: right;}.rppb{margin-top: 0.5rem;}.rppb{color: #a4a9b4;font-size: .75em;}.tns-horizontal.tns-subpixel>.tns-item{position: relative;}.SearchResults.ui-layout-left ul{display: grid;grid-template-columns: repeat(2, minmax(0, 1fr));}.SearchResults.ui-layout-left .listFUTItem.has-auction-data.selected .rowContent.has-tap-callback{background-color: #2c319b8f;}.SearchResults.ui-layout-left .listFUTItem.has-auction-data .rowContent.has-tap-callback .entityContainer{width: 100%;}.SearchResults.ui-layout-left .listFUTItem.has-auction-data .rowContent.has-tap-callback .entityContainer .player-stats-data-component{width: 44%;}.SearchResults.ui-layout-left .listFUTItem.has-auction-data .rowContent.has-tap-callback .entityContainer .player-stats-data-component ul{display: grid;grid-template-columns: repeat(3, minmax(0, 1fr));}.SearchResults.ui-layout-left .listFUTItem.has-auction-data .rowContent.has-tap-callback .entityContainer .player-stats-data-component ul li{padding:0;margin-top: 0.2rem;}.SearchResults.ui-layout-left .listFUTItem.has-auction-data .rowContent.has-tap-callback .auction{display: flex;width: 46%;right: 0;top: 36%;}.SearchResults.ui-layout-left .ui-layout-left .listFUTItem.has-auction-data .entityContainer {box-sizing: border-box;}.SearchResults.ui-layout-left .listFUTItem .rowContent.has-tap-callback::before{display:none;}.SearchResults.ui-layout-left .pp{position: absolute;width: 23%;right: 0;font-size: 1em;top: 0.3rem;}.SearchResults.ui-layout-left .ppb{display: block;margin-top: 0.2rem;}.SearchResults.ui-layout-left .ppt{color: #a4a9b4;}button.notevents{pointer-events: none;color: #a4a9b4;}.ui-layout-left.ut-club-search-results-view .pp,.ut-transfer-list-view .pp,.ut-store-reveal-modal-list-view .pp,.ut-unassigned-view.ui-layout-left .pp{padding-left: 0;position: absolute;right: 0;top: 0;height: 100%;display: flex;align-items: center;}.ui-layout-left.ut-club-search-results-view .ppb,.ut-transfer-list-view .ppb,.ut-store-reveal-modal-list-view .ppb,.ut-unassigned-view.ui-layout-left .ppb{margin-top: 0;display: block;}.ui-layout-left.ut-club-search-results-view .ppt,.ut-transfer-list-view .ppt,.ut-store-reveal-modal-list-view .ppt,.ut-unassigned-view.ui-layout-left .ppt{font-size: 1rem;}.ui-layout-left.ut-club-search-results-view .ppv,.ut-transfer-list-view .ppv,.ut-store-reveal-modal-list-view .ppv,.ut-unassigned-view.ui-layout-left .ppv{font-size: 1.2rem;margin-top: .5rem;}.btn-standard.section-header-btn.mini.call-to-action.getprice{margin-left: 1rem;}.btn-standard.section-header-btn.mini.call-to-action.getprice:hover{background-color:#e9dfcd}.view-modal-container.form-modal header .getprice{position: absolute;top: .5rem;left: 0;height: 2rem;line-height: 2rem;}.large-picks-container > div .pp{padding-left: 0;text-align: center;display: flex;justify-content: center;}.large-picks-container > div .ppt{font-size:1rem}.large-picks-container > div .ppv{font-size:1.2rem}.tr{display: flex;justify-content: space-between;padding: 0.5rem;background-color: #d31332;}.barTn{position: absolute;right: .2rem;top: 0;}.ut-objective-entry-view--title span.task-new{padding-left: 0.5rem;padding-right: 0.8rem;background-color: #d31332;margin-right: 0.2rem;}.ut-sbc-set-tile-view .tileHeader span.task-new{padding-left: 0.3rem;padding-right: 0.8rem;background-color: #d31332;margin-right: 0.2rem;}.ut-sbc-set-tile-view.production-tagged .tileHeader::before{display:none;}.sbcInfo{padding: 0.5rem;background-color: #d313325c;display: flex;font-family: UltimateTeamCondensed,sans-serif;justify-content: space-between;font-size: 1.1rem;}.sbcInfo div{width: 50%;}.sbcInfo div{width: 50%;}.sbcInfo div:last-child{display: flex;justify-content: space-around;}.tr.no{background-color: #d313325c;}.task-expire{background-color: #d313325c;height: 2rem;line-height: 2rem;text-align: center;}.btn-standard.weifenpei{width: 100%;margin: 0 0.5rem 0.5rem;font-size: 1.4rem;line-height: 2.4rem;height: 2.4rem;background-color: #f8eede;color: #243962;}.btn-standard.weifenpei:hover{background-color: #e9dfcd;}.btn-standard.weifenpei:active{background-color: #cac2b5;}.btn-standard.weifenpei.disabled{background-color: #11151a;color: #635f59;pointer-events:none;}a.header_explain{color: #a2a2a2;text-decoration: none;line-height: 3rem;}a.header_explain:hover{color: #ffffff;}.ut-fifa-header-view{display: flex;justify-content: space-between;}", getPriceButton:false, netError:false, loadData:false, }; futsbcup.copyButton = function(pageTitle,controller){ var pageSeat,sbcId; if(pageTitle == className.sbcList){ pageSeat = this.keys.selector.SCH; sbcId = controller.sbset.id; }else if(pageTitle == className.sbcItem){ pageSeat = this.keys.selector.SSH; sbcId = controller._challengeId + "/" + controller._set.name; var requirementsText = ""; var requirementsWait = setInterval(function(){ requirementsText = controller._requirementsNotification.getView()._requirements.__requirements.getInnerHTML(); if(requirementsText != ""){ clearInterval(requirementsWait) for (let index = 0; index < futsbcup.keys.requirements.length; index++) { GM_log(futsbcup.keys.requirements[index]) if(requirementsText.indexOf(futsbcup.keys.requirements[index]) != -1){ window.requirementTarget = parseInt(requirementsText.substr(requirementsText.indexOf(futsbcup.keys.requirements[index]) + futsbcup.keys.requirements[index].length,3)); } } $(pageSeat).after(html.countBtn.replace("{target}",requirementTarget)) $("#goToFutCd").click(function () { GM_log(window.requirementTarget) var playerArray = getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController().getCurrentController()._squad.getFieldPlayers(); var playerRatingText = ""; var targetText = "target=" + window.requirementTarget.toString(); var playerNumber = []; for (let index = 0; index < playerArray.length; index++) { if(playerArray[index].isBrick() == false){ if(playerArray[index].getItem().rating !== 0){ playerNumber.push(playerArray[index].getItem().rating); } }else{ playerNumber.push(0); } } if(playerNumber.length == 0){ GM_log("*无评分列表*"); }else{ playerRatingText = "&ratings=" + playerNumber.join(","); GM_log(playerRatingText); } GM_openInTab("https://futcd.com/sbc.html?" + targetText + playerRatingText, { active: true, insert: true, setParent :true }); }); } },500) } $(pageSeat).after(html.copyBtn.replace("{sbcId}",sbcId)) }; futsbcup.searchInput = function(controller,positionOpen){ for(var i=0;i 0){ var targetLength = targetObject.children("li:contains('" + $(this).val() + "')").length; if(targetLength > 0){ targetObject.children("li:not(:contains('" + $(this).val() + "'))").hide(); GM_log(targetLength) if(targetLength < 4 && targetPanelTop !== 0){ var targetHeight = (4 - targetLength) * 49; GM_log(targetHeight + "px"); targetObject.css("height","calc(14rem - " + targetHeight + "px)"); targetPanel.css("top","calc(-224px + " + targetHeight + "px)"); }else{ targetObject.css("height","14rem"); if(targetPanelTop !== 0){ targetPanel.css("top","-224px"); } } } }else{ targetObject.css("height","14rem"); if(targetPanelTop !== 0){ targetPanel.css("top","-224px"); } } }); }; futsbcup.priceFormat = function(priceValue){ var priceText = ""; if(priceValue !== "无数据"){ var priceNumber = parseInt(priceValue.replace(/,/g,'')); if(priceNumber == 0){ priceText = "无数据"; }else if(priceNumber < 10000){ priceText = priceNumber.toLocaleString(); }else{ priceText = (priceNumber / 10000).toFixed(2).toLocaleString() + "万"; } }else{ priceText = priceValue; } return priceText; }; futsbcup.clickGetPrice = function(type){ var priceButton = ""; if(type == 1 || type == 2){ priceButton = futsbcup.keys.selector.getPriceButton; }else if(type == 3 || type == 6){ priceButton = futsbcup.keys.selector.getPriceButton3; }else if(type == 4 || type == 5){ priceButton = futsbcup.keys.selector.getPriceButton4; } $(priceButton).click(async function () { events.notice("开始读取价格数据 请稍等", 1) if(futsbcup.keys.loadData == false){ futsbcup.keys.loadData = true; var playerPriceBox = ".pp"; var playerArray = []; var playerIdList = []; var playerBox = ".rowContent.has-tap-callback .entityContainer"; if(type == 4){ playerBox = ".rowContent .entityContainer"; } if(type == 5){ playerBox = ".large-picks-container > div" } var getPriceBox = ""; if(type == 1 || type ==2){ getPriceBox = ".pagingContainer"; }else if(type == 3 || type == 6){ getPriceBox = ".ut-section-header-view"; }else if(type == 4 || type == 5){ getPriceBox = ".view-modal-container.form-modal footer"; } var playerNoRepIdList = []; var priceUrl = []; if(type == 1){ playerArray = getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController().getCurrentController()._rightController._childViewControllers[2]._view._list.listRows; }else if(type == 2){ playerArray = getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController().getCurrentController()._leftController._view._list.listRows; }else if(type == 3 || type == 6){ playerArray = getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController().getCurrentController()._leftController._viewmodel._collection; }else if(type == 4){ let notification = getAppMain()._defaultDispatcher._observers._collection["notification.AppResume"]._observers; if(notification[notification.length - 1].scope.className == 'UTStorePackRevealModalListViewController'){ playerArray = notification[notification.length - 1].scope._view.listRows } }else if(type == 5){ let notification = getAppMain()._defaultDispatcher._observers._collection["notification.AppResume"]._observers; if(notification[notification.length - 1].scope.className == 'UTPlayerPicksViewController'){ playerArray = notification[notification.length - 1].scope.picks } } if($(playerPriceBox).length != playerArray.length && priceButton !== "" && getPriceBox !== ""){ $(getPriceBox).find("button").addClass("notevents") let playerBoxNumber = $(playerBox).length; for (let i = 0; i < playerBoxNumber; i++) { if($(playerBox).eq(i).find(playerPriceBox).length == 0 ){ let tempId = 0; if(type == 1 || type ==2){ tempId = playerArray[i].data.definitionId; }else if(type == 3 || type == 5){ tempId = playerArray[i].definitionId; }else if(type == 6){ if(playerArray[i].type == "player"){ tempId = playerArray[i].definitionId; } }else if(type == 4){ if(playerArray[i].data.type == "player"){ tempId = playerArray[i].data.definitionId; } } if(tempId !== 0){ playerIdList.push(tempId) if(playerNoRepIdList.indexOf(tempId) == -1){ playerNoRepIdList.push(tempId) } } } } if(playerNoRepIdList.length > 0){ let getRepeat = Math.ceil(playerNoRepIdList.length / 20); for (let i = 0; i < getRepeat; i++) { priceUrl.push("https://www.futbin.com/23/playerPrices?player=&rids=" + playerNoRepIdList.splice(-20).join()) } var priceData = {}; for (const key in priceUrl) { if (Object.hasOwnProperty.call(priceUrl, key)) { let tempData = await getPrice(priceUrl[key]); priceData = Object.assign(priceData,tempData); } } for (let i = 0; i < playerArray.length; i++) { var priceHtml = ""; var playerData = {}; if(type == 1 || type == 2 || type == 4){ playerData = playerArray[i].data; }else if(type == 3 || type == 5 || type == 6){ playerData = playerArray[i]; } if(playerData !== {}){ if(priceData.hasOwnProperty(playerData.definitionId) == true && $(playerBox).eq(i).length > 0 ){ if(type == 4 && playerData.type !== "player") return; if(type == 6 && playerData.type !== "player") return; priceHtml = html.priceShow.replace("{price}",futsbcup.priceFormat(priceData[playerData.definitionId].prices[info.base.platform].LCPrice)) let priceHtml2 = ""; if(type == 1){ let dPrice = "无数据"; if(info.base.price.hasOwnProperty(playerData.rating) == true){ dPrice = info.base.price[playerData.rating]["p"]; } priceHtml2 = html.priceShow2.replace("{price}",futsbcup.priceFormat(dPrice)) } priceHtml = priceHtml.replace("{price2}",priceHtml2); $(playerBox).eq(i).append(priceHtml); } } } } } futsbcup.keys.loadData = false; $(getPriceBox).find("button").removeClass("notevents") } }); }; function getPrice(url){ return new Promise(res => { GM_xmlhttpRequest({ method:"GET", url:url, headers: { "Content-type": "application/json" }, onload:function(response){ if(response.status == 404){ events.notice("查询价格失败 请检查网络",2); return; } res(JSON.parse(response.response)) }, onerror:function(){ events.notice("查询价格失败 请检查网络",2); } }) }) }; futsbcup.taskHtml = function(number,text){ let html = "
{Number}
{reward}
"; if(number > 0){ html = html.replace("{Number}","今日新增" + number + "个"); }else{ html = html.replace("tr","tr no"); html = html.replace("{Number}","今日无新增"); } if(text == "、"){ text = ""; } html = html.replace("{reward}",text); return html; }; futsbcup.addGetPriceButton = function(type){ if(type == 3){ $(".ut-section-header-view").eq(2).append(html.priceBtn2); }else if(type == 4 || type == 5){ $(".view-modal-container.form-modal header").append(html.priceBtn2); }else if(type == 6){ $(".ut-section-header-view").eq(0).append(html.priceBtn2); }else{ if($(".getprice").length == 0){ $(futsbcup.keys.selector.pagingContainer).append(html.priceBtn); if($(futsbcup.keys.selector.pagingContainer).is(":hidden") == true){ $(futsbcup.keys.selector.pagingContainer).prev().addClass("paginated"); $(futsbcup.keys.selector.pagingContainer).css('display','flex'); $(futsbcup.keys.selector.getPriceButton).css('margin','auto'); } } } futsbcup.clickGetPrice(type); }; futsbcup.getTask = function(){ let SID = services.Authentication.sessionUtas.id; console.log(SID) GM_xmlhttpRequest({ method:"GET", url:"https://utas.mob.v1.fut.ea.com/ut/game/fifa23/scmp/campaign/categories", headers: { "Content-type": "application/json", "X-UT-SID": SID }, onload:function(response){ let data = JSON.parse(response.response); let nowDate = Math.round(new Date().getTime()/1000); let objJson = {reward:"",new:{"-1":0}}; let rewardJson = {"球员":0,"组合包":0}; for (let i = 0; i < data.length; i++) { data[i].groupsList.forEach( (item,key) => { let tempJson = {"f":"0","e":"0"} if(item.title !== "每日目标"){ if(item.startTime >= nowDate - 86400){ tempJson.f = "1"; objJson.new["-1"]++; if(objJson.new.hasOwnProperty(String(i+1))){ objJson.new[String(i+1)]++; }else{ objJson.new[String(i+1)] = 1; } for (let z = 0; z < item.awardsList.length; z++) { if(item.awardsList[z].awardType == "pack"){ rewardJson["组合包"]++; } if(item.awardsList[z].awardType == "item"){ if(item.awardsList[z].itemDataReduced.itemType == "player"){ rewardJson["球员"]++; } } } } if(item.endTime <= nowDate + 86400 && item.endTime !== 0){ tempJson.e = "1"; } } objJson[item.groupType.toString()+"-"+item.groupId.toString()] = tempJson; }) } let reward = []; if(rewardJson["球员"] > 0){ reward.push("球员") } if(rewardJson["组合包"] > 0){ reward.push("组合包") } objJson.reward = reward.join("、"); info.task.obj.stat = objJson; info.task.obj.html = futsbcup.taskHtml(objJson.new["-1"],objJson.reward); }, }) GM_xmlhttpRequest({ method:"GET", url:"https://futcd.com/data/futsbc.json", headers: { "Content-type": "application/json", "Cache-Control": "600" }, onload:function(res){ let sbcJson = JSON.parse(res.response); let sbcHtml = ""; if(sbcJson.new["0"] > 0){ sbcHtml = html.task.replace("{reward}",sbcJson.reward); sbcHtml = sbcHtml.replace("{Number}",sbcJson.new["0"]); } info.task.sbc.stat = sbcJson; info.task.sbc.html = sbcHtml; }, }) } futsbcup.callBack = function(){ if($(futsbcup.keys.selector.game).length === 0) return; var controller = getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController().getCurrentController(); if(!cntlr.current() || !cntlr.current().className) return; let currentName = cntlr.current().className; if(currentName == className.home){ if($(".view-navbar-clubinfo-name") !== null && info.base.state == false){ events.notice("FSU插件加载成功",0); events.init() info.base.state = true; } if(info.task["obj"].html !== "" && $(info.task["obj"].parent).find(".tr").length == 0){ $(info.task["obj"].parent).find("header").after(info.task["obj"].html); } if(info.task["sbc"].html !== "" && $(info.task["sbc"].parent).find(".tr").length == 0){ $(info.task["sbc"].parent).find("header").after(info.task["sbc"].html); } } if(currentName == className.object){ if(info.task["obj"].stat.new[-1] > 0 && $(".barTn").length == 0){ let objBar = cntlr.current()._view._objectivesTM.items; let newJson = info.task["obj"].stat.new; for (let name in newJson) { if(name !== "-1"){ objBar[name].__root.insertAdjacentHTML('beforeend', html.taskBar.replace("{Number}","+"+newJson[name])); } } } let objectiveSubview = cntlr.current().getView().objectiveSubview; if(typeof objectiveSubview == "object"){ if(objectiveSubview.hasOwnProperty("groups") && $(".ut-objective-entry-view--title span").length == 0){ let objList = objectiveSubview.groups; for (let i = 0; i < objList.length; i++) { let objId = objList[i].id; let objAttr = info.task["obj"].stat[objId]; if(objAttr !== undefined){ let titleHtml = ""; let expireHtml = "" if(objAttr.f == "1"){ titleHtml = ""; } if(objAttr.e == "1"){ expireHtml = "
即将到期
"; } objList[i].__title.insertAdjacentHTML('afterBegin', titleHtml); objList[i].__title.parentElement.insertAdjacentHTML('afterend', expireHtml); } } } } } if(currentName == className.sbc){ if(info.task["sbc"].stat.new[0] > 0 && $(".barTn").length == 0){ let sbcBar = cntlr.current()._view._SBCCategoriesTM.items; let newJson = info.task["sbc"].stat.new; for (let name in newJson) { if(sbcBar[name] !== undefined){ sbcBar[name].__root.insertAdjacentHTML('beforeend', html.taskBar.replace("{Number}","+"+newJson[name])); } } } let sbcList = cntlr.current()._view.sbcSetTiles; if(sbcList.length > 0 && $(".tileHeader span").length == 0){ for (let i = 0; i < sbcList.length; i++) { let sbcId = sbcList[i].data.id; let sbcAttr = info.task["sbc"].stat[sbcId]; if(sbcAttr !== undefined){ let titleHtml = ""; let expireHtml = ""; if(sbcAttr.f == "1"){ titleHtml = ""; } if(sbcAttr.e == "1"){ expireHtml = "
即将到期
"; } sbcList[i].__tileTitle.insertAdjacentHTML('afterBegin', titleHtml); sbcList[i].__root.insertAdjacentHTML('afterBegin', expireHtml); if(sbcList[i]._interactionState == true){ let infoHtml = html.sbcInfo; let priceText = "0"; if(sbcAttr.type !== "7"){ if(info.base.platform == "pc"){ priceText = sbcAttr.pc; }else{ priceText = sbcAttr.tv; } } infoHtml = infoHtml.replace("{price}",futsbcup.priceFormat(priceText)); infoHtml = infoHtml.replace("{up}",sbcAttr.u); infoHtml = infoHtml.replace("{down}",sbcAttr.d); sbcList[i].__root.lastChild.insertAdjacentHTML('beforebegin', infoHtml) } }else{ sbcList[i].__tileTitle.insertAdjacentHTML('afterBegin', ""); sbcList[i].__root.lastChild.insertAdjacentHTML('beforebegin', "
无数据请过段时间重新进入WEBAPP再查看
") } } } } if([className.sbcList,className.sbcItem].indexOf(currentName) != -1){ if($(futsbcup.keys.selector.copyButton).length === 0){ futsbcup.copyButton(cntlr.current().className,cntlr.current()); } }; if(futsbcup.keys.getPriceButton == true){ if([className.home,"UTMarketSearchFiltersViewController","UTClubHubViewController","UTTransfersHubViewController","UTMyClubSearchFiltersViewController","UTStorePackViewController"].indexOf(currentName) != -1){ GM_log("*进入拍卖页面或者俱乐部页面重置读价格按钮*") futsbcup.keys.getPriceButton = false; }; } if($(".view-modal-container.form-modal").length == 1 && $(futsbcup.keys.selector.getPriceButton4).length == 0){ GM_log("*正在打开球员挑选包或预览包*") var notification = getAppMain()._defaultDispatcher._observers._collection["notification.AppResume"]._observers; if(notification[notification.length - 1].scope.className == 'UTStorePackRevealModalListViewController' ){ GM_log("*定位到预览包开始添加按钮和事件*") futsbcup.addGetPriceButton(4); } if(notification[notification.length - 1].scope.className == 'UTPlayerPicksViewController' ){ GM_log("*定位到球员选择包开始添加按钮和事件*") futsbcup.addGetPriceButton(5); } } if(["UTMarketSearchResultsSplitViewController","ClubSearchResultsSplitViewController"].indexOf(currentName) != -1){ let playerArray = cntlr.left()._view._list.listRows; if(playerArray.length > 0){ if(futsbcup.keys.getPriceButton == false){ futsbcup.keys.getPriceButton = true; futsbcup.addGetPriceButton(2); } } }; if(currentName == "UTTransferListSplitViewController"){ let playerArray = cntlr.left()._viewmodel._collection; if(playerArray.length > 0){ if(futsbcup.keys.getPriceButton == false){ futsbcup.keys.getPriceButton = true; futsbcup.addGetPriceButton(3); } } }; if(currentName == "UTUnassignedItemsSplitViewController"){ let playerArray = cntlr.left()._viewmodel._collection; if(playerArray.length > 0){ if($(futsbcup.keys.selector.getPriceButton3).length == 0){ futsbcup.addGetPriceButton(6); } events.uasReset(); } }; if([className.sbcItem,className.squadItem].indexOf(currentName) != -1){ // console.log((cntlr.current()._rightController.className) if(cntlr.current()._rightController.className == "UTSquadComparePlayersViewController"){ return; } var rightController = controller._rightController._currentController.getView(); if(cntlr.right().className == "UTClubSearchFiltersViewController"){ futsbcup.keys.getPriceButton = false; if($(futsbcup.keys.selector.searchInput).length === 0){ futsbcup.searchInput(cntlr.right().getView()._filterContainer); } GM_log("*返回搜索页面重置getprice*") console.log("读取价格按钮开关",futsbcup.keys.getPriceButton) if(info.criteria.state){ let currentCriteria = cntlr.right().viewmodel.searchCriteria; if(info.unassigned.run == 1){ console.log("状态1","直接填充选项搜索球员") let searchCriteria = new UTSearchCriteriaDTO(); searchCriteria._type = "player"; searchCriteria.count = 21; searchCriteria.sortBy = Object.keys(info.criteria.data).length ? "ovr" : info.criteria.data.sortBy; searchCriteria._sort = Object.keys(info.criteria.data).length ? "desc" : info.criteria.data._sort; searchCriteria.defId = info.unassigned.playerId; console.log(searchCriteria.sortBy,searchCriteria._sort) cntlr.right().viewmodel.searchCriteria = searchCriteria; cntlr.right().getView().getSearchButton()._tapDetected(this); events.notice("开始读取重复球员数据 请稍等",1); return; } if(info.unassigned.run !== 0 && currentCriteria.defId.length == 0){ console.log("状态不是0","但是判断符合条件给变成0") info.unassigned.run = 0; } if(info.unassigned.run == 2){ console.log("状态2","修改input") cntlr.right().getView().getPlayerNameSearch()._playerNameInput.setValue("未分配重复球员名单"); return; } console.log("开始判断进行填充选项","此时的saveCriteria为:",info.criteria.data) if(Object.keys(info.criteria.data).length == 0){ cntlr.right().getView().getSortDropDown().setIndexById(2); let posId = -1; if(cntlr.current()._squad._players[cntlr.left().getView().getSelectedSlot()._slotIndex].position !== null){ posId = cntlr.current()._squad._players[cntlr.left().getView().getSelectedSlot()._slotIndex].position.typeId; } cntlr.right().getView()._filterContainer.filters[2].setIndexById(posId) info.criteria.state = false; }else{ info.criteria.state = false; //交易选项匹配判断 currentCriteria._untradeables = info.criteria.data._untradeables; if(info.criteria.data._untradeables == "true"){ cntlr.right().getView().getSortOptions().toggles._collection["sort-untradeable"].toggle(true); }else{ cntlr.right().getView().getSortOptions().toggles._collection["sort-untradeable"].toggle(false); } //排除队伍选项匹配判断 if(controller.className == className.squadItem){ currentCriteria.excludeDefIds = []; }else{ currentCriteria.excludeDefIds = info.criteria.data.excludeDefIds; if(info.criteria.data.excludeDefIds.length > 0){ cntlr.right().getView().getSortOptions().toggles._collection["sort-exclude-squad"].toggle(true); }else{ cntlr.right().getView().getSortOptions().toggles._collection["sort-exclude-squad"].toggle(false); } } //排序条件选项匹配判断 if(info.criteria.data.sortBy !== currentCriteria.sortBy || info.criteria.data._sort !== currentCriteria._sort){ let sort = ["valuedesc","valueasc","ovrdesc","ovrasc","recentdesc"] for (let i = 0; i < sort.length; i++) { if(info.criteria.data.sortBy + info.criteria.data._sort == sort[i]){ cntlr.right().getView().getSortDropDown().setIndexById(i); break; } } } //品质条件选项匹配判断 if(info.criteria.data.level !== currentCriteria.level){ for (const v of cntlr.right().getView()._filterContainer.filters[0].options) { if(v.value == info.criteria.data.level){ cntlr.right().getView()._filterContainer.filters[0].setIndexById(v.id); break; } } } //稀有条件选项匹配判断 if(info.criteria.data.rarities !== currentCriteria.rarities){ if(info.criteria.data.rarities.length == 1){ cntlr.right().getView()._filterContainer.filters[1].setIndexById(info.criteria.data.rarities[0]) } } //位置条件选项匹配判断 if(info.criteria.data._position == "any"){ cntlr.right().getView()._filterContainer.filters[2].setIndexById(-1) }else{ let posId = -1; if(controller._squad._players[cntlr.left().getView().getSelectedSlot()._slotIndex].position !== null){ posId = controller._squad._players[cntlr.left().getView().getSelectedSlot()._slotIndex].position.typeId; } cntlr.right().getView()._filterContainer.filters[2].setIndexById(posId) } //地区条件选项匹配判断 if(info.criteria.data.nation !== currentCriteria.nation){ cntlr.right().getView()._filterContainer.filters[4].setIndexById(info.criteria.data.nation) } //联赛条件选项匹配判断 if(info.criteria.data.league !== currentCriteria.league){ cntlr.right().getView()._filterContainer.filters[5].setIndexById(info.criteria.data.league) } //俱乐部条件选项匹配判断 if(info.criteria.data.club !== currentCriteria.club){ cntlr.right().getView()._filterContainer.filters[6].setIndexById(info.criteria.data.club) } } } } if(cntlr.right().className == "UTSelectItemFromClubViewController"){ GM_log("*搜索结果页面*") if($(".paginated-item-list .listFUTItem").length == 0 && $(".paginated-item-list .ut-no-results-view").length == 0){ console.log("没有结果输出") return; } let playerArray = cntlr.right().getView()._list.listRows; if(info.unassigned.run == 1){ info.unassigned.run = 2; console.log("状态1","判断是否没有球员") if($(".paginated-item-list .listFUTItem").length == 0){ events.notice("已无重复球员",2); services.Item.itemDao.itemRepo.unassigned.reset(); return; } } if(playerArray.length > 0){ console.log("添加读取价格按钮") if(futsbcup.keys.getPriceButton == false){ futsbcup.keys.getPriceButton = true; futsbcup.addGetPriceButton(1); } } if(cntlr.right().searchCriteria.defId.length == 0){ info.criteria.data = JSON.parse(JSON.stringify(cntlr.right().searchCriteria)); } } if(cntlr.right().className == "UTSlotDetailsViewController"){ GM_log("*发现重新选择位置进行搜索重新填充排序*") info.criteria.state = true; if(currentName == className.sbcItem){ if($(".position-container").length !== 0 && $("#weifenpei").length == 0){ let btnPrev = ""; let btnText = ""; let btnDisabled = ""; if(cntlr.current()._squad._players[cntlr.left().getView().getSelectedSlot()._slotIndex].getItem().definitionId == 0){ btnPrev = "添加球员"; btnText = "添加未分配重复球员"; }else{ btnPrev = "替换球员"; btnText = "替换为未分配重复球员"; } let unassignedJson = services.Item.itemDao.itemRepo.unassigned._collection; info.unassigned = {"state":false,"run":0,"playerId":[]}; console.log("点选位置重置为状态",0) if(Object.keys(unassignedJson).length > 0){ let players = []; for (let i = 0; i < cntlr.current()._squad._players.length; i++) { if(cntlr.current()._squad._players[i].item.definitionId !== 0){ players.push(cntlr.current()._squad._players[i].item.definitionId) } } for (const key in unassignedJson) { if(unassignedJson[key].isDuplicate() && unassignedJson[key].loans == -1 && unassignedJson[key].type == "player" && players.indexOf(unassignedJson[key].definitionId) == -1){ info.unassigned.playerId.push(unassignedJson[key].definitionId); } } } if(info.unassigned.playerId.length > 0){ info.unassigned.state = true; }else{ btnDisabled = "disabled"; btnText = "无未分配重复球员"; } $(".btn-text:contains(" + btnPrev + ")").parent().after(""); if(info.unassigned.state){ $("#weifenpei").click(function () { cntlr.right()._panelView.eButtonSelected(cntlr.right()._panelView._btnAddSwap) info.unassigned.run = 1; console.log("点击按钮变为状态",1) }) } } } } }; if(currentName == "UTMarketSearchFiltersViewController"){ if(cntlr.current().getView()._tabMenu.selectedItemId === 0){ if($(futsbcup.keys.selector.searchInput).length === 0){ futsbcup.searchInput(cntlr.current().getView()._searchFilters,1); } } }; }; futsbcup.start = function(){ GM_addStyle(this.keys.sytle); //选择一个需要观察的节点 var targetNode = $(document)[0], // 设置observer的配置选项 config = {childList: true,characterData: true,attributes: false,subtree: true}, observer = new MutationObserver(this.callBack); //使用配置文件对目标节点进行观测 observer.observe(targetNode, config); }; GM_log("**加载插件成功**") futsbcup.start() })();