Skip to content

Commit 3b7f58d

Browse files
committed
1.1.4 Changes
1 parent 7bc17c8 commit 3b7f58d

File tree

7 files changed

+62
-19
lines changed

7 files changed

+62
-19
lines changed

app/function-overrides/popup-override.js

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export const popupOverride = () => {
4646
case atob("UGF5cGFs"):
4747
case atob("WW91dHViZSBTdWJzY3JpcHRpb24="):
4848
case atob("UGF0cmVvbg=="):
49+
case atob("RGlzY29yZCAoQ29tbXVuaXR5KQ=="):
50+
case atob("VHdpdHRlciAoRmFzdCBSZXNwb25zZSk="):
51+
case atob("R2l0aHVi"):
4952
return e;
5053
}
5154
return services.Localization.localize(t);

app/function-overrides/sbcview-override.js

+25-8
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ import {
1717
} from "../app.constants";
1818
import { showPopUp } from "./popup-override";
1919
import { addFutbinCachePrice } from "../utils/futbinUtil";
20-
import { getValue } from "../services/repository";
20+
import { getValue, setValue } from "../services/repository";
2121
import { getSellBidPrice, roundOffPrice } from "../utils/priceUtil";
2222

2323
export const sbcViewOverride = () => {
2424
const squladDetailPanelView = UTSBCSquadDetailPanelView.prototype.render;
2525

2626
UTSBCSquadDetailPanelView.prototype.render = function (...params) {
2727
squladDetailPanelView.call(this, ...params);
28+
const sbcId = params.length ? params[0].id : "";
29+
setValue("squadId", sbcId);
2830
setTimeout(() => {
2931
if (!$(".futBinFill").length) {
3032
$(".challenge-content").append(
@@ -33,9 +35,9 @@ export const sbcViewOverride = () => {
3335
<input id="squadId" type="text" class="ut-text-input-control futBinId" placeholder="FutBin Id" />
3436
${generateButton(
3537
idFillSBC,
36-
" Auto Fill",
38+
"Auto Fill",
3739
async () => {
38-
await fillSquad();
40+
await fillSquad(getValue("squadId"));
3941
},
4042
"call-to-action"
4143
)}
@@ -52,6 +54,9 @@ export const sbcViewOverride = () => {
5254
)
5355
);
5456
}
57+
if (getValue(sbcId)) {
58+
appendSquadTotal(getValue(sbcId).value);
59+
}
5560
});
5661
};
5762
};
@@ -213,7 +218,7 @@ const buyPlayer = (player, buyPrice) => {
213218
});
214219
};
215220

216-
const fillSquad = async () => {
221+
const fillSquad = async (sbcId) => {
217222
const squadId = $("#squadId").val();
218223
if (!squadId) {
219224
sendUINotification("Squad Id is missing !!!", UINotificationType.NEGATIVE);
@@ -277,13 +282,25 @@ const fillSquad = async () => {
277282

278283
hideLoader();
279284

280-
$(
281-
`<div class="rating">
285+
setValue(sbcId, {
286+
expiryTimeStamp: new Date(Date.now() + 15 * 60 * 1000),
287+
value: squadTotal.toLocaleString(),
288+
});
289+
appendSquadTotal(squadTotal.toLocaleString());
290+
};
291+
292+
const appendSquadTotal = (total) => {
293+
if ($(".squadTotal").length) {
294+
$(".squadTotal").text(total);
295+
} else {
296+
$(
297+
`<div class="rating">
282298
<span class="ut-squad-summary-label">FUTBIN Squad Price</span>
283299
<div>
284-
<span class="ratingValue currency-coins">${squadTotal.toLocaleString()}</span>
300+
<span class="ratingValue squadTotal currency-coins">${total}</span>
285301
</div>
286302
</div>
287303
`
288-
).insertAfter($(".chemistry"));
304+
).insertAfter($(".chemistry"));
305+
}
289306
};

app/services/club.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,19 @@ const downloadClub = async () => {
8787

8888
let csvContent = "";
8989
const headers =
90-
"Player Name,Rating,Rare,Position,Nation,League,Club,Price Range,FUTBIN Price,Bought For,Discard Value,Contract Left,IsUntradable,IsLoaned";
90+
"Player Name,Rating,Quality,Rarity,Position,Nation,League,Club,Price Range,FUTBIN Price,Bought For,Discard Value,Contract Left,IsUntradable,IsLoaned";
9191
csvContent += headers + "\r\n";
9292
for (const squadMember of squadMembers) {
9393
let rowRecord = "";
9494
rowRecord += squadMember._staticData.name + ",";
9595
rowRecord += squadMember.rating + ",";
96+
rowRecord += getCardQuality(squadMember) + ",";
9697
if (ItemRarity[squadMember.rareflag]) {
9798
rowRecord += !squadMember.rareflag
9899
? "COMMON,"
99100
: ItemRarity[squadMember.rareflag] + ",";
101+
} else if (squadMember.isSpecial()) {
102+
rowRecord += "SPECIAL,";
100103
} else {
101104
rowRecord += ",";
102105
}
@@ -150,6 +153,17 @@ const downloadClub = async () => {
150153
hideLoader();
151154
};
152155

156+
const getCardQuality = (card) => {
157+
if (card.isGoldRating()) {
158+
return "Gold";
159+
} else if (card.isSilverRating()) {
160+
return "Silver";
161+
} else if (card.isBronzeRating()) {
162+
return "Bronze";
163+
}
164+
return "";
165+
};
166+
153167
addBtnListner("#downloadClub", async function () {
154168
await downloadClub();
155169
});

app/utils/ratingFilterUtil.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,33 @@ import { deletePlayers, insertPlayers } from "./dbUtil";
44
import { sendUINotification } from "./notificationUtil";
55

66
export const savePlayersWithInRatingRange = async (rating) => {
7-
const res = await $.getJSON(
8-
`${fut_resourceRoot}${fut_resourceBase}${fut_guid}/${fut_year}/fut/items/web/players.json`
9-
);
10-
117
const playerFilteredIds = [];
128
setValue("PlayersRatingRange", []);
139
await deletePlayers();
1410

11+
if (!rating) {
12+
return;
13+
}
14+
const [minRating, maxRating] = rating.split("-").map((a) => a && parseInt(a));
15+
const res = await $.getJSON(
16+
`${fut_resourceRoot}${fut_resourceBase}${fut_guid}/${fut_year}/fut/items/web/players.json`
17+
);
18+
1519
res.LegendsPlayers.reduce(function (filtered, option) {
16-
if (rating && option.r === rating) {
20+
if (
21+
(minRating && option.r >= rating) ||
22+
(maxRating && option.r <= maxRating)
23+
) {
1724
filtered.push(option.id);
1825
}
1926
return filtered;
2027
}, playerFilteredIds);
2128

2229
res.Players.reduce(function (filtered, option) {
23-
if (rating && option.r === rating) {
30+
if (
31+
(minRating && option.r >= rating) ||
32+
(maxRating && option.r <= maxRating)
33+
) {
2434
filtered.push(option.id);
2535
}
2636
return filtered;

app/utils/uiUtils/generateTextInput.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export const generateTextInput = (
1414
id,
1515
info,
1616
value = null,
17-
customCallBack = null,
1817
type = "number",
1918
additionalClasses = "settings-field"
2019
) => {

app/view/EnhancerSettingsView.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ EnhancerSettingsView.prototype._generate = function _generate() {
7777
"",
7878
{ idMinRating },
7979
"Will only show players with rating as this value in searches",
80-
enhancerSetting["idMinRating"]
80+
enhancerSetting["idMinRating"],
81+
"text"
8182
)}
8283
${generateTextInput(
8384
"FUTBIN List Duration",
8485
"1H",
8586
{ idFutBinDuration },
8687
"List Duration when listing using Re-list FUTBIN",
8788
enhancerSetting["idFutBinDuration"],
88-
null,
8989
"text"
9090
)}
9191
${generateToggleInput(

tampermonkey-header.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = {
22
headers: {
33
name: "FUT Trade Enhancer",
44
namespace: "http://tampermonkey.net/",
5-
version: "1.1.4",
5+
version: "1.1.5",
66
description: "FUT Trade Enhancer",
77
author: "CK Algos",
88
match: [

0 commit comments

Comments
 (0)