Skip to content

Commit c628f8c

Browse files
rainerstudiosclaude
andcommitted
Add complete pricing features with multi-market comparison
💰 PRICING FEATURES ADDED: 1. Steam Market Price in Float Bar - Displays Steam price directly in float display - Shows as: 💰 $XX.XX in green - Automatically extracted from market listing 2. Buff163 Integration (Now Actually Called!) - Fixed: Now properly calls Buff163 integration - Shows Buff163 price below float display - Compares Buff163 vs Steam prices - Shows arbitrage percentage 3. Multi-Market Price Comparison (NEW!) - Uses Skin.Broker API (/api/price/:marketHashName) - Shows prices from 4 markets: 🇨🇳 Buff163 🌐 Skinport 💎 CS.MONEY ⚙️ Steam (current) - Highlights lowest price - Shows % difference vs Steam - Shows number of listings per market - Visual grid layout with color-coded differences 📊 Display Order (Top to Bottom): - Float Value + Steam Price - Trade Protection Display - Float Rarity Display - Multi-Market Prices - Buff163 Integration 🔧 Technical: - Steam price extracted from .market_listing_price_with_fee - Buff163 called with itemName + steamPrice - Multi-market uses fullItemName from float data - All features cached (5-10 min) to reduce API calls 📝 Files Changed: - content.js: Added price extraction + feature calls - manifest.json: Added multiMarketPricing.js - src/multiMarketPricing.js (NEW): 370 lines 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 12ab203 commit c628f8c

3 files changed

Lines changed: 407 additions & 2 deletions

File tree

content.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,11 +618,27 @@ async function addFloatDisplay(itemElement, floatData) {
618618
const floatRange = maxFloat - minFloat;
619619
const floatPosition = ((floatData.floatValue - minFloat) / floatRange) * 100;
620620

621+
// Extract Steam Market price if available
622+
let steamPrice = null;
623+
const priceElement = itemElement.querySelector('.market_listing_price_with_fee, .market_listing_price, .normal_price');
624+
if (priceElement) {
625+
const priceText = priceElement.textContent.trim();
626+
const priceMatch = priceText.match(/[\d.,]+/);
627+
if (priceMatch) {
628+
steamPrice = parseFloat(priceMatch[0].replace(',', '.'));
629+
}
630+
}
631+
621632
// Create visible display with conditional float bar
622633
let displayHtml = `
623-
<div style="display: flex; align-items: center; gap: 8px;">
634+
<div style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
624635
<span class="cs2-float-copyable" style="cursor: pointer; transition: background-color 0.2s ease;" title="Click to copy float value">Float: ${floatData.floatValue.toFixed(floatData.precision || 4)}</span>`;
625636

637+
// Add Steam price if available
638+
if (steamPrice) {
639+
displayHtml += `<span style="color: #4CAF50; font-weight: bold;">💰 $${steamPrice.toFixed(2)}</span>`;
640+
}
641+
626642
// Add visual float bar if enabled
627643
if (settings.enableVisualFloatBars !== false) {
628644
displayHtml += `
@@ -732,6 +748,18 @@ async function addFloatDisplay(itemElement, floatData) {
732748
// Track price history for market intelligence
733749
await trackItemPrice(itemElement, floatData);
734750

751+
// Display Buff163 price comparison if price available
752+
if (steamPrice && floatData.fullItemName && window.buff163Integration) {
753+
console.log('[CS2 Float] Calling Buff163 with:', {itemName: floatData.fullItemName, steamPrice});
754+
await window.buff163Integration.displayBuff163Price(itemElement, floatData.fullItemName, steamPrice);
755+
} else {
756+
console.log('[CS2 Float] Buff163 not called:', {
757+
hasSteamPrice: !!steamPrice,
758+
hasItemName: !!floatData.fullItemName,
759+
hasIntegration: !!window.buff163Integration
760+
});
761+
}
762+
735763
// Add 3D item preview if image URL is available
736764
if (floatData.imageUrl && window.item3DPreview) {
737765
window.item3DPreview.attachToListing(itemElement, floatData.imageUrl);
@@ -775,6 +803,17 @@ async function addFloatDisplay(itemElement, floatData) {
775803
hasFloatValue: floatData.floatValue !== undefined
776804
});
777805
}
806+
807+
// Multi-Market Pricing - shows prices from Buff163, Skinport, CS.MONEY
808+
if (window.multiMarketPricing && floatData.fullItemName) {
809+
console.log('[CS2 Float] Calling Multi-Market Pricing for:', floatData.fullItemName);
810+
await window.multiMarketPricing.display(container, floatData.fullItemName, steamPrice);
811+
} else {
812+
console.log('[CS2 Float] Multi-Market Pricing not available:', {
813+
hasDisplay: !!window.multiMarketPricing,
814+
hasItemName: !!floatData.fullItemName
815+
});
816+
}
778817
}
779818

780819
/**

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"https://steamcommunity.com/id/*/tradehistory",
3737
"https://steamcommunity.com/profiles/*/tradehistory"
3838
],
39-
"js": ["lib/marketIntelligence.js", "lib/inventoryEnhancer.js", "src/infiniteScroll.js", "src/buff163Integration.js", "src/item3DPreview.js", "src/tradeProtectionDisplay.js", "src/floatRarityDisplay.js", "content.js"],
39+
"js": ["lib/marketIntelligence.js", "lib/inventoryEnhancer.js", "src/infiniteScroll.js", "src/buff163Integration.js", "src/item3DPreview.js", "src/tradeProtectionDisplay.js", "src/floatRarityDisplay.js", "src/multiMarketPricing.js", "content.js"],
4040
"css": ["styles/main.css", "styles/inventory.css"],
4141
"run_at": "document_idle"
4242
}

0 commit comments

Comments
 (0)