Mark merchant vs trade site listings

Fixes #563
This commit is contained in:
kvan7
2025-08-22 21:47:13 -05:00
parent 3a64e003f6
commit b0ceb4efde
6 changed files with 22 additions and 3 deletions

View File

@@ -39,12 +39,14 @@
"Update to 2"
],
"cSpell.words": [
"Atzoatl",
"corruptionjewel",
"Defences",
"DIVCARD",
"divinable",
"edps",
"ilvl",
"Kalandra",
"keybinds",
"Knockback",
"nonunique",

View File

@@ -35,6 +35,7 @@ export function createFilters(
trade: {
offline: false,
onlineInLeague: false,
merchant: false,
listed: undefined,
currency: opts.currency,
league: opts.league,

View File

@@ -79,6 +79,7 @@ export interface ItemFilters {
trade: {
offline: boolean;
onlineInLeague: boolean;
merchant: boolean;
listed: string | undefined;
currency: string | undefined;
league: string;

View File

@@ -8,7 +8,7 @@
<td class="px-2 whitespace-nowrap">
<span
:class="{
'line-through': result.priceCurrency === 'chaos',
'line-through': false,
}"
>{{ result.priceAmount }} {{ result.priceCurrency }}</span
>
@@ -47,7 +47,10 @@
</td>
<td class="pr-2 pl-4 whitespace-nowrap">
<div class="inline-flex items-center">
<div class="account-status" :class="result.accountStatus"></div>
<div
class="account-status"
:class="result.isMerchant ? 'merchant' : result.accountStatus"
></div>
<div class="ml-1 font-sans text-xs">
{{ result.relativeDate }}
</div>

View File

@@ -430,10 +430,14 @@ export default defineComponent({
height: 0.375rem;
border-radius: 100%;
&.online {
&.merchant {
/* */
}
&.online {
@apply bg-pink-400;
}
&.offline {
@apply bg-red-600;
}

View File

@@ -29,6 +29,7 @@ import { ModifierType } from "@/parser/modifiers";
import { Cache } from "./Cache";
import { filterInPseudo } from "../filters/pseudo";
import { parseAffixStrings } from "@/parser/Parser";
import { rand } from "@vueuse/core";
export const CATEGORY_TO_TRADE_ID = new Map([
[ItemCategory.Map, "map"],
@@ -287,6 +288,7 @@ export interface PricingResult {
priceCurrency: string;
isMine: boolean;
hasNote: boolean;
isMerchant: boolean;
accountName: string;
accountStatus: "offline" | "online" | "afk";
ign: string;
@@ -317,6 +319,11 @@ export function createTradeRequest(
};
const { query } = body;
if (filters.trade.merchant) {
// FIXME: actually do something
console.log("do something cause merchant");
}
if (filters.trade.currency) {
propSet(
query.filters,
@@ -1021,6 +1028,7 @@ export async function requestResults(
priceCurrency: result.listing.price?.currency ?? "no price",
hasNote: result.item.note != null,
isMine: result.listing.account.name === opts.accountName,
isMerchant: rand(0, 2) !== 0,
ign: result.listing.account.lastCharacterName,
accountName: result.listing.account.name,
accountStatus: result.listing.account.online