Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
<link rel="stylesheet" href="assets/site.css">
<script src="assets/site.js"></script>

</head><body><a class="skip" href="#main">Skip to content</a><nav class="site"><a class="brand" href="index.html" aria-label="KCD Tools home"><span class="logo">⚒️</span> KCD Tools</a><a href="crafting.html">Crafting</a><a href="farming.html">Farming</a><a href="loadouts.html">Loadouts</a><a class="gh" href="https://github.com/xBusterguy/KCDCalculator" target="_blank" rel="noopener noreferrer" title="View the code or report an issue on GitHub">GitHub ↗</a><details class="menu" id="menu"><summary aria-label="Settings: light or dark mode, backup" title="Light/dark mode and backup"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 3a9 9 0 0 1 0 18z" fill="currentColor"/></svg><span class="mlabel">Settings</span></summary><div class="pop"><button id="theme" type="button" aria-label="Switch light or dark mode">Switch to dark</button><hr><button id="bk" type="button">Back up my data</button><button id="rsb" type="button">Restore from backup</button><input id="rs" aria-label="Choose a backup file" type="file" accept=".json,application/json" hidden><p class="s" id="bkmsg">Saves your prices, orders, favourites, loadouts and settings to a file.</p></div></details></nav><main id="main" tabindex="-1"><div class="tbar"><h1>Page not found</h1></div><div class="layout norail"><div class="mc"><p>That page does not exist. <a href="index.html">Go to the home page</a>, or pick a tool: <a href="crafting.html">Crafting</a>, <a href="farming.html">Farming</a> or <a href="loadouts.html">Loadouts</a>.</p></div></div></main><footer class="site"><div class="sig">Made by <b>Busterguy</b> · Found a bug or have an issue? Contact me on <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"/></svg>Discord.</div><div class="sig">Open source: <a href="https://github.com/xBusterguy/KCDCalculator" target="_blank" rel="noopener noreferrer">view the repo</a> or <a href="https://github.com/xBusterguy/KCDCalculator/issues/new/choose" target="_blank" rel="noopener noreferrer">report an issue</a> on GitHub.</div></footer></body></html>
</head><body><a class="skip" href="#main">Skip to content</a><nav class="site"><a class="brand" href="index.html" aria-label="KCD Tools home"><span class="logo">⚒️</span> KCD Tools</a><a href="crafting.html">Crafting</a><a href="farming.html">Farming</a><a href="loadouts.html">Loadouts</a><a href="prices.html">Prices</a><a class="gh" href="https://github.com/xBusterguy/KCDCalculator" target="_blank" rel="noopener noreferrer" title="View the code or report an issue on GitHub">GitHub ↗</a><details class="menu" id="menu"><summary aria-label="Settings: light or dark mode, backup" title="Light/dark mode and backup"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 3a9 9 0 0 1 0 18z" fill="currentColor"/></svg><span class="mlabel">Settings</span></summary><div class="pop"><button id="theme" type="button" aria-label="Switch light or dark mode">Switch to dark</button><hr><button id="bk" type="button">Back up my data</button><button id="rsb" type="button">Restore from backup</button><input id="rs" aria-label="Choose a backup file" type="file" accept=".json,application/json" hidden><p class="s" id="bkmsg">Saves your prices, orders, favourites, loadouts and settings to a file.</p></div></details></nav><main id="main" tabindex="-1"><div class="tbar"><h1>Page not found</h1></div><div class="layout norail"><div class="mc"><p>That page does not exist. <a href="index.html">Go to the home page</a>, or pick a tool: <a href="crafting.html">Crafting</a>, <a href="farming.html">Farming</a> or <a href="loadouts.html">Loadouts</a>.</p></div></div></main><footer class="site"><div class="sig">Made by <b>Busterguy</b> · Found a bug or have an issue? Contact me on <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"/></svg>Discord.</div><div class="sig">Open source: <a href="https://github.com/xBusterguy/KCDCalculator" target="_blank" rel="noopener noreferrer">view the repo</a> or <a href="https://github.com/xBusterguy/KCDCalculator/issues/new/choose" target="_blank" rel="noopener noreferrer">report an issue</a> on GitHub.</div></footer></body></html>
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,4 @@ The button in the top bar reads `changelog.json`. Add a new object at the top of

## Updating the suggested market prices

`assets/market.js` holds a dated snapshot of material prices (groschen) taken from the Auction houses page of the KCDRoleplay account site (the 7-day average sale price). That page needs a game login, so the file is updated by hand: change the numbers under `p` (the keys are the material ids used in `assets/recipes.js`) and set `date`. Prices a visitor types on the site always override these, and a tick box turns the suggestions off.
`assets/market.js` holds a dated snapshot of material prices (groschen) taken from the Auction houses page of the KCDRoleplay account site (the 7-day average sale price). That page needs a game login, so the file is updated by hand: change the numbers under `p` (the keys are the material ids used in `assets/recipes.js`) and set `date`. Prices a visitor types on the Prices page always override these, and a tick box there turns the suggestions off. Groups for the Prices page are set at the top of `assets/pricing.js`; a new raw material lands in “Other” until you add its id to a group.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ Everything runs in your browser. There is no account and nothing is sent anywher
![Crafting cost calculator](docs/screenshots/crafting.png)

- All nine crafts: Smithing, Armouring, Tailoring, Bowyery, Jewelling, Alchemy, Brewing, Cooking and Carpentry (1,211 pieces).
- Enter your material prices and see each piece's cost, bench fee, selling price and profit at your markup.
- See each piece's cost, bench fee, selling price and profit at your markup, using the prices from the Prices page.
- Intermediate parts such as steel, leather and padding are worked out from raw materials, or use your own price.
- Filter by level and by type within each craft (for example Swords, Helmets, Furniture or Lighting), sort by any column, star favourites, and search across every craft.
- Build an order and get a combined shopping list.
- Save named price presets (for example one per town), and share or import price lists as plain text.

## Farming efficiency

![Farming efficiency](docs/screenshots/farming.png)

- Compare every crop by value per hour, value per harvest and value in a time window.
- Set your trade level, whether strips are weeded and watered, how many strips you have, and your own selling prices.
- Set your trade level, whether strips are weeded and watered and how many strips you have. Worth per load uses the same prices as everything else.
- Quick-setup buttons, a top 3 chart, and a note on how every number is worked out.

## Loadout builder
Expand All @@ -40,6 +39,15 @@ Everything runs in your browser. There is no account and nothing is sent anywher
- See what each costs to make and get a shopping list of materials.
- Copy a loadout as text or as a link, or save it as a picture.

## Prices

![Prices page](docs/screenshots/prices.png)

- One page for every material price the calculators use (124 materials, plus hemp fibre for Farming), grouped as ores, timber, hunt, herbs, farm and food, fish, rare finds and parts you can craft.
- Type your own price, or leave it empty to use the auction house average (`assets/market.js`). Each row shows which one the calculators use and how many pieces need it.
- Show only the prices you set, the ones still missing, or what your current order needs.
- Save named price sets (for example one per town), and share or bring in price lists as plain text.

## Everywhere

![The guided tour highlighting a feature](docs/screenshots/tour.png)
Expand Down Expand Up @@ -82,11 +90,13 @@ index.html home page
crafting.html crafting cost calculator
farming.html farming efficiency
loadouts.html loadout builder
prices.html the Prices page: every material price in one place
404.html page not found
assets/site.css the look shared by every page: colours, top bar, title bar, left rail (edit styles here)
assets/site.js shared behaviour: light/dark, backup and restore, loading feedback, offline copy and updates
assets/recipes.js every crafting recipe (edit recipes here only)
assets/market.js suggested material prices from the auction houses (dated snapshot)
assets/pricing.js shared price logic: groups, your price vs market, worked-out parts (used by Prices, Farming and the price line)
assets/categories.js how the crafting page groups pieces into types (Swords, Helmets, Furniture...)
assets/tour.js the guided tour (one list of steps, edit the text there)
changelog.json the list shown by the What's new button (add new entries at the top)
Expand Down
2 changes: 1 addition & 1 deletion assets/market.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const MARKET={date:"2026-11-16",src:"KCDRoleplay auction houses, 7-day average s
O:6,C:2,K:8,A:50,G:19,L:6,H:14,N:4,R:9,W:8,F:26,V:2510,P:347,U:923,M:2989,D:6,E:6,T:15,
charcoal:3,cobwebs:3,tusks:11,yew:608,rantlers:83,rcrystal:25,barley:9,hops:5,grapes:5,honey:9,amber:104,oak:44,aseeds:83,plums:5,
chamomile:4,sage:4,belladonna:11,ginger:26,elder:4,mandrake:6,amandrake:58,flax:7,hay:6,carrots:6,egg:5,roach:3,onions:8,cabbage:8,
hare:4,milk:14,chicken:2,venison:4,carp:6,eel:8,pike:11,boar:6}};
hare:4,milk:14,chicken:2,venison:4,carp:6,eel:8,pike:11,boar:6,hempf:5}};
94 changes: 94 additions & 0 deletions assets/pricing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Shared material prices: the one place that knows what a material costs.
// Needs assets/recipes.js (RAW, INT, DATA, CR) and assets/market.js (MARKET) loaded first.
// Used by the Prices page (where prices are entered), Farming (worth per load) and the
// price summary line on Crafting and Loadouts. Prices live in localStorage "kcd-p"; the
// "use market prices" switch is "sg" inside "kcd-s".
window.KP = (function () {
"use strict";
// Goods that no recipe uses but Farming sells, so they can be priced too
var EXTRA = { hempf: "Hemp fibre" };
// Farming crop name -> material id
var CROP = { Cabbage: "cabbage", Carrots: "carrots", Onions: "onions", Barley: "barley", Hay: "hay", Hops: "hops", Grapes: "grapes", Plums: "plums", Sage: "sage", Chamomile: "chamomile", "Hemp fibre": "hempf", Flax: "flax" };
var G = [
["ores", "Ores & metals", "O C K A G U M D E Z"],
["timber", "Timber & fuel", "L R X oak yew charcoal"],
["hunt", "Hunt & hides", "H F V T W Q tusks rantlers hare venison boar wmeat wheart"],
["herbs", "Herbs & mushrooms", "N mint wormwood chamomile sage thistle dandelion belladonna valerian wort eyebright poppy ginger marigold comfrey feverfew elder mandrake amandrake boletus lepiota cobwebs"],
["farm", "Farm & food", "barley hops grapes honey plums flax hay hempf apple pear beet carrots egg onions cabbage garlic pork milk horseradish chicken mutton beef ptender btender bkidney btongue pliver sstomach aseeds"],
["fish", "Fish", "carp eel pike roach"],
["rare", "Rare finds", "P amber rcrystal J u v brokenaxe"]
];
var GROUP = {}, GROUPS = [];
G.forEach(function (g) { GROUPS.push({ id: g[0], name: g[1] }); g[2].split(" ").forEach(function (id) { GROUP[id] = g[0]; }); });
Object.keys(RAW).forEach(function (id) { if (!GROUP[id]) GROUP[id] = "other"; });
if (Object.keys(RAW).some(function (id) { return GROUP[id] === "other"; })) GROUPS.push({ id: "other", name: "Other" });
Object.keys(INT).forEach(function (id) { GROUP[id] = "parts"; });
GROUPS.push({ id: "parts", name: "Parts you can craft" });

var name = function (id) { return RAW[id] || EXTRA[id] || (INT[id] && INT[id][0]) || id; };
var ids = Object.keys(RAW).concat(Object.keys(EXTRA), Object.keys(INT));

// How many recipe lines (counting each name variant) use each material
var USED = {};
(function () {
var RX = /\{(\w+)\}(\d+)|([A-Za-z])(\d+)/g;
DATA.split("\n").forEach(function (l) {
var p = l.split("|"); if (p.length < 5) return; var n = p[2].split(";").length;
p[4].replace(RX, function (m, w, a, k) { var id = w || k; USED[id] = (USED[id] || 0) + n; return m; });
});
Object.keys(INT).forEach(function (k) { for (var r in INT[k][2]) USED[r] = USED[r] || 0; });
})();
var FARMED = {}; Object.keys(CROP).forEach(function (c) { FARMED[CROP[c]] = c; });

var load = function (k, d) { try { var v = JSON.parse(localStorage.getItem(k)); return v && typeof v === "object" && !Array.isArray(v) ? v : d; } catch (e) { return d; } };
var P, sg, C = {};
function read() {
P = load("kcd-p", {}); var st = load("kcd-s", {}); sg = st.sg == null ? true : !!st.sg; C = {};
}
read();
var ov = function (id) { return P[id] !== undefined && P[id] !== "" && !isNaN(parseFloat(P[id])); };
var mkt = function (id) { return (MARKET.p && MARKET.p[id]) || 0; };
var sug = function (id) { return sg ? mkt(id) : 0; };
function unit(id) {
if (id in C) return C[id];
C[id] = 0; // guards against a loop in the data
var v;
if (ov(id)) v = Math.max(0, parseFloat(P[id]) || 0);
else if (INT[id]) { var r = INT[id][2], s = 0; for (var k in r) s += r[k] * unit(k); v = (s + (INT[id][3] || 0)) / INT[id][1]; }
else v = sug(id);
return (C[id] = v);
}
// "yours", "market", "worked out" or "missing"
function source(id) {
if (ov(id)) return "yours";
if (INT[id]) { var r = INT[id][2]; for (var k in r) if (source(k) === "missing") return "missing"; return "worked out"; }
return sug(id) ? "market" : "missing";
}
var tm;
function save() { clearTimeout(tm); tm = setTimeout(function () { try { localStorage.setItem("kcd-p", JSON.stringify(P)); } catch (e) {} }, 200); }
function flush() { clearTimeout(tm); try { localStorage.setItem("kcd-p", JSON.stringify(P)); } catch (e) {} }
function set(id, v) { v = String(v == null ? "" : v).trim().replace(",", "."); if (v === "" || isNaN(parseFloat(v)) || parseFloat(v) < 0) delete P[id]; else P[id] = v; C = {}; save(); }
function setAll(o) { P = {}; for (var k in o) if (ids.indexOf(k) >= 0 && !isNaN(parseFloat(o[k])) && parseFloat(o[k]) >= 0) P[k] = String(o[k]); C = {}; flush(); }
function setSg(v) { sg = !!v; C = {}; var st = load("kcd-s", {}); st.sg = sg; try { localStorage.setItem("kcd-s", JSON.stringify(st)); } catch (e) {} }
function mine() { var o = {}; for (var k in P) if (ov(k)) o[k] = P[k]; return o; }
// Counts over raw goods that something actually uses
function stats() {
var y = 0, m = 0, x = 0;
Object.keys(RAW).concat(Object.keys(EXTRA)).forEach(function (id) {
if (!USED[id] && !FARMED[id]) return;
if (ov(id)) y++; else if (sug(id)) m++; else x++;
});
Object.keys(INT).forEach(function (id) { if (ov(id)) y++; });
return { yours: y, market: m, missing: x };
}
function marketDate() { var d = new Date(MARKET.date + "T12:00:00"); return isNaN(d) ? MARKET.date : d.toLocaleDateString("en-GB", { day: "numeric", month: "short" }); }
// Name lookup for imports ("Iron ore = 7")
var BYNAME = {}; ids.forEach(function (id) { BYNAME[name(id).toLowerCase()] = id; });

return {
EXTRA: EXTRA, CROP: CROP, GROUPS: GROUPS, GROUP: GROUP, USED: USED, FARMED: FARMED, BYNAME: BYNAME,
ids: ids, name: name, ov: ov, mkt: mkt, sug: sug, unit: unit, source: source,
set: set, setAll: setAll, setSg: setSg, mine: mine, stats: stats, read: read, flush: flush, marketDate: marketDate,
get P() { return P; }, get sg() { return sg; }
};
})();
Loading
Loading