add local production bonuses
This commit is contained in:
@@ -4,6 +4,7 @@ import type { CraftingRecipe, ProfitResult, IngredientBreakdown, SortState } fro
|
||||
import type { FilterState, VariantType } from '../types/filters'
|
||||
import { useAlbionPrices } from './useAlbionPrices'
|
||||
import { formatItemId } from '../utils/formatting'
|
||||
import { cityRrr, isRrrExempt } from '../data/cityBonuses'
|
||||
|
||||
function variantOf(outputItemId: string): VariantType {
|
||||
const id = outputItemId.replace(/@\d$/, '') // strip enchantment suffix
|
||||
@@ -30,7 +31,6 @@ export function useCraftingProfit(
|
||||
const profitResults = computed<ProfitResult[]>(() => {
|
||||
const f = filters.value
|
||||
const city = f.city
|
||||
const rrrFactor = 1 - f.rrr / 100
|
||||
|
||||
const results: ProfitResult[] = []
|
||||
const nameLower = f.nameFilter.trim().toLowerCase()
|
||||
@@ -44,7 +44,8 @@ export function useCraftingProfit(
|
||||
if (nameLower && !recipe.displayName.toLowerCase().includes(nameLower)) continue
|
||||
|
||||
// Calculate material cost from ingredients only
|
||||
let materialCost = 0
|
||||
let basicCost = 0 // resources subject to RRR
|
||||
let artefactCost = 0 // artefacts / ALCHEMY_RARE — not subject to RRR
|
||||
let missingPrices = false
|
||||
|
||||
// Track oldest price date (for status column)
|
||||
@@ -70,7 +71,8 @@ export function useCraftingProfit(
|
||||
} else {
|
||||
trackDate(ingEntry.sell_price_min_date)
|
||||
const totalCost = unitPrice * ing.quantity
|
||||
materialCost += totalCost
|
||||
if (isRrrExempt(ing.itemId)) artefactCost += totalCost
|
||||
else basicCost += totalCost
|
||||
ingredientBreakdown.push({
|
||||
itemId: ing.itemId,
|
||||
displayName: formatItemId(ing.itemId),
|
||||
@@ -81,13 +83,16 @@ export function useCraftingProfit(
|
||||
}
|
||||
}
|
||||
|
||||
const effectiveMaterialCost = materialCost * rrrFactor
|
||||
const materialCost = basicCost + artefactCost
|
||||
const rrr = cityRrr(city, recipe.outputItemId)
|
||||
const effectiveMaterialCost = basicCost * (1 - rrr / 100) + artefactCost
|
||||
const priceAgeMs = missingPrices ? null : (oldestDate ? Date.now() - new Date(oldestDate).getTime() : null)
|
||||
|
||||
results.push({
|
||||
recipe,
|
||||
materialCost,
|
||||
effectiveMaterialCost,
|
||||
rrr,
|
||||
priceAgeMs,
|
||||
missingPrices,
|
||||
ingredientBreakdown,
|
||||
|
||||
Reference in New Issue
Block a user