diff --git a/extension/changelog.json b/extension/changelog.json index 99a64a44d..bfc81c458 100644 --- a/extension/changelog.json +++ b/extension/changelog.json @@ -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 }, diff --git a/extension/scripts/features/trade-values/ttTradeValues.js b/extension/scripts/features/trade-values/ttTradeValues.js index aaadca2ea..03adee037 100644 --- a/extension/scripts/features/trade-values/ttTradeValues.js +++ b/extension/scripts/features/trade-values/ttTradeValues.js @@ -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(); }); @@ -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")) { @@ -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;