Skip to content

Commit

Permalink
Fix Trade Item Values after Trade page redesign.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sashank999 committed Feb 17, 2024
1 parent 04e1b2a commit f79140a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion extension/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": { "major": 6, "minor": 25, "build": 0 },
"title": "Beta",
"date": false,
"logs": { "features": [], "fixes": [], "changes": [], "removed": [] }
"logs": { "features": [], "fixes": [{ "message": "Trade Item Values after Trade page redesign.", "contributor": "TheFoxMan" }], "changes": [], "removed": [] }
},
{
"version": { "major": 6, "minor": 24, "build": 0 },
Expand Down
8 changes: 4 additions & 4 deletions extension/scripts/features/trade-values/ttTradeValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
function initialiseListeners() {
CUSTOM_LISTENERS[EVENT_CHANNELS.TRADE].push(({ step }) => {
if (!feature.enabled()) return;
if (!["view", "initiateTrade", "accept", "start"].includes(step)) return;
if (!["logview", "initiateTrade", "accept", "start"].includes(step)) return;

addItemValues();
});
Expand All @@ -32,9 +32,9 @@
await requireElement(".cont .color1 .desc > li .name");
const localMappings = {};

for (const log of document.findAll(".log li div:not(.tt-modified)")) {
for (const log of document.findAll(".log li .msg:not(.tt-modified)")) {
log.classList.add("tt-modified");
const text = log.childNodes[1].textContent;
const text = log.textContent;
let totalValue = 0;

if (!text.includes("says:") && text.includes("added")) {
Expand All @@ -49,7 +49,7 @@
const quantityMap = {};
for (const entry of itemEntries) {
const nameRegex = entry.match(/(?<=x ).*/);
const quantityRegex = entry.match(/\d*(?=x)/g);
const quantityRegex = entry.match(/\d+(?=x)/g);
if (!nameRegex || !quantityRegex) {
console.log("TT - (Trade Values) Ignoring item because it doesn't match anything.", entry);
continue;
Expand Down

0 comments on commit f79140a

Please sign in to comment.