";
if(number > 0){
html = html.replace("{Number}",fy("task.added") + number);
}else{
html = html.replace("fsu-task","fsu-task no");
html = html.replace("{Number}",fy("task.noadded"));
}
if(text == "、"){
text = "";
}
let reward = text;
reward = reward.replace("组合包",fy("task.pack"));
reward = reward.replace("球员",fy("task.player"));
html = html.replace("{reward}",reward);
return html;
};
events.showLoader = () => {
document.querySelector(".ut-click-shield").classList.add("showing","fsu-loading");
document.querySelector(".loaderIcon").style.display = "block";
};
events.hideLoader = () => {
document.querySelector(".ut-click-shield").classList.remove("showing","fsu-loading");
document.querySelector(".loaderIcon").style.display = "none";
if(info.base.template){
info.base.template = false;
isPhone() ? cntlr.current()._view._fsuSquad.setInteractionState(1) : cntlr.right().getView()._fsuSquad.setInteractionState(1);
}
if(info.base.losauction){
info.base.losauction = false;
if(isPhone()){
events.notice("notice.phoneloas",0)
}
}
events.changeLoadingText("loadingclose.text");
};
events.L10n = function(param) {
let text = "";
if(param.indexOf("{") !== -1){
text = param;
let paramArr = param.match(/{(.*?)}/g);
for (let item of paramArr) {
let paramFormat = item.match(/{(.*?)}/)[1];
if(info.localization[info.language].hasOwnProperty(paramFormat)){
text = text.replace(item,info.localization[info.language][paramFormat]);
}
}
}else{
text = info.localization[info.language].hasOwnProperty(param) ? info.localization[info.language][param] : param;
}
return text;
}
const fy = function(p){
let t = "";
if(Array.isArray(p)){
t = info.localization[p.shift()][info.language];
let s = p.slice();
for (let n in s) {
t = t.replace(`%${Number(n) + 1}`,`${s[n]}`);
}
}else if(p.indexOf("{") !== -1){
t = p;
let pa = p.match(/{(.*?)}/g);
for (let i of pa) {
let pf = i.match(/{(.*?)}/)[1];
if(info.localization.hasOwnProperty(pf)){
t = t.replace(i,info.localization[pf][info.language]);
}
}
}else{
t = info.localization.hasOwnProperty(p) ? info.localization[p][info.language] : p;
}
return t;
}
info.localization = {
"price.btntext":["查询价格","查詢價格","Check Price"],
"price.formatno":["无数据","沒有數據","No Data"],
"price.formatcompany":["万","萬","ten thousand"],
"price.now":["球员低价","最低價格","Low Price"],
"price.low":["评分低价","評分最低價格","Rating Price"],
"price.last":["购买价格","購入價格","Bought Price"],
"duplicate.swap":["可发送俱乐部","可以送到球會","Can be Sent to Club"],
"duplicate.not":["队内不可交易","球會球員無法交易","Club Players are Untradeable"],
"duplicate.yes":["队内可交易","球會球員可交易","Club Players are Tradable"],
"duplicate.nodata":["无队内数据","沒有球員數據","No Club Players Data"],
"duplicate.lowprice":["评分低价:","評分最低價格:","Rating Price "],
"top.readme":["【FSU】插件使用说明","【FSU】插件使用說明","【FSU】Plugin Instructions"],
"top.upgrade":["有新版FSU插件可升级","有新版本的FSU插件可更新","There is a new version of the FSU plugin that can be upgraded"],
"notice.upgradefailed":["查询新版本失败","查詢新版本失敗","Query new version failed"],
"notice.upgradeconfirm":["有新版本点击顶部链接查看","有新版本點擊頂部鏈接查看","There is a new version, click the top link to view"],
"notice.uasreset":["已重新载入列表 请重新进入查看","已重新載入列表 請重新進入查看","The list has been reloaded, please re-enter to view"],
"notice.priceloading":["开始读取价格数据 请稍等","開始讀取價格數據 請稍等","Start reading price data, please wait"],
"notice.loaderror":["读取数据失败 请检查网络","讀取數據失敗 請檢查網絡","Failed to read data, please check the network"],
"notice.succeeded":["FSU插件加载成功","FSU插件載入成功","FSU plugin loaded successfully"],
"notice.duplicateloading":["开始读取重复球员数据 请稍等","開始讀取重複球員數據 請稍等","Start reading duplicate player data, please wait"],
"notice.quicksearch":["使用快捷添加 直接沿用上次配置搜索球员","使用快捷增加球員 直接沿用上次配置搜索球員","Use the shortcut to add, directly follow the last configuration to search for players"],
"notice.appointloading":["开始读取指定评分球员 请稍等","開始讀取指定評分球員 請稍等","Start reading assigned rating player please wait "],
"notice.noduplicate":["已无重复球员","已經沒有重複球員","no duplicate player"],
"notice.quickauction":["球员将按照最低售价作为即买价挂出","球員將按最低價格列在轉會市場上","Players will be listed at the lowest selling price as an immediate purchase price"],
"task.player":["球员","球員","Player"],
"task.pack":["组合包","組合包","Pack"],
"task.added":["今日新增:","今日新增:","Added today "],
"task.noadded":["今日无新增","今日沒有新增","No new additions today"],
"task.new":["新","新","New"],
"task.expire":["即将到期","即將過期","Expiring"],
"task.nodata":["无数据请过段时间重新进入WEBAPP再查看","沒有數據請過段時間重新進入WEBAPP再查看","No data, please re-enter WEBAPP after a while to check"],
"sbc.price":["造价预估:","製作價格:","Cost estimate:"],
"sbc.topprice":["预估造价","製作價格","Estimate"],
"sbc.topsquad":["阵容价值","球隊價格","Squad"],
"sbc.like":["值得做:","贊成:","Thumbs Up:"],
"sbc.dislike":["不值得:","反對:","Thumbs Down:"],
"sbc.consult":["抄作业","參考方案","See Plan"],
"sbc.count":["算评分","計算評分","Calculate Score"],
"sbc.duplicates":["重复球员名单","重複球員名單","Duplicate Players List"],
"sbc.qucikdupes":["重","重","D"],
"sbc.appoint":["指定评分球员名单","指定評分球員名單","Assign Rating Players List"],
"sbc.addduplicate":["添加重复球员","新增重複球員","Add Duplicate Players"],
"sbc.swapduplicate":["替换为重复球员","交換為重複球員","Swap Duplicate Players"],
"sbc.notduplicate":["无重复球员","沒有重複球員","No Duplicate Players"],
"sbc.addquick":["快捷添加球员","快速新增球員","Quick Add Player"],
"sbc.swapquick":["快捷替换球员","快速交換球員","Quick Swap Player"],
"sbc.watchplayer":["查看球员","查看球員","Watch Player"],
"uasreset.btntext":["重载名单","重新載入名單","Reload List"],
"sbc.filtert":["筛选","篩選","Filter"],
"sbc.filter0":["全部","全部","All"],
"sbc.filter1":["新增","新增","New"],
"sbc.filter2":["临期","即期","Expiring"],
"sbc.filter3":["高评价","高評價","Approval"],
"loadingclose.text":["数据载入 如卡顿点此关闭","數據載入中 如長時間未響應 請點擊此處關閉","If you encounter stuck, click here to close"],
"quicklist.gotofutbin":["前往FUTBIN查看","前往FUTBIN查看","Go to FUTBIN"],
"quicklist.auction":["按低价快速拍卖","使用最低價格列入轉會","Quick Auction at Low Price"],
"pack.promo":["特殊球员","特殊球員","PROMO"],
"emptylist.t":["处理后无符合条件球员","處理後無符合條件球員","No eligible players after processing"],
"emptylist.c":["请改变条件或翻页查看","請改變條件或翻頁查看","Please change the criteria or flip the page to view"],
"set.title":["FSU设置","FSU設定","FSU Settings"],
"set.card.title":["球员卡信息","球員卡資訊","Player Card Information"],
"set.card.pos":["额外位置","額外位置","Extra Position"],
"set.card.lea":["所属联赛","所屬聯賽","Affiliated League"],
"set.card.price":["球员价格","球員價格","Player Price"],
"set.card.other":["其他属性","其他屬性","Other Attributes"],
"set.card.club":["俱乐部内球员","俱樂部內球員","Club Players"],
"set.card.low":["评分低价","評分低價","Low Rating Price"],
"set.sbc.title":["SBC操作","SBC 操作","SBC Operations"],
"set.sbc.top":["阵容顶部按钮","陣容頂部按鈕","Top Buttons"],
"set.sbc.right":["阵容右侧按钮","陣容右側按鈕","Right-side Buttons"],
"set.sbc.quick":["快捷添加球员","快速添加球員","Quick Add Players"],
"set.sbc.duplicate":["重复球员填充","重複球員填充","Fill with Duplicate Players"],
"set.sbc.records":["选项记录","選項記錄","Option Records"],
"set.sbc.input":["信息输入检索","資訊輸入檢索","Information Input Search"],
"set.info.title":["信息展示","資訊展示","Information Display"],
"set.info.obj":["目标顶部显示","目標頂部顯示","Objective top display"],
"set.info.sbc":["SBC","SBC","SBC"],
"set.info.sbcf":["SBC筛选","SBC篩選","SBC Filters"],
"set.info.sbcs":["SBC子任务","SBC子任務","SBC Subtasks"],
"set.info.pack":["球员包可开球员","球員包可開球員","Pack PROMO"],
"set.info.auction":["拍卖紧凑显示","拍賣緊湊顯示","Compact Auction Display"],
"set.info.squad":["阵容价值","陣容價值","Squad Value"],
"set.style.title":["球员卡信息样式","球員卡資訊樣式","Player Card Information Style"],
"set.style.new":["随品质变化","隨品質變化","Varies with Quality"],
"set.style.old":["纯色样式","純色樣式","Solid Color Style"],
"set.player.title":["选中球员操作","選中球員操作","Select Player Action"],
"set.player.auction":["按低价快速拍卖","按低價快速拍賣","Quick Auction at Low Price"],
"set.player.futbin":["前往FUTBIN查看","前往FUTBIN查看","Go to FUTBIN for Details"],
"quicklist.getprice":["查询拍卖低价","查詢拍賣低價","Search for Auction Price"],
"quicklist.getpricey":["刷新拍卖低价","重新整理拍賣低價","Refresh Auction Price"],
"set.player.getprice":["查询拍卖低价","查詢拍賣低價","Search for Auction Price"],
"quicklist.getpricelt":["最低价","最低價","Lowest price"],
"quicklist.getpriceload":["读取中","讀取中","Loading"],
"sbc.swaprating":["替换为同评分","替換為同評分","Replace with the same rating"],
"sbc.squadfill":["FUTBIN方案智能填充","FUTBIN方案智能填充","FUTBIN squad intelligent autofill"],
"notice.templateload":["读取FUTBIN方案并比价中 请稍后","讀取FUTBIN方案並比價中 請稍後","Reading FUTBIN squad and comparing prices. Please wait."],
"notice.templateerror":["方案保存失败 请重新尝试","方案保存失敗 請重新嘗試","Failed to save the squad. Please try again."],
"notice.templatesuccess":["FUTBIN方案加载成功","成功載入 FUTBIN 方案","FUTBIN squad loaded successfully"],
"notice.templatezero":["无可加载方案 请稍后再试","無可載入的方案 請稍後再試","No available squad to load. Please try again later."],
"set.sbc.template":["FUTBIN方案填充","FUTBIN方案填充","FUTBIN squad autofill"],
"notice.marketsetmax":["已修改优化搜索信息可直接搜索 如无结果请返回调整参数","已修改優化搜尋資訊,可直接搜尋。如無結果,請返回調整參數。","Optimizations have been made to the search information. You can now search directly. If there are no results, please return and adjust the parameters."],
"set.sbc.market":["假想球员拍卖搜索优化","假想球员拍賣搜尋優化","Fantasy Player Auction Search Optimization"],
"notice.auctionsuccess":["%1 挂牌 %2 成功","%1 掛牌 %2 成功","%1 listed %2 successfully."],
"notice.auctionnoplayer":["%1 没有找到球员","%1 沒有找到球員","%1 player not found."],
"notice.auctionlimits":["%1 FUTBIN价格超出球员限价","%1 FUTBIN價格超出球員限價","The FUTBIN price for %1 exceeds player limit."],
"notice.auctionmax":["已达到拍卖行上限","已達到拍賣行上限","Auction house limit reached."],
"losa.all":["全选","全選","Select All"],
"losa.select":["已选球员","已選球員","Selected"],
"losa.price":["共计可售","共計可售","Total"],
"loas.button":["拍卖所选球员","拍賣所選球員","Auction Selected Players"],
"loas.popupt":["球员批量挂拍卖提示","球員批量掛拍賣提示","Bulk Auction Listing Reminder for Players"],
"loas.popupm":["已选择本列表中 %1 个球员拍卖价格大致为 %2 ,请点击确认开始陆续上架拍卖,途中可点击加载图标下文字取消。","已選擇本列表中 %1 個球員拍賣價格大致為 %2 ,請點擊確認開始陸續上架拍賣,途中可點擊加載圖標下文字取消。","You have selected approximately %1 players from this list, with an estimated auction price of %2. Please click confirm to start listing them for auction one by one. You can click the text below the loading icon to cancel during the process."],
"loas.start":["程序开始批量售卖球员 预计耗费 %1 秒","程式開始批量售賣球員 預計耗費 %1 秒","The program starts to sell players in bulk, which is expected to take %1 of seconds"],
"loadingclose.template1":["读取FUTBIN阵容中 点此可结束程序","讀取FUTBIN陣容中 點此可結束程式","Read the FUTBIN lineup, click here to end the program"],
"loadingclose.template2":["正在读取方案 %1 阵容 剩余 %2 方案 点此可结束程序","正在讀取和比對方案 %1 陣容 剩餘 %2 方案 點此可結束程式","Reading and comparing plan %1 lineup, remaining %2 plans, click here to end the program"],
"loadingclose.loas":["正在挂牌第 %1 个球员 剩余 %2 个 点此可结束程序","正在掛牌第 %1 個球員 剩餘 %2 個 點此可結束程式","The %1 players are being listed, and the remaining %2, click here to end the program"],
"set.player.loas":["批量拍卖球员","批量拍賣球員","Bulk Auction Players"],
"notice.squaderror":["阵容位置匹配失败 请联系解决","陣容位置匹配失敗 請聯絡解決","Lineup position matching failed, please contact to solve it."],
"set.getdoc":["查看设置说明","檢視設定說明","View setup instructions"],
"builder.league":["排除五大联赛球员","排除五大聯賽球員","Exclude top five leagues"],
"builder.rare":["排除周最佳球员","排除周最佳球員","Exclude TOTW"],
"notice.phoneloas":["请注意手机端挂牌后需重新进入拍卖清单才会刷新显示。","請注意手機端掛牌後需重新進入拍賣清單才會重新整理顯示。","Please note that after listing on the mobile terminal, you need to re-enter the auction list before refreshing the display."],
"notice.builder":["通过排除后球员数量已不足11位,如需要请调整条件再次搜索。","通過排除後球員數量已不足11位,如需要請調整條件再次搜尋。","After the exclusion, the number of players is less than 11. If necessary, please adjust the conditions to search again."],
"notice.conceptdiff":["发现所购买的假想球员有多个版本,已经将非搜索版本的亮度。","發現所購買的假想球員有多個版本,已經將非搜尋版本的亮度。","Found that there are multiple versions of the purchased hypothetical player, the brightness of the non-searched version has been added."],
}
html = {
"priceBtn":"",
"priceBtn2":"",
"taskBar":"
`
for (let i in l) {
let tn = i == 0 ? "left" : "right";
let ts = document.createElement("div");
ts.classList.add("fsu-quick-list",tn);
sp._fsuQuickTop.append(ts);
if(i == 0){
sp._fsuQuickTop.append(events.createDF(`
OR
`));
}
for (let si in l[i]) {
if(l[i][si] !== 0){
let o = t+1-Number(si);
let n = `t_${i}_${o}`
let r = events.createButton(
new UTButtonControl(),
"",
(e) => {events.SBCSetRatingPlayers(e);},
"im"
)
r.__root.innerHTML = `${o}×${l[i][si]}`;
r.__root.setAttribute("data-r",o);
sp._fsuRlist[n] = r;
sp._fsuQuickTop.querySelector(`.${tn}`).append(sp._fsuRlist[n].__root);
}
}
}
}
if(sp._fsuQuickOther.innerHTML !== ""){
sp._fsuQuickTop.append(sp._fsuQuickOther);
}
sp._summaryPanel.__root.append(sp._fsuQuickTop)
let y = t !== 0 ? t : 75;
let rh = document.createElement("div");
rh.classList.add("fsu-quick","right");
rh.innerHTML = ``;
sp._fsuQuickRight = rh;
for (let i = 0; i < 10; i++) {
let o = y+3-i;
let n = `r_${o}`
let r = events.createButton(
new UTButtonControl(),
o,
(e) => {events.SBCSetRatingPlayers(e);},
"im"
);
r.__root.setAttribute("data-r",o);
sp._fsuRlist[n] = r;
sp._fsuQuickRight.querySelector(".fsu-quick-list").append(sp._fsuRlist[n].__root);
}
let rd = events.createButton(
new UTButtonControl(),
fy("sbc.qucikdupes"),
(e) => {events.SBCSetRatingPlayers(e);},
"im"
);
rd.__root.setAttribute("data-r","d");
sp._fsuRlist["r_d"] = rd;
sp._fsuQuickRight.querySelector(".fsu-quick-list").append(sp._fsuRlist["r_d"].__root);
sp._summaryPanel.__root.after(sp._fsuQuickRight);
if(!info.set.sbc_top){
sp._fsuQuickTop.remove();
}
if(!info.set.sbc_top){
sp._fsuQuickRight.remove();
}
}
}
//分个形式(拍卖行待售、待分配)球员列表 读取球员列表查询价格
UTSectionedItemListView.prototype.addItems = function(t, e, i, r) {
call.plist.sectioned.call(this,t, e, i, r);
let p = this.listRows.map(function (i) {if(i.data.type == "player" && !info.roster.data.hasOwnProperty(i.data.definitionId)){return i.data.definitionId}}).filter(Boolean);
events.loadPlayerPrice(p,this);
if(info.set.player_loas && (cntlr.current().getNavigationTitle() !== services.Localization.localize("navbar.label.assigncards") || repositories.Item.getPileSize(ItemPile.TRANSFER) - repositories.Item.numItemsInCache(ItemPile.TRANSFER) > 0)){
let pn = 0,pr = {},ln = 0;
for (let n of this.listRows) {
if(!n.data.untradeable && n.data.loans == -1 && n.data.type == "player" && !n.data._auction.isClosedTrade() && !n.data._auction.isActiveTrade()){
pn++;
n.__root.classList.add("fsu-akb");
n._fsuLosAuction = events.createToggle(
"",
async(e) => {
if(e.getToggleState()){
e._parent._fsuAkbCurrent++;
e._parent._fsuAkbArray[e._id] = e;
}else{
e._parent._fsuAkbCurrent--;
delete e._parent._fsuAkbArray[e._id];
}
e._parent._fsuAkbToggle.toggle(e._parent._fsuAkbCurrent == e._parent._fsuAkbNumber);
events.losAuctionCount(e._parent,1)
},
""
)
n._fsuLosAuction.toggle(1);
n._fsuLosAuction._parent = this;
pr[n.data.id] = n._fsuLosAuction;
n._fsuLosAuction._id = n.data.id;
n._fsuLosAuction._pId = n.data.definitionId;
n._fsuLosAuction._l = ln;
n._fsuLosAuction.setInteractionState(0);
n.__root.insertBefore(n._fsuLosAuction.__root,n.__root.firstChild)
}
ln++;
}
if(pn){
let b = document.createElement("div");
b.classList.add("fsu-akb-left");
this._fsuAkbToggle = events.createToggle(
fy("losa.all"),
async(e) => {
let sf = e.getToggleState() ? true : false;
e._parent._fsuAkbCurrent = sf ? e._parent._fsuAkbNumber : 0;
e._parent._fsuAkbArray = {};
for (let n of e._parent.listRows) {
if(n.hasOwnProperty("_fsuLosAuction") && n._fsuLosAuction._interactionState){
n._fsuLosAuction.toggle(sf)
if(sf){
if(n.hasOwnProperty("_fsuLosAuction")){
if(events.getCachePrice(n._fsuLosAuction._pId,2)){
e._parent._fsuAkbArray[n._fsuLosAuction._id] = n._fsuLosAuction;
}
}
}
}
}
events.losAuctionCount(e._parent,1)
},
""
)
this._fsuAkbToggle.toggle(1);
this._fsuAkbToggle.setInteractionState(0);
this._fsuAkbToggle._parent = this;
b.appendChild(this._fsuAkbToggle.__root);
let bnd = document.createElement("div");
bnd.insertAdjacentHTML('beforeend', `${fy("losa.select")} `);
let bns = document.createElement("span");
bns.classList.add("fsu-akb-num");
bns.innerText = `${pn}`;
bnd.appendChild(bns);
bnd.insertAdjacentHTML('beforeend', `/`);
let bnn = document.createElement("span");
bnn.classList.add("fsu-akb-max");
bnn.innerText = `${pn}`;
bnd.appendChild(bnn);
b.appendChild(bnd);
let bpd = document.createElement("div");
bpd.insertAdjacentHTML('beforeend', `${fy("losa.price")} `);
let bpp = document.createElement("span");
bpp.classList.add("fsu-akb-price","currency-coins");
bpp.innerText = `0`;
bpd.appendChild(bpp);
b.appendChild(bpd);
this._fsuAkbArray = pr;
this._fsuAkbCurrent = pn;
this._fsuAkbNumber = pn;
this._fsuAkb = document.createElement("div");
this._fsuAkb.classList.add("fsu-akb-title");
this._fsuAkb.appendChild(b);
this._fsuAkbButton = events.createButton(
new UTStandardButtonControl(),
fy("loas.button"),
(e) => {
events.popup(
[
{ labelEnum: enums.UIDialogOptions.OK },
{ labelEnum: enums.UIDialogOptions.CANCEL },
],
fy("loas.popupt"),
fy(["loas.popupm",e._parent._fsuAkb.querySelector(".fsu-akb-num").innerText,e._parent._fsuAkb.querySelector(".fsu-akb-price").innerText]),
(t) => {
if(t === 2){
events.losAuctionSell(e);
}
}
)
},
"btn-standard section-header-btn mini"
)
this._fsuAkbButton.setInteractionState(0);
this._fsuAkbButton._parent = this;
this._fsuAkb.appendChild(this._fsuAkbButton.__root);
this._header.__root.after(this._fsuAkb);
events.losAuctionCount(this,0);
}
}
}
events.popup = (o,t,m,c) => {
let mp = new EADialogViewController({
dialogOptions: o,
message: m,
title: t,
type: EADialogView.Type.MESSAGE
});
mp.init();
mp.modalDisplayDimensions.minWidth = "300px";
mp.onExit.observe(this, function (e, z) {
e.unobserve(this), c.call(this, z);
});
gPopupClickShield.setActivePopup(mp);
}
events.wait = (min,max) => {
let delay = Math.floor(Math.random() * (max * 1000 - min * 1000 + 1)) + min * 1000;
return new Promise(resolve => setTimeout(resolve, delay));
}
events.changeLoadingText = (t) =>{
document.querySelector('.fsu-loading-close').innerHTML = fy(t);
}
events.losAuctionSell = async(e) => {
e.setInteractionState(0);
info.base.losauction = true;
events.showLoader();
let a = e._parent._fsuAkbArray,b = e._parent._fsuAkbCurrent,pn = 0;
events.notice(["loas.start",`${b}`,`${b * 5}`],1);
for (let n in a) {
if(!info.base.losauction){
break;
}
pn++;
events.changeLoadingText(["loadingclose.loas",`${pn}`,`${b - pn}`]);
await events.playerToAuction(n,events.getCachePrice(a[n]._pId,1));
console.log(a[n]._l)
if(isPhone()){
a[n].toggle(false);
e._parent.listRows[a[n]._l].hide();
e._parent._fsuAkbCurrent--;
e._parent._fsuAkbNumber--;
delete e._parent._fsuAkbArray[a[n]._id];
events.losAuctionCount(e._parent)
}
await events.wait(2,4);
}
events.hideLoader();
info.base.losauction = false;
e.setInteractionState(e._parent._fsuAkbCurrent);
}
events.getCachePrice = (i,t) => {
if(t == 1){
return info.roster.data.hasOwnProperty(i) ? Number(info.roster.data[i].prices[info.base.platform].LCPrice.replace(/,/g, '')) : 0;
}else{
return info.roster.data.hasOwnProperty(i);
}
}
events.losAuctionCount = (e,t) => {
if(e.hasOwnProperty("_fsuAkbCurrent") && e.hasOwnProperty("_fsuAkbNumber") && e.hasOwnProperty("_fsuAkbArray")){
let pn = 0,qs = {};
for (let n in e._fsuAkbArray) {
let p = events.getCachePrice(e._fsuAkbArray[n]._pId,1),j = events.getCachePrice(e._fsuAkbArray[n]._pId,2);
pn += p;
if(!j){
e._fsuAkbArray[n].setInteractionState(0);
}else if(j && p == 0){
e._fsuAkbArray[n].setInteractionState(0);
e._fsuAkbCurrent--;
e._fsuAkbNumber--;
delete e._fsuAkbArray[n];
}else{
e._fsuAkbArray[n].setInteractionState(1);
}
}
e._fsuAkb.querySelector(".fsu-akb-num").innerText = e._fsuAkbCurrent;
e._fsuAkb.querySelector(".fsu-akb-max").innerText = e._fsuAkbNumber;
e._fsuAkb.querySelector(".fsu-akb-price").innerText = pn.toLocaleString();
if(pn){
e._fsuAkbButton.setInteractionState(1);
e._fsuAkbToggle.setInteractionState(1);
}else if(pn == 0){
e._fsuAkbButton.setInteractionState(0);
}
}
}
//列表形式(右侧、拍卖行搜索结果、俱乐部)球员列表 读取球员列表查询价格
UTPaginatedItemListView.prototype.renderItems = function(t) {
call.plist.paginated.call(this,t);
let p = this.listRows.map(function (i) {if(i.data.type == "player" && !info.roster.data.hasOwnProperty(i.data.definitionId)){return i.data.definitionId}}).filter(Boolean);
let ct = isPhone() ? getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController().getNavigationTitle() : getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController().getCurrentController()._rightController.getNavigationTitle();
let ctt = ct == services.Localization.localize("navbar.label.clubsearch") ? 1 : 0;
if(ctt){
let z = getAppMain().getRootViewController().getPresentedViewController().getCurrentViewController()._childViewControllers,q = false;
for (let n of z) {
if(n.className.indexOf("UTSBC") !== -1){
q = true;
break;
}
}
let s = true;
this.listRows.forEach(function(i) {
if(q){
if(info.unassigned.rlist.length !== 0){
if(info.unassigned.rlist.indexOf(i.data.definitionId) == -1){
i.hide();
}else{
s = false;
}
}else{
s = false;
}
}
})
if(s && q){
this.__itemList.prepend(events.createDF(`
${fy("emptylist.t")}
${fy("emptylist.c")}
`));
}else{
if(this.__itemList.querySelector(".ut-no-results-view")){
this.__itemList.querySelector(".ut-no-results-view").remove()
}
}
}else{
//假想球员搜索结果排除其他版本项目
let pn = this._targets._collection.rowselect[0].target;
if(pn.hasOwnProperty("pinnedItemView")){
pn._list.__itemList.classList.remove("fsu-compact");
}
if(info.set.sbc_market && pn.hasOwnProperty("pinnedItemView") && pn.pinnedItemView && pn.pinnedItemView.itemCell.data.concept){
let z = 0;
let pi = pn.pinnedItemView.itemCell.data.definitionId;
this.listRows.forEach(function(i) {
if(i.data.definitionId !== pi){
i.__root.style.filter = "brightness(0.5)";
z++;
}
})
if(z && !isPhone()){
events.notice("notice.conceptdiff",1)
}
}
}
events.loadPlayerPrice(p);
}
//球员预览包打开 读取球员列表查询价格
UTStoreRevealModalListView.prototype.addItems = function(e, t, i, o) {
call.plist.storeReveal.call(this, e, t, i, o);
let p = e.map(function (it) {if(it.type == "player" && !info.roster.data.hasOwnProperty(it.definitionId)){return it.definitionId}}).filter(Boolean);
events.loadPlayerPrice(p);
}
//球员挑选包打开 读取球员列表查询价格
UTPlayerPicksViewController.prototype.viewDidAppear = function() {
call.plist.picks.call(this);
let p = this.picks.map(function (i) {if(i.type == "player" && !info.roster.data.hasOwnProperty(i.definitionId)){return i.definitionId}}).filter(Boolean);
events.loadPlayerPrice(p);
}
//俱乐部卖掉球员 移除在阵容列表内球员 以便计算重复效果
UTClubRepository.prototype.removeClubItem = function(t) {
call.plist.club.call(this,t);
if(info.roster.thousand.hasOwnProperty(t.definitionId)){
delete(info.roster.thousand[t.definitionId]);
}
}
//阵容评分获取 每次球员变化都会获取 主要计算阵容整体价格
UTSquadEntity.prototype.getRating = function() {
let r = call.plist.squadGR.call(this);
let p = [];
for (let i of this.getFieldPlayers()) {
let id = i._item.definitionId;
if(id > 0 && info.roster.data.hasOwnProperty(id)){
p.push(id)
}
}
events.squadTotal(this.getFieldPlayers().map(function (i) {if(info.roster.data.hasOwnProperty(i._item.definitionId)){return i._item.definitionId}}).filter(i => i > 0));
return r;
}
//阵容的总价格计算填充 需要传递阵容球员ID列表(数组)
events.squadTotal = (p) => {
let e = document.getElementById("squadTotal");
if(e){
let n = 0;
for (let i of p) {
if(info.roster.data.hasOwnProperty(i)){
let s = info.roster.data[i].prices[info.base.platform].LCPrice;
n += isNaN(s) ? Number((s).replace(/,/g, "")) : Number(s);
}
}
e.innerText = n.toLocaleString();
if(n !== 0 && document.getElementById("sbcPrice")){
let p = e.parentNode.querySelector(".fsu-squad-pTitle");
if(p.querySelector("span")){
p.querySelector("span").remove();
}
p.append(events.createDF(events.priceLastDiff(n,document.getElementById("sbcPrice").innerText.replace(/,/g, ''))))
}
}
}
//差价计算 需要传递购买价格和预估价格
events.priceLastDiff = (p,l) => {
let n = ((Number(p)/Number(l)-1)*100).toFixed(0);
if (!isFinite(n)) {
n = 0;
}
let v = ("+" + n +"%").replace("+-","-");
return v.indexOf("+") != -1 ? `${v}` : `${v}`;
}
//球员价格读取 需要传递球员ID列表(数组)
events.loadPlayerPrice = async(list,el) => {
if(list.length > 0){
let la = Array.from(new Set(list));
let pu = [];
let gr = Math.ceil(la.length / 23);
for (let i = 0; i < gr; i++) {
let lt = la.splice(-23).join();
pu.push(`https://www.futbin.com/${info.base.year}/playerPrices?player=&rids=${lt}`)
}
for (let k in pu) {
let t = await getFutbin(pu[k]);
info.roster.data = Object.assign(info.roster.data,t);
for (let k in t) {
let e = document.querySelectorAll(`.fsu-price-box[data-id='${k}']`);
let p = t[k].prices[info.base.platform].LCPrice;
if(e.length > 0){
for (let i of e) {
if(i.classList.contains("fsu-price-val")){
i.setAttribute("data-value",p);
i.innerText = p;
}else{
i.querySelector(".fsu-price-val").setAttribute("data-value",p);
i.querySelector(".fsu-price-val .value").innerText = p;
}
if(i.querySelectorAll(".fsu-price-last").length > 0){
i.querySelector(".fsu-price-val .title span").outerHTML = events.priceLastDiff(p.replace(/,/g, ''),i.querySelector(".fsu-price-last .value").innerText.replace(/,/g, ''));
}
}
}
}
}
if(document.getElementById("squadTotal")){
events.squadTotal(cntlr.current()._squad.getFieldPlayers().map(function (i) {return i._item.definitionId}).filter(i => i > 0));
}
}
if(el){
events.losAuctionCount(el,0)
}
}
//阵容页面显示 添加阵容价值部分
UTBaseSquadSplitViewController.prototype.viewDidAppear = function(){
call.view.squad.call(this);
if(info.set.info_squad){
let p = this._squad.getPlayers().map(function (i) {if(i._item.type == "player" && !info.roster.data.hasOwnProperty(i._item.definitionId)){return i._item.definitionId}}).filter(i => i > 0);
this._getLeftController().getView().getSummaryPanel().getRootElement().querySelector(`.ut-squad-summary-info${this.className == "UTSBCSquadSplitViewController" ? "--right" : ""}`).after(events.createDF(`
${fy("sbc.topsquad")}0
`))
if(!p.length){
events.squadTotal(this._squad.getFieldPlayers().map(function (i) {if(info.roster.data.hasOwnProperty(i._item.definitionId)){return i._item.definitionId}}).filter(i => i > 0));
}
if(this._squad.isSBC()){
let si;
if(info.task.sbc.stat.hasOwnProperty(this._set.id)){
if(this._set.challengesCount == 1){
si = info.task.sbc.stat.hasOwnProperty(this._set.id) ? info.task.sbc.stat[this._set.id] : -1;
}else{
si = info.task.sbc.stat[this._set.id].hasOwnProperty("c") ? info.task.sbc.stat[this._set.id].c[this._challengeId] : -1;
}
}else{
si = -1;
}
if(si !== -1 && !document.getElementById("sbcPrice")){
this._getLeftController().getView().getRootElement().querySelector(".fsu-squad-pBox .fsu-squad-pWrap").after(events.createDF(`
`))
}
}
}
}
call.task = {
sbcT:UTSBCHubView.prototype.populateTiles,
sbcC:UTSBCChallengesViewController.prototype.viewDidAppear,
sbcN:UTSBCHubView.prototype.populateNavigation,
objN:UTObjectivesHubView.prototype.setupNavigation,
objG:UTObjectiveCategoryView.prototype.setCategoryGroups,
home:UTHomeHubView.prototype._generate,
homeG:UTHomeHubView.prototype.getObjectivesTile,
}
events.squadCount = (e) => {
let t = e.__root.getAttribute("data-r");
let pa = cntlr.current()._squad.getFieldPlayers(),pn = [],pr = "";
for (let i of pa) {
if(i.isBrick()){
pn.push(0);
}else{
if(i.item.rating !== 0){
pn.push(i.item.rating)
}
}
}
if(pn.length > 0){
pr = "&ratings=" + pn.join(",");
}
GM_openInTab(`https://futcd.com/sbc.html?target=${t}${pr}`, { active: true, insert: true, setParent :true });
}
events.squadConsult = (e) => {
let i = e.__root.getAttribute("data-id");
GM_openInTab(`https://www.futbin.com/squad-building-challenges/ALL/${i}/list`, { active: true, insert: true, setParent :true });
}
//SBC阵容填充指定评分 需要元素携带data-r(评分),切换球员填充状态为3
events.SBCSetRatingPlayers = async(e) => {
let r = e.__root.getAttribute('data-r'),x = e.__text ? e.__text.textContent : "";
let pi = 0,w,b;
if(isPhone()){
w = cntlr.current();
}else{
w = cntlr.left();
}
if(x !== fy("sbc.swaprating")){
if(w.getView().getSelectedSlot() !== null){
pi = w.getView().getSelectedSlot().getIndex();
}
if(w._squad._getSlotByIndex(pi).isBrick() || w._squad._getSlotByIndex(pi).isValid()){
let pl = w._squad.getNonBrickSlots()
for (const i of pl) {
if(!i.isValid()){
pi = i.getIndex();
break;
}
}
}
await w.getView().selectSlot(pi);
await w.getView().getSelectedSlot()._tapDetected(this);
}
if(isPhone()){
b = cntlr.current()._rootController;
}else{
b = cntlr.right();
}
if(r == "d"){
if(b._panelView._fsuUn._interactionState){
await b._panelView._fsuUn._tapDetected(this);
}else{
events.notice("notice.noduplicate",2);
}
}else{
info.unassigned.state = true;
info.unassigned.run = 3;
info.unassigned.rating = r;
await b._panelView._btnAddSwap._tapDetected(this);
}
}
//SBC填充导航题头 加载导航额外信息
UTSBCHubView.prototype.populateNavigation = function(e, t) {
call.task.sbcN.call(this, e, t);
setTimeout(() => {
if(info.task.sbc.stat.hasOwnProperty("new") && info.set.info_sbc){
if(info.task.sbc.stat.new[0] > 0){
let t = this._SBCCategoriesTM.items;
let j = info.task.sbc.stat.new;
for (let n in j) {
if(t[n]){
t[n].__root.append(events.createDF(fy(html.taskBar).replace("{Number}",`+${j[n]}`)));
}
}
}
if(services.SBC.repository.categories._collection.hasOwnProperty("Favourite")){
let f = services.SBC.repository.categories._collection.Favourite.setIds;
let se = 0;
for (let si of f) {
if(info.task.sbc.stat.hasOwnProperty(si)){
if(info.task.sbc.stat[si].e == "1") se++;
}
}
if(se > 0){
this._SBCCategoriesTM.items[1].__root.append(events.createDF(`
${se}
`));
}
}
}
},10);
}
//SBC填充任务列表 每次切换类型都重新填充 加载任务额外信息
UTSBCHubView.prototype.populateTiles = function(e, t) {
call.task.sbcT.call(this, e, t);
if(info.set.info_sbc){
let l = this.sbcSetTiles;
for (let i of l) {
events.sbcInfoFill(i.data.id,i);
}
if(t.isFavourite){
let f = t.setIds;
let se = 0;
for (let si of f) {
if(info.task["sbc"].stat.hasOwnProperty(si)){
if(info.task["sbc"].stat[si].e == "1") se++;
}
}
let el = this._SBCCategoriesTM.items[1].__root;
if(el.querySelector(".fsu-task-bar-favorite")){
el.querySelector(".fsu-task-bar-favorite").remove();
}
if(se > 0){
el.append(events.createDF(`
${se}
`));
}
}
}
if(Object.keys(info.task.sbc.stat).length && info.set.info_sbcf){
this._fsuSbcFilter = new UTDropDownControl();
let fa = [];
for (let i = 0; i < 4; i++) {
fa.push(new UTDataProviderEntryDTO(i,i,fy(`sbc.filter${i}`)))
}
this._fsuSbcFilter.init();
this._fsuSbcFilter.setOptions(fa);
this._fsuSbcFilter.addTarget(this._fsuSbcFilter, (e) => {events.sbcFilter(e);}, EventType.CHANGE);
let b = document.createElement("div");
b.classList.add("fsu-sbcfilter-box");
let o = document.createElement("div");
o.classList.add("fsu-sbcfilter-option");
let s = document.createElement("div");
s.innerText = fy(`sbc.filtert`);
o.appendChild(s);
o.appendChild(this._fsuSbcFilter.__root);
b.appendChild(o);
if(this.__root.querySelector(".fsu-sbcfilter-box")){
this.__root.querySelector(".fsu-sbcfilter-box").remove()
}
this._SBCCategoriesTM.__root.after(b);
}
}
events.sbcFilter = e => {
let t = cntlr.current()._view.sbcSetTiles,g = e.getIndex();
for (let i of t) {
let y = true,d = i.data.id;
if(info.task.sbc.stat.hasOwnProperty(d)){
let s = info.task.sbc.stat[d];
if(g == 1 && s.f !== "1") y = false;
if(g == 2 && s.e !== "1") y = false;
if(g == 3){
let n = parseFloat(s.u);
if(!isNaN(n)){
if(n < 65) y = false;
}else{
y = false
}
}
}
y ? i.show() : i.hide();
}
}
//SBC子任务列表展示 填充额外信息和读取价格
UTSBCChallengesViewController.prototype.viewDidAppear = function() {
call.task.sbcC.call(this);
if(info.set.info_sbcs){
events.sbcInfoFill(this.sbset.id,this.getView()._setInfo);
events.sbcSubPrice(this.sbset.id,this.getView()._challengeTiles);
}
}
//打开futbin球员链接,需要元素携带data-id(球员id)和data-name(球员全称)
events.openFutbinPlayerUrl = async(e) => {
events.showLoader();
let di = e.__root.getAttribute('data-id');
let n = e.__root.getAttribute('data-name').normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/ø/g, "o");
let u = `https://www.futbin.org/futbin/api/searchPlayersByName?playername=${n}&year=${info.base.year}`;
let d = await getFutbin(u);
let fi = "";
for (let i of d.data) {
if(i.resource_id == di){
fi = i.ID;
break;
}
}
events.hideLoader();
GM_openInTab(`https://www.futbin.com/${info.base.year}/player/${fi}/`, { active: true, insert: true, setParent :true });
};
//SBC信息填充,需要传递sbcid和需填充的元素
events.sbcInfoFill = (d,e) => {
if(!info.task.sbc.stat.hasOwnProperty(d)) return;
let s = info.task.sbc.stat[d];
if(s !== undefined){
if(e.hasOwnProperty("__tileTitle")) e.__tileTitle.prepend(events.createDF(`${s.f == "1" ? "" + fy("task.new") + "" : ""}`));
if(!e.__root.querySelector(".task-expire")){
e.__root.prepend(events.createDF(`${s.e == "1" ? "
" + fy("task.expire") + "
" : ""}`));
}
}
if(e._interactionState && !e.__root.querySelector(".fsu-sbc-info")){
let p = s.type == "7" ? "0" : info.base.platform == "pc" ? s.pc : s.tv;
e.__root.lastChild.before(events.createDF(fy(html.sbcInfo).replace("{price}",Number(p).toLocaleString()).replace("{up}",s.u).replace("{down}",s.d)))
}
if(e._rewards.rewards.length == 1 && e._rewards.rewards[0].isItem){
let it = e._rewards.rewards[0].item;
if(it.type == "player"){
let fb = events.createButton(
new UTStandardButtonControl(),
fy("sbc.watchplayer"),
(e) => {events.openFutbinPlayerUrl(e);},
"mini"
)
fb.__root.setAttribute("data-id",it.definitionId);
fb.__root.setAttribute("data-name",`${it._staticData.name}`);
e._rewards._fsuPlayer = fb;
e._rewards.__root.children[0].append(e._rewards._fsuPlayer.__root);
}
}
}
events.createDF = (t) => {
let f = document.createRange().createContextualFragment(t);
return f;
}
events.sbcSubPrice = async(id,e) => {
if(!info.task.sbc.stat[id].hasOwnProperty("c")){
let u = `https://www.futbin.org/futbin/api/getChallengesBySetId?set_id=${id}`;
let d = await getFutbin(u);
info.task.sbc.stat[id].c = {};
for (let i of d.data) {
let j = {"tv":i.price.ps,"pc":i.price.pc};
info.task.sbc.stat[id].c[i.challengeId] = j;
}
}
if(info.task.sbc.stat[id].hasOwnProperty("c")){
for (let i of e) {
i.__tileContent.before(events.createDF(`