41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
|
|
export interface ConfigType {
|
|
data: {
|
|
'threadsToUse/speed': number;
|
|
minSnipeProfit: number;
|
|
minAvgProfit: number;
|
|
minCraftProfit: number;
|
|
maxAvgLbinDiff: number;
|
|
rawCraftMaxWeightPP: number;
|
|
minSnipePP: number;
|
|
minCraftPP: number;
|
|
ignoreCategories: {
|
|
weapon: boolean;
|
|
accessories: boolean;
|
|
armor: boolean;
|
|
misc: boolean;
|
|
blocks: boolean;
|
|
consumables: boolean;
|
|
}
|
|
minSales: number;
|
|
includeCraftCost: boolean;
|
|
minPriceForRawcraft: number;
|
|
};
|
|
filters: {
|
|
EnchantThresholdConditionalBypass: Record<string, Record<string, number>>;
|
|
EnchantThreshold: Record<string, number>;
|
|
itemIDExclusions: string[];
|
|
};
|
|
}
|
|
|
|
export function loadConfig(): ConfigType {
|
|
const configPath = path.join(__dirname, 'config.json');
|
|
try {
|
|
const fileContents = fs.readFileSync(configPath, 'utf8');
|
|
return JSON.parse(fileContents) as ConfigType;
|
|
} catch (error) {
|
|
throw new Error(`Failed to load config.json at ${configPath}: ${error}`);
|
|
}
|
|
}
|